open-mmlab / mmsegmentation

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

Incorrect documentation for tutorial in Random mosaic Please update #2452

Open Cli98 opened 1 year ago

Cli98 commented 1 year ago

Here I want to report for the incorrect documentation for tutorial in Random mosaic

The official documentation for Random mosaic is at here https://mmsegmentation.readthedocs.io/en/latest/tutorials/customize_datasets.html#multi-image-mix-dataset

where the document provides an example for random mosaic usage:


train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='LoadAnnotations'),
    dict(type='RandomMosaic', prob=1),
    dict(type='Resize', img_scale=(1024, 512), keep_ratio=True),
    dict(type='RandomFlip', prob=0.5),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_semantic_seg']),
]

train_dataset = dict(
    type='MultiImageMixDataset',
    dataset=dict(
        classes=classes,
        palette=palette,
        type=dataset_type,
        reduce_zero_label=False,
        img_dir=data_root + "images/train",
        ann_dir=data_root + "annotations/train",
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(type='LoadAnnotations'),
        ]
    ),
    pipeline=train_pipeline
)

However, the usage is not correct. Because it calls

dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations'),

twice, which totally mess up the augmentation. The resulting segmentation got another augmentation in top left ceil of returned mask.

To correct, remove either one function call of

dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations'),

could be enough.

Similar errors show up in issue #1207 https://github.com/open-mmlab/mmsegmentation/issues/1207

@MengzhangLI Can you guys investigate?

MeowZheng commented 1 year ago

Thank you for pointing that out. we are working on fix it