Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'gt_instances' of eval_metric.py #11696

Open
HaMeow-lst1 opened this issue May 9, 2024 · 2 comments
Open

KeyError: 'gt_instances' of eval_metric.py #11696

HaMeow-lst1 opened this issue May 9, 2024 · 2 comments
Assignees

Comments

@HaMeow-lst1
Copy link

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!

@HaMeow-lst1
Copy link
Author

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!

@sofiapfund
Copy link

sofiapfund commented May 11, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants