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

Exception during running replacer ONNXMaskRCNNReplacement in conversion of MaskRCNN from ONNX to IR

New Contributor I



In an attempt to convert a MaskRCNN model from Pytorch ==>  ONNX ==> IR, it's failing in the conversion from ONNX to IR (ONNXMaskRCNNReplacement is attempting to access a node that's not in the graph). I am using OpenVINO version 2020.1.


I used ONNX 1.6 and opset version 11 for the conversion to ONNX. 

For converting to IR, this was the input command: 

sudo python3 --input_model mask_rcnn_R_50_FPN_1x.onnx --input_shape "[1,3,960,1280]"  --transformations_config ./extensions/front/onnx/mask_rcnn.json --log_level DEBUG --input "0:2"

Error log:

[ 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 "ONNXMaskRCNNReplacement (<class 'extensions.front.onnx.mask_rcnn_conversion.ObjectDetectionAPIOutputReplacement'>)": Attempt to access node 6795 that not in graph
[ ERROR ]  Traceback (most recent call last):
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/utils/", line 287, in apply_transform
    for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/middle/", line 58, in for_graph_and_each_sub_graph_recursively
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/front/tf/", line 48, in find_and_replace_pattern
    self.transform_graph(graph, desc._replacement_desc['custom_attributes'])
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/extensions/front/onnx/", line 49, in transform_graph
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/extensions/front/onnx/", line 87, in insert_ExperimentalDetectronROIFeatureExtractor1
    old_output_node = Node(graph, '6795')
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/graph/", line 38, in __init__
    assert node in graph, "Attempt to access node {} that not in graph".format(node)
AssertionError: Attempt to access node 6795 that not in graph

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

Traceback (most recent call last):
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/", line 314, in main
    return driver(argv)
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/", line 281, in driver
    ret_res = emit_ir(prepare_ir(argv), argv)
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/", line 246, in prepare_ir
    graph = mo_onnx.driver(argv)
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/pipeline/", line 72, in driver
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/utils/", line 324, in apply_replacements
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/utils/", line 124, in wrapper
    function(*args, **kwargs)
  File "/opt/intel/openvino_2020.1.023/deployment_tools/model_optimizer/mo/utils/", line 309, in apply_transform
    )) from err
Exception: Exception occurred during running replacer "ONNXMaskRCNNReplacement (<class 'extensions.front.onnx.mask_rcnn_conversion.ObjectDetectionAPIOutputReplacement'>)": Attempt to access node 6795 that not in graph

Please advise on how to solve this problem.

Thank you

0 Kudos
1 Reply

A similar query has been posted. Please refer this comment and let us know in case of any questions.


Ram prasad