How to calculate the mAP, for my custom dataset which is labelled using Euclid in yolo format
Hi, I labelled my custom data set using euclid in yolo format. And I trained Yolo and everything is working fine. But now I want to calculate the mAP. For this I need to use some scripts like voc_eval.py etc, for which the ground truth annotations should be in VOC XML format. is there any way to convert Yolo format annotations to VOC format annotations, so that I can use scripts provided by VOC team. Or else is there any procedure to calculate mAP from Yolo format annotated data(using euclid)
Could you please share the voc_eval.py, so I can check for euclid https://github.com/prabindh/euclid ?
After running ./ darknet detector on my test set it generates text files for each class in the Pascal VOC format. Check the below example
Image_01389 0.925365 2.702499 139.048599 416.000000 408.688477 Image_01562 0.800577 2.937439 50.000034 144.580612 175.984833 Image_01562 0.007224 17.548409 16.466003 154.005432 340.751160 Image_01562 0.921113 52.459122 28.805679 416.000000 386.246338
Now, I need to use this generated text along with ground truth annotations, to calculate the mAP using voc_eval.py
Or by using any other standard tool. But for that to happen, the ground truth annotations should be in VOC format. Either I need to convert my annotations to VOC format or create new script to calculate mAP from yolo format
We can also calculate mAP using VOC Devkit
Any idea on this problem
It should be fairly easy to convert the annotation to another format using Python. Given the equation to convert between the two. Do you have the equation handy ?
Yolo
<class> <centerX/imageWidth> <centerY/imageHeight> <bboxWidth/imageWidth> <bboxHeight/imageHeight> (We'll index this from 0-4)
And for VOC, the format is
Voc
<class> <bboxXMin> <bboxYMin> <bboxXMax> <bboxYMax> (Index this 0-4)
bboxWidth = yolo[3] * imageWidth bboxHeight = yolo[4] * imageHeight centerX = yolo[1] * imageWidth centerY = yolo[2] * imageHeight
voc[1] = centerX - (bboxWidth/2) voc[2] = centerY - (bboxHeight/2) voc[3] = centerX + (bboxWidth/2) voc[4] = centerY + (bboxHeight/2) Yolo label example
A .xml file is to be created to each text file. I can't upload .xml so I uploaded as a text file. You can ignore the action, pose and difficulty stuff, shown in below example. only name i.e class name and bbox are to be stored
How did you calculate mAP in yolo on your dataset, I asking this out of curiosity, because I have seen many post in Darknet google groups asking how to calculate mAP. And many people doesn't know how to do so. If you have calculated, please share it in the groups