Skip to content

What is the relationship between the output label of pretrained model in model zoo and wordnet synset id? #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
imkzh opened this issue May 2, 2018 · 8 comments

Comments

@imkzh
Copy link

imkzh commented May 2, 2018

we can easily access pytorch pre-trained model like VGG, AlexNet and SqueezeNet by

import torchvision 
torchvision.models.vgg16(pretrained=True)

can anyone point out what's the relationship between the output label(index of maximum output value) and the actual category?

i downloaded ILSVRC2012_devkit_t12 and got the imagenet id and other metainfo provided by meta.mat, however it seems pre-trained model have some different id. because when i evaluate the network with ILSVRC2012 validation set, it reports 100% error.

@Cadene
Copy link

Cadene commented May 2, 2018

You can find an example here.

You will need two files:

@imkzh
Copy link
Author

imkzh commented May 5, 2018

Thank you for your help, they are exactly what i need, as torchvision modules itself didn't provide any documentations on this.

@fmassa
Copy link
Member

fmassa commented May 9, 2018

I think we should provide somewhere the mapping between the class names and the indices. Not sure if it should be in pytorch/examples or in torchvision. What do you think?

@imkzh
Copy link
Author

imkzh commented May 9, 2018

That's great! i think it will be torchvision to provide those mapping, and pytorch/examples to have some example on it. 😀 am i too greedy?

@fmassa
Copy link
Member

fmassa commented Aug 3, 2018

I think this totally make sense to provide this mapping.
I'll think about a good way of doing it, maybe making a base class TorchvisionModel, that contains the basic pre-processing parameters that are used for all the models, as well as the image synset.

@theoptips
Copy link

+1 would appreciate a model.class_ method or model.labels_ kind of like sklearn. Developers can easily see the mapping between output labels and index. May be this feature already exists? Would love to know how to do it. Thanks!

@NizarTarabay
Copy link

Thank you for your help, they are exactly what i need, as torchvision modules itself didn't provide any documentations on this.
How did you manage to make it work, even with these two text files there still a discrepancy between the output predicted labels and the imagenet validation dataset.
I am using Squeezenet to predict the validation classes on ILSVRC2012. The pretrained model seems working well, however, the accuracy is 0!

@stared
Copy link

stared commented Jun 10, 2019

I think that class names (i.e. a map idx -> class name) are an integral part of any pre-trained classifier. Would a PR with class names be welcome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants