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.
6405 Discussions

float 16 or 32 ? about py_examples/classification_example.py

idata
Employee
998 Views

I examined ncapi/py_examples/classification_example.py

 

As a input data, image data was converted to float16 data.

 

graph.LoadTensor(img.astype(numpy.float16), 'user object') # <- sample cord

 

this is ok, I got correct result

 

prediction 1 is n02123045 tabby, tabby cat

 

prediction 2 is n02124075 Egyptian cat

 

prediction 3 is n02127052 lynx, catamount

 

prediction 4 is n02123394 Persian cat

 

prediction 5 is n02971356 carton

 

when I use "graph.LoadTensor(img.astype(numpy.float32), 'user object')",

 

I got wrong result NAN array.

 

But original caffemodel (bvlc_alexnet.caffemodel) uses float32 data.

 

Does the network converted from float32 calculation model to float16, when compiled? (with mvNCCompile.pyc)

 

Is there a way to calculate it with float32?
0 Kudos
4 Replies
idata
Employee
726 Views

@skymapnote The NCS is designed to use float16 input data, so when using mvNCCompile.pyc to compile a network for use with the NCS, the resulting graph file expects float16 input data. This results in having to convert your input data to half precision float 16 values before calling LoadTensor in your inference application.

0 Kudos
idata
Employee
726 Views

@Tome_at_Intel according to https://uploads.movidius.com/1463156689-2016-04-29_VPU_ProductBrief.pdf myriad2 supports half- and full-precision for both integer and float operation - why is NCS limited to half?

0 Kudos
idata
Employee
726 Views

@macsz Hi macsz. We made a product decision to support only half precision floats for the NCS in order to optimize the NCS for accuracy, power and performance.

0 Kudos
idata
Employee
726 Views

@Tome_at_Intel thank you for the answer :)

0 Kudos
Reply