I have 2 categories of classes Dogs and cats. I've made a list for these categories:
labels = ["cats", "dogs"]
I've tried using
pred_name = labels[np.argmax(prob)]
to show me the label. But I have a problem with model.predict(img).
It only shows me 1. instead of array [0. 1.].
import cv2
import numpy as np
img = cv2.imread('D:cat.jpg')
img = cv2.resize(img,(150,150))
img = np.reshape(img,[1,150,150,3])
labels=["cats", "dogs"]
classes = model.predict_classes(img)
print(classes)
prob=model.predict(img)
print("%.2f" % prob)
pred_name = labels[np.argmax(prob)]
print(pred_name)
i want my model.predict shows me an array ([0. 1.] or [1. 0.]) instead of just a single number 0 or 1, so I can apply the array into argmax.
thank you in advance.