tensorflow-onnx icon indicating copy to clipboard operation
tensorflow-onnx copied to clipboard

Conversion of checkpoint + config to ONNX

Open fschvart opened this issue 2 years ago • 4 comments

Hi,

I have a DeepLab 2 TensorFlow checkpoint that I want to convert to ONNX. The conversion to saved_model seems to be buggy so I was wondering whether there's a way to convert it straight to ONNX.

Thanks!

fschvart avatar Jul 18 '22 22:07 fschvart

Could you please describe more details about how you did the conversion and what are buggy things?

fatcat-z avatar Jul 27 '22 16:07 fatcat-z

@fatcat-z I didn't do a conversion yet. I have a TensorFlow Panoptic Deeplab model checkpoint and config file, that there's currently a bug in the code that prohibits me from exporting the checkpoint and config to a saved_model file. Furthermore, if I use the Deeplab2 repo code, inference doesn't run well, only when performed as eval during the model training. I saw someone mentioning in one of the issues that they were in a similar situation and were able to export a checkpoint + config file directly to an ONNX model. I can easily load the model as a trained DeepLab module. Can I somehow convert a DeepLab module to an ONNX model?

fschvart avatar Jul 27 '22 20:07 fschvart

@fatcat-z Jay Zhang FTE I didn't do a conversion yet. I have a TensorFlow Panoptic Deeplab model checkpoint and config file, that there's currently a bug in the code that prohibits me from exporting the checkpoint and config to a saved_model file. Furthermore, if I use the Deeplab2 repo code, inference doesn't run well, only when performed as eval during the model training. I saw someone mentioning in one of the issues that they were in a similar situation and were able to export a checkpoint + config file directly to an ONNX model. I can easily load the model as a trained DeepLab module. Can I somehow convert a DeepLab module to an ONNX model?

TF2ONNX could load checkpoint and export it to ONNX. Could you please go through the usage here to see if any of them can meet your requirement?

fatcat-z avatar Aug 01 '22 05:08 fatcat-z

@fatcat-z I reviewed that file previously. I don't have a metagraph so I can't use, unfortunately, the checkpoint method. Maybe I need to dive into the code and change the way the saved model is loaded (for example) to the way I load the model with checkpoint and config and try converting from that point

fschvart avatar Aug 01 '22 20:08 fschvart

It's been over 2 months, so closing this. Feel free to open a new one if the issue still exists.

fatcat-z avatar Oct 11 '22 05:10 fatcat-z