Home / docs / UnboundLocalError: local variable ‘name’ referenced before assignment

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:

Check Also

Real-time 3D plot in python

Python: Creating a real-time 3D plot

Python: Creating a real-time 3D plot updated: 31-01-2019 To create a real-time 3D plot from …

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: