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

Problem loading tensorflow ssd model for openvino on a raspberry

FSern
Beginner
868 Views

Hello,

I want to run the ssd_mobilenet from tensorflow models api on a raspberry with movidius using openvino but I have problems loeading the IR file.

I installed the lastest version of openvino on my pc (ubuntu 16) following this guide https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html

then I used the model optimizer to create the IR file and tested it no problem.

then I installed openvino for raspbian following this guide https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_raspbian.html

but, while running the sample I got an error

RuntimeError: Check 'axis < static_cast<size_t>(input_rank)' failed at /teamcity/work/scoring_engine_build/releases_2020_1/ngraph/src/ngraph/op/gather.cpp:140:
While validating node 'Gather[Gather_1718](patternLabel_1714: float{10,20,30}, patternLabel_1715: int64_t{5}, patternLabel_1717: int64_t{1}) -> (??)':
The axis must => 0 and <= input_rank (axis: 4294967295)

and I found that this guy had the same problem https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit/topic/848966

using the model form 2019 to run the sample worked perfectly but I still get the error when I try to use my bin and xml

0 Kudos
1 Solution
David_C_Intel
Employee
868 Views

Hi Felipe,

Thanks for reaching out.

As you can check on the thread you referred to, this is an issue with the latest OpenVINO™ toolkit version (2020.1). The "axis" error is caused by the new IR v10 format. 

Could you please generate the model with the following parameter and tell us if it works: 

--generate_deprecated_IR_V7

If it does not work, we recommend you installing the previous version of OpenVINO™ toolkit (2019 R3.1) on your Ubuntu 16 system, convert the model there, which will generate the IR v7 format and that should work successfully with the Intel® Neural Compute Stick 2 on the raspberry pi.

 

Best Regards,

David

View solution in original post

0 Kudos
3 Replies
David_C_Intel
Employee
869 Views

Hi Felipe,

Thanks for reaching out.

As you can check on the thread you referred to, this is an issue with the latest OpenVINO™ toolkit version (2020.1). The "axis" error is caused by the new IR v10 format. 

Could you please generate the model with the following parameter and tell us if it works: 

--generate_deprecated_IR_V7

If it does not work, we recommend you installing the previous version of OpenVINO™ toolkit (2019 R3.1) on your Ubuntu 16 system, convert the model there, which will generate the IR v7 format and that should work successfully with the Intel® Neural Compute Stick 2 on the raspberry pi.

 

Best Regards,

David

0 Kudos
FSern
Beginner
868 Views

Thank you!, I executed the command with the flag and it worked. I was able to get the .bin and .xml from the tensorflow's ssd frozen pretrained model and worked on the rp + ncs.

But now I have another problem. I trained this model on a custom dataset for only 4 classes, but when I try to get the IR file from my custom frozen graph I get this error:

[ ERROR ]  Failed to match nodes from custom replacement description with id 'ObjectDetectionAPISSDPostprocessorReplacement':
It means model and custom replacement description are incompatible.
Try to correct custom replacement description according to documentation with respect to model node names
[ ERROR ]  Cannot infer shapes or values for node "Postprocessor/Cast_1".
[ ERROR ]  0
[ ERROR ]  
[ ERROR ]  It can happen due to bug in custom shape infer function <function Cast.infer at 0x7f3383dcc950>.
[ ERROR ]  Or because the node inputs have incorrect values/shapes.
[ ERROR ]  Or because input shapes are incorrect (embedded to the model or passed via --input_shape).
[ ERROR ]  Run Model Optimizer with --log_level=DEBUG for more information.
[ ANALYSIS INFO ]  Your model looks like TensorFlow Object Detection API Model.
Check if all parameters are specified:
    --tensorflow_use_custom_operations_config
    --tensorflow_object_detection_api_pipeline_config
    --input_shape (optional)
    --reverse_input_channels (if you convert a model to use with the Inference Engine sample applications)
Detailed information about conversion of this model can be found at
https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.PartialInfer.PartialInfer'>): Stopped shape/value propagation at "Postprocessor/Cast_1" node.
 For more information please refer to Model Optimizer FAQ (https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html), question #38.

0 Kudos
FSern
Beginner
868 Views

[UPDATE] I kept looking and found the solution  for the last problem. apparently I had to modify the file that I pass to the flag --transformations_config which is on /opt/intel/openvino/deployment_tools/model_optimizer/extensions/front/tf/ssd_support_api_v1.14.json and only change Postprocessor/Cast for Postprocessor/Cast_1 and the model optimizer worked perfectly and it ran on the rp + ncs just fine. 

Thanks a lot!.

 

0 Kudos
Reply