IDEA-Research / Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything
https://arxiv.org/abs/2401.14159
Apache License 2.0
14.11k stars 1.31k forks source link

Unable to detect, not enough values to unpack (expected 3, got 2) #480

Open live-github opened 3 months ago

live-github commented 3 months ago

shoe shoe

watch_color watch

grounding_dino_model use: GroundingDINO_SwinT_OGC.py groundingdino_swint_ogc.pth sam_vit_h_4b8939.pth OR sam_hq_vit_h.pth

detections = grounding_dino_model.predict_with_classes( image=image, classes=['shoe'], box_threshold=0.25, text_threshold=0.25 )

debug: groundingdino/util/inference.py 202 line, no return channel value source_h, sourcew, = image.shape # not enough values to unpack (expected 3, got 2)

If forced to change to source_h, source_w = image.shape[:2] you will not be able to get the mask later.

In addition to single-channel images such as black and white or grayscale, some color images cannot be detected. See picture above!!!