Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Glenn Jocher 2019-09-02 16:11:55 +02:00
parent 39c198579f
commit 1e4351c4a2
1 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ def detect(save_txt=False, save_img=True, stream_img=False):
pred, _ = model(img) pred, _ = model(img)
det = non_max_suppression(pred.float(), opt.conf_thres, opt.nms_thres)[0] det = non_max_suppression(pred.float(), opt.conf_thres, opt.nms_thres)[0]
s = '%gx%g ' % img.shape[2:] # string to print image size s = '%gx%g ' % img.shape[2:] # print string
if det is not None and len(det): if det is not None and len(det):
# Rescale boxes from img_size to im0 size # Rescale boxes from img_size to im0 size
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round() det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()
@ -77,7 +77,7 @@ def detect(save_txt=False, save_img=True, stream_img=False):
# Print results # Print results
for c in det[:, -1].unique(): for c in det[:, -1].unique():
n = (det[:, -1] == c).sum() # detections per class n = (det[:, -1] == c).sum() # detections per class
s += '%g %ss' % (n, classes[int(c)]) # add to string s += '%g %ss, ' % (n, classes[int(c)]) # add to string
# Write results # Write results
for *xyxy, conf, _, cls in det: for *xyxy, conf, _, cls in det: