open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.62k stars 9.47k forks source link

KeyError: 'DINO is not in the model registry. Please check whether the value of `DINO` is correct or it was registered as expected. #9881

Closed crescentxxx closed 1 year ago

crescentxxx commented 1 year ago

I tried DINO in the 3.x branch, but got this error:

Traceback (most recent call last):
  File "/home/chiebot-cv/project/mmdet222/Orignal_mmdet/tools/train.py", line 124, in <module>
    main()
  File "/home/chiebot-cv/project/mmdet222/Orignal_mmdet/tools/train.py", line 113, in main
    runner = Runner.from_cfg(cfg)
  File "/home/chiebot-cv/anaconda3/envs/mmengine/lib/python3.9/site-packages/mmengine/runner/runner.py", line 431, in from_cfg
    runner = cls(
  File "/home/chiebot-cv/anaconda3/envs/mmengine/lib/python3.9/site-packages/mmengine/runner/runner.py", line 401, in __init__
    self.model = self.build_model(model)
  File "/home/chiebot-cv/anaconda3/envs/mmengine/lib/python3.9/site-packages/mmengine/runner/runner.py", line 794, in build_model
    model = MODELS.build(model)
  File "/home/chiebot-cv/anaconda3/envs/mmengine/lib/python3.9/site-packages/mmengine/registry/registry.py", line 421, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/chiebot-cv/anaconda3/envs/mmengine/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 240, in build_model_from_cfg
    return build_from_cfg(cfg, registry, default_args)
  File "/home/chiebot-cv/anaconda3/envs/mmengine/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg
    raise KeyError(
KeyError: 'DINO is not in the model registry. Please check whether the value of `DINO` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/tutorials/config.html#import-custom-python-modules'

which is very confusing, because I just switched to 3.x branch and did not change anything.

I used the following commands to create 3.x conda env:

conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
pip install -U openmim
mim install mmengine
mim install "mmcv>=2.0.0rc1"
git checkout 3.x
pip install -v -e .

And here is the version of some packages:

mmcv                      2.0.0rc4                 pypi_0    pypi
mmdet                     3.0.0rc6                  dev_0    <develop>
mmengine                  0.6.0                    pypi_0    pypi

pytorch                   1.12.1          py3.9_cuda11.3_cudnn8.3.2_0    pytorch
cudatoolkit               11.3.1               h2bc3f7f_2    defaults

Anyone knows what's wrong with it? Many thx.

crescentxxx commented 1 year ago

I tried the config file ssd300_voc0712.py, and have a similar error. This is the sysetm environment and config file :

System environment:
    sys.platform: linux
    Python: 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:58:50) [GCC 10.3.0]
    CUDA available: True
    numpy_random_seed: 688656251
    GPU 0,1,2,3: NVIDIA GeForce RTX 3090
    CUDA_HOME: /usr/local/cuda
    NVCC: Cuda compilation tools, release 11.2, V11.2.142
    GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
    PyTorch: 1.12.1
    PyTorch compiling details: PyTorch built with:
  - GCC 9.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 v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - LAPACK is enabled (usually provided by MKL)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 11.3
  - 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.3.2  (built against CUDA 11.5)
  - Magma 2.5.2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.3, CUDNN_VERSION=8.3.2, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -fabi-version=11 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -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 -Werror=cast-function-type -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.12.1, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, 

    TorchVision: 0.13.1
    OpenCV: 4.6.0
    MMEngine: 0.6.0

Runtime environment:
    cudnn_benchmark: False
    mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0}
    dist_cfg: {'backend': 'nccl'}
    seed: None
    Distributed launcher: none
    Distributed training: False
    GPU number: 1
------------------------------------------------------------

