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

add upsample neck #512

Merged
merged 5 commits into from
Apr 25, 2021
Merged

add upsample neck #512

merged 5 commits into from
Apr 25, 2021

Conversation

xiexinch
Copy link
Collaborator

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.

@codecov
Copy link

codecov bot commented Apr 23, 2021

Codecov Report

Merging #512 (8cd7604) into master (5b33faa) will decrease coverage by 0.40%.
The diff coverage is 33.33%.

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

@@            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     
Flag Coverage Δ
unittests 86.13% <33.33%> (-0.41%) ⬇️

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

Impacted Files Coverage Δ
mmseg/models/necks/upsample_neck.py 29.03% <29.03%> (ø)
mmseg/models/necks/__init__.py 100.00% <100.00%> (ø)
mmseg/datasets/pipelines/transforms.py 97.12% <0.00%> (-0.87%) ⬇️

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 5b33faa...a6ae77b. Read the comment docs.

Comment on lines 10 to 11
class UpsampleNeck(nn.Module):
"""Upsample Network."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring.

self.in_channels = in_channels
self.out_channels = out_channels
self.scales = scales
self.num_outs = num_outs
Copy link
Collaborator

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.

Comment on lines 46 to 47
if len(inputs) == 1:
inputs = inputs * self.num_outs
Copy link
Collaborator

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.

Comment on lines 14 to 17
in_channels,
out_channels,
scales=[0.5, 1, 2, 4],
num_outs=4):
Copy link
Collaborator

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.

Comment on lines 52 to 53
size=list((np.array(inputs[i].shape[2:]) *
self.scales[i]).astype(int)),
Copy link
Collaborator

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.



@NECKS.register_module()
class UpsampleNeck(nn.Module):
Copy link
Collaborator

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is missing.

Copy link
Collaborator

@xvjiarui xvjiarui Apr 25, 2021

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.

@xvjiarui xvjiarui merged commit 98ef5ac into open-mmlab:master Apr 25, 2021
@xiexinch xiexinch deleted the vit_plus_heads branch April 25, 2021 12:02
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* 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>
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
* [Download] Smart downloading

* add test

* finish test

* update

* make style
sibozhang pushed a commit to sibozhang/mmsegmentation that referenced this pull request Mar 22, 2024
…s so that they will be ignored in modelzoo statistics (open-mmlab#512)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants