boostcampaitech3 / level2-object-detection-level2-cv-18

level2-object-detection-level2-cv-18 created by GitHub Classroom
1 stars 5 forks source link

mmdetection Albumentation 사용 #23

Open ed-kyu opened 2 years ago

ed-kyu commented 2 years ago

개요

mmdetection Albumentation 사용

내용

# Albumentation settings
albu_train_transforms = [
    dict(
    type='OneOf',
    transforms=[
        dict(type='Flip',p=1.0),
        dict(type='RandomRotate90',p=1.0)
    ],
    p=0.5),
    dict(type='RandomResizedCrop', height=1024, width=1024, scale=(0.5, 1.0), p=0.5),
    dict(type='RandomBrightnessContrast', brightness_limit=0.1, contrast_limit=0.15, p=0.5),
    dict(type='HueSaturationValue', hue_shift_limit=15, sat_shift_limit=25, val_shift_limit=10, p=0.5),
    dict(type='GaussNoise', p=0.3),
    dict(
    type='OneOf',
    transforms=[
        dict(type='Blur', p=1.0),
        dict(type='GaussianBlur', p=1.0),
        dict(type='MedianBlur', blur_limit=5, p=1.0),
        dict(type='MotionBlur', p=1.0)
    ], p=0.1
    )
]
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(type='Resize', img_scale=[(1333, 800), (1666, 1000)], keep_ratio=True),         
    dict(type='RandomFlip', flip_ratio=0.5),
    ############ albumentation ###################
    dict(
        type='Albu',
        transforms=albu_train_transforms, ########## `albu_train_transforms`
        bbox_params=dict(
            type='BboxParams',
            format='pascal_voc',
            label_fields=['gt_labels'],
            min_visibility=0.0,
            filter_lost_elements=True),
        keymap={
            'img': 'image',
            'gt_bboxes': 'bboxes'
        },
        update_pad_shape=False,
        skip_img_without_anno=True
        ),
    ################################################ 
    dict(type='Normalize', **img_norm_cfg),
    dict(type='Pad', size_divisor=32),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
]
kimkihoon0515 commented 2 years ago

감사합니다 참고하고 있습니다