-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
EvalHook uses case-insensitive key indicator matching and configurabl… #1076
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1076 +/- ##
==========================================
+ Coverage 65.72% 67.66% +1.94%
==========================================
Files 157 159 +2
Lines 10092 10296 +204
Branches 1828 1864 +36
==========================================
+ Hits 6633 6967 +334
+ Misses 3113 2961 -152
- Partials 346 368 +22
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Usage and Migration are needed in the PR description for downstream repos, like #739 |
@dreamerlin |
mmcv/runner/hooks/evaluation.py
Outdated
@@ -367,8 +391,13 @@ def _do_evaluate(self, runner): | |||
if tmpdir is None: | |||
tmpdir = osp.join(runner.work_dir, '.eval_hook') | |||
|
|||
from mmcv.engine import multi_gpu_test | |||
results = multi_gpu_test( | |||
if self.test_fn is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we do this once during initialization rather than import the function every epoch?
* configurable greater/less keys
* update DistEvalHook
Motivation
Make the EvalHook more flexible to ease the inheritance and usage of it in the downstream repos.
Modification
Usage
Config
To use
EvalHook
with a specific setting, users need to modify the evaluation variable in config files. like:Migration
Since the key for determine greater an less is related to the downstream task, downstream repos may need to overwrite the self.greater_keys and self.less_keys:
It is recommended to implement EvalHook in downstream repos by inheriting the one in MMCV. Specifically, downstream repos may need to:
self.greater_keys
andself.less_keys
. Note that these keys will be used in a case-insensitive way, so it's better to define them in lower case for consistency.self.__init__
to specify the test_fn. Or the default ones (mmcv.engine.single_gpu_test
for EvalHook andmmcv.engine.multi_gpu_test
for DistEvalHook)For example:
BC-breaking (Optional)
May need to check if there are any case-sensitive key indicators used in downstream repos.