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

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.2
File Size Uploaded
vernier-0.5.2.tar.gz 813.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for vernier 0.5.2
File
vernier-0.5.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
vernier-0.5.2-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
vernier-0.5.2-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details
vernier-0.5.2-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.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
vernier-0.5.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
vernier-0.5.2-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.2.tar.gz

Download URL vernier-0.5.2.tar.gz
Size 813.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9211576d2774e584ff2dcfa20929b5eee12522b7be059a80ce0b0dfe6fbefd82
BLAKE2b-256 checksum
How to use checksums
12e17c841ef5781a414c03de74b33fc936e85171395cb36146a79a805e03af45
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-cp310-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
6d94adf97c73fa10cee189a1e8ce3c5f10109122f37f11f7ccf0fa505ebe9f5f
BLAKE2b-256 checksum
How to use checksums
01170d1b30112f2e9ab1ecc0de6fdab06a24650cdcc38bdba0b7d2a1889fbb23
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-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
a5919ff3001bf7673334da11eac27480979489b658843b7c168881262b419d32
BLAKE2b-256 checksum
How to use checksums
f82001a6f99eb3666468ffeeead62c66c7ed51c9e0192bc57b654de7b670f6a8
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-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
cf99e46fbc4d8a08c062702d40b2ee7bdb0ad8d0e31a05d457878ae8a109aa49
BLAKE2b-256 checksum
How to use checksums
d4615613846ba524481dd43fda9ec001b3d8b837dcfa86eb0eb9ad3532d8d818
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-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
0a7c2821540cdabffea9fd308e8aa5f93af9db346f38f4ea90ff2688c832d735
BLAKE2b-256 checksum
How to use checksums
d414e3786cc7fa3c4a049b95f5d95f241195def608cfe4e82f555e92a4163749
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-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
8cf080177dd59bc9ffe3074db31d6a46e3eae72215c27f318f555dc5b97a3097
BLAKE2b-256 checksum
How to use checksums
f02514dcf185530ae624f564aeeb9739d293573bdf5b40970e6c1c2cf6b38c50
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-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
2fd9120c0a27dbb80f1b7f2e3ed457093f0355213edbf8b62d11aee3e593b95b
BLAKE2b-256 checksum
How to use checksums
3f8657f00590237385821a6b7585a60d3bd7055e68bbb4593da371995d5008eb
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 22, 2026.

Transparency log

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

Download URL vernier-0.5.2-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
73f5106ad0ded9a4a6da001fa67eb42da7c0d8c04de17a97c723340a8008ef43
BLAKE2b-256 checksum
How to use checksums
07af667f14cbb5c6e8f42135f88b1fdfe51faf19640888f58badeaaa2e86b7c9
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 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.4

8 release files

0.5.3

8 release files

This release

0.5.2 This release

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