AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.8k stars 7.97k forks source link

mAP (mean average precision) calculation for different Datasets (MSCOCO, ImageNet, PascalVOC) #2746

Open AlexeyAB opened 5 years ago

AlexeyAB commented 5 years ago

Different approaches of mAP (mean average precision) calculation:

  1. -map_points 101 for MS COCO
  2. -map_points 11 for PascalVOC 2007 (uncomment difficult in voc.data)
  3. -map_points 0 for ImageNet, PascalVOC 2010-2012 and your custom dataset

For example:

Then calculate: AP@[.5, .95] = mAP@IoU=0.50:.05:.0.95 = (mAP@IoU=0.50 + mAP@IoU=0.55 + mAP@IoU=0.60 + mAP@IoU=0.65 + mAP@IoU=0.70 + mAP@IoU=0.75 + mAP@IoU=0.80 + mAP@IoU=0.85 + mAP@IoU=0.90 + mAP@IoU=0.95) / 10


I.e.


URLs:

pjspillai commented 5 years ago

@AlexeyAB Hi, Thanks for sharing these! These are super helpful.

Quick question, did you try verifying your mAP script result matches the one mentioned in Yolo3 paper on the COCO test-dev set? Thanks!

AlexeyAB commented 5 years ago

@pjspillai Hi,

There are no public annotations for COCO test-dev, so there is nothing to use with detector map command. But there is only 2014 Testing Image info [1MB] that doesn't contain bboxes: http://cocodataset.org/#download

How to check Yolo v3 on COCO test-dev set on evaluation server is described here: https://github.com/AlexeyAB/darknet/issues/2145


You can check yolov3-spp.weights model on COCO 2014 val-set 5k, that you can get by using this script: https://github.com/AlexeyAB/darknet/blob/master/scripts/get_coco_dataset.sh And get mAP@0.5 ~= 59.3%

chenjoya commented 5 years ago

@AlexeyAB Hi, Thanks for your elegant solution! Could you provide a more convenient method to calc AP@[.5, .95]? e.g.:

./darknet detector map cfg/coco.data cfg/yolov3-spp.cfg yolov3-spp.weights -points 101 -iou_thresh 0.5~0.95

Thanks!

chenjoya commented 5 years ago

Here we provide YOLOv3-320 evaluation results on COCO val 2017 by this implemention and cocoapi respectively. It seems that there are some difference between them.

repo AP50 AP75 script
cocoapi 63.6 35.6 ./darknet detector valid cfg/coco.data cfg/yolov3.cfg yolov3.weights -out yolov3-320, then eval the yolov3-320.json with cocoapi
darknet-AlexeyAB 62.29 34.55 ./darknet detector map cfg/coco.data cfg/yolov3.cfg yolov3.weights -points 101 -iou_thresh 0.5 or 0.75

COCOAPI: (https://github.com/cocodataset/cocoapi) 2

This implemention (AP50 & AP75): 1 3

Thanks for your attention.

AlexeyAB commented 5 years ago

@ChenJoya Hi,

There are additional params (iscrowd) in the COCO dataset which can be taken into account by the Pycocotool script, but Yolo can't, because Yolo labels don't support them.

p3jawors commented 5 years ago

@AlexeyAB can you please confirm the command for running mAP (or evaluation for that matter) on PASCAL-VOC 07? I see you have it listed as ./darknet detector map cfg/coco.data cfg/yolov3-spp.cfg yolov3-spp.weights -points 11 but the reference to coco.data seems wrong. I also get issues running this command as it looks for the file coco_testdev. I imagine the line should be ./darknet detector map cfg/voc.data cfg/yolov3-voc.cfg yolov3-voc.weights -points 11 However, I am having trouble finding the yolov3-voc.weights.

If I try to run it with the yolov3-spp.weights and yolov3-spp.cfg it also does not work (number of classes mismatch). I believe that those weights are also trained on MS-COCO since the cfg is set to 80 classes. The same happens with yolov3.weights and yolov3.cfg.

Can you please confirm the command to run on PASCAL-VOC07, and if you have a link to the pre-trained weights that would be immensely appreciated.

AlexeyAB commented 5 years ago

There is no trained model of Yolo v3 for Pascal VOC.

There is model Yolo v2 for Pascal VOC: https://github.com/AlexeyAB/darknet#pre-trained-models yolov2.cfg (194 MB COCO Yolo v2) - requires 4 GB GPU-RAM: https://pjreddie.com/media/files/yolov2.weights yolo-voc.cfg (194 MB VOC Yolo v2) - requires 4 GB GPU-RAM: http://pjreddie.com/media/files/yolo-voc.weights

How to check the mAP on Pascal VOC: https://github.com/AlexeyAB/darknet#how-to-calculate-map-on-pascalvoc-2007

p3jawors commented 5 years ago

Thank you for the quick reply,

Cheers