murdockhou / Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM

GNU Lesser General Public License v3.0
59 stars 17 forks source link

RuntimeError: ONNX export failed: Couldn't export Python operator SwishImplementation #6

Open nutsam opened 4 years ago

nutsam commented 4 years ago

I ran your convert to onnx code and had error like title, can you help?

murdockhou commented 4 years ago

@nutsam you need set EfficientSwish false like that

nutsam commented 4 years ago

Yes, I used your code and has that line already, but still error.

murdockhou commented 4 years ago

Are you sure you are using the original code and not change anywhere? It's weird if you not change code but occur this error. The env that I use is:

nutsam notifications@github.com 于2020年5月14日周四 上午10:08写道:

Yes, I used your code and has that line already, but still error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/murdockhou/Yet-Another-EfficientDet-Pytorch-Convert-ONNX-TVM/issues/6#issuecomment-628342468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMCC7JUKIWDTRYUJF2FX5DRRNHCJANCNFSM4M7RQM7Q .

Beam-wi commented 4 years ago

@nutsam Have you solved this problem? I encounter the same problem with you.

Beam-wi commented 4 years ago

@nutsam 知道了,作者在 EfficientDetBackbone 中实例化 BiFPN,Regressor,Classifier时没有传onnx_export参数,加进去就行了

swchew commented 3 years ago

@Beam-wi may I ask which code and exactly where should we insert "onnx_export" into?

heitorrapela commented 2 years ago

If you print the model (print(model)), you can debug in which parts of the code still have the MemoryEfficientSwish.

In my case, my model had the backbone (efficient net) and the detector wrapped, so when I loaded the set_swish after the loaded model or if I used the flag to initialize the model and then load the weights, flag onnx_export didn't update the layer. So, I had to fix it manually as the following code: