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

Depth_Anything to ONNX model's conversion failed #589

Closed Meleko96 closed 6 months ago

Meleko96 commented 7 months ago

Issue Type

Documentation Feature Request

OS

Linux

onnx2tf version number

1.19.11

onnx version number

1.15.0

onnxruntime version number

1.17.0

onnxsim (onnx_simplifier) version number

0.4.35

tensorflow version number

2.12.1

Download URL for ONNX

https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/439_Depth-Anything/resources_s.tar.gz

Parameter Replacement JSON

{
  "format_version": 1,
  "operations": [
    {
      "op_name": "wa/depth_head/refinenet4/Resize",
      "param_target": "inputs",
      "param_name": "wa/Constant_5_output_0",
      "values": [34,45]
    }
  ]
}

Description

Hello, I am trying to convert the depth_anything onnx model to tensorflow lite. The model's variant is depth_anything_vits14_1x3x480x640.onnx. The command that I used is: onnx2tf -i depth_anything_vit_480x640.onnx -b 1 -osd -oiqt -ioqd int8 -coion -prf replace_param_depth_any.json I got the following error. image image I tried to understand and debug the problem, but I was not able to fix it. image

Thank you for your help!

PINTO0309 commented 6 months ago

No parameter substitution is required.

pip install onnx2tf -U
pip install tensorflow==2.15.0.post1
onnx2tf -i depth_anything_vits14_1x3x480x640.onnx -cotof -cotoa 1e-3

image