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.
-
Install from local:
git clone https://github.com/imyhxy/ccocotools cd ccocotools && python setup.py install
-
Install from Github:
pip install git+http://github.com/imyhxy/ccocotools
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()
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 |