jeffaudi commited on
Commit
156088c
β€’
1 Parent(s): d56b026

Switching to Airbus training dataset

Browse files
.gitattributes CHANGED
@@ -35,3 +35,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  demo/Pleiades_HD15_Miami_Marina.jpg filter=lfs diff=lfs merge=lfs -text
37
  demo/Satellite_Image_Marina_New_Zealand.jpg filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  demo/Pleiades_HD15_Miami_Marina.jpg filter=lfs diff=lfs merge=lfs -text
37
  demo/Satellite_Image_Marina_New_Zealand.jpg filter=lfs diff=lfs merge=lfs -text
38
+ weights/best_mAP_epoch_20.pth filter=lfs diff=lfs merge=lfs -text
39
+ demo/836f35381.jpg filter=lfs diff=lfs merge=lfs -text
40
+ demo/848d2afef.jpg filter=lfs diff=lfs merge=lfs -text
41
+ demo/82f13510a.jpg filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1,4 +1,5 @@
1
  run_docker.sh
2
  **/.ipynb_checkpoints/
3
  **/__pycache__
4
- Makefile
 
 
1
  run_docker.sh
2
  **/.ipynb_checkpoints/
3
  **/__pycache__
4
+ **/.DS_Store
5
+ Makefile
README.md CHANGED
@@ -2,7 +2,7 @@
2
  title: Ship Detection in Optical Satellite Imagery
3
  emoji: 🚒
4
  colorFrom: purple
5
- colorTo: yellow
6
  sdk: docker
7
  pinned: false
8
  license: cc-by-nc-sa-4.0
 
2
  title: Ship Detection in Optical Satellite Imagery
3
  emoji: 🚒
4
  colorFrom: purple
5
+ colorTo: blue
6
  sdk: docker
7
  pinned: false
8
  license: cc-by-nc-sa-4.0
app.py CHANGED
@@ -23,13 +23,13 @@ MARGIN = OVERLAP / 2
23
  BATCH_SIZE = 16
24
 
25
  # CLASSES
26
- CLASSES = DOTADataset.CLASSES
27
 
28
  # Choose to use a config and initialize the detector
29
- config_file = 'oriented_rcnn_r50_fpn_1x_dota_le90.py'
30
 
31
  # Setup a checkpoint file to load
32
- weights_file = 'weights/oriented_rcnn_r50_fpn_1x_dota_le90-6d2b2ce0.pth'
33
 
34
  # check if GPU if available
35
  device = torch.device("cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu")
@@ -60,12 +60,8 @@ def predict_image(img, threshold):
60
  end_time = time.time()
61
  #print(result)
62
 
63
- # filter results
64
- SELECTED = 6
65
- result = [c if i == SELECTED else np.zeros((0, 6), dtype=np.float32) for i, c in enumerate(result)]
66
-
67
  # total number of predictions
68
- infos = count = np.sum(result[SELECTED][:, -1] > threshold)
69
 
70
  img_preds = model.show_result(img, result, score_thr=threshold, show=False)
71
  return img_preds, img.shape, infos, end_time - start_time
@@ -73,6 +69,9 @@ def predict_image(img, threshold):
73
 
74
  # Define example images and their true labels for users to choose from
75
  example_data = [
 
 
 
76
  ["./demo/Satellite_Image_Marina_New_Zealand.jpg", 0.4],
77
  ["./demo/Pleiades_HD15_Miami_Marina.jpg", 0.4],
78
  # Add more example images and labels as needed
@@ -116,7 +115,7 @@ with demo:
116
  label='Try these images!'
117
  )
118
 
119
- gr.Markdown("<p>This demo is provided by <a href='https://www.linkedin.com/in/faudi/'>Jeff Faudi</a> and <a href='https://www.dl4eo.com/'>DL4EO</a>. This model is based on the <a href='https://github.com/open-mmlab/mmrotate'>MMRotate framework</a> which provides oriented bounding boxes. We believe that oriented bouding boxes are better suited for detection in satellite images. This model has been trained on a combination of ships in VHR imagery datasets</p><p>The associated licenses are <a href='https://about.google/brand-resource-center/products-and-services/geo-guidelines/#google-earth-web-and-apps'>GoogleEarth fair use</a> and <a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en'>CC-BY-SA-NC</a>. This demonstration CANNOT be used for commercial puposes. Please contact <a href='mailto:jeff@dl4eo.com'>me</a> for more information on how you could get access to a commercial grade model or API. </p>")
120
 
121
 
122
  if os.path.exists('/.dockerenv'):
@@ -128,13 +127,13 @@ if os.path.exists('/.dockerenv'):
128
  demo.launch(
129
  server_name=hostname,
130
  inline=False,
131
- #server_port=7860,
132
  debug=True
133
  )
134
  else:
135
  print('Not running inside a Docker container')
136
  demo.launch(
137
  inline=False,
138
- #server_port=7860,
139
  debug=False
140
  )
 
23
  BATCH_SIZE = 16
24
 
25
  # CLASSES
26
+ CLASSES = ['ship',]
27
 
28
  # Choose to use a config and initialize the detector
29
+ config_file = 'redet_re50_refpn_1x_dota_ms_rr_le90.py'
30
 
31
  # Setup a checkpoint file to load
32
+ weights_file = 'weights/best_mAP_epoch_20.pth'
33
 
34
  # check if GPU if available
35
  device = torch.device("cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu")
 
60
  end_time = time.time()
61
  #print(result)
62
 
 
 
 
 
63
  # total number of predictions
64
+ infos = np.sum(result[0][:, -1] > threshold)
65
 
66
  img_preds = model.show_result(img, result, score_thr=threshold, show=False)
67
  return img_preds, img.shape, infos, end_time - start_time
 
69
 
70
  # Define example images and their true labels for users to choose from
71
  example_data = [
72
+ ["./demo/82f13510a.jpg", 0.75],
73
+ ["./demo/836f35381.jpg", 0.75],
74
+ ["./demo/848d2afef.jpg", 0.75],
75
  ["./demo/Satellite_Image_Marina_New_Zealand.jpg", 0.4],
76
  ["./demo/Pleiades_HD15_Miami_Marina.jpg", 0.4],
77
  # Add more example images and labels as needed
 
115
  label='Try these images!'
116
  )
117
 
118
+ gr.Markdown("<p>This demo is provided by <a href='https://www.linkedin.com/in/faudi/'>Jeff Faudi</a> and <a href='https://www.dl4eo.com/'>DL4EO</a>. This model is based on the <a href='https://github.com/open-mmlab/mmrotate'>MMRotate framework</a> which provides oriented bounding boxes. We believe that oriented bouding boxes are better suited for detection in satellite images. This model has been trained on Airbus Ship Detection available on Kaggle. The associated license is <a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en'>CC-BY-SA-NC</a>. This demonstration CANNOT be used for commercial puposes. Please contact <a href='mailto:jeff@dl4eo.com'>me</a> for more information on how you could get access to a commercial grade model or API. </p>")
119
 
120
 
121
  if os.path.exists('/.dockerenv'):
 
127
  demo.launch(
128
  server_name=hostname,
129
  inline=False,
130
+ server_port=7860,
131
  debug=True
132
  )
133
  else:
134
  print('Not running inside a Docker container')
135
  demo.launch(
136
  inline=False,
137
+ server_port=7860,
138
  debug=False
139
  )
weights/oriented_rcnn_r50_fpn_1x_dota_le90-6d2b2ce0.pth β†’ demo/82f13510a.jpg RENAMED
File without changes
demo/836f35381.jpg ADDED

Git LFS Details

  • SHA256: 93c43a689e0a343064860594b2119b55053efd1035272d867f16e554e337bfb8
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
demo/848d2afef.jpg ADDED

