2016-02-20 21 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

相關問題