I created a classification model with both saved_model format and .h5 format. I am trying to load the model so I can deploy it with
new_model = tf.keras.models.load_model('my_model.h5')
Then I predict
print(new_model.predict('/content/images/image.jpg'))
Then it returns
> IndexError Traceback (most recent call last)
<ipython-input-26-749bd8c0774b> in <module>()
1 new_model = tf.keras.models.load_model('my_model.h5')
----> 2 print(new_model.predict('/content/images/image.jpg'))
>5 frames
>/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/tensor_shape.py in __getitem__(self, key)
887 else:
888 if self._v2_behavior:
--> 889 return self._dims[key].value
890 else:
891 return self._dims[key]
>IndexError: list index out of range
I've tried other similar solutions but they don't work. Do I need to retrain the model? What do I do so I can predict on one image in a clean environment?