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

Issue with converting tensorflow model to Intel Movidius graph

idata
Employee
890 Views

Hello I faced with the problem when trying to use Movidius stick with tensorflow. I have keras model and I convert it to tensorflow model. When I convert it to Movidius graph I got error:

 

Traceback (most recent call last):

 

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

 

create_graph(args.network, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights)

 

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

 

net = parse_tensor(args, myriad_config)

 

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

 

if have_first_input(strip_tensor_id(node.outputs[0].name)):

 

IndexError: list index out of range

 

Here is my code:

 

from keras.models import model_from_json

 

from keras.models import load_model

 

from keras import backend as K

 

import tensorflow as tf

 

import nn

 

import os

 

weights_file = "weights.h5"

 

sess = K.get_session()

 

K.set_learning_phase(0)

 

model = nn.alexnet_model() # get keras model

 

model.load_weights(weights_file)

 

saver = tf.train.Saver()

 

saver.save(sess, "./TF_Model/tf_model") # convert keras to tensorflow model

 

tf_model_path = "./TF_Model/tf_model"

 

fw = tf.summary.FileWriter('logs', sess.graph)

 

fw.close()

 

os.system('mvNCCompile TF_Model/tf_model.meta -in=conv2d_1_input -on=activation_7/Softmax') # get Movidius graph

 

Python version: 2.7

 

OS: Ubuntu 16.04

 

Tensorflow version: 1.12
0 Kudos
3 Replies
idata
Employee
563 Views

@jenamax Thanks for providing your code. Can you Which version of the NCSDK are you using? If you could provide me with your model files, that would be helpful and save me a lot of time also.

0 Kudos
idata
Employee
563 Views

Hello im facing the same problem

 

i work with keras/tensorflow. just finetune a yolov3 (416) for custom data. everything fine in the host with the camera.

 

i use the same code of @jenamax for transform keras->tf. I get the .meta .index .dataXXXX checkpoint as expected.

 

i run in vm ubuntu16.04 8gb with ncsdk 1 the command

 

mvNCCompile tfmodel.meta -s 12 -in input_1 -on conv2d_59/conv2d_67/conv2d_75

 

In the model.json says that outputs layers are those 3

 

conv2d_59

 

conv2d_67

 

conv2d_75

 

but getting [ERROR 13] outputs conv2d_59/conv2d_67/conv2d_75 not as expect…

 

any help?

0 Kudos
idata
Employee
563 Views

@Tome_at_Intel

 

hello im facing the same problem

 

here is my model.json (yolov3) : https://drive.google.com/file/d/1syNkwSEro0mElDQ34uihPZDIBGpw4bor/view?usp=sharing

 

when I type " mvNCCompile TF_Model/tf_model.meta -in input_1 -on conv2d_75/kernel -s 12 "

 

It gives me :

 

"input_data = np.random.uniform(0, 1, shape)

 

File "mtrand.pyx", line 1302, in mtrand.RanomState.uniform

 

File "mtrand.pyx", line 242, in mtrand.cont2_array_sc

 

TypeError: 'NoneType' object cannot be interpreted as an integer

 

"

 

I'm not sure if the output_node 's name is "conv2d_75", because the model.json says that outputs layers are those 3

 

conv2d_59

 

conv2d_67

 

conv2d_75

 

but i think it's doesn't matter. now i just want to know how to solve this "Type Error"

 

and i don't know if the yolov3 is supported by ncs? it seems to have three outputs.

 

Thank you very much!
0 Kudos
Reply