mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

Export support for panoptic segmentation model

Open daigo0927 opened this issue 2 years ago • 4 comments

Motivation

Support panoptic segmentation model (especially PanopticFPN by now) from the MMDetection codebase.

Originally I created a PR at the MMDetection repository: https://github.com/open-mmlab/mmdetection/pull/8169 and migrated to MMDeploy.

Modification

  • Add some @FUNCTION_REWRITER.register_rewriter for supporting PanopticFPN export.
  • Add panoptic segmentation configs
  • Append semseg to the detector_forward outputs.

BC-breaking (Optional)

I have not faced any BC-breaking errors but I'm not sure that it is safe to append semseg to output_names at mmdeploy/codebase/mmdet/models/detectors/base.py:__forward_impl. I would appreciate it if you give some advice or instruction.

Use cases (Optional)

We can export PanopticFPN of MMDetection. I have checked my modification to work via docker environment (almost the same as docker/CPU/Dockerfile).

See details at https://github.com/daigo0927/blog/tree/master/mmdeploy-panopticfpn-onnx

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

daigo0927 avatar Jun 26 '22 14:06 daigo0927

Codecov Report

Merging #649 (c26bc41) into master (17a7d60) will increase coverage by 0.80%. The diff coverage is 45.45%.

:exclamation: Current head c26bc41 differs from pull request most recent head 104292f. Consider uploading reports for the commit 104292f to get more accurate results

@@            Coverage Diff             @@
##           master     #649      +/-   ##
==========================================
+ Coverage   55.99%   56.80%   +0.80%     
==========================================
  Files         269      264       -5     
  Lines        8945     8683     -262     
  Branches     1314     1289      -25     
==========================================
- Hits         5009     4932      -77     
+ Misses       3584     3397     -187     
- Partials      352      354       +2     
Flag Coverage Δ
unittests 56.80% <45.45%> (+0.80%) :arrow_up:

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

Impacted Files Coverage Δ
mmdeploy/codebase/mmdet/models/detectors/base.py 69.23% <ø> (-2.20%) :arrow_down:
...t/models/detectors/panoptic_two_stage_segmentor.py 30.00% <30.00%> (ø)
...ebase/mmdet/models/seg_heads/base_semantic_head.py 37.50% <37.50%> (ø)
mmdeploy/codebase/mmdet/models/__init__.py 100.00% <100.00%> (ø)
...deploy/codebase/mmdet/models/detectors/__init__.py 100.00% <100.00%> (ø)
...deploy/codebase/mmdet/models/seg_heads/__init__.py 100.00% <100.00%> (ø)
...y/codebase/mmcls/models/backbones/shufflenet_v2.py 46.15% <0.00%> (-35.67%) :arrow_down:
mmdeploy/pytorch/functions/linear.py 40.00% <0.00%> (-24.87%) :arrow_down:
mmdeploy/pytorch/functions/triu.py 33.33% <0.00%> (-6.67%) :arrow_down:
mmdeploy/pytorch/functions/chunk.py 25.00% <0.00%> (-5.44%) :arrow_down:
... and 30 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 17a7d60...104292f. Read the comment docs.

codecov[bot] avatar Jun 27 '22 02:06 codecov[bot]

@daigo0927 Hi, thanks for your contribution. We'll review this PR soon.

RunningLeon avatar Jun 27 '22 03:06 RunningLeon

@daigo0927 Hi, hope you could update according to the left comments. Any discussion is welcome.

RunningLeon avatar Jul 11 '22 10:07 RunningLeon

Hi @RunningLeon , thank you for the kind message. I am a little busy on my job but willing to update this PR. Thanks!

daigo0927 avatar Jul 11 '22 10:07 daigo0927

@daigo0927 Hi, sorry to bother you, but do you have any plan for this PR?

RunningLeon avatar Aug 25 '22 07:08 RunningLeon

@RunningLeon Thanks for your reminder. I'm afraid I don't have much time to update this PR. I would close this PR 😢 .

daigo0927 avatar Aug 30 '22 11:08 daigo0927

@RunningLeon Hi, i would like to complete this pull and get panoptic deployment working with mmdeploy. i checked out the repo @daigo0927 made, and i see he was able to mostly complete the changes, but i am unable to find any documentation on supporting new models other then a very brief explanation of the rewriter for unsupported functions, do you have something a little more detailed on the model conversion. A document going over the steps involved would be great

Likhith-Sugganahalli avatar Dec 12 '22 06:12 Likhith-Sugganahalli