Skip to main content

High-performance, parity-preserving COCO-style evaluation

Project description

vernier

CI PyPI crates.io vernier-core crates.io vernier-mask crates.io vernier-cli License: MIT OR Apache-2.0 Open In Colab

Fast, parity-preserving evaluation for object detection, instance / panoptic / semantic segmentation, boundary IoU, OKS keypoints, LVIS federated, LRP / oLRP error decomposition, and detection-family calibration (ECE / MCE / reliability). Rust core, Python frontend, optional CLI.

60-second example

One-shot — predictions already serialized to JSON (end-of-epoch checkpoint, CI gate, post-training inspection):

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

gt_bytes = Path("instances_val2017.json").read_bytes()
dt_bytes = Path("detections.json").read_bytes()

dataset = CocoDataset.from_json(gt_bytes)
summary = Evaluator(iou=Bbox()).evaluate(dataset, dt_bytes)
for line in summary.pretty_lines():
    print(line)

In a training loop — overlap eval with the data loading and inference. The matching kernel runs on a worker thread, so submit(...) returns immediately and the main thread keeps moving. Passing a CocoDataset reuses the parsed-once GT and its per-kernel derivation cache across every epoch (ADR-0020):

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

gt = CocoDataset.from_json(Path("instances_val2017.json").read_bytes())
evaluator = Evaluator(iou=Bbox())
with evaluator.background(gt) as bg:
    for images, targets in val_loader:
        # torchvision detection API shape: list[dict] of length batch_size,
        # each with "boxes" (N,4 xywh), "scores" (N,), "labels" (N,) as
        # torch.Tensor. vernier consumes any DLPack-producing array library
        # (torch, jax, cupy, numpy) zero-copy.
        predictions = model(images)
        bg.submit([
            {"image_id": int(t["image_id"]), **p}
            for t, p in zip(targets, predictions)
        ])
    summary = bg.finalize()
print("AP =", summary.stats[0])

Both end in the same 12-line pycocotools-shaped Summary; docs/tutorials/first-evaluation.md walks each end-to-end.

Benchmarks

Workload vernier median Speedup vs alternatives
Instance — bbox AP (val2017) 371 ms 5.6× faster-coco-eval · 15.5× pycocotools
Instance — segm AP (val2017) 971 ms 3.6× faster-coco-eval · 6.8× pycocotools
Instance — boundary AP (val2017) 3.1 s 5.6× faster-coco-eval · 19.6× boundary-iou-api
Instance — keypoints AP (val2017, OKS) 137 ms 12.1× faster-coco-eval · 16.5× pycocotools
Panoptic — PQ (val2017) 12.6 s 2.7× panopticapi
Semantic — mIoU (val2017) 5.0 s 4.1× mmsegmentation
Instance — LVIS bbox AP (v1 val, perfect-DT) 3.7 s 56.5× lvis-api · 10× lower peak RSS (1.48 GiB vs 15.01 GiB)

Panoptic cell exceeded the 5% relative-IQR gate (21% on this snapshot — chronically noisy because PNG decode dominates wall time). The 2.7× speedup is the load-bearing signal; the precise ratio carries a wider confidence band than the others.

Median total-stage wall time on a KVM VPS (AMD EPYC-Milan, 4 cores × 2 threads = 8 logical CPUs, x86_64 — not a bare-metal Milan box), harness mode release (N=10 measurement reps + 2 warmup, randomised impl order, 5% relative-IQR gate per impl), build profile = cargo release defaults (opt-level=3, lto=thin, codegen-units=1, no target-cpu) — same as the PyPI wheel. Full per-cell breakdown (including IQRs), RSS, and methodology in docs/benchmarks.md; per-library comparison of when to pick which in docs/comparison.md.

