Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
274 Views

Error while converting PMTD ONNX model to OpenVino IR Model

Jump to solution

Hi!

I'm trying to convert the Pyramid Mask Text Detector (PMTD) model (ONNX) to its OpenVino IR representation. I use the following command to convert:

>python mo.py --input_model PMTD.onnx --transformations_config /extensions/front/onnx/mask_rcnn.json --log_level DEBUG --input_shape [1,3,1000,1000]

However, I run into an error stating that the required node was not found:

 

[ 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 6530 that not in graph
[ ERROR ] Traceback (most recent call last):
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 288, in apply_transform
for_graph_and_each_sub_graph_recursively(graph, replacer.find_and_replace_pattern)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\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_2020.3.194\deployment_tools\model_optimizer\mo\front\tf\replacement.py", line 48, in find_and_replace_pattern
self.transform_graph(graph, desc._replacement_desc['custom_attributes'])
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\extensions\front\onnx\mask_rcnn_conversion.py", line 48, in transform_graph
insert_do(graph, replacement_descriptions)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\extensions\front\onnx\mask_rcnn_conversion.py", line 81, in insert_do
old_do_output_nodes = [Node(graph, node_id) for node_id in do_outputs]
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\extensions\front\onnx\mask_rcnn_conversion.py", line 81, in <listcomp>
old_do_output_nodes = [Node(graph, node_id) for node_id in do_outputs]
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\graph\graph.py", line 38, in __init__
assert node in graph, "Attempt to access node {} that not in graph".format(node)
AssertionError: Attempt to access node 6530 that not in graph

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

Traceback (most recent call last):
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\main.py", line 312, in main
ret_code = driver(argv)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\main.py", line 273, in driver
ret_res = emit_ir(prepare_ir(argv), argv)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\main.py", line 238, in prepare_ir
graph = unified_pipeline(argv)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\pipeline\unified.py", line 29, in unified_pipeline
class_registration.ClassType.BACK_REPLACER
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 334, in apply_replacements
apply_replacements_list(graph, replacers_order)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 324, in apply_replacements_list
num_transforms=len(replacers_order))
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\utils\logger.py", line 124, in wrapper
function(*args, **kwargs)
File "C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer\mo\utils\class_registration.py", line 312, in apply_transform
)) from err
Exception: Exception occurred during running replacer "ONNXMaskRCNNReplacement (<class 'extensions.front.onnx.mask_rcnn_conversion.ObjectDetectionAPIOutputReplacement'>)": Attempt to access node 6530 that not in graph

I've attached the complete DEBUG logs.

On investigating further, I went through the mask_rcnn_conversion.py and saw that it required input and output nodes to replace the required layers. Since the PMTD model uses Mask RCNN, I think that only the ID of the FPN nodes is different. Is there a way to find the required IDs? Or is there another solution?

This question may seem similar to @Goyal__Pranav 's question here: https://community.intel.com/t5/Intel-Distribution-of-OpenVINO/Exception-during-running-replacer-ONNX...

But, he's only trying to convert the MaskRCNN model, not the PMTD model.

Any help would be appreciated.

0 Kudos

Accepted Solutions
Highlighted
New Contributor I
156 Views

Hi! Yes, you're right. The custom RoIAlign implementation was not exported properly by ONNX. I switched to roi_align in torchvision.ops. Also, OpenVino 2020.4 includes an implementation for the roi_align op. So, this issue is now solved. Thanks a lot!

View solution in original post

0 Kudos
5 Replies
Highlighted
Moderator
258 Views

Hi @Sharma__Divyanshu 

PMTD ONNX model has not been officially validated for ONNX-IR conversion via Model Optimizer, so unfortunately we cannot guarantee it is being workable. The exception message for ONNXMaskRCNNReplacement that you see might be caused by the fact that you still use mask_rcnn.json configuration file. So I believe you need to create new json configuration file or update current onnx/mask_rcnn.json one specifically for your PMTD model.

Best regards, Max.

0 Kudos
Highlighted
New Contributor I
217 Views

Hi @Max_L_Intel ! Thanks for your reply!

OpenVino 2020.4 now has an implementation for RoIAlign, but now I run into a new error: 

mo.utils.error.Error: Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.ApplyPermutations.ApplyPermutation'>): Can't permute attrs for node 3090. Error message: 0

 

The complete debug log is attached below. 

Any help would be really appreciated!

Thanks!

0 Kudos
Highlighted
Moderator
195 Views

Hi @Sharma__Divyanshu 

The problem seems to be in incorrectly replaced sub-graph. The output from operation should have gone to 3090 node, but that didn't happen.

What layer do you use for this node 3090?

0 Kudos
Highlighted
Moderator
166 Views

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

0 Kudos
Highlighted
New Contributor I
157 Views

Hi! Yes, you're right. The custom RoIAlign implementation was not exported properly by ONNX. I switched to roi_align in torchvision.ops. Also, OpenVino 2020.4 includes an implementation for the roi_align op. So, this issue is now solved. Thanks a lot!

View solution in original post

0 Kudos