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

Error when without -dgc: onnx2tf.py -i shufflenet-9.onnx -oiqt #657

Closed hayyaw closed 4 months ago

hayyaw commented 4 months ago

Issue Type

Others

OS

Linux

onnx2tf version number

1.23.0

onnx version number

1.15.0

onnxruntime version number

1.17.1

onnxsim (onnx_simplifier) version number

0.4.33

tensorflow version number

2.16.1

Download URL for ONNX

https://github.com/onnx/models/blob/main/validated/vision/classification/shufflenet/model/shufflenet-9.onnx

Parameter Replacement JSON

no

Description

Error when without -dgc: onnx2tf.py -i shufflenet-9.onnx -oiqt

PINTO0309 commented 4 months ago
onnx2tf -i shufflenet-9.onnx -oiqt -cotof

image

image

image

hayyaw commented 4 months ago

I can not pull onnx2tf:1.23.0 docker. I can obtain the latest docker version is 1.22.4. So, I use 1.23.0 code with 1.22.4 docker:sudo python onnx2tf/onnx2tf.py -i benchmark/shufflenet-9.onnx -oiqt -cotof. However, groupconv converter result is group nums' conv. The full interger quant model size is 49M. I also try to pull onnx2tf:latest docker, the full interger quant model size is also 49M. image How should I get the same result as the picture above? Looking forward to your reply.Thanks!

PINTO0309 commented 4 months ago
docker run --rm -it \
-v `pwd`:/workdir \
-w /workdir \
docker.io/pinto0309/onnx2tf:1.23.3

onnx2tf -i shufflenet-9.onnx -oiqt -cotof

ls -lh saved_model/

total 20M
drwxr-xr-x 2 user user 4.0K Jul  3 07:22 assets
-rw-r--r-- 1 user user   58 Jul  3 07:22 fingerprint.pb
-rw-r--r-- 1 user user 2.5M Jul  3 07:22 saved_model.pb
-rw-r--r-- 1 user user 1.6M Jul  3 07:22 shufflenet-9_dynamic_range_quant.tflite
-rw-r--r-- 1 user user 2.7M Jul  3 07:22 shufflenet-9_float16.tflite
-rw-r--r-- 1 user user 5.4M Jul  3 07:22 shufflenet-9_float32.tflite
-rw-r--r-- 1 user user 1.8M Jul  3 07:22 shufflenet-9_full_integer_quant.tflite
-rw-r--r-- 1 user user 1.9M Jul  3 07:23 shufflenet-9_full_integer_quant_with_int16_act.tflite
-rw-r--r-- 1 user user 1.8M Jul  3 07:22 shufflenet-9_integer_quant.tflite
-rw-r--r-- 1 user user 1.9M Jul  3 07:23 shufflenet-9_integer_quant_with_int16_act.tflite
drwxr-xr-x 2 user user 4.0K Jul  3 07:22 variables