aliyun / conditional-lane-detection

Apache License 2.0
396 stars 89 forks source link

export to onnx #5

Closed lucky-xu-1994 closed 3 years ago

lucky-xu-1994 commented 3 years ago

Hi, thank you for your great work! I have run it on my own datasets (different view with culane), and it predicts very well. but I have problem in how to export .pth to onnx.

I have tried : python tools/pytorch2onnx.py configs/condlanenet/culane/culane_small_test.py ./culane_small.pth --out ./condlanenet.onnx --shape 320 800

and it did save a ONNX file(44.7MB) in my path. but when I open ONNX,I don't understand the output.

image

image

can anyone here help me out? thanks!

hustllz commented 3 years ago

We have not supported exporting onnx in this repo. We did not adapt the newly added heads to the feature of exporting onnx of mmdetection. So the "pytorch2onnx.py" file in the official mmdetection does not work properly. It seems that only the backbone part is exported. If you want to export onnx file, I suggest writing another script to extract the inference part of the model and geting out of this framework for now.

lucky-xu-1994 commented 3 years ago

We have not supported exporting onnx in this repo. We did not adapt the newly added heads to the feature of exporting onnx of mmdetection. So the "pytorch2onnx.py" file in the official mmdetection does not work properly. It seems that only the backbone part is exported. If you want to export onnx file, I suggest writing another script to extract the inference part of the model and geting out of this framework for now.

ok, I will try as you suggest. Thank you!

jyang68sh commented 3 years ago

@lucky-xu-1994 Hi, did you manage to get the script working? Thanks!

lucky-xu-1994 commented 3 years ago

@lucky-xu-1994 Hi, did you manage to get the script working? Thanks!

@jyang68sh sorry to be late. I have not.it's hard to export to ONNX for existing conditional weight/bias and conditional branching in the network. for more you can refer to issue #13 .

WYL-Projects commented 3 years ago

@lucky-xu-1994 Hi, can ONNX be exported now?

Jinming-Su commented 2 years ago

@lucky-xu-1994 Hi, have you address this problem?

sjtuljw520 commented 2 years ago

We have not supported exporting onnx in this repo. We did not adapt the newly added heads to the feature of exporting onnx of mmdetection. So the "pytorch2onnx.py" file in the official mmdetection does not work properly. It seems that only the backbone part is exported. If you want to export onnx file, I suggest writing another script to extract the inference part of the model and geting out of this framework for now.

ok, I will try as you suggest. Thank you!

@lucky-xu-1994 , Hi Xu, have you solved this problem and can you share your resolution? thank you.

HL-lucky commented 2 years ago

我们不支持在这笔回购协议中出口onnx。我们没有使新添加的头适应导出mmdetection的onnx的功能。因此,官方mmdetection中的“pytorch2onnx.py”文件无法正常工作。似乎只出口了骨干部分。如果您想导出onnx文件,我建议编写另一个脚本来提取模型的推理部分,暂时退出此框架。

好的,我会按照你的建议试试。谢谢!

嗨 解决这个问题了吗? 你能分享一下你的解决方案吗? 谢谢您!

abhigoku10 commented 1 year ago

Has any one able to solve this export onnx issue @HL-lucky @lucky-xu-1994 @hustllz