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

Compile self-defined Tensorflow model with mvNCCompile

idata
Employee
805 Views

I have trained a CNN model using Tensorflow and tried to compile it to graph file supported by Movidius using mvNCCompile.

 

The following is the first error I got:

 

[Error 34] Setup Error: Values for input contain placeholder. Pass an absolute value.

 

I think it's a reasonable one because a CNN model shall receive a single image directly and output a result (e.g. the class number the image belongs to) accordingly. However, when training the model using Tensorflow, I set the input to be a tensor(a placeholder to be exact) with shape [batch_size, image_width, image_height, image_channel]. The error convinces me that the desired input size shall be [1, image_width, image_height, image_channel]. So I did some trick on my model by adding one more tensor to the model. Use tf.train.import_meta_graph() function, check the kwargs "input_map", pass something to it then you are good. I got inspired by the following link:

 

https://stackoverflow.com/questions/42306484/configure-input-map-when-importing-a-tensorflow-model-from-metagraph-file.

 

Then I continued and met the second error:

 

You must feed a value for placeholder tensor 'dropout' with dtype float.

 

I used a dropout layer in my model and dropout shall be set to 1.0 during real world predicting. I solved this problem using similar trick as the first one. Use the input_map kwargs, pass a constant 1.0 to dropout and we are good.

 

Finally, the third error.

 

[Error 5] Toolkit Error: Stage Details Not Supported: RealDiv

 

I did some search but got no result so far. Is it a bug of the ncsdk or is it a bug of mine? I guess that the operation RealDiv is supported by TF but not by Movidius yet.

 

Last few words:

 

I have seen a lot of posts not only in this forum but also on stackoverflow. Most guys are stopped by unknown errors and as far as I know, the compilation error has not been solved yet. I really hope that the maintainer of Movidius could clarify what is the process with custom TF model. I know there are working models like the inception_v1 and v3 but there is no explanation about why the two works but mine could not. I read the working example code but I believed that it is tensorflow.contrib.slim.nets that makes things work. I paid for the blue stick and for the service later on because I heard the promotion that TF is supported. Of course I know development with TF is not that comfortable because it's rather complicate but I do hope that somebody in charge could give me some real support.

 

By the way, I could offer some help for the development of ncsdk if needed. I also welcome everyone who shares similar bugs contact me via syangav@gmail.com. Maybe we could solve this out together.

 

Thanks!

0 Kudos
2 Replies
idata
Employee
574 Views

@Yang can you share what you had to do to get around error 34? Specifically how you use input_map.

0 Kudos
idata
Employee
574 Views
0 Kudos
Reply