PINTO0309 / onnx2tf

Self-Created Tools to convert ONNX files (NCHW) to TensorFlow/TFLite/Keras format (NHWC). The purpose of this tool is to solve the massive Transpose extrapolation problem in onnx-tensorflow (onnx-tf). I don't need a Star, but give me a pull request.
MIT License
712 stars 73 forks source link

How to convert onnx(NCHW) to NHWC and write back to onnx file Because my HW takes onnx file as input in NHWC format #584

Closed abhishek27m1992github closed 9 months ago

abhishek27m1992github commented 9 months ago

Issue Type

Others

OS

Others

onnx2tf version number

na

onnx version number

na

onnxruntime version number

na

onnxsim (onnx_simplifier) version number

na

tensorflow version number

na

Download URL for ONNX

na

Parameter Replacement JSON

na

Description

it's just a question or may be a feature request.

abhishek27m1992github commented 9 months ago

My H/W can take .tflite file as input( which is already in NWHC format) and works file. but to use variety of models genarted from different framework we are now fixing onnx as common input so it can take .onnx file as input but should be in NHWC format. so came across your solution but i think it converts onnx2tflite .

PINTO0309 commented 9 months ago

https://github.com/PINTO0309/simple-onnx-processing-tools

abhishek27m1992github commented 9 months ago

https://github.com/PINTO0309/simple-onnx-processing-tools

scc4onnx: as shown in example it adds transpose as extra layer in order to convert to NHWC but it brings extra overhead to H/W performance. i want the output without transpose layer similar like onnx2tf tool. So the other way is to change/reshuffle the weight matrix. Can your onnx2tf tool write the data into onnx in NHWC format or any tool without adding transpose layer ?