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

When my model is conv3d, avgpool3d seems to have some issues #722

Closed jungyin closed 1 week ago

jungyin commented 2 weeks ago

Issue Type

Feature Request

OS

Linux

onnx2tf version number

1.26.2

onnx version number

1.16.1

onnxruntime version number

1.18.1

onnxsim (onnx_simplifier) version number

0.4.36

tensorflow version number

2.17.0

Download URL for ONNX

https://1drv.ms/u/c/4008ad016f04b6a0/ET1fYPRg0fxNk9NAPr870pkBcKNHr_xKjm7wZF5Ii2hXLg?e=nKf0KE

Parameter Replacement JSON

{
    "inputs": [
        {
            "name": "input_0",
            "shape": [
                1,
                3,
                150,
                128,
                128
            ]
        }
    ],
    "outputs": [
        {
            "name": "face_PPG",
            "shape": [
                1,
                150
            ]
        },
        {
            "name": "finger_PPG",
            "shape": [
                1,
                150
            ]
        }
    ]
}

Description

My model structure is conv3d, and its input type is ncdhw. When I try to convert the onnx model to tflite, there is always an error in the screenshot. After changing it to a fixed value, it can export the model normally. I am not sure if this modification is correct. Can you provide me with some guidance

image

PINTO0309 commented 2 weeks ago

onnx file

jungyin commented 2 weeks ago

onnx 文件

i was update https://1drv.ms/u/c/4008ad016f04b6a0/ET1fYPRg0fxNk9NAPr870pkBcKNHr_xKjm7wZF5Ii2hXLg?e=nKf0KE

PINTO0309 commented 2 weeks ago

TensorFlow cannot pool properly when count_include_pad = 1. see: https://github.com/PINTO0309/onnx2tf/issues/124

https://github.com/onnx/onnx/blob/main/docs/Changelog.md#averagepool-11

image

jungyin commented 1 week ago

TensorFlow cannot pool properly when count_include_pad = 1. see: #124

https://github.com/onnx/onnx/blob/main/docs/Changelog.md#averagepool-11

  • AveragePool-11 image

image

It seems that this approach requires adjustments to the existing model, and such adjustments may require me to retrain the model? Besides, you can take a look. After I made changes to the source code, this error will pause the report. Is this modification correct? Looking forward to your reply, thank you very much!

PINTO0309 commented 1 week ago

Check the accuracy of the model by specifying the -cotof option. It is probably incredibly inaccurate.

It seems that this approach requires adjustments to the existing model, and such adjustments may require me to retrain the model?

Unfortunately, that's right.

jungyin commented 1 week ago

Check the accuracy of the model by specifying the option. It is probably incredibly inaccurate.-cotof

It seems that this approach requires adjustments to the existing model, and such adjustments may require me to retrain the model?

Unfortunately, that's right.

i was try add -cotof,it print this,maby it is surcess work? image

PINTO0309 commented 1 week ago

The conversion was completely successful.

However, AvgPool has a very large number of edge cases. This time it just happened to work, so you need to be careful that it won't always be successful.

github-actions[bot] commented 1 week ago

If there is no activity within the next two days, this issue will be closed automatically.