03/06 16:23:57 - mmengine - INFO - Config:
input_size = 300
model = dict(
    type='SingleStageDetector',
    data_preprocessor=dict(
        type='DetDataPreprocessor',
        mean=[123.675, 116.28, 103.53],
        std=[1, 1, 1],
        bgr_to_rgb=True,
        pad_size_divisor=1),
    backbone=dict(
        type='SSDVGG',
        depth=16,
        with_last_pool=False,
        ceil_mode=True,
        out_indices=(3, 4),
        out_feature_indices=(22, 34),
        init_cfg=dict(
            type='Pretrained', checkpoint='open-mmlab://vgg16_caffe')),
    neck=dict(
        type='SSDNeck',
        in_channels=(512, 1024),
        out_channels=(512, 1024, 512, 256, 256, 256),
        level_strides=(2, 2, 1, 1),
        level_paddings=(1, 1, 0, 0),
        l2_norm_scale=20),
    bbox_head=dict(
        type='SSDHead',
        in_channels=(512, 1024, 512, 256, 256, 256),
        num_classes=20,
        anchor_generator=dict(
            type='SSDAnchorGenerator',
            scale_major=False,
            input_size=300,
            basesize_ratio_range=(0.2, 0.9),
            strides=[8, 16, 32, 64, 100, 300],
            ratios=[[2], [2, 3], [2, 3], [2, 3], [2], [2]]),
        bbox_coder=dict(
            type='DeltaXYWHBBoxCoder',
            target_means=[0.0, 0.0, 0.0, 0.0],
            target_stds=[0.1, 0.1, 0.2, 0.2])),
    train_cfg=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.5,
            neg_iou_thr=0.5,
            min_pos_iou=0.0,
            ignore_iof_thr=-1,
            gt_max_assign_all=False),
        sampler=dict(type='PseudoSampler'),
        smoothl1_beta=1.0,
        allowed_border=-1,
        pos_weight=-1,
        neg_pos_ratio=3,
        debug=False),
    test_cfg=dict(
        nms_pre=1000,
        nms=dict(type='nms', iou_threshold=0.45),
        min_bbox_size=0,
        score_thr=0.02,
        max_per_img=200))
cudnn_benchmark = True
dataset_type = 'VOCDataset'
data_root = 'data/VOCdevkit/'
file_client_args = dict(backend='disk')
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(
        type='Expand',
        mean=[123.675, 116.28, 103.53],
        to_rgb=True,
        ratio_range=(1, 4)),
    dict(
        type='MinIoURandomCrop',
        min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
        min_crop_size=0.3),
    dict(type='Resize', scale=(300, 300), keep_ratio=False),
    dict(type='RandomFlip', prob=0.5),
    dict(
        type='PhotoMetricDistortion',
        brightness_delta=32,
        contrast_range=(0.5, 1.5),
        saturation_range=(0.5, 1.5),
        hue_delta=18),
    dict(type='PackDetInputs')
]
test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='Resize', scale=(300, 300), keep_ratio=False),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(
        type='PackDetInputs',
        meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
                   'scale_factor'))
]
train_dataloader = dict(
    batch_size=8,
    num_workers=3,
    persistent_workers=True,
    sampler=dict(type='DefaultSampler', shuffle=True),
    batch_sampler=dict(type='AspectRatioBatchSampler'),
    dataset=dict(
        type='RepeatDataset',
        times=10,
        dataset=dict(
            type='ConcatDataset',
            ignore_keys=['dataset_type'],
            datasets=[
                dict(
                    type='VOCDataset',
                    data_root='data/VOCdevkit/',
                    ann_file='VOC2007/ImageSets/Main/trainval.txt',
                    data_prefix=dict(sub_data_root='VOC2007/'),
                    filter_cfg=dict(filter_empty_gt=True, min_size=32),
                    pipeline=[
                        dict(type='LoadImageFromFile'),
                        dict(type='LoadAnnotations', with_bbox=True),
                        dict(
                            type='Expand',
                            mean=[123.675, 116.28, 103.53],
                            to_rgb=True,
                            ratio_range=(1, 4)),
                        dict(
                            type='MinIoURandomCrop',
                            min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
                            min_crop_size=0.3),
                        dict(
                            type='Resize', scale=(300, 300), keep_ratio=False),
                        dict(type='RandomFlip', prob=0.5),
                        dict(
                            type='PhotoMetricDistortion',
                            brightness_delta=32,
                            contrast_range=(0.5, 1.5),
                            saturation_range=(0.5, 1.5),
                            hue_delta=18),
                        dict(type='PackDetInputs')
                    ]),
                dict(
                    type='VOCDataset',
                    data_root='data/VOCdevkit/',
                    ann_file='VOC2012/ImageSets/Main/trainval.txt',
                    data_prefix=dict(sub_data_root='VOC2012/'),
                    filter_cfg=dict(filter_empty_gt=True, min_size=32),
                    pipeline=[
                        dict(type='LoadImageFromFile'),
                        dict(type='LoadAnnotations', with_bbox=True),
                        dict(
                            type='Expand',
                            mean=[123.675, 116.28, 103.53],
                            to_rgb=True,
                            ratio_range=(1, 4)),
                        dict(
                            type='MinIoURandomCrop',
                            min_ious=(0.1, 0.3, 0.5, 0.7, 0.9),
                            min_crop_size=0.3),
                        dict(
                            type='Resize', scale=(300, 300), keep_ratio=False),
                        dict(type='RandomFlip', prob=0.5),
                        dict(
                            type='PhotoMetricDistortion',
                            brightness_delta=32,
                            contrast_range=(0.5, 1.5),
                            saturation_range=(0.5, 1.5),
                            hue_delta=18),
                        dict(type='PackDetInputs')
                    ])
            ])))
