supervision
supervision copied to clipboard
too many values to unpack (expected 5)
Search before asking
- [X] I have searched the Supervision issues and found no similar bug report.
Bug
I was using Supervision for an inference of yolov8 model on a sample video data. When I am trying to run the program using the code below, its showing me this error:
for _, _, confidence, class_id, _
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 5)
I have went through the updated code in the Detections/core.py but haven't found out exactly why this error is coming up.
I have also referred to downgrading the supervision version to 0.3.0 but that has created more clashes as python versions and pytorch versions also clash.
Environment
- supervision==0.23.0
- opencv-python==4.10.0.84
- ultralytics==8.3.1
- python==3.12.0
Minimal Reproducible Example
import numpy as np
from ultralytics import YOLO
video_path = r'det/data/football.mp4'
model = YOLO("yolov8s.pt")
video_info = sv.VideoInfo.from_video_path(video_path)
def process_frame(frame: np.ndarray,_) -> np.ndarray:
results = model(frame,imgsz = 1280)[0]
detections = sv.Detections.from_ultralytics(results)
box_annotator = sv.BoundingBoxAnnotator()
labels = [
f"{model.names[class_id]} {confidence:0.2f}"
for _, _, confidence, class_id, _
in detections
]
frame = box_annotator.annotate(scene=frame, detections=detections, labels=labels)
return frame
sv.process_video(source_path=video_path, target_path=f"result.mp4", callback=process_frame)
Additional
No response
Are you willing to submit a PR?
- [X] Yes I'd like to help by submitting a PR!