-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
add upsample neck #512
add upsample neck #512
Conversation
Codecov Report
@@ Coverage Diff @@
## master #512 +/- ##
==========================================
- Coverage 86.53% 86.13% -0.41%
==========================================
Files 98 99 +1
Lines 5133 5165 +32
Branches 829 835 +6
==========================================
+ Hits 4442 4449 +7
- Misses 534 557 +23
- Partials 157 159 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
mmseg/models/necks/upsample_neck.py
Outdated
class UpsampleNeck(nn.Module): | ||
"""Upsample Network.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing docstring.
mmseg/models/necks/upsample_neck.py
Outdated
self.in_channels = in_channels | ||
self.out_channels = out_channels | ||
self.scales = scales | ||
self.num_outs = num_outs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
num_outs == len(scales
. We may remove num_outs
.
mmseg/models/necks/upsample_neck.py
Outdated
if len(inputs) == 1: | ||
inputs = inputs * self.num_outs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeating the same scale may not be useful. We may remove this.
mmseg/models/necks/upsample_neck.py
Outdated
in_channels, | ||
out_channels, | ||
scales=[0.5, 1, 2, 4], | ||
num_outs=4): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may support norm_cfg
and act_cfg
.
mmseg/models/necks/upsample_neck.py
Outdated
size=list((np.array(inputs[i].shape[2:]) * | ||
self.scales[i]).astype(int)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may use scale
argument.
mmseg/models/necks/upsample_neck.py
Outdated
|
||
|
||
@NECKS.register_module() | ||
class UpsampleNeck(nn.Module): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may rename it to something like MultiLevelNeck
since we would also perform downsampling.
Args: | ||
in_channels (List[int]): Number of input channels per scale. | ||
out_channels (int): Number of output channels (used at each scale). | ||
scales (List[int]): Scale factors for each input feature map. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We fix this in the new PR.
* init * upsample v1.0 * fix errors * change to in_channels list * add unittest, docstring, norm/act config and rename Co-authored-by: xiexinch <test767803@foxmail.com>
* [Download] Smart downloading * add test * finish test * update * make style
…s so that they will be ignored in modelzoo statistics (open-mmlab#512)
A neck structure connect vit backbone and decoder_heads.
Default output of vit backbone is a downsample 16x feature map, we design a structure that convert the feature map to [32x, 16x, 8x, 4x] feature map list.