open-mmlab/mmsegmentation

Incorrect documentation for tutorial in Random mosaic Please update

Open

#2,452 opened on Dec 31, 2022

View on GitHub
 (1 comment) (2 reactions) (1 assignee)Python (2,386 forks)batch import
BacklogHigh Priority from Communityhelp wanted

Repository metrics

Stars
 (6,867 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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?

Contributor guide