Skip to main content

Drop-in pycocotools replacement — up to 23x faster COCO evaluation in pure Rust

Project description

hotcoco

CI PyPI Crates.io License: MIT

Fast enough for every epoch, lean enough for every dataset. A drop-in replacement for pycocotools that doesn't become the bottleneck — in your training loop or at foundation model scale. Up to 23× faster on standard COCO, 39× faster on Objects365, and fits comfortably in memory where alternatives run out.

Available as a Python package, CLI tool, and Rust library. Pure Rust — no Cython, no C compiler, no Microsoft Build Tools. Prebuilt wheels for Linux, macOS, and Windows.

Beyond raw speed, hotcoco ships a diagnostic toolkit that pycocotools and faster-coco-eval don't have: TIDE error breakdown, cross-category confusion matrix, per-category AP, F-scores, confidence calibration (ECE/MCE), per-image diagnostics with label error detection, sliced evaluation, dataset healthcheck, and publication-quality plots with a one-call PDF report. Same pip install, no extra config.

Documentation | Changelog | Roadmap

Performance

Benchmarked on COCO val2017 (5,000 images, 36,781 synthetic detections), Apple M1 MacBook Air:

Eval Type pycocotools faster-coco-eval hotcoco
bbox 9.46s 2.45s (3.9×) 0.41s (23.0×)
segm 9.16s 4.36s (2.1×) 0.49s (18.6×)
keypoints 2.62s 1.78s (1.5×) 0.21s (12.7×)

Speedups in parentheses are vs pycocotools. Results verified against pycocotools on COCO val2017 with a 10,000+ case parity test suite — your AP scores won't change.

At scale (Objects365 val — 80k images, 365 categories, 1.2M detections), hotcoco completes in 18s vs 721s for pycocotools (39×) and 251s for faster-coco-eval (14×) — while using half the memory. See the full benchmarks.

Get started

pip install hotcoco

No Cython, no C compiler, no Microsoft Build Tools. Prebuilt wheels for Linux, macOS, and Windows.

Already using pycocotools? One line:

from hotcoco import init_as_pycocotools
init_as_pycocotools()

Or use it directly — the API is identical:

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.run()

What's included

  • COCO, LVIS & Open Images evaluation — bbox, segmentation, keypoints, and oriented bounding box (OBB); all standard metrics plus LVIS federated eval (APr/APc/APf) and Open Images hierarchy-aware eval (group-of matching, GT expansion). OBB evaluation uses rotated IoU via polygon clipping for aerial imagery, document analysis, and scene text. See the evaluation guide.
  • Confidence calibration — ECE/MCE metrics and reliability diagrams measure whether your model's confidence scores are meaningful. See calibration.
  • Model comparisonhotcoco.compare(eval_a, eval_b) with per-metric deltas, per-category AP breakdown, and bootstrap confidence intervals for statistical significance. See model comparison.
  • Per-image diagnostics & label errors — per-image F1/AP scores, automatic detection of wrong labels and missing annotations in your ground truth. See diagnostics.
  • TIDE error analysis — breaks down every FP and FN into six error types so you know why your model falls short, not just by how much. See TIDE errors.
  • Confusion matrix — cross-category matching with per-class breakdowns. See confusion matrix.
  • F-scores — F-beta averaging over precision/recall curves, analogous to mAP. See F-scores.
  • Plotting — publication-quality PR curves, per-category AP, confusion matrices, and TIDE error breakdowns. Four built-in themes (cold-brew, warm-slate, scientific-blue, ember) with paper_mode for LaTeX/PowerPoint embedding. report() generates a single-page PDF summary. pip install hotcoco[plot]. See plotting.
  • Sliced evaluation — re-accumulate metrics for named image subsets (indoor/outdoor, day/night) without recomputing IoU. See sliced evaluation.
  • Dataset healthcheck — 4-layer validation (structural, quality, distribution, GT/DT compatibility) catches duplicate IDs, degenerate bboxes, category imbalance, and more. See healthcheck.
  • Format conversion — COCO ↔ YOLO, COCO ↔ Pascal VOC, and COCO ↔ CVAT from Python or the CLI; COCO ↔ DOTA from Python. See format conversion.
  • PyTorch integrationsCocoDetection and CocoEvaluator drop-in replacements for torchvision's detection classes; no torchvision or pycocotools dependency required. See PyTorch integration.
  • Experiment tracker integrationget_results(prefix="val/bbox", per_class=True) returns a flat dict ready for W&B, MLflow, or any logger. See logging metrics.
  • Dataset browsercoco.browse() / coco explore opens a local browser with category filter, annotation overlays (bbox/segm/keypoints), hover-to-highlight, zoom/pan, and detection comparison. Pass eval= to enable an interactive eval dashboard with PR curves, confusion matrix, TIDE errors, calibration, and per-image F1. pip install hotcoco[browse]. See Dataset Browser.
  • Python CLI (coco) — included with pip install hotcoco; eval, healthcheck, stats, filter, merge, split, sample, convert, compare, and explore subcommands. See CLI reference.
  • Rust CLI (coco-eval) — lightweight eval-only binary; cargo install hotcoco-cli. See CLI reference.
  • Type stubs — ships with .pyi stubs and py.typed marker for full autocomplete and type checking in VS Code, PyCharm, and other IDEs.
  • Rust library — use hotcoco directly in your Rust projects via cargo add hotcoco. See Rust API.

See the documentation for full API reference and examples.

Contributing

Contributions are welcome. The core library is pure Rust in crates/hotcoco/ — if you're new to Rust but comfortable with Python and the COCO spec, the PyO3 bindings in crates/hotcoco-pyo3/ are a gentler entry point.

Before submitting a PR, run the pre-commit checks locally:

cargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings
cargo test

Parity with pycocotools is a hard requirement — if your change touches evaluation logic, verify metrics haven't shifted with just parity.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hotcoco-0.4.0.tar.gz (346.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hotcoco-0.4.0-cp39-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

hotcoco-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

hotcoco-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

hotcoco-0.4.0-cp39-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

hotcoco-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

hotcoco-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file hotcoco-0.4.0.tar.gz.

File metadata

  • Download URL: hotcoco-0.4.0.tar.gz
  • Upload date:
  • Size: 346.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hotcoco-0.4.0.tar.gz
Algorithm Hash digest
SHA256 49ecd4f3a2056b61e4e43f13fef218b4f2ca4da08f2131a434bdd90729a830e7
MD5 c5d8c1bca61d714fb2d44d554ab270d4
BLAKE2b-256 d2f7e9a900dba0046b5d82e456e8c27a2cd6343eb325fd48741e3076360e02ba

See more details on using hashes here.

File details

Details for the file hotcoco-0.4.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: hotcoco-0.4.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hotcoco-0.4.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6b5893ab91038332224908ac7406cc7f6c818a8637e5533d80c2ac6001eb89d7
MD5 85b42b10cfd73de1853d625877a9f469
BLAKE2b-256 cb1cbb6f160a04d82f6cd47f7b8d2ef0f5b9d609dd4d69ef0bdff77edc5901b4

See more details on using hashes here.

File details

Details for the file hotcoco-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hotcoco-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7e675419770ce4d392262990a2309014d564097a48d3bb14178bc11354f695bd
MD5 60be43b18355d83042b751d1d033b820
BLAKE2b-256 dc0f9298ad66e1d0df39824e94b59a6d2d69a60eeb11c8b93ace3646349f1e1f

See more details on using hashes here.

File details

Details for the file hotcoco-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hotcoco-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 65aeb2e32e93609b2697bb83ec6f26d11e89439e6ef151d6f69c2139ddfff7fc
MD5 1ac101ea42683c7ac24fdc86cdf3e38a
BLAKE2b-256 6e26de71d35a441faf943d0f4a53f37a3cdce83c3920d2c36ad0a837d514919c

See more details on using hashes here.

File details

Details for the file hotcoco-0.4.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hotcoco-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf47a1a3cd322cdeaaa2925127206efaf3e2f98d59f58751596fb70aa08078d3
MD5 8ce2bd69a091739b1242f5a4c0af90e3
BLAKE2b-256 ff732cbfbb4fa9db62eb919d11191876a19672d44cd8d931d4bf67f68ce87636

See more details on using hashes here.

File details

Details for the file hotcoco-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hotcoco-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fc3d4a3517c61da8835db839260060618b210eb188b1bdfd37b2bed4e83161a5
MD5 91ce12934accabe685351deced3353dc
BLAKE2b-256 68cc3dc6862ce0b10fdca4a22dd4289d24e50934404fe2f8b16ba7189f3278a9

See more details on using hashes here.

File details

Details for the file hotcoco-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hotcoco-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f2458929c786537a7e84a2b5e21a260e6319d136fcdbf80e801d229ad2d9413
MD5 b8b432ffa7a748de431bdbb4a173109b
BLAKE2b-256 a6df9399387cc608ea39c48f5b21c5e926ec124b3cf1c6401c6526a7e6a4cba2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page