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.

Compiling non-visual tf-model for NCS

idata
Employee
1,380 Views

Is it generally possible to compile tensorflow-models that are not CNN?

 

I want to run a tensorflow model on the Intel Movidius Neural Compute Stick that is a general NN and not for any image processing and therefore also not using CNN-arcitecture but rather simple perceptrons.

 

For example:

 

Can I compile an _XOR Neural Network_ (example) with mvNCCompile to run on the NCS?

 

I keep getting this error-log, when trying to compile models that don't contain Convolutional-Layers:

 

> ubuntu:~/path$ mvNCCheck TF_Model/tf_model.meta -in=dense_1_input_1 -on=activation_2_1/Relu

 

 

/usr/local/bin/ncsdk/Controllers/Parsers/TensorFlowParser/Convolution.py:47: SyntaxWarning: assertion is always true, perhaps remove parentheses? assert(False, "Layer type not supported by Convolution: " + obj.type) mvNCCheck v02.00, Copyright @ Intel Corporation 2017 ****** Info: No Weights provided. inferred path: TF_Model/tf_model.data-00000-of-00001****** TF_Model/tf_model.meta 2019-03-27 16:24:56.276630: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA No Bias No Bias Fusing DeptwiseConv + Pointwise Convolution into plain Convolution Fusing Add and Batch after Convolution Traceback (most recent call last): File "/usr/local/bin/mvNCCheck", line 239, in <module> quit_code = check_net(args.network, args.image, args.inputnode, args.outputnode, args.nshaves, args.inputsize, args.weights, args) File "/usr/local/bin/mvNCCheck", line 206, in check_net load_ret = load_network(args, parser, myriad_config) File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 83, in load_network input_data, expected_result = p.calculateReference(arguments) File "/usr/local/bin/ncsdk/Controllers/Parsers/TensorFlow.py", line 545, in calculateReference nhwc_to_nchw_transpozition) File "/home/ase/.local/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 639, in transpose return _wrapfunc(a, 'transpose', axes) File "/home/ase/.local/lib/python3.5/site-packages/numpy/core/fromnumeric.py", line 56, in _wrapfunc return getattr(obj, method)(*args, **kwds) ValueError: axes don't match array

 

0 Kudos
4 Replies
idata
Employee
1,046 Views

Hey @Jesus_at_Intel , @Tome_at_Intel , @Luis_at_Intel , @Sahira_at_Intel ,

 

I saw that you are experts with the NCS Stick. Could you help me with that issue? :smile:

 

Btw.: I realized in the above error log, I used mvNCCheck instead of mvNCCompile. The error phenomenon is the same anyway.

 

Thank you very much in advance!

 

Martin
0 Kudos
idata
Employee
1,046 Views

I have the same problem, I try compiling my model. Originally is development in Keras, next i make the conversion to tensorflow and obtained .meta, .index,.data and check point. Next insert the command _mvNCCompile myModelTensorFlow.meta -in="input" -on="output/Softmax"_ but i have the same problem as @martin-online.

 

Any solution?

 

Thanks

0 Kudos
idata
Employee
1,046 Views

Hi @martin-online

 

I apologize for replying so late. The NCSDK is designed to only run CNNs. The error you're getting is caused when the NCSDK Tensorflow parser checks the dimensions of their input and tries to process the input data. Since it expects an image input and you're not providing one, it throws an error when trying to run numpy transpose axes.

 

Best Regards,

 

Sahira
0 Kudos
idata
Employee
1,046 Views

Hey @Sahira_at_Intel ,

 

thank you for your reply!

 

That's what I thought when going through the traceback of the error that I got. Is there any way I can build a work around for this? Maybe providing input in "fake" 3 dimensions (like an image). Is there any way that I don't have to use CNN-layers in the model?

 

I tried:

 

If I put a random 2D-Conv-Layer as the first layer of my model - it compiles. If I put the random 2D-Conv-Layer as a deeper hidden layer - it doesn't compile. So my conclusion was, that the compiler expects a TensorFlow ConvLayer as the start node.

 

Can I somehow work around this force to use CNNs? There must be a way - even if it's neccessary for me to modify the local compilers code. I think small perceptrons are way easier to run and calculate and also they only use layers, that are supported by the compiler anyway (Dense, Activation …). Please help me with a workaround.

 

Otherwise, is there a way I can use OpenVino somehow to compile a fully connected TensorFlow model (without ConvLayers) for the NCS Stick 1?

 

I'm looking forward to your answer! :)

 

Best regards,

 

Martin
0 Kudos
Reply