I have the output Tensor of a forward pass for a Facebook implementation of the ResNet model with a cat image. That is a 1000-dimensional Tensor with the classification probabilities. Using torch.topk I can obtain the top-5 probabilities and their indexes in the output tensor. Now I want to see the human-readable labels for those most-probable indexes.
I searched online for the list of labels (which apparently are also called sysnets) and only found this: http://image-net.org/challenges/LSVRC/2015/browse-synsets
I put those labels in a file using line numbers as the label index and when I run the network with two different cat images, I get "screwdriver" as the top guess for both. If I sort the label file alphabetically, I get "cinema" for both.
This appears to be a problem with converting index to label, right? So...the question is: How can I properly map index in network output tensor to Imagenet label?
Found this tutorial on training ConvNets on ImageNet by Dato and at the end it contains the correct mapping. Reporting it here for the record:
Full mapping here: https://gist.github.com/maraoz/388eddec39d60c6d52d4