ssd512_voc.py 3.94 KB
Newer Older
1
benchmark = True
yhcao6's avatar
yhcao6 committed
2
# model settings
yhcao6's avatar
fix  
yhcao6 committed
3
input_size = 512
yhcao6's avatar
yhcao6 committed
4
5
model = dict(
    type='SingleStageDetector',
yhcao6's avatar
yhcao6 committed
6
    pretrained='open-mmlab://vgg16_caffe',
yhcao6's avatar
yhcao6 committed
7
8
    backbone=dict(
        type='SSDVGG',
yhcao6's avatar
fix  
yhcao6 committed
9
        input_size=input_size,
yhcao6's avatar
yhcao6 committed
10
11
12
13
14
15
16
17
18
        depth=16,
        with_last_pool=False,
        ceil_mode=True,
        out_indices=(3, 4),
        out_feature_indices=(22, 34),
        l2_norm_scale=20),
    neck=None,
    bbox_head=dict(
        type='SSDHead',
yhcao6's avatar
fix  
yhcao6 committed
19
        input_size=input_size,
yhcao6's avatar
yhcao6 committed
20
        in_channels=(512, 1024, 512, 256, 256, 256, 256),
yhcao6's avatar
fix  
yhcao6 committed
21
        num_classes=21,
yhcao6's avatar
yhcao6 committed
22
        anchor_strides=(8, 16, 32, 64, 128, 256, 512),
23
        basesize_ratio_range=(0.15, 0.9),
yhcao6's avatar
yhcao6 committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
        anchor_ratios=([2], [2, 3], [2, 3], [2, 3], [2, 3], [2], [2]),
        target_means=(.0, .0, .0, .0),
        target_stds=(0.1, 0.1, 0.2, 0.2)))
train_cfg = dict(
    assigner=dict(
        type='MaxIoUAssigner',
        pos_iou_thr=0.5,
        neg_iou_thr=0.5,
        min_pos_iou=0.,
        ignore_iof_thr=-1,
        gt_max_assign_all=False),
    smoothl1_beta=1.,
    allowed_border=-1,
    pos_weight=-1,
    neg_pos_ratio=3,
    debug=False)
test_cfg = dict(
    nms=dict(type='nms', iou_thr=0.45),
    min_bbox_size=0,
    score_thr=0.02,
    max_per_img=200)
# model training and testing settings
# dataset settings
yhcao6's avatar
fix  
yhcao6 committed
47
48
dataset_type = 'VOCDataset'
data_root = 'data/VOCdevkit/'
yhcao6's avatar
yhcao6 committed
49
50
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[1, 1, 1], to_rgb=True)
data = dict(
51
52
    imgs_per_gpu=4,
    workers_per_gpu=2,
yhcao6's avatar
yhcao6 committed
53
54
    train=dict(
        type='RepeatDataset',
55
        times=10,
yhcao6's avatar
yhcao6 committed
56
57
        dataset=dict(
            type=dataset_type,
yhcao6's avatar
fix  
yhcao6 committed
58
59
60
61
62
            ann_file=[
                data_root + 'VOC2007/ImageSets/Main/trainval.txt',
                data_root + 'VOC2012/ImageSets/Main/trainval.txt'
            ],
            img_prefix=[data_root + 'VOC2007/', data_root + 'VOC2012/'],
yhcao6's avatar
yhcao6 committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
            img_scale=(512, 512),
            img_norm_cfg=img_norm_cfg,
            size_divisor=None,
            flip_ratio=0.5,
            with_mask=False,
            with_crowd=False,
            with_label=True,
            test_mode=False,
            extra_aug=dict(
                photo_metric_distortion=dict(
                    brightness_delta=32,
                    contrast_range=(0.5, 1.5),
                    saturation_range=(0.5, 1.5),
                    hue_delta=18),
                expand=dict(
                    mean=img_norm_cfg['mean'],
                    to_rgb=img_norm_cfg['to_rgb'],
                    ratio_range=(1, 4)),
                random_crop=dict(
                    min_ious=(0.1, 0.3, 0.5, 0.7, 0.9), min_crop_size=0.3)),
yhcao6's avatar
fix  
yhcao6 committed
83
            resize_keep_ratio=False)),
yhcao6's avatar
yhcao6 committed
84
85
    val=dict(
        type=dataset_type,
yhcao6's avatar
fix  
yhcao6 committed
86
87
        ann_file=data_root + 'VOC2007/ImageSets/Main/test.txt',
        img_prefix=data_root + 'VOC2007/',
yhcao6's avatar
yhcao6 committed
88
89
90
91
92
93
94
95
96
97
        img_scale=(512, 512),
        img_norm_cfg=img_norm_cfg,
        size_divisor=None,
        flip_ratio=0,
        with_mask=False,
        with_label=False,
        test_mode=True,
        resize_keep_ratio=False),
    test=dict(
        type=dataset_type,
yhcao6's avatar
fix  
yhcao6 committed
98
99
        ann_file=data_root + 'VOC2007/ImageSets/Main/test.txt',
        img_prefix=data_root + 'VOC2007/',
yhcao6's avatar
yhcao6 committed
100
101
102
103
104
105
106
107
108
        img_scale=(512, 512),
        img_norm_cfg=img_norm_cfg,
        size_divisor=None,
        flip_ratio=0,
        with_mask=False,
        with_label=False,
        test_mode=True,
        resize_keep_ratio=False))
# optimizer
109
optimizer = dict(type='SGD', lr=1e-3, momentum=0.9, weight_decay=5e-4)
yhcao6's avatar
yhcao6 committed
110
111
112
113
114
115
116
optimizer_config = dict()
# learning policy
lr_config = dict(
    policy='step',
    warmup='linear',
    warmup_iters=500,
    warmup_ratio=1.0 / 3,
117
    step=[16, 20])
yhcao6's avatar
yhcao6 committed
118
119
120
121
122
123
124
125
126
127
checkpoint_config = dict(interval=1)
# yapf:disable
log_config = dict(
    interval=50,
    hooks=[
        dict(type='TextLoggerHook'),
        # dict(type='TensorboardLoggerHook')
    ])
# yapf:enable
# runtime settings
128
total_epochs = 24
yhcao6's avatar
yhcao6 committed
129
130
131
132
133
134
dist_params = dict(backend='nccl')
log_level = 'INFO'
work_dir = './work_dirs/ssd512_voc'
load_from = None
resume_from = None
workflow = [('train', 1)]