_base_ = [
    '../_base_/models/icnet_r50-d8.py',
    '../_base_/datasets/my_dataset_model.py',
    '../_base_/default_runtime.py',
    '../_base_/schedules/schedule_40k_check_4000.py',
]

norm_cfg = dict(
    type='BN',
)

crop_size = (832, 832)

data_preprocessor = dict(
    size=(832, 832),
    mean=[
        94.94709810464303,
        61.72942233949928,
        75.93763705236906,
    ],
    std=[
        44.005506081132594,
        42.69595666984776,
        44.99354156225523,
    ],
    bgr_to_rgb=False,
)

model = dict(
    backbone=dict(
        backbone_cfg=dict(
            depth=18,
            init_cfg=dict(
                type='Pretrained',
                checkpoint='./My_Local_Model/open_mmlab/resnet18_v1c.pth',
            ),
        ),
        layer_channels=(128, 512),
        norm_cfg=dict(
            type='BN',
        ),
        align_corners=True,
    ),
    data_preprocessor=dict(
        size=(832, 832),
        mean=[
            94.94709810464303,
            61.72942233949928,
            75.93763705236906,
        ],
        std=[
            44.005506081132594,
            42.69595666984776,
            44.99354156225523,
        ],
        bgr_to_rgb=False,
    ),
    decode_head=dict(
        num_classes=36,
        loss_decode=dict(
            type='DiceLoss',
            use_sigmoid=False,
            loss_weight=1.0,
        ),
        align_corners=True,
    ),
    auxiliary_head=[
        dict(
            type='FCNHead',
            in_channels=128,
            channels=128,
            num_convs=1,
            num_classes=36,
            in_index=0,
            norm_cfg=dict(
                type='SyncBN',
                requires_grad=True,
            ),
            concat_input=False,
            align_corners=True,
            loss_decode=dict(
                type='DiceLoss',
                use_sigmoid=False,
                loss_weight=0.4,
            ),
        ),
        dict(
            type='FCNHead',
            in_channels=128,
            channels=128,
            num_convs=1,
            num_classes=36,
            in_index=1,
            norm_cfg=dict(
                type='SyncBN',
                requires_grad=True,
            ),
            concat_input=False,
            align_corners=True,
            loss_decode=dict(
                type='DiceLoss',
                use_sigmoid=False,
                loss_weight=0.4,
            ),
        ),
    ],
)

test_cfg = dict(
    mode='slide',
    crop_size=(832, 832),
    stride=(554, 554),
)

optim_wrapper = dict(
    type='OptimWrapper',
    _delete_=True,
    optimizer=dict(
        type='AdamW',
        lr=0.0001,
        weight_decay=0.0005,
    ),
    clip_grad=dict(
        max_norm=1,
        norm_type=2,
    ),
)

param_scheduler = [
    dict(
        type='LinearLR',
        start_factor=1e-06,
        by_epoch=False,
        begin=0,
        end=1500,
    ),
    dict(
        type='PolyLR',
        power=0.9,
        begin=1500,
        end=40000,
        eta_min=1e-05,
        by_epoch=False,
    ),
]

