Skip to content

Commit

Permalink
[Fix] Fix SimOTA with no valid bbox. (#6733)
Browse files Browse the repository at this point in the history
  • Loading branch information
RangiLyu authored and ZwwWayne committed Dec 15, 2021
1 parent fcd9a15 commit 4316c09
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions mmdet/core/bbox/assigners/sim_ota_assigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ def _assign(self,
assigned_gt_inds = decoded_bboxes.new_full((num_bboxes, ),
0,
dtype=torch.long)
if num_gt == 0 or num_bboxes == 0:
valid_mask, is_in_boxes_and_center = self.get_in_gt_and_in_center_info(
priors, gt_bboxes)
valid_decoded_bbox = decoded_bboxes[valid_mask]
valid_pred_scores = pred_scores[valid_mask]
num_valid = valid_decoded_bbox.size(0)

if num_gt == 0 or num_bboxes == 0 or num_valid == 0:
# No ground truth or boxes, return empty assignment
max_overlaps = decoded_bboxes.new_zeros((num_bboxes, ))
if num_gt == 0:
Expand All @@ -142,13 +148,6 @@ def _assign(self,
return AssignResult(
num_gt, assigned_gt_inds, max_overlaps, labels=assigned_labels)

valid_mask, is_in_boxes_and_center = self.get_in_gt_and_in_center_info(
priors, gt_bboxes)

valid_decoded_bbox = decoded_bboxes[valid_mask]
valid_pred_scores = pred_scores[valid_mask]
num_valid = valid_decoded_bbox.size(0)

pairwise_ious = bbox_overlaps(valid_decoded_bbox, gt_bboxes)
iou_cost = -torch.log(pairwise_ious + eps)

Expand Down

0 comments on commit 4316c09

Please sign in to comment.