Community
cancel
Showing results for 
Search instead for 
Did you mean: 
PIN__LO
Beginner
278 Views

Convert *.pb to IR format from custom Mask RCNN

Dear all,

I am trying to generate IR files for custom trained Mask RCNN model on tensorflow.

Model: Mask RCNN Inception V2

Tensorflow version: 1.12.0

Openvino: 2019.R1

Command used for IR generation:

cd %~dp0
SET MODEL_DIR=model/Mask_RCNN_0612
SET MODEL_NAME=frozen_inference_graph
SET CUSTOM_JASON_PATH=extensions/front/tf/mask_rcnn_support_api_v1.7.json
set CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1
python mo_tf.py --input_model "%MODEL_DIR%/%MODEL_NAME%.pb" --input_shape [1,800,800,3] --tensorflow_use_custom_operations_config "%CUSTOM_JASON_PATH%" --tensorflow_object_detection_api_pipeline_config "%MODEL_DIR%/pipeline.config" --output_dir "%MODEL_DIR%/IR_format" --reverse_input_channels

 

The error message:

[ ERROR ]  Failed to match nodes from custom replacement description with id 'ObjectDetectionAPIProposalReplacement':
It means model and custom replacement description are incompatible.
Try to correct custom replacement description according to documentation with respect to model node names
[ ERROR ]  Failed to match nodes from custom replacement description with id 'ObjectDetectionAPIDetectionOutputReplacement':
It means model and custom replacement description are incompatible.
Try to correct custom replacement description according to documentation with respect to model node names
[ ERROR ]  Failed to match nodes from custom replacement description with id 'ObjectDetectionAPIMaskRCNNROIPoolingSecondReplacement':
It means model and custom replacement description are incompatible.
Try to correct custom replacement description according to documentation with respect to model node names
The predicted masks are produced by the "masks" layer for each bounding box generated with a "detection_output" layer.
Refer to IR catalogue in the documentation for information about the DetectionOutput layer and Inference Engine documentation about output data interpretation.
The topology can be inferred using dedicated demo "mask_rcnn_demo".
[ ERROR ]  Graph contains 0 node after executing <class 'extensions.front.create_tensor_nodes.CreateTensorNodes'>. It considered as error because resulting IR will be empty which is not usual
Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.front.create_tensor_nodes.CreateTensorNodes'>): Graph contains 0 node after executing <class 'extensions.front.create_tensor_nodes.CreateTensorNodes'>. It considered as error because resulting IR will be empty which is not usual

 

I successfully convert the original  Mask RCNN model to IR format (https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md) , using the same command.

I followed the object detection API (https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html) to train my own model. 

I also tried openvino 2020R1  and other json file: v1.7 , v1.11  ,v1.13 ,v1.14, and v1.15. The results are all the same.

The attachment is the frozen *.pb file.

Hope someone can help, thanks a lots.

 

 

0 Kudos
2 Replies
JesusG_Intel
Moderator
278 Views

Hello Lo,

I apologize for the delay. Thanks for sending your files. We are looking into your issue.

Regards,

JesusG_Intel
Moderator
278 Views

Hello Lo,

I have looked at your modified PB file and noticed that it is much different than the original pre-trained model and that is why it cannot be converted as-is. I have tried many of the .json files provided in openvino/../front/tf and none of them work. I have also tried modifying some of the .json files without success.

There are a couple of other things you can try to see if they help:

1) Try using a later version of Tensorflow to train your model.

2) Follow the guidance for Custom Layers in the Model Optimizer.

Regards,

Reply