-
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
add model registry #760
add model registry #760
Conversation
We can briefly describe the design in the PR description to involve more community discussions. |
Codecov Report
@@ Coverage Diff @@
## master #760 +/- ##
==========================================
- Coverage 64.86% 64.81% -0.05%
==========================================
Files 148 149 +1
Lines 9189 9404 +215
Branches 1647 1708 +61
==========================================
+ Hits 5960 6095 +135
- Misses 2902 2962 +60
- Partials 327 347 +20
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The original goal of design seems to be achieved perfectly. One remaining question: is there a guide to bypass the 3-level hierarchy? Because from the code here, it seems that only a 2-level hierarchy is accepted. |
We may also provide a guide for migrating from the old code to the new code (or what do we need to take care of to avoid BC-breaking) in the doc if necessary. |
Multi-level is supported. |
I will provide a illustration in this PR. And I will create a PR in model for demo. |
We may also need to provide one more registry for DATASET, thus downstream tasks can use similar build function from MMCV to build model, dataset, and runner in the unified entry point/engine. |
mmcv/utils/registry.py
Outdated
return self._module_dict.get(key, None) | ||
scope, real_key = self.split_scope_key(key) | ||
if scope is not None: | ||
return self._children[scope].get(real_key) |
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.
Does this satisfy the desired use case?
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.
Yep. The object could be built with inheritance in a recursive way.
Ping this part. Are we going to add this in this PR or in the future when necessary? |
The dataset build function is not unified yet. I suggest add DATASET in a new PR> |
OK. |
There is a remaining issue, how could build modules in |
|
@hellock doc refactor done. |
@hellock another doc refactor done. |
This PR refactored
Registry
class in following ways:build
function an attribute ofRegistry
class.before:
after:
build
function could be configured by passing argument.For example, we can define
MODEL
registry in both MMDetection and MMClassification as followed:In MMDetection:
In MMClassification:
We could build either
NetA
orNetB
by:Modification for MM repos:
before:
after: