zhyever / Monocular-Depth-Estimation-Toolbox

Monocular Depth Estimation Toolbox based on MMSegmentation.
Apache License 2.0
908 stars 105 forks source link

KeyError: 'CustomDepthDataset is already registered in dataset' #91

Open firaterdem opened 1 year ago

firaterdem commented 1 year ago

I am getting this error while implementing the code for the custom dataset. How can I solve it?

(MDE) D:\FIRAT\Güncel\Postdoc_2218\Process\Monocular-Depth-Estimation-Toolbox-main>python tools/train.py tools/depth/datasets/custom.py Traceback (most recent call last): File "tools/train.py", line 168, in <module> main() File "tools/train.py", line 67, in main cfg = Config.fromfile(args.config) File "C:\Users\firat\anaconda3\envs\MDE\lib\site-packages\mmcv\utils\config.py", line 335, in fromfile use_predefined_variables) File "C:\Users\firat\anaconda3\envs\MDE\lib\site-packages\mmcv\utils\config.py", line 206, in _file2dict mod = import_module(temp_module_name) File "C:\Users\firat\anaconda3\envs\MDE\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "C:\Users\firat\AppData\Local\Temp\tmp396gff_i\tmpei0oe1p3.py", line 27, in <module> File "C:\Users\firat\anaconda3\envs\MDE\lib\site-packages\mmcv\utils\registry.py", line 313, in _register module_class=cls, module_name=name, force=force) File "C:\Users\firat\anaconda3\envs\MDE\lib\site-packages\mmcv\utils\registry.py", line 246, in _register_module raise KeyError(f'{name} is already registered ' KeyError: 'CustomDepthDataset is already registered in dataset'

I am using tools/depth/datasets/custom.py as a config file. Also, my folder structure is as follows:

data/custom/train/depth data/custom/train/rgb data/custom/val/depth data/custom/val/rgb

zhyever commented 1 year ago

That could be something related to 'https://github.com/zhyever/Monocular-Depth-Estimation-Toolbox/blob/main/depth/datasets/custom.py'. If you def a new CustomDepthDataset class, there could be such a error thrown out, because the CustomDepthDataset has already been registered in this file.