1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! 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.
//!
//! ```no_run
//! use hotcoco::{COCO, COCOeval, params::IouType};
//! # fn main() -> hotcoco::error::Result<()> {
//! 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
//! # Ok(())
//! # }
//! ```
//!
//! # 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](https://derekallman.github.io/hotcoco/getting-started/migration/).
pub use COCO;
pub use ;
pub use ;
pub use Error;
// Re-exported at the root because it is the shape of `EvalImg`'s per-threshold
// fields — a consumer holding an `EvalImg` needs the type nameable.
pub use ThreshMatrix;
pub use Hierarchy;
// Re-exported from where they are defined, not through `detection`. Both are
// family-agnostic — any family that resamples gets a `BootstrapCI`, any family
// that bins confidences gets a `CalibrationBin` — so routing the crate-root path
// through the detection driver would make the next family import a detection path
// for a type detection does not own.
pub use BootstrapCI;
pub use CalibrationBin;
pub use ;
pub use ;
pub use ;
pub use ;