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

[Refactor] Add build_pos_embed and build_layers for BEiT #1517

Merged
merged 2 commits into from
Apr 27, 2022

Conversation

MeowZheng
Copy link
Collaborator

@MeowZheng MeowZheng commented Apr 26, 2022

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Split model initialization into independent functionss.

Modification

  1. Add _build_patch_embedding in BEiT
  2. Add _build_layers in BEiT

results

Method before refactor inference test after refactor training result after refactor
upernet_beit-base_8x2_640x640_160k_ade20k 53.08 53.08

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

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 MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #1517 (28c686e) into master (62c3a7d) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1517      +/-   ##
==========================================
+ Coverage   90.30%   90.32%   +0.01%     
==========================================
  Files         140      140              
  Lines        8345     8362      +17     
  Branches     1403     1403              
==========================================
+ Hits         7536     7553      +17     
  Misses        571      571              
  Partials      238      238              
Flag Coverage Δ
unittests 90.32% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
mmseg/models/backbones/beit.py 92.36% <100.00%> (+0.52%) ⬆️

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 62c3a7d...28c686e. Read the comment docs.

self.init_values = init_values
self.window_size = (img_size[0] // patch_size,
img_size[1] // patch_size)
self.patch_shape = self.window_size
Copy link
Collaborator

Choose a reason for hiding this comment

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

patch_emb_shape might be more accurate.

@MeowZheng MeowZheng merged commit 69b28e0 into open-mmlab:master Apr 27, 2022
@MeowZheng MeowZheng deleted the beit-refa branch April 27, 2022 03:37
ZhimingNJ pushed a commit to AetrexTechnology/mmsegmentation that referenced this pull request Jun 29, 2022
…1517)

* [Refactor] Add build_pos_embed and build_layers for BEiT

* Update mmseg/models/backbones/beit.py
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this pull request Dec 3, 2023
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