open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.59k stars 9.46k forks source link

KeyError: "ATSS: 'DyHead is not in the models registry'" #7336

Closed Williamlizl closed 2 years ago

Williamlizl commented 2 years ago

Traceback (most recent call last): File "/home/lbc/mmdetection_val_tool/pred_class_result.py", line 33, in <module> model = init_detector(config, checkpoint, device='cuda:3') File "/home/lbc/.local/lib/python3.7/site-packages/mmdet/apis/inference.py", line 39, in init_detector model = build_detector(config.model, test_cfg=config.get('test_cfg')) File "/home/lbc/.local/lib/python3.7/site-packages/mmdet/models/builder.py", line 58, in build_detector cfg, default_args=dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/home/lbc/.local/lib/python3.7/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/lbc/.local/lib/python3.7/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/lbc/.local/lib/python3.7/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.__name__}: {e}') KeyError: "ATSS: 'DyHead is not in the models registry'"

version: mmdet: 2.2.0 mmcv-full:1.4.0

I use DyHead model to infer on my own coco-format datasets, but it shows the error.

shinya7y commented 2 years ago

Please install mmdet>=2.22.0 to use DyHead.

Williamlizl commented 2 years ago

Please install mmdet>=2.22.0 to use DyHead.

mmdet ==2.22.0, but it shows the error

shinya7y commented 2 years ago

Please reconfirm your mmdet version.

File "/home/lbc/.local/lib/python3.7/site-packages/mmdet/apis/inference.py", line 39, in init_detector model = build_detector(config.model, test_cfg=config.get('test_cfg'))

This code is line 43 in mmdet==2.22.0 https://github.com/open-mmlab/mmdetection/blob/v2.22.0/mmdet/apis/inference.py and line 39 in mmdet<2.16.0 https://github.com/open-mmlab/mmdetection/blob/v2.15.1/mmdet/apis/inference.py

Czm369 commented 2 years ago

Please check mmdet >=2.22.0.Because DyHead is only supported in 2.22.0 https://github.com/open-mmlab/mmdetection/blob/52a32763bef402a5eb684625d974eebe29755351/mmdet/models/necks/dyhead.py#L130. Maybe you can pip uninstall mmdet, git clone git@github.com:open-mmlab/mmdetection.git and re-install mmdet.

Williamlizl commented 2 years ago

Please check mmdet >=2.22.0.Because DyHead is only supported in 2.22.0

https://github.com/open-mmlab/mmdetection/blob/52a32763bef402a5eb684625d974eebe29755351/mmdet/models/necks/dyhead.py#L130

. Maybe you can pip uninstall mmdet, git clone git@github.com:open-mmlab/mmdetection.git and re-install mmdet.

Thank you, It does work in local environment, I pip mmdet==2,22,0 in conda virtual environment but not in local environment.