I have been training a model using mmdetection on Google Colab, and everything worked well before this afternoon. But suddenly, with exactly the same code, when I ran
from mmdet.apis import init_detector, inference_detector
I got this error:
`/content/mmdetection/mmdet/apis/__init__.py in
----> 1 from .inference import (async_inference_detector, inference_detector,
2 init_detector, show_result_pyplot)
3 from .test import multi_gpu_test, single_gpu_test
4 from .train import get_root_logger, set_random_seed, train_detector
5
/content/mmdetection/mmdet/apis/inference.py in
7 from mmcv.runner import load_checkpoint
8
----> 9 from mmdet.core import get_classes
10 from mmdet.datasets.pipelines import Compose
11 from mmdet.models import build_detector
/content/mmdetection/mmdet/core/__init__.py in
1 from .anchor import * # noqa: F401, F403
----> 2 from .bbox import * # noqa: F401, F403
3 from .evaluation import * # noqa: F401, F403
4 from .fp16 import * # noqa: F401, F403
5 from .mask import * # noqa: F401, F403
/content/mmdetection/mmdet/core/bbox/__init__.py in
5 TBLRBBoxCoder)
6 from .iou_calculators import BboxOverlaps2D, bbox_overlaps
----> 7 from .samplers import (BaseSampler, CombinedSampler,
8 InstanceBalancedPosSampler, IoUBalancedNegSampler,
9 OHEMSampler, PseudoSampler, RandomSampler,
/content/mmdetection/mmdet/core/bbox/samplers/__init__.py in
7 from .random_sampler import RandomSampler
8 from .sampling_result import SamplingResult
----> 9 from .score_hlr_sampler import ScoreHLRSampler
10
11 __all__ = [
/content/mmdetection/mmdet/core/bbox/samplers/score_hlr_sampler.py in
1 import torch
2
----> 3 from mmdet.ops import nms_match
4 from ..builder import BBOX_SAMPLERS
5 from ..transforms import bbox2roi
/content/mmdetection/mmdet/ops/__init__.py in
1 from .context_block import ContextBlock
----> 2 from .conv_ws import ConvWS2d, conv_ws_2d
3 from .corner_pool import CornerPool
4 from .dcn import (DeformConv, DeformConvPack, DeformRoIPooling,
5 DeformRoIPoolingPack, ModulatedDeformConv,
/content/mmdetection/mmdet/ops/conv_ws.py in
22
23 @CONV_LAYERS.register_module(name='ConvWS')
---> 24 class ConvWS2d(nn.Conv2d):
25
26 def __init__(self,
/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py in _register(cls)
120 def _register(cls):
121 self._register_module(
--> 122 module_class=cls, module_name=name, force=force)
123 return cls
124
/usr/local/lib/python3.6/dist-packages/mmcv/utils/registry.py in _register_module(self, module_class, module_name, force)
56 module_name = module_class.__name__
57 if not force and module_name in self._module_dict:
---> 58 raise KeyError(f'{module_name} is already registered '
59 f'in {self.name}')
60 self._module_dict[module_name] = module_class
KeyError: 'ConvWS is already registered in conv layer'`
Does anyone have the same problem? It only appeared this afternoon.
Same issue here (#3249). We made duplicate posts at almost exactly the same time!
This is due to the updates of MMCV. We move all cuda ops to mmcv in the latest version. A temporary workaround is to install mmcv==0.6.2. This issue will be fixed after #3232 being fixed.
Most helpful comment
This is due to the updates of MMCV. We move all cuda ops to mmcv in the latest version. A temporary workaround is to install mmcv==0.6.2. This issue will be fixed after #3232 being fixed.