TransWikia.com

How to find the class name of a new image from the pre-trained model

Data Science Asked on October 1, 2021

I would just like to get the class names of the predictions. I can get the class names on the images that I trained the model. But if I predict an image (say which is not trained but already belongs to the pre-trained model (VGG16) I cannot get its class name).

My scenario:
I used VGG16 pre-trained and added new datasets (like logos, stars, hills etc which are not present in VGG16 (say) )

Now I trained this model in those datasets, when i predicted an image, it gave the correct class-name (logos, stars, hills etc..)

But when I predict an image that was already in VGG16 (say Dog, Cat), it is not giving me the right class name i.e Dog, Cat etc.

I need some help in this scenario.

Is there any way to get the get the class name?

One Answer

In the original training session, there will have been the mapping between class name and numerical class ID (e.g. Cat = 0, Dog = 1, ...). The model you use will output just the IDs and you need to find the mapping that was used.

If your new data has been added in addition to the old classes, they should each have a new unique ID. If you used VGG architecture to train on your new classes from scratch, then the model will not be able to make predictions for the original VGG classes.

Answered by n1k31t4 on October 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP