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

[Improve] Update registries of mmcls. #1306

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

mzr1996
Copy link
Member

@mzr1996 mzr1996 commented Jan 9, 2023

Motivation

MMEngine has supported to auto import modules from the registry and added some other updates.

Modification

  1. Add locations to all registries in mmcls to support auto-import.
  2. Adjust all scripts. For scripts using runner, remove the register_all_modules since it's not necessary. For scripts without using runner, replace register_all_modules to init_default_scope.
  3. Update the minimum version of Python to 3.7 since MMengine has updated.

Usage

With this PR, we can directly build components from the registry without importing the related package. For example

>>> from mmcls.registry import DATASETS
>>> DATASETS.build({'type': 'CIFAR10', 'data_prefix': 'data/cifar10', 'test_mode': True})
Dataset CIFAR10
    Number of samples: 	10000
    Number of categories: 	10
    Prefix of data: 	data/cifar10

@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Base: 0.02% // Head: 88.60% // Increases project coverage by +88.57% 🎉

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

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

Additional details and impacted files
@@             Coverage Diff              @@
##           dev-1.x    #1306       +/-   ##
============================================
+ Coverage     0.02%   88.60%   +88.57%     
============================================
  Files          121      161       +40     
  Lines         8217    12687     +4470     
  Branches      1368     2038      +670     
============================================
+ Hits             2    11241    +11239     
+ Misses        8215     1107     -7108     
- Partials         0      339      +339     
Flag Coverage Δ
unittests 88.60% <ø> (+88.57%) ⬆️

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/classifiers/timm.py 25.97% <0.00%> (ø)
mmcls/evaluation/metrics/multi_task.py 94.59% <0.00%> (ø)
mmcls/models/necks/reduction.py 100.00% <0.00%> (ø)
mmcls/models/classifiers/hugging_face.py 25.64% <0.00%> (ø)
mmcls/models/tta/__init__.py 100.00% <0.00%> (ø)
mmcls/apis/model.py 82.29% <0.00%> (ø)
mmcls/structures/multi_task_data_sample.py 100.00% <0.00%> (ø)
mmcls/models/backbones/mobilevit.py 91.15% <0.00%> (ø)
mmcls/models/heads/efficientformer_head.py 93.10% <0.00%> (ø)
... and 152 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/apis/inference.py Show resolved Hide resolved
mmcls/registry.py Outdated Show resolved Hide resolved
tools/visualizations/vis_scheduler.py Show resolved Hide resolved
@mzr1996 mzr1996 requested a review from yingfhu January 10, 2023 09:52
Copy link
Collaborator

@yingfhu yingfhu 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 97c4ae8 into open-mmlab:dev-1.x Jan 11, 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.

None yet

2 participants