Expand description
Perception evaluation in pure Rust.
Detection ships today — bbox, segmentation, keypoints, and oriented boxes across the COCO, LVIS, and Open Images protocols — on a layered engine that other metric families will share.
use hotcoco::{COCO, COCOeval, params::IouType};
let gt = COCO::new(std::path::Path::new("instances_val2017.json"))?;
let dt = gt.load_res(std::path::Path::new("detections.json"))?;
let mut ev = COCOeval::new(gt, dt, IouType::Bbox);
ev.run(); // evaluate -> accumulate -> summarize
let report = ev.report()?; // metrics, per-class, curves, provenance§How the crate is laid out
| Module | What lives there |
|---|---|
types | The COCO schema — Dataset, Image, Annotation, Category, Rle. |
coco | The dataset object: load, index, query, filter, merge, split, sample. |
mask, geometry | RLE codec and rotated-rect mechanics. |
primitives | Matching kernels — similarity, greedy assignment, LSAP. |
metrics | Metric functions over flat arrays — AP, calibration, confusion, bootstrap. |
report | EvalReport — the shape every metric family reports in. |
detection | The detection metric family: AP/AR, LVIS, Open Images, TIDE. |
quality | Dataset introspection: health checks and statistics. |
convert | YOLO, Pascal VOC, CVAT, DOTA, and Open Images conversion. |
§The functional layer
primitives and metrics are free functions over flat arrays — no
evaluator required, the way sklearn.metrics and torchmetrics.functional
work:
use hotcoco::metrics::counts::average_precision;
let ap = average_precision(&[0.9, 0.8, 0.3], &[true, false, true], None, 3, &[0.0, 0.5, 1.0]);The two split by what a function produces: primitives produces matches,
metrics produces numbers from matches (see metrics for the full
split). Between them they hold the implementation of every similarity,
matching and accumulation rule in the crate — exactly one of each, with
tests/architecture.rs failing the build if a second appears. That is what
makes them the place for an auditor to look.
COCOeval is the stateful driver on top — it owns the pycocotools-compatible
evaluate/accumulate/summarize lifecycle, and its analysis methods are
adapters that marshal eval_imgs into arrays and call the functions above.
§Coming from 0.x
1.0 renamed several module paths (eval → detection and friends) with no
aliases; the crate-root re-exports resolve unchanged. The rename table is in
the migration guide.
Re-exports§
pub use coco::COCO;pub use convert::ConvertError;pub use convert::CvatImportStats;pub use convert::CvatStats;pub use convert::DotaStats;pub use convert::OidStats;pub use convert::VocStats;pub use convert::YoloStats;pub use detection::AccumulatedEval;pub use detection::AnnotationIndex;pub use detection::COCOeval;pub use detection::CalibrationResult;pub use detection::CategoryDelta;pub use detection::CompareOpts;pub use detection::ComparisonResult;pub use detection::ConfusionMatrix;pub use detection::DtStatus;pub use detection::ErrorProfile;pub use detection::EvalImg;pub use detection::EvalMode;pub use detection::EvalParams;pub use detection::EvalResults;pub use detection::EvalShape;pub use detection::FreqGroup;pub use detection::GtStatus;pub use detection::ImageDiagnostics;pub use detection::ImageSummary;pub use detection::LabelError;pub use detection::LabelErrorType;pub use detection::MetricDef;pub use detection::SliceResult;pub use detection::SlicedResults;pub use detection::TideErrors;pub use detection::compare;pub use error::Error;pub use primitives::greedy::ThreshMatrix;pub use detection::hierarchy::Hierarchy;pub use metrics::bootstrap::BootstrapCI;pub use metrics::calibration::CalibrationBin;pub use params::AreaRange;pub use params::IouType;pub use params::Params;pub use quality::CategoryStats;pub use quality::DatasetStats;pub use quality::DatasetSummary;pub use quality::Finding;pub use quality::HealthReport;pub use quality::Layer;pub use quality::SummaryStats;pub use report::EvalReport;pub use report::Provenance;pub use types::Annotation;pub use types::Category;pub use types::Dataset;pub use types::Image;pub use types::Rle;pub use types::Segmentation;
Modules§
- coco
- COCO dataset loading and querying API.
- convert
- Format converters: COCO ↔ YOLO, Pascal VOC, CVAT, DOTA, and Open Images.
- detection
- The detection metric family.
- error
- geometry
- Computational geometry primitives for oriented bounding box (OBB) evaluation.
- mask
- Pure Rust implementation of COCO mask operations: RLE encoding and decoding, IoU, merge, and area.
- metrics
- Metric functions — numbers computed from matches.
- params
- primitives
- Matching kernels — the shared substrate that decides what pairs with what.
- quality
- Dataset quality and introspection — a tier of its own.
- report
EvalReport— the shape every family’s results take.- types