# Keras : get back labels from a model

I have a saved keras model. How can I get back the labels from the model ?

Because right now, I can use the predict method to get back the probability for a sample to belong to a certain class e.g. class 1, 2, 3.

But how can I know what class 1, 2, 3 correspond to in the model e.g. cat, dog, bird ?

• the labels are not loaded with the model, so if you don't have any information of the model, you have no way to get the labels. If you have information about it, then Олег answer is right. There is also a method 'decode_prediction' in keras.applications.imagenet_utils that return a dict with label for IMAGENET – Jérémy Blain Oct 11 '18 at 13:02
• Ok. This is what I feared. Thanks for confirming my feeling. – FenryrMKIII Oct 11 '18 at 14:10

You can use the argmax function to get the class labels. Please refer to this link for more information. Hope this answers your question.
Create list of labels ["dog", "cat"] and use argmax as index to get value from list.