Skip to content

Commit

Permalink
nms_rotated npu add new attr is_angle
Browse files Browse the repository at this point in the history
  • Loading branch information
huhongsun committed Jul 16, 2024
1 parent cf8ffc2 commit 47dff6f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions mmcv/ops/csrc/pytorch/npu/nms_rotated_npu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Tensor nms_rotated_npu(const Tensor dets, const Tensor scores,
.Output(selectedBox)
.Output(selectedIndex)
.Attr("iou_threshold", (float)iou_threshold)
.Attr("is_angle", false)
.Run();
selectedIndex = selectedIndex.to(at::kLong);
return selectedIndex;
Expand Down
4 changes: 0 additions & 4 deletions mmcv/ops/nms.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,6 @@ def nms_rotated(dets: Tensor,
input_labels = labels
if dets.device.type in ('npu', 'mlu'):
order = scores.new_empty(0, dtype=torch.long)
if dets.device.type == 'npu':
coefficient = 57.29578 # 180 / PI
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,
input_labels, iou_threshold,
multi_label)
Expand Down

0 comments on commit 47dff6f

Please sign in to comment.