Drop-in pycocotools replacement — up to 23x faster COCO evaluation in pure Rust
Project description
hotcoco
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, 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, and keypoints; all standard metrics plus LVIS federated eval (APr/APc/APf) and Open Images hierarchy-aware eval (group-of matching, GT expansion). See the evaluation guide.
- 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. Three built-in themes (
warm-slate,scientific-blue,ember) withpaper_modefor 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 in either direction, from Python or the CLI. See format conversion.
- PyTorch integrations —
CocoDetectionandCocoEvaluatordrop-in replacements for torchvision's detection classes; no torchvision or pycocotools dependency required. See PyTorch integration. - Experiment tracker integration —
get_results(prefix="val/bbox", per_class=True)returns a flat dict ready for W&B, MLflow, or any logger. See logging metrics. - Python CLI (
coco) — included withpip install hotcoco;eval,healthcheck,stats,filter,merge,split,sample, andconvertsubcommands. See CLI reference. - Rust CLI (
coco-eval) — lightweight eval-only binary;cargo install hotcoco-cli. See CLI reference. - 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 (see CONTRIBUTING.md).
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hotcoco-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: hotcoco-0.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05b002597d61ced756ad3e7fc75c82f9908c12c8e7d7004cc5ac41747a88bc91
|
|
| MD5 |
8474460abb978f7fb24d799831696c9a
|
|
| BLAKE2b-256 |
cc8b6be46f7657e7fda1b924b5b85c50f44b1f2a8cf3a1e1ef20135ace2a8852
|
File details
Details for the file hotcoco-0.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: hotcoco-0.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3f8bc5dd620594ee752216e5d106857ea96f229f5cd702ed00df56f20f773fd
|
|
| MD5 |
171245757c1d0ee0228d45df44ec150d
|
|
| BLAKE2b-256 |
baaf8ca9f1e74f3f5862fbb46efb7cbd90ee84ad60b23e6b59109b57d089c7db
|
File details
Details for the file hotcoco-0.3.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: hotcoco-0.3.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a63eab524ee3de8db198c9d3e7d9b36a58570d2a7ba67f81252a709e4d675dd6
|
|
| MD5 |
7e2f8371d7b15076f4618647a62655f7
|
|
| BLAKE2b-256 |
7a915902e944cc7d1ef76b8d43c103fdde604527dadb27d5f4a9cb0cdf691b66
|
File details
Details for the file hotcoco-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: hotcoco-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7c5c197e69f904719718ad1c0811094e9d8673f31ff678232024367d3d7790
|
|
| MD5 |
bd18810cef29c54285e75e7ada0f1585
|
|
| BLAKE2b-256 |
274eb2eb1797e594420494d9ce42b347fb51c452f0affce49e47577cd2749a60
|
File details
Details for the file hotcoco-0.3.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: hotcoco-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b529d98a296fcb79974da4672925b38d7cc5722e06c4dfa53badfc0e3a93b439
|
|
| MD5 |
a501c023c100de035b855df6b538ca58
|
|
| BLAKE2b-256 |
a2bfdbeeaddc16398dc2eb84719ab3adf26c0470da14bbe8997b9a7e115834c1
|
File details
Details for the file hotcoco-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: hotcoco-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d549281e9f54d11e8511cef4e41260c7cc2bae0e7222ba320b92db1b2526303
|
|
| MD5 |
0fbbc36df1665484169ce75fad8d0471
|
|
| BLAKE2b-256 |
232c18798639b7d52b95ecd8f38793b3421aeb4b83964786164e5a1271898085
|
File details
Details for the file hotcoco-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: hotcoco-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b63a682d589c9d41c12a05da8883f1b98cdacbe41ad453f1244ba8f1420b527e
|
|
| MD5 |
d90e1fcc87f3198f14648e1034e5e825
|
|
| BLAKE2b-256 |
9eb4f6dd58b3428a41dcb651d34b0313d88ff3c676a218ac9f7b281c04c952a8
|