This commit is contained in:
Glenn Jocher 2019-12-23 11:25:15 -08:00
parent 6946a2a8fc
commit 26ed5e2ddc
1 changed files with 4 additions and 3 deletions

View File

@ -88,7 +88,7 @@ def detect(save_txt=False, save_img=False):
# Apply NMS # Apply NMS
pred = non_max_suppression(pred, opt.conf_thres, opt.nms_thres) pred = non_max_suppression(pred, opt.conf_thres, opt.nms_thres)
# Apply # Apply Classifier
if classify: if classify:
pred = apply_classifier(pred, modelc, img, im0s) pred = apply_classifier(pred, modelc, img, im0s)
@ -105,6 +105,9 @@ def detect(save_txt=False, save_img=False):
# 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()
# Print time (inference + NMS)
print('%sDone. (%.3fs)' % (s, time.time() - t))
# 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
@ -120,8 +123,6 @@ def detect(save_txt=False, save_img=False):
label = '%s %.2f' % (names[int(cls)], conf) label = '%s %.2f' % (names[int(cls)], conf)
plot_one_box(xyxy, im0, label=label, color=colors[int(cls)]) plot_one_box(xyxy, im0, label=label, color=colors[int(cls)])
print('%sDone. (%.3fs)' % (s, time.time() - t))
# Stream results # Stream results
if view_img: if view_img:
cv2.imshow(p, im0) cv2.imshow(p, im0)