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

Error while converting MaskRCnn custom trained model

Vishnuj
Beginner
698 Views

Hi,

I am trying to convert a custom trained MaskRCNN model. 

I downloaded the model from here:   https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.m...

and trained it on custom dataset.

Tensorflow version used to training: 2.6

 

I used the following command to convert the model:

mo --saved_model_dir "models/gcp_model_maskrcnn_with_masks/export_run2/export/saved_model" --transformations_config "/root/sharedfolder/dent_damage_det/mask_rcnn_support_api_v2.4.json" --tensorflow_object_detection_api_pipeline_config "models/gcp_model_maskrcnn_with_masks/export_run2/export/pipeline.config" --output_dir "models/gcp_model_maskrcnn_with_masks/export_run2/export/openvino_model" --input_shape [1,1024,1024,3] --reverse_input_channels

 

The conversion is giving me this error:

[ ERROR ]  Exception occurred during running replacer "ObjectDetectionAPIPreprocessor2Replacement" (<class 'openvino.tools.mo.front.tf.ObjectDetectionAPI.ObjectDetectionAPIPreprocessor2Replacement'>): The matched sub-graph contains network input node "input_tensor". 
 For more information please refer to Model Optimizer FAQ, question #75. (https://docs.openvino.ai/latest/openvino_docs_MO_DG_prepare_model_Model_Optimizer_FAQ.html?question=75#question-75)

 

The custom model and pipeline config file is available at this location: 

https://drive.google.com/drive/u/2/folders/1DxeiIgOi8MFWGxm206NzFf5EB_Jok0Ig

 

Please help me to resolve this issue.

 

Thanks,

Vishnu

0 Kudos
6 Replies
IntelSupport
Community Manager
674 Views

Hi Vishnuj,


Thanks for reaching out.

I received the same error as you. We are still investigating and will get back to you with the information soon.



Regards,

Aznie


0 Kudos
IntelSupport
Community Manager
657 Views

Hi Vishnu,

 

I am able to convert the Mask R-CNN Inception ResNet V2 1024x1024 from TensorFlow 2 Detection Model Zoo. For your information, if you retrain a model, you have to also retrain the config file. Retrain the config file is a bit difficult because it depends on the model network. You may refer to this Github thread that has a similar issue and hope this would help.

 

 

Regards,

Aznie


0 Kudos
Vishnuj
Beginner
637 Views

Hi Aznie,

 

I followed the blog and added the line "coordinates_swap_method": "swap_weights" but still I am getting the same error.

Since you are telling you were able to convert the model, can you please share the config file which you have used?

Also let me know how to retrain the config file for custom models.

 

Thanks,

Vishnu

0 Kudos
Hairul_Intel
Moderator
616 Views

Hi Vishnu,

From the previous reply, the Mask R-CNN Inception ResNet V2 1024x1024 model from TensorFlow 2 Detection Model Zoo was converted by using mask_rcnn_support_api_v2.0.json, since this model was trained with TensorFlow 2.2 version.

 

The commands used to convert Mask R-CNN Inception ResNet V2 1024x1024 model:

mo --saved_model_dir mask_rcnn_inception_resnet_v2_1024x1024_coco17_gpu-8\saved_model --tensorflow_object_detection_api_pipeline_config mask_rcnn_inception_resnet_v2_1024x1024_coco17_gpu-8\pipeline.config --transformations_config openvino\tools\mo\front\tf\mask_rcnn_support_api_v2.0.json --reverse_input_channels

 

Here is the result for converting the Mask R-CNN Inception ResNet V2 1024x1024 model:

success_convert.png

 

 

Regarding custom config file, you can follow this article on steps to correct custom replacement description in JavaScript Object Notation (JSON) file with respect to the node names of the model. The steps mentioned in the article are for Faster R-CNN TensorFlow models but are applicable for Mask R-CNN TensorFlow models as well.

 

 

Regards,

Hairul

 

0 Kudos
Vishnuj
Beginner
568 Views

Hi, 

I could understand which node names to match. There are lot of node names when we visualize the input graph of the model. Which node names should be there or not there. I could not understand. Can you please help me with it.

 

Thanks,

Vishnu

0 Kudos
IntelSupport
Community Manager
581 Views

Hi Vishnu,


This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.



Regards,

Aznie


0 Kudos
Reply