tensorflow / models

Models and examples built with TensorFlow
Other
77.16k stars 45.75k forks source link

Exporting a trained model for inference (Tensorflow 2) #9617

Open MattVoge opened 3 years ago

MattVoge commented 3 years ago

I have a general question: How can I export a Object Detection model including all weights into a protobuf file without using checkpoints? Tensorflow 1 allowed this (export_inference_graph.py), however, I see no way in TF2.

lucky-xu-1994 commented 3 years ago

I have the same question with @MattVoge .

saikumarchalla commented 3 years ago

@MattVoge @lucky-xu-1994 Could you please use exporter_main_v2.py for TF2 and let us know if that solves your query. Thanks!

lucky-xu-1994 commented 3 years ago

@MattVoge @lucky-xu-1994 Could you please use exporter_main_v2.py for TF2 and let us know if that solves your query. Thanks!

I have used exporter_main_v2.py to export model, it created a saved_model (assets, variables, saved_model.pb),and can only be used as an inference model, not supported to be used on other platforms. so what I need is to freeze the model like in TF1, please help!

MattVoge commented 3 years ago

@MattVoge @lucky-xu-1994 Could you please use exporter_main_v2.py for TF2 and let us know if that solves your query. Thanks!

Thanks for your reply. But as I've said above, I want to export it without checkpoints. Just one protobuf including all weights and stuff.

romeolandry commented 3 years ago

I have the same Problem. Please Help!

Suraj1199 commented 3 years ago

As suggested by this answer on stack overflow, compat.v1 module can be used . I have shared it as a reference for the ones who face the same issue.

FPerezHernandez92 commented 3 years ago

Any news?

eirikaso commented 3 years ago

No updates?

abdulghani91 commented 3 years ago

I have finished the training with TensorFlow 2 and I want to know how can I export my model as model.pb, and can I use it with OpenCV, anyone can help me with that