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

Update regnet.py #935

Merged
merged 11 commits into from
Aug 10, 2022
Merged

Update regnet.py #935

merged 11 commits into from
Aug 10, 2022

Conversation

timothylimyl
Copy link
Contributor

Motivation

In the example comment to print out the different layers of outputs, we need to indicate the out_indices to (0,1,2,3) to see all backbone layers output as the default argument is (3,).

Let's just ensure that the user won't be confused on why the output printed does not match the code in the comments.

Modification

Just adding out_indices argument call to output all layers instead of leaving it to default.

In the example comment to print out the different layers of outputs, we need to indicate the `out_indices` to (0,1,2,3) to see all backbone layers output as the default argument is (3,)
@codecov
Copy link

codecov bot commented Jul 28, 2022

Codecov Report

Merging #935 (c3f0416) into dev (71ef7ba) will increase coverage by 1.29%.
The diff coverage is 97.64%.

@@            Coverage Diff             @@
##              dev     #935      +/-   ##
==========================================
+ Coverage   84.57%   85.86%   +1.29%     
==========================================
  Files         134      137       +3     
  Lines        8772     9363     +591     
  Branches     1516     1621     +105     
==========================================
+ Hits         7419     8040     +621     
+ Misses       1117     1082      -35     
- Partials      236      241       +5     
Flag Coverage Δ
unittests 85.79% <97.64%> (+1.21%) ⬆️

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

Impacted Files Coverage Δ
mmcls/models/backbones/mvit.py 97.61% <97.61%> (ø)
mmcls/models/backbones/__init__.py 100.00% <100.00%> (ø)
mmcls/models/backbones/regnet.py 98.05% <100.00%> (ø)
mmcls/models/utils/attention.py 96.91% <0.00%> (-3.09%) ⬇️
mmcls/datasets/voc.py 31.81% <0.00%> (-1.52%) ⬇️
mmcls/models/backbones/swin_transformer.py 85.64% <0.00%> (-1.50%) ⬇️
mmcls/models/heads/__init__.py 100.00% <0.00%> (ø)
mmcls/models/heads/multi_label_csra_head.py 92.15% <0.00%> (ø)
mmcls/models/backbones/swin_transformer_v2.py 89.47% <0.00%> (ø)
... and 9 more

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

Copy link
Collaborator

@Ezra-Yu Ezra-Yu left a comment

Choose a reason for hiding this comment

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

Thank you for your report.

It would be better if the case of str could be added, Can you please help us update it in this PR.

>>> from mmcls.models import RegNet
>>> import torch
>>> inputs = torch.rand(1, 3, 32, 32)
>>> # use str type 'arch'
>>> regnet_cfg = dict(arch='regnetx_4.0gf')  # default out_indices is (3,)
>>> model = RegNet(**regnet_cfg)
>>> model.eval()
>>> level_outputs = model(inputs)
>>> for level_out in level_outputs:
...     print(tuple(level_out.shape))
... 
(1, 1360, 1, 1)
>>> 
>>> # use dict type 'arch'
>>> arch_cfg =dict(w0=88, wa=26.31, wm=2.25, group_w=48, depth=25, bot_mul=1.0)
>>> regnet_cfg = dict(arch=arch_cfg, out_indices=(0, 1, 2, 3))
>>> model = RegNet(**regnet_cfg)
>>> model.eval()
>>> level_outputs = model(inputs)
>>> for level_out in level_outputs:
...     print(tuple(level_out.shape))
... 
(1, 96, 8, 8)
(1, 192, 4, 4)
(1, 432, 2, 2)
(1, 1008, 1, 1)

@Ezra-Yu Ezra-Yu changed the base branch from master to dev July 28, 2022 05:57
following changes proposal of maintainer
@timothylimyl
Copy link
Contributor Author

@Ezra-Yu follow your changes exactly.

@mzr1996
Copy link
Member

mzr1996 commented Aug 2, 2022

@Ezra-Yu follow your changes exactly.

Please fix the lint error before merge.

@timothylimyl
Copy link
Contributor Author

@mzr1996 done, sorry for the multiple useless commits, was not aware of the patch branch. You can see that the file changes is still just regnet.py docs.

@timothylimyl
Copy link
Contributor Author

ping @Ezra-Yu , can close?

@Ezra-Yu
Copy link
Collaborator

Ezra-Yu commented Aug 8, 2022

ping @Ezra-Yu , can close?

We can finish the PR today.

Copy link
Collaborator

@Ezra-Yu Ezra-Yu left a comment

Choose a reason for hiding this comment

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

LGTM.

@timothylimyl
Copy link
Contributor Author

timothylimyl commented Aug 10, 2022

docs is still off, I can't figure out how does the formatting works for now

@Ezra-Yu
Copy link
Collaborator

Ezra-Yu commented Aug 10, 2022

docs is still off, I can't figure out how does the formatting works for now

can you open this link

image

@mzr1996 mzr1996 merged commit b366897 into open-mmlab:dev Aug 10, 2022
@timothylimyl
Copy link
Contributor Author

thanks.

@timothylimyl timothylimyl deleted the patch-1 branch August 10, 2022 12:49
Ezra-Yu pushed a commit to Ezra-Yu/mmclassification that referenced this pull request Sep 6, 2022
* Update regnet.py

In the example comment to print out the different layers of outputs, we need to indicate the `out_indices` to (0,1,2,3) to see all backbone layers output as the default argument is (3,)

* Update regnet.py

following changes proposal of maintainer

* fix linting

* fix blank space for docs

* fix blank space for docs

* fix blank space for docs
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.

3 participants