hotcoco 0.1.0

Rust implementation of pycocotools — COCO dataset API for object detection, segmentation, and keypoint evaluation
Documentation
  • Coverage
  • 60.84%
    87 out of 143 items documented0 out of 49 items with examples
  • Size
  • Source code size: 129.41 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 8.59 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 29s Average build duration of successful builds.
  • all releases: 29s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • derekallman/hotcoco
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • derekallman

hotcoco

A drop-in replacement for pycocotools — 11-26x faster COCO evaluation for object detection, segmentation, and keypoints.

Available as a Python package, CLI tool, and Rust library.

Documentation | Changelog | Roadmap

Performance

Benchmarked on COCO val2017 (5,000 images, 36,781 ground truth annotations, ~43,700 detections), Apple M1 MacBook Air:

Eval Type pycocotools faster-coco-eval hotcoco
bbox 11.79s 3.47s (3.4x) 0.74s (15.9x)
segm 19.49s 10.52s (1.9x) 1.58s (12.3x)
keypoints 4.79s 3.08s (1.6x) 0.19s (25.0x)

Speedups in parentheses are vs pycocotools. All metrics match pycocotools within 0.003 (many are exact).

Quick Start

Python

pip install hotcoco
from hotcoco import COCO, COCOeval

coco_gt = COCO("instances_val2017.json")
coco_dt = coco_gt.load_res("detections.json")

ev = COCOeval(coco_gt, coco_dt, "bbox")
ev.evaluate()
ev.accumulate()
ev.summarize()

Drop-in replacement for pycocotools

If you have existing code that imports from pycocotools and don't want to change every import, call init_as_pycocotools() once at startup:

from hotcoco import init_as_pycocotools
init_as_pycocotools()

# Existing code works unchanged
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from pycocotools import mask

CLI

cargo install hotcoco-cli
coco-eval --gt annotations.json --dt detections.json --iou-type bbox

Rust

cargo add hotcoco
use hotcoco::{COCO, COCOeval};
use hotcoco::params::IouType;
use std::path::Path;

let coco_gt = COCO::new(Path::new("annotations.json"))?;
let coco_dt = coco_gt.load_res(Path::new("detections.json"))?;

let mut eval = COCOeval::new(coco_gt, coco_dt, IouType::Bbox);
eval.evaluate();
eval.accumulate();
eval.summarize();

License

MIT