Skip to content
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 onnx export of two stage #5205

Merged
merged 25 commits into from
May 27, 2021
Merged

Conversation

jshilong
Copy link
Collaborator

@jshilong jshilong commented May 23, 2021

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 the DenseHead and BboxHead would be different when export to ONNX , which will greatly affect the future development of other instance task and #4912.

Modification

This PR moves all ONNX related code of two-stage model to a new function onnx_export in corresponding class.

BC-breaking (Optional)

None

@jshilong jshilong changed the title refactor rpn refactor onnx May 23, 2021
@RunningLeon RunningLeon requested a review from ZwwWayne May 24, 2021 03:03
@jshilong jshilong added the WIP Working in progress label May 24, 2021
@codecov
Copy link

codecov bot commented May 24, 2021

Codecov Report

Merging #5205 (489f5d2) into master (ade08ba) will decrease coverage by 0.04%.
The diff coverage is 26.72%.

❗ Current head 489f5d2 differs from pull request most recent head a186d4c. Consider uploading reports for the commit a186d4c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5205      +/-   ##
==========================================
- Coverage   65.39%   65.35%   -0.05%     
==========================================
  Files         276      276              
  Lines       21229    21204      -25     
  Branches     3561     3522      -39     
==========================================
- Hits        13883    13857      -26     
- Misses       6572     6599      +27     
+ Partials      774      748      -26     
Flag Coverage Δ
unittests 65.31% <26.72%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmdet/core/export/pytorch2onnx.py 15.68% <ø> (ø)
mmdet/models/dense_heads/detr_head.py 88.99% <0.00%> (-0.42%) ⬇️
mmdet/models/roi_heads/cascade_roi_head.py 76.59% <0.00%> (ø)
...heads/roi_extractors/single_level_roi_extractor.py 65.38% <0.00%> (-4.01%) ⬇️
mmdet/models/roi_heads/standard_roi_head.py 50.31% <7.31%> (-12.09%) ⬇️
mmdet/models/dense_heads/rpn_head.py 56.25% <13.33%> (-17.79%) ⬇️
mmdet/models/detectors/single_stage.py 75.00% <14.28%> (-1.09%) ⬇️
mmdet/models/dense_heads/yolo_head.py 49.33% <18.18%> (-1.82%) ⬇️
mmdet/models/detectors/base.py 53.84% <20.00%> (-1.36%) ⬇️
mmdet/models/roi_heads/bbox_heads/bbox_head.py 76.59% <25.00%> (-3.23%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ade08ba...a186d4c. Read the comment docs.

@jshilong jshilong removed the WIP Working in progress label May 24, 2021
@jshilong jshilong changed the title refactor onnx refactor onnx export of TWO STAGE May 24, 2021
@jshilong jshilong changed the title refactor onnx export of TWO STAGE refactor onnx export of two stage May 24, 2021
@jshilong jshilong requested a review from hhaAndroid May 25, 2021 15:13
mmdet/models/detectors/single_stage.py Outdated Show resolved Hide resolved
mmdet/models/roi_heads/bbox_heads/bbox_head.py Outdated Show resolved Hide resolved
mmdet/models/roi_heads/standard_roi_head.py Outdated Show resolved Hide resolved
@RangiLyu
Copy link
Member

Why is there a 13.7 MB tmp.onnx in this PR?

@jshilong jshilong requested a review from RangiLyu May 27, 2021 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants