- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@pashmina.bendale Thanks for bringing this to our attention. We are incorporating a fix for this into the next SDK release.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page