# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
data_preprocessor = dict(
    type='SegDataPreProcessor',
    mean=[123.675, 116.28, 103.53],
    std=[58.395, 57.12, 57.375],
    bgr_to_rgb=True,
    pad_val=0,
    seg_pad_val=255)
model = dict(
    type='EncoderDecoder',
    data_preprocessor=data_preprocessor,
    pretrained='open-mmlab://resnet50_v1c', # 'open-mmlab://resnet18_v1c', 'open-mmlab://resnet50_v1c' 'open-mmlab://resnet101_v1c'
    backbone=dict(
        type='ResNetV1c',
        depth=50, # 18, 50, 101, 
        num_stages=4,
        dilations=(1, 1, 2, 4),
        strides=(1, 2, 2, 2),
        out_indices=(1, 2, 3),
        norm_cfg=norm_cfg,
        norm_eval=False,
        style='pytorch',
        contract_dilation=True),
    neck=dict(
        type='JPU',
        in_channels=(512, 1024, 2048), # (128, 256, 512), (512, 1024, 2048), (512, 1024, 2048)
        mid_channels=512, # 128, 512, 512
        start_level=0,
        end_level=-1,
        dilations=(1, 2, 4, 8),
        align_corners=False,
        norm_cfg=norm_cfg),
    decode_head=dict(
        type='PSPHead',
        in_channels=2048, # 512, 2048, 2048
        in_index=2,
        channels=512, # 128, 512, 512
        pool_scales=(1, 2, 3, 6),
        dropout_ratio=0.1,
        num_classes=19,
        norm_cfg=norm_cfg,
        align_corners=False,
        loss_decode=dict(
            type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)),
    auxiliary_head=dict(
        type='FCNHead',
        in_channels=1024, # 256, 1024, 1024
        in_index=1,
        channels=256, # 64, 256, 256
        num_convs=1,
        concat_input=False,
        dropout_ratio=0.1,
        num_classes=19,
        norm_cfg=norm_cfg,
        align_corners=False,
        loss_decode=dict(
            type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)),
    # model training and testing settings
    train_cfg=dict(),
    test_cfg=dict(mode='whole'))
