Skip to content

Commit

Permalink
repair nms_rotated bug
Browse files Browse the repository at this point in the history
  • Loading branch information
huhongsun committed Jun 15, 2024
1 parent 4d7bf26 commit c38593d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mmcv/ops/nms.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def nms_rotated(dets: Tensor,
flip_mat[-1] = -1
dets_cw = dets * flip_mat
else:
dets_cw = dets
dets_cw = dets.clone()
multi_label = labels is not None
if labels is None:
input_labels = scores.new_empty(0, dtype=torch.int)
Expand All @@ -462,6 +462,8 @@ def nms_rotated(dets: Tensor,
order = scores.new_empty(0, dtype=torch.long)
if dets.device.type == 'npu':
coefficient = 57.29578 # 180 / PI
dets_cw = dets_cw.float()
scores = scores.float()
for i in range(dets.size()[0]):
dets_cw[i][4] *= coefficient # radians to angle
keep_inds = ext_module.nms_rotated(dets_cw, scores, order, dets_cw,
Expand Down

0 comments on commit c38593d

Please sign in to comment.