Git LFS Details

  • SHA256: a7dbaed644c2b6a990608155f29a9d875cc572e176ddf03a9e3224ef72c2f000
  • Pointer size: 131 Bytes
  • Size of remote file: 135 kB
oriented_rcnn_r50_fpn_1x_dota_le90.py β†’ redet_re50_refpn_1x_dota_ms_rr_le90.py RENAMED
@@ -1,20 +1,28 @@
1
- dataset_type = 'DOTADataset'
2
- data_root = 'data/split_1024_dota1_0/'
3
  img_norm_cfg = dict(
4
- mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
 
 
5
  train_pipeline = [
6
  dict(type='LoadImageFromFile'),
7
  dict(type='LoadAnnotations', with_bbox=True),
8
- dict(type='RResize', img_scale=(1024, 1024)),
9
  dict(
10
  type='RRandomFlip',
11
  flip_ratio=[0.25, 0.25, 0.25],
12
  direction=['horizontal', 'vertical', 'diagonal'],
13
  version='le90'),
 
 
 
 
 
 
14
  dict(
15
  type='Normalize',
16
- mean=[123.675, 116.28, 103.53],
17
- std=[58.395, 57.12, 57.375],
18
  to_rgb=True),
19
  dict(type='Pad', size_divisor=32),
20
  dict(type='DefaultFormatBundle'),
@@ -24,14 +32,14 @@ test_pipeline = [
24
  dict(type='LoadImageFromFile'),
25
  dict(
26
  type='MultiScaleFlipAug',
27
- img_scale=(1024, 1024),
28
  flip=False,
29
  transforms=[
30
- dict(type='RResize'),
31
  dict(
32
  type='Normalize',
33
- mean=[123.675, 116.28, 103.53],
34
- std=[58.395, 57.12, 57.375],
35
  to_rgb=True),
36
  dict(type='Pad', size_divisor=32),
37
  dict(type='DefaultFormatBundle'),
@@ -39,162 +47,209 @@ test_pipeline = [
39
  ])
40
  ]
41
  data = dict(
42
- samples_per_gpu=2,
43
- workers_per_gpu=2,
44
  train=dict(
45
- type='DOTADataset',
46
- ann_file='data/split_1024_dota1_0/trainval/annfiles/',
47
- img_prefix='data/split_1024_dota1_0/trainval/images/',
 
 
48
  pipeline=[
49
  dict(type='LoadImageFromFile'),
50
  dict(type='LoadAnnotations', with_bbox=True),
51
- dict(type='RResize', img_scale=(1024, 1024)),
52
  dict(
53
  type='RRandomFlip',
54
  flip_ratio=[0.25, 0.25, 0.25],
55
  direction=['horizontal', 'vertical', 'diagonal'],
56
  version='le90'),
 
 
 
 
 
 
57
  dict(
58
  type='Normalize',
59
- mean=[123.675, 116.28, 103.53],
60
- std=[58.395, 57.12, 57.375],
61
  to_rgb=True),
62
  dict(type='Pad', size_divisor=32),
63
  dict(type='DefaultFormatBundle'),
64
  dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
65
  ],
66
- version='le90'),
 
67
  val=dict(
68
- type='DOTADataset',
69
- ann_file='data/split_1024_dota1_0/trainval/annfiles/',
70
- img_prefix='data/split_1024_dota1_0/trainval/images/',
71
  pipeline=[
72
  dict(type='LoadImageFromFile'),
73
  dict(
74
  type='MultiScaleFlipAug',
75
- img_scale=(1024, 1024),
76
  flip=False,
77
  transforms=[
78
- dict(type='RResize'),
79
  dict(
80
  type='Normalize',
81
- mean=[123.675, 116.28, 103.53],
82
- std=[58.395, 57.12, 57.375],
83
  to_rgb=True),
84
  dict(type='Pad', size_divisor=32),
85
  dict(type='DefaultFormatBundle'),
86
  dict(type='Collect', keys=['img'])
87
  ])
88
  ],
89
- version='le90'),
 
90
  test=dict(
91
- type='DOTADataset',
92
- ann_file='data/split_1024_dota1_0/test/images/',
93
- img_prefix='data/split_1024_dota1_0/test/images/',
94
  pipeline=[
95
  dict(type='LoadImageFromFile'),
96
  dict(
97
  type='MultiScaleFlipAug',
98
- img_scale=(1024, 1024),
99
  flip=False,
100
  transforms=[
101
- dict(type='RResize'),
102
  dict(
103
  type='Normalize',
104
- mean=[123.675, 116.28, 103.53],
105
- std=[58.395, 57.12, 57.375],
106
  to_rgb=True),
107
  dict(type='Pad', size_divisor=32),
108
  dict(type='DefaultFormatBundle'),
109
  dict(type='Collect', keys=['img'])
110
  ])
111
  ],
112
- version='le90'))
113
- evaluation = dict(interval=1, metric='mAP')
114
- optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001)
 
115
  optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
116
  lr_config = dict(
117
- policy='step',
118
  warmup='linear',
119
- warmup_iters=500,
120
- warmup_ratio=0.3333333333333333,
121
- step=[8, 11])
122
- runner = dict(type='EpochBasedRunner', max_epochs=12)
123
- checkpoint_config = dict(interval=1)
124
- log_config = dict(interval=50, hooks=[dict(type='TextLoggerHook')])
 
 
 
125
  dist_params = dict(backend='nccl')
126
  log_level = 'INFO'
127
- load_from = None
128
  resume_from = None
129
  workflow = [('train', 1)]
130
  opencv_num_threads = 0
131
  mp_start_method = 'fork'
132
  angle_version = 'le90'
133
  model = dict(
134
- type='OrientedRCNN',
135
  backbone=dict(
136
- type='ResNet',
137
  depth=50,
138
  num_stages=4,
139
  out_indices=(0, 1, 2, 3),
140
  frozen_stages=1,
141
- norm_cfg=dict(type='BN', requires_grad=True),
142
- norm_eval=True,
143
  style='pytorch',
144
- init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet50')),
145
  neck=dict(
146
- type='FPN',
147
  in_channels=[256, 512, 1024, 2048],
148
  out_channels=256,
149
  num_outs=5),
150
  rpn_head=dict(
151
- type='OrientedRPNHead',
152
  in_channels=256,
153
  feat_channels=256,
154
  version='le90',
155
  anchor_generator=dict(
156
  type='AnchorGenerator',
157
- scales=[8],
158
- ratios=[0.5, 1.0, 2.0],
159
  strides=[4, 8, 16, 32, 64]),
160
  bbox_coder=dict(
161
- type='MidpointOffsetCoder',
162
- angle_range='le90',
163
- target_means=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
164
- target_stds=[1.0, 1.0, 1.0, 1.0, 0.5, 0.5]),
165
  loss_cls=dict(
166
  type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
167
  loss_bbox=dict(
168
  type='SmoothL1Loss', beta=0.1111111111111111, loss_weight=1.0)),
169
  roi_head=dict(
170
- type='OrientedStandardRoIHead',
171
- bbox_roi_extractor=dict(
172
- type='RotatedSingleRoIExtractor',
173
- roi_layer=dict(
174
- type='RoIAlignRotated',
175
- out_size=7,
176
- sample_num=2,
177
- clockwise=True),
178
- out_channels=256,
179
- featmap_strides=[4, 8, 16, 32]),
180
- bbox_head=dict(
181
- type='RotatedShared2FCBBoxHead',
182
- in_channels=256,
183
- fc_out_channels=1024,
184
- roi_feat_size=7,
185
- num_classes=15,
186
- bbox_coder=dict(
187
- type='DeltaXYWHAOBBoxCoder',
188
- angle_range='le90',
189
- norm_factor=None,
190
- edge_swap=True,
191
- proj_xy=True,
192
- target_means=(0.0, 0.0, 0.0, 0.0, 0.0),
193
- target_stds=(0.1, 0.1, 0.2, 0.2, 0.1)),
194
- reg_class_agnostic=True,
195
- loss_cls=dict(
196
- type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
197
- loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  train_cfg=dict(
199
  rpn=dict(
200
  assigner=dict(
@@ -203,7 +258,8 @@ model = dict(
203
  neg_iou_thr=0.3,
204
  min_pos_iou=0.3,
205
  match_low_quality=True,
206
- ignore_iof_thr=-1),
 
207
  sampler=dict(
208
  type='RandomSampler',
209
  num=256,
@@ -216,30 +272,49 @@ model = dict(
216
  rpn_proposal=dict(
217
  nms_pre=2000,
218
  max_per_img=2000,
219
- nms=dict(type='nms', iou_threshold=0.8),
220
  min_bbox_size=0),
221
- rcnn=dict(
222
- assigner=dict(
223
- type='MaxIoUAssigner',
224
- pos_iou_thr=0.5,
225
- neg_iou_thr=0.5,
226
- min_pos_iou=0.5,
227
- match_low_quality=False,
228
- iou_calculator=dict(type='RBboxOverlaps2D'),
229
- ignore_iof_thr=-1),
230
- sampler=dict(
231
- type='RRandomSampler',
232
- num=512,
233
- pos_fraction=0.25,
234
- neg_pos_ub=-1,
235
- add_gt_as_proposals=True),
236
- pos_weight=-1,
237
- debug=False)),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  test_cfg=dict(
239
  rpn=dict(
240
  nms_pre=2000,
241
  max_per_img=2000,
242
- nms=dict(type='nms', iou_threshold=0.8),
243
  min_bbox_size=0),
244
  rcnn=dict(
245
  nms_pre=2000,
@@ -247,3 +322,10 @@ model = dict(
247
  score_thr=0.05,
248
  nms=dict(iou_thr=0.1),
249
  max_per_img=2000)))
 
 
 
 
 
 
 
 
1
+ dataset_type = 'AirbusShipDataset'
2
+ data_root = '/data/share/airbus-ship-detection/'
3
  img_norm_cfg = dict(
4
+ mean=[52.29048625, 73.2539164, 80.97759001],
5
+ std=[53.09640994, 47.58987537, 42.15418378],
6
+ to_rgb=True)
7
  train_pipeline = [
8
  dict(type='LoadImageFromFile'),
9
  dict(type='LoadAnnotations', with_bbox=True),
10
+ dict(type='RResize', img_scale=(768, 768)),
11
  dict(
12
  type='RRandomFlip',
13
  flip_ratio=[0.25, 0.25, 0.25],
14
  direction=['horizontal', 'vertical', 'diagonal'],
15
  version='le90'),
16
+ dict(
17
+ type='PolyRandomRotate',
18
+ rotate_ratio=0.5,
19
+ angles_range=180,
20
+ auto_bound=False,
21
+ version='le90'),
22
  dict(
23
  type='Normalize',
24
+ mean=[52.29048625, 73.2539164, 80.97759001],
25
+ std=[53.09640994, 47.58987537, 42.15418378],
26
  to_rgb=True),
27
  dict(type='Pad', size_divisor=32),
28
  dict(type='DefaultFormatBundle'),
 
32
  dict(type='LoadImageFromFile'),
33
  dict(
34
  type='MultiScaleFlipAug',
35
+ img_scale=(768, 768),
36
  flip=False,
37
  transforms=[
38
+ dict(type='RResize', img_scale=(768, 768)),
39
  dict(
40
  type='Normalize',
41
+ mean=[52.29048625, 73.2539164, 80.97759001],
42
+ std=[53.09640994, 47.58987537, 42.15418378],
43
  to_rgb=True),
44
  dict(type='Pad', size_divisor=32),
45
  dict(type='DefaultFormatBundle'),
 
47
  ])
48
  ]
49
  data = dict(
50
+ samples_per_gpu=20,
51
+ workers_per_gpu=8,
52
  train=dict(
53
+ type='AirbusShipDataset',
54
+ ann_file='full.csv',
55
+ img_prefix='train_v2/',
56
+ metrics_file='metrics_20240328.csv',
57
+ oversample_rate=5,
58
  pipeline=[
59
  dict(type='LoadImageFromFile'),
60
  dict(type='LoadAnnotations', with_bbox=True),
61
+ dict(type='RResize', img_scale=(768, 768)),
62
  dict(
63
  type='RRandomFlip',
64
  flip_ratio=[0.25, 0.25, 0.25],
65
  direction=['horizontal', 'vertical', 'diagonal'],
66
  version='le90'),
67
+ dict(
68
+ type='PolyRandomRotate',
69
+ rotate_ratio=0.5,
70
+ angles_range=180,
71
+ auto_bound=False,
72
+ version='le90'),
73
  dict(
74
  type='Normalize',
75
+ mean=[52.29048625, 73.2539164, 80.97759001],
76
+ std=[53.09640994, 47.58987537, 42.15418378],
77
  to_rgb=True),
78
  dict(type='Pad', size_divisor=32),
79
  dict(type='DefaultFormatBundle'),
80
  dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
81
  ],
82
+ version='le90',
83
+ data_root='/data/share/airbus-ship-detection/'),
84
  val=dict(
85
+ type='AirbusShipDataset',
86
+ ann_file='valid.csv',
87
+ img_prefix='train_v2/',
88
  pipeline=[
89
  dict(type='LoadImageFromFile'),
90
  dict(
91
  type='MultiScaleFlipAug',
92
+ img_scale=(768, 768),
93
  flip=False,
94
  transforms=[
95
+ dict(type='RResize', img_scale=(768, 768)),
96
  dict(
97
  type='Normalize',
98
+ mean=[52.29048625, 73.2539164, 80.97759001],
99
+ std=[53.09640994, 47.58987537, 42.15418378],
100
  to_rgb=True),
101
  dict(type='Pad', size_divisor=32),
102
  dict(type='DefaultFormatBundle'),
103
  dict(type='Collect', keys=['img'])
104
  ])
105
  ],
106
+ version='le90',
107
+ data_root='/data/share/airbus-ship-detection/'),
108
  test=dict(
109
+ type='AirbusShipDataset',
110
+ ann_file='valid.csv',
111
+ img_prefix='train_v2/',
112
  pipeline=[
113
  dict(type='LoadImageFromFile'),
114
  dict(
115
  type='MultiScaleFlipAug',
116
+ img_scale=(768, 768),
117
  flip=False,
118
  transforms=[
119
+ dict(type='RResize', img_scale=(768, 768)),
120
  dict(
121
  type='Normalize',
122
+ mean=[52.29048625, 73.2539164, 80.97759001],
123
+ std=[53.09640994, 47.58987537, 42.15418378],
124
  to_rgb=True),
125
  dict(type='Pad', size_divisor=32),
126
  dict(type='DefaultFormatBundle'),
127
  dict(type='Collect', keys=['img'])
128
  ])
129
  ],
130
+ version='le90',
131
+ data_root='/data/share/airbus-ship-detection/'))
132
+ evaluation = dict(interval=2, metric='mAP', save_best='mAP')
133
+ optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
134
  optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
135
  lr_config = dict(
136
+ policy='CosineAnnealing',
137
  warmup='linear',
138
+ warmup_iters=2000,
139
+ warmup_ratio=0.05,
140
+ min_lr_ratio=0.05)
141
+ runner = dict(type='EpochBasedRunner', max_epochs=20)
142
+ checkpoint_config = dict(interval=10)
143
+ log_config = dict(
144
+ interval=200,
145
+ hooks=[dict(type='TextLoggerHook'),
146
+ dict(type='TensorboardLoggerHook')])
147
  dist_params = dict(backend='nccl')
148
  log_level = 'INFO'
149
+ load_from = 'redet_re50_fpn_1x_dota_ms_rr_le90-fc9217b5.pth'
150
  resume_from = None
151
  workflow = [('train', 1)]
152
  opencv_num_threads = 0
153
  mp_start_method = 'fork'
154
  angle_version = 'le90'
155
  model = dict(
156
+ type='ReDet',
157
  backbone=dict(
158
+ type='ReResNet',
159
  depth=50,
160
  num_stages=4,
161
  out_indices=(0, 1, 2, 3),
162
  frozen_stages=1,
 
 
163
  style='pytorch',
164
+ pretrained='work_dirs/pretrain/re_resnet50_c8_batch256-25b16846.pth'),
165
  neck=dict(
166
+ type='ReFPN',
167
  in_channels=[256, 512, 1024, 2048],
168
  out_channels=256,
169
  num_outs=5),
170
  rpn_head=dict(
171
+ type='RotatedRPNHead',
172
  in_channels=256,
173
  feat_channels=256,
174
  version='le90',
175
  anchor_generator=dict(
176
  type='AnchorGenerator',
177
+ scales=[2, 4],
178
+ ratios=[0.125, 0.5, 1.0, 2.0],
179
  strides=[4, 8, 16, 32, 64]),
180
  bbox_coder=dict(
181
+ type='DeltaXYWHBBoxCoder',
182
+ target_means=[0.0, 0.0, 0.0, 0.0],
183
+ target_stds=[1.0, 1.0, 1.0, 1.0]),
 
184
  loss_cls=dict(
185
  type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
186
  loss_bbox=dict(
187
  type='SmoothL1Loss', beta=0.1111111111111111, loss_weight=1.0)),
188
  roi_head=dict(
189
+ type='RoITransRoIHead',
190
+ version='le90',
191
+ num_stages=2,
192
+ stage_loss_weights=[1, 1],
193
+ bbox_roi_extractor=[
194
+ dict(
195
+ type='SingleRoIExtractor',
196
+ roi_layer=dict(
197
+ type='RoIAlign', output_size=7, sampling_ratio=0),
198
+ out_channels=256,
199
+ featmap_strides=[4, 8, 16, 32]),
200
+ dict(
201
+ type='RotatedSingleRoIExtractor',
202
+ roi_layer=dict(
203
+ type='RiRoIAlignRotated',
204
+ out_size=7,
205
+ num_samples=2,
206
+ num_orientations=16,
207
+ clockwise=True),
208
+ out_channels=256,
209
+ featmap_strides=[4, 8, 16, 32])
210
+ ],
211
+ bbox_head=[
212
+ dict(
213
+ type='RotatedShared2FCBBoxHead',
214
+ in_channels=256,
215
+ fc_out_channels=1024,
216
+ roi_feat_size=7,
217
+ num_classes=1,
218
+ bbox_coder=dict(
219
+ type='DeltaXYWHAHBBoxCoder',
220
+ angle_range='le90',
221
+ norm_factor=2,
222
+ edge_swap=True,
223
+ target_means=[0.0, 0.0, 0.0, 0.0, 0.0],
224
+ target_stds=[0.1, 0.1, 0.2, 0.2, 1]),
225
+ reg_class_agnostic=True,
226
+ loss_cls=dict(
227
+ type='CrossEntropyLoss',
228
+ use_sigmoid=False,
229
+ loss_weight=1.0),
230
+ loss_bbox=dict(type='SmoothL1Loss', beta=1.0,
231
+ loss_weight=1.0)),
232
+ dict(
233
+ type='RotatedShared2FCBBoxHead',
234
+ in_channels=256,
235
+ fc_out_channels=1024,
236
+ roi_feat_size=7,
237
+ num_classes=1,
238
+ bbox_coder=dict(
239
+ type='DeltaXYWHAOBBoxCoder',
240
+ angle_range='le90',
241
+ norm_factor=None,
242
+ edge_swap=True,
243
+ proj_xy=True,
244
+ target_means=[0.0, 0.0, 0.0, 0.0, 0.0],
245
+ target_stds=[0.05, 0.05, 0.1, 0.1, 0.5]),
246
+ reg_class_agnostic=False,
247
+ loss_cls=dict(
248
+ type='CrossEntropyLoss',
249
+ use_sigmoid=False,
250
+ loss_weight=1.0),
251
+ loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0))
252
+ ]),
253
  train_cfg=dict(
254
  rpn=dict(
255
  assigner=dict(
 
258
  neg_iou_thr=0.3,
259
  min_pos_iou=0.3,
260
  match_low_quality=True,
261
+ ignore_iof_thr=-1,
262
+ gpu_assign_thr=200),
263
  sampler=dict(
264
  type='RandomSampler',
265
  num=256,
 
272
  rpn_proposal=dict(
273
  nms_pre=2000,
274
  max_per_img=2000,
275
+ nms=dict(type='nms', iou_threshold=0.7),
276
  min_bbox_size=0),
277
+ rcnn=[
278
+ dict(
279
+ assigner=dict(
280
+ type='MaxIoUAssigner',
281
+ pos_iou_thr=0.5,
282
+ neg_iou_thr=0.5,
283
+ min_pos_iou=0.5,
284
+ match_low_quality=False,
285
+ ignore_iof_thr=-1,
286
+ iou_calculator=dict(type='BboxOverlaps2D')),
287
+ sampler=dict(
288
+ type='RandomSampler',
289
+ num=512,
290
+ pos_fraction=0.25,
291
+ neg_pos_ub=-1,
292
+ add_gt_as_proposals=True),
293
+ pos_weight=-1,
294
+ debug=False),
295
+ dict(
296
+ assigner=dict(
297
+ type='MaxIoUAssigner',
298
+ pos_iou_thr=0.5,
299
+ neg_iou_thr=0.5,
300
+ min_pos_iou=0.5,
301
+ match_low_quality=False,
302
+ ignore_iof_thr=-1,
303
+ iou_calculator=dict(type='RBboxOverlaps2D')),
304
+ sampler=dict(
305
+ type='RRandomSampler',
306
+ num=512,
307
+ pos_fraction=0.25,
308
+ neg_pos_ub=-1,
309
+ add_gt_as_proposals=True),
310
+ pos_weight=-1,
311
+ debug=False)
312
+ ]),
313
  test_cfg=dict(
314
  rpn=dict(
315
  nms_pre=2000,
316
  max_per_img=2000,
317
+ nms=dict(type='nms', iou_threshold=0.7),
318
  min_bbox_size=0),
319
  rcnn=dict(
320
  nms_pre=2000,
 
322
  score_thr=0.05,
323
  nms=dict(iou_thr=0.1),
324
  max_per_img=2000)))
325
+ img_size = 768
326
+ max_keep_ckpts = 1
327
+ val_dataloader = dict(samples_per_gpu=20, workers_per_gpu=8)
328
+ seed = 1984
329
+ gpu_ids = range(0, 1)
330
+ device = 'cuda'
331
+ work_dir = './logs/redet/2024-03-28-14-45-06'
weights/best_mAP_epoch_20.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:31aebdccade8c5fc2ea4b81547a736a7a7648acc3c3fadc6337e46ff16943222
3
+ size 363302067