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.

Can't compile tensorflow model to NCS

idata
Employee
687 Views

Hi @Tome_at_Intel

 

I'm using TensorFlow Speech Commands Example:

 

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/speech_commands

 

I trained the model and made predictions successfully in both CPU and GPU hardware.

 

And I want to make this example work with NCS + VM. And I already run NCS examples successfully in VM.

 

[Version]

 

OS: Ubuntu 16.04 (Installed on VirtualBox 5.2.12 on Windows 7)

 

NCSDK 2.05.00.02

 

-Including TensorFlow 1.7

 

[Description]

 

     

  • This example use "_speech_commands/train.py_" to train model.
  •  

  • And use "_speech_commands/label_wav.py_" to do prediction. (I get input node name '_wav_data:0_' and output node name '_labels_softmax:0_' at _label_wav.py_)
  •  

 

This example use a simple CNN structure (2 convolutional layers, 1 maxpooling layer). I knew some difficult model not supported by NCS yet. But this model is really simple.

 

[Command]

 

I used the command to compile my ckpt file:

 

mvNCCompile conv.ckpt-4000.meta -s 12 -in wav_data:0 -on labels_softmax: -o conv.ckpt-4000.graph

 

And I got the following error message as below.

 

[Message]

 

user@ncs-vm:~/Documents/tf$ mvNCCompile conv.ckpt-4000.meta -s 12 -in wav_data:0 -on labels_softmax:0 -o conv.ckpt-4000.graph

 

mvNCCompile v02.00, Copyright @ Intel Corporation 2017

 

/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/tf_inspect.py:45: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead

 

Traceback (most recent call last):

 

File "/usr/local/bin/mvNCCompile", line 169, in

 

create_graph(args.network, args.image, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights, args.explicit_concat, args.ma2480, args.scheduler, args.new_parser, args)

 

File "/usr/local/bin/mvNCCompile", line 148, in create_graph

 

load_ret = load_network(args, parser, myriad_config)

 

File "/usr/local/bin/ncsdk/Controllers/Scheduler.py", line 100, in load_network

 

parse_ret = parse_tensor(arguments, myriad_conf)

 

File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 214, in parse_tensor

 

saver = tf.train.import_meta_graph(path, clear_devices=True)

 

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1927, in import_meta_graph

 

*_kwargs)

 

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/meta_graph.py", line 741, in import_scoped_meta_graph

 

producer_op_list=producer_op_list)

 

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 432, in new_func

 

return func(_args, **kwargs)

 

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/importer.py", line 457, in import_graph_def

 

_RemoveDefaultAttrs(op_dict, producer_op_list, graph_def)

 

File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/importer.py", line 227, in _RemoveDefaultAttrs

 

op_def = op_dict[node.op]

 

KeyError: 'DecodeWav'

 

user@ncs-vm:~/Documents/tf$

 

Could you please help on this?

 

Thank you

 

Johnson

0 Kudos
3 Replies
idata
Employee
386 Views

@johnson Please view https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/optimize_for_inference.py to remove training layers. Additionally, please remove dropout layers from the model (this could help). Information on making changes to your model to be NCS compliant can be found at https://movidius.github.io/ncsdk/tf_compile_guidance.html. Hope this helps.

0 Kudos
idata
Employee
386 Views

@Tome_at_Intel

 

Thank you for your reply. I read the links you provided.

 

I realized I need to remove training layers and dropout layers to make a inference only version model. And then compile the model to NCS model.

 

One thing I need to make clear first, according to the last line of Error Message I got:

 

_KeyError: 'DecodeWav'_

 

This example uses contrib_audio.decode_wav to decode a wav file then transfer to image, and then do Training/Inference things.

 

contrib_audio.decode_wav function is from tensorflow class:

 

_from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio_ (This class supports some audio processing)

 

_wav_decoder = contrib_audio.decode_wav(

 

wav_loader, desired_channels=1, desired_samples=desired_samples)_

 

     

  • If NCS supports class tensorflow.contrib.framework.python.ops?
  •  

  • If not, what should I do? (Maybe combine using TensorFlow-CPU version and TensorFlow-NCS supoort?)
  •  

  • If the the input data for NCS stick has to be image type data?
  •  

 

Thank you.

 

BR

 

Johnson
0 Kudos
idata
Employee
386 Views

@johnson Currently, the NCSDK doesn't have the TensorFlow audio processing capabilities implemented and so far I haven't seen a NCS compatible model that doesn't use an image input. Doing a combination of TensorFlow CPU and TensorFlow NCS could work, but I imagine that isn't the solution that you have in mind. Models that use audio could work if converted to a spectrogram form.

0 Kudos
Reply