joe-siyuan-qiao / DetectoRS

DetectoRS: Detecting Objects with Recursive Feature Pyramid and Switchable Atrous Convolution

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: __init__() got an unexpected keyword argument 'rfp' for mmdet v2.0 branch

TrachIvan opened this issue · comments

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:
  - GCC 7.5
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.1 Product Build 20200208 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.5.0 (Git Hash e2ac1fac44c5078ca927cb9b90e1b3066a0b2ed0)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 10.1
  - NVCC architecture flags: -gencode;arch=compute_61,code=sm_61
  - CuDNN 7.5.1
  - Magma 2.5.2
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=1, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF, 

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 <module>
    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  

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.

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