I am testing the v2 of the python API for tensorflow models and found out an error compared to the tutorial.
Indeed, in tutorial, it is asked to use this function as follow:
graph.queue_inference_with_fifo_elem(input_fifo, output_fifo, input_tensor, None, 'object1')
But this raise the following error:
TypeError: queue_inference_with_fifo_elem() takes 5 positional arguments but 6 were given
Looking at the queue_inference_with_fifo_elem() it looks like the None argument shouldn't be set up.
So using the function without the None kind of work because now, it raises this error:
which is weird because the size of the input is: (1, 299, 299, 3)
When I Compile the graph I use:
mvNCCompile output/inception-v3.meta -in input -on InceptionV3/Logits/AvgPool_1a_8x8/AvgPool -o test.graph -is 299 299
This gives me as output:
shape: (1, 299, 299, 3)
res.shape: (1, 1, 1, 2048)
TensorFlow output shape: (1, 1, 2048)
As you might see, I'm simply using inception_v3 as provided by ncappzoo so nothing very specific except the output which is not the softmax.
So it looks like the input length is ok right?
If you have any advice on this I'll take it :)
@malonzo I was able to generate the graph file using the command you provided. However I was unable to experience the same error
Exception: Status.INVALID_DATA_LENGTH. Can you provide a link to your code so that I can reproduce your issue (saves me a lot of time!) and help you debug the error? Thanks.
Thank you for the feedback,
Here are the files.
I call ncs2_inception_v3.py --graph=test2.graph:
Here is the complete output that I have:
E: [ 0] ncFifoWriteElem:2370 input tensor length (2145624) doesnt match expected value (1072812)
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp
Traceback (most recent call last):
File "ncs2_inception_v3.py", line 88, in
graph.queue_inference_with_fifo_elem(inputs, outputs, numpy_final,'object2')
File "/usr/local/lib/python3.6/dist-packages/mvnc/mvncapi.py", line 757, in queue_inference_with_fifo_elem
FATAL: exception not rethrown
Abandon (core dumped)
For better reproducibility, I installed ncsdk2 on ubuntu18.04 by changing the 1604 value in the install.sh
I have python 3.6 in a virtual_env but the sdk install was made on the system.
@malonzo Looks like the issue could be related to a data type. In line 88, please try changing the queue inference line to
graph.queue_inference_with_fifo_elem(inputs, outputs, numpy_final.astype(np.float32),'object2').