open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
8.3k stars 2.62k forks source link

class `ConcatDataset` in mmengine/dataset/dataset_wrapper.py: __init__() got an unexpected keyword argument 'pipeline' #3001

Closed xu19971109 closed 1 year ago

xu19971109 commented 1 year ago

If I just use one of my datasets, it can work. When I want to cat them and the mmseg always reports the error: class 'ConcatDataset' in mmengine/dataset/dataset_wrapper.py: __init__() got an unexpected keyword argument 'pipeline'

I try 2 configs files. One is:

dataset_A_train = dict(
    type='RepeatDataset',
    times=1,
    dataset=dict( 
        type=dataset_type,
        data_root=data_root,
        data_prefix=dict(
            img_path=cityscape_list, seg_map_path=cityscape_list),
        pipeline=train_pipeline
    )
)

dataset_B_train = dict(
    type='RepeatDataset',
    times=1,
    dataset=dict( 
        type=dataset_type,
        data_root=data_root,
        data_prefix=dict(
            img_path=cityscape_list_2, seg_map_path=cityscape_list_2),
        pipeline=train_pipeline
    )
)

concatenate_dataset = dict(
    type='ConcatDataset',
    datasets=[dataset_A_train, dataset_B_train])

train_dataloader = dict(
    batch_size=2,
    num_workers=2,
    persistent_workers=True,
    sampler=dict(type='InfiniteSampler', shuffle=True),
    dataset=dict(
        type='ConcatDataset',
        datasets=[dataset_A_train, dataset_B_train]))

The other is :

dataset_A_train = dict(
        type=dataset_type,
        data_root=data_root,
        data_prefix=dict(
            img_path=cityscape_list, seg_map_path=cityscape_list),
        pipeline=train_pipeline)

dataset_B_train = dict(
        type=dataset_type,
        data_root=data_root,
        data_prefix=dict(
            img_path=cityscape_list_2, seg_map_path=cityscape_list_2),
        pipeline=train_pipeline)

concatenate_dataset = dict(
    type='ConcatDataset',
    datasets=[dataset_A_train, dataset_B_train])

train_dataloader = dict(
    batch_size=2,
    num_workers=2,
    persistent_workers=True,
    sampler=dict(type='InfiniteSampler', shuffle=True),
    dataset=dict(
        type='ConcatDataset',
        datasets=[dataset_A_train, dataset_B_train]))

They all report the same error: class 'ConcatDataset' in mmengine/dataset/dataset_wrapper.py: __init__() got an unexpected keyword argument 'pipeline'

Do you have any examples about 'ConcatDataset'?

I found the api is image

How do I use the key 'pipeline' and other keys?

xu19971109 commented 1 year ago

image Will ’pipeline‘ be added by default in train_dataloader?

xu19971109 commented 1 year ago

Sorry, I found pidnet-s_2xb6-120k_1024x1024-cityscapes.py has set the pipeline itself. I deleted the pipeline in pidnet-s_2xb6-120k_1024x1024-cityscapes.py , it could load the image.