IDEA-Research / Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything

Home Page:https://arxiv.org/abs/2401.14159

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError in Labels issues?

JohanHuynh0130 opened this issue · comments

has anyone ever come into the issue below when trying to test other SAM models:
Traceback (most recent call last):
File "E:\PythonProjects\Grounded-Segment-Anything\EfficientSAM\grounded_mobile_sam.py", line 145, in
main(args)
File "E:\PythonProjects\Grounded-Segment-Anything\EfficientSAM\grounded_mobile_sam.py", line 83, in main
labels = [
File "E:\PythonProjects\Grounded-Segment-Anything\EfficientSAM\grounded_mobile_sam.py", line 83, in
labels = [
ValueError: too many values to unpack (expected 5)

Let me know how to fix this please. Thank you!

detections returns 6 values, while the labels list takes into account 5. fixed by changing:

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

to:

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

thanks a lot :) @haviduck