Skip to content
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

关于mmdet版本问题 #27

Open
sayoko17 opened this issue Mar 5, 2022 · 3 comments
Open

关于mmdet版本问题 #27

sayoko17 opened this issue Mar 5, 2022 · 3 comments

Comments

@sayoko17
Copy link

sayoko17 commented Mar 5, 2022

我安装了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的,不知道如何解决

@cxxgtxy
Copy link
Collaborator

cxxgtxy commented Mar 10, 2022

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

@cenchaojun
Copy link

我安装了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

@cxxgtxy
Copy link
Collaborator

cxxgtxy commented Mar 17, 2022

对于mmdetection, pip install就可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants