SkalskiP/yolov8-live

Variable Label error

githubheyguy opened this issue · 5 comments

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

for _, confidence, class_id, _

ValueError: too many values to unpack (expected 4)

You didn’t use requirements.txt to install.

Traceback (most recent call last):
File "main.py", line 83, in
main()
File "main.py", line 61, in main
labels = [
File "main.py", line 61, in
labels = [
ValueError: too many values to unpack (expected 4)

I activated the virtual environment and used requirements.txt to install but still getting this error'

Hi @malin-howto and @sarah-tujjar 👋🏻 It looks like you have an incorrect version of supervision installed. Try to downgrade supervision to 0.2.1.

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

Hi @Ryandran 👋🏻 That's an alternative solution. Assuming you want to change the code ;)