open-mmlab/mmdetection

KeyError: 'gt_instances' of eval_metric.py

HaMeow-lst1 opened this issue · 2 comments

I use MMDtection 3.x. The dataset is voc-format. I have trained a model and get detection_results.pkl

However, I run

python tools/analysis_tools/eval_metric.py configs/saga/cascade-rcnn_flir.py ./detection_results.pkl

and get errors

  File "/home/lisongtao/mm3+conda/saga_test/mmdet/evaluation/metrics/voc_metric.py", line 89, in process
    gt_instances = gt['gt_instances']
KeyError: 'gt_instances'

Could you please tell me how to solve this problem?

Besides, I want to open source the code for evaluation. You can also tell me how to calculate the map according to a .pkl file and config. Thanks a lot!

Besides, if convenient, could I only use annotations for the test dataset without images and training data? I want to others can get mAP conveniently without downloading too much. Thanks a lot!

I ran into the same issue and solved as described below :)

The detection_results.pkl file does not, by default, store any information regarding the ground truth instances. To incorporate the ground truth data for offline evaluation of the detections, one needs to comment out line 32 within the DumpDetResults class.

File location:
mmdetection/tree/main/mmdet/evaluation/metrics/dump_det_results.py

Modify:
line 32 # data_sample.pop('gt_instances', None)