2016-02-20 23 views
1

我使用猫图像获得a Facebook implementation of the ResNet model的正向传递的输出张量。这是一个具有分类概率的1000维张量。使用torch.topk我可以获得输出张量中的前5个概率及其指数。现在我想看看那些最可能的索引的人类可读标签。在火炬的1000维输出张量中为特定索引获取ImageNet标签

我在网上搜索了标签的列表(这显然也称为sysnets),只有发现这一点: http://image-net.org/challenges/LSVRC/2015/browse-synsets

我把这些标签在文件中使用的行号为标签索引,当我运行网络上有两个不同的猫咪图像,我得到“螺丝刀”作为两者的首选猜测。如果我按字母顺序排列标签文件,那么我会为两者获得“电影”。

这似乎是索引转换为标签的问题,对吧? 所以...问题是: 如何正确映射网络输出张量中的索引到Imagenet标签?

+1

这将是一个很好的问题要问的库GitHub的问题 – smhx

回答

1

找到this tutorial on training ConvNets on ImageNet by Dato并在最后它包含正确的映射。此处报告,备案:

{ 
0: 'tench, Tinca tinca', 
1: 'goldfish, Carassius auratus', 
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', 
3: 'tiger shark, Galeocerdo cuvieri', 
4: 'hammerhead, hammerhead shark', 
5: 'electric ray, crampfish, numbfish, torpedo', 
6: 'stingray', 
7: 'cock', 
8: 'hen', 
9: 'ostrich, Struthio camelus', 
10: 'brambling, Fringilla montifringilla', 
... [truncated for space] 
990: 'buckeye, horse chestnut, conker', 
991: 'coral fungus', 
992: 'agaric', 
993: 'gyromitra', 
994: 'stinkhorn, carrion fungus', 
995: 'earthstar', 
996: 'hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa', 
997: 'bolete', 
998: 'ear, spike, capitulum', 
999: 'toilet tissue, toilet paper, bathroom tissue' 
} 

完全映射在这里:https://gist.github.com/maraoz/388eddec39d60c6d52d4

相关问题