val_dataloader = dict(
    batch_size=1,
    num_workers=2,
    persistent_workers=True,
    drop_last=False,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
        type='VOCDataset',
        data_root='data/VOCdevkit/',
        ann_file='VOC2007/ImageSets/Main/test.txt',
        data_prefix=dict(sub_data_root='VOC2007/'),
        test_mode=True,
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='Resize', scale=(300, 300), keep_ratio=False),
            dict(type='LoadAnnotations', with_bbox=True),
            dict(
                type='PackDetInputs',
                meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
                           'scale_factor'))
        ]))
test_dataloader = dict(
    batch_size=1,
    num_workers=2,
    persistent_workers=True,
    drop_last=False,
    sampler=dict(type='DefaultSampler', shuffle=False),
    dataset=dict(
        type='VOCDataset',
        data_root='data/VOCdevkit/',
        ann_file='VOC2007/ImageSets/Main/test.txt',
        data_prefix=dict(sub_data_root='VOC2007/'),
        test_mode=True,
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='Resize', scale=(300, 300), keep_ratio=False),
            dict(type='LoadAnnotations', with_bbox=True),
            dict(
                type='PackDetInputs',
                meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape',
                           'scale_factor'))
        ]))
val_evaluator = dict(type='VOCMetric', metric='mAP', eval_mode='11points')
test_evaluator = dict(type='VOCMetric', metric='mAP', eval_mode='11points')
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=24, val_interval=1)
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
param_scheduler = [
    dict(
        type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
    dict(
        type='MultiStepLR',
        begin=0,
        end=24,
        by_epoch=True,
        milestones=[16, 20],
        gamma=0.1)
]
optim_wrapper = dict(
    type='OptimWrapper',
    optimizer=dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0005))
auto_scale_lr = dict(enable=False, base_batch_size=64)
default_scope = 'mmdet'
default_hooks = dict(
    timer=dict(type='IterTimerHook'),
    logger=dict(type='LoggerHook', interval=50),
    param_scheduler=dict(type='ParamSchedulerHook'),
    checkpoint=dict(type='CheckpointHook', interval=1),
    sampler_seed=dict(type='DistSamplerSeedHook'),
    visualization=dict(type='DetVisualizationHook'))
env_cfg = dict(
    cudnn_benchmark=False,
    mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0),
    dist_cfg=dict(backend='nccl'))
vis_backends = [dict(type='LocalVisBackend')]
visualizer = dict(
    type='DetLocalVisualizer',
    vis_backends=[dict(type='LocalVisBackend')],
    name='visualizer')
