pub struct Params {
pub iou_type: IouType,
pub img_ids: Vec<u64>,
pub cat_ids: Vec<u64>,
pub iou_thrs: Vec<f64>,
pub rec_thrs: Vec<f64>,
pub max_dets: Vec<usize>,
pub area_ranges: Vec<AreaRange>,
pub use_cats: bool,
pub kpt_oks_sigmas: Vec<f64>,
pub expand_dt: bool,
}Expand description
Evaluation parameters controlling IoU thresholds, area ranges, and detection limits.
Defaults match pycocotools: 10 IoU thresholds (0.50:0.05:0.95), 101 recall thresholds, and standard COCO area ranges. Keypoint evaluation uses different defaults (3 area ranges instead of 4, max 20 detections instead of 1/10/100).
Fields§
§iou_type: IouTypeIoU computation type (bbox, segm, keypoints, or obb).
img_ids: Vec<u64>Image IDs to evaluate (empty = all images).
cat_ids: Vec<u64>Category IDs to evaluate (empty = all categories).
iou_thrs: Vec<f64>IoU thresholds for matching (default: 0.50, 0.55, …, 0.95).
rec_thrs: Vec<f64>Recall thresholds for interpolated precision (default: 0.00, 0.01, …, 1.00).
max_dets: Vec<usize>Maximum detections per image for each summary metric (default: [1, 10, 100]).
area_ranges: Vec<AreaRange>Area ranges for filtering, each with a label and [min, max] bounds.
Default labels: "all", "small", "medium", "large" (3 ranges for keypoints).
use_cats: boolWhether to evaluate per-category (true) or pool all categories (false).
kpt_oks_sigmas: Vec<f64>Per-keypoint OKS sigmas (default: 17 COCO keypoint sigmas).
expand_dt: boolWhether to expand detections up the category hierarchy (OID mode). Default: false (only GT is expanded).
Implementations§
Source§impl Params
impl Params
Sourcepub fn area_range_idx(&self, label: &str) -> Option<usize>
pub fn area_range_idx(&self, label: &str) -> Option<usize>
Index of the area range with the given label, or None if not found.
Sourcepub fn all_area_idx(&self) -> usize
pub fn all_area_idx(&self) -> usize
Index of the "all" area range, falling back to the first.
Every whole-dataset metric is reported at area="all", so this lookup runs
in the summarize, report, calibration, diagnostics, and TIDE paths. The
fallback matters: a caller with custom area labels and no "all" still gets
a defined index rather than a panic, and index 0 is the widest range by
convention.
Sourcepub fn all_area_range(&self) -> [f64; 2]
pub fn all_area_range(&self) -> [f64; 2]
The [min, max] bounds of the "all" area range.
The value-side twin of all_area_idx, for the
consumers that compare against an EvalImg’s stored
area_rng rather than indexing an axis.
§Panics
On empty area_ranges — an evaluator with no area ranges has no cells to
filter, and every caller indexes the axis anyway.
Sourcepub fn max_det(&self) -> usize
pub fn max_det(&self) -> usize
The per-image detection cap: the largest entry in max_dets, or 100 if empty.
The one owner of this lookup — the maximum, never max_dets.last(). The
two agree on the sorted default [1, 10, 100] and diverge on unsorted
input, and a run where evaluate() stamps cells with one and an analysis
filters on the other silently matches nothing. pycocotools sidesteps the
question by sorting maxDets inside evaluate(); hotcoco does not mutate
caller params, because the accumulated M axis follows the caller’s order.
Sourcepub fn max_det_idx(&self) -> usize
pub fn max_det_idx(&self) -> usize
Position of max_det’s value in max_dets — the M-axis
slot every headline metric is read from.
The index-side twin of max_det, and required for the
same reason: shape.m - 1 is the last slot, not the slot holding the
cap. The two agree on the sorted default [1, 10, 100] and diverge on
anything else — under max_dets = [100, 10, 1] the last slot is
max_det = 1, so per-class AP, the F-scores and report()’s PR curves
would all be read at a cap the headline AP was not computed at.
Falls back to 0 when the cap is not in the list, which only happens for
an empty max_dets.
Sourcepub fn iou_thr_idx(&self, thr: f64) -> Option<usize>
pub fn iou_thr_idx(&self, thr: f64) -> Option<usize>
Index of the IoU threshold equal to thr (within 1e-9), or None.
The owner of the exact-match policy, paired with
nearest_iou_thr_idx, which snaps
unconditionally. The two answer different questions and must not be
interchanged: a metric named AP50 means the 0.50 slice or nothing —
reporting the 0.65 slice under that name because it happened to be
closest is a wrong number, not a fallback — while a caller passing an
analysis threshold (“classify at ~0.6”) wants the nearest grid point it
actually has.
Three copies of the exact form existed — calibration, summarize, and a
test — and they disagreed: two took the first threshold within tolerance
and one took the nearest, so a params list holding two thresholds that
close resolved iou_thr = 0.5 differently depending on which path asked.
The tolerance is not a fudge. thr is a caller-supplied f64 compared
against a grid built by linspace to match numpy.linspace bit-for-bit,
so exact equality would reject values that are 0.5 in every sense a caller
means. Nearest-wins among those within tolerance makes the answer
single-valued regardless.
Sourcepub fn nearest_iou_thr_idx(&self, thr: f64) -> usize
pub fn nearest_iou_thr_idx(&self, thr: f64) -> usize
Index of the IoU threshold closest to thr, snapping unconditionally.
The owner of the snap-always policy — the counterpart to
iou_thr_idx’s exact-within-1e-9 match. TIDE and
per-image diagnostics take an analysis threshold from the user and report
which grid point they landed on, so “nothing within tolerance” is not a
failure there; it is a snap. Both hand-rolled the scan, and one of them
tie-broke on partial_cmp while the other did not.
Returns 0 for an empty threshold list, which is the same degenerate
answer both call sites already produced via map_or(0, …) — there is no
index to report and every consumer indexes with it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Params
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnsafeUnpin for Params
impl UnwindSafe for Params
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more