darknet yolo 计算mAP,recall

1.生成检测结果文件

./darknet detector valid cfg/car.data cfg/car.cfg backup/car_final.weights -out car.txt -gpu 0 -thresh .5

2.把car.txt 用faster rcnn 中voc_eval计算mAP

/home/sam/src/caffeup2date_pyfasterrcnn/lib/datasets/compute_mAP.py

from voc_eval import voc_eval

print voc_eval('/home/sam/src/darknet/results/{}.txt', '/home/sam/datasets/car2/VOC2007/Annotations/{}.xml', '/home/sam/datasets/car2/VOC2007/ImageSets/Main/test.txt', 'car', '.')

第三个结果就是


如果只想计算大于0.3的输出结果的mAP,把 voc_eval.py文件中如下代码更改

sorted_ind = np.argsort(-confidence)
sorted_ind1 = np.where(confidence[sorted_ind] >= .3)[0]#np.argsort(-confidence<=-.3)
sorted_ind = sorted_ind[sorted_ind1]



3.计算recall 

./darknet detector recall cfg/car.data cfg/car.cfg backup/car_final.weights -out car.txt -gpu 0 -thresh .5



你可能感兴趣的:(深度学习,darknet,yolo)