Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

classification_sample labels file

Ashwin_V_Intel
Employee
11,290 Views

Hi,

OpenVINO's classification_sample.py sample code has a --labels flag that expects a .labels extension file. I suspect it is similar to the --labels flag of NCSDK's image-classifier sample code, which takes a .txt file and prints a human readable sysnset word instead of the class number. Where can I find the .labels file for OpenVINO's pre-trained or public models (downloaded by downloader.py)?

Thanks

Ashwin

0 Kudos
1 Solution
Ashwin_V_Intel
Employee
11,290 Views

Hi Monique,

Thank you for the prompt response. Looks like squeezenet.labels is a renamed version of sysnset_words.txt found in http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz. I would recommend updating the downloader.py script to download the corresponding labels when any model is downloaded.

For those who stumble across this post, here's what I did:

Results of running a sample code without the --labels option:

licensedgeek@intelai: python3 classification_sample.py -m ~/intel/computer_vision_sdk/deployment_tools/model_downloader/classification/googlenet/v1/caffe/googlenet-v1.xml -i Mackerel-tabby-750x441.jpg -d MYRIAD

0.4785156 label #281
0.2106934 label #285
0.2073975 label #282
0.0485840 label #287
0.0055351 label #761
0.0034733 label #478
0.0033455 label #700
0.0026646 label #283
0.0022964 label #673
0.0022335 label #750

Results of running with the --labels option:

licensedgeek@intelai: python3 classification_sample.py -m ~/intel/computer_vision_sdk/deployment_tools/model_downloader/classification/googlenet/v1/caffe/googlenet-v1.xml -i Mackerel-tabby-750x441.jpg -d MYRIAD --labels ~/intel/computer_vision_sdk/deployment_tools/model_downloader/classification/googlenet/v1/caffe/googlenet-v1.labels

0.4785156 label tabby, tabby cat
0.2106934 label Egyptian cat
0.2073975 label tiger cat
0.0485840 label lynx, catamount
0.0055351 label remote control, remote
0.0034733 label carton
0.0033455 label paper towel
0.0026646 label Persian cat
0.0022964 label mouse, computer mouse
0.0022335 label quilt, comforter, comfort, puff

How did I get googlenet-v1.labels?

Well, OpenVINO doesn't [yet] ship with labels file for all supported models, so I pulled the ILSVRC2012 sysnset_words.txt from http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz and renamed it as googlenet-v1.labels. Note that the ILSVRC2012 synset_words.txt won't work for GoogLeNet V2 since V2 was trained on ILSVRC2015, you'd have to fetch the 2015 labels file when running GoogLeNet V2.

 

View solution in original post

11 Replies
Monique_J_Intel
Employee
11,290 Views

Hi Ashwin,

You are correct. The labels file is in the following path once you've run the demo_squeezenet $HOME/openvino_models/ir/squeezenet1.1/squeezenet.labels.

Kind Regards,

Monique Jones

 

0 Kudos
Ashwin_V_Intel
Employee
11,291 Views

Hi Monique,

Thank you for the prompt response. Looks like squeezenet.labels is a renamed version of sysnset_words.txt found in http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz. I would recommend updating the downloader.py script to download the corresponding labels when any model is downloaded.

For those who stumble across this post, here's what I did:

Results of running a sample code without the --labels option:

licensedgeek@intelai: python3 classification_sample.py -m ~/intel/computer_vision_sdk/deployment_tools/model_downloader/classification/googlenet/v1/caffe/googlenet-v1.xml -i Mackerel-tabby-750x441.jpg -d MYRIAD

0.4785156 label #281
0.2106934 label #285
0.2073975 label #282
0.0485840 label #287
0.0055351 label #761
0.0034733 label #478
0.0033455 label #700
0.0026646 label #283
0.0022964 label #673
0.0022335 label #750

Results of running with the --labels option:

licensedgeek@intelai: python3 classification_sample.py -m ~/intel/computer_vision_sdk/deployment_tools/model_downloader/classification/googlenet/v1/caffe/googlenet-v1.xml -i Mackerel-tabby-750x441.jpg -d MYRIAD --labels ~/intel/computer_vision_sdk/deployment_tools/model_downloader/classification/googlenet/v1/caffe/googlenet-v1.labels

0.4785156 label tabby, tabby cat
0.2106934 label Egyptian cat
0.2073975 label tiger cat
0.0485840 label lynx, catamount
0.0055351 label remote control, remote
0.0034733 label carton
0.0033455 label paper towel
0.0026646 label Persian cat
0.0022964 label mouse, computer mouse
0.0022335 label quilt, comforter, comfort, puff

How did I get googlenet-v1.labels?

Well, OpenVINO doesn't [yet] ship with labels file for all supported models, so I pulled the ILSVRC2012 sysnset_words.txt from http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz and renamed it as googlenet-v1.labels. Note that the ILSVRC2012 synset_words.txt won't work for GoogLeNet V2 since V2 was trained on ILSVRC2015, you'd have to fetch the 2015 labels file when running GoogLeNet V2.

 

Monique_J_Intel
Employee
11,290 Views

Hi Ashwin,

I agree with you and i'll see what can be done on this. Thanks for your feedback!

Kind Regards,

Monique Jones

0 Kudos
Bellet__Vincent
Beginner
11,290 Views

hey,

I cannot find the labels for googlenet v2. any ideas where to dowload it ?

it seems strange to me that openvino download the model without the coresponding labels...

thanks in advance

0 Kudos
Jeehyun_P_Intel
Employee
11,290 Views

Hello, 

I'm wondering that where we can get the label for the alexnet as well.

Any information would be appreciated.

0 Kudos
nikos1
Valued Contributor I
11,290 Views

Hi Jeehyun,

The Alexnet seems to be trained on Imagenet so it should be the same 1000 class names as above

https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet

Could you try and let us know?

Thanks!

0 Kudos
han__qroguekid
Beginner
11,290 Views

Hi Intel,

    I would like to evaluate some modles related to classification that in the list_topologies.yml, but only one label called squeezenet.labels in the openvino toolkits. It only helpful when I evaluate squeezenet & alexnet and output wrong results when I evaluate another model like mobilenet, resnet, etc. Would you give me some advice to evaluate another models like to obtain the corresponding labels for each model?

Thanks.

qroguekid

 

0 Kudos
Shubha_R_Intel
Employee
11,290 Views

Dear han, qroguekid,

For other classification models (for instance Resnet50) you should be able to search the internet for the associated labels and annotation files. But labels and annotation are not associated with the models, they are associated with the dataset which was used to train the models, for instance Coco, ImageNet, etc...

Intel is not the keeper of the ground truth labels and annotation files.

Hope it helps,

Thanks,

Shubha

0 Kudos
STyur
New Contributor I
11,290 Views

I found labels for AlexNet  -

https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a

 

cat7.bmp

Image pics\cat7.bmp

classid probability
------- -----------
283: 'Persian cat',0.9883202
287: 'lynx, catamount',0.0048525
728: 'plastic bag',0.0024846
285: 'Egyptian cat',0.0010755
332: 'Angora, Angora rabbit',0.0009068
282: 'tiger cat',0.0007492
279: 'Arctic fox, white fox, Alopex lagopus',0.0004699
281: 'tabby, tabby cat',0.0004684
331: 'hare',0.0001679
904: 'window screen',0.0001299

 

0 Kudos
Benguigui__Michael
2,063 Views

Hi all .. Is there a way to display all classes results (in that case, the 1000 probas of each image) when using classification_sample_async ?

++

0 Kudos
Benguigui__Michael
2,050 Views

The "-nt"  option does the job ... but its description could be updated from "Number of top results" to "Number of top classification results for per image".

0 Kudos
Reply