|
norm_cfg = dict(type='SyncBN', requires_grad=True) |
|
model = dict( |
|
type='EncoderDecoder', |
|
pretrained='open-mmlab://resnet50_v1c', |
|
backbone=dict( |
|
type='ResNetV1c', |
|
depth=50, |
|
num_stages=4, |
|
out_indices=(0, 1, 2, 3), |
|
dilations=(1, 1, 1, 1), |
|
strides=(1, 2, 2, 2), |
|
norm_cfg=dict(type='SyncBN', requires_grad=True), |
|
norm_eval=False, |
|
style='pytorch', |
|
contract_dilation=True), |
|
neck=dict( |
|
type='FPN', |
|
in_channels=[256, 512, 1024, 2048], |
|
out_channels=256, |
|
num_outs=4), |
|
decode_head=dict( |
|
type='FPNHead', |
|
in_channels=[256, 256, 256, 256], |
|
in_index=[0, 1, 2, 3], |
|
feature_strides=[4, 8, 16, 32], |
|
channels=128, |
|
dropout_ratio=0.1, |
|
num_classes=104, |
|
norm_cfg=dict(type='SyncBN', requires_grad=True), |
|
align_corners=False, |
|
loss_decode=dict( |
|
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), |
|
train_cfg=dict(), |
|
test_cfg=dict(mode='whole')) |
|
dataset_type = 'CustomDataset' |
|
data_root = './data/FoodSeg103/Images/' |
|
img_norm_cfg = dict( |
|
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) |
|
crop_size = (512, 1024) |
|
train_pipeline = [ |
|
dict(type='LoadImageFromFile'), |
|
dict(type='LoadAnnotations'), |
|
dict(type='Resize', img_scale=(2048, 1024), ratio_range=(0.5, 2.0)), |
|
dict(type='RandomCrop', crop_size=(512, 1024), cat_max_ratio=0.75), |
|
dict(type='RandomFlip', prob=0.5), |
|
dict(type='PhotoMetricDistortion'), |
|
dict( |
|
type='Normalize', |
|
mean=[123.675, 116.28, 103.53], |
|
std=[58.395, 57.12, 57.375], |
|
to_rgb=True), |
|
dict(type='Pad', size=(512, 1024), pad_val=0, seg_pad_val=255), |
|
dict(type='DefaultFormatBundle'), |
|
dict(type='Collect', keys=['img', 'gt_semantic_seg']) |
|
] |
|
test_pipeline = [ |
|
dict(type='LoadImageFromFile'), |
|
dict( |
|
type='MultiScaleFlipAug', |
|
img_scale=(2048, 1024), |
|
flip=False, |
|
transforms=[ |
|
dict(type='Resize', keep_ratio=True), |
|
dict(type='RandomFlip'), |
|
dict( |
|
type='Normalize', |
|
mean=[123.675, 116.28, 103.53], |
|
std=[58.395, 57.12, 57.375], |
|
to_rgb=True), |
|
dict(type='ImageToTensor', keys=['img']), |
|
dict(type='Collect', keys=['img']) |
|
]) |
|
] |
|
data = dict( |
|
samples_per_gpu=2, |
|
workers_per_gpu=2, |
|
train=dict( |
|
type='CustomDataset', |
|
data_root='./data/FoodSeg103/Images/', |
|
img_dir='img_dir/train', |
|
ann_dir='ann_dir/train', |
|
pipeline=[ |
|
dict(type='LoadImageFromFile'), |
|
dict(type='LoadAnnotations'), |
|
dict( |
|
type='Resize', img_scale=(2048, 1024), ratio_range=(0.5, 2.0)), |
|
dict(type='RandomCrop', crop_size=(512, 1024), cat_max_ratio=0.75), |
|
dict(type='RandomFlip', prob=0.5), |
|
dict(type='PhotoMetricDistortion'), |
|
dict( |
|
type='Normalize', |
|
mean=[123.675, 116.28, 103.53], |
|
std=[58.395, 57.12, 57.375], |
|
to_rgb=True), |
|
dict(type='Pad', size=(512, 1024), pad_val=0, seg_pad_val=255), |
|
dict(type='DefaultFormatBundle'), |
|
dict(type='Collect', keys=['img', 'gt_semantic_seg']) |
|
]), |
|
val=dict( |
|
type='CustomDataset', |
|
data_root='./data/FoodSeg103/Images/', |
|
img_dir='img_dir/test', |
|
ann_dir='ann_dir/test', |
|
pipeline=[ |
|
dict(type='LoadImageFromFile'), |
|
dict( |
|
type='MultiScaleFlipAug', |
|
img_scale=(2048, 1024), |
|
flip=False, |
|
transforms=[ |
|
dict(type='Resize', keep_ratio=True), |
|
dict(type='RandomFlip'), |
|
dict( |
|
type='Normalize', |
|
mean=[123.675, 116.28, 103.53], |
|
std=[58.395, 57.12, 57.375], |
|
to_rgb=True), |
|
dict(type='ImageToTensor', keys=['img']), |
|
dict(type='Collect', keys=['img']) |
|
]) |
|
]), |
|
test=dict( |
|
type='CustomDataset', |
|
data_root='./data/FoodSeg103/Images/', |
|
img_dir='img_dir/test', |
|
ann_dir='ann_dir/test', |
|
pipeline=[ |
|
dict(type='LoadImageFromFile'), |
|
dict( |
|
type='MultiScaleFlipAug', |
|
img_scale=(2048, 1024), |
|
flip=False, |
|
transforms=[ |
|
dict(type='Resize', keep_ratio=True), |
|
dict(type='RandomFlip'), |
|
dict( |
|
type='Normalize', |
|
mean=[123.675, 116.28, 103.53], |
|
std=[58.395, 57.12, 57.375], |
|
to_rgb=True), |
|
dict(type='ImageToTensor', keys=['img']), |
|
dict(type='Collect', keys=['img']) |
|
]) |
|
])) |
|
log_config = dict( |
|
interval=50, hooks=[dict(type='TextLoggerHook', by_epoch=False)]) |
|
dist_params = dict(backend='nccl') |
|
log_level = 'INFO' |
|
load_from = None |
|
resume_from = None |
|
workflow = [('train', 1)] |
|
cudnn_benchmark = True |
|
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005) |
|
optimizer_config = dict() |
|
lr_config = dict(policy='poly', power=0.9, min_lr=0.0001, by_epoch=False) |
|
runner = dict(type='IterBasedRunner', max_iters=80000) |
|
checkpoint_config = dict(by_epoch=False, interval=4000) |
|
evaluation = dict(interval=4000, metric='mIoU') |
|
work_dir = 'checkpoints/r50_fpn' |
|
gpu_ids = range(0, 1) |
|
|