Search code examples
tensorflowonnx

Tensorflow 2.0 model checkpoint files to .pb/onnx file


For model checkpoint files (usually consist of .meta, .data, .index) generated from TF-2.0, how can I convert it to onnx or pb file? since I found most of the existing tools, such as tf2onnx only support TF-1.x.


Solution

  • tf2onnx supports tf2, saved models, and checkpoint files. I would recommend making a saved model:

    model.save("path")

    Then use tf2onnx command line:

    tf2onnx.convert --saved-model path/to/model --output model.onnx --opset 12

    https://github.com/onnx/tensorflow-onnx#--saved-model