vision icon indicating copy to clipboard operation
vision copied to clipboard

does deformable conv support export to onnx?

Open lucasjinreal opened this issue 4 years ago • 6 comments

Does deformable conv support export to onnx or not?

lucasjinreal avatar Apr 06 '20 09:04 lucasjinreal

Not at the moment. Contributions welcome

fmassa avatar Apr 06 '20 10:04 fmassa

Not at the moment. Contributions welcome

@fmassa I implemented ONNX exporter for deform_conv2d with pure ONNX operators, i.e. no custom layers, in my repository deform_conv2d_onnx_exporter.

My module, deform_conv2d_onnx_exporter, registers ONNX operator for torchvision::deform_conv2d. Because the latest version of ONNX does not support deform_conv2d natively, I had to implement my module using GatherND and other operators. Therefore, the performance of my module is not very good, but good enough for me. It requires opset version 12 and later because it uses version 12 GatherND and Clip operators.

Is this helpful for this project? If yes, I would like to create a pull request to this project.

Regards, Murase

masamitsu-murase avatar Aug 14 '21 15:08 masamitsu-murase

Not at the moment. Contributions welcome

@fmassa I implemented ONNX exporter for deform_conv2d with pure ONNX operators, i.e. no custom layers, in my repository deform_conv2d_onnx_exporter.

My module, deform_conv2d_onnx_exporter, registers ONNX operator for torchvision::deform_conv2d. Because the latest version of ONNX does not support deform_conv2d natively, I had to implement my module using GatherND and other operators. Therefore, the performance of my module is not very good, but good enough for me. It requires opset version 12 and later because it uses version 12 GatherND and Clip operators.

Is this helpful for this project? If yes, I would like to create a pull request to this project.

Regards, Murase

Hi @masamitsu-murase,

Thanks for the contribution. I do not see the repository. Is the link broken?

Thanks

vp211991 avatar Nov 02 '21 11:11 vp211991

I re-published deform-conv2d-onnx-exporter.

masamitsu-murase avatar Apr 07 '23 15:04 masamitsu-murase

I re-published deform-conv2d-onnx-exporter.

File "D:\ProgramData\anaconda3\envs\propainter\lib\site-packages\deform_conv2d_onnx_exporter.py", line 66, in tensor return g.op("Constant", value_t=torch.tensor(value, dtype=dtype)) TypeError: an integer is required (got type NoneType) (Occurred when translating deform_conv2d).

hhuiwang avatar Mar 14 '24 10:03 hhuiwang

There is now native support for DeformConv in ONNX. So how to export model into onnx without getting an error "torchvision::deform_conv2d unimplemented"?

sdml0 avatar Jul 27 '24 07:07 sdml0