用yolov4跑了下 coco 的 val2017,想看看map,但是coco2017的json标注又不能直接用,所以先用yolov4的
./darknet detector valid data/coco.data cfg/yolov4.cfg backup/yolov4.weights
生成result.json
然后再用以下脚本计算map
# author: Wu
# modified from: https://blog.csdn.net/qq_40527427/article/details/106166842
# 2022/1/22
# This script is used to evaluate map using gt json and output json in coco format
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
# coco格式的json文件,原始标注数据
anno_file = '/data0/wjh/coco/annotations/instances_val2017.json'
res_path = '/home/wujiahao/yolov4/darknet-master/results/coco_results.json'
coco_gt = COCO(anno_file)
coco_dt = coco_gt.loadRes(res_path)
cocoEval = COCOeval(coco_gt, coco_dt, 'bbox')
cocoEval.evaluate()
cocoEval.accumulate()
cocoEval.summarize()
print(cocoEval.stats)
版权声明:本文为CSDN博主「sysu_first_yasuo」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44326452/article/details/122645080
暂无评论