mmpretrain
mmpretrain copied to clipboard
[Feature] add reduction for neck
Motivation
In some cases, it is necessary to reduce the dimension of extracted feature, so Reduction
is implemented in necks.
Use cases
model = dict(
type='ImageClassifier',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(3,),
style='pytorch'
),
neck=[
dict(type='GeneralizedMeanPooling'),
dict(type='LinearReduction',
in_channels=2048,
out_channels=512,
act_cfg=dict(type='ReLU'),
norm_cfg=dict(type='BN1d')
)
],
head=dict(
type='LinearClsHead',
num_classes=1000,
in_channels=2304,
loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
topk=(1, 5),
),
)
Checklist
Before PR:
- [ ] Pre-commit or other linting tools are used to fix the potential lint issues.
- [ ] Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
- [ ] The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
- [ ] The documentation has been modified accordingly, like docstring or example tutorials.
After PR:
- [ ] If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects, like MMDet or MMSeg.
- [ ] CLA has been signed and all committers have signed the CLA in this PR.
please rebase the branch to fix the conflict.
Codecov Report
Base: 0.02% // Head: 91.39% // Increases project coverage by +91.36%
:tada:
Coverage data is based on head (
7eaf7ca
) compared to base (b8b31e9
). Patch has no changes to coverable lines.
Additional details and impacted files
@@ Coverage Diff @@
## dev-1.x #978 +/- ##
============================================
+ Coverage 0.02% 91.39% +91.36%
============================================
Files 121 131 +10
Lines 8217 9804 +1587
Branches 1368 1543 +175
============================================
+ Hits 2 8960 +8958
+ Misses 8215 648 -7567
- Partials 0 196 +196
Flag | Coverage Δ | |
---|---|---|
unittests | 91.39% <ø> (+91.36%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
mmcls/apis/inference.py | 0.00% <0.00%> (ø) |
|
mmcls/datasets/transforms/compose.py | ||
mmcls/models/backbones/mobilevit.py | 91.15% <0.00%> (ø) |
|
mmcls/models/backbones/deit3.py | 94.52% <0.00%> (ø) |
|
mmcls/models/backbones/edgenext.py | 95.20% <0.00%> (ø) |
|
mmcls/models/backbones/swin_transformer_v2.py | 89.47% <0.00%> (ø) |
|
mmcls/models/backbones/mvit.py | 92.46% <0.00%> (ø) |
|
mmcls/models/necks/reduction.py | 100.00% <0.00%> (ø) |
|
mmcls/models/utils/layer_scale.py | 86.66% <0.00%> (ø) |
|
mmcls/models/heads/efficientformer_head.py | 93.10% <0.00%> (ø) |
|
... and 121 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.