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 clip backbone #1258

Merged
merged 12 commits into from
Dec 22, 2022
Merged

Conversation

Scarecrow0
Copy link
Contributor

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

Add the CLIP backbone for inference time of Imagenet classification.

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.

@CLAassistant
Copy link

CLAassistant commented Dec 12, 2022

CLA assistant check
All committers have signed the CLA.

configs/clip/README.md Outdated Show resolved Hide resolved
@tonysy
Copy link
Collaborator

tonysy commented Dec 12, 2022

The configs/clip/vit_base_224_dataproc.py and other similar files should be moved to configs/_base_/datasets, please follow the filename convention like imagenet_bs64_clip_224.py

Copy link
Collaborator

@tonysy tonysy left a comment

Choose a reason for hiding this comment

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

As inline comments

README: configs/clip/README.md

Models:
- Name: vit_base_patch16_clip_384.openai_ft_in12k_in1k
Copy link
Member

Choose a reason for hiding this comment

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

Please rename the model name according to https://mmclassification.readthedocs.io/en/dev-1.x/advanced_guides/convention.html
For example:
clip-vit-base-p16_openai-pre_3rdparty_in1k
clip-vit-base-p16_laion2b-in12k-pre_3rdparty_in1k-384px

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Thanks for the help.

@Scarecrow0
Copy link
Contributor Author

As inline comments

Changes are applied.

configs/clip/metafile.yml Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Base: 0.02% // Head: 88.65% // Increases project coverage by +88.62% 🎉

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

❗ Current head 148f77a differs from pull request most recent head 063ef99. Consider uploading reports for the commit 063ef99 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           dev-1.x    #1258       +/-   ##
============================================
+ Coverage     0.02%   88.65%   +88.62%     
============================================
  Files          121      152       +31     
  Lines         8217    12127     +3910     
  Branches      1368     1931      +563     
============================================
+ Hits             2    10751    +10749     
+ Misses        8215     1064     -7151     
- Partials         0      312      +312     
Flag Coverage Δ
unittests 88.65% <ø> (+88.62%) ⬆️

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

Impacted Files Coverage Δ
mmcls/datasets/transforms/compose.py
mmcls/models/backbones/deit3.py 94.52% <0.00%> (ø)
mmcls/models/backbones/revvit.py 64.39% <0.00%> (ø)
mmcls/models/backbones/replknet.py 93.00% <0.00%> (ø)
mmcls/engine/optimizers/adan_t.py 10.60% <0.00%> (ø)
mmcls/models/backbones/edgenext.py 95.20% <0.00%> (ø)
mmcls/models/backbones/mobileone.py 94.47% <0.00%> (ø)
mmcls/engine/hooks/ema_hook.py 81.69% <0.00%> (ø)
mmcls/models/backbones/davit.py 84.94% <0.00%> (ø)
mmcls/engine/hooks/margin_head_hooks.py 92.59% <0.00%> (ø)
... and 143 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.

@Scarecrow0
Copy link
Contributor Author

Request for further review. @mzr1996

The directory of converted checkpoints for CLIP model: /mnt/petrelfs/share_data/lirongjie/clip_backbone_ckpt

@Scarecrow0 Scarecrow0 requested review from mzr1996 and tonysy and removed request for mzr1996 December 15, 2022 03:54
@tonysy tonysy changed the title Add clip backbone [Feature] Add clip backbone Dec 15, 2022
configs/clip/metafile.yml Outdated Show resolved Hide resolved
configs/clip/metafile.yml Outdated Show resolved Hide resolved
configs/clip/metafile.yml Outdated Show resolved Hide resolved
configs/clip/metafile.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@tonysy tonysy left a comment

Choose a reason for hiding this comment

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

Please upadte the files according to zerun's comments

@Scarecrow0 Scarecrow0 requested review from tonysy and mzr1996 and removed request for tonysy and mzr1996 December 20, 2022 02:02
@mzr1996 mzr1996 merged commit 5b266d9 into open-mmlab:dev-1.x Dec 22, 2022
@openmmlab-bot
Copy link
Collaborator

Dear Scarecrow0 ,
First of all, we want to express our gratitude for your significant PR in the MMCls project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR.
We are looking forward to continuing our collaboration with you. OpenMMLab has established a special contributors' organization called MMSIG, which provides contributors with open-source certificates, a recognition system, and exclusive rewards. You can contact us by adding our WeChat(if you have WeChat): openmmlabwx, or join in our discord:https://discord.gg/raweFPmdzG. We sincerely hope you will join us!
Best regards! @Scarecrow0

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

5 participants