类子集的 COCO api 评估 [英] COCO api evaluation for subset of classes

查看:51
本文介绍了类子集的 COCO api 评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 python coco api 运行对象检测评估.我有两个文件,一个ground truth json和一个results json.coco notebook demo 仅显示对所有类运行 eval.如何只为一个特定的类或类的子集运行它?目前我正在这样做:

I'm using the python coco api to run evaluation for object detection. I have two files, a ground truth json, and a results json. The coco notebook demo only shows running eval for all classes. How can I run it for only one specific class or a subset of classes? Currently I'm doing this:

from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval

annType = 'bbox'

cocoGt=COCO(gt_json)
cocoDt=cocoGt.loadRes(results_json)

imgIds=sorted(cocoGt.getImgIds())

# running evaluation
cocoEval = COCOeval(cocoGt,cocoDt,annType)
cocoEval.params.imgIds = imgIds
cocoEval.evaluate()
cocoEval.accumulate()
cocoEval.summarize()

推荐答案

我参考这个页面 (http://www.programmersought.com/article/3065285708/)

I refer to this page (http://www.programmersought.com/article/3065285708/)

cocoEval = COCOeval(cocoGt,cocoDt,annType)
coco_eval.params.catIds = [1] #person id : 1
cocoEval.params.imgIds = imgIds   
cocoEval.evaluate()  
cocoEval.accumulate()  
cocoEval.summarize() 

此外,我修改了 cocoapi/PythonAPI/pycocotools/cocoeval.py 来计算每个类别的 AP.
https://github 中的第 458-464 行.com/kimyoon-young/centerNet-deep-sort/blob/master/tools/cocoeval.py

Additionaly, I modified cocoapi/PythonAPI/pycocotools/cocoeval.py to calculate AP for each category.
line 458-464 in https://github.com/kimyoon-young/centerNet-deep-sort/blob/master/tools/cocoeval.py

结果如下.

类别:0:0.410733757610904 #person AP
类别:1:0.20226150054237374 #bird AP
....
类别:79:0.04993736566987926
(所有类别)地图:0.27999824034118914 # 我的结果
平均精度 (AP) @[ IoU=0.50:0.95 |面积=全部|maxDets=100 ] = 0.280 #original

category : 0 : 0.410733757610904 #person AP
category : 1 : 0.20226150054237374 #bird AP
....
category : 79 : 0.04993736566987926
(all categories) mAP : 0.27999824034118914 # my results
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.280 #original

这篇关于类子集的 COCO api 评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