Get predicted class in Keras Sequential Model

Get predicted class 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) 

Author: Manoj

Developer and a self-learner, love to work with Reactjs, Angular, Node, Python and C#.Net

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.