'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? If so, I'd be very thankful for any link/tutorial/help!!

Please let me know if you need any more Information. I'm very unexperienced with such forums. Sorry about that.

Walter



Solution 1:[1]

I converted several models from TF to onnx with MMdnn

Also, tf2onnx can be usefull

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Radmar
Solution 2 duongntbk