I'm trying to get started with OpenVINO and Neural Compute Stick. For "Hello world" task I chose converting one of my Tensorflow Model to IR Model and run it on NCS. The model is http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet101_coco_2018_01_28.tar.gz (from Tensorflow Model Zoo Object Detection). Of course I'm using it with custom classes and input shape. Compilation to IR Model works like a charm (FP16 and FP32):
python3 mo_tf.py --input_meta_graph ~/train_09_07/model.ckpt-66967.meta --tensorflow_use_custom_operations_config extensions/front/tf/faster_rcnn_support_api_v1.7.json --tensorflow_object_detection_api_pipeline_config ~/train_09_07/pipeline.config --reverse_input_channels --data_type FP32 --batch 1
First for execution I'm using object_detection_sample_ssd from samples delivered with OpenVINO. On CPU execution works. However, when I'm trying to run this on NCS (with model converted to FP16) following error appears:
[ ERROR ] [VPU] Reshape input or output reshape_4d has invalid batch
I was trying to change batch size etc. but nothing works.
I will be grateful for any help.
Using just the meta graph file isn't enough to convert the model I will reproduce your issue on my side and supply the command line for you to use.
I converted the model with the following command please give it a try:
sudo python3 /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/mo.py --input_model frozen_inference_graph.pb --tensorflow_object_detection_api_pipeline_config pipeline.config --output="detection_boxes,detection_scores,num_detections" --tensorflow_use_custom_operations_config /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support_api_v1.7.json.json
I will try to run it on NCS and see if I get the same error.
Ok so everything works well on CPU as you saw as well. With the movidius stick i'm getting the following error
[ ERROR ] [VPU] input SecondStageFeatureExtractor/resnet_v1_101/block4/unit_1/bottleneck_v1/add has invalid batc
let me take troubleshoot this a bit further and take a look at the graph and see what batch size it's expecting for this layer.
FYI I converted the model again with extra parameters data_type FP16, --batch 1, and --tensorboard_logdir
I tried to convert models mask_rcnn from TensorFlow Object Detection Models Zoo using this command:
mo_tf.py --input_model $ / rcnn_bis / mask_rcnn_resnet101_atrous_coco_2018_01_28 / frozen_inference_graph.pb --tensorflow_use_custom_operations_config /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/extensions/front/tf/mask_rcnn_support.json --tensorflow_object_detection_api_pipeline_config $ / mask_rcnn_resnet101_atrous_coco_2018_01_28 / pipeline.config - data_type FP16 --batch 1
And I wanted to launch an inference with the following command using an input image of 960 * 525
./mask_rcnn_demo -i $ / blue_car_W_960_H_525.png -m $ / mask_rcnn_resnet101_atrous_coco_2018_01_28 / FP16 / frozen_inference_graph.xml -d MYRIAD
In output I had this error
[ERROR] [VPU] Input SecondStageBoxPredictor_1 / ResizeBilinear has invalid batch
I also converted the rfcn models using this command
mo_tf.py --input_model $ / rfcn_resnet101_coco_2018_01_28 / frozen_inference_graph.pb --tensorflow_use_custom_operations_config /opt/intel/computer_vision_sdk/deployment_tools/model_optimizer/extensions/front/tf/rfcn_support.json --tensorflow_object_detection_api_pipeline_config $ / rfcn_resnet101_coco_2018_01_28 / pipeline.config --data_type FP16 --batch 1
for the inference I used the following command:
./segmentation_demo -i $ / blue_car_W_960_H_525.png -m $ / rfcn_resnet101_coco_2018_01_28 / FP32 / frozen_inference_graph.xml -d MYRIAD
And I had this error
[ERROR] vector :: _ M_range_check: __n (which is 18446744073709551615)> = this-> size () (which is 21)
Can you tell me what to do to fix these errors.
Thanking you in advance.
I'm currently looking into your issues. Sorry that you're having difficulties ! Can you clarify what you mean by this statement ?
Of course I'm using it with custom classes and input shape.
Also I have PM'd you, so that you can zip up your frozen.pb and send it to me privately.
Thanks for using OpenVino !
Dear Thiziri (and everyone):
I encourage you to download the latest release of OpenVino 2019 R1, released today. In this release I see a mask_rcnn_support.json, mask_rcnn_support_api_v1.7.json and mask_rcnn_support_api_v1.11.json. I also see rfcn_support.json and rfcn_support_api_v1.10.json. Note that rfcn_support_api_v1.10.json is new in OpenVino 2019 R1. It's important to match up the *.json version number with the Tensorflow API version number. Here is exact wording from the MO Object Detection Online Document:
mask_rcnn_support.json — for frozen Mask R-CNN topologies from the models zoo
mask_rcnn_support_api_v1.7.json — for Mask R-CNN topologies trained manually using the TensorFlow* Object Detection API version 1.7.0 or higher up to 1.9.0 inclusively
mask_rcnn_support_api_v1.11.json — for Mask R-CNN topologies trained manually using the TensorFlow* Object Detection API version 1.10.0 or higher
rfcn_support.json — for the frozen RFCN topology from the models zoo frozen with TensorFlow* version 1.9.0 or lower.
rfcn_support_api_v1.10.json — for the frozen RFCN topology from the models zoo frozen with TensorFlow* version 1.10.0 or higher.
If you follow these rules, model conversion should work. If it still fails however, please feel free to post here and we will help out !
Thanks for using OpenVino !