I have created an image classifier using keras and I am trying to use model.predict()
for a single image. My code looks like this:
path = 's.jpg'
from keras.preprocessing import image
img_width, img_height = 224,224
img = image.load_img(path, target_size = (img_width, img_height))
img = image.img_to_array(img)
img = np.expand_dims(img, axis = 0)
a =model.predict(img)
But the output array 'a' with probability scores is always in descending order. Do you have any idea why?? I have three categories.
The predict returns class probability, [class1_prob, class2_prob, ....]
assuming you have softmax
in your model.
It should not be always decreasing unless you pass such data so that for which the class probability is always in decreasing order.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.