diff --git a/DeepDataMiningLearning/ngdet/detectors/base.py b/DeepDataMiningLearning/ngdet/detectors/base.py index 70001c57..9854f63d 100644 --- a/DeepDataMiningLearning/ngdet/detectors/base.py +++ b/DeepDataMiningLearning/ngdet/detectors/base.py @@ -186,5 +186,10 @@ def build_detector(spec: str, taxonomy, device: str = "cuda", # Expected: prints the registered detector backends (after importing adapters). # =========================================================================== if __name__ == "__main__": - from . import hf_detr, yolo, locate_anything # noqa: F401 - print("Registered detector backends:", list(DETECTOR_REGISTRY)) + # Under `python -m` this file runs as `__main__`; importing an adapter + # loads it a *second* time under its real name, and @register fills that + # copy's registry rather than this one. Read the canonical module so the + # self-test reports what a normal import sees instead of an empty list. + from DeepDataMiningLearning.ngdet.detectors import base as _canonical + from DeepDataMiningLearning.ngdet.detectors import hf_detr, yolo, locate_anything # noqa: F401 + print("Registered detector backends:", list(_canonical.DETECTOR_REGISTRY)) diff --git a/DeepDataMiningLearning/ngperception/depth/estimators/base.py b/DeepDataMiningLearning/ngperception/depth/estimators/base.py index 8fb38e9e..206dfe3c 100644 --- a/DeepDataMiningLearning/ngperception/depth/estimators/base.py +++ b/DeepDataMiningLearning/ngperception/depth/estimators/base.py @@ -116,5 +116,10 @@ def build_estimator(spec: str, device: str = "cuda", **kwargs) -> BaseDepthEstim # Expected: prints the registered depth backends (after importing adapters). # =========================================================================== if __name__ == "__main__": - from . import hf_depth # noqa: F401 - print("Registered depth backends:", list(DEPTH_REGISTRY)) + # Under `python -m` this file runs as `__main__`; importing an adapter + # loads it a *second* time under its real name, and @register fills that + # copy's registry rather than this one. Read the canonical module so the + # self-test reports what a normal import sees instead of an empty list. + from DeepDataMiningLearning.ngperception.depth.estimators import base as _canonical + from DeepDataMiningLearning.ngperception.depth.estimators import hf_depth # noqa: F401 + print("Registered depth backends:", list(_canonical.DEPTH_REGISTRY))