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|
| 13 |
+
num_blocks=(4, ),
|
| 14 |
+
num_channels=(64, )),
|
| 15 |
+
stage2=dict(
|
| 16 |
+
num_modules=1,
|
| 17 |
+
num_branches=2,
|
| 18 |
+
block='BASIC',
|
| 19 |
+
num_blocks=(4, 4),
|
| 20 |
+
num_channels=(32, 64)),
|
| 21 |
+
stage3=dict(
|
| 22 |
+
num_modules=4,
|
| 23 |
+
num_branches=3,
|
| 24 |
+
block='BASIC',
|
| 25 |
+
num_blocks=(4, 4, 4),
|
| 26 |
+
num_channels=(32, 64, 128)),
|
| 27 |
+
stage4=dict(
|
| 28 |
+
num_modules=3,
|
| 29 |
+
num_branches=4,
|
| 30 |
+
block='BASIC',
|
| 31 |
+
num_blocks=(4, 4, 4, 4),
|
| 32 |
+
num_channels=(32, 64, 128, 256)))),
|
| 33 |
+
neck=dict(type='HRFPN', in_channels=[32, 64, 128, 256], out_channels=256),
|
| 34 |
+
rpn_head=dict(
|
| 35 |
+
type='RPNHead',
|
| 36 |
+
in_channels=256,
|
| 37 |
+
feat_channels=256,
|
| 38 |
+
anchor_scales=[8],
|
| 39 |
+
anchor_ratios=[0.5, 1.0, 2.0],
|
| 40 |
+
anchor_strides=[4, 8, 16, 32, 64],
|
| 41 |
+
target_means=[.0, .0, .0, .0],
|
| 42 |
+
target_stds=[1.0, 1.0, 1.0, 1.0],
|
| 43 |
+
loss_cls=dict(
|
| 44 |
+
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
|
| 45 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)),
|
| 46 |
+
bbox_roi_extractor=dict(
|
| 47 |
+
type='SingleRoIExtractor',
|
| 48 |
+
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2),
|
| 49 |
+
out_channels=256,
|
| 50 |
+
featmap_strides=[4, 8, 16, 32]),
|
| 51 |
+
bbox_head=[
|
| 52 |
+
dict(
|
| 53 |
+
type='SharedFCBBoxHead',
|
| 54 |
+
num_fcs=2,
|
| 55 |
+
in_channels=256,
|
| 56 |
+
fc_out_channels=1024,
|
| 57 |
+
roi_feat_size=7,
|
| 58 |
+
num_classes=81,
|
| 59 |
+
target_means=[0., 0., 0., 0.],
|
| 60 |
+
target_stds=[0.1, 0.1, 0.2, 0.2],
|
| 61 |
+
reg_class_agnostic=True,
|
| 62 |
+
loss_cls=dict(
|
| 63 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 64 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)),
|
| 65 |
+
dict(
|
| 66 |
+
type='SharedFCBBoxHead',
|
| 67 |
+
num_fcs=2,
|
| 68 |
+
in_channels=256,
|
| 69 |
+
fc_out_channels=1024,
|
| 70 |
+
roi_feat_size=7,
|
| 71 |
+
num_classes=81,
|
| 72 |
+
target_means=[0., 0., 0., 0.],
|
| 73 |
+
target_stds=[0.05, 0.05, 0.1, 0.1],
|
| 74 |
+
reg_class_agnostic=True,
|
| 75 |
+
loss_cls=dict(
|
| 76 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 77 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)),
|
| 78 |
+
dict(
|
| 79 |
+
type='SharedFCBBoxHead',
|
| 80 |
+
num_fcs=2,
|
| 81 |
+
in_channels=256,
|
| 82 |
+
fc_out_channels=1024,
|
| 83 |
+
roi_feat_size=7,
|
| 84 |
+
num_classes=81,
|
| 85 |
+
target_means=[0., 0., 0., 0.],
|
| 86 |
+
target_stds=[0.033, 0.033, 0.067, 0.067],
|
| 87 |
+
reg_class_agnostic=True,
|
| 88 |
+
loss_cls=dict(
|
| 89 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 90 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))
|
| 91 |
+
],
|
| 92 |
+
mask_roi_extractor=dict(
|
| 93 |
+
type='SingleRoIExtractor',
|
| 94 |
+
roi_layer=dict(type='RoIAlign', out_size=14, sample_num=2),
|
| 95 |
+
out_channels=256,
|
| 96 |
+
featmap_strides=[4, 8, 16, 32]),
|
| 97 |
+
mask_head=dict(
|
| 98 |
+
type='FCNMaskHead',
|
| 99 |
+
num_convs=4,
|
| 100 |
+
in_channels=256,
|
| 101 |
+
conv_out_channels=256,
|
| 102 |
+
num_classes=81,
|
| 103 |
+
loss_mask=dict(
|
| 104 |
+
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)))
|
| 105 |
+
# model training and testing settings
|
| 106 |
+
train_cfg = dict(
|
| 107 |
+
rpn=dict(
|
| 108 |
+
assigner=dict(
|
| 109 |
+
type='MaxIoUAssigner',
|
| 110 |
+
pos_iou_thr=0.7,
|
| 111 |
+
neg_iou_thr=0.3,
|
| 112 |
+
min_pos_iou=0.3,
|
| 113 |
+
ignore_iof_thr=-1),
|
| 114 |
+
sampler=dict(
|
| 115 |
+
type='RandomSampler',
|
| 116 |
+
num=256,
|
| 117 |
+
pos_fraction=0.5,
|
| 118 |
+
neg_pos_ub=-1,
|
| 119 |
+
add_gt_as_proposals=False),
|
| 120 |
+
allowed_border=0,
|
| 121 |
+
pos_weight=-1,
|
| 122 |
+
debug=False),
|
| 123 |
+
rpn_proposal=dict(
|
| 124 |
+
nms_across_levels=False,
|
| 125 |
+
nms_pre=2000,
|
| 126 |
+
nms_post=2000,
|
| 127 |
+
max_num=2000,
|
| 128 |
+
nms_thr=0.7,
|
| 129 |
+
min_bbox_size=0),
|
| 130 |
+
rcnn=[
|
| 131 |
+
dict(
|
| 132 |
+
assigner=dict(
|
| 133 |
+
type='MaxIoUAssigner',
|
| 134 |
+
pos_iou_thr=0.5,
|
| 135 |
+
neg_iou_thr=0.5,
|
| 136 |
+
min_pos_iou=0.5,
|
| 137 |
+
ignore_iof_thr=-1),
|
| 138 |
+
sampler=dict(
|
| 139 |
+
type='RandomSampler',
|
| 140 |
+
num=512,
|
| 141 |
+
pos_fraction=0.25,
|
| 142 |
+
neg_pos_ub=-1,
|
| 143 |
+
add_gt_as_proposals=True),
|
| 144 |
+
mask_size=28,
|
| 145 |
+
pos_weight=-1,
|
| 146 |
+
debug=False),
|
| 147 |
+
dict(
|
| 148 |
+
assigner=dict(
|
| 149 |
+
type='MaxIoUAssigner',
|
| 150 |
+
pos_iou_thr=0.6,
|
| 151 |
+
neg_iou_thr=0.6,
|
| 152 |
+
min_pos_iou=0.6,
|
| 153 |
+
ignore_iof_thr=-1),
|
| 154 |
+
sampler=dict(
|
| 155 |
+
type='RandomSampler',
|
| 156 |
+
num=512,
|
| 157 |
+
pos_fraction=0.25,
|
| 158 |
+
neg_pos_ub=-1,
|
| 159 |
+
add_gt_as_proposals=True),
|
| 160 |
+
mask_size=28,
|
| 161 |
+
pos_weight=-1,
|
| 162 |
+
debug=False),
|
| 163 |
+
dict(
|
| 164 |
+
assigner=dict(
|
| 165 |
+
type='MaxIoUAssigner',
|
| 166 |
+
pos_iou_thr=0.7,
|
| 167 |
+
neg_iou_thr=0.7,
|
| 168 |
+
min_pos_iou=0.7,
|
| 169 |
+
ignore_iof_thr=-1),
|
| 170 |
+
sampler=dict(
|
| 171 |
+
type='RandomSampler',
|
| 172 |
+
num=512,
|
| 173 |
+
pos_fraction=0.25,
|
| 174 |
+
neg_pos_ub=-1,
|
| 175 |
+
add_gt_as_proposals=True),
|
| 176 |
+
mask_size=28,
|
| 177 |
+
pos_weight=-1,
|
| 178 |
+
debug=False)
|
| 179 |
+
],
|
| 180 |
+
stage_loss_weights=[1, 0.5, 0.25])
|
| 181 |
+
test_cfg = dict(
|
| 182 |
+
rpn=dict(
|
| 183 |
+
nms_across_levels=False,
|
| 184 |
+
nms_pre=1000,
|
| 185 |
+
nms_post=1000,
|
| 186 |
+
max_num=1000,
|
| 187 |
+
nms_thr=0.7,
|
| 188 |
+
min_bbox_size=0),
|
| 189 |
+
rcnn=dict(
|
| 190 |
+
score_thr=0.05,
|
| 191 |
+
nms=dict(type='nms', iou_thr=0.5),
|
| 192 |
+
max_per_img=100,
|
| 193 |
+
mask_thr_binary=0.5))
|
| 194 |
+
# dataset settings
|
| 195 |
+
dataset_type = 'CocoDataset'
|
| 196 |
+
data_root = '/content/drive/My Drive/Mmdetection/'
|
| 197 |
+
img_norm_cfg = dict(
|
| 198 |
+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
| 199 |
+
train_pipeline = [
|
| 200 |
+
dict(type='LoadImageFromFile'),
|
| 201 |
+
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
| 202 |
+
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
|
| 203 |
+
dict(type='RandomFlip', flip_ratio=0.5),
|
| 204 |
+
dict(type='Normalize', **img_norm_cfg),
|
| 205 |
+
dict(type='Pad', size_divisor=32),
|
| 206 |
+
dict(type='DefaultFormatBundle'),
|
| 207 |
+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
|
| 208 |
+
]
|
| 209 |
+
test_pipeline = [
|
| 210 |
+
dict(type='LoadImageFromFile'),
|
| 211 |
+
dict(
|
| 212 |
+
type='MultiScaleFlipAug',
|
| 213 |
+
img_scale=(1333, 800),
|
| 214 |
+
flip=False,
|
| 215 |
+
transforms=[
|
| 216 |
+
dict(type='Resize', keep_ratio=True),
|
| 217 |
+
dict(type='RandomFlip'),
|
| 218 |
+
dict(type='Normalize', **img_norm_cfg),
|
| 219 |
+
dict(type='Pad', size_divisor=32),
|
| 220 |
+
dict(type='ImageToTensor', keys=['img']),
|
| 221 |
+
dict(type='Collect', keys=['img']),
|
| 222 |
+
])
|
| 223 |
+
]
|
| 224 |
+
data = dict(
|
| 225 |
+
imgs_per_gpu=2,
|
| 226 |
+
workers_per_gpu=2,
|
| 227 |
+
train=dict(
|
| 228 |
+
type=dataset_type,
|
| 229 |
+
ann_file='/content/drive/My Drive/chunk.json',
|
| 230 |
+
img_prefix='/content/drive/My Drive/chunk_images/',
|
| 231 |
+
pipeline=train_pipeline),
|
| 232 |
+
val=dict(
|
| 233 |
+
type=dataset_type,
|
| 234 |
+
ann_file=data_root + 'VOC2007/test.json',
|
| 235 |
+
img_prefix=data_root + 'VOC2007/Test/',
|
| 236 |
+
pipeline=test_pipeline),
|
| 237 |
+
test=dict(
|
| 238 |
+
type=dataset_type,
|
| 239 |
+
ann_file=data_root + 'VOC2007/test.json',
|
| 240 |
+
img_prefix=data_root + 'VOC2007/Test/',
|
| 241 |
+
pipeline=test_pipeline))
|
| 242 |
+
# evaluation = dict(interval=1, metric=['bbox'])
|
| 243 |
+
# optimizer
|
| 244 |
+
optimizer = dict(type='SGD', lr=0.0012, momentum=0.9, weight_decay=0.0001)
|
| 245 |
+
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
|
| 246 |
+
# learning policy
|
| 247 |
+
lr_config = dict(
|
| 248 |
+
policy='step',
|
| 249 |
+
warmup='linear',
|
| 250 |
+
warmup_iters=500,
|
| 251 |
+
warmup_ratio=1.0 / 3,
|
| 252 |
+
step=[16, 19])
|
| 253 |
+
checkpoint_config = dict(interval=1,create_symlink=False)
|
| 254 |
+
# yapf:disable
|
| 255 |
+
log_config = dict(
|
| 256 |
+
interval=50,
|
| 257 |
+
hooks=[
|
| 258 |
+
dict(type='TextLoggerHook'),
|
| 259 |
+
# dict(type='TensorboardLoggerHook')
|
| 260 |
+
])
|
| 261 |
+
# yapf:enable
|
| 262 |
+
# runtime settings
|
| 263 |
+
total_epochs = 36
|
| 264 |
+
dist_params = dict(backend='nccl')
|
| 265 |
+
log_level = 'INFO'
|
| 266 |
+
work_dir = '/content/drive/My Drive/Mmdetection/new_chunk_cascade_mask_rcnn_hrnetv2p_w32_20e'
|
| 267 |
+
load_from = None
|
| 268 |
+
resume_from = '/content/drive/My Drive/Mmdetection/new_chunk_cascade_mask_rcnn_hrnetv2p_w32_20e/epoch_30.pth'
|
| 269 |
+
workflow = [('train', 1)]
|
cascade_mask_rcnn_hrnetv2p_w32_20e_v2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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# model settings
|
| 2 |
+
model = dict(
|
| 3 |
+
type='CascadeRCNN',
|
| 4 |
+
# num_stages=3,
|
| 5 |
+
pretrained='open-mmlab://msra/hrnetv2_w32',
|
| 6 |
+
backbone=dict(
|
| 7 |
+
type='HRNet',
|
| 8 |
+
extra=dict(
|
| 9 |
+
stage1=dict(
|
| 10 |
+
num_modules=1,
|
| 11 |
+
num_branches=1,
|
| 12 |
+
block='BOTTLENECK',
|
| 13 |
+
num_blocks=(4, ),
|
| 14 |
+
num_channels=(64, )),
|
| 15 |
+
stage2=dict(
|
| 16 |
+
num_modules=1,
|
| 17 |
+
num_branches=2,
|
| 18 |
+
block='BASIC',
|
| 19 |
+
num_blocks=(4, 4),
|
| 20 |
+
num_channels=(32, 64)),
|
| 21 |
+
stage3=dict(
|
| 22 |
+
num_modules=4,
|
| 23 |
+
num_branches=3,
|
| 24 |
+
block='BASIC',
|
| 25 |
+
num_blocks=(4, 4, 4),
|
| 26 |
+
num_channels=(32, 64, 128)),
|
| 27 |
+
stage4=dict(
|
| 28 |
+
num_modules=3,
|
| 29 |
+
num_branches=4,
|
| 30 |
+
block='BASIC',
|
| 31 |
+
num_blocks=(4, 4, 4, 4),
|
| 32 |
+
num_channels=(32, 64, 128, 256)))),
|
| 33 |
+
neck=dict(type='HRFPN', in_channels=[32, 64, 128, 256], out_channels=256),
|
| 34 |
+
rpn_head=dict(
|
| 35 |
+
type='RPNHead',
|
| 36 |
+
in_channels=256,
|
| 37 |
+
feat_channels=256,
|
| 38 |
+
anchor_generator=dict(
|
| 39 |
+
type='AnchorGenerator',
|
| 40 |
+
scales=[8],
|
| 41 |
+
ratios=[0.5, 1.0, 2.0],
|
| 42 |
+
strides=[4, 8, 16, 32, 64]),
|
| 43 |
+
bbox_coder=dict(
|
| 44 |
+
type='DeltaXYWHBBoxCoder',
|
| 45 |
+
target_means=[.0, .0, .0, .0],
|
| 46 |
+
target_stds=[1.0, 1.0, 1.0, 1.0]),
|
| 47 |
+
loss_cls=dict(
|
| 48 |
+
type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
|
| 49 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)),
|
| 50 |
+
roi_head=dict(
|
| 51 |
+
type='CascadeRoIHead',
|
| 52 |
+
num_stages=3,
|
| 53 |
+
stage_loss_weights=[1, 0.5, 0.25],
|
| 54 |
+
bbox_roi_extractor=dict(
|
| 55 |
+
type='SingleRoIExtractor',
|
| 56 |
+
roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), # may conflict
|
| 57 |
+
out_channels=256,
|
| 58 |
+
featmap_strides=[4, 8, 16, 32]),
|
| 59 |
+
bbox_head=[
|
| 60 |
+
dict(
|
| 61 |
+
type='Shared2FCBBoxHead',
|
| 62 |
+
# num_fcs=2,
|
| 63 |
+
in_channels=256,
|
| 64 |
+
fc_out_channels=1024,
|
| 65 |
+
roi_feat_size=7,
|
| 66 |
+
num_classes=80,
|
| 67 |
+
bbox_coder=dict(
|
| 68 |
+
type='DeltaXYWHBBoxCoder',
|
| 69 |
+
target_means=[0., 0., 0., 0.],
|
| 70 |
+
target_stds=[0.1, 0.1, 0.2, 0.2]),
|
| 71 |
+
reg_class_agnostic=True,
|
| 72 |
+
loss_cls=dict(
|
| 73 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 74 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)),
|
| 75 |
+
dict(
|
| 76 |
+
type='Shared2FCBBoxHead',
|
| 77 |
+
# num_fcs=2,
|
| 78 |
+
in_channels=256,
|
| 79 |
+
fc_out_channels=1024,
|
| 80 |
+
roi_feat_size=7,
|
| 81 |
+
num_classes=80,
|
| 82 |
+
bbox_coder=dict(
|
| 83 |
+
type='DeltaXYWHBBoxCoder',
|
| 84 |
+
target_means=[0., 0., 0., 0.],
|
| 85 |
+
target_stds=[0.05, 0.05, 0.1, 0.1]),
|
| 86 |
+
reg_class_agnostic=True,
|
| 87 |
+
loss_cls=dict(
|
| 88 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 89 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)),
|
| 90 |
+
dict(
|
| 91 |
+
type='Shared2FCBBoxHead',
|
| 92 |
+
# num_fcs=2,
|
| 93 |
+
in_channels=256,
|
| 94 |
+
fc_out_channels=1024,
|
| 95 |
+
roi_feat_size=7,
|
| 96 |
+
num_classes=80,
|
| 97 |
+
bbox_coder=dict(
|
| 98 |
+
type='DeltaXYWHBBoxCoder',
|
| 99 |
+
target_means=[0., 0., 0., 0.],
|
| 100 |
+
target_stds=[0.033, 0.033, 0.067, 0.067]),
|
| 101 |
+
reg_class_agnostic=True,
|
| 102 |
+
loss_cls=dict(
|
| 103 |
+
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
|
| 104 |
+
loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))
|
| 105 |
+
],
|
| 106 |
+
mask_roi_extractor=dict(
|
| 107 |
+
type='SingleRoIExtractor',
|
| 108 |
+
roi_layer=dict(type='RoIAlign', out_size=14, sample_num=2),
|
| 109 |
+
out_channels=256,
|
| 110 |
+
featmap_strides=[4, 8, 16, 32]),
|
| 111 |
+
mask_head=dict(
|
| 112 |
+
type='FCNMaskHead',
|
| 113 |
+
num_convs=4,
|
| 114 |
+
in_channels=256,
|
| 115 |
+
conv_out_channels=256,
|
| 116 |
+
num_classes=80,
|
| 117 |
+
loss_mask=dict(
|
| 118 |
+
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)))
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
# model training and testing settings
|
| 122 |
+
train_cfg = dict(
|
| 123 |
+
rpn=dict(
|
| 124 |
+
assigner=dict(
|
| 125 |
+
type='MaxIoUAssigner',
|
| 126 |
+
pos_iou_thr=0.7,
|
| 127 |
+
neg_iou_thr=0.3,
|
| 128 |
+
min_pos_iou=0.3,
|
| 129 |
+
ignore_iof_thr=-1),
|
| 130 |
+
sampler=dict(
|
| 131 |
+
type='RandomSampler',
|
| 132 |
+
num=256,
|
| 133 |
+
pos_fraction=0.5,
|
| 134 |
+
neg_pos_ub=-1,
|
| 135 |
+
add_gt_as_proposals=False),
|
| 136 |
+
allowed_border=0,
|
| 137 |
+
pos_weight=-1,
|
| 138 |
+
debug=False),
|
| 139 |
+
rpn_proposal=dict(
|
| 140 |
+
nms_across_levels=False,
|
| 141 |
+
nms_pre=2000,
|
| 142 |
+
nms_post=2000,
|
| 143 |
+
max_num=2000,
|
| 144 |
+
nms_thr=0.7,
|
| 145 |
+
nms=dict(type='nms', iou_threshold=0.7),
|
| 146 |
+
max_per_img=2000,
|
| 147 |
+
min_bbox_size=0),
|
| 148 |
+
rcnn=[
|
| 149 |
+
dict(
|
| 150 |
+
assigner=dict(
|
| 151 |
+
type='MaxIoUAssigner',
|
| 152 |
+
pos_iou_thr=0.5,
|
| 153 |
+
neg_iou_thr=0.5,
|
| 154 |
+
min_pos_iou=0.5,
|
| 155 |
+
ignore_iof_thr=-1),
|
| 156 |
+
sampler=dict(
|
| 157 |
+
type='RandomSampler',
|
| 158 |
+
num=512,
|
| 159 |
+
pos_fraction=0.25,
|
| 160 |
+
neg_pos_ub=-1,
|
| 161 |
+
add_gt_as_proposals=True),
|
| 162 |
+
mask_size=28,
|
| 163 |
+
pos_weight=-1,
|
| 164 |
+
debug=False),
|
| 165 |
+
dict(
|
| 166 |
+
assigner=dict(
|
| 167 |
+
type='MaxIoUAssigner',
|
| 168 |
+
pos_iou_thr=0.6,
|
| 169 |
+
neg_iou_thr=0.6,
|
| 170 |
+
min_pos_iou=0.6,
|
| 171 |
+
ignore_iof_thr=-1),
|
| 172 |
+
sampler=dict(
|
| 173 |
+
type='RandomSampler',
|
| 174 |
+
num=512,
|
| 175 |
+
pos_fraction=0.25,
|
| 176 |
+
neg_pos_ub=-1,
|
| 177 |
+
add_gt_as_proposals=True),
|
| 178 |
+
mask_size=28,
|
| 179 |
+
pos_weight=-1,
|
| 180 |
+
debug=False),
|
| 181 |
+
dict(
|
| 182 |
+
assigner=dict(
|
| 183 |
+
type='MaxIoUAssigner',
|
| 184 |
+
pos_iou_thr=0.7,
|
| 185 |
+
neg_iou_thr=0.7,
|
| 186 |
+
min_pos_iou=0.7,
|
| 187 |
+
ignore_iof_thr=-1),
|
| 188 |
+
sampler=dict(
|
| 189 |
+
type='RandomSampler',
|
| 190 |
+
num=512,
|
| 191 |
+
pos_fraction=0.25,
|
| 192 |
+
neg_pos_ub=-1,
|
| 193 |
+
add_gt_as_proposals=True),
|
| 194 |
+
mask_size=28,
|
| 195 |
+
pos_weight=-1,
|
| 196 |
+
debug=False)
|
| 197 |
+
],
|
| 198 |
+
stage_loss_weights=[1, 0.5, 0.25])
|
| 199 |
+
test_cfg = dict(
|
| 200 |
+
rpn=dict(
|
| 201 |
+
nms_across_levels=False,
|
| 202 |
+
nms_pre=1000,
|
| 203 |
+
nms_post=1000,
|
| 204 |
+
max_num=1000,
|
| 205 |
+
nms_thr=0.7,
|
| 206 |
+
nms=dict(type='nms', iou_threshold=0.7),
|
| 207 |
+
max_per_img=1000,
|
| 208 |
+
min_bbox_size=0),
|
| 209 |
+
rcnn=dict(
|
| 210 |
+
score_thr=0.05,
|
| 211 |
+
nms=dict(type='nms', iou_thr=0.5),
|
| 212 |
+
max_per_img=100,
|
| 213 |
+
mask_thr_binary=0.5))
|
| 214 |
+
# dataset settings
|
| 215 |
+
dataset_type = 'CocoDataset'
|
| 216 |
+
data_root = '/content/drive/My Drive/Mmdetection/'
|
| 217 |
+
img_norm_cfg = dict(
|
| 218 |
+
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
|
| 219 |
+
train_pipeline = [
|
| 220 |
+
dict(type='LoadImageFromFile'),
|
| 221 |
+
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
|
| 222 |
+
dict(type='Resize', img_scale=(1333, 800), keep_ratio=True),
|
| 223 |
+
dict(type='RandomFlip', flip_ratio=0.5),
|
| 224 |
+
dict(type='Normalize', **img_norm_cfg),
|
| 225 |
+
dict(type='Pad', size_divisor=32),
|
| 226 |
+
dict(type='DefaultFormatBundle'),
|
| 227 |
+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels', 'gt_masks']),
|
| 228 |
+
]
|
| 229 |
+
test_pipeline = [
|
| 230 |
+
dict(type='LoadImageFromFile'),
|
| 231 |
+
dict(
|
| 232 |
+
type='MultiScaleFlipAug',
|
| 233 |
+
img_scale=(1333, 800),
|
| 234 |
+
flip=False,
|
| 235 |
+
transforms=[
|
| 236 |
+
dict(type='Resize', keep_ratio=True),
|
| 237 |
+
dict(type='RandomFlip'),
|
| 238 |
+
dict(type='Normalize', **img_norm_cfg),
|
| 239 |
+
dict(type='Pad', size_divisor=32),
|
| 240 |
+
dict(type='ImageToTensor', keys=['img']),
|
| 241 |
+
dict(type='Collect', keys=['img']),
|
| 242 |
+
])
|
| 243 |
+
]
|
| 244 |
+
data = dict(
|
| 245 |
+
imgs_per_gpu=2,
|
| 246 |
+
workers_per_gpu=2,
|
| 247 |
+
train=dict(
|
| 248 |
+
type=dataset_type,
|
| 249 |
+
ann_file='/content/drive/My Drive/chunk.json',
|
| 250 |
+
img_prefix='/content/drive/My Drive/chunk_images/',
|
| 251 |
+
pipeline=train_pipeline),
|
| 252 |
+
val=dict(
|
| 253 |
+
type=dataset_type,
|
| 254 |
+
ann_file=data_root + 'VOC2007/test.json',
|
| 255 |
+
img_prefix=data_root + 'VOC2007/Test/',
|
| 256 |
+
pipeline=test_pipeline),
|
| 257 |
+
test=dict(
|
| 258 |
+
type=dataset_type,
|
| 259 |
+
ann_file=data_root + 'VOC2007/test.json',
|
| 260 |
+
img_prefix=data_root + 'VOC2007/Test/',
|
| 261 |
+
pipeline=test_pipeline))
|
| 262 |
+
# evaluation = dict(interval=1, metric=['bbox'])
|
| 263 |
+
# optimizer
|
| 264 |
+
optimizer = dict(type='SGD', lr=0.0012, momentum=0.9, weight_decay=0.0001)
|
| 265 |
+
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
|
| 266 |
+
# learning policy
|
| 267 |
+
lr_config = dict(
|
| 268 |
+
policy='step',
|
| 269 |
+
warmup='linear',
|
| 270 |
+
warmup_iters=500,
|
| 271 |
+
warmup_ratio=1.0 / 3,
|
| 272 |
+
step=[16, 19])
|
| 273 |
+
checkpoint_config = dict(interval=1,create_symlink=False)
|
| 274 |
+
# yapf:disable
|
| 275 |
+
log_config = dict(
|
| 276 |
+
interval=50,
|
| 277 |
+
hooks=[
|
| 278 |
+
dict(type='TextLoggerHook'),
|
| 279 |
+
# dict(type='TensorboardLoggerHook')
|
| 280 |
+
])
|
| 281 |
+
# yapf:enable
|
| 282 |
+
# runtime settings
|
| 283 |
+
total_epochs = 36
|
| 284 |
+
dist_params = dict(backend='nccl')
|
| 285 |
+
log_level = 'INFO'
|
| 286 |
+
work_dir = '/content/drive/My Drive/Mmdetection/new_chunk_cascade_mask_rcnn_hrnetv2p_w32_20e'
|
| 287 |
+
load_from = None
|
| 288 |
+
resume_from = '/content/drive/My Drive/Mmdetection/new_chunk_cascade_mask_rcnn_hrnetv2p_w32_20e/epoch_30.pth'
|
| 289 |
+
workflow = [('train', 1)]
|
epoch_36.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7d6db8dc5d8d7b041d4086b26d7bd5d1b65411e2fdc1cd862816ab51ddab7686
|
| 3 |
+
size 663519823
|