Skip to content

Commit

Permalink
reppoint bug fix when negative image training
Browse files Browse the repository at this point in the history
  • Loading branch information
MinkiSong committed Jul 5, 2022
1 parent 01439d1 commit aedb8ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mmrotate/core/bbox/assigners/max_convex_iou_assigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def convex_overlaps(self, gt_rbboxes, points):
overlaps (torch.Tensor): Overlaps between k gt_bboxes and n \
bboxes, shape(k, n).
"""
if gt_rbboxes.size(0) == 0:
return gt_rbboxes.new_zeros((0, points.size(0)))
overlaps = convex_iou(points, gt_rbboxes)
overlaps = overlaps.transpose(1, 0)
return overlaps
3 changes: 3 additions & 0 deletions mmrotate/models/dense_heads/rotated_reppoints_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,9 @@ def get_pos_loss(self, cls_score, pts_pred, label, bbox_gt, label_weight,
Returns:
Tensor: Losses of all positive samples in single image.
"""
if pos_inds.size(0) == 0:
pos_loss = bbox_gt.new_zeros(0)
return pos_loss,
pos_scores = cls_score[pos_inds]
pos_pts_pred = pts_pred[pos_inds]
pos_bbox_gt = bbox_gt[pos_inds]
Expand Down

0 comments on commit aedb8ae

Please sign in to comment.