open-mmlab/mmsegmentation

Incorrect documentation for tutorial in Random mosaic Please update

Open

#2,452 建立於 2022年12月31日

在 GitHub 查看
 (1 留言) (2 反應) (1 負責人)Python (2,386 fork)batch import
BacklogHigh Priority from Communityhelp wanted

倉庫指標

Star
 (6,867 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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?

貢獻者指南