_base_ = '../vfnet/vfnet_r50_fpn_mdconv_c3-c5_mstrain_2x_coco.py'
model = dict(
    backbone=dict(
        type='ResNeXt',
        depth=101,
        groups=64,
        base_width=4,
        num_stages=4,
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        norm_cfg=dict(type='BN', requires_grad=True),
        norm_eval=True,
        style='pytorch',
        dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
        stage_with_dcn=(False, True, True, True),
        init_cfg=dict(
            type='Pretrained', checkpoint='open-mmlab://resnext101_64x4d')),
    bbox_head=dict(num_classes=2)
)

# Dataset path
TRAIN_DATASET = '/home/hqvo2/Projects/Breast_Cancer/data/processed_data2/mass/train_train'
TRAIN_ANNOTATION = TRAIN_DATASET + '/annotation_coco_with_classes.json'
VAL_DATASET = '/home/hqvo2/Projects/Breast_Cancer/data/processed_data2/mass/train_val'
VAL_ANNOTATION = VAL_DATASET + '/annotation_coco_with_classes.json'
TEST_DATASET = '/home/hqvo2/Projects/Breast_Cancer/data/processed_data2/mass/test'
TEST_ANNOTATION = TEST_DATASET + '/annotation_coco_with_classes.json'

# Modify dataset related settings
dataset_type = 'COCODataset'
classes = ('malignant-mass', 'benign-mass')
data = dict(
    samples_per_gpu=4,
    workers_per_gpu=4,
    train=dict(
        img_prefix=TRAIN_DATASET,
        classes=classes,
        ann_file=TRAIN_ANNOTATION),
    val=dict(
        img_prefix=VAL_DATASET,
        classes=classes,
        ann_file=VAL_ANNOTATION),
    test=dict(
        img_prefix=TEST_DATASET,
        classes=classes,
        ann_file=TEST_ANNOTATION))


load_from = 'https://download.openmmlab.com/mmdetection/v2.0/vfnet/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_coco_20201027pth-b5f6da5e.pth'
work_dir = '/home/hqvo2/Projects/Breast_Cancer/experiments/cbis_ddsm_detection/mass/vfnet_x101_64x4d_fpn_mdconv_c3-c5_mstrain_2x_ddsm'

evaluation = dict(
    save_best='bbox_mAP'
)
runner = dict(max_epochs=24)
workflow=[('train', 1), ('val', 1)]

log_config = dict(
    interval=50,
    hooks=[
        dict(type='TextLoggerHook'),
        dict(type='TensorboardLoggerHook')
    ])
