Skip to main content

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)

Comments

Popular posts from this blog

Build a Flask-Python web App

Building a dynamic website made so easy with Python -Flask, a Micro FrameWork which helps us to create the websites like Twitter and even more. Forget about the complicated web programming languages, start learning Python. So where you start, Python or Flask ?. I should say, you have to learn basics of how Python first, just have a look at Python.org

Using Image url in Keras image classification

  How to load an image in Keras for machine learning from a url ?