Closed weijinmeng closed 2 years ago
You can use these codes for COCO dataset.
import sys
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
#initialize COCO ground truth api
annFile = sys.argv[2]
cocoGt=COCO(annFile)
#initialize COCO detections api
resFile = sys.argv[1]
cocoDt=cocoGt.loadRes(resFile)
imgIds=sorted(cocoGt.getImgIds())
# running evaluation
cocoEval = COCOeval(cocoGt, cocoDt, 'segm')
cocoEval.params.imgIds = imgIds
cocoEval.evaluate()
cocoEval.accumulate()
cocoEval.summarize()
I want to know how to get AP metrics.