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.

Cannot convert a custom trained Faster RCNN model to IR

Pereira__Errol
934 Views

Hi all,

I have a Faster RCNN model (faster_rcnn_resnet101_coco_2018_01_28) trained on custom objects. I am trying to convert this model to its Immediate Representation in OpenVINO toolkit but I am facing some issues while doing so.

However when I try to convert the original model(pre-trained model from Tensorflow model Zoo) I am able to successfully convert it to its IR.

Below is the command I am using to convert the custom model:

 python {PATH_TO_MODEL_OPTIMIZER}\mo_tf.py 
--input_model {PATH_TO_INFERENCE_GRAPH}\frozen_inference_graph.pb
--tensorflow_use_custom_operations_config {PATH_TO_OPENVINO}\openvino_2019.3.379\deployment_tools\model_optimizer\extensions\front\tf\faster_rcnn_support.json
--tensorflow_object_detection_api_pipeline_config {PATH_TO_CONFIG_FILE}\faster_rcnn_resnet101_pets.config
--reverse_input_channels --log_level=DEBUG

When running this command in debug mode I am getting the below error:

[ ERROR ]  Found the following nodes '[]' with name 'crop_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalReplacement replacement didn't work.
Exception occurred during running replacer "ObjectDetectionAPIDetectionOutputReplacement" (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIDetectionOutputReplacement'>): Found the 
following nodes '[]' with name 'crop_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalReplacement replacement didn't work.

[ 2019-12-11 14:10:08,597 ] [ DEBUG ] [ main:304 ]  Traceback (most recent call last):
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 273, in apply_replacements
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\middle\pattern_match.py", line 58, in for_graph_and_each_sub_graph_recursively
    func(graph)
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\front\tf\replacement.py", line 95, in find_and_replace_pattern
    self.replace_sub_graph(graph, match)
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\front\common\replacement.py", line 140, in replace_sub_graph
    new_sub_graph = self.generate_sub_graph(graph, match)  # pylint: disable=assignment-from-no-return
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\extensions\front\tf\ObjectDetectionAPI.py", line 602, in generate_sub_graph
    format(proposal_nodes_ids))
mo.utils.error.Error: Found the following nodes '[]' with name 'crop_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalReplacement replacement didn't work.

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

Traceback (most recent call last):
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\main.py", line 298, in main
    return driver(argv)
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\main.py", line 247, in driver
    is_binary=not argv.input_model_is_text)
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\pipeline\tf.py", line 136, in tf2nx
    class_registration.apply_replacements(graph, class_registration.ClassType.FRONT_REPLACER)
  File "C:\Program Files (x86)\IntelSWTools\openvino_2019.3.379\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 293, in apply_replacements
    )) from err
mo.utils.error.Error: Found the following nodes '[]' with name 'crop_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalReplacement replacement didn't work.
Exception occurred during running replacer "ObjectDetectionAPIDetectionOutputReplacement" (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIDetectionOutputReplacement'>): Found the 
following nodes '[]' with name 'crop_proposals' but there should be exactly 1. Looks like ObjectDetectionAPIProposalReplacement replacement didn't work.

I am not facing any issues converting a pre-trained model from the Tensorflow model zoo. This happens only when I try to convert a custom trained model.

Below are the specifications of my installation:

  1. OpenVINO Toolkit version : 2019_R3.1 (latest)
  2. OS : Windows 10 Pro
  3. Tensorflow API v : Latest version from Github (https://github.com/tensorflow/models)
  4. Tensorflow version : 1.15.0

Note : All the prerequisites are installed and successfully completed the demo in the installation guide of OpenVINO.

Attaching the custom model with the config file and the logs containing the errors.

Please guide me in solving this issue.

Thanks in advance

0 Kudos
1 Solution
Pereira__Errol
934 Views

Hi Luis_at_Intel,

I re trained the model using TF 1.14 and was able to convert the model to its IR. 

Thanks for your help,

Regards,

Errol

View solution in original post

0 Kudos
3 Replies
Pereira__Errol
934 Views

Please help

0 Kudos
Luis_at_Intel
Moderator
934 Views

Hi Pereira, Errol,

Thanks for reaching out. Based on the information you provided I see you have TensorFlow 1.15.0, did you use this version to train your model? We have seen issues with this TF version, if possible could you try downgrading to TF version 1.14.0? Let me know if this works, also we have this guide that walks through re-training a model.

 

Regards,

Luis

0 Kudos
Pereira__Errol
935 Views

Hi Luis_at_Intel,

I re trained the model using TF 1.14 and was able to convert the model to its IR. 

Thanks for your help,

Regards,

Errol

0 Kudos
Reply