open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.55k stars 1.21k forks source link

KeyError: 'NightDataset is not in the dataset registry. Please check whether the value of `NightDataset` 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'[Bug] #2360

Closed Get-it-right closed 1 year ago

Get-it-right commented 1 year ago

Prerequisite

Environment

OrderedDict([('sys.platform', 'linux'), ('Python', '3.8.16 (default, Mar 2 2023, 03:21:46) [GCC 11.2.0]'), ('CUDA available', True), ('numpy_random_seed', 2147483648), ('GPU 0', 'NVIDIA GeForce RTX 3090'), ('CUDA_HOME', '/usr/local/cuda'), ('NVCC', 'Cuda compilation tools, release 11.3, V11.3.109'), ('GCC', 'gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0'), ('PyTorch', '1.12.0+cu113'), ('PyTorch compiling details', 'PyTorch built with:\n - GCC 9.3\n - C++ Version: 201402\n - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v2.6.0 (Git Hash 52b5f107dd9cf10910aaa19cb47f3abf9b349815)\n - OpenMP 201511 (a.k.a. OpenMP 4.5)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - CUDA Runtime 11.3\n - 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_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\n - CuDNN 8.3.2 (built against CUDA 11.5)\n - Magma 2.5.2\n - 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= -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.0, 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, \n'), ('TorchVision', '0.13.0+cu113'), ('OpenCV', '4.7.0'), ('MMEngine', '0.7.3'), ('MMPose', '1.0.0+')])

mmcv 2.0.0 mmdet 3.0.0 mmengine 0.7.3 mmpose 1.0.0

Reproduces the problem - code sample

mmpose/mmpose/datasets/datasets/body/night_dataset.py

Copyright (c) OpenMMLab. All rights reserved.

from mmpose.registry import DATASETS from ..base import BaseCocoStyleDataset

@DATASETS.register_module(name='NightDataset') class NightDataset(BaseCocoStyleDataset): """COCO dataset for pose estimation.

"Microsoft COCO: Common Objects in Context", ECCV'2014.
...
"""

METAINFO: dict = dict(from_file='configs/_base_/datasets/night.py')

mmpose/mmpose/datasets/datasets/body/init.py

Copyright (c) OpenMMLab. All rights reserved.

from .aic_dataset import AicDataset from .coco_dataset import CocoDataset from .crowdpose_dataset import CrowdPoseDataset from .jhmdb_dataset import JhmdbDataset from .mhp_dataset import MhpDataset from .mpii_dataset import MpiiDataset from .mpii_trb_dataset import MpiiTrbDataset from .ochuman_dataset import OCHumanDataset from .posetrack18_dataset import PoseTrack18Dataset from .posetrack18_video_dataset import PoseTrack18VideoDataset from .night_dataset import NightDataset

all = [ 'CocoDataset', 'MpiiDataset', 'MpiiTrbDataset', 'AicDataset', 'CrowdPoseDataset', 'OCHumanDataset', 'MhpDataset', 'PoseTrack18Dataset', 'JhmdbDataset', 'PoseTrack18VideoDataset','NightDataset' ]

Reproduces the problem - command or script

python mmpose/tools/train.py mmpose/projects/rtmpose/rtmpose/body_2d_keypoint/rtmpose-t_8xb256-420e_coco-256x192.py --auto-scale-lr --show-dir night/model

Reproduces the problem - error message

KeyError: 'NightDataset is not in the dataset registry. Please check whether the value of NightDataset 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'

Additional information

No response

Tau-J commented 1 year ago

For customized contents, you need to install mmpose via pip install -e . or mim install -e .

Get-it-right commented 1 year ago

For customized contents, you need to install mmpose via pip install -e . or mim install -e .

thanks! I run again and have a new problem that "AssertionError: class NightDataset in mmpose/datasets/datasets/body/night_dataset.py: Annotation file does not exist", my dataset is a BaseCocoStyleDataset, does that mean I need to add functions like init?

Tau-J commented 1 year ago

Annotation file does not exist means the ann_file you set is inavailable

Get-it-right commented 1 year ago

Annotation file does not exist means the ann_file you set is inavailable

Thanks! Haha, I made a silly mistake. you are so helpful.