|
norm_cfg = dict(type='SyncBN', requires_grad=True) |
|
model = dict( |
|
type='EncoderDecoder', |
|
backbone=dict( |
|
type='VIT_MLA', |
|
model_name='vit_large_patch16_384', |
|
img_size=768, |
|
patch_size=16, |
|
in_chans=3, |
|
embed_dim=1024, |
|
depth=24, |
|
num_heads=16, |
|
num_classes=19, |
|
drop_rate=0.0, |
|
norm_cfg=dict(type='SyncBN', requires_grad=True), |
|
pos_embed_interp=True, |
|
align_corners=False, |
|
mla_channels=256, |
|
mla_index=(5, 11, 17, 23)), |
|
decode_head=dict( |
|
type='VIT_MLAHead', |
|
in_channels=1024, |
|
channels=512, |
|
img_size=768, |
|
mla_channels=256, |
|
mlahead_channels=128, |
|
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)), |
|
auxiliary_head=[ |
|
dict( |
|
type='VIT_MLA_AUXIHead', |
|
in_channels=256, |
|
channels=512, |
|
in_index=0, |
|
img_size=768, |
|
num_classes=104, |
|
align_corners=False, |
|
loss_decode=dict( |
|
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), |
|
dict( |
|
type='VIT_MLA_AUXIHead', |
|
in_channels=256, |
|
channels=512, |
|
in_index=1, |
|
img_size=768, |
|
num_classes=104, |
|
align_corners=False, |
|
loss_decode=dict( |
|
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), |
|
dict( |
|
type='VIT_MLA_AUXIHead', |
|
in_channels=256, |
|
channels=512, |
|
in_index=2, |
|
img_size=768, |
|
num_classes=104, |
|
align_corners=False, |
|
loss_decode=dict( |
|
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), |
|
dict( |
|
type='VIT_MLA_AUXIHead', |
|
in_channels=256, |
|
channels=512, |
|
in_index=3, |
|
img_size=768, |
|
num_classes=104, |
|
align_corners=False, |
|
loss_decode=dict( |
|
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)) |
|
]) |
|
train_cfg = dict() |
|
test_cfg = dict(mode='slide', crop_size=(768, 768), stride=(512, 512)) |
|
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 = (768, 768) |
|
train_pipeline = [ |
|
dict(type='LoadImageFromFile'), |
|
dict(type='LoadAnnotations'), |
|
dict(type='Resize', img_scale=(2049, 1025), ratio_range=(0.5, 2.0)), |
|
dict(type='RandomCrop', crop_size=(768, 768), 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=(768, 768), 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=(2049, 1025), |
|
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=1, |
|
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=(2049, 1025), ratio_range=(0.5, 2.0)), |
|
dict(type='RandomCrop', crop_size=(768, 768), 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=(768, 768), 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=(2049, 1025), |
|
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=(2049, 1025), |
|
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.002, |
|
momentum=0.9, |
|
weight_decay=0.0, |
|
paramwise_cfg=dict(custom_keys=dict(head=dict(lr_mult=10.0)))) |
|
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=80000, metric='mIoU') |
|
find_unused_parameters = True |
|
work_dir = 'checkpoints/setr_mla_large_384/' |
|
gpu_ids = range(0, 1) |
|
|