mirror of https://github.com/alibaba/EasyCV.git
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
_base_ = './segformer_b0_coco.py'
|
|
|
|
model = dict(
|
|
pretrained=
|
|
'https://download.openmmlab.com/mmsegmentation/v0.5/pretrain/segformer/mit_b5_20220624-658746d9.pth',
|
|
backbone=dict(
|
|
embed_dims=64,
|
|
num_layers=[3, 6, 40, 3],
|
|
),
|
|
decode_head=dict(
|
|
in_channels=[64, 128, 320, 512],
|
|
channels=768,
|
|
),
|
|
)
|
|
|
|
img_norm_cfg = dict(
|
|
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
|
crop_size = (640, 640)
|
|
train_pipeline = [
|
|
dict(type='MMResize', img_scale=(2048, 640), ratio_range=(0.5, 2.0)),
|
|
dict(type='SegRandomCrop', crop_size=crop_size, cat_max_ratio=0.75),
|
|
dict(type='MMRandomFlip', flip_ratio=0.5),
|
|
dict(type='MMPhotoMetricDistortion'),
|
|
dict(type='MMNormalize', **img_norm_cfg),
|
|
dict(type='MMPad', size=crop_size, pad_val=dict(img=0, masks=0, seg=255)),
|
|
dict(type='DefaultFormatBundle'),
|
|
dict(
|
|
type='Collect',
|
|
keys=['img', 'gt_semantic_seg'],
|
|
meta_keys=('filename', 'ori_filename', 'ori_shape', 'img_shape',
|
|
'pad_shape', 'scale_factor', 'flip', 'flip_direction',
|
|
'img_norm_cfg')),
|
|
]
|
|
test_pipeline = [
|
|
dict(
|
|
type='MMMultiScaleFlipAug',
|
|
img_scale=(2048, 640),
|
|
# img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75],
|
|
flip=False,
|
|
transforms=[
|
|
dict(type='MMResize', keep_ratio=True),
|
|
dict(type='MMRandomFlip'),
|
|
dict(type='MMNormalize', **img_norm_cfg),
|
|
dict(type='ImageToTensor', keys=['img']),
|
|
dict(
|
|
type='Collect',
|
|
keys=['img'],
|
|
meta_keys=('filename', 'ori_filename', 'ori_shape',
|
|
'img_shape', 'pad_shape', 'scale_factor', 'flip',
|
|
'flip_direction', 'img_norm_cfg')),
|
|
])
|
|
]
|