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

[Feature] Add vis-cam tool #577

Merged
merged 37 commits into from
Dec 23, 2021
Merged

[Feature] Add vis-cam tool #577

merged 37 commits into from
Dec 23, 2021

Conversation

Ezra-Yu
Copy link
Collaborator

@Ezra-Yu Ezra-Yu commented Dec 2, 2021

Motivation

Add tool to visualize cam

Modification

Please briefly describe what modification is made in this PR.

Use cases

python tools/visualizations/vis_cam.py demo/bird.JPEG configs/resnet/resnet50_8xb32_in1k.py \
    https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_batch256_imagenet_20200708-cfb998bf.pth \
    --target-layers model.backbone.layer4.2

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.

@Ezra-Yu Ezra-Yu changed the title Add vis-cam tool [Feature] Add vis-cam tool Dec 2, 2021
@codecov
Copy link

codecov bot commented Dec 2, 2021

Codecov Report

Merging #577 (9d5c053) into master (643fb19) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #577      +/-   ##
==========================================
+ Coverage   81.31%   81.34%   +0.02%     
==========================================
  Files         115      116       +1     
  Lines        6654     6722      +68     
  Branches     1142     1156      +14     
==========================================
+ Hits         5411     5468      +57     
- Misses       1095     1103       +8     
- Partials      148      151       +3     
Flag Coverage Δ
unittests 81.34% <100.00%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
mmcls/models/backbones/swin_transformer.py 91.90% <100.00%> (+0.04%) ⬆️
mmcls/models/backbones/t2t_vit.py 94.44% <100.00%> (+0.04%) ⬆️
mmcls/datasets/__init__.py 100.00% <0.00%> (ø)
mmcls/datasets/samplers/__init__.py 100.00% <0.00%> (ø)
mmcls/datasets/samplers/repeat_aug.py 85.10% <0.00%> (ø)
mmcls/datasets/builder.py 46.15% <0.00%> (+3.60%) ⬆️
mmcls/apis/train.py 27.77% <0.00%> (+6.25%) ⬆️
mmcls/datasets/samplers/distributed_sampler.py 28.00% <0.00%> (+6.26%) ⬆️

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 b4450b7...9d5c053. Read the comment docs.

@Ezra-Yu Ezra-Yu mentioned this pull request Dec 13, 2021
@Ezra-Yu Ezra-Yu requested a review from mzr1996 December 13, 2021 09:07
Copy link
Member

@mzr1996 mzr1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@mzr1996 mzr1996 merged commit 131d8c6 into open-mmlab:master Dec 23, 2021
@Ezra-Yu Ezra-Yu deleted the cam branch July 18, 2022 08:47
mzr1996 added a commit to mzr1996/mmpretrain that referenced this pull request Nov 24, 2022
* add cam-grad tool

* refactor cam-grad tool

* add docs

* update docs

* Update docs and support Transformer

* remove pictures and use link

* replace example img and finish EN docs

* improve docs

* improve code

* Fix MobileNet V3 configs

* Refactor to support more powerful feature extraction.

* Add unit tests

* Fix unit test

* fix distortion of visualization exapmles in docs

* fix distortion

* fix distortion

* fix distortion

* merge master

* merge fix conficts

* Imporve the tool

* Support use both attribute name and index to get layer

* add default get_target-layers

* add default get_target-layers

* update docs

* update docs

* add additional printt info when not using target-layers

* Imporve docs

* Fix enumerate list.

Co-authored-by: mzr1996 <[email protected]>
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