Meituan-AutoML/Twins

关于mmdet版本问题

sayoko17 opened this issue · 3 comments

我安装了2.8.0的mmdet
但在执行
config_file = 配置文件路径
checkpoint_file = 模型路径
model = init_detector(config_file, checkpoint_file, device='cuda:0')
加载模型时,却得到了这样的报错:

Traceback (most recent call last):
File "newtest.py", line 17, in
model = init_detector(config_file, checkpoint_file, device='cuda:0')
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/apis/inference.py", line 38, in init_detector
model = build_detector(config.model, test_cfg=config.test_cfg)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 67, in build_detector
return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg))
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 32, in build
return build_from_cfg(cfg, registry, default_args)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 171, in build_from_cfg
return obj_cls(**args)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/detectors/mask_rcnn.py", line 24, in init
pretrained=pretrained)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/detectors/two_stage.py", line 26, in init
self.backbone = build_backbone(backbone)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 37, in build_backbone
return build(cfg, BACKBONES)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 32, in build
return build_from_cfg(cfg, registry, default_args)
File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 164, in build_from_cfg
f'{obj_type} is not in the {registry.name} registry')
KeyError: 'alt_gvt_small is not in the backbone registry'

然后gvt.py里确实是有注册成backbone的,不知道如何解决

newtest.py 是不是没有import gvt,所以注册没有?

我安装了2.8.0的mmdet 但在执行 config_file = 配置文件路径 checkpoint_file = 模型路径 model = init_detector(config_file, checkpoint_file, device='cuda:0') 加载模型时,却得到了这样的报错:

Traceback (most recent call last): File "newtest.py", line 17, in model = init_detector(config_file, checkpoint_file, device='cuda:0') File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/apis/inference.py", line 38, in init_detector model = build_detector(config.model, test_cfg=config.test_cfg) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 67, in build_detector return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 32, in build return build_from_cfg(cfg, registry, default_args) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 171, in build_from_cfg return obj_cls(**args) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/detectors/mask_rcnn.py", line 24, in init pretrained=pretrained) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/detectors/two_stage.py", line 26, in init self.backbone = build_backbone(backbone) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 37, in build_backbone return build(cfg, BACKBONES) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmdet/models/builder.py", line 32, in build return build_from_cfg(cfg, registry, default_args) File "/home/sxn/data/env/openmmlab/lib/python3.7/site-packages/mmcv/utils/registry.py", line 164, in build_from_cfg f'{obj_type} is not in the {registry.name} registry') KeyError: 'alt_gvt_small is not in the backbone registry'

然后gvt.py里确实是有注册成backbone的,不知道如何解决

在init__里面导入后,好像是在文件目录下重新生成,

python setup.py develop

对于mmdetection, pip install就可以