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–22× 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 993 ms 22.4× 5.4× 2.3×
segm AP RF-DETR Seg-Nano 2.38 s 9.4× 4.2× 2.0×
keypoints AP ViTPose-B 129 ms 18.6× 6.1× 1.6×
boundary AP jittered GT 3.15 s 19.8× ¹ 16.9× —
Panoptic PQ perfect DT 10.5 s 3.3× ² — —
Semantic mIoU perfect DT 2.87 s 14.1× ³ — —
LVIS v1 bbox AP jittered GT 2.50 s 81.0× ⁴ — 1.6×

¹ boundary-iou-api · ² panopticapi · ³ mmsegmentation · ⁴ lvis-api, with 13.6× lower peak memory (1.11 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 15.4× / 4.0× / 1.9×. Treat a single-workload speedup as a point estimate, not a property of the library — the full 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 395 MiB, against 997 MiB (hotcoco), 1383 MiB (faster-coco-eval) and 1429 MiB (pycocotools) — a 2.5–3.6× 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.5× 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 306 ms 221 ms 146 ms 131 ms 2.8× 11.4×
segm 926 ms 536 ms 304 ms 239 ms 2.3× 14.6×
boundary 3.18 s 1.68 s 866 ms 711 ms — 23.8×
keypoints 139 ms 90 ms 60 ms 52 ms 3.1× 14.7×
bbox, Objects365 (1.06M dets) † 6.6 s — — 3.2 s 2.6× 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 the synthetic-DT rows, the RF-DETR snapshot for the real-prediction ones.

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.4

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.4
File Size Uploaded
vernier-0.5.4.tar.gz 816.9 kB Details

Built distributions (wheels)

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

Total release size: 17.0 MB

Release files / vernier-0.5.4.tar.gz

Download URL vernier-0.5.4.tar.gz
Size 816.9 kB
Tags Source
SHA-256 checksum
How to use checksums
751890740f2ef7b8e47dd0e25ac7ff544e5ec406b2241524477d4bdff516e399
BLAKE2b-256 checksum
How to use checksums
20f319adcb8da500dc2ce2430f734efce70dae34bf70f5bc9c994e525e8c5a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-cp310-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
655f6cb79ef2e3e950658f33c3d55e6ed816fb0de475bfaf07a0f9e2f0e4445c
BLAKE2b-256 checksum
How to use checksums
6ca71cca7faefdd8620799ad1f46726af40469a52fe441e7dc45ed971b2b0ca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-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
e486fcc6941102cdd1d59f2eff73426c3a3470582b59f4b63b5174bfcbed05c2
BLAKE2b-256 checksum
How to use checksums
897640019512009bb6462cb4b5ab4bd1020ddc7b01b7e78af68ed8d67fe0cb0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-cp310-abi3-musllinux_1_2_aarch64.whl
Size 2.3 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
232e1ef76f92ab36885f5d2df01af894697d2f2966ab24af2bacf6c164407385
BLAKE2b-256 checksum
How to use checksums
0b03f2b9a96130fc5cd4ba1966a7ce86598e4365cff16b2513554a853414c82f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-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
2bf3fa0bc1c28b84dc9041f5e561511d02bffab1921106593adb95755bd30dcc
BLAKE2b-256 checksum
How to use checksums
5c11f0a90d0e2c6cba2c168e601a7c2836e35911dd8477a611481f58ceea279a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-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
18eec7c51c46ec76261d4850b47918d98fe8bf82912b3e5479a02b45c835b12b
BLAKE2b-256 checksum
How to use checksums
5b8dd128aea0a9db4e5a3842bba20b574c33c11f2f306edcfa4f633a67bbf721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-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
898fa563ee599f559f0ee4ee4492f602920832f4c487605299f28c0e2a887c28
BLAKE2b-256 checksum
How to use checksums
18604ab10fa911cc5f262647ee36d55f951e821cfe93ec394d3c6e6e468e4263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

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

Download URL vernier-0.5.4-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.2 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d4834d5c72e3f3ede95f83492d1be7bfe85e528a155ee5d32dfb86c38c2f5e16
BLAKE2b-256 checksum
How to use checksums
46114e5a727adb9294f2a69fb1ef11eb10aa3cb0ccb916931c7fc5a971812707
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.4 This release

8 release files

0.5.3

8 release files

0.5.2

8 release files

0.5.1

8 release files

0.5.0

8 release files

0.4.1

8 release files

0.4.0

8 release files

0.3.0

8 release files

0.2.0

8 release files

0.1.0

8 release files

0.0.4

8 release files

0.0.3

8 release files

0.0.2

8 release files

0.0.1

7 release files

0.0.0

2 release files

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