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

Error while Converting Tensorflow 2 Faster R-CNN ResNet101 V1 640x640 - custom trained model

Anishauday
Novice
3,324 Views

Hi Team,

Request to help in converting my Tensorflow 2 SavedModel to IR Format

I have custom trained the model and did transfer learning and used Intel Devcloud to convert the Tensorflow 2 SavedModel format to IR

Model used: Tensorflow 2 Faster R-CNN ResNet101 V1 640x640

 

I tried running the command mo_tf.py --saved_model_dir saved_model and got the error attached in the log

I also tried specificying the input shape as [1,3,640,640] (not sure if is the correct shape) and still got the same error

 

Request to help resolve this

 

Labels (1)
0 Kudos
13 Replies
Munesh_Intel
Moderator
3,303 Views

Hi Anisha,

I am moving this topic to DevCloud for Edge forum for further assistance.

 

For future DevCloud for Edge related questions, I would suggest you post in the DevCloud for Edge forum.

Link : https://community.intel.com/t5/Intel-DevCloud-for-Edge/bd-p/devcloud-edge

 

Regards,

Munesh


0 Kudos
ChrisB_Intel
Moderator
3,265 Views

Anishauday,


Can you share your model with me so I can take a look? Please feel free to send it to me via private message so you don't have to share it publicly.


Thanks

Chris



0 Kudos
Anishauday
Novice
3,255 Views

Hi Chris, Thanks very much for the help! Inboxed you the lite weight model file since the actual model file is >70 MB

0 Kudos
ChrisB_Intel
Moderator
3,225 Views


  Could you give us a link to the model you used for training? You mentioned faster rcnn but the zip is ssd which is a different model architecture. Also, it would be good to know what tensorflow version you used to train?


Additionally, please try and convert using these parameters: mo.py --saved_model_dir <model_dir>/saved_model/ --transformations extensions/front/tf/ssd_support_api_v2.4.json --tensorflow_object_detection_api <model_dir>/pipeline.config


Please also PM me the pipeline.config file


Thanks

Chris



0 Kudos
Anishauday
Novice
3,208 Views
I shared the SSD model because there was restriction on sending large files.
Used the model from : https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md for transfer learning.
The model I shared is SSD mobilenet V2 320*320
If you down load the .tar file then you will be able to get the .config file.

I will also try converting using the command you mentioned.

Thanks very much
0 Kudos
ChrisB_Intel
Moderator
3,192 Views

Thanks for the clarification, please let me know your results on that conversion.


Thanks

Chris



0 Kudos
ChrisB_Intel
Moderator
3,175 Views

Did you have any success converting that model?


Thanks

Chris



0 Kudos
Anishauday
Novice
3,162 Views
Hi Chris,
Thanks for following up! I'm still unsuccessful with model optimization.

I tried freezing the TF2 Object detection model- Faster RCNN res101 640*640 from custom trained from TF2 model zoo.

mo_tf.py --input_model frozen_model.pb --output_dir out_model/ --reverse_input_channels --input_shape=[1,640,640,3] --input=input_tensor --output=detection_scores,detection_boxes,num_detections --transformations_config=/opt/intel/openvino_2021.4.582/deployment_tools/model_optimizer/extensions/front/tf/faster_rcnn_support.json --tensorflow_object_detection_api_pipeline_config=/home/u80089/aj/pipeline.config

and we got the error

[ ERROR ] Exception occurred during running replacer "REPLACEMENT_ID" (<CLASS>): Nonode with name num_detections</CLASS>
0 Kudos
ChrisB_Intel
Moderator
3,144 Views

Thanks for getting back to me, I am still investigating, will get back to you shortly.


Thanks

Chris



0 Kudos
ChrisB_Intel
Moderator
3,119 Views

Instead of using the support.json, you should use the api version that corresponds with the version of tensor flow that you used. Which by the way, which version did you use? If that doesn't work I would also need copy of the frozen_model.pb and pipline.config.

ChrisB_Intel_0-1626711727906.png

 

0 Kudos
Anishauday
Novice
3,101 Views

Hi Chris, Thanks a lot.. I have inboxed you the pipeline.config file but couldn't attach the frozen file for FasterRCNN since its really huge. Also I tried with 2.4.json file still no luck.

0 Kudos
ChrisB_Intel
Moderator
3,080 Views

Anishauday


I have moved your case over to the OpenVino team. I have been in contact with them and they are already working on it. I am moving the case into their community for tracking purposes.


Thansk

Chris



0 Kudos
Anishauday
Novice
3,057 Views

Thanks very much Chris!

0 Kudos
Reply