non-max-suppression function fixed for one class model conf. (#305)
This commit is contained in:
parent
7a7cba744a
commit
a4724d5592
@ -645,7 +645,11 @@ def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=Non
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Compute conf
|
# Compute conf
|
||||||
x[:, 5:] *= x[:, 4:5] # conf = obj_conf * cls_conf
|
if nc == 1:
|
||||||
|
x[:, 5:] = x[:, 4:5] # for models with one class, cls_loss is 0 and cls_conf is always 0.5,
|
||||||
|
# so there is no need to multiplicate.
|
||||||
|
else:
|
||||||
|
x[:, 5:] *= x[:, 4:5] # conf = obj_conf * cls_conf
|
||||||
|
|
||||||
# Box (center x, center y, width, height) to (x1, y1, x2, y2)
|
# Box (center x, center y, width, height) to (x1, y1, x2, y2)
|
||||||
box = xywh2xyxy(x[:, :4])
|
box = xywh2xyxy(x[:, :4])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user