joe-siyuan-qiao / DetectoRS

DetectoRS: Detecting Objects with Recursive Feature Pyramid and Switchable Atrous Convolution
Apache License 2.0
1.14k stars 176 forks source link

TypeError: __init__() got an unexpected keyword argument 'sac' #40

Closed CruiseShao closed 4 years ago

CruiseShao commented 4 years ago

When I was running image_demo.py on a branch based on mmdetv2, a problem occurred. I was testing detectors_htc_r50_1x_coco.py, how can I fix it?

/home/powerop/.local/lib/python3.6/site-packages/mmcv/utils/registry.py:64: UserWarning: The old API of register_module(module, force=False) is deprecated and will be removed, please use the new API register_module(name=None, force=False, module=None) instead. 'The old API of register_module(module, force=False) ' Traceback (most recent call last): File "image_demo.py", line 26, in main() File "image_demo.py", line 18, in main model = init_detector(args.config, args.checkpoint, device=args.device) File "/home/powerop/work/package/mmdetection-master/mmdet/apis/inference.py", line 33, in init_detector model = build_detector(config.model, test_cfg=config.test_cfg) File "/home/powerop/work/package/mmdetection-master/mmdet/models/builder.py", line 48, in build_detector return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "/home/powerop/work/package/mmdetection-master/mmdet/models/builder.py", line 20, in build return build_from_cfg(cfg, registry, default_args) File "/home/powerop/.local/lib/python3.6/site-packages/mmcv/utils/registry.py", line 167, in build_from_cfg return obj_cls(args) File "/home/powerop/work/package/mmdetection-master/mmdet/models/detectors/htc.py", line 9, in init super(HybridTaskCascade, self).init(kwargs) File "/home/powerop/work/package/mmdetection-master/mmdet/models/detectors/cascade_rcnn.py", line 23, in init pretrained=pretrained) File "/home/powerop/work/package/mmdetection-master/mmdet/models/detectors/two_stage.py", line 26, in init self.backbone = build_backbone(backbone) File "/home/powerop/work/package/mmdetection-master/mmdet/models/builder.py", line 24, in build_backbone return build(cfg, BACKBONES) File "/home/powerop/work/package/mmdetection-master/mmdet/models/builder.py", line 20, in build return build_from_cfg(cfg, registry, default_args) File "/home/powerop/.local/lib/python3.6/site-packages/mmcv/utils/registry.py", line 167, in build_from_cfg return obj_cls(**args) TypeError: init() got an unexpected keyword argument 'sac'

joe-siyuan-qiao commented 4 years ago

Hi, I just did a quick run on image_demo.py but didn't observe this error. Please make sure python finds this repo when importing mmdet so changes made to it can be reflected in the environment. Thanks.

CruiseShao commented 4 years ago

I reinstalled the entire virtual environment and fixed the SAC bug while testing with tool/test.py. But in the test, part of the convolutional layer parameter is missing. image

CruiseShao commented 4 years ago

I have successfully obtained the detection results, and how can I achieve the segmentation results as the paper shows? Are there any functions or code in the mmdet that I can use? And thank you for your sharing of code and answer. image

CruiseShao commented 4 years ago

I created another environment and installed the v1 code, and when I tested it using the same commands, I found that I could perform the Segmentation of different targets. I think it's because the V2 version of the code doesn't match the trained model resulting in the inability to perform subsequent segmentation operations and exhibits partial convolutional Parameter mismatch.

joe-siyuan-qiao commented 4 years ago

Thanks for reporting this. I don't think the problem is due to model mismatching if you could get a normal box/mask AP. The script reported missing parameters perhaps because it loaded the ImageNet pre-trained model before loading the coco checkpoint. Anyway, good to see that you got what you wanted in the end.