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.

Issues in classification example

idata
Employee
1,233 Views

This affects ncapi/py_example/classification_examples.py in MvNC_SDK_1.07.06.tgz and MvNC_SDK_1.07.07.tgz

 

Issue 1:

 

There seems to be an off-by-one error in interpreting the classification results. The best result is discarded and second to sixth result is shown instead of top-5.

 

I had to change

 

output, userobj = graph.GetResult() order = output.argsort()[::-1][:6] print('\n------- predictions --------') for i in range(1,6): print ('prediction ' + str(i) + ' is ' + labels[order[i]])

 

to

 

output, userobj = graph.GetResult() order = output.argsort()[::-1][:5] print('\n------- predictions --------') for i in range(0,len(order)): print ('prediction ' + str(i+1) + ' is ' + labels[order[i]])

 

to get it show the top-5 classification results. This seems correct in the example in the toolkit example (bin/examples/top5_over_a_dataset.py).

 

Issue 2:

 

The path to a mean file needs to be updated. The file points to ilsvrc_2012_mean.npy which was not present. The closest match I found was bin/data/imagenet_mean.npy.

 

I had to change the line

 

ilsvrc_mean = numpy.load('../mean/ilsvrc12/ilsvrc_2012_mean.npy').mean(1).mean(1)

 

to

 

ilsvrc_mean = numpy.load('../../bin/data/imagenet_mean.npy').mean(1).mean(1)

 

to make this work. Pointing to any valid imagenet mean file that is present on the system will likely also work. (I had some problems with installation, which now appear fixed, so the file may exist for other users.)

 

Has anyone else seen these?

0 Kudos
4 Replies
idata
Employee
940 Views

The mean file changes above were needed in my case because I had issues when running convert_mean.py via get_models.sh. Creation of mean/ilsvrc12 folder failed.

 

I had to create the mean/ilsvrc12 folder manually (and remove references to the age/gender models) and then run convert_mean.py to create /ncapi/mean/ilsvrc12/ilsvrc_2012_mean.npy

 

After the above file is created, I can revert the line in classification_example to the original

 

ilsvrc_mean = numpy.load('../mean/ilsvrc12/ilsvrc_2012_mean.npy').mean(1).mean(1)

 

and run classification_example.py successfully.

0 Kudos
idata
Employee
940 Views

In ncapi/tools/convert_mean.py, replacing

 

os.system('mkdir ../mean/ilsvrc12')

 

with

 

os.makedirs('../mean/ilsvrc12')

 

fixes the issue related to mean file (ilsvrc_2012_mean.npy) being missing.
0 Kudos
idata
Employee
940 Views

Same issue and your last suggestion worked! Thank you.

 

In addition, I had to add this to the top of the script or else it hangs: #!/usr/bin/python3

0 Kudos
idata
Employee
940 Views

@pashmina.bendale Thanks for bringing this to our attention. We are incorporating a fix for this into the next SDK release.

0 Kudos
Reply