Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception occurred during running replacer "ObjectDetectionAPIOutputReplacement" [Build]: - empty IR #24375

Closed
2 tasks done
Executer13 opened this issue May 6, 2024 · 14 comments
Assignees

Comments

@Executer13
Copy link

OpenVINO Version

2024.1

Operating System

Other (Please specify in description)

Hardware Architecture

x86 (64 bits)

Target Platform

Google Colab
Tensorflow 2.8.0

Build issue description

i am trying to onver the tensorflow object detection API model after finetuning it. However, i am unable to do so as with saved_model and frozen, as i keep getting the error:-

[ ERROR ] Exception occurred during running replacer "ObjectDetectionAPIOutputReplacement" (<class 'openvino.tools.mo.front.tf.ObjectDetectionAPI.ObjectDetectionAPIOutputReplacement'>): Graph contains 1 node after executing <class 'openvino.tools.mo.front.tf.ObjectDetectionAPI.ObjectDetectionAPIOutputReplacement'>. It considered as error because resulting IR will be empty which is not usual

Build script or step-by-step to reproduce

!mo --input_model /content/gdrive/MyDrive/custom_model_lite/saved_model/frozen/frozen_model.pb
--tensorflow_object_detection_api_pipeline_config /content/gdrive/MyDrive/config/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8.config
--transformations_config=/content/gdrive/MyDrive/json/ssd_support_api_v2.4.json
--reverse_input_channels
--log_level DEBUG \

Relevant log output

[ ERROR ]  Exception occurred during running replacer "ObjectDetectionAPIOutputReplacement" (<class 'openvino.tools.mo.front.tf.ObjectDetectionAPI.ObjectDetectionAPIOutputReplacement'>): Graph contains 1 node after executing <class 'openvino.tools.mo.front.tf.ObjectDetectionAPI.ObjectDetectionAPIOutputReplacement'>. It considered as error because resulting IR will be empty which is not usual

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
@rkazants
Copy link
Contributor

rkazants commented May 6, 2024

Hi @Executer13,

We do not recommend to use configs for conversion object detection models. This is legacy approach. Also, please use ovc that are replacing mo (legacy) tool and mo will be removed in 2025 release. See documentation about transitioning to new conversion API for more details: https://docs.openvino.ai/2024/documentation/legacy-features/transition-legacy-conversion-api.html.
Regarding your case, please execute out-of-the-box conversion by the following run:

ovc frozen_model.pb

Best regards,
Roman

@Executer13
Copy link
Author

Hey @rkazants thanks for the response. i have tried the given solution. However, it keeps resulting in Empty .bin IR file. Please let me know if there is a way to convert the TENSORFLOW OBJECT DETECTION API MODEL to IR either via tflite, saved_model or frozen thanks

@rkazants
Copy link
Contributor

rkazants commented May 6, 2024

Hi @Executer13, can you share your model frozen_model.pb please?

Best regards,
Roman

@Executer13
Copy link
Author

frozen_graph.zip
detect.zip
saved_model.zip
Kindly find the attached Tflite, frozen_model.pb and the saved_model directory. i have tried several methods for conversion of these files using tflite conversion, conversion using mo and ovc.

@Executer13
Copy link
Author

Executer13 commented May 6, 2024

Note:- tflite is a successful model working correctly when used for detection. If you could provide me a solution or converted IR that would be really grateful of you! THANKS

@rkazants rkazants added bug Something isn't working and removed support_request labels May 6, 2024
@rkazants rkazants changed the title Exception occurred during running replacer "ObjectDetectionAPIOutputReplacement" [Build]: Exception occurred during running replacer "ObjectDetectionAPIOutputReplacement" [Build]: - empty IR May 6, 2024
@Executer13
Copy link
Author

is there any update? or any workaround of this. would be much appreciated if i could just get a way to convert the tflite either. Thanks!

@rkazants
Copy link
Contributor

rkazants commented May 7, 2024

Hi @Executer13,

I noticed that frozen_graph.pb is strange and contains Identity nodes and Placeholder without meaningful part:

image

However, you seem to have a correct model in SavedModel format. So my recommendation to work with it:

ovc saved_model

Pay attention that saved_model is a directory with input model.

Best regards,
Roman

@Executer13
Copy link
Author

Thank for the response. i am trying to run the command to convert the model using ovc:-


!ovc /content/gdrive/MyDrive/saved_model \
--output_model  /content/gdrive/MyDrive//saved_model \
--compress_to_fp16=False

and i am getting the output:-

[ SUCCESS ] XML file: /content/gdrive/MyDrive//saved_model/saved_model.xml
[ SUCCESS ] BIN file: /content/gdrive/MyDrive//saved_model/saved_model.bin

However, the Bin file is still empty! Note:- i have tried via mo as well

@Executer13
Copy link
Author

Executer13 commented May 7, 2024

@rkazants are you able to convert the saved_model to IR. if yes, please share the IR thanks!

@rkazants
Copy link
Contributor

Hi @Executer13, I did reproduce the bug. Please give me some time to fix it.

Best regards,
Roman

@rkazants
Copy link
Contributor

Hi @Executer13,

The model is strange because it always outputs four zero scalars. Please check.

image

Also, we have internal transformation inside TF FE to remove Constant->Result isolated sub-graphs because they are not meaningful from perspective. That is why the resulted model is empty. So there is no bug on OV side. It is specific to the input model.

Best regards,
Roman

@rkazants rkazants added support_request and removed bug Something isn't working labels May 10, 2024
@Executer13
Copy link
Author

Executer13 commented May 10, 2024

Hey @rkazants thanks for the insight the issue was actually resolved by considering freezing layers from the checkpoint and considering the conversion of the frozen_graph using the tensorflow-object-detection-api pipeline with ssd-config.

THANKS!

@rkazants
Copy link
Contributor

Hi @Executer13, please also consider using ovc because tensorflow-object-detection-api pipeline with ssd-config is deprecated approach. Does ovc work for you?

Best regards,
Roman

@rkazants
Copy link
Contributor

Hi @Executer13,

If no more question, I am closing this ticket. Please don't hesitate to ask in case of question.

Best regards,
Roman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants