SkalskiP / yolov8-native-tracking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

too many values to unpack (expected 4)

litaldavar opened this issue · comments

error when looping the labels
my code:
from supervision.dataset.formats.yolo import detections_to_yolo_annotations
for result in model.track(source=f"{HOME}/Recording_2023-05-04_09_41_20_Camera - 1of8.mp4", stream=True):
frame = result.orig_img
detections = sv.Detections.from_yolov8(result)

if result.boxes.id is not None:
detections.tracker_id = result.boxes.id.cpu().numpy().astype(int)

print(f"{detections.class_id}")
detections = detections[(detections.class_id !=0)]

labels = [
f"{tracker_id} {model.model.names[class_id]} {confidence:0.2f}"
for _, confidence, class_id, tracker_id
in detections
]

frame = box_annotator.annotate(scene=frame, detections=detections, labels=labels)

error message : ValueError Traceback (most recent call last)
in <cell line: 2>()
10 detections = detections[(detections.class_id !=0)]
11
---> 12 labels = [
13 f"{tracker_id} {model.model.names[class_id]} {confidence:0.2f}"
14 for _, confidence, class_id, tracker_id

in (.0)
12 labels = [
13 f"{tracker_id} {model.model.names[class_id]} {confidence:0.2f}"
---> 14 for _, confidence, class_id, tracker_id
15 in detections
16 ]

ValueError: too many values to unpack (expected 4)

Duplicate: #2