open-mmlab / mmdetection

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

Get TypeError: __init__() got an unexpected keyword argument 'data_root' while using RepeatDataset #12007

Open Icecream-blue-sky opened 1 month ago

Icecream-blue-sky commented 1 month ago

If not use RepeatDataset, the training is normal:

train_dataloader = dict(
    pin_memory=True,
    dataset =  dict(
            type=dataset_type,
            metainfo=metainfo,
            data_root=data_root,
            ann_file='annotations/fractal_first_images_mini_train.json',
            data_prefix=dict(img='fractal_first_images_mini_train/'),
            filter_cfg=dict(filter_empty_gt=True, min_size=32),
            pipeline=train_pipeline,
            backend_args=backend_args)
    # dataset = repeat_dataset
    )

While using RepeatDataset, it raises the error: TypeError: init() got an unexpected keyword argument 'data_root':

repeat_dataset = dict(
        type='RepeatDataset',
        times=50,
        dataset=dict(
            _delete_=True,
            type=dataset_type,
            metainfo=metainfo,
            data_root=data_root,
            ann_file='annotations/fractal_first_images_mini_train.json',
            data_prefix=dict(img='fractal_first_images_mini_train/'),
            filter_cfg=dict(filter_empty_gt=True, min_size=32),
            pipeline=train_pipeline,
            backend_args=backend_args)
    )

train_dataloader = dict(
    pin_memory=True,
    # dataset =  dict(
    #         type=dataset_type,
    #         metainfo=metainfo,
    #         data_root=data_root,
    #         ann_file='annotations/fractal_first_images_mini_train.json',
    #         data_prefix=dict(img='fractal_first_images_mini_train/'),
    #         filter_cfg=dict(filter_empty_gt=True, min_size=32),
    #         pipeline=train_pipeline,
    #         backend_args=backend_args)
    dataset = repeat_dataset
    )

mmdet 3.3.0, mmcv 2.1.0, pytorch 2.4.1, cuda12.4, gpu H100 Why?