SamsungLabs / iterdet

[S+SSPR2020] IterDet: Iterative Scheme for Object Detection in Crowded Environments
https://arxiv.org/abs/2005.05708
Mozilla Public License 2.0
210 stars 39 forks source link

Error while running image_demo.py #13

Closed hyperparameters closed 3 years ago

hyperparameters commented 4 years ago

I tried to run the demo in colab after following the install.md guide i successfully build iterdet but got a runtime error when tried to image_demo.py

Reproduction

python demo/image_demo.py demo/demo.jpg configs/iterdet/crowd_human_visible_faster_rcnn_r50_fpn_2x.py \
    crowd_human_visible_faster_rcnn_r50_fpn_2x.pth --device gpu

Environment python mmdet/utils/collect_env.py also gives the same error

Traceback (most recent call last):
  File "mmdet/utils/collect_env.py", line 62, in <module>
    for name, val in collect_env().items():
  File "mmdet/utils/collect_env.py", line 55, in collect_env
    from mmdet.ops import get_compiler_version, get_compiling_cuda_version
  File "/content/iterdet/mmdet/ops/__init__.py", line 2, in <module>
    from .conv_ws import ConvWS2d, conv_ws_2d
  File "/content/iterdet/mmdet/ops/conv_ws.py", line 23, in <module>
    class ConvWS2d(nn.Conv2d):
  File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 122, in _register
    module_class=cls, module_name=name, force=force)
  File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 58, in _register_module
    raise KeyError(f'{module_name} is already registered '
KeyError: 'ConvWS is already registered in conv layer'
torch==1.5.1+cu101
torchvision==0.6.1+cu101
mmdet==2.0.0+1531b8d
mmcv==1.0.4

nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

gcc --version

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Error traceback

Traceback (most recent call last):
  File "demo/image_demo.py", line 3, in <module>
    from mmdet.apis import inference_detector, init_detector, show_result_pyplot
  File "/content/iterdet/mmdet/apis/__init__.py", line 1, in <module>
    from .inference import (async_inference_detector, inference_detector,
  File "/content/iterdet/mmdet/apis/inference.py", line 9, in <module>
    from mmdet.core import get_classes
  File "/content/iterdet/mmdet/core/__init__.py", line 5, in <module>
    from .mask import *  # noqa: F401, F403
  File "/content/iterdet/mmdet/core/mask/__init__.py", line 2, in <module>
    from .structures import BitmapMasks, PolygonMasks
  File "/content/iterdet/mmdet/core/mask/structures.py", line 8, in <module>
    from mmdet.ops.roi_align import roi_align
  File "/content/iterdet/mmdet/ops/__init__.py", line 2, in <module>
    from .conv_ws import ConvWS2d, conv_ws_2d
  File "/content/iterdet/mmdet/ops/conv_ws.py", line 23, in <module>
    class ConvWS2d(nn.Conv2d):
  File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 122, in _register
    module_class=cls, module_name=name, force=force)
  File "/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py", line 58, in _register_module
    raise KeyError(f'{module_name} is already registered '
KeyError: 'ConvWS is already registered in conv layer'
Udit1999 commented 4 years ago

I am facing the same issue.

Steps that I followed for installation:

git clone https://github.com/saic-vul/iterdet.git
cd iterdet 
pip install -r requirements/build.txt
pip install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"
pip install -v -e .  # or "python setup.py develop"
filaPro commented 4 years ago

Hi @hyperparameters, @Udit1999 Looks like it is a fresh bug in mmdetection, that is already fixed in their master. However this repo is not up-to-date with their master. I think, this may be fixed by downgrading mmcv to the version close to May 2020, ex. 0.5.8, as shown in mmcv section. Could you please try it and say if it helped?

Udit1999 commented 4 years ago

Hi @filaPro Thanks for your help. The issue is fixed by downgrading mmcv to 0.5.1.

filaPro commented 4 years ago

Fixed in b293300.

hihijimin commented 3 years ago

still.. i have this issue.

environment

  File "/home/name/HDD1/iterdet/mmdet/ops/__init__.py", line 2, in <module>
    from .conv_ws import ConvWS2d, conv_ws_2d
  File "/home/name/HDD1/iterdet/mmdet/ops/conv_ws.py", line 23, in <module>
    class ConvWS2d(nn.Conv2d):
  File "/home/name/anaconda3/envs/mmdetect/lib/python3.6/site-packages/mmcv/utils/registry.py", line 122, in _register
    module_class=cls, module_name=name, force=force)
  File "/home/name/anaconda3/envs/mmdetect/lib/python3.6/site-packages/mmcv/utils/registry.py", line 58, in _register_module
    raise KeyError(f'{module_name} is already registered '
KeyError: 'ConvWS is already registered in conv layer'

nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

gcc --version

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mmcv.version '0.5.1' mmdet.version '2.0.0+1f5b3be'

how can solve this problem? help me

filaPro commented 3 years ago

Hi @hihijimin ,

I've tried to build with the Dockerfile (just replaced original repo link with ours). python mmdet/utils/collect_env.py runs without errors. Can you please try with docker?

hihijimin commented 3 years ago

Hi @filaPro , Thank you. i tried to build with the docker. It works fine without errors.