IDEA-Research / detrex

detrex is a research platform for DETR-based object detection, segmentation, pose estimation and other visual recognition tasks.
https://detrex.readthedocs.io/en/latest/
Apache License 2.0
1.97k stars 206 forks source link

"RuntimeError: selected index k out of range" in h_deformable_detr #180

Closed KappyDays closed 1 year ago

KappyDays commented 1 year ago

Hi, thank you for providing a nice project

I'm using "projects > h_deformable_detr > configs > h_deformable_detr_swin_large_two_stage_12ep.py" to train my custom dataset(Object Detection, Using Bbox-COCO Label).

When i entered this command,

python tools/train_net.py --config-file projects/h_deformable_detr/configs/h_deformable_detr_swin_large_two_stage_12ep.py

The RuntimeError is Raised. image

To solve this problem, I printed out the shape of enc_outputs_class and the value of the topk variable. image

And I checked that the value of enc_outputs_class is less than the value of topk. (1781 < 1800)

But I don't know how to fix it.

Besides, the part I modified in another file is the value of the num_classes variable in "projects > h_deformable_detr > configs > models > h_deformable_detr_r50.py"

I modified num_classes=1 because my custom dataset only has 1 class.

Thanks for reading and I hope this problem gets resolved.

FengLi-ust commented 1 year ago

You need to use less number of queries or groups, i.e., 1500 in total. You can also pad the queries to 1800 with randomly initialized queries when the shape of enc_outputs_class and the value of the topk variable.

rentainhe commented 1 year ago

As there is no more activity, I am closing the issue, feel free to reopen it if necessary~

nhw649 commented 8 months ago

You need to use less number of queries or groups, i.e., 1500 in total. You can also pad the queries to 1800 with randomly initialized queries when the shape of enc_outputs_class and the value of the topk variable.

Hello, I have the same problem. I want to know whether to use all zero initialization or random initialization, is there a specific implementation of the code?