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 'rfp' for mmdet v2.0 branch #53

Closed TrachIvan closed 4 years ago

TrachIvan commented 4 years ago

I getting such error TypeError: init() got an unexpected keyword argument 'rfp' after adding rfp.py from master branch of mmdet

Checklist I have searched related issues but cannot get the expected help.

Describe the bug There is no support for DetectorRS in mmdet2.0 branch

Reproduction

  1. This is my command python demo/webcam_demo.py configs/DetectoRS/DetectoRS_mstrain_400_1200_r50_40e.py ../DetectoRS-master/DetectoRS_R50-0f1c8080.pth
  2. I performed changes in detectors directories, I have tried to add rfp.py to detector list, so I have merged htc.py and cascade_rcnn.py to can add rfp.py as there is no rfp support in mmdet2.0 branch

Environment

sys.platform: linux Python: 3.6.8 (default, Oct 7 2019, 12:59:55) [GCC 8.3.0] CUDA available: True CUDA_HOME: /usr/local/cuda-10.1 NVCC: Cuda compilation tools, release 10.1, V10.1.168 GPU 0: GeForce GTX 1060 6GB GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.6.0a0+0ecea2d PyTorch compiling details: PyTorch built with:

TorchVision: 0.7.0a0+e92b515 OpenCV: 4.2.0 MMCV: 0.6.2 MMDetection: 2.0.0+e32f6d5 MMDetection Compiler: GCC 7.5 MMDetection CUDA Compiler: 10.1 I have installed PyTorch from source

Error traceback Traceback (most recent call last): File "demo/webcam_demo.py", line 46, in main() File "demo/webcam_demo.py", line 28, in main model = init_detector(args.config, args.checkpoint, device=device) File "DetectoRS/mmdet/apis/inference.py", line 33, in init_detector model = build_detector(config.model, test_cfg=config.test_cfg) File "DetectoRS/mmdet/models/builder.py", line 48, in build_detector return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg)) File "DetectoRS/mmdet/models/builder.py", line 20, in build return build_from_cfg(cfg, registry, default_args) File "py_env/venv/lib/python3.6/site-packages/mmcv/utils/registry.py", line 167, in build_from_cfg return obj_cls(args) File "DetectoRS/mmdet/models/detectors/rfp.py", line 78, in init kwargs) File "DetectoRS/mmdet/models/detectors/htc.py", line 24, in init super(HybridTaskCascade, self).init(num_stages, backbone, kwargs) File "DetectoRS/mmdet/models/detectors/cascade_rcnn.py", line 36, in init self.backbone = builder.build_backbone(backbone) File "DetectoRS/mmdet/models/builder.py", line 24, in build_backbone return build(cfg, BACKBONES) File "DetectoRS/mmdet/models/builder.py", line 20, in build return build_from_cfg(cfg, registry, default_args) File "py_env/venv/lib/python3.6/site-packages/mmcv/utils/registry.py", line 167, in build_from_cfg return obj_cls(args)

Bug fix I have tried to rebuild mmdet after adding rfp, but it did not six an issue. So if there is add support for DetectorRS I would much appreciate this, and I would like to propose my help to add it for latest pytorch and mmdet.

Thank you very much

joe-siyuan-qiao commented 4 years ago

MMdetection v1 and v2 are not compatible. The mmdetv2 branch has the implementation of DetectoRS, which is similar to the implementation of the official mmdetection repo. If you need to use the pre-trained large models in the master branch, you probably need to retrain them using mmdetv2 branch or mmdetection official repo; or you can try to manually convert the pre-trained checkpoint if there's any mismatch. However, converting models may not work due to the compatibility issue.

TrachIvan commented 4 years ago

Hi,

Thank you very much for your replay. Yes, converting models produced to many issues, so I decided to build mmdet for pytorch 1.7 and I managed to do it, but it produced very poor results, so I am going to invasigate it, but it is another issue in any way, so I am closing this one.

Thank you very much again, Ivan