daquexian / onnx-simplifier

Simplify your onnx model
Apache License 2.0
3.67k stars 377 forks source link

resnet18 and inception cannot use simplify method #311

Closed deng-ShiFu closed 8 months ago

deng-ShiFu commented 8 months ago

I downloaded the onnx files for the following four models.

The simplify method can be used normally for DenseNet and EfficientNet, but this method cannot be used for ResNet18 and Inception. The following errors occurred for ResNet18 and Inception respectively. 1 2

Below is the code I use. ` import onnx from onnxsim import simplify

onnxModel = onnx.load("test/resnet18-v2-7.onnx") model_simp, check = simplify(onnxModel) `

I used the online tool(convertmodel.com) you provided to apply resnet18, and found that this tool can be applied to resnet18, and the output model (resnet18_sim) will not have this error when using the simplify method. My onnxsim version is 0.4.33. I am a beginner and I am not familiar with onnx and deep learning models. I am not sure whether my wrong operation caused the problem.

daquexian commented 8 months ago

Thanks for using onnxsim.

It's indeed a bug of onnxsim, which only occurs on very old models.

I have fixed it in the latest version (4.34).

Feel free to reopen this issue if you have any other further questions.