lucasjinreal / DCNv2_latest

DCNv2 supports decent pytorch such as torch 1.5+ (now 1.8+)
BSD 3-Clause "New" or "Revised" License
614 stars 125 forks source link

onnx model has no weights and bias #5

Open ArtyZe opened 3 years ago

ArtyZe commented 3 years ago

Hello, thanks for your great work! Now I can export onnx model with dcn op successfully. But my onnx model is not correct: image As my weights and bias have not been export to onnx.

Have you ever met same error? Thanks!

maxclaey commented 3 years ago

@ArtyZe How did you manage to export to ONNX model? When I try to export to onnx, I get RuntimeError: No Op registered for Plugin with domain_version of 9 Thanks in advance for you help!

lucasjinreal commented 3 years ago

@ArtyZe DCN's onnx is a custom op not listed on ONNX standard, your visualization result might not accurate. For validation, you can check your onnx inference result using onnx-runtime.

ArtyZe commented 3 years ago

@ArtyZe How did you manage to export to ONNX model? When I try to export to onnx, I get RuntimeError: No Op registered for Plugin with domain_version of 9 Thanks in advance for you help!

Hi, You got see code below in file dcnv2_onnx.py ? image It's a torch supported way to register ops to torch/onnx. So 1. replace your dcnv2.py file with dcnv2_onnx.py then export model to onnx or 2. add above code to your own code and then export model to onnx

ArtyZe commented 3 years ago

@ArtyZe DCN's onnx is a custom op not listed on ONNX standard, your visualization result might not accurate. For validation, you can check your onnx inference result using onnx-runtime.

You are right. It's a tool bug of netron for custom ops. Data exist but netron displays nothing. It's right when I export data of this op with python

austinmw commented 3 years ago

@maxclaey did you find a solution to this? I'm running into the same issue. @jinfagang Do you happen to know what this error comes from?

edit: Turns out I needed operator_export_type=torch.onnx.OperatorExportTypes.ONNX_ATEN_FALLBACK in torch.onnx.export()

MoaazAbdulrahman commented 2 years ago

@ArtyZe I have tried your solution using dcnv2_onnx.py but I am still facing the same error RuntimeError: No Op registered for Plugin with domain_version of 9. Could you please share with me the file that you used to convert to onnx. Thanks.