_base_ = [
    '../_base_/models/upernet_mae.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 = (512, 512)

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

model = dict(
    backbone=dict(
        type='MAE',
        img_size=(512, 512),
        init_values=1.0,
    ),
    data_preprocessor=dict(
        size=(512, 512),
        mean=[
            94.94709810464303,
            61.72942233949928,
            75.93763705236906,
        ],
        std=[
            44.005506081132594,
            42.69595666984776,
            44.99354156225523,
        ],
        bgr_to_rgb=False,
    ),
    pretrained='./My_Local_Model/pretrain/mae_pretrain_vit_base_mmcls.pth',
    decode_head=dict(
        in_channels=[
            768,
            768,
            768,
            768,
        ],
        channels=768,
        num_classes=36,
        norm_cfg=dict(
            type='BN',
        ),
        loss_decode=dict(
            type='DiceLoss',
            use_sigmoid=False,
            loss_weight=1.0,
        ),
    ),
    neck=dict(
        embed_dim=768,
        rescales=[
            4,
            2,
            1,
            0.5,
        ],
    ),
    auxiliary_head=dict(
        in_channels=768,
        norm_cfg=dict(
            type='BN',
        ),
        num_classes=36,
        loss_decode=dict(
            type='DiceLoss',
            use_sigmoid=False,
            loss_weight=0.4,
        ),
    ),
    test_cfg=dict(
        mode='slide',
        crop_size=(512, 512),
        stride=(341, 341),
    ),
)

fp16 = dict(
    loss_scale='dynamic',
)

optim_wrapper = dict(
    _delete_=True,
    type='AmpOptimWrapper',
    optimizer=dict(
        type='AdamW',
        lr=3e-05,
        betas=(0.9, 0.999),
        weight_decay=0.05,
    ),
    constructor='LayerDecayOptimizerConstructor',
    paramwise_cfg=dict(
        num_layers=12,
        layer_decay_rate=0.9,
    ),
)

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,
    ),
]

train_dataloader = dict(
    batch_size=4,
)

