fparodi commited on
Commit
c678d14
·
verified ·
1 Parent(s): a329652

Upload detection/cascade_rcnn_r101_fpn_config.py with huggingface_hub

Browse files
detection/cascade_rcnn_r101_fpn_config.py ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ auto_scale_lr = dict(base_batch_size=16, enable=False)
2
+ backend_args = None
3
+ data_root = './'
4
+ dataset_type = 'CocoDataset'
5
+ default_hooks = dict(
6
+ checkpoint=dict(
7
+ interval=1, max_keep_ckpts=1, save_best='auto', type='CheckpointHook'),
8
+ logger=dict(interval=50, type='LoggerHook'),
9
+ param_scheduler=dict(type='ParamSchedulerHook'),
10
+ sampler_seed=dict(type='DistSamplerSeedHook'),
11
+ timer=dict(type='IterTimerHook'),
12
+ visualization=dict(type='DetVisualizationHook'))
13
+ default_scope = 'mmdet'
14
+ env_cfg = dict(
15
+ cudnn_benchmark=False,
16
+ dist_cfg=dict(backend='nccl'),
17
+ mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
18
+ launcher = 'none'
19
+ load_from = '.\\best_coco_bbox_mAP_epoch_12.pth'
20
+ log_level = 'INFO'
21
+ log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50)
22
+ model = dict(
23
+ backbone=dict(
24
+ depth=101,
25
+ frozen_stages=1,
26
+ init_cfg=dict(checkpoint='torchvision://resnet101', type='Pretrained'),
27
+ norm_cfg=dict(requires_grad=True, type='BN'),
28
+ norm_eval=True,
29
+ num_stages=4,
30
+ out_indices=(
31
+ 0,
32
+ 1,
33
+ 2,
34
+ 3,
35
+ ),
36
+ style='pytorch',
37
+ type='ResNet'),
38
+ data_preprocessor=dict(
39
+ bgr_to_rgb=True,
40
+ mean=[
41
+ 123.675,
42
+ 116.28,
43
+ 103.53,
44
+ ],
45
+ pad_size_divisor=32,
46
+ std=[
47
+ 58.395,
48
+ 57.12,
49
+ 57.375,
50
+ ],
51
+ type='DetDataPreprocessor'),
52
+ neck=dict(
53
+ in_channels=[
54
+ 256,
55
+ 512,
56
+ 1024,
57
+ 2048,
58
+ ],
59
+ num_outs=5,
60
+ out_channels=256,
61
+ type='FPN'),
62
+ roi_head=dict(
63
+ bbox_head=[
64
+ dict(
65
+ bbox_coder=dict(
66
+ target_means=[
67
+ 0.0,
68
+ 0.0,
69
+ 0.0,
70
+ 0.0,
71
+ ],
72
+ target_stds=[
73
+ 0.1,
74
+ 0.1,
75
+ 0.2,
76
+ 0.2,
77
+ ],
78
+ type='DeltaXYWHBBoxCoder'),
79
+ fc_out_channels=1024,
80
+ in_channels=256,
81
+ loss_bbox=dict(beta=1.0, loss_weight=1.0, type='SmoothL1Loss'),
82
+ loss_cls=dict(
83
+ loss_weight=1.0,
84
+ type='CrossEntropyLoss',
85
+ use_sigmoid=False),
86
+ num_classes=80,
87
+ reg_class_agnostic=True,
88
+ roi_feat_size=7,
89
+ type='Shared2FCBBoxHead'),
90
+ dict(
91
+ bbox_coder=dict(
92
+ target_means=[
93
+ 0.0,
94
+ 0.0,
95
+ 0.0,
96
+ 0.0,
97
+ ],
98
+ target_stds=[
99
+ 0.05,
100
+ 0.05,
101
+ 0.1,
102
+ 0.1,
103
+ ],
104
+ type='DeltaXYWHBBoxCoder'),
105
+ fc_out_channels=1024,
106
+ in_channels=256,
107
+ loss_bbox=dict(beta=1.0, loss_weight=1.0, type='SmoothL1Loss'),
108
+ loss_cls=dict(
109
+ loss_weight=1.0,
110
+ type='CrossEntropyLoss',
111
+ use_sigmoid=False),
112
+ num_classes=80,
113
+ reg_class_agnostic=True,
114
+ roi_feat_size=7,
115
+ type='Shared2FCBBoxHead'),
116
+ dict(
117
+ bbox_coder=dict(
118
+ target_means=[
119
+ 0.0,
120
+ 0.0,
121
+ 0.0,
122
+ 0.0,
123
+ ],
124
+ target_stds=[
125
+ 0.033,
126
+ 0.033,
127
+ 0.067,
128
+ 0.067,
129
+ ],
130
+ type='DeltaXYWHBBoxCoder'),
131
+ fc_out_channels=1024,
132
+ in_channels=256,
133
+ loss_bbox=dict(beta=1.0, loss_weight=1.0, type='SmoothL1Loss'),
134
+ loss_cls=dict(
135
+ loss_weight=1.0,
136
+ type='CrossEntropyLoss',
137
+ use_sigmoid=False),
138
+ num_classes=80,
139
+ reg_class_agnostic=True,
140
+ roi_feat_size=7,
141
+ type='Shared2FCBBoxHead'),
142
+ ],
143
+ bbox_roi_extractor=dict(
144
+ featmap_strides=[
145
+ 4,
146
+ 8,
147
+ 16,
148
+ 32,
149
+ ],
150
+ out_channels=256,
151
+ roi_layer=dict(output_size=7, sampling_ratio=0, type='RoIAlign'),
152
+ type='SingleRoIExtractor'),
153
+ num_stages=3,
154
+ stage_loss_weights=[
155
+ 1,
156
+ 0.5,
157
+ 0.25,
158
+ ],
159
+ type='CascadeRoIHead'),
160
+ rpn_head=dict(
161
+ anchor_generator=dict(
162
+ ratios=[
163
+ 0.5,
164
+ 1.0,
165
+ 2.0,
166
+ ],
167
+ scales=[
168
+ 8,
169
+ ],
170
+ strides=[
171
+ 4,
172
+ 8,
173
+ 16,
174
+ 32,
175
+ 64,
176
+ ],
177
+ type='AnchorGenerator'),
178
+ bbox_coder=dict(
179
+ target_means=[
180
+ 0.0,
181
+ 0.0,
182
+ 0.0,
183
+ 0.0,
184
+ ],
185
+ target_stds=[
186
+ 1.0,
187
+ 1.0,
188
+ 1.0,
189
+ 1.0,
190
+ ],
191
+ type='DeltaXYWHBBoxCoder'),
192
+ feat_channels=256,
193
+ in_channels=256,
194
+ loss_bbox=dict(
195
+ beta=0.1111111111111111, loss_weight=1.0, type='SmoothL1Loss'),
196
+ loss_cls=dict(
197
+ loss_weight=1.0, type='CrossEntropyLoss', use_sigmoid=True),
198
+ type='RPNHead'),
199
+ test_cfg=dict(
200
+ rcnn=dict(
201
+ max_per_img=100,
202
+ nms=dict(iou_threshold=0.5, type='nms'),
203
+ score_thr=0.05),
204
+ rpn=dict(
205
+ max_per_img=1000,
206
+ min_bbox_size=0,
207
+ nms=dict(iou_threshold=0.7, type='nms'),
208
+ nms_pre=1000)),
209
+ train_cfg=dict(
210
+ rcnn=[
211
+ dict(
212
+ assigner=dict(
213
+ ignore_iof_thr=-1,
214
+ match_low_quality=False,
215
+ min_pos_iou=0.5,
216
+ neg_iou_thr=0.5,
217
+ pos_iou_thr=0.5,
218
+ type='MaxIoUAssigner'),
219
+ debug=False,
220
+ pos_weight=-1,
221
+ sampler=dict(
222
+ add_gt_as_proposals=True,
223
+ neg_pos_ub=-1,
224
+ num=512,
225
+ pos_fraction=0.25,
226
+ type='RandomSampler')),
227
+ dict(
228
+ assigner=dict(
229
+ ignore_iof_thr=-1,
230
+ match_low_quality=False,
231
+ min_pos_iou=0.6,
232
+ neg_iou_thr=0.6,
233
+ pos_iou_thr=0.6,
234
+ type='MaxIoUAssigner'),
235
+ debug=False,
236
+ pos_weight=-1,
237
+ sampler=dict(
238
+ add_gt_as_proposals=True,
239
+ neg_pos_ub=-1,
240
+ num=512,
241
+ pos_fraction=0.25,
242
+ type='RandomSampler')),
243
+ dict(
244
+ assigner=dict(
245
+ ignore_iof_thr=-1,
246
+ match_low_quality=False,
247
+ min_pos_iou=0.7,
248
+ neg_iou_thr=0.7,
249
+ pos_iou_thr=0.7,
250
+ type='MaxIoUAssigner'),
251
+ debug=False,
252
+ pos_weight=-1,
253
+ sampler=dict(
254
+ add_gt_as_proposals=True,
255
+ neg_pos_ub=-1,
256
+ num=512,
257
+ pos_fraction=0.25,
258
+ type='RandomSampler')),
259
+ ],
260
+ rpn=dict(
261
+ allowed_border=0,
262
+ assigner=dict(
263
+ ignore_iof_thr=-1,
264
+ match_low_quality=True,
265
+ min_pos_iou=0.3,
266
+ neg_iou_thr=0.3,
267
+ pos_iou_thr=0.7,
268
+ type='MaxIoUAssigner'),
269
+ debug=False,
270
+ pos_weight=-1,
271
+ sampler=dict(
272
+ add_gt_as_proposals=False,
273
+ neg_pos_ub=-1,
274
+ num=256,
275
+ pos_fraction=0.5,
276
+ type='RandomSampler')),
277
+ rpn_proposal=dict(
278
+ max_per_img=2000,
279
+ min_bbox_size=0,
280
+ nms=dict(iou_threshold=0.7, type='nms'),
281
+ nms_pre=2000)),
282
+ type='CascadeRCNN')
283
+ optim_wrapper = dict(
284
+ loss_scale='dynamic',
285
+ optimizer=dict(lr=0.02, momentum=0.9, type='SGD', weight_decay=0.0001),
286
+ type='AmpOptimWrapper')
287
+ param_scheduler = [
288
+ dict(
289
+ begin=0, by_epoch=False, end=500, start_factor=0.001, type='LinearLR'),
290
+ dict(
291
+ begin=0,
292
+ by_epoch=True,
293
+ end=12,
294
+ gamma=0.1,
295
+ milestones=[
296
+ 8,
297
+ 11,
298
+ ],
299
+ type='MultiStepLR'),
300
+ ]
301
+ resume = False
302
+ test_cfg = dict(type='TestLoop')
303
+ test_dataloader = dict(
304
+ batch_size=4,
305
+ dataset=dict(
306
+ ann_file=
307
+ '.\\test.json',
308
+ backend_args=None,
309
+ pipeline=[
310
+ dict(backend_args=None, type='LoadImageFromFile'),
311
+ dict(keep_ratio=True, scale=(
312
+ 1333,
313
+ 800,
314
+ ), type='Resize'),
315
+ dict(type='LoadAnnotations', with_bbox=True),
316
+ dict(
317
+ meta_keys=(
318
+ 'img_id',
319
+ 'img_path',
320
+ 'ori_shape',
321
+ 'img_shape',
322
+ 'scale_factor',
323
+ ),
324
+ type='PackDetInputs'),
325
+ ],
326
+ test_mode=True,
327
+ type='CocoDataset'),
328
+ drop_last=False,
329
+ num_workers=4,
330
+ persistent_workers=True,
331
+ sampler=dict(shuffle=False, type='DefaultSampler'))
332
+ test_evaluator = dict(
333
+ ann_file=
334
+ '.\\test.json',
335
+ backend_args=None,
336
+ format_only=False,
337
+ metric='bbox',
338
+ type='CocoMetric')
339
+ test_pipeline = [
340
+ dict(backend_args=None, type='LoadImageFromFile'),
341
+ dict(keep_ratio=True, scale=(
342
+ 1333,
343
+ 800,
344
+ ), type='Resize'),
345
+ dict(type='LoadAnnotations', with_bbox=True),
346
+ dict(
347
+ meta_keys=(
348
+ 'img_id',
349
+ 'img_path',
350
+ 'ori_shape',
351
+ 'img_shape',
352
+ 'scale_factor',
353
+ ),
354
+ type='PackDetInputs'),
355
+ ]
356
+ train_cfg = dict(max_epochs=12, type='EpochBasedTrainLoop', val_interval=1)
357
+ train_dataloader = dict(
358
+ batch_sampler=dict(type='AspectRatioBatchSampler'),
359
+ batch_size=4,
360
+ dataset=dict(
361
+ ann_file=
362
+ '.\\train.json',
363
+ backend_args=None,
364
+ filter_cfg=dict(filter_empty_gt=True, min_size=32),
365
+ pipeline=[
366
+ dict(backend_args=None, type='LoadImageFromFile'),
367
+ dict(type='LoadAnnotations', with_bbox=True),
368
+ dict(keep_ratio=True, scale=(
369
+ 1333,
370
+ 800,
371
+ ), type='Resize'),
372
+ dict(
373
+ direction=[
374
+ 'horizontal',
375
+ 'vertical',
376
+ ],
377
+ prob=0.5,
378
+ type='RandomFlip'),
379
+ dict(type='PackDetInputs'),
380
+ ],
381
+ type='CocoDataset'),
382
+ num_workers=4,
383
+ persistent_workers=True,
384
+ sampler=dict(shuffle=True, type='DefaultSampler'))
385
+ train_pipeline = [
386
+ dict(backend_args=None, type='LoadImageFromFile'),
387
+ dict(type='LoadAnnotations', with_bbox=True),
388
+ dict(keep_ratio=True, scale=(
389
+ 1333,
390
+ 800,
391
+ ), type='Resize'),
392
+ dict(direction=[
393
+ 'horizontal',
394
+ 'vertical',
395
+ ], prob=0.5, type='RandomFlip'),
396
+ dict(type='PackDetInputs'),
397
+ ]
398
+ val_cfg = dict(type='ValLoop')
399
+ val_dataloader = dict(
400
+ batch_size=4,
401
+ dataset=dict(
402
+ ann_file=
403
+ '.\\test.json',
404
+ backend_args=None,
405
+ pipeline=[
406
+ dict(backend_args=None, type='LoadImageFromFile'),
407
+ dict(keep_ratio=True, scale=(
408
+ 1333,
409
+ 800,
410
+ ), type='Resize'),
411
+ dict(type='LoadAnnotations', with_bbox=True),
412
+ dict(
413
+ meta_ckeys=(
414
+ 'img_id',
415
+ 'img_path',
416
+ 'ori_shape',
417
+ 'img_shape',
418
+ 'scale_factor',
419
+ ),
420
+ type='PackDetInputs'),
421
+ ],
422
+ test_mode=True,
423
+ type='CocoDataset'),
424
+ drop_last=False,
425
+ num_workers=4,
426
+ persistent_workers=True,
427
+ sampler=dict(shuffle=False, type='DefaultSampler'))
428
+ val_evaluator = dict(
429
+ ann_file=
430
+ '.\\test.json',
431
+ backend_args=None,
432
+ format_only=False,
433
+ metric='bbox',
434
+ type='CocoMetric')
435
+ vis_backends = [
436
+ dict(type='LocalVisBackend'),
437
+ ]
438
+ visualizer = dict(
439
+ name='visualizer',
440
+ type='DetLocalVisualizer',
441
+ vis_backends=[
442
+ dict(type='LocalVisBackend'),
443
+ ])
444
+ work_dir = './'