Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
6108 Discussions

Problems using Faster RCNN TFODAPI converted

Jordan_RJ
Beginner
561 Views

Hello,

 

I converted a first model (trained on a custom dataset) from TFODAPI (TF == 2.6) using OpenVINO (stack : 2121.4.752), it was an : SSD 50. After converting it, I successfuly used it using : object_detection_sample_ssd.py 

 

I did conversion using : 

python3 <path_to>/mo_tf.py \
    --saved_model_dir <path_to>/saved_model/ \
    --transformations_config <path_to>/model_optimizer/extensions/front/tf/ssd_support_api_v2.4.json \
   --tensorflow_object_detection_api_pipeline_config <path_to>/my_ssd_resnet50_v1_fpn/pipeline.config \
  --input_shape [1,640,640,3]

 

I tried conversion of faster RCNN 152 (trained on a custom dataset) in the same way: 

python3 <path_to>/mo_tf.py \
--saved_model_dir <path_to>/my_faster_rcnn_resnet152/saved_model/ \
--transformations_config ../../faster_rcnn_support_api_v2.4.json \
--tensorflow_object_detection_api_pipeline_config <path_to>/my_faster_rcnn_resnet152/pipeline.config \
--input_shape [1,1333,1333,3]

 

When trying to convert fatser_RCNN 152, I get following error :

[ ERROR ] Exception occurred during running replacer "ObjectDetectionAPIProposalReplacement" (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIProposalReplacement'>): The matched sub-graph contains network input node "input_tensor".


Could you help me to debug this ?

 

Respectfully

0 Kudos
8 Replies
Peh_Intel
Moderator
505 Views

Hi Jordan,


Thanks for reaching out to us.


I’ve validated that the pre-trained model, Faster R-CNN ResNet152 V1 1024x1024 from TensorFlow 2 Detection Model Zoo can be successfully converted into Intermediate Representation (IR).


We would like to request your custom model (saved_model and pipeline config) for further investigation.



Regards,

Peh


Jordan_RJ
Beginner
455 Views

Is it possible to send that in private ?

 

Also, I tried from model-zoo too and got following ouput :

 ERROR ]  Please contact Model Optimizer developers and forward the following information:
[ ERROR ]  Exception occurred during running replacer "ObjectDetectionAPIPreprocessor2Replacement (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIPreprocessor2Replacement'>)": 
[ ERROR ]  Traceback (most recent call last):
  File "/<PATH>/hpml/openvino/install/intel/openvino_2021.4.752/deployment_tools/model_optimizer/mo/utils/class_registration.py", line 276, in apply_transform
    replacer.find_and_replace_pattern(graph)
  File "/<PATH>/openvino/install/intel/openvino_2021.4.752/deployment_tools/model_optimizer/mo/front/tf/replacement.py", line 36, in find_and_replace_pattern
    self.transform_graph(graph, desc._replacement_desc['custom_attributes'])
  File "/<PATH>/openvino/install/intel/openvino_2021.4.752/deployment_tools/model_optimizer/extensions/front/tf/ObjectDetectionAPI.py", line 710, in transform_graph
    assert len(start_nodes) >= 1
AssertionError
Peh_Intel
Moderator
427 Views

Hi Jordan,


Yes, you can privately send your model to my email:

yux.chern.peh@intel.com


Regarding the TensorFlow 2 Detection Model, you have to use faster_rcnn_support_api_v2.0.json as they are trained using TensorFlow Object Detection API version 2.2.



Regards,

Peh


Jordan_RJ
Beginner
391 Views

Thank you for your answer, I will come back to you by email with pretrained model, as soon as I have verifier that my problem was not just about using V2.4 instead of v2.0

 

Respectfully

Peh_Intel
Moderator
299 Views

Hi Jordan,


I do not receive your custom model in my email so far. Does it mean you already able to convert your model?



Regards,

Peh


Peh_Intel
Moderator
284 Views

Hi Jordan,


Thank you for your question. If you need any additional information from Intel, please submit a new question as this thread is no longer being monitored. 



Regards,

Peh


Bharat_Sharma
Beginner
162 Views

Hi,
I am facing this exact issue when converting my custom trained faster rcnn model to openvino IR.I am using openvino version - 
openvino 2021.4.2
openvino-dev 2021.4.2


I tried using the faster_rcnn_support_api_v2.0.json and it gives me this error - 

[ WARNING ] Model Optimizer removes pre-processing block of the model which resizes image keeping aspect ratio. The Inference Engine does not support dynamic image size so the Intermediate Representation file is generated with the input image size of a fixed size.
[ WARNING ] The model resizes the input image keeping aspect ratio with min dimension 800, max dimension 1333. The provided input height 800, width 1333 is transformed to height 1333, width 1333.
[ ERROR ] -------------------------------------------------
[ ERROR ] ----------------- INTERNAL ERROR ----------------
[ ERROR ] Unexpected exception happened.
[ ERROR ] Please contact Model Optimizer developers and forward the following information:
[ ERROR ] Exception occurred during running replacer "ObjectDetectionAPIPreprocessor2Replacement (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIPreprocessor2Replacement'>)":
[ ERROR ] Traceback (most recent call last):
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/utils/class_registration.py", line 276, in apply_transform
replacer.find_and_replace_pattern(graph)
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/front/tf/replacement.py", line 36, in find_and_replace_pattern
self.transform_graph(graph, desc._replacement_desc['custom_attributes'])
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/extensions/front/tf/ObjectDetectionAPI.py", line 710, in transform_graph
assert len(start_nodes) >= 1
AssertionError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/main.py", line 394, in main
ret_code = driver(argv)
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/main.py", line 356, in driver
ret_res = emit_ir(prepare_ir(argv), argv)
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/main.py", line 252, in prepare_ir
graph = unified_pipeline(argv)
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/pipeline/unified.py", line 13, in unified_pipeline
class_registration.apply_replacements(graph, [
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/utils/class_registration.py", line 328, in apply_replacements
apply_replacements_list(graph, replacers_order)
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/utils/class_registration.py", line 314, in apply_replacements_list
apply_transform(
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/utils/logger.py", line 111, in wrapper
function(*args, **kwargs)
File "/home/bharat/projects/fuelmatics-lid-detection/env/lib/python3.8/site-packages/mo/mo/utils/class_registration.py", line 302, in apply_transform
raise Exception('Exception occurred during running replacer "{} ({})": {}'.format(
Exception: Exception occurred during running replacer "ObjectDetectionAPIPreprocessor2Replacement (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIPreprocessor2Replacement'>)":

When i use the faster_rcnn_support_api_v2.4.json, i get a different error which is the same as mentioned by @Jordan_RJ  in the beginning.

This is the python command that runs - 

python env/lib/python3.8/site-packages/mo_tf.py --saved_model_dir=exported_models/faster_rcnn/saved_model --output_dir=openvino/faster_rcnn --transformations_config=env/lib/python3.8/site-packages/mo/extensions/front/tf/faster_rcnn_support_api_v2.0.json --tensorflow_object_detection_api_pipeline_config=exported_models/faster_rcnn/pipeline.config --input_shape="[1, 800, 1333, 3]"

Help in this would be really appreciated. @Peh_Intel 

Thanks,
Bharat

 

 

Peh_Intel
Moderator
143 Views

Hi Bharat,

 

Thanks for submitting a new question in the following thread:

https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Trouble-exporting-faster-rcnn-model-to-openvino-IR-format/m-p/1434767

 

 

Regards,

Peh

Reply