Baselines pinned for these numberspycocotools==2.0.11, faster-coco-eval==1.7.2, panopticapi @ 7bb4655, boundary-iou-api @ 37d2558, mmsegmentation @ c685fe6 (vendored), lvis-api @ 031ac21 (PyPI lvis==0.5.3). All cells were measured at HEAD 885d385d63e1 (machine fingerprint 37652a58e939 — the prior snapshot's 1655eb18a194 retired alongside the dual-SHA LVIS caveat). Each baseline is locked in its own uv-managed venv per ADR-0017.

Install

pip install vernier                  # Python wheel
cargo add vernier-core               # Rust library
cargo install vernier-cli            # `vernier` CLI binary

Wheels ship for linux x86_64 / aarch64 (glibc + musl), macOS x86_64 / arm64, and windows x64. The umbrella vernier crate name on crates.io is held as a 0.0.0 placeholder; vernier-core is the real Rust entry point — see docs/engineering/registry-reservations.md.

Status & validation

Pre-1.0; public API is unstable. See docs/adr/ for the design decisions shaping it.

pycocotools==2.0.11 is the de-facto reference for COCO evaluation — slow, unmaintained, and full of edge-case quirks. Faster reimplementations exist, but each silently fixes some quirks and not others, so you discover the divergences empirically. vernier takes a third path:

  • Auditable parity. Every divergence from pycocotools is filed in the quirks survey under ADR-0002 as either strict (bit-equal output, even when vernier's implementation is structurally different) or corrected (opt-in opinionated fix). Strict is the default; corrected fixes are itemized so you always know when your numbers diverge from a reference run. A drop-in shim (vernier.patch_pycocotools()) keeps existing pycocotools-based scripts working with one line.
  • Rust core, Python frontend. The matching kernel is pure Rust with runtime SIMD dispatch; the FFI layer is data conversion only. The CLI ships as a static binary, so CI pipelines call vernier without provisioning a Python interpreter.
  • One toolkit instead of five. bbox / segm / boundary / keypoints AP, panoptic PQ, semantic mIoU, LVIS federated, oLRP error decomposition, and detection-family calibration all live behind one Python API and one CLI — folded over a single matching pass. Per-paradigm migration guides under docs/migrate/ show how to replace pycocotools, faster-coco-eval, panopticapi, lvis-api, and mmsegmentation one at a time.
  • Scenario slicing + cross-run aggregation. A partition manifest (weather, time_of_day, …) feeds vernier eval --manifest for per-slice headline metrics and vernier aggregate for cross-run corruption tables (mPC / rPC) — one matching pass, N slices (ADR-0046).

Per-paradigm parity status:

Paradigm / metric Oracle Parity tier Open caveat
Instance bbox / segm / keypoints AP pycocotools==2.0.11 strict bit-equal none
Instance boundary IoU boundary-iou-api strict bit-equal none
Segm + boundary TIDE thresholds (t_b) none yet corrected-only ADR-0022 still proposed; defaults extrapolated, not measured
Panoptic PQ panopticapi (single-core path) strict bit-equal none
Panoptic boundary PQ bowenc0221/boundary-iou-api (single-core path, same SHA as the instance vendor) strict bit-equal ADR-0025 §Z1/Z2 amendment; Cityscapes panoptic (Z3) deferred
Semantic mIoU / FWIoU / pAcc / mAcc mmseg.IoUMetric vendored at v1.2.2 (ADR-0036, still proposed); cityscapesScripts + ADE20K cross-impl bench externally blocked strict bit-equal on the four per-class u64 marginals at val2017 scale ADR-0028; ADE20K-scale bench gated on license-cleared cache
LVIS federated AP lvis-api (vendored at 031ac21f, ORACLE_LVIS_COMMIT_SHA) strict bit-equal on the (T, R, K, A) precision tensor at full LVIS v1 val bench paradigm wired; segm cell waits on evaluate_segm_grid_with_dataset
LRP / oLRP error decomposition (instance bbox / segm / boundary / keypoints) pure-NumPy oracle (ADR-0043) strict against the oracle within 1e-9; kemaloksuz/LRP-Error tripwire vendored opt-in panoptic LRP is a typed NotImplementedError stub — panoptic predictions carry no per-segment scores (ADR follow-up)
Detection-family calibration — ECE / MCE / reliability (instance bbox / segm / boundary / keypoints) clean-room NumPy oracle (ADR-0018) with isolated P1–P10 quirks survey strict bit-equal against the oracle (16/16 parity tests) panoptic (Shape 2) and semantic (Shape 3) calibration deferred on data-model prerequisites; Clopper-Pearson CI documented Phase-2

Three-tier parity model: ADR-0002; per-library comparison: docs/comparison.md.

Three evaluation paradigms

They have different data models, different matching rules, and different parity oracles:

  • vernier.instance — detections with scores → bbox / segm / boundary / keypoints AP.
  • vernier.panoptic — RGB-encoded panoptic PNGs + segments_info JSON → PQ.
  • vernier.semantic — single-channel class-id label maps → mIoU / FWIoU / pAcc / mAcc.

See Three paradigms.

Documentation

Contributing

Local checks: just lint && just test && just audit. The full contributor workflow (ADR lifecycle, vendoring policy, code style) is in CONTRIBUTING.md. Repository layout and common just recipes are in CLAUDE.md.

License

Dual-licensed under Apache-2.0 or MIT at your option.

Third-party code

vernier vendors a small number of test-only reference implementations to support parity testing. None of this code is included in published wheels or linked into the Rust binary. See THIRD_PARTY_NOTICES.md for the full inventory and license attributions.

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

vernier-0.0.4.tar.gz (630.3 kB view details)

Uploaded Source

Built Distributions

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

vernier-0.0.4-cp310-abi3-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

vernier-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

vernier-0.0.4-cp310-abi3-musllinux_1_2_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

vernier-0.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.9 MB view details)

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

vernier-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

vernier-0.0.4-cp310-abi3-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

vernier-0.0.4-cp310-abi3-macosx_10_12_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file vernier-0.0.4.tar.gz.

File metadata

  • Download URL: vernier-0.0.4.tar.gz
  • Upload date:
  • Size: 630.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vernier-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8507e24b7efa1817b299f499e629f4fd4152730c54b176fe061437bea2994c91
MD5 679ad1b18f2876fcfab8195e3ac7652c
BLAKE2b-256 ec69c3a46caf970fc94d694393d288f254dca7d12aca3a6bd7a14b37ef983915

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4.tar.gz:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: vernier-0.0.4-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vernier-0.0.4-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 83eaafb4645196b7fc3e1ab3ce4107f33e82a05849dd183848131ad0a6b4f9b9
MD5 369b3be64a3b06878751c6c65ae79fbf
BLAKE2b-256 c5f52373af460ba1a3a1fe8c404d00296057959a9499757d3436480e5d8ae53a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-win_amd64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for vernier-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 199ac94958e413b29f4ab627d35dec77f862ae508aa4edffb708f12ba3b00f22
MD5 276866733baa2569db6899a3d5746dad
BLAKE2b-256 80d5831a43b441dceab7d9a6e28eb571e08489f121f1632e4a32516a6371311a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for vernier-0.0.4-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 42ca866dcf138ef0d8b4116cdf5c38cf1ffd8452ee2472a0c19ce8e92b979e84
MD5 098212aaef0607274bdf56cf99f9ab6e
BLAKE2b-256 2f3d26a48085bfb84a16001f973e4e4306f2ae8c277b6e8812ce698a240011f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vernier-0.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 452a7d619d596dfe62834e0001bff72e9ac4853ad9a2f44cd1627845c90c53ef
MD5 aa7126dd75b55e0542701e883ab5e351
BLAKE2b-256 5a0d02921f2388dd5c7a3030e4ac4f965888ff995d52bc29796547729309f173

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vernier-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dec0c3f82bbacfbe153785b416ff3fe156fca97992943f5ff5fa3ccfa7181c50
MD5 c39d326c837a7bdc32e334a14ee7ae1a
BLAKE2b-256 d3d8aeccd1a5999ba395665fc94fb7531bfda1619a65d43bb3a15d5e613edf8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vernier-0.0.4-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 97def3765ef90058638f58f9fb5f3556f98ecafdaaa59342f63763532f0ed70a
MD5 930cd8a75cfcf75cd2e87e5b4ff20729
BLAKE2b-256 047dbb1c38209360eb17429e05cff2dd677269a22fe7875c5ca0e43e32e4318a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vernier-0.0.4-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vernier-0.0.4-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e04852bf4e1da29b28edb102747815f2fe0740708f03a9989359055a66795bf4
MD5 ec211d9d20b44148fa68a6c1a17fb2a4
BLAKE2b-256 5e2d206291b534d3dc0ff141289a78bd4bcbda5b3614c94c1b00988d41eec9bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for vernier-0.0.4-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: wheels.yml on NoeFontana/vernier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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