imyhxy / ccocotools

This is a C++ implementation of cocoapi bbox evaluation code.
11 stars 0 forks source link
bbox coco cocoapi object-detection python

Fast COCOApi for COCO bbox task

This repository just copy and paste PythonAPI from the official cocoapi, merge the C++ implementation of COCOeval in detectron2 into FastCOCOeval. Simplify all unnecessary requirements and make it easy to install.

Installation

Usage

from ccocotools.coco import COCO
from ccocotools.fastcocoeval import FastCOCOeval

gt_json = 'instance_val2017.json'
pd_json = 'predictions.json'

anno = COCO(gt_json)
pred = anno.loadRes(pd_json)
coco_eval = FastCOCOeval(anno, pred, 'bbox')
coco_eval.evaluate()
coco_eval.accumulate()
coco_eval.summarize()

Performance

The C++ implementation reduces 75% total time compares to the python one.

Implementation evaluate() accumulate() summarize() Total
Python 73.0s 15.4s 3.6ms 92.0s
C++ 16.4s 2.5s 3.9ms 22.8s

Reference