Get predicted class name in Keras Sequential Model
In Keras Sequential Model problems we can get predicted result as output. As a beginner you may note that it is not what you expected. So how do we get the actual label for that image.?
In image classification we get a predicted result which is pointed to corresponding label.
In such a case use the NumPy's argmax function.
img_class = model.predict(test_img)
prediction = img_class[0]
className = np.argmax(prediction, axis=-1)
print("Class : ",className)
prediction = img_class[0]
className = np.argmax(prediction, axis=-1)
print("Class : ",className)
Comments
Post a Comment