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

Problem Compiling Retrained MobileNet .pb Graph to Movidius Graph

idata
Employee
840 Views

Hi

 

I have retrained a custom graph based on MobileNet v1 and following this tutorial:

 

TensorFlow For Poets

 

I get the following errors when trying to compile the retrained_graph.pb to movidius .graph file using mvNCCompile

 

Error Log

 

Here's the command I use:

 

mvNCCompile -s 12 retrained_graph.pb -in input -on final_result

 

I visualized the graph using tensorboard and here's how it looks like:

 

 

I also used different custom retrained graphs (based on Inception v3 instead of MobileNet) and different switches when compiling and I still got errors (different ones though)

 

Here's my retrained_graph.pb:

 

 

retrained_graph.pb

 

 

I'd be grateful if you could give me a clue

 

Thanks
0 Kudos
9 Replies
idata
Employee
513 Views

Update:

 

I installed NCSDK v2 and ran the same command, the error changed to this:

 

 

[Error 5] Toolkit Error: Stage Details Not Supported: Top Not Supported - Constants input_1/BottleneckInputPlaceholder

 

0 Kudos
idata
Employee
513 Views

@Tome_at_Intel any thoughts?

0 Kudos
idata
Employee
513 Views

@vista7 The first six nodes from Decode_Jpeg to Mul are doing image resizing and mean and scale calculations. These pre-processing steps should be done in a Python script when creating your NCS application. These preprocessing nodes should be removed and then a new graph should be created with a placeholder as input to the first convolution layer.

0 Kudos
idata
Employee
513 Views

@Tome_at_Intel Thank you for the answer, I did as you said and here's my edited graph visualized in tensorboard in detail:

 

 

But I'm still getting the same error

 

 

[Error 5] Toolkit Error: Stage Details Not Supported: Top Not Supported - Constants input_1/BottleneckInputPlaceholde

 

 

running the following code

 

mvNCCompile -s 12 retrained_graph.pb -in input -on final_result

 

Should I make further adjustments to the graph?

 

Thanks

0 Kudos
idata
Employee
513 Views

@vista7

0 Kudos
idata
Employee
513 Views

@Tome_at_Intel I can't see the contents of your response (if it's not empty)

 

Isn't there a python script for (re)training mobilenet or inception in a way that's compatible with mvNCCompiler? (like the one on 'tensorflow for poets' for retraining mobilenet called retrain.py?)

 

I think probably with relatively few adjustments to this retrain script the problem can be solved, It'd be really great if you could have a look at it (or give me some details about what changes should be applied)

 

Thanks
0 Kudos
idata
Employee
513 Views

@vista7 Sorry about the earlier reply. At the moment, there isn't a retraining guide for Tensorflow. The error seems to be coming from the input node. If I make reshape the last layer, the issue goes away.

 

That being said, you will need to create a model for inference that includes the trained weights. The bottlenecks are used for training and caching the intermediate results on the file system (read https://www.tensorflow.org/hub/tutorials/image_retraining#bottlenecks). The NCSDK doesn't have support for this.

 

You can take a look at Ashwin's flowers example in his make file at https://github.com/ashwinvijayakumar/ncappzoo/blob/flowers/apps/flowers/Makefile.

0 Kudos
idata
Employee
513 Views

@Tome_at_Intel I did as the example you mentioned and I can compile the graph and run the profiler on it, here's the result:

 

Profiler Log

 

I also uploaded the output_report.html and here it is:

 

Output Report

 

The way I did it was that I followed the instructions written on flowers example's Makefile, I exported variables like MODEL_CKPT, I got the checkpoint files from download.tensorflow.org , I got the flower_photos dataset from the same source, I trained them with train_image_classifier.py for 50000 steps, I exported graphDef with export_inference_graph.py, then I froze it with freeze_graph.py and finally compiled and profiled it with following commands:

 

mvNCCompile ./mobilenet_v1_1.0_224_flowers_frozen.pb -s 12 -in input -on MobilenetV1/Predictions/Reshape_1

 

mvNCProfile ./mobilenet_v1_1.0_224_flowers_frozen.pb -s 12 -in input -on MobilenetV1/Predictions/Reshape_1

 

But the problem is that when I'm trying to check it with mvNCCheck I get mixed results.

 

I ran the following command 10 times in a row and it passed the graph once, and for Percentage of wrong values, it gave 20% 3 times, 40% five times and 60% once:

 

mvNCCheck ./mobilenet_v1_1.0_224_flowers_frozen.pb -s 12 -in input -on MobilenetV1/Predictions/Reshape_1

 

Here's the log file of the mvNCCheck:

 

mvNCCheck

 

I also can't use it on image-classifier app on ncappzoo because mvncStatus says it's an UNSUPPORTED GRAPH

 

Here's the frozen graph file (on the commands above I wrote mobilenet_v1_1.0_224_flowers_frozen.pb but the uploaded file is mobilenet_v1_1.0_224_flowers_50000_frozen.pb):

 

mobilenet_v1_1.0_224_flowers_50000_frozen.pb

 

And here's the compiled one:

 

graph

 

Did I forget something or did something wrong?

 

I'd appreciate it if you could help

 

Thanks
0 Kudos
idata
Employee
513 Views

@vista7 If you are getting unsupported graph file for image classifier, you may need to recompile the Movidius graph file. If you are using different machines for compiling your graph file and for deployment, make sure these machines are using the same version of the NCSDK. If a graph file was created with a previous NCSDK version (i.e. NCSDK v 2.4.xx.xx) it won't work with the current NCSDK v 2.05.

 

For mvNCCheck, it uses random values for the input if you don't specify an input file. More information can be found at https://movidius.github.io/blog/mvNCCheck/.

0 Kudos
Reply