Untitled

 avatar
unknown
plain_text
4 months ago
524 B
5
Indexable
!pip install pycocotools

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

def evaluation(pred_file, gt_file):
    coco_gt = COCO(gt_file)
    coco_pred = coco_gt.loadRes(pred_file)

    # Initialize COCOeval
    coco_eval = COCOeval(coco_gt, coco_pred, iouType='keypoints')

    # Evaluate
    coco_eval.evaluate()
    coco_eval.accumulate()
    coco_eval.summarize()

    # Print mAP
    print("mAP:", coco_eval.stats[0])  # AP (Average Precision) @ IoU=0.50:0.95
Editor is loading...
Leave a Comment