UnboundLocalError: local variable ‘name’ referenced before assignment

UnboundLocalError: local variable ‘name’ referenced before assignment

When I was loading a saved keras model, I was getting an error: UnboundLocalError: local variable ‘name’ referenced before assignment. I had saved a model in Keras using:

when I was trying to load the model, using:

I was getting error:

I was using keras version 2.2.3 (latest), and I was also getting same output for all images, my code to predict the classifier on a test image is:

no matter what image I feed to the network to predict from a saved model, I was always getting [[1.]] output.

Advertisements

Solution:

change Keras version. I downgraded to 2.2.2 using:

 

Now after executing:

 

 

Related Links:

Leave a Reply