-
Notifications
You must be signed in to change notification settings - Fork 440
Description
What is the feature?
Motivation
Currently, linking components (for example, passing backbone.out_channels to neck) requires either:
-
Hardcoding values in the config (error-prone)
-
Writing "glue code" inside parent classes (i.e. Detector), which tightly couples components and requires modifying source code to change data flow.
Limiting the ability to compose generic components dynamically.
Proposal
Introduce ObjectHub to enable runtime parameter resolution directly within build_from_cfg.
Design
ObjectHub: A global registry (inheriting ManagerMixin) that manages live instances, scoped to the current experiment.
_alias_: A new config reserved key that registers the built instance to the hub.
@ syntax: String arguments starting with @ are resolved dynamically against registered objects.
Example
model = dict(
type='Detector',
backbone=dict(
type='ResNet',
depth=50,
_alias_='first_backbone' # Register instance
),
neck=dict(
type='FPN',
in_channels='@first_backbone.out_channels' # Resolve attribute at runtime
)
)Status
I have a prototype ready.
It supports:
- recursive resolution (@backbone.meta.version)
- private attribute protection,
- and is isolated by Runner experiment name.
Any other context?
No response