-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor]Refactor exporting One-Stage model to ONNX #6003
Conversation
* revert batch to single * update anchor_head * replace preds with bboxes * add point_bbox_coder * FCOS add get_selected_priori * unified anchor-free and anchor-based get_bbox_single * update code * update reppoints and sabl * add sparse priors * add mlvlpointsgenerator * revert __init__ of core * refactor reppoints * delete label channal * add docstr * fix typo * fix args * fix typo * fix doc * fix stride_h * add offset * Unified bbox coder * add offset * remove point_bbox_coder.py * fix docstr * new interface of single_proir * fix device * add unitest * add cuda unitest * add more cuda unintest * fix reppoints * fix device * update all prior * update vfnet * add unintest for ssd and yolo and rename prior_idxs * add docstr for MlvlPointGenerator * update reppoints and rpnhead * add space * add num_base_priors * update some model * update docstr * fixAugFPN test and lint. * Fix autoassign * add docs * Unified fcos decoding * update docstr * fix train error * Fix Vfnet * Fix some * update centernet * revert * add warnings * fix unittest error * delete duplicated * fix comment * fix docs * fix type Co-authored-by: zhangshilong <2392587229zsl@gmail.com>
some remaining issues, like num_base_anchors should also be fixed with comments |
This pr is still working in progress, any suggestion is appreciated |
Renaming the attribute |
Sure, we can do that in the next PR. |
I will check it |
38c0ecf
to
304150d
Compare
304150d
to
e114eac
Compare
5c778b7
to
0829b33
Compare
0829b33
to
59a4fb6
Compare
Would you mind helping to retest it? I may have fixed it in point_generator |
Hello,When I have test this pr,I tranform python2onnx,all model is successed.But when I tranform onnx2trt,only fcos success. ERR LOG: (pt1.8) PJLAB\shenkun@shai14001070l:~/workspace/mmdetection$ python tools/deployment/onnx2tensorrt.py configs/retinanet/retinanet_r50_fpn_1x_coco.py tmp/retinanet.onnx --trt-file='retinanet.trt' --input-img='tests/data/color.jpg' --shape 800 1216 (pt1.8) PJLAB\shenkun@shai14001070l:~/workspace/mmdetection$ python tools/deployment/onnx2tensorrt.py configs/ssd/ssd300_coco.py tmp/ssd.onnx --trt-file='ssd.trt' --input-img='tests/data/color.jpg' --shape 800 1216tools/deployment/onnx2tensorrt.py:199: UserWarning: Arguments like (pt1.8) PJLAB\shenkun@shai14001070l:~/workspace/mmdetection$ python tools/deployment/onnx2tensorrt.py configs/yolo/yolov3_d53_320_273e_coco.py tmp/yolov3.onnx --trt-file='yolov3.trt' --input-img='tests/data/color.jpg' --shape 800 1216tools/deployment/onnx2tensorrt.py:199: UserWarning: Arguments like |
This PR works fine under PyTorch 1.6, This problem only appears in the higher version PyTorch. |
* Refactor one-stage get_bboxes logic (#5317) * revert batch to single * update anchor_head * replace preds with bboxes * add point_bbox_coder * FCOS add get_selected_priori * unified anchor-free and anchor-based get_bbox_single * update code * update reppoints and sabl * add sparse priors * add mlvlpointsgenerator * revert __init__ of core * refactor reppoints * delete label channal * add docstr * fix typo * fix args * fix typo * fix doc * fix stride_h * add offset * Unified bbox coder * add offset * remove point_bbox_coder.py * fix docstr * new interface of single_proir * fix device * add unitest * add cuda unitest * add more cuda unintest * fix reppoints * fix device * update all prior * update vfnet * add unintest for ssd and yolo and rename prior_idxs * add docstr for MlvlPointGenerator * update reppoints and rpnhead * add space * add num_base_priors * update some model * update docstr * fixAugFPN test and lint. * Fix autoassign * add docs * Unified fcos decoding * update docstr * fix train error * Fix Vfnet * Fix some * update centernet * revert * add warnings * fix unittest error * delete duplicated * fix comment * fix docs * fix type Co-authored-by: zhangshilong <2392587229zsl@gmail.com> * support onnx export for fcos * support onnx export for fcos fsaf retina and ssd * resolve comments * resolve comments * add with nms * support cornernet * resolve comments * add default with nms * fix trt arrange should be int Co-authored-by: Haian Huang(深度眸) <1286304229@qq.com>
* Refactor one-stage get_bboxes logic (#5317) * revert batch to single * update anchor_head * replace preds with bboxes * add point_bbox_coder * FCOS add get_selected_priori * unified anchor-free and anchor-based get_bbox_single * update code * update reppoints and sabl * add sparse priors * add mlvlpointsgenerator * revert __init__ of core * refactor reppoints * delete label channal * add docstr * fix typo * fix args * fix typo * fix doc * fix stride_h * add offset * Unified bbox coder * add offset * remove point_bbox_coder.py * fix docstr * new interface of single_proir * fix device * add unitest * add cuda unitest * add more cuda unintest * fix reppoints * fix device * update all prior * update vfnet * add unintest for ssd and yolo and rename prior_idxs * add docstr for MlvlPointGenerator * update reppoints and rpnhead * add space * add num_base_priors * update some model * update docstr * fixAugFPN test and lint. * Fix autoassign * add docs * Unified fcos decoding * update docstr * fix train error * Fix Vfnet * Fix some * update centernet * revert * add warnings * fix unittest error * delete duplicated * fix comment * fix docs * fix type Co-authored-by: zhangshilong <2392587229zsl@gmail.com> * support onnx export for fcos * support onnx export for fcos fsaf retina and ssd * resolve comments * resolve comments * add with nms * support cornernet * resolve comments * add default with nms * fix trt arrange should be int Co-authored-by: Haian Huang(深度眸) <1286304229@qq.com>
* Refactor one-stage get_bboxes logic (#5317) * revert batch to single * update anchor_head * replace preds with bboxes * add point_bbox_coder * FCOS add get_selected_priori * unified anchor-free and anchor-based get_bbox_single * update code * update reppoints and sabl * add sparse priors * add mlvlpointsgenerator * revert __init__ of core * refactor reppoints * delete label channal * add docstr * fix typo * fix args * fix typo * fix doc * fix stride_h * add offset * Unified bbox coder * add offset * remove point_bbox_coder.py * fix docstr * new interface of single_proir * fix device * add unitest * add cuda unitest * add more cuda unintest * fix reppoints * fix device * update all prior * update vfnet * add unintest for ssd and yolo and rename prior_idxs * add docstr for MlvlPointGenerator * update reppoints and rpnhead * add space * add num_base_priors * update some model * update docstr * fixAugFPN test and lint. * Fix autoassign * add docs * Unified fcos decoding * update docstr * fix train error * Fix Vfnet * Fix some * update centernet * revert * add warnings * fix unittest error * delete duplicated * fix comment * fix docs * fix type Co-authored-by: zhangshilong <2392587229zsl@gmail.com> * support onnx export for fcos * support onnx export for fcos fsaf retina and ssd * resolve comments * resolve comments * add with nms * support cornernet * resolve comments * add default with nms * fix trt arrange should be int Co-authored-by: Haian Huang(深度眸) <1286304229@qq.com>
* Refactor one-stage get_bboxes logic (open-mmlab#5317) * revert batch to single * update anchor_head * replace preds with bboxes * add point_bbox_coder * FCOS add get_selected_priori * unified anchor-free and anchor-based get_bbox_single * update code * update reppoints and sabl * add sparse priors * add mlvlpointsgenerator * revert __init__ of core * refactor reppoints * delete label channal * add docstr * fix typo * fix args * fix typo * fix doc * fix stride_h * add offset * Unified bbox coder * add offset * remove point_bbox_coder.py * fix docstr * new interface of single_proir * fix device * add unitest * add cuda unitest * add more cuda unintest * fix reppoints * fix device * update all prior * update vfnet * add unintest for ssd and yolo and rename prior_idxs * add docstr for MlvlPointGenerator * update reppoints and rpnhead * add space * add num_base_priors * update some model * update docstr * fixAugFPN test and lint. * Fix autoassign * add docs * Unified fcos decoding * update docstr * fix train error * Fix Vfnet * Fix some * update centernet * revert * add warnings * fix unittest error * delete duplicated * fix comment * fix docs * fix type Co-authored-by: zhangshilong <2392587229zsl@gmail.com> * support onnx export for fcos * support onnx export for fcos fsaf retina and ssd * resolve comments * resolve comments * add with nms * support cornernet * resolve comments * add default with nms * fix trt arrange should be int Co-authored-by: Haian Huang(深度眸) <1286304229@qq.com>
Motivation
The recent ONNX-related development is too quickly, which made the code hard to read, and there is a problem that the return type of the same function such as
_get_bboxes
in theDenseHead
.,Modification
This PR moves all ONNX related code of the One-Stage model to a new function
onnx_export
in the corresponding class.BC-breaking (Optional)
None