Keras Predict_classes Method Returns "list Index Out Of Range" Error
I am new to CNN and machine learning in general and have been trying to follow Image Classification tutorial of TensorFlow. Now, the Google Colab can be found here. I've followed t
Solution 1:
All the predict functions in Keras expect batch of inputs. Therefore, since you are doing prediction on one single image, you need to add an axis at the beginning of image tensor to represent the batch axis:
image = tf.expand_dims(image, axis=0) # the shape would be (1, 224, 224, 3)
print(model.predict_classes(image)[0])
Baca Juga
- How To Convert Rgb Images To Grayscale, Expand Dimensions Of That Grayscale Image To Use In Inceptionv3?
- Typeerror: '>' Not Supported Between Instances Of 'nonetype' And 'float'
- I Use Tfliteconvert Post_training_quantize=true But My Model Is Still Too Big For Being Hosted In Firebase Ml Kit's Custom Servers
Post a Comment for "Keras Predict_classes Method Returns "list Index Out Of Range" Error"