Skip to content

Commit

Permalink
Fix NMS Return Index (#2196)
Browse files Browse the repository at this point in the history
* fix nms index return

* fix
  • Loading branch information
huayuan4396 authored Jun 25, 2023
1 parent 90f17f2 commit 2f2ada9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mmdeploy/mmcv/ops/nms.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@ def _multiclass_nms_single(boxes: Tensor,
labels = labels[:, topk_inds, ...]

if output_index:
bbox_index = pre_topk_inds[None, topk_inds]
bbox_index = box_inds.unsqueeze(0)
if pre_top_k > 0:
bbox_index = pre_topk_inds[None, box_inds]
if keep_top_k > 0:
bbox_index = bbox_index[:, topk_inds[:-1]]
return dets, labels, bbox_index
else:
return dets, labels
Expand Down

0 comments on commit 2f2ada9

Please sign in to comment.