Skip to content

Commit 9584d43

Browse files
author
Adrien Pre
committed
fix wrong case in live_yolo_opencv.py
1 parent c14ab2b commit 9584d43

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

machine-learning/object-detection/live_yolo_opencv.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@
7676
x, y = boxes[i][0], boxes[i][1]
7777
w, h = boxes[i][2], boxes[i][3]
7878
# draw a bounding box rectangle and label on the image
79-
color = [int(c) for c in colors[class_ids[i]]]
79+
80+
color = [int(c) for c in COLORS[class_ids[i]]]
8081
cv2.rectangle(image, (x, y), (x + w, y + h), color=color, thickness=thickness)
81-
text = f"{labels[class_ids[i]]}: {confidences[i]:.2f}"
82+
text = f"{LABEL[class_ids[i]]}: {confidences[i]:.2f}"
8283
# calculate text width & height to draw the transparent boxes as background of the text
8384
(text_width, text_height) = cv2.getTextSize(text, cv2.FONT_HERSHEY_SIMPLEX, fontScale=font_scale, thickness=thickness)[0]
8485
text_offset_x = x
@@ -97,4 +98,4 @@
9798
break
9899

99100
cap.release()
100-
cv2.destroyAllWindows()
101+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)