Skip to content

Commit 52bc994

Browse files
author
冬落
committed
debug fcos_rt_r50_4x
1 parent e51ec82 commit 52bc994

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

config/fcos_config.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -538,21 +538,18 @@
538538
'lr_epoch': [32, 44], # 4x
539539
# ----------------- Input -----------------
540540
## Transforms
541-
'train_min_size': [256, 288, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640], # short edge of image
541+
'train_min_size': [320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640], # short edge of image
542+
'train_min_size2': [400, 500, 600],
542543
'train_max_size': 900,
543544
'test_min_size': 512,
544545
'test_max_size': 736,
546+
'random_crop_size': [320, 608],
545547
## Pixel mean & std
546548
'pixel_mean': [0.485, 0.456, 0.406],
547549
'pixel_std': [0.229, 0.224, 0.225],
548550
## Transforms
549-
'detr_style': False,
550-
'trans_config': [
551-
{'name': 'RandomHFlip'},
552-
{'name': 'RandomSizeCrop', 'min_crop_size': 256, "max_crop_size": 608},
553-
{'name': 'RandomShift', 'max_shift': 32},
554-
{'name': 'RandomResize'},
555-
],
551+
'detr_style': True,
552+
'trans_config': None,
556553
'normalize_coords': False,
557554
},
558555

models/detectors/fcos/criterion.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ def ota_loss(self, outputs, targets):
181181
for batch_idx in range(batch_size):
182182
tgt_labels = targets[batch_idx]["labels"].to(device) # [N,]
183183
tgt_bboxes = targets[batch_idx]["boxes"].to(device) # [N, 4]
184+
# refine target
185+
tgt_boxes_wh = tgt_bboxes[..., 2:] - tgt_bboxes[..., :2]
186+
min_tgt_size = torch.min(tgt_boxes_wh, dim=-1)[0]
187+
keep = (min_tgt_size >= 8)
188+
tgt_bboxes = tgt_bboxes[keep]
189+
tgt_labels = tgt_labels[keep]
190+
# label assignment
184191
assigned_result = self.matcher(fpn_strides=fpn_strides,
185192
anchors=anchors,
186193
pred_cls=pred_cls[batch_idx].detach(),

0 commit comments

Comments
 (0)