CharlesShang / DCNv2

Deformable Convolutional Networks v2 with Pytorch
BSD 3-Clause "New" or "Revised" License
1.28k stars 402 forks source link

Onnx support #25

Open dheerajpreddy opened 5 years ago

dheerajpreddy commented 5 years ago

Will there be onnx support for this? I'm currently unable to convert my model to onnx because of no support for DCNv2

Thanks.

joyyang1215 commented 5 years ago

Same requirements. Thanks

lucasjinreal commented 4 years ago
RuntimeError: ONNX export failed: Couldn't export Python operator _DCNv2
universebang commented 4 years ago
RuntimeError: ONNX export failed: Couldn't export Python operator _DCNv2

same error, did u resolve it?

huaze555 commented 4 years ago

@jinfagang Hi, have you get some answer to solve this problem?

biyuehuang commented 4 years ago

I met the same problem. I want to convert yolact_plus to onnx.

import DCNv2
def evalimage(net:Yolact, path:str, save_path:str=None):
    frame = torch.from_numpy(cv2.imread(path)).float()
    batch = FastBaseTransform()(frame.unsqueeze(0))
    preds = net(batch)
    torch.onnx.export(net, batch, "yolact_plus.onnx",operator_export_type=DCNv2)

Error

Multiple GPUs detected! Turning off JIT. Config not specified. Parsed yolact_plus_base_config from the file name.

Loading model... Done. /home/kiwi/Document/yolact/DCNv2/dcn_v2.py:31: TracerWarning: Converting a tensor to a Python integer might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! ctx.deformable_groups) /home/kiwi/Document/yolact/yolact.py:221: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if self.last_img_size != (cfg._tmp_img_w, cfg._tmp_img_h): Traceback (most recent call last): File "eval.py", line 1123, in evaluate(net, dataset) File "eval.py", line 895, in evaluate evalimage(net, args.image) File "eval.py", line 609, in evalimage torch.onnx.export(net, batch, "yolact_plus.onnx",operator_export_type=DCNv2) File "/home/kiwi/miniconda3/envs/detectron2/lib/python3.6/site-packages/torch/onnx/init.py", line 148, in export strip_doc_string, dynamic_axes, keep_initializers_as_inputs) File "/home/kiwi/miniconda3/envs/detectron2/lib/python3.6/site-packages/torch/onnx/utils.py", line 66, in export dynamic_axes=dynamic_axes, keep_initializers_as_inputs=keep_initializers_as_inputs) File "/home/kiwi/miniconda3/envs/detectron2/lib/python3.6/site-packages/torch/onnx/utils.py", line 416, in _export fixed_batch_size=fixed_batch_size) File "/home/kiwi/miniconda3/envs/detectron2/lib/python3.6/site-packages/torch/onnx/utils.py", line 296, in _model_to_graph fixed_batch_size=fixed_batch_size, params_dict=params_dict) File "/home/kiwi/miniconda3/envs/detectron2/lib/python3.6/site-packages/torch/onnx/utils.py", line 135, in _optimize_graph graph = torch._C._jit_pass_onnx(graph, operator_export_type) TypeError: _jit_pass_onnx(): incompatible function arguments. The following argument types are supported:

  1. (arg0: torch::jit::Graph, arg1: torch._C._onnx.OperatorExportTypes) -> torch::jit::Graph
GilbertTam commented 4 years ago

+1

iamZe commented 3 years ago

Any updates?

EphChem commented 3 years ago

+1

leon5678 commented 3 years ago

+1

wanghaohw commented 2 years ago

@dheerajpreddy ,have you sloved your problems?I meet the same problem,I would be grateful you could give any information.

hitbuyi commented 2 years ago

Any information or progress on this issue? I have same requirement to convert DCNv2 to ONNX

aRibra commented 1 year ago

+1

Note-Liu commented 3 months ago

+1