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

[Fix] Fix some vit init bugs #609

Merged
merged 8 commits into from
Jun 19, 2021
Merged

Conversation

clownrat6
Copy link
Contributor

  1. Fix some new style parameters init bug for vit.

  2. Add some unit test for vit to improve code cov.

@clownrat6 clownrat6 requested a review from xvjiarui June 18, 2021 19:29
@codecov
Copy link

codecov bot commented Jun 18, 2021

Codecov Report

Merging #609 (6f6502a) into master (0076913) will increase coverage by 0.11%.
The diff coverage is 85.71%.

❗ Current head 6f6502a differs from pull request most recent head 72178ca. Consider uploading reports for the commit 72178ca to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #609      +/-   ##
==========================================
+ Coverage   85.45%   85.57%   +0.11%     
==========================================
  Files         101      101              
  Lines        5220     5226       +6     
  Branches      840      842       +2     
==========================================
+ Hits         4461     4472      +11     
+ Misses        586      583       -3     
+ Partials      173      171       -2     
Flag Coverage Δ
unittests 85.57% <85.71%> (+0.11%) ⬆️

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

Impacted Files Coverage Δ
mmseg/models/utils/timm_convert.py 7.69% <ø> (+0.28%) ⬆️
mmseg/models/backbones/vit.py 86.66% <85.71%> (+2.85%) ⬆️

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 0076913...72178ca. Read the comment docs.

@@ -325,7 +338,8 @@ def init_weights(self, pretrained=None):

self.load_state_dict(state_dict, False)

elif pretrained is None:
elif isinstance(self.pretrained, type(None)):
Copy link
Collaborator

Choose a reason for hiding this comment

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

is None

@@ -185,8 +179,12 @@ class VisionTransformer(BaseModule):
Default: dict(type='LN')
act_cfg (dict): The activation config for FFNs.
Defalut: dict(type='GELU').
final_norm (bool): Whether to add a additional layer to normalize
first_norm (bool): Whether to add a norm in PatchEmbed Block.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
first_norm (bool): Whether to add a norm in PatchEmbed Block.
patch_norm (bool): Whether to add a norm in PatchEmbed Block.

Comment on lines 270 to 275
self.patch_embed = PatchEmbed(
img_size=img_size,
patch_size=patch_size,
in_channels=in_channels,
embed_dim=embed_dims,
norm_cfg=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self.patch_embed = PatchEmbed(
img_size=img_size,
patch_size=patch_size,
in_channels=in_channels,
embed_dim=embed_dims,
norm_cfg=None)
self.patch_embed = PatchEmbed(
img_size=img_size,
patch_size=patch_size,
in_channels=in_channels,
embed_dim=embed_dims,
norm_cfg=norm_cfg if patch_norm else None)

@xvjiarui xvjiarui merged commit 0c4c3b7 into open-mmlab:master Jun 19, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* [Fix] Fix vit init bug

* Add some vit unit tests

* Modify module import

* Fix pretrain weights bug

* Modify pretrained judge

* Add some unit tests to improve code cov

* Optimize code

* Fix vit unit test
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this pull request Dec 3, 2023
* add bottom up nms

* add bottom up nms

* use_nms default True

* fix .md

* increase code coverage

* increase code coverage

* increase code coverage

* delete unnecessary 'list'

* test pre-commit

* update variable names & ReadMe

* clarify pose-nms-thr in the help message

* increase code coverage

* increase code coverage
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