openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
7.36k stars 2.3k forks source link

How to convert a tensorflow faster rcnn pb model with two "pyFunc" ops? #121

Closed chenaili6 closed 4 years ago

chenaili6 commented 5 years ago

The pre-trained model in https://github.com/endernewton/tf-faster-rcnn :res101_faster_rcnn_iter_110000.meta has more than one “pyfunc” tensorflow ops。I want to convert this model to openvino model, but failed with op “pyfunc”, is there a proper way to convert this model? Thank you very much!

shubha-ramani commented 5 years ago

Dearest @chenaili6 :

You bet. We can convert faster_rcnn models. Please check out the below documentation. Pay special attention to the version of Tensorflow used in the model because the *.json file you will use in the command is different per Tensorflow API version ! https://docs.openvinotoolkit.org/latest/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_Object_Detection_API_Models.html

Thanks for using OpenVino !

Shubha

chenaili6 commented 5 years ago

Thanks for your help! I can convert frozen models in Object Detection Model Zoo with python3 mo.py --input_model=/home/faster_rcnn_resnet101_coco_2018_01_28/frozen_inference_graph.pb --output=detection_boxes,detection_scores,num_detections --tensorflow_use_custom_operations_config extensions/front/tf/faster_rcnn_support.json --tensorflow_object_detection_api_pipeline_config /home/faster_rcnn_resnet101_coco_2018_01_28/pipeline.config . But the topologies of the model in https://github.com/endernewton/tf-faster-rcnn is a bit different from the model in Object Detection Model Zoo 。 Now I have got the frozen file without pyfunc operations, and I tried to follow the methods of using the TensorFlow* Object Detection API to write a similar ***.json and pipeline.config, but failed with error: Exception occurred during running replacer "ObjectDetectionAPIRoisProposalReplacement" (<class 'extensions.front.tf.ObjectDetectionAPI.ObjectDetectionAPIRoisProposalReplacement'>): The matched sub-graph contains network input node "Placeholder_1". The version of openvino is:computer_vision_sdk_2018.5.445. Could you give me some help? Thanks again!

shubha-ramani commented 5 years ago

Dearest @chenaili6 , may I kindly nudge you to download 2019 R1 ? The reason I ask is that many issues have been fixed in that release. Please try again with the latest release and post your findings here.

Thank you for using OpenVino !

Shubha

lazarevevgeny commented 4 years ago

@chenaili6 there is no way to convert the TF model with PyFunc operations because there is no implementation of this custom TF operations in the OpenVINO plugins.

And the https://github.com/endernewton/tf-faster-rcnn model is not supported and there are no plans to support it. Please, use Tensorflow Object Detection Model zoo models instead.