I am new to image classification and sorry if this problem seems too naive. I am using tf transfer learning model for my recent work. Ref: https://www.tensorflow.org/tutorials/images/transfer_learning.
Here there is clear mention of how to use this model to prediction on batch prediction for images. But i am having a hard time figuring out how to do prediction for single image using this.
I tried with this:
np_image = Image.open(image_path)
np_image = np.array(np_image).astype('float32')/255
np_image = transform.resize(np_image, (800, 700, 3))
np_image = np.expand_dims(np_image, axis=0)
probability_model = tf.keras.Sequential([model, tf.keras.layers.Softmax()])
predictions = probability_model.predict_proba(np_image)
But this is giving 1 as result for all images. I want probability prediction at an image level using this model.
Got a solution for this problem.