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 Determine The Learning Rate And The Variance In A Gradient Descent Algorithm?
- Why Is It In Pytorch When I Make A Copy Of A Network's Weight It Would Be Automatically Updated After Back-propagation?
- Why The Model Is Training On Only 1875 Training Set Images If There Are 60000 Images In The Mnist Dataset?
Post a Comment for "Keras Predict_classes Method Returns "list Index Out Of Range" Error"