GroundingDINO icon indicating copy to clipboard operation
GroundingDINO copied to clipboard

RuntimeError: selected index k out of range

Open SHUSHENGQIGUI opened this issue 2 years ago • 4 comments
trafficstars

when I input 7350X150 image for inference, or some images with high height-width ratio , it will get this bug, the bug detial is in below: File "/GroundingDINO/groundingdino/models/GroundingDINO/transformer.py", line 278, in forward topk_proposals = torch.topk(topk_logits, topk, dim=1)[1] # bs, nq RuntimeError: selected index k out of range

how to fix this bug ? please

SHUSHENGQIGUI avatar Jul 26 '23 09:07 SHUSHENGQIGUI

After the data augmentation, the image size may be too small and there may not be enough feature for selection

rentainhe avatar Jul 27 '23 04:07 rentainhe

Thank you! do you know what is the minimal limit of the image size ratio?

SHUSHENGQIGUI avatar Jul 27 '23 06:07 SHUSHENGQIGUI

Thank you! do you know what is the minimal limit of the image size ratio?

Sry we did not test some extreme situations before : (

I think Grounding-DINO works for most of the testing images

rentainhe avatar Jul 28 '23 09:07 rentainhe

Attempted a quick fix here: https://github.com/IDEA-Research/GroundingDINO/pull/346#issue-2412178824 Feel free to try it out to help test it - or suggest a better solution. This is a really quick patch.

artemisp avatar Jul 16 '24 23:07 artemisp