xiaofanghf commited on
Commit
0878892
·
verified ·
1 Parent(s): 1280e34

Delete FasterRCNN/configs/faster_rcnn/faster-rcnn_r50_fpn_2x_coco_ReLINZ_112px_RndSmpl_Imgs:all_Anno:small-only_Augm_Val:LINZ.py

Browse files
FasterRCNN/configs/faster_rcnn/faster-rcnn_r50_fpn_2x_coco_ReLINZ_112px_RndSmpl_Imgs:all_Anno:small-only_Augm_Val:LINZ.py DELETED
@@ -1,412 +0,0 @@
1
- _base_ = [
2
- '../_base_/models/faster-rcnn_r50_fpn.py',
3
- '../_base_/datasets/coco_detection.py',
4
- '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'
5
- ]
6
-
7
-
8
-
9
- # TRAIN DATASET
10
- data_root_train = '/var/storage/Common/SatelliteVehicles/Datasets/Real/Real-LINZ_112px_0.125m_RndSmpl_Imgs:all_Anno:small-only/train/'
11
-
12
- # VAL DATASET
13
- # data_root_val = '/var/storage/Common/SatelliteVehicles/Datasets/Real/Real-LINZ_112px_0.125m_RndSmpl_Imgs:all_Anno:small-only/validation/'
14
- data_root_val = '/var/storage/Common/SatelliteVehicles/Datasets/Real/Real-LINZ_112px_0.125m_RndSmpl_Imgs:all_Anno:small-only/validation_subset025.0_seed0/'
15
-
16
- # TEST DATASET
17
- ## LINZ
18
- data_root_test = '/var/storage/Common/SatelliteVehicles/Datasets/Real/Real-LINZ_112px_0.125m_RndSmpl_Imgs:all_Anno:small-only/test/'
19
-
20
- ## Utah
21
- # data_root_test = '/var/storage/Common/SatelliteVehicles/Datasets/Real/Real-Utah_112px_0.125m_RndSmpl_Imgs:all_Anno:small-only/test/'
22
-
23
-
24
- max_epochs = 1000 # 40
25
- train_batch_size_per_gpu = 64
26
- validation_batch_size_per_gpu = 64
27
- test_batch_size_per_gpu = 64
28
- num_workers = 8
29
-
30
-
31
- class_name = ('small',)
32
- num_classes = len(class_name)
33
- metainfo = dict(classes=class_name, palette=[(20, 220, 60)])
34
-
35
- img_scale = (128, 128)
36
-
37
- affine_scale = 0.9
38
-
39
- load_from = 'https://download.openxlab.org.cn/models/mmdetection/FasterR-CNN/weight/faster-rcnn_r50_fpn_2x_coco'
40
-
41
-
42
- # model settings
43
- model = dict(
44
- type='FasterRCNN',
45
- data_preprocessor=dict(
46
- type='DetDataPreprocessor',
47
- mean=[123.675, 116.28, 103.53],
48
- std=[58.395, 57.12, 57.375],
49
- bgr_to_rgb=True,
50
- pad_size_divisor=32),
51
- backbone=dict(
52
- type='ResNet',
53
- depth=50,
54
- num_stages=4,
55
- out_indices=(0, 1, 2, 3),
56
- frozen_stages=1,
57
- norm_cfg=dict(type='BN', requires_grad=True),
58
- norm_eval=True,
59
- style='pytorch',
60
- init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
61
- neck=dict(
62
- type='FPN',
63
- in_channels=[256, 512, 1024, 2048],
64
- out_channels=256,
65
- num_outs=5),
66
- rpn_head=dict(
67
- type='RPNHead',
68
- in_channels=256,
69
- feat_channels=256,
70
- anchor_generator=dict(
71
- type='AnchorGenerator',
72
- scales=[8],
73
- ratios=[0.5, 1.0, 2.0],
74
- strides=[4, 8, 16, 32, 64]),
75
- bbox_coder=dict(
76
- type='DeltaXYWHBBoxCoder',
77
- target_means=[.0, .0, .0, .0],
78
- target_stds=[1.0, 1.0, 1.0, 1.0]),
79
- loss_cls=dict(
80
- type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
81
- loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
82
- roi_head=dict(
83
- type='StandardRoIHead',
84
- bbox_roi_extractor=dict(
85
- type='SingleRoIExtractor',
86
- roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0),
87
- out_channels=256,
88
- featmap_strides=[4, 8, 16, 32]),
89
- bbox_head=dict(
90
- type='Shared2FCBBoxHead',
91
- in_channels=256,
92
- fc_out_channels=1024,
93
- roi_feat_size=7,
94
- num_classes=num_classes,
95
- bbox_coder=dict(
96
- type='DeltaXYWHBBoxCoder',
97
- target_means=[0., 0., 0., 0.],
98
- target_stds=[0.1, 0.1, 0.2, 0.2]),
99
- reg_class_agnostic=False,
100
- loss_cls=dict(
101
- type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
102
- loss_bbox=dict(type='L1Loss', loss_weight=1.0))),
103
- # model training and testing settings
104
- train_cfg=dict(
105
- rpn=dict(
106
- assigner=dict(
107
- type='MaxIoUAssigner',
108
- pos_iou_thr=0.7,
109
- neg_iou_thr=0.3,
110
- min_pos_iou=0.3,
111
- match_low_quality=True,
112
- ignore_iof_thr=-1),
113
- sampler=dict(
114
- type='RandomSampler',
115
- num=256,
116
- pos_fraction=0.5,
117
- neg_pos_ub=-1,
118
- add_gt_as_proposals=False),
119
- allowed_border=-1,
120
- pos_weight=-1,
121
- debug=False),
122
- rpn_proposal=dict(
123
- nms_pre=2000,
124
- max_per_img=1000,
125
- nms=dict(type='nms', iou_threshold=0.7),
126
- min_bbox_size=0),
127
- rcnn=dict(
128
- assigner=dict(
129
- type='MaxIoUAssigner',
130
- pos_iou_thr=0.5,
131
- neg_iou_thr=0.5,
132
- min_pos_iou=0.5,
133
- match_low_quality=False,
134
- ignore_iof_thr=-1),
135
- sampler=dict(
136
- type='RandomSampler',
137
- num=512,
138
- pos_fraction=0.25,
139
- neg_pos_ub=-1,
140
- add_gt_as_proposals=True),
141
- pos_weight=-1,
142
- debug=False)),
143
- test_cfg=dict(
144
- rpn=dict(
145
- nms_pre=1000,
146
- max_per_img=1000,
147
- nms=dict(type='nms', iou_threshold=0.7),
148
- min_bbox_size=0),
149
- rcnn=dict(
150
- score_thr=0.05,
151
- nms=dict(type='nms', iou_threshold=0.5),
152
- max_per_img=100)
153
- # soft-nms is also supported for rcnn testing
154
- # e.g., nms=dict(type='soft_nms', iou_threshold=0.5, min_score=0.05)
155
- ))
156
-
157
-
158
-
159
- dataset_type = 'CocoDataset'
160
-
161
- backend_args = None
162
-
163
- # Original
164
- # train_pipeline = [
165
- # dict(type='LoadImageFromFile', backend_args=backend_args),
166
- # dict(type='LoadAnnotations', with_bbox=True),
167
- # dict(type='Resize', scale=img_scale, keep_ratio=True),
168
- # dict(type='RandomFlip', prob=0.5),
169
- # dict(type='PackDetInputs')
170
- # ]
171
-
172
- pre_transform = [
173
- dict(type='LoadImageFromFile', backend_args=backend_args),
174
- dict(type='LoadAnnotations', with_bbox=True)
175
- ]
176
-
177
- albu_train_transforms = [
178
- dict(type='Blur', p=0.01),
179
- dict(type='MedianBlur', p=0.01),
180
- dict(type='ToGray', p=0.01),
181
- dict(type='CLAHE', p=0.01)
182
- ]
183
-
184
- last_transform = [
185
- dict(
186
- type='Albu',
187
- transforms=albu_train_transforms,
188
- bbox_params=dict(
189
- type='BboxParams',
190
- format='pascal_voc',
191
- label_fields=['gt_bboxes_labels', 'gt_ignore_flags']),
192
- keymap={
193
- 'img': 'image',
194
- 'gt_bboxes': 'bboxes'
195
- }),
196
- dict(type='YOLOXHSVRandomAug'), # ???
197
- dict(type='RandomFlip', prob=0.5),
198
- dict(
199
- type='PackDetInputs',
200
- meta_keys=(
201
- 'img_id',
202
- 'img_path',
203
- 'ori_shape',
204
- 'img_shape',
205
- 'flip',
206
- 'flip_direction'
207
- )
208
- )
209
- ]
210
-
211
- mosaic_affine_transform = [
212
- dict(
213
- type='Mosaic',
214
- img_scale=img_scale,
215
- pad_val=114.0,
216
- ),
217
- dict(
218
- type='RandomAffine',
219
- max_rotate_degree=0.0,
220
- max_shear_degree=0.0,
221
- scaling_ratio_range=(1 - affine_scale, 1 + affine_scale),
222
- # img_scale is (width, height)
223
- border=(-img_scale[0] // 2, -img_scale[1] // 2),
224
- border_val=(114, 114, 114))
225
- ]
226
-
227
- train_pipeline = [
228
- *pre_transform,
229
- *mosaic_affine_transform,
230
- dict(
231
- type='MixUp',
232
- img_scale=img_scale,
233
- ),
234
- *last_transform
235
- ]
236
-
237
-
238
- # Original
239
- # train_dataloader = dict(
240
- # batch_size=train_batch_size_per_gpu,
241
- # num_workers=num_workers,
242
- # persistent_workers=True,
243
- # sampler=dict(type='DefaultSampler', shuffle=True),
244
- # batch_sampler=dict(type='AspectRatioBatchSampler'),
245
- # dataset=dict(
246
- # type=dataset_type,
247
- # data_root=data_root_train,
248
- # ann_file='annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500_BalancedRatio:0.2000.json',
249
- # data_prefix=dict(img='images/'),
250
- # filter_cfg=dict(filter_empty_gt=False, min_size=32),
251
- # pipeline=train_pipeline,
252
- # metainfo=metainfo,
253
- # backend_args=backend_args
254
- # )
255
- # )
256
-
257
- train_dataloader = dict(
258
- batch_size=train_batch_size_per_gpu,
259
- num_workers=num_workers,
260
- persistent_workers=True,
261
- sampler=dict(type='DefaultSampler', shuffle=True),
262
- batch_sampler=dict(type='AspectRatioBatchSampler'),
263
- dataset=dict(
264
- _delete_=True,
265
- type='MultiImageMixDataset',
266
- dataset=dict(
267
- type=dataset_type,
268
- data_root=data_root_train,
269
- # ann_file='annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500.json',
270
- ann_file='annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500_BalancedRatio:0.2000.json',
271
- data_prefix=dict(img='images/'),
272
- filter_cfg=dict(filter_empty_gt=False, min_size=32),
273
- metainfo=metainfo,
274
- backend_args=backend_args,
275
- pipeline=pre_transform
276
- ),
277
- pipeline=train_pipeline,
278
- )
279
- )
280
-
281
-
282
-
283
- test_pipeline = [
284
- dict(type='LoadImageFromFile', backend_args=backend_args),
285
- dict(type='Resize', scale=img_scale, keep_ratio=True),
286
- # If you don't have a gt annotation, delete the pipeline
287
- dict(type='LoadAnnotations', with_bbox=True),
288
- dict(
289
- type='PackDetInputs',
290
- meta_keys=(
291
- 'img_id', 'img_path', 'ori_shape', 'img_shape',
292
- 'scale_factor'
293
- )
294
- )
295
- ]
296
-
297
-
298
- val_dataloader = dict(
299
- batch_size=validation_batch_size_per_gpu,
300
- num_workers=num_workers,
301
- persistent_workers=True,
302
- drop_last=False,
303
- sampler=dict(type='DefaultSampler', shuffle=False),
304
- dataset=dict(
305
- type=dataset_type,
306
- data_root=data_root_val,
307
- ann_file='annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500.json',
308
- data_prefix=dict(img='images/'),
309
- filter_cfg=dict(filter_empty_gt=False, min_size=32),
310
- test_mode=True,
311
- pipeline=test_pipeline,
312
- metainfo=metainfo,
313
- backend_args=backend_args
314
- )
315
- )
316
-
317
- test_dataloader = dict(
318
- batch_size=test_batch_size_per_gpu,
319
- num_workers=num_workers,
320
- persistent_workers=True,
321
- drop_last=False,
322
- sampler=dict(type='DefaultSampler', shuffle=False),
323
- dataset=dict(
324
- type=dataset_type,
325
- data_root=data_root_test,
326
- ann_file='annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500.json',
327
- data_prefix=dict(img='images/'),
328
- filter_cfg=dict(filter_empty_gt=False, min_size=32),
329
- test_mode=True,
330
- pipeline=test_pipeline,
331
- metainfo=metainfo,
332
- backend_args=backend_args
333
- )
334
- )
335
-
336
- # test_dataloader = val_dataloader
337
-
338
- val_evaluator = dict(
339
- type='CocoMetric',
340
- ann_file=data_root_val + 'annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500.json',
341
- metric='bbox',
342
- format_only=False,
343
- backend_args=backend_args
344
- )
345
-
346
- test_evaluator = dict(
347
- type='CocoMetric',
348
- ann_file=data_root_test + 'annotations_coco_FakeBBoxes:42.36px_ForIoU:0.500.json',
349
- metric='bbox',
350
- format_only=False,
351
- backend_args=backend_args
352
- )
353
-
354
- # test_evaluator = val_evaluator
355
-
356
-
357
-
358
- # training schedule for 2x
359
- train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=max_epochs, val_interval=1)
360
- val_cfg = dict(type='ValLoop')
361
- test_cfg = dict(type='TestLoop')
362
-
363
- # learning rate
364
- param_scheduler = [
365
- dict(
366
- type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500),
367
- dict(
368
- type='MultiStepLR',
369
- begin=0,
370
- end=max_epochs,
371
- by_epoch=True,
372
- milestones=[16, 22],
373
- gamma=0.1)
374
- ]
375
-
376
- # optimizer
377
- optim_wrapper = dict(
378
- type='OptimWrapper',
379
- optimizer=dict(
380
- type='SGD',
381
- lr=0.2,
382
- momentum=0.9,
383
- weight_decay=0.0001
384
- )
385
- )
386
-
387
- # Default setting for scaling LR automatically
388
- # - `enable` means enable scaling LR automatically
389
- # or not by default.
390
- # - `base_batch_size` = (8 GPUs) x (2 samples per GPU)
391
- auto_scale_lr = dict(enable=False, base_batch_size=train_batch_size_per_gpu)
392
-
393
-
394
- default_hooks = dict(
395
- checkpoint=dict(
396
- interval=1,
397
- max_keep_ckpts=1,
398
- save_best=['coco/bbox_mAP', 'coco/bbox_mAP_50']
399
- ),
400
- # The warmup_mim_iter parameter is critical.
401
- # The default value is 1000 which is not suitable for cat datasets.
402
- # param_scheduler=dict(
403
- # max_epochs=max_epochs,
404
- # warmup_mim_iter=1000,
405
- # lr_factor=lr_factor
406
- # ),
407
- logger=dict(type='LoggerHook', interval=5))
408
-
409
- vis_backends = [dict(type='LocalVisBackend'), dict(type='TensorboardVisBackend')]
410
- visualizer = dict(
411
- type='DetLocalVisualizer', vis_backends=vis_backends, name='visualizer')
412
-