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] Added NumClassCheckHook and CI tests #559

Merged

Conversation

elopezz
Copy link
Contributor

@elopezz elopezz commented Nov 26, 2021

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

Extend and adapt NumClassCheckHook for working with mmcls library. The hook is very convenient for checking if your model classes number is equal to the dataset classes number and detect early mistakes in the training pipeline.

Modification

I added the NumClassCheckHook, adapting it to the mmcls environment. I also added an unit test for checking the correct working of the hook.

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 Nov 26, 2021

CLA assistant check
All committers have signed the CLA.

@mzr1996
Copy link
Member

mzr1996 commented Nov 29, 2021

Thanks for your contribution, we will review it soon~

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.

  1. please build a local HOOK registry to avoid conflict of repeat registration into the HOOK registrar of MMCV refer to [Fix] Use local ATTENTION registry to avoid conflict with other repo. #375
  2. please make a /mmcls/core/hook folder and remove this hook in that folder, so that users can find this helpful feature easily. like https://github.com/open-mmlab/mmdetection/tree/master/mmdet/core/hook

@codecov
Copy link

codecov bot commented Nov 30, 2021

Codecov Report

Merging #559 (7de5235) into master (58ab028) will increase coverage by 0.02%.
The diff coverage is 85.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #559      +/-   ##
==========================================
+ Coverage   80.01%   80.03%   +0.02%     
==========================================
  Files         109      111       +2     
  Lines        6419     6446      +27     
  Branches     1102     1108       +6     
==========================================
+ Hits         5136     5159      +23     
- Misses       1146     1150       +4     
  Partials      137      137              
Flag Coverage Δ
unittests 80.03% <85.18%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
mmcls/core/hook/class_num_check_hook.py 84.00% <84.00%> (ø)
mmcls/core/hook/__init__.py 100.00% <100.00%> (ø)

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 58ab028...7de5235. Read the comment docs.

@elopezz elopezz requested a review from Ezra-Yu December 1, 2021 08:26
@mzr1996 mzr1996 self-requested a review December 2, 2021 07:02
mmcls/core/hook/NumClassCheckHook.py Outdated Show resolved Hide resolved
mmcls/core/hook/NumClassCheckHook.py Outdated Show resolved Hide resolved
mmcls/core/hook/NumClassCheckHook.py Outdated Show resolved Hide resolved
mmcls/core/hook/ClassNumCheckHook.py Outdated Show resolved Hide resolved
mmcls/core/hook/ClassNumCheckHook.py Outdated Show resolved Hide resolved
mmcls/core/hook/ClassNumCheckHook.py Outdated Show resolved Hide resolved
tests/test_data/test_datasets/test_num_class_hook.py Outdated Show resolved Hide resolved
@mzr1996
Copy link
Member

mzr1996 commented Dec 3, 2021

And please merge the latest master branch at first, because we made some changes about CI.

@elopezz elopezz changed the title [Enhancement] Added NumClassCheckHook and CI tests [Enhance] Added NumClassCheckHook and CI tests Dec 7, 2021
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 d232912 into open-mmlab:master Dec 8, 2021
mzr1996 pushed a commit to mzr1996/mmpretrain that referenced this pull request Nov 24, 2022
* Added NumClassCheckHook and CI tests

* Added HOOKS local registry. NumClassCheckHook and unit test files redistribution.

* Extended hook for supporting IterRunner & EpochRunner. Extended unit test.

* Simplification of ClassNumCheckHook. Minor changes.
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.

4 participants