Closed monkeycc closed 1 year ago
Hello @monkeycc , the issue above has been fixed after your submission. It was associated with the new release of ultralytics and how they want to simplify the use of YOLO in a python environment.
you can re-clone repo or update yolov8_n_opencv.py
with code bellow.
DP = detect_params[0].numpy()
print(DP)
if len(DP) != 0:
for i in range(len(detect_params[0])):
print(i)
boxes = detect_params[0].boxes
box = boxes[i] # returns one box
clsID = box.cls.numpy()[0]
conf = box.conf.numpy()[0]
bb = box.xyxy.numpy()[0]
cv2.rectangle(
frame,
(int(bb[0]), int(bb[1])),
(int(bb[2]), int(bb[3])),
detection_colors[int(clsID)],
3,
)
# Display class name and confidence
font = cv2.FONT_HERSHEY_COMPLEX
cv2.putText(
frame,
class_list[int(clsID)]
+ " "
+ str(round(conf, 3))
+ "%",
(int(bb[0]), int(bb[1]) - 10),
font,
1,
(255, 255, 255),
2,
)
I am using an nvidia jetson device, so I need to modify line 55 to:
DP = detect_params[0].cpu().numpy()
And I get the following error when executing:
Line 58, in
Can you help me?