open-mmlab/mmsegmentation

Incorrect documentation for tutorial in Random mosaic Please update

Open

#2452 aperta il 31 dic 2022

Vedi su GitHub
 (1 commento) (2 reazioni) (1 assegnatario)Python (2386 fork)batch import
BacklogHigh Priority from Communityhelp wanted

Metriche repository

Star
 (6867 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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?

Guida contributor