Get imagenet labels in vgg

Hi everyone,

Quick question: how do you get the class labels for the out-the-box vgg model?

I know you can get the class predictions and we built a linear model on top of those but how can I get the imagenet labels corresponding to those 1000 predictions?

You can use the decode_predictions function in keras.appications.vgg16 or else you can download the imagenet_class_index.json file and then find the predicted class.

https://keras.io/applications/ has an example where you can look on how to use the decode_predictions function.

Thanks for your reply

I think the vgg model is implemented from scratch rather than using the built-in keras implementation.

In any event, I looked at Jeremy’s vgg class and noticed there’s a rather obvious call get_classes() which assigns self.classes so you can access the classes with vgg.classes :slight_smile: