Skip to main content

vernier

PyPI Python Crates.io License

Fast, auditable evaluation for 2D vision models. Detection, instance and panoptic segmentation, semantic segmentation, keypoints, and LVIS, all in one package with a Rust core, a Python API, and a standalone CLI.

  • Bit-exact with pycocotools==2.0.11, panopticapi, lvis-api and boundary-iou-api in strict mode. Every upstream quirk has a documented disposition (quirks survey).
  • Drop-in for pycocotools.cocoeval.COCOeval: change one import, or none. Same constructor, same params mutations, same eval / evalImgs / ious / stats read back off the instance (what carries over).
  • 4–24× faster than faster-coco-eval and pycocotools at equal CPU budget, measured on real detector output rather than jittered ground truth (benchmarks).
  • Built for real pipelines: training-loop evaluation, multi-rank gathering, per-image tables, error decomposition, calibration, scenario slicing.

Install

pip install vernier               # Python ≥ 3.10, abi3 wheels
cargo binstall vernier-cli        # standalone `vernier` binary, no Python needed
cargo add vernier                 # Rust library

Quickstart: the COCO API you already know

vernier.COCOeval has the same constructor, the same evaluate() / accumulate() / summarize() sequence, and the same .stats as pycocotools. It defaults to parity_mode="strict", so the output is bit-identical (see Status & validation for what that is measured against).

from pycocotools.coco import COCO
from vernier import COCOeval  # was: from pycocotools.cocoeval import COCOeval

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

E = COCOeval(coco_gt, coco_dt, iouType="bbox")  # "segm" | "keypoints" | "boundary"
E.evaluate()
E.accumulate()
E.summarize()

Code you can't edit (mmdetection, detectron2, ultralytics, …): patch the symbol before anything imports pycocotools.cocoeval.

import vernier

unpatch = vernier.patch_pycocotools()  # pycocotools.cocoeval.COCOeval -> vernier
run_existing_eval()
unpatch()

The patch is explicit, reversible, and never happens on import. A context manager (vernier.adapters.patched_pycocotools) and a one-fixture pytest recipe are in the pycocotools migration guide.

TorchMetrics' MeanAveragePrecision runs under the patch unchanged, including class_metrics=True and extended_summary=True (tests/python/test_compat_torchmetrics.py asserts the patched and unpatched results are equal). Two params fields are the exception and raise rather than diverge quietly: imgIds subsetting, and areaRng (custom area ranges are a native-Evaluator feature, ADR-0040). The migration guide has the field-by-field table.

The shim exists for migration. New code should use the native Evaluator: immutable configuration, typed results, no pycocotools dependency, and access to everything below.

from pathlib import Path
from vernier.instance import Bbox, CocoDataset, Evaluator

gt = CocoDataset.from_json(Path("instances_val2017.json").read_bytes())
dt = Path("detections.json").read_bytes()

evaluator = Evaluator(iou=Bbox(), parity_mode="strict")
summary = evaluator.evaluate(gt, dt, num_threads=8)

print("\n".join(summary.pretty_lines()))  # the familiar 12-line table
ap = summary.stats[0]

The native Evaluator defaults to parity_mode="corrected", which applies the itemized fixes to upstream bugs. Pass "strict" when your numbers must match published pycocotools results.

Inside a training loop, evaluate on a background worker and feed it tensors directly (torch, JAX, CuPy, NumPy via DLPack, zero-copy):

with evaluator.background(gt) as bg:
    for images, targets in val_loader:
        preds = model(images)
        bg.submit([{"image_id": int(t["image_id"]), **p} for t, p in zip(targets, preds)])
    summary = bg.finalize()

Per-image and per-class diagnostics as Polars DataFrames (pip install "vernier[tables]"):

result = evaluator.evaluate(gt, dt, tables="all")
result.per_class

Paradigms

Pick the submodule that matches your model's output. They have different data models and matching rules, so they are separate evaluators rather than one class with a mode switch (why).

Submodule Input Metrics
vernier.instance Scored detections: boxes, masks, keypoints AP / AR (bbox, segm, boundary, OKS), LVIS federated AP
vernier.panoptic Panoptic PNGs + segments_info PQ / SQ / RQ, boundary PQ
vernier.semantic Class-id label maps mIoU, FWIoU, pixel accuracy, mean accuracy

Beyond the COCO API

Need Feature Guide
Evaluate without blocking training Evaluator.background(...) how-to
Evaluate across DDP ranks evaluate_to_partial / from_partials how-to
Find which images/classes regressed tables="all" how-to
Explain an AP gap TIDE error decomposition, oLRP tutorial
Check score calibration ECE / MCE / reliability (calibration=True) how-to
Metrics per weather, time of day, … Manifest slicing, vernier aggregate (mPC / rPC) how-to
Non-standard IoU / recall / area grids iou_thresholds=, recall_thresholds=, area_ranges= how-to

