69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
_base_ = [
|
|
'../_base_/models/fcn_hr18.py', '../_base_/datasets/pascal_context.py',
|
|
'../_base_/default_runtime.py'
|
|
]
|
|
model = dict(
|
|
pretrained='pretrain_model/hrnetv2_w48-d2186c55.pth',
|
|
backbone=dict(
|
|
extra=dict(
|
|
stage2=dict(num_channels=(48, 96)),
|
|
stage3=dict(num_channels=(48, 96, 192)),
|
|
stage4=dict(num_channels=(48, 96, 192, 384)))),
|
|
decode_head=dict(
|
|
num_classes=60,
|
|
in_channels=[48, 96, 192, 384],
|
|
channels=sum([48, 96, 192, 384])))
|
|
crop_size = (480, 480)
|
|
cudnn_benchmark = True
|
|
# model training and testing settings
|
|
train_cfg = dict()
|
|
test_cfg = dict(mode='whole')
|
|
|
|
img_norm_cfg = dict(
|
|
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
|
train_pipeline = [
|
|
dict(type='LoadImageFromFile'),
|
|
dict(type='LoadAnnotations', with_seg=True),
|
|
dict(type='Resize', img_scale=(520, 520), ratio_range=(0.5, 2.0)),
|
|
dict(type='RandomFlip', flip_ratio=0.5),
|
|
dict(type='Normalize', **img_norm_cfg),
|
|
dict(type='RandomCrop', crop_size=crop_size),
|
|
dict(type='DefaultFormatBundle'),
|
|
dict(type='Collect', keys=['img', 'gt_semantic_seg']),
|
|
]
|
|
test_pipeline = [
|
|
dict(type='LoadImageFromFile'),
|
|
dict(
|
|
type='MultiScaleFlipAug',
|
|
img_scale=(480, 480),
|
|
img_ratios=[0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0],
|
|
flip=True,
|
|
transforms=[
|
|
dict(type='Resize', keep_ratio=True),
|
|
dict(type='RandomFlip'),
|
|
dict(type='Normalize', **img_norm_cfg),
|
|
dict(type='ImageToTensor', keys=['img']),
|
|
dict(type='Collect', keys=['img']),
|
|
])
|
|
]
|
|
data = dict(
|
|
samples_per_gpu=4,
|
|
workers_per_gpu=4,
|
|
train=dict(pipeline=train_pipeline),
|
|
val=dict(pipeline=test_pipeline),
|
|
test=dict(pipeline=test_pipeline))
|
|
|
|
# optimizer
|
|
optimizer = dict(type='SGD', lr=0.04, momentum=0.9, weight_decay=0.0001)
|
|
optimizer_config = dict()
|
|
# learning policy
|
|
lr_config = dict(
|
|
policy='poly',
|
|
power=0.9,
|
|
by_epoch=False,
|
|
)
|
|
# runtime settings
|
|
total_epochs = 200
|
|
evaluation = dict(interval=11, metric='mIoU')
|
|
checkpoint_config = dict(interval=10)
|