TSD
TSD copied to clipboard
KeyError: 'TSDSharedFCBBoxHead is not in the head registry'
While running this, i encountered the error
from mmdet.apis import inference_detector, init_detector, show_result_pyplot config_file = '/md/tsd/faster_rcnn_x101_64x4d_fpn_TSD.py' checkpoint_file = '/md/tsd/faser_rcnn_X101_64x4d_TSD.pth' model = init_detector(config_file, checkpoint_file, device='cuda:0')
Environment
sys.platform: linux Python: 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0] CUDA available: True CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 10.1, V10.1.243 GPU 0: Tesla T4 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.3.1+cu100 PyTorch compiling details: PyTorch built with:
- GCC 7.3
- Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for Intel(R) 64 architecture applications
- Intel(R) MKL-DNN v0.20.5 (Git Hash 0125f28c61c1f822fd48570b4c1066f96fcb9b2e)
- OpenMP 201511 (a.k.a. OpenMP 4.5)
- NNPACK is enabled
- CUDA Runtime 10.0
- NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
- CuDNN 7.6.3
- Magma 2.5.1
- Build settings: BLAS=MKL, BUILD_NAMEDTENSOR=OFF, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -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-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 -Wno-stringop-overflow, DISABLE_NUMA=1, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=True, 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.4.2+cu100 OpenCV: 4.5.1 MMCV: 0.4.3 MMDetection: 1.1.0+unknown MMDetection Compiler: GCC 7.5 MMDetection CUDA Compiler: 10.1
Error traceback
KeyError Traceback (most recent call last)
8 frames /content/mmdetection-1.1.0/mmdet/apis/inference.py in init_detector(config, checkpoint, device) 32 'but got {}'.format(type(config))) 33 config.model.pretrained = None ---> 34 model = build_detector(config.model, test_cfg=config.test_cfg) 35 if checkpoint is not None: 36 checkpoint = load_checkpoint(model, checkpoint)
/content/mmdetection-1.1.0/mmdet/models/builder.py in build_detector(cfg, train_cfg, test_cfg) 41 42 def build_detector(cfg, train_cfg=None, test_cfg=None): ---> 43 return build(cfg, DETECTORS, dict(train_cfg=train_cfg, test_cfg=test_cfg))
/content/mmdetection-1.1.0/mmdet/models/builder.py in build(cfg, registry, default_args) 13 return nn.Sequential(*modules) 14 else: ---> 15 return build_from_cfg(cfg, registry, default_args) 16 17
/content/mmdetection-1.1.0/mmdet/utils/registry.py in build_from_cfg(cfg, registry, default_args) 77 for name, value in default_args.items(): 78 args.setdefault(name, value) ---> 79 return obj_cls(**args)
/content/mmdetection-1.1.0/mmdet/models/detectors/faster_rcnn.py in init(self, backbone, rpn_head, bbox_roi_extractor, bbox_head, train_cfg, test_cfg, neck, shared_head, pretrained) 25 train_cfg=train_cfg, 26 test_cfg=test_cfg, ---> 27 pretrained=pretrained)
/content/mmdetection-1.1.0/mmdet/models/detectors/two_stage.py in init(self, backbone, neck, shared_head, rpn_head, bbox_roi_extractor, bbox_head, mask_roi_extractor, mask_head, train_cfg, test_cfg, pretrained) 45 self.bbox_roi_extractor = builder.build_roi_extractor( 46 bbox_roi_extractor) ---> 47 self.bbox_head = builder.build_head(bbox_head) 48 49 if mask_head is not None:
/content/mmdetection-1.1.0/mmdet/models/builder.py in build_head(cfg) 33 34 def build_head(cfg): ---> 35 return build(cfg, HEADS) 36 37
/content/mmdetection-1.1.0/mmdet/models/builder.py in build(cfg, registry, default_args) 13 return nn.Sequential(*modules) 14 else: ---> 15 return build_from_cfg(cfg, registry, default_args) 16 17
/content/mmdetection-1.1.0/mmdet/utils/registry.py in build_from_cfg(cfg, registry, default_args) 68 if obj_cls is None: 69 raise KeyError('{} is not in the {} registry'.format( ---> 70 obj_type, registry.name)) 71 elif inspect.isclass(obj_type): 72 obj_cls = obj_type
KeyError: 'TSDSharedFCBBoxHead is not in the head registry'
I run the code, without loading checkpoint under ./TSD/ and everything is ok. Re-installing tsd maybe helpful. And the potential problem maybe that you have more than one mmdet installed and your code import another one.