I was trying to apply transfer learning to the InceptionV3. Here is my code:
inception_model = InceptionV3(weights='imagenet',include_top=False)
output_inception = inception_model.output
output_globalavgpooling = GlobalAveragePooling2D()(output_inception)
output_dense = Dense(1024,activation='relu')(output_globalavgpooling)
predictions = Dense(1,activation='sigmoid')(output_dense)
final_model = Model(inception_model.input,output=predictions)
final_model.compile()
inception_model.summary()
When I run this code I am getting following error at the final_model = Model(inception_model.input,output=predictions)
line:
TypeError: Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ref() as the key.
What should I do?
I had a similar error. In my case it was due to using an old version of Keras and Tensorflow 2 from conda. There currently is some issues preventing the use of Tensorflow 2 with current Keras via conda.
I created a new environment and installed using according to the Keras/Tensorflow websites (CPU only version in my case):
pip install tensorflow
pip install keras
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With