open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.23k stars 9.4k forks source link

Does test.py dump predictions to .pkl file before NMS or after NMS? #11837

Open SamedYalcin opened 2 months ago

SamedYalcin commented 2 months ago

I'm trying to do some error analysis. While looking through predictions in results.pkl I noticed there are overlapping bounding boxes with IoU larger than the threshold in the config file. I wasn't able to find relavant places in the source code either. Does anybody know if predictions are before NMS or after NMS?

athira-selvam commented 2 months ago

@SamedYalcin which model are you using? I have same problem with detr.

SamedYalcin commented 2 months ago

co_dino_5scale_swin_l_16xb1_16e_o365tococo

I'm using above config file. It seems likes only soft-NMS is applied however config file states soft-NMS+NMS.

SamedYalcin commented 2 months ago

So the dump includes detections after NMS. I misinterpreted what the config file meant. If you want to disable NMS, it's best to simply read the models .py file to find out what to do but generally setting nms=None does the trick. You can also try iou_thr=-1 or score_thr=-1 which disables thresholding.

FYI: Co-DETR has 3 nms configurations, each for the different head in the model. I had to read the source code to find this out. First nms config corresponds to the query head's nms, which generates the final proposals.

@athira-selvam