mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

import custom model error

Open GF1447571253 opened this issue 2 years ago • 18 comments

I run tools/train.py on my machine and got a KeyError! 2022-05-14 15:19:32,105 - mmdet - INFO - Set random seed to 640356377, deterministic: False Traceback (most recent call last): File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg return obj_cls(**args) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/detectors/yolox.py", line 58, in init super(YOLOX, self).init(backbone, neck, bbox_head, train_cfg, File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/detectors/single_stage.py", line 32, in init self.backbone = build_backbone(backbone) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/builder.py", line 20, in build_backbone return BACKBONES.build(cfg) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 44, in build_from_cfg raise KeyError( KeyError: 'ConvNeXt is not in the models registry'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 237, in main() File "tools/train.py", line 207, in main model = build_detector( File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/builder.py", line 58, in build_detector return DETECTORS.build( File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') KeyError: "YOLOX: 'ConvNeXt is not in the models registry'"

However, i run it on pycharm with ssh interpreter, and the code works

GF1447571253 avatar May 14 '22 07:05 GF1447571253

ConvNeXt is not supported yet, #7281

chhluo avatar May 14 '22 11:05 chhluo

Sorry, i think i didn’t describe my question clearly, all I want to ask is , i run the code with pycharm by ssh liking my server ,no error occur, but run the code in server shell got a error. For more information,I would like describing my question again in Chinese. 我在pycharm上通过ssh远程连接服务器,然后在pycharm上运行代码,没有报错。但是在服务器的终端上运行代码就报错? convnext我已经实现并通过加入到mmdet/models/backbones/init.py里面了,也通过custom_imports加入到配置文件中了

Sent from my iPhone

------------------ Original ------------------ From: Cedric Luo @.> Date: Sat,May 14,2022 7:09 PM To: open-mmlab/mmdetection @.> Cc: GF1447571253 @.>, Author @.> Subject: Re: [open-mmlab/mmdetection] import custom model error (Issue #7983)

ConvNeXt is not support yet, #7281

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

GF1447571253 avatar May 14 '22 11:05 GF1447571253

Please check whether convnext exists on the sever and whether you use the expected the conda or pip environment.

chhluo avatar May 14 '22 14:05 chhluo

yes, I'm sure that i have check convnext on mmdetection/mmdet/models/backbones/ folders and conda envs is same whether pycharm or shell. image and i have tried to add the code below

custom_imports = dict(

imports=[

'mmdet.models.backbones._csp_darknet.py'

],

allow_failed_imports=False)

and it turns out (mmdet) sdxx@sdxx-Precision-5820-Tower:~/hgf/mmdetection$ python tools/train.py Traceback (most recent call last): File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/misc.py", line 73, in import_modules_from_strings imported_tmp = import_module(imp) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'convnext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 237, in main() File "tools/train.py", line 110, in main cfg = Config.fromfile(args.config) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/config.py", line 337, in fromfile import_modules_from_strings(**cfg_dict['custom_imports']) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/misc.py", line 80, in import_modules_from_strings raise ImportError ImportError it seems strange!

GF1447571253 avatar May 15 '22 08:05 GF1447571253

In the picture, the path is mmdet.models.backbones.csp_darknet.py, not mmdet.models.backbones._csp_darknet.py

chhluo avatar May 15 '22 08:05 chhluo

yes, i just want to show you convnext existing, _csp_darknet.py is in the bottom.

GF1447571253 avatar May 15 '22 08:05 GF1447571253

Please reinstall mmdet by pip install -v -e . in directory mmdetection.

chhluo avatar May 15 '22 12:05 chhluo

it not works

GF1447571253 avatar May 19 '22 01:05 GF1447571253

Please paste your config file and your env infomation when running in terminal. By the way, ConvNext is supported in mmclassification https://github.com/open-mmlab/mmclassification/tree/master/configs/convnext, you can directly used in mmdet

chhluo avatar May 19 '22 02:05 chhluo

I copied yolox_head.py and pasted in a new a python file named yolox_head_with_iou_aware.py in which the class name is YOLOXHead_. Similarly, I new a sim_ota_assigner.py in which the class name is SimOTAAssigner_. Thank for your help. (mmdet) sdxx@sdxx-Precision-5820-Tower:~/hgf/mmdetection$ pip install -v -e . Using pip 21.2.4 from /home/sdxx/.local/lib/python3.6/site-packages/pip (python 3.6) Defaulting to user installation because normal site-packages is not writeable Obtaining file:///home/sdxx/hgf/mmdetection Running command python setup.py egg_info running egg_info creating /tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info writing /tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/PKG-INFO writing dependency_links to /tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/dependency_links.txt writing requirements to /tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/requires.txt writing top-level names to /tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/top_level.txt writing manifest file '/tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/SOURCES.txt' reading manifest file '/tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'mmdet/VERSION' warning: no files found matching 'mmdet/.mim/demo//' adding license file 'LICENSE' writing manifest file '/tmp/pip-pip-egg-info-prd__y7y/mmdet.egg-info/SOURCES.txt' Requirement already satisfied: matplotlib in /home/sdxx/.local/lib/python3.6/site-packages (from mmdet==2.24.1) (3.3.4) Requirement already satisfied: numpy in /home/sdxx/.local/lib/python3.6/site-packages (from mmdet==2.24.1) (1.19.5) Requirement already satisfied: pycocotools in /home/sdxx/.local/lib/python3.6/site-packages (from mmdet==2.24.1) (2.0.4) Requirement already satisfied: six in /home/sdxx/.local/lib/python3.6/site-packages (from mmdet==2.24.1) (1.15.0) Requirement already satisfied: terminaltables in /home/sdxx/.local/lib/python3.6/site-packages (from mmdet==2.24.1) (3.1.10) Requirement already satisfied: cycler>=0.10 in /home/sdxx/.local/lib/python3.6/site-packages (from matplotlib->mmdet==2.24.1) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in /home/sdxx/.local/lib/python3.6/site-packages (from matplotlib->mmdet==2.24.1) (1.3.1) Requirement already satisfied: python-dateutil>=2.1 in /home/sdxx/.local/lib/python3.6/site-packages (from matplotlib->mmdet==2.24.1) (2.8.2) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/sdxx/.local/lib/python3.6/site-packages (from matplotlib->mmdet==2.24.1) (2.4.7) Requirement already satisfied: pillow>=6.2.0 in /home/sdxx/.local/lib/python3.6/site-packages (from matplotlib->mmdet==2.24.1) (8.3.2) Installing collected packages: mmdet Attempting uninstall: mmdet Found existing installation: mmdet 2.24.1 Uninstalling mmdet-2.24.1: Removing file or directory /home/sdxx/.local/lib/python3.6/site-packages/mmdet.egg-link Removing pth entries from /home/sdxx/.local/lib/python3.6/site-packages/easy-install.pth: Removing entry: /home/sdxx/hgf/mmdetection Successfully uninstalled mmdet-2.24.1 Running setup.py develop for mmdet Running command /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/sdxx/hgf/mmdetection/setup.py'"'"'; file='"'"'/home/sdxx/hgf/mmdetection/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps --user --prefix= running develop running egg_info writing mmdet.egg-info/PKG-INFO writing dependency_links to mmdet.egg-info/dependency_links.txt writing requirements to mmdet.egg-info/requires.txt writing top-level names to mmdet.egg-info/top_level.txt reading manifest file 'mmdet.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'mmdet/VERSION' warning: no files found matching 'mmdet/.mim/demo//' adding license file 'LICENSE' writing manifest file 'mmdet.egg-info/SOURCES.txt' running build_ext Creating /home/sdxx/.local/lib/python3.6/site-packages/mmdet.egg-link (link to .) Adding mmdet 2.24.1 to easy-install.pth file

Installed /home/sdxx/hgf/mmdetection

Successfully installed mmdet-2.24.1

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),)) - skipping (mmdet) sdxx@sdxx-Precision-5820-Tower:~/hgf/mmdetection$ (mmdet) sdxx@sdxx-Precision-5820-Tower:~/hgf/mmdetection$ python tools/train.py /home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/utils/setup_env.py:38: UserWarning: Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( /home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/utils/setup_env.py:48: UserWarning: Setting MKL_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. warnings.warn( 2022-05-19 09:28:01,205 - mmdet - INFO - Environment info:

sys.platform: linux Python: 3.8.13 (default, Mar 28 2022, 11:38:47) [GCC 7.5.0] CUDA available: True GPU 0: NVIDIA GeForce RTX 3090 CUDA_HOME: :/usr/local/cuda GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.8.0 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v1.7.0 (Git Hash 7aed236906b1f7a05c0917e5257a1af05e9ff683)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 11.1
  • 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_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_37,code=compute_37
  • CuDNN 8.0.5
  • Magma 2.5.2
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -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-psabi -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, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.0, USE_CUDA=ON, USE_CUDNN=ON, 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,

TorchVision: 0.9.0 OpenCV: 4.5.5 MMCV: 1.4.2 MMCV Compiler: GCC 7.3 MMCV CUDA Compiler: 11.1 MMDetection: 2.24.1+240d7a3

2022-05-19 09:28:01,435 - mmdet - INFO - Distributed training: False 2022-05-19 09:28:01,622 - mmdet - INFO - Config: optimizer = dict( type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005, nesterov=True, paramwise_cfg=dict(norm_decay_mult=0.0, bias_decay_mult=0.0)) optimizer_config = dict(grad_clip=None) lr_config = dict( policy='YOLOX', warmup='exp', by_epoch=False, warmup_by_epoch=True, warmup_ratio=1, warmup_iters=5, num_last_epochs=15, min_lr_ratio=0.05) runner = dict(type='EpochBasedRunner', max_epochs=100) checkpoint_config = dict(interval=10) log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')]) custom_hooks = [ dict(type='YOLOXModeSwitchHook', num_last_epochs=15, priority=48), dict(type='SyncNormHook', num_last_epochs=15, interval=10, priority=48), dict( type='ExpMomentumEMAHook', resume_from=None, momentum=0.0001, priority=49) ] dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] opencv_num_threads = 0 mp_start_method = 'fork' auto_scale_lr = dict(enable=False, base_batch_size=16) img_scale = (640, 640) model = dict( type='YOLOX', input_size=(640, 640), random_size_range=(15, 25), random_size_interval=10, backbone=dict(type='CSPDarknet', deepen_factor=0.33, widen_factor=0.5), neck=dict( type='YOLOXPAFPN', in_channels=[128, 256, 512], out_channels=128, num_csp_blocks=1), bbox_head=dict( type='YOLOXHead_', num_classes=80, in_channels=128, feat_channels=128), train_cfg=dict(assigner=dict(type='SimOTAAssigner_', center_radius=2.5)), test_cfg=dict(score_thr=0.01, nms=dict(type='nms', iou_threshold=0.65))) data_root = '/data/coco/' dataset_type = 'CocoDataset' train_pipeline = [ dict(type='Mosaic', img_scale=(640, 640), pad_val=114.0), dict( type='RandomAffine', scaling_ratio_range=(0.1, 2), border=(-320, -320)), dict( type='MixUp', img_scale=(640, 640), ratio_range=(0.8, 1.6), pad_val=114.0), dict(type='YOLOXHSVRandomAug'), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Resize', img_scale=(640, 640), keep_ratio=True), dict( type='Pad', pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict(type='FilterAnnotations', min_gt_bbox_wh=(1, 1), keep_empty=False), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ] train_dataset = dict( type='MultiImageMixDataset', dataset=dict( type='CocoDataset', ann_file='/data/coco/annotations/instances_train2017.json', img_prefix='/data/coco/images/train2017/', pipeline=[ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True) ], filter_empty_gt=False), pipeline=[ dict(type='Mosaic', img_scale=(640, 640), pad_val=114.0), dict( type='RandomAffine', scaling_ratio_range=(0.1, 2), border=(-320, -320)), dict( type='MixUp', img_scale=(640, 640), ratio_range=(0.8, 1.6), pad_val=114.0), dict(type='YOLOXHSVRandomAug'), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Resize', img_scale=(640, 640), keep_ratio=True), dict( type='Pad', pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict( type='FilterAnnotations', min_gt_bbox_wh=(1, 1), keep_empty=False), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ]) test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(640, 640), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Pad', pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img']) ]) ] data = dict( samples_per_gpu=16, workers_per_gpu=8, persistent_workers=True, train=dict( type='MultiImageMixDataset', dataset=dict( type='CocoDataset', ann_file='/data/coco/annotations/instances_train2017.json', img_prefix='/data/coco/images/train2017/', pipeline=[ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True) ], filter_empty_gt=False), pipeline=[ dict(type='Mosaic', img_scale=(640, 640), pad_val=114.0), dict( type='RandomAffine', scaling_ratio_range=(0.1, 2), border=(-320, -320)), dict( type='MixUp', img_scale=(640, 640), ratio_range=(0.8, 1.6), pad_val=114.0), dict(type='YOLOXHSVRandomAug'), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Resize', img_scale=(640, 640), keep_ratio=True), dict( type='Pad', pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict( type='FilterAnnotations', min_gt_bbox_wh=(1, 1), keep_empty=False), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']) ]), val=dict( type='CocoDataset', ann_file='/data/coco/annotations/instances_val2017.json', img_prefix='/data/coco/images/val2017/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(640, 640), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Pad', pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img']) ]) ]), test=dict( type='CocoDataset', ann_file='/data/coco/annotations/instances_val2017.json', img_prefix='/data/coco/images/val2017/', pipeline=[ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(640, 640), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict( type='Pad', pad_to_square=True, pad_val=dict(img=(114.0, 114.0, 114.0))), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img']) ]) ])) max_epochs = 100 num_last_epochs = 15 interval = 10 evaluation = dict( save_best='auto', interval=10, dynamic_intervals=[(85, 1)], metric='bbox') work_dir = './work_dirs/modified_yolox_s_1x16_100e_coco' auto_resume = False gpu_ids = [0]

2022-05-19 09:28:01,622 - mmdet - INFO - Set random seed to 839702807, deterministic: False Traceback (most recent call last): File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 52, in build_from_cfg return obj_cls(**args) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/detectors/yolox.py", line 58, in init super(YOLOX, self).init(backbone, neck, bbox_head, train_cfg, File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/detectors/single_stage.py", line 37, in init self.bbox_head = build_head(bbox_head) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/builder.py", line 40, in build_head return HEADS.build(cfg) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 44, in build_from_cfg raise KeyError( KeyError: 'YOLOXHead_ is not in the models registry'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 238, in main() File "tools/train.py", line 208, in main model = build_detector( File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmdet/models/builder.py", line 58, in build_detector return DETECTORS.build( File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 212, in build return self.build_func(*args, **kwargs, registry=self) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/cnn/builder.py", line 27, in build_model_from_cfg return build_from_cfg(cfg, registry, default_args) File "/home/sdxx/hgf/anaconda3/envs/mmdet/lib/python3.8/site-packages/mmcv/utils/registry.py", line 55, in build_from_cfg raise type(e)(f'{obj_cls.name}: {e}') KeyError: "YOLOX: 'YOLOXHead_ is not in the models registry'"

GF1447571253 avatar May 19 '22 02:05 GF1447571253

Did you add @HEAD.register_module() for YOLOXHead_ ? If not, please read https://mmdetection.readthedocs.io/en/latest/tutorials/customize_models.html

chhluo avatar May 19 '22 02:05 chhluo

yes, i did image image

GF1447571253 avatar May 19 '22 02:05 GF1447571253

It's strange that running is okay in pycharm which connected to the remote server, but failed in terminal. Running is okay in pycharm verifyed that your modifcation is correct. So is there any special setting in pycharm?

chhluo avatar May 21 '22 17:05 chhluo

I downloaded the mmdetection in my laptop and remote server respectively,and then I added a ssh interpreter. image image and I'm not done anything special in pycharm and all the modfication i've done in pycharm can be seen in the remote server(inlcuding new a python file, modify the code and so on)

GF1447571253 avatar May 22 '22 07:05 GF1447571253

hi, did you solve this problem? I met the same problem.

PandaHead2077 avatar Jun 13 '22 02:06 PandaHead2077

no

Sent from my iPhone

------------------ Original ------------------ From: cc @.> Date: Mon,Jun 13,2022 10:14 AM To: open-mmlab/mmdetection @.> Cc: GF1447571253 @.>, Author @.> Subject: Re: [open-mmlab/mmdetection] import custom model error (Issue #7983)

hi, did you solve this problem? I met the same problem.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

GF1447571253 avatar Jun 13 '22 02:06 GF1447571253

I designed a network structure name "SpinMLP" and configured it according to the documentation, but he got the same error:KeyError: 'SpinMLP is not in the models registry' image

Clichong avatar Sep 10 '22 09:09 Clichong

This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.

github-actions[bot] avatar Sep 17 '22 11:09 github-actions[bot]

This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.

github-actions[bot] avatar Sep 22 '22 11:09 github-actions[bot]