models icon indicating copy to clipboard operation
models copied to clipboard

Exporting a trained model for inference (Tensorflow 2)

Open MattVoge opened this issue 5 years ago • 9 comments

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.

MattVoge avatar Jan 07 '21 09:01 MattVoge

I have the same question with @MattVoge .

lucky-xu-1994 avatar Jan 08 '21 02:01 lucky-xu-1994

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

saikumarchalla avatar Jan 10 '21 14:01 saikumarchalla

@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!

lucky-xu-1994 avatar Jan 11 '21 01:01 lucky-xu-1994

@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.

MattVoge avatar Jan 11 '21 13:01 MattVoge

I have the same Problem. Please Help!

romeolandry avatar Jan 26 '21 07:01 romeolandry

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.

Suraj1199 avatar Mar 25 '21 16:03 Suraj1199

Any news?

FPerezHernandez92 avatar Apr 27 '21 11:04 FPerezHernandez92

No updates?

eirikaso avatar Jun 03 '21 14:06 eirikaso

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

abdulghani91 avatar Jul 29 '21 17:07 abdulghani91