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.32k stars 1.32k forks source link

TypeError: list indices must be integers or slices, not NoneType #352

Open fbarrientos opened 11 months ago

fbarrientos commented 11 months ago

Hello! The detect objects:

detections = grounding_dino_model.predict_with_classes(
    image=image,
    classes=enhance_class_name(class_names=CLASSES),
    box_threshold=BOX_TRESHOLD,
    text_threshold=TEXT_TRESHOLD
)

why for some test images, one of the class_id is None? As shown in the following screenshot:

image

And how could you solve it?

rentainhe commented 11 months ago

Hello, maybe you can hack into the function and print the class_name output by Grounding-DINO, Grounding-DINO may automatically combine different predicted phrases together and make this function (by searching the phrase index) not work

yxchng commented 8 months ago

@rentainhe what do you mean? how to hack into the function and solve this problem?