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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
checkpoint_config = dict(interval=1)
|
| 2 |
+
log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')])
|
| 3 |
+
custom_hooks = [dict(type='NumClassCheckHook')]
|
| 4 |
+
dist_params = dict(backend='nccl')
|
| 5 |
+
log_level = 'INFO'
|
| 6 |
+
load_from = None
|
| 7 |
+
resume_from = None
|
| 8 |
+
workflow = [('train', 1)]
|
| 9 |
+
opencv_num_threads = 0
|
| 10 |
+
mp_start_method = 'fork'
|
| 11 |
+
auto_scale_lr = dict(enable=False, base_batch_size=16)
|
| 12 |
+
dataset_type = 'CocoDataset'
|
| 13 |
+
data_root = 'data/coco/'
|
| 14 |
+
img_norm_cfg = dict(
|
| 15 |
+
mean=[103.53, 116.28, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
|
| 16 |
+
train_pipeline = [
|
| 17 |
+
dict(type='LoadImageFromFile'),
|
| 18 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 19 |
+
dict(
|
| 20 |
+
type='Resize',
|
| 21 |
+
img_scale=[(1333, 640), (1333, 800)],
|
| 22 |
+
multiscale_mode='range',
|
| 23 |
+
keep_ratio=True),
|
| 24 |
+
dict(type='RandomFlip', flip_ratio=0.5),
|
| 25 |
+
dict(
|
| 26 |
+
type='Normalize',
|
| 27 |
+
mean=[103.53, 116.28, 123.675],
|
| 28 |
+
std=[1.0, 1.0, 1.0],
|
| 29 |
+
to_rgb=False),
|
| 30 |
+
dict(type='Pad', size_divisor=32),
|
| 31 |
+
dict(type='DefaultFormatBundle'),
|
| 32 |
+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
|
| 33 |
+
]
|
| 34 |
+
test_pipeline = [
|
| 35 |
+
dict(type='LoadImageFromFile'),
|
| 36 |
+
dict(
|
| 37 |
+
type='MultiScaleFlipAug',
|
| 38 |
+
img_scale=(1333, 800),
|
| 39 |
+
flip=False,
|
| 40 |
+
transforms=[
|
| 41 |
+
dict(type='Resize', keep_ratio=True),
|
| 42 |
+
dict(type='RandomFlip'),
|
| 43 |
+
dict(
|
| 44 |
+
type='Normalize',
|
| 45 |
+
mean=[103.53, 116.28, 123.675],
|
| 46 |
+
std=[1.0, 1.0, 1.0],
|
| 47 |
+
to_rgb=False),
|
| 48 |
+
dict(type='Pad', size_divisor=32),
|
| 49 |
+
dict(type='ImageToTensor', keys=['img']),
|
| 50 |
+
dict(type='Collect', keys=['img'])
|
| 51 |
+
])
|
| 52 |
+
]
|
| 53 |
+
data = dict(
|
| 54 |
+
samples_per_gpu=2,
|
| 55 |
+
workers_per_gpu=2,
|
| 56 |
+
train=dict(
|
| 57 |
+
type='RepeatDataset',
|
| 58 |
+
times=3,
|
| 59 |
+
dataset=dict(
|
| 60 |
+
type='CocoDataset',
|
| 61 |
+
ann_file='data/coco/annotations/instances_train2017.json',
|
| 62 |
+
img_prefix='data/coco/train2017/',
|
| 63 |
+
pipeline=[
|
| 64 |
+
dict(type='LoadImageFromFile'),
|
| 65 |
+
dict(type='LoadAnnotations', with_bbox=True),
|
| 66 |
+
dict(
|
| 67 |
+
type='Resize',
|
| 68 |
+
img_scale=[(1333, 640), (1333, 800)],
|
| 69 |
+
multiscale_mode='range',
|
| 70 |
+
keep_ratio=True),
|
| 71 |
+
dict(type='RandomFlip', flip_ratio=0.5),
|
| 72 |
+
dict(
|
| 73 |
+
type='Normalize',
|
| 74 |
+
mean=[103.53, 116.28, 123.675],
|
| 75 |
+
std=[1.0, 1.0, 1.0],
|
| 76 |
+
to_rgb=False),
|
| 77 |
+
dict(type='Pad', size_divisor=32),
|
| 78 |
+
dict(type='DefaultFormatBundle'),
|
| 79 |
+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
|
| 80 |
+
])),
|
| 81 |
+
val=dict(
|
| 82 |
+
type='CocoDataset',
|
| 83 |
+
ann_file='data/coco/annotations/instances_val2017.json',
|
| 84 |
+
img_prefix='data/coco/val2017/',
|
| 85 |
+
pipeline=[
|
| 86 |
+
dict(type='LoadImageFromFile'),
|
| 87 |
+
dict(
|
| 88 |
+
type='MultiScaleFlipAug',
|
| 89 |
+
img_scale=(1333, 800),
|
| 90 |
+
flip=False,
|
| 91 |
+
transforms=[
|
| 92 |
+
dict(type='Resize', keep_ratio=True),
|
| 93 |
+
dict(type='RandomFlip'),
|
| 94 |
+
dict(
|
| 95 |
+
type='Normalize',
|
| 96 |
+
mean=[103.53, 116.28, 123.675],
|
| 97 |
+
std=[1.0, 1.0, 1.0],
|
| 98 |
+
to_rgb=False),
|
| 99 |
+
dict(type='Pad', size_divisor=32),
|
| 100 |
+
dict(type='ImageToTensor', keys=['img']),
|
| 101 |
+
dict(type='Collect', keys=['img'])
|
| 102 |
+
])
|
| 103 |
+
]),
|
| 104 |
+
test=dict(
|
| 105 |
+
type='CocoDataset',
|
| 106 |
+
ann_file='data/coco/annotations/instances_val2017.json',
|
| 107 |
+
img_prefix='data/coco/val2017/',
|
| 108 |
+
pipeline=[
|
| 109 |
+
dict(type='LoadImageFromFile'),
|
| 110 |
+
dict(
|
| 111 |
+
type='MultiScaleFlipAug',
|
| 112 |
+
img_scale=(1333, 800),
|
| 113 |
+
flip=False,
|
| 114 |
+
transforms=[
|
| 115 |
+
dict(type='Resize', keep_ratio=True),
|
| 116 |
+
dict(type='RandomFlip'),
|
| 117 |
+
dict(
|
| 118 |
+
type='Normalize',
|
| 119 |
+
mean=[103.53, 116.28, 123.675],
|
| 120 |
+
std=[1.0, 1.0, 1.0],
|
| 121 |
+
to_rgb=False),
|
| 122 |
+
dict(type='Pad', size_divisor=32),
|
| 123 |
+
dict(type='ImageToTensor', keys=['img']),
|
| 124 |
+
dict(type='Collect', keys=['img'])
|
| 125 |
+
])
|
| 126 |
+
]))
|
| 127 |
+
evaluation = dict(interval=1, metric='bbox')
|
| 128 |
+
optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
|
| 129 |
+
optimizer_config = dict(grad_clip=None)
|
| 130 |
+
lr_config = dict(
|
| 131 |
+
policy='step',
|
| 132 |
+
warmup='linear',
|
| 133 |
+
warmup_iters=500,
|
| 134 |
+
warmup_ratio=0.001,
|
| 135 |
+
step=[9, 11])
|
| 136 |
+
runner = dict(type='EpochBasedRunner', max_epochs=12)
|
| 137 |
+
model = dict(
|
| 138 |
+
type='FasterRCNN',
|
| 139 |
+
backbone=dict(
|
| 140 |
+
type='ResNet',
|
| 141 |
+
depth=50,
|
| 142 |
+
num_stages=4,
|
| 143 |
+
out_indices=(0, 1, 2, 3),
|
| 144 |
+
frozen_stages=1,
|
| 145 |
+
norm_cfg=dict(type='BN', requires_grad=False),
|
| 146 |
+
norm_eval=True,
|
| 147 |
+
style='caffe',
|
| 148 |
+
init_cfg=dict(
|
| 149 |
+
type='Pretrained',
|
| 150 |
+
checkpoint='open-mmlab://detectron2/resnet50_caffe')),
|
| 151 |
+
neck=dict(
|
| 152 |
+
type='FPN',
|
| 153 |
+
in_channels=[256, 512, 1024, 2048],
|
| 154 |
+
out_channels=256,
|
| 155 |
+
num_outs=5),
|
| 156 |
+
rpn_head=dict(
|
| 157 |
+
type='RPNHead',
|
| 158 |
+
in_channels=256,
|
| 159 |
+
feat_channels=256,
|
| 160 |
+
anchor_generator=dict(
|
| 161 |
+
type='AnchorGenerator',
|
| 162 |
+
scales=[8],
|
| 163 |
+
ratios=[0.5, 1.0, 2.0],
|
| 164 |
+
strides=[4, 8, 16, 32, 64]),
|
| 165 |
+
bbox_coder=dict(
|
| 166 |
+
type='DeltaXYWHBBoxCoder',
|
| 167 |
+
target_means=[0.0, 0.0, 0.0, 0.0],
|
| 168 |
+
target_stds=[1.0, 1.0, 1.0, 1.0]),
|
| 169 |
+
loss_cls=dict(
|
| 170 |
+
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
|
| 171 |
+
loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
|
| 172 |
+
roi_head=dict(
|
| 173 |
+
type='StandardRoIHead',
|
| 174 |
+
bbox_roi_extractor=dict(
|
| 175 |
+
type='SingleRoIExtractor',
|
| 176 |
+
roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
|
| 177 |
+
out_channels=256,
|
| 178 |
+
featmap_strides=[4, 8, 16, 32]),
|
| 179 |
+
bbox_head=dict(
|
| 180 |
+
type='Shared2FCBBoxHead',
|
| 181 |
+
in_channels=256,
|
| 182 |
+
fc_out_channels=1024,
|
| 183 |
+
roi_feat_size=7,
|
| 184 |
+
num_classes=80,
|
| 185 |
+
bbox_coder=dict(
|
| 186 |
+
type='DeltaXYWHBBoxCoder',
|
| 187 |
+
target_means=[0.0, 0.0, 0.0, 0.0],
|
| 188 |
+
target_stds=[0.1, 0.1, 0.2, 0.2]),
|
| 189 |
+
reg_class_agnostic=False,
|
| 190 |
+
loss_cls=dict(
|
| 191 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 192 |
+
loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
|
| 193 |
+
train_cfg=dict(
|
| 194 |
+
assigner=dict(
|
| 195 |
+
type='MaxIoUAssigner',
|
| 196 |
+
pos_iou_thr=0.5,
|
| 197 |
+
neg_iou_thr=0.5,
|
| 198 |
+
min_pos_iou=0.5,
|
| 199 |
+
match_low_quality=False,
|
| 200 |
+
ignore_iof_thr=-1),
|
| 201 |
+
sampler=dict(
|
| 202 |
+
type='RandomSampler',
|
| 203 |
+
num=512,
|
| 204 |
+
pos_fraction=0.25,
|
| 205 |
+
neg_pos_ub=-1,
|
| 206 |
+
add_gt_as_proposals=True),
|
| 207 |
+
pos_weight=-1,
|
| 208 |
+
debug=False),
|
| 209 |
+
test_cfg=dict(
|
| 210 |
+
score_thr=0.05,
|
| 211 |
+
nms=dict(type='nms', iou_threshold=0.5),
|
| 212 |
+
max_per_img=100),
|
| 213 |
+
pretrained=None),
|
| 214 |
+
train_cfg=dict(
|
| 215 |
+
rpn=dict(
|
| 216 |
+
assigner=dict(
|
| 217 |
+
type='MaxIoUAssigner',
|
| 218 |
+
pos_iou_thr=0.7,
|
| 219 |
+
neg_iou_thr=0.3,
|
| 220 |
+
min_pos_iou=0.3,
|
| 221 |
+
match_low_quality=True,
|
| 222 |
+
ignore_iof_thr=-1),
|
| 223 |
+
sampler=dict(
|
| 224 |
+
type='RandomSampler',
|
| 225 |
+
num=256,
|
| 226 |
+
pos_fraction=0.5,
|
| 227 |
+
neg_pos_ub=-1,
|
| 228 |
+
add_gt_as_proposals=False),
|
| 229 |
+
allowed_border=-1,
|
| 230 |
+
pos_weight=-1,
|
| 231 |
+
debug=False),
|
| 232 |
+
rpn_proposal=dict(
|
| 233 |
+
nms_pre=2000,
|
| 234 |
+
max_per_img=1000,
|
| 235 |
+
nms=dict(type='nms', iou_threshold=0.7),
|
| 236 |
+
min_bbox_size=0),
|
| 237 |
+
rcnn=dict(
|
| 238 |
+
assigner=dict(
|
| 239 |
+
type='MaxIoUAssigner',
|
| 240 |
+
pos_iou_thr=0.5,
|
| 241 |
+
neg_iou_thr=0.5,
|
| 242 |
+
min_pos_iou=0.5,
|
| 243 |
+
match_low_quality=False,
|
| 244 |
+
ignore_iof_thr=-1),
|
| 245 |
+
sampler=dict(
|
| 246 |
+
type='RandomSampler',
|
| 247 |
+
num=512,
|
| 248 |
+
pos_fraction=0.25,
|
| 249 |
+
neg_pos_ub=-1,
|
| 250 |
+
add_gt_as_proposals=True),
|
| 251 |
+
pos_weight=-1,
|
| 252 |
+
debug=False)),
|
| 253 |
+
test_cfg=dict(
|
| 254 |
+
rpn=dict(
|
| 255 |
+
nms_pre=1000,
|
| 256 |
+
max_per_img=1000,
|
| 257 |
+
nms=dict(type='nms', iou_threshold=0.7),
|
| 258 |
+
min_bbox_size=0),
|
| 259 |
+
rcnn=dict(
|
| 260 |
+
score_thr=0.05,
|
| 261 |
+
nms=dict(type='nms', iou_threshold=0.5),
|
| 262 |
+
max_per_img=100)))
|