Skip to content

Commit e6e59b4

Browse files
RangiLyuZwwWayne
authored andcommitted
[Fix] Fix SimOTA with no valid bbox. (#6733)
1 parent 6ead450 commit e6e59b4

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

mmdet/core/bbox/assigners/sim_ota_assigner.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ def _assign(self,
127127
assigned_gt_inds = decoded_bboxes.new_full((num_bboxes, ),
128128
0,
129129
dtype=torch.long)
130-
if num_gt == 0 or num_bboxes == 0:
130+
valid_mask, is_in_boxes_and_center = self.get_in_gt_and_in_center_info(
131+
priors, gt_bboxes)
132+
valid_decoded_bbox = decoded_bboxes[valid_mask]
133+
valid_pred_scores = pred_scores[valid_mask]
134+
num_valid = valid_decoded_bbox.size(0)
135+
136+
if num_gt == 0 or num_bboxes == 0 or num_valid == 0:
131137
# No ground truth or boxes, return empty assignment
132138
max_overlaps = decoded_bboxes.new_zeros((num_bboxes, ))
133139
if num_gt == 0:
@@ -142,13 +148,6 @@ def _assign(self,
142148
return AssignResult(
143149
num_gt, assigned_gt_inds, max_overlaps, labels=assigned_labels)
144150

145-
valid_mask, is_in_boxes_and_center = self.get_in_gt_and_in_center_info(
146-
priors, gt_bboxes)
147-
148-
valid_decoded_bbox = decoded_bboxes[valid_mask]
149-
valid_pred_scores = pred_scores[valid_mask]
150-
num_valid = valid_decoded_bbox.size(0)
151-
152151
pairwise_ious = bbox_overlaps(valid_decoded_bbox, gt_bboxes)
153152
iou_cost = -torch.log(pairwise_ious + eps)
154153

0 commit comments

Comments
 (0)