log_processor = dict(type='LogProcessor', window_size=50, by_epoch=True)
log_level = 'INFO'
load_from = None
resume = False
custom_hooks = [
    dict(type='NumClassCheckHook'),
    dict(type='CheckInvalidLossHook', interval=50, priority='VERY_LOW')
]
launcher = 'none'
work_dir = './work_dirs/ssd300_voc0712'

This is the error:

03/06 16:23:57 - mmengine - WARNING - Failed to import mmdet.visualization, please check the location of the registry visualizer is correct.
Traceback (most recent call last):
  File "/home/chiebot-cv/project/mmdet222/Orignal_mmdet/tools/train.py", line 124, in <module>
    main()
  File "/home/chiebot-cv/project/mmdet222/Orignal_mmdet/tools/train.py", line 113, in main
    runner = Runner.from_cfg(cfg)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_v3/lib/python3.9/site-packages/mmengine/runner/runner.py", line 431, in from_cfg
    runner = cls(
  File "/home/chiebot-cv/anaconda3/envs/mmdet_v3/lib/python3.9/site-packages/mmengine/runner/runner.py", line 385, in __init__
    self.visualizer = self.build_visualizer(visualizer)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_v3/lib/python3.9/site-packages/mmengine/runner/runner.py", line 767, in build_visualizer
    return VISUALIZERS.build(visualizer)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_v3/lib/python3.9/site-packages/mmengine/registry/registry.py", line 548, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_v3/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg
    raise KeyError(
KeyError: 'DetLocalVisualizer is not in the visualizer registry. Please check whether the value of `DetLocalVisualizer` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'
k1dDing commented 1 year ago

I have a similar error too,after train.py. 03/08 20:11:52 - mmengine - WARNING - Failed to import mmdet.visualization, please check the location of the registry visualizer is correct. Traceback (most recent call last): File "tools/train.py", line 124, in main() File "tools/train.py", line 113, in main runner = Runner.from_cfg(cfg) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 431, in from_cfg runner = cls( File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 385, in init self.visualizer = self.build_visualizer(visualizer) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 767, in build_visualizer return VISUALIZERS.build(visualizer) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg raise KeyError( KeyError: 'DetLocalVisualizer is not in the visualizer registry. Please check whether the value of DetLocalVisualizer is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'

crescentxxx commented 1 year ago

I have a similar error too,after train.py. 03/08 20:11:52 - mmengine - WARNING - Failed to import mmdet.visualization, please check the location of the registry visualizer is correct. Traceback (most recent call last): File "tools/train.py", line 124, in main() File "tools/train.py", line 113, in main runner = Runner.from_cfg(cfg) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 431, in from_cfg runner = cls( File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 385, in init self.visualizer = self.build_visualizer(visualizer) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 767, in build_visualizer return VISUALIZERS.build(visualizer) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg raise KeyError( KeyError: 'DetLocalVisualizer is not in the visualizer registry. Please check whether the value of DetLocalVisualizer is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'

Did you solve this problem? I created a new conda env, and this error just disappeared. Then I write a new dataset, and a similar registry error occured.

crescentxxx commented 1 year ago

I unexpectedly solved this problem by creating a new environment, and then I writed a new dataset, but a new similar error occured.

  1. The dataset code is as follows:
from .xml_style import XMLDataset
from mmdet.registry import DATASETS

@DATASETS.register_module()
class ChiebotXmlDataset(XMLDataset):
    pass
  1. The __init__.py is as follows:
    
    # Copyright (c) OpenMMLab. All rights reserved.
    from .base_det_dataset import BaseDetDataset
    from .cityscapes import CityscapesDataset
    from .coco import CocoDataset
    from .coco_panoptic import CocoPanopticDataset
    from .crowdhuman import CrowdHumanDataset
    from .dataset_wrappers import MultiImageMixDataset
    from .deepfashion import DeepFashionDataset
    from .lvis import LVISDataset, LVISV1Dataset, LVISV05Dataset
    from .objects365 import Objects365V1Dataset, Objects365V2Dataset
    from .openimages import OpenImagesChallengeDataset, OpenImagesDataset
    from .samplers import (AspectRatioBatchSampler, ClassAwareSampler,
                       GroupMultiSourceSampler, MultiSourceSampler)
    from .utils import get_loading_pipeline
    from .voc import VOCDataset
    from .wider_face import WIDERFaceDataset
    from .xml_style import XMLDataset
    from .chiebot_xml import ChiebotXmlDataset

all = [ 'XMLDataset', 'CocoDataset', 'DeepFashionDataset', 'VOCDataset', 'CityscapesDataset', 'LVISDataset', 'LVISV05Dataset', 'LVISV1Dataset', 'WIDERFaceDataset', 'get_loading_pipeline', 'CocoPanopticDataset', 'MultiImageMixDataset', 'OpenImagesDataset', 'OpenImagesChallengeDataset', 'AspectRatioBatchSampler', 'ClassAwareSampler', 'MultiSourceSampler', 'GroupMultiSourceSampler', 'BaseDetDataset', 'CrowdHumanDataset', 'Objects365V1Dataset', 'Objects365V2Dataset', 'ChiebotXmlDataset' ]


3. The error is as follows:
```bash
 -------------------- 
Traceback (most recent call last):
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 121, in build_from_cfg
    obj = obj_cls(**args)  # type: ignore
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/runner/loops.py", line 43, in __init__
    super().__init__(runner, dataloader)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/runner/base_loop.py", line 26, in __init__
    self.dataloader = runner.build_dataloader(
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/runner/runner.py", line 1333, in build_dataloader
    dataset = DATASETS.build(dataset_cfg)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/registry/registry.py", line 548, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg
    raise KeyError(
KeyError: 'ChiebotXmlDataset is not in the dataset registry. Please check whether the value of `ChiebotXmlDataset` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/chiebot-cv/project/mmdet222/Orignal_mmdet/tools/train.py", line 124, in <module>
    main()
  File "/home/chiebot-cv/project/mmdet222/Orignal_mmdet/tools/train.py", line 120, in main
    runner.train()
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/runner/runner.py", line 1656, in train
    self._train_loop = self.build_train_loop(
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/runner/runner.py", line 1448, in build_train_loop
    loop = LOOPS.build(
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/registry/registry.py", line 548, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "/home/chiebot-cv/anaconda3/envs/mmdet_test/lib/python3.9/site-packages/mmengine/registry/build_functions.py", line 135, in build_from_cfg
    raise type(e)(
KeyError: "class `EpochBasedTrainLoop` in mmengine/runner/loops.py: 'ChiebotXmlDataset is not in the dataset registry. Please check whether the value of `ChiebotXmlDataset` is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module'"

Does anyone know what's wrong with it? Thanks a lot for your reply.

k1dDing commented 1 year ago

I have a similar error too,after train.py. 03/08 20:11:52 - mmengine - WARNING - Failed to import mmdet.visualization, please check the location of the registry visualizer is correct. Traceback (most recent call last): File "tools/train.py", line 124, in main() File "tools/train.py", line 113, in main runner = Runner.from_cfg(cfg) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 431, in from_cfg runner = cls( File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 385, in init self.visualizer = self.build_visualizer(visualizer) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/runner/runner.py", line 767, in build_visualizer return VISUALIZERS.build(visualizer) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/registry/registry.py", line 548, in build return self.build_func(cfg, *args, **kwargs, registry=self) File "/home/ding/.conda/envs/mm3/lib/python3.8/site-packages/mmengine/registry/build_functions.py", line 100, in build_from_cfg raise KeyError( KeyError: 'DetLocalVisualizer is not in the visualizer registry. Please check whether the value of DetLocalVisualizer is correct or it was registered as expected. More details can be found at https://mmengine.readthedocs.io/en/latest/advanced_tutorials/config.html#import-the-custom-module' I recreate a new env too ,and this issue disappeared. I write a new coco format dataset training normally. Did you solve this problem? I created a new conda env, and this error just disappeared. Then I write a new dataset, and a similar registry error occured.

I recreate a new env too ,and this issue disappeared. I write a new coco format dataset training normally.

fearless-pilgrim commented 3 days ago

I fix this problem by adding:

sys.path.append("path to your dino folders") import dinov2.eval.segmentation.models