Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] KeyError: 'MyDataset is not in the mmdet3d::dataset registry. #3039

Open
3 tasks done
Ljji opened this issue Sep 12, 2024 · 2 comments
Open
3 tasks done

[Bug] KeyError: 'MyDataset is not in the mmdet3d::dataset registry. #3039

Ljji opened this issue Sep 12, 2024 · 2 comments

Comments

@Ljji
Copy link

Ljji commented Sep 12, 2024

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmdetection3d

Environment

利用mmdetection3d官方文档中训练自己的数据集,但是数据集注册不上去

Reproduces the problem - code sample

import mmengine
import numpy as np

from mmdet3d.registry import DATASETS
from mmdet3d.structures import LiDARInstance3DBoxes
from .det3d_dataset import Det3DDataset

@DATASETS.register_module()
class MyDataset(Det3DDataset):

# 替换成自定义 pkl 信息文件里的所有类别
METAINFO = {
    'classes': ('Pedestrian', 'Cyclist', 'Car')
}

def parse_ann_info(self, info):
    """Process the `instances` in data info to `ann_info`.

    Args:
        info (dict): Data information of single data sample.

    Returns:
        dict: Annotation information consists of the following keys:

            - gt_bboxes_3d (:obj:`LiDARInstance3DBoxes`):
              3D ground truth bboxes.
            - gt_labels_3d (np.ndarray): Labels of ground truths.
    """
    ann_info = super().parse_ann_info(info)
    if ann_info is None:
        ann_info = dict()
        # 空实例
        ann_info['gt_bboxes_3d'] = np.zeros((0, 7), dtype=np.float32)
        ann_info['gt_labels_3d'] = np.zeros(0, dtype=np.int64)

    # 过滤掉没有在训练中使用的类别
    ann_info = self._remove_dontcare(ann_info)
    gt_bboxes_3d = LiDARInstance3DBoxes(ann_info['gt_bboxes_3d'])
    ann_info['gt_bboxes_3d'] = gt_bboxes_3d
    return ann_info

和int 里面也导入了,但还是一样

Copyright (c) OpenMMLab. All rights reserved.

from dataset_wrappers import CBGSDataset
from det3d_dataset import Det3DDataset
from kitti_dataset import KittiDataset
from lyft_dataset import LyftDataset
from my_dataset import MyDataset
from .nuscenes_dataset import NuScenesDataset

yapf: enable

from .s3dis_dataset import S3DISDataset, S3DISSegDataset
from .scannet_dataset import (ScanNetDataset, ScanNetInstanceSegDataset,
ScanNetSegDataset)
from .seg3d_dataset import Seg3DDataset
from .semantickitti_dataset import SemanticKittiDataset
from .sunrgbd_dataset import SUNRGBDDataset

yapf: disable

from .transforms import (AffineResize, BackgroundPointsFilter, GlobalAlignment,
GlobalRotScaleTrans, IndoorPatchPointSample,
IndoorPointSample, LoadAnnotations3D,
LoadPointsFromDict, LoadPointsFromFile,
LoadPointsFromMultiSweeps, NormalizePointsColor,
ObjectNameFilter, ObjectNoise, ObjectRangeFilter,
ObjectSample, PointSample, PointShuffle,
PointsRangeFilter, RandomDropPointsColor,
RandomFlip3D, RandomJitterPoints, RandomResize3D,
RandomShiftScale, Resize3D, VoxelBasedPointSampler)
from .utils import get_loading_pipeline
from .waymo_dataset import WaymoDataset

all = [
'KittiDataset', 'MyDataset','CBGSDataset', 'NuScenesDataset', 'LyftDataset',
'ObjectSample', 'RandomFlip3D', 'ObjectNoise', 'GlobalRotScaleTrans',
'PointShuffle', 'ObjectRangeFilter', 'PointsRangeFilter',
'LoadPointsFromFile', 'S3DISSegDataset', 'S3DISDataset',
'NormalizePointsColor', 'IndoorPatchPointSample', 'IndoorPointSample',
'PointSample', 'LoadAnnotations3D', 'GlobalAlignment', 'SUNRGBDDataset',
'ScanNetDataset', 'ScanNetSegDataset', 'ScanNetInstanceSegDataset',
'SemanticKittiDataset', 'Det3DDataset', 'Seg3DDataset',
'LoadPointsFromMultiSweeps', 'WaymoDataset', 'BackgroundPointsFilter',
'VoxelBasedPointSampler', 'get_loading_pipeline', 'RandomDropPointsColor',
'RandomJitterPoints', 'ObjectNameFilter', 'AffineResize',
'RandomShiftScale', 'LoadPointsFromDict', 'Resize3D', 'RandomResize3D',
]

Reproduces the problem - command or script

python tools/train.py configs/pointpillars/pointpillars_hv_secfpn_8xb6_custom.py

