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
706 stars 73 forks source link

Add transposition to the tflite model #700

Closed pipipyau closed 1 month ago

pipipyau commented 1 month ago

Issue Type

Feature Request

OS

OSX

onnx2tf version number

1.25.12

onnx version number

1.16.2

onnxruntime version number

1.19.2

onnxsim (onnx_simplifier) version number

0.4.36

tensorflow version number

2.17.0

Download URL for ONNX

https://drive.google.com/file/d/18IkWTktKG2wTvtjnrjsNodD9ri4jmLZE/view?usp=drive_link

Parameter Replacement JSON

{}

Description

  1. I am studying model conversion as part of my Research development at the university.
  2. Need to leave the option to use the same input data as for the onnx model for tflite model. simple example is (1,3,224,224) (NCHW), but my obtained (from onnx) tflite model have NHWC input and no transpose layer.
  3. I tried to use flags when converting -k
  4. This task takes into account that when replacing the model, it will not be possible to change the input data
PINTO0309 commented 1 month ago

I'm sorry, but I don't understand what you're expecting.

onnx2tf -i conv_model.onnx

image

onnx2tf -i conv_model.onnx -kat input

image

pipipyau commented 1 month ago

Thank you for your reply! I used the -k flag incorrectly. And what about the output - is it possible to keep the shape there by adding a transposition (1, 16, 224, 224)?

PINTO0309 commented 1 month ago

WIP: https://github.com/PINTO0309/onnx2tf/tree/rep_param_conv WIP: https://github.com/PINTO0309/onnx2tf/commit/1ab3f1177b35db34e44463ee6d02c64140679404

pipipyau commented 1 month ago

Thanks for your work✨

PINTO0309 commented 1 month ago

Fix: https://github.com/PINTO0309/onnx2tf/releases/tag/1.26.0