CLI

A static binary for CI gates and robotics replay pipelines. Output is byte-deterministic (sorted keys, no timestamps), so artifacts diff cleanly.

vernier eval --gt gt.json --dt dt.json --iou-type bbox                  # pycocotools-identical stdout
vernier eval --gt gt.json --dt dt.json --iou-type segm --emit json=result.json --threads 8

Exit codes: 0 success, 1 evaluation error, 2 invalid arguments. Full reference: crates/vernier-cli.

Status & validation

Every row is checked by a parity harness that runs the reference implementation and vernier on the same inputs. "Bit-exact" means parity_mode="strict", against the reference as published on PyPI — vernier's own output is identical on x86-64 and ARM. (A pycocotools you recompile from source can round bbox IoU 1-2 ULP differently on ARM; see ADR-0056 and the migration guide.)

Metric Reference Parity Notes
bbox / segm / keypoints AP pycocotools==2.0.11 bit-exact
Boundary AP boundary-iou-api bit-exact
LVIS federated AP lvis-api 0.5.3 bit-exact full v1 val, bbox
Panoptic PQ, boundary PQ panopticapi (single-core path) bit-exact Cityscapes panoptic deferred
Semantic mIoU / FWIoU / pAcc / mAcc mmseg.IoUMetric v1.2.2 (vendored) bit-exact on class marginals ADR-0036 proposed; ADE20K-scale check pending
oLRP clean-room NumPy oracle ≤ 1e-9 panoptic not supported
Calibration (ECE / MCE) clean-room NumPy oracle bit-exact detection family only
TIDE thresholds (segm, boundary) none corrected only ADR-0022 proposed

Parity model: ADR-0002. Library-by-library comparison: docs/comparison.md.

Performance

Median wall time at a one-CPU budget (CPU/wall is 1.00 in every cell). COCO val2017 throughout, except the LVIS row, which is LVIS v1 val. Speedup is the other library's time divided by vernier's.

The DT source column is load-bearing. A jittered workload perturbs the ground truth to synthesise detections, which inherits the GT's per-image class distribution — not the distribution a detector actually produces. The bbox and segm rows are measured on real RF-DETR predictions on val2017 (513,808 and 430,516 detections) and the keypoints row on real ViTPose output; the remaining rows still run against synthetic DT, and are labelled as such rather than presented as equivalent.

Workload DT source vernier vs pycocotools vs faster-coco-eval vs hotcoco
bbox AP RF-DETR Nano 955 ms 23.8× 5.7× 2.4×
segm AP RF-DETR Seg-Nano 2.34 s 9.5× 4.3× 2.1×
keypoints AP ViTPose-B 129 ms 18.6× 6.1× 1.6×
boundary AP jittered GT 3.12 s 19.1× ¹ 17.1× —
Panoptic PQ perfect DT 10.5 s 3.3× ² — —
Semantic mIoU perfect DT 2.86 s 13.9× ³ — —
LVIS v1 bbox AP jittered GT 2.32 s 84.3× ⁴ — 1.7×

¹ boundary-iou-api · ² panopticapi · ³ mmsegmentation · ⁴ lvis-api, with 14.8× lower peak memory (1.02 vs 15.08 GiB)

A second real detector on the same kernel and GT gives a different point estimate: RF-DETR Seg-Nano's bbox output (16% fewer detections, higher AP) measures 16.7× / 4.2× / 2.0×. Treat a single-workload speedup as a point estimate, not a property of the library — the release snapshot gives per-stage breakdowns, including the one cell where hotcoco's evaluate kernel is faster than vernier's.

Peak RSS on the real bbox cell is 390 MiB, against 997 MiB (hotcoco), 1384 MiB (faster-coco-eval) and 1429 MiB (pycocotools) — a 2.6–3.7× advantage. Every implementation's working set grows with real detection density, but not by the same factor: against hotcoco the gap widens from 1.4× on the synthetic cell to 2.6× here, because hotcoco's per-detection Python-object overhead scales with detection count while vernier's binary ingest does not.

Thread scaling (num_threads, 8-vCPU host)

faster-coco-eval ≥ 1.8 and hotcoco are multi-threaded by default, so each column compares equal CPU budgets.

Workload 1 2 4 8 vs hotcoco @ 8 vs faster-coco-eval @ 8
bbox 293 ms 213 ms 141 ms 125 ms 2.9× 11.9×
segm 886 ms 514 ms 292 ms 234 ms 2.3× 14.8×
boundary 3.10 s 1.64 s 853 ms 703 ms — 24.0×
keypoints 134 ms 87 ms 59 ms 50 ms 3.2× 15.2×
bbox, Objects365 (1.06M dets) † 6.1 s — — 2.9 s 2.9× OOM at ~30 GiB

Strict-mode results are bit-identical across thread counts. † Single-rep dev run; pycocotools takes ~6 min per rep at this size. The faster-coco-eval OOM is carried forward from the previous round rather than re-measured — reproducing a 30 GiB OOM destabilises the host mid-round.

AMD EPYC-Milan KVM VPS (4 cores x 2 threads = 8 logical CPUs), harness mode release (N=10 measurement reps + 2 warmup, randomised impl order, 5% relative-IQR gate), against hotcoco==1.0.1, faster-coco-eval==1.8.0 and pycocotools==2.0.11. Full methodology, every baseline pin and the complete results: docs/benchmarks.md for every timed row except keypoints, the release snapshot for the round's narrative.

Documentation

Contributing

just lint && just test && just audit

See CONTRIBUTING.md for the ADR workflow, vendoring policy, and code style.

License

Licensed under either of Apache-2.0 or MIT at your option. Test-only reference implementations used for parity checks are listed in THIRD_PARTY_NOTICES.md. They are not shipped in wheels or binaries.

Metadata

Release files for vernier 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vernier 0.5.5
File Size Uploaded Provenance Actions
vernier-0.5.5.tar.gz 832.9 kB With provenance Details for vernier-0.5.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for vernier 0.5.5
File Actions
vernier-0.5.5-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for vernier-0.5.5-cp310-abi3-win_amd64.whl
vernier-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for vernier-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl
vernier-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for vernier-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl
vernier-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for vernier-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
vernier-0.5.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for vernier-0.5.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
vernier-0.5.5-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for vernier-0.5.5-cp310-abi3-macosx_11_0_arm64.whl
vernier-0.5.5-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for vernier-0.5.5-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 17.0 MB

Release files / vernier-0.5.5.tar.gz

Download URL vernier-0.5.5.tar.gz
Size 832.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ca7f10b04f3d33e9cb6c794cc7290964f0007da988ec31e24a845ed09571979b
BLAKE2b-256 checksum
How to use checksums
07804e769d2e39508eadb3f7a1b35dbdcf74b056c6f53ee560da661445d0f02a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-win_amd64.whl

Download URL vernier-0.5.5-cp310-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
13b1e0689088ef2b8ae5f7bb55395d08557c65dc5d511347080a2e0bdd068ceb
BLAKE2b-256 checksum
How to use checksums
f370283e3ce7e2bea98effef8b79926f47b9f811c2efb87cefe032a2efa9df34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL vernier-0.5.5-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.6 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
2cb5f1a55c74142a7a93f974e446336ffa026e42a6407f2976d3c48213e46392
BLAKE2b-256 checksum
How to use checksums
db924b566be98eb79cf45f481975aa14dbf291a99e942eea2b69e1213e15f836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL vernier-0.5.5-cp310-abi3-musllinux_1_2_aarch64.whl
Size 2.4 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
67c4474ad09461d4e755574c02b9b7d036f1c1669dde0ae4f20e485ff6cd2ff1
BLAKE2b-256 checksum
How to use checksums
dea5eee0e9b281e3641ad32d7dc93f1df00a1a9f4a36d2e2f123702efa9d8040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL vernier-0.5.5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f2fd415a439d4a20fdf1ee5bfb3f8281d65ec7723e199b78562f4dd4375e0bac
BLAKE2b-256 checksum
How to use checksums
57b1251981ca50b1257bac402bfc4ac48f587f1563de2ed8de8bd88d458fbb70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL vernier-0.5.5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a71a2bc73a54068631140a6f7446e704d6f0bfc26f5e7ba6e787168c248dde8c
BLAKE2b-256 checksum
How to use checksums
756e04b9e3fe771967e00f26639f911caec83599a3873986caf86a611e00d069
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-macosx_11_0_arm64.whl

Download URL vernier-0.5.5-cp310-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8bdb92d18e0142d6715855032f8d31d6727c9261bc137cfcad421420f5363ad7
BLAKE2b-256 checksum
How to use checksums
ec01864959e6625ea9cce8b77d3412c3dbc2602ba30a89bd487c6972fb4883e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / vernier-0.5.5-cp310-abi3-macosx_10_12_x86_64.whl

Download URL vernier-0.5.5-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
20bbab2c3d00432a035264ee8eca134e2dca45e495c3060d6c17d51b4d80c2f6
BLAKE2b-256 checksum
How to use checksums
8c97faaee4df40d29719ab357623e7d57ddcdb87b7709e79ec506154f12c43c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for vernier 0.5.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for vernier-0.5.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page