Unverified 提交 5545ff35 authored 作者: Yonghye Kwon's avatar Yonghye Kwon 提交者: GitHub

Sort by confidence and remove excess boxes without explicit if (#10517)

* sort by confidence and remove excess boxes without explicit if Signed-off-by: 's avatarYonghye Kwon <developer.0hye@gmail.com> * cleanup indexing boxes for remove excess boxes it is related to https://github.com/ultralytics/yolov5/pull/10502. Signed-off-by: 's avatarYonghye Kwon <developer.0hye@gmail.com> Co-authored-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com>
上级 10e93d29
......@@ -969,10 +969,7 @@ def non_max_suppression(
n = x.shape[0] # number of boxes
if not n: # no boxes
continue
elif n > max_nms: # excess boxes
x = x[x[:, 4].argsort(descending=True)[:max_nms]] # sort by confidence
else:
x = x[x[:, 4].argsort(descending=True)] # sort by confidence
x = x[x[:, 4].argsort(descending=True)[:max_nms]] # sort by confidence and remove excess boxes
# Batched NMS
c = x[:, 5:6] * (0 if agnostic else max_wh) # classes
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论