We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17f77d9 commit f37b452Copy full SHA for f37b452
utils/general.py
@@ -310,6 +310,7 @@ def segments2boxes(segments):
310
def resample_segments(segments, n=1000):
311
# Up-sample an (n,2) segment
312
for i, s in enumerate(segments):
313
+ s = np.concatenate((s, s[0:1, :]), axis=0)
314
x = np.linspace(0, len(s) - 1, n)
315
xp = np.arange(len(s))
316
segments[i] = np.concatenate([np.interp(x, xp, s[:, i]) for i in range(2)]).reshape(2, -1).T # segment xy
@@ -646,7 +647,11 @@ def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=Non
646
647
continue
648
649
# Compute conf
- x[:, 5:] *= x[:, 4:5] # conf = obj_conf * cls_conf
650
+ if nc == 1:
651
+ x[:, 5:] = x[:, 4:5] # for models with one class, cls_loss is 0 and cls_conf is always 0.5,
652
+ # so there is no need to multiplicate.
653
+ else:
654
+ x[:, 5:] *= x[:, 4:5] # conf = obj_conf * cls_conf
655
656
# Box (center x, center y, width, height) to (x1, y1, x2, y2)
657
box = xywh2xyxy(x[:, :4])
0 commit comments