Reproduces the problem - error message

KeyError: 'MyDataset is not in the mmdet3d::dataset registry

Additional information

No response

@HHX0607
Copy link

HHX0607 commented Nov 14, 2024

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmdetection3d

Environment

利用mmdetection3d官方文档中训练自己的数据集,但是数据集注册不上去

Reproduces the problem - code sample

import mmengine import numpy as np

from mmdet3d.registry import DATASETS from mmdet3d.structures import LiDARInstance3DBoxes from .det3d_dataset import Det3DDataset

@DATASETS.register_module() class MyDataset(Det3DDataset):

# 替换成自定义 pkl 信息文件里的所有类别
METAINFO = {
    'classes': ('Pedestrian', 'Cyclist', 'Car')
}

def parse_ann_info(self, info):
    """Process the `instances` in data info to `ann_info`.

    Args:
        info (dict): Data information of single data sample.

    Returns:
        dict: Annotation information consists of the following keys:

            - gt_bboxes_3d (:obj:`LiDARInstance3DBoxes`):
              3D ground truth bboxes.
            - gt_labels_3d (np.ndarray): Labels of ground truths.
    """
    ann_info = super().parse_ann_info(info)
    if ann_info is None:
        ann_info = dict()
        # 空实例
        ann_info['gt_bboxes_3d'] = np.zeros((0, 7), dtype=np.float32)
        ann_info['gt_labels_3d'] = np.zeros(0, dtype=np.int64)

    # 过滤掉没有在训练中使用的类别
    ann_info = self._remove_dontcare(ann_info)
    gt_bboxes_3d = LiDARInstance3DBoxes(ann_info['gt_bboxes_3d'])
    ann_info['gt_bboxes_3d'] = gt_bboxes_3d
    return ann_info

和int 里面也导入了,但还是一样

Copyright (c) OpenMMLab. All rights reserved.

from dataset_wrappers import CBGSDataset from det3d_dataset import Det3DDataset from kitti_dataset import KittiDataset from lyft_dataset import LyftDataset from my_dataset import MyDataset from .nuscenes_dataset import NuScenesDataset

yapf: enable

from .s3dis_dataset import S3DISDataset, S3DISSegDataset from .scannet_dataset import (ScanNetDataset, ScanNetInstanceSegDataset, ScanNetSegDataset) from .seg3d_dataset import Seg3DDataset from .semantickitti_dataset import SemanticKittiDataset from .sunrgbd_dataset import SUNRGBDDataset

yapf: disable

from .transforms import (AffineResize, BackgroundPointsFilter, GlobalAlignment, GlobalRotScaleTrans, IndoorPatchPointSample, IndoorPointSample, LoadAnnotations3D, LoadPointsFromDict, LoadPointsFromFile, LoadPointsFromMultiSweeps, NormalizePointsColor, ObjectNameFilter, ObjectNoise, ObjectRangeFilter, ObjectSample, PointSample, PointShuffle, PointsRangeFilter, RandomDropPointsColor, RandomFlip3D, RandomJitterPoints, RandomResize3D, RandomShiftScale, Resize3D, VoxelBasedPointSampler) from .utils import get_loading_pipeline from .waymo_dataset import WaymoDataset

all = [ 'KittiDataset', 'MyDataset','CBGSDataset', 'NuScenesDataset', 'LyftDataset', 'ObjectSample', 'RandomFlip3D', 'ObjectNoise', 'GlobalRotScaleTrans', 'PointShuffle', 'ObjectRangeFilter', 'PointsRangeFilter', 'LoadPointsFromFile', 'S3DISSegDataset', 'S3DISDataset', 'NormalizePointsColor', 'IndoorPatchPointSample', 'IndoorPointSample', 'PointSample', 'LoadAnnotations3D', 'GlobalAlignment', 'SUNRGBDDataset', 'ScanNetDataset', 'ScanNetSegDataset', 'ScanNetInstanceSegDataset', 'SemanticKittiDataset', 'Det3DDataset', 'Seg3DDataset', 'LoadPointsFromMultiSweeps', 'WaymoDataset', 'BackgroundPointsFilter', 'VoxelBasedPointSampler', 'get_loading_pipeline', 'RandomDropPointsColor', 'RandomJitterPoints', 'ObjectNameFilter', 'AffineResize', 'RandomShiftScale', 'LoadPointsFromDict', 'Resize3D', 'RandomResize3D', ]

Reproduces the problem - command or script

python tools/train.py configs/pointpillars/pointpillars_hv_secfpn_8xb6_custom.py

Reproduces the problem - error message

KeyError: 'MyDataset is not in the mmdet3d::dataset registry

Additional information

No response

@Ljji 同样的问题,请问解决了吗

@Ljji
Copy link
Author

Ljji commented Nov 14, 2024

直接在执行文件里注册,把代码粘贴过去

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants