tag: object detection mAP metric
This is the python code for mAP calculation in object detection task, it follows the standard pascal voc format, and read the gt files as .xml format, the prediction files as .txt format.
It will output the AP of each class, and mAP for the all classes
the gt .xml format follows the standard pascal voc format, and each .xml has
<size>, <width>, <height>, <object>, <name>, <bndbox>, <xmin>, <ymin>, <xmax>, <ymax> .etc
attributes.
The prediction .txt format is the self-defined format, which outputs 6 elements for each detected roi, and are organized as
class_id, conf_score, xmin, ymin, xmax, ymax
IMPORTANT:
In general training procedure, the mAP calculation will use all det_rois with conf_score > 0 to maintain high recall rate.
So the testing procedure follows the training schedule, and save all det_rois without score_thres and overlap_thres restrict.
running the code is straightforward:
- put the gt .xml files into xml_gt folder;
- put the predicted .txt files into txt_predict folder;
- put the *.names & *.txt in root directory. *.txt specify the image_list you want to compute mAP, test.txt for default
- simply run: python mAP_calculate_tool.py
IMPORTANT:
the .pkl files in cache_gt_pkl and predict.pkl, are used for increasing calculation speed. So if you change the gt .xml files or predict .txt files, you need to update the .pkl files.
The simplest way to handle this is delete all this .pkl files.
- https://github.com/zhreshold/mxnet-ssd/tree/master/evaluate
- https://github.com/zhreshold/mxnet-ssd/blob/master/dataset/pascal_voc.py
- http://host.robots.ox.ac.uk/pascal/VOC/voc2012/htmldoc/devkit_doc.html
- https://sanchom.wordpress.com/2011/09/01/precision-recall/
revise indx | revise time | revise version | reviser | revise comments |
---|---|---|---|---|
1 | 2018-02-06 | V1.0 | humengdoudou | |
2 |