walterPeyton
walterPeyton

Reputation: 31

Tensorflow to ONNX conversion

I'm currently trying to convert a saved (and working) .pb file that I created with this tutorial (https://github.com/thtrieu/darkflow) into a onnx file. I'm using winML tools at the moment but the result of the conversion doesn't work at all (the input parameters are wrong + the whole architecture is not correct).

My input parameter (as specified on the very bottom of the readme): input:0

Output node: ouput:0

I want to use the converted model inside a UWP application that's running on a HoloLens.

Has anyone already successfully converted this model (or any TensorFlow model) to ONNX?

Upvotes: 3

Views: 15566

Answers (2)

duongntbk
duongntbk

Reputation: 670

You can use tf2onnx to convert your .pb file to onnx.

Install it using pip.

pip install tf2onnx

Then you call it like this.

python -m tf2onnx.convert --input <path to your pb file> --inputs <comma-delimited input names goes here> --outputs <comma-delimited output names goes here> --output <path to output in onnx format>

You said your input is input:0 and your ouput is ouput:0, so the command should look like this.

python -m tf2onnx.convert --input yolo.pb --inputs input:0 --outputs ouput:0 --output yolo.onnx

If necessary, you can use the netron app to verify the input and output name.

Upvotes: 4

Radmar
Radmar

Reputation: 73

I converted several models from TF to onnx with MMdnn

Also, tf2onnx can be usefull

Upvotes: 3

Related Questions