mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

[Fix] Enable to set float mlp_ratio in SwinTransformer

Open i-aki-y opened this issue 2 years ago • 2 comments

Motivation

In the original implementation, the mlp_ratio parameter in the SwinTransformer can be float, but the current mmdet's implementation does not support non-integer mlp_ratio (an Exception will be raised if a non-integer value is given).

I have found the same fix in mmsegmentation: see, https://github.com/open-mmlab/mmsegmentation/pull/1274

Modification

When a float mlp_ratio is given, dims of mlp's out channels are truncated to an integer.

BC-breaking (Optional)

I think this does not break BC.

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 test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

i-aki-y avatar Aug 30 '22 12:08 i-aki-y

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 30 '22 12:08 CLAassistant

Codecov Report

Base: 64.17% // Head: 64.08% // Decreases project coverage by -0.08% :warning:

Coverage data is based on head (24ad5d2) compared to base (3b72b12). Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8670      +/-   ##
==========================================
- Coverage   64.17%   64.08%   -0.09%     
==========================================
  Files         361      361              
  Lines       29530    29525       -5     
  Branches     5020     5020              
==========================================
- Hits        18951    18922      -29     
- Misses       9576     9589      +13     
- Partials     1003     1014      +11     
Flag Coverage Δ
unittests 64.08% <ø> (-0.07%) :arrow_down:

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

Impacted Files Coverage Δ
mmdet/models/backbones/swin.py 81.50% <ø> (ø)
mmdet/utils/setup_env.py 68.00% <0.00%> (-24.00%) :arrow_down:
mmdet/datasets/builder.py 45.83% <0.00%> (-7.30%) :arrow_down:
mmdet/core/bbox/samplers/random_sampler.py 75.00% <0.00%> (-5.56%) :arrow_down:
mmdet/core/bbox/assigners/sim_ota_assigner.py 80.00% <0.00%> (-3.64%) :arrow_down:
mmdet/utils/misc.py 61.53% <0.00%> (-2.57%) :arrow_down:
mmdet/models/dense_heads/dense_test_mixins.py 40.74% <0.00%> (-2.47%) :arrow_down:
mmdet/models/roi_heads/test_mixins.py 50.71% <0.00%> (-2.15%) :arrow_down:
mmdet/core/bbox/assigners/max_iou_assigner.py 72.36% <0.00%> (-1.32%) :arrow_down:
mmdet/datasets/custom.py 61.25% <0.00%> (-0.21%) :arrow_down:
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Sep 05 '22 03:09 codecov[bot]

We need to migrate this PR in MMDet 3.x

ZwwWayne avatar Jan 29 '23 11:01 ZwwWayne