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

[Enhance] Add stochastic depth decay rule in resnet #1363

Merged
merged 7 commits into from Feb 22, 2023

Conversation

fangyixiao18
Copy link
Collaborator

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

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

update resnet according to timm
code link: https://github.com/rwightman/pytorch-image-models/blob/main/timm/models/resnet.py#L600

BC-breaking (Optional)

Does the modification introduce changes that break the backward compatibility of the downstream repositories?
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

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.

@codecov
Copy link

codecov bot commented Feb 13, 2023

Codecov Report

Base: 0.02% // Head: 86.79% // Increases project coverage by +86.77% 🎉

Coverage data is based on head (1025876) compared to base (b8b31e9).
Patch has no changes to coverable lines.

❗ Current head 1025876 differs from pull request most recent head c05e73a. Consider uploading reports for the commit c05e73a to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           dev-1.x    #1363       +/-   ##
============================================
+ Coverage     0.02%   86.79%   +86.77%     
============================================
  Files          121      169       +48     
  Lines         8217    13969     +5752     
  Branches      1368     2221      +853     
============================================
+ Hits             2    12125    +12123     
+ Misses        8215     1461     -6754     
- Partials         0      383      +383     
Flag Coverage Δ
unittests 86.79% <ø> (+86.77%) ⬆️

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

Impacted Files Coverage Δ
mmcls/datasets/transforms/compose.py
mmcls/utils/analyze.py 100.00% <0.00%> (ø)
mmcls/models/heads/margin_head.py 89.13% <0.00%> (ø)
mmcls/models/backbones/deit3.py 94.52% <0.00%> (ø)
mmcls/engine/hooks/switch_recipe_hook.py 88.46% <0.00%> (ø)
mmcls/structures/multi_task_data_sample.py 100.00% <0.00%> (ø)
mmcls/models/necks/reduction.py 100.00% <0.00%> (ø)
mmcls/models/backbones/levit.py 96.06% <0.00%> (ø)
mmcls/models/backbones/hornet.py 82.05% <0.00%> (ø)
mmcls/models/backbones/mobileone.py 94.47% <0.00%> (ø)
... and 160 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

mmcls/models/backbones/resnet.py Outdated Show resolved Hide resolved
mmcls/models/backbones/resnet.py Outdated Show resolved Hide resolved
Comment on lines 167 to 168
drop_path_rate = np.array([drop_path_rate])
drop_path_rate = drop_path_rate.repeat(num_blocks)
Copy link
Member

Choose a reason for hiding this comment

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

I think [drop_path_rate] * num_blocks is enough, we don't need to import numpy and use numpy array here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

forgot to update

@mzr1996 mzr1996 merged commit ab953f3 into open-mmlab:dev-1.x Feb 22, 2023
@fangyixiao18 fangyixiao18 deleted the resnet-stochastic-dpr branch February 23, 2023 08:28
Ezra-Yu pushed a commit to Ezra-Yu/mmclassification that referenced this pull request Apr 11, 2023
* add stochastic depth decay rule to drop path rate

* add default value

* update

* pass ut

* update

* pass ut

* remove np
fangyixiao18 added a commit that referenced this pull request Apr 13, 2023
* [Enhance] Add stochastic depth decay rule in resnet. (#1363)

* add stochastic depth decay rule to drop path rate

* add default value

* update

* pass ut

* update

* pass ut

* remove np

* rebase

* update ToPIL and ToNumpy

* rebase

* rebase

* rebase

* rebase

* add readme

* fix review suggestions

* rebase

* fix conflicts

* fix conflicts

* fix lint

* remove comments

* remove useless code

* update docstring

* update doc API

* update doc

---------

Co-authored-by: Yixiao Fang <36138628+fangyixiao18@users.noreply.github.com>
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.

None yet

3 participants