Skip to main content

Params

Struct Params 

Source
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: IouType

IoU 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: bool

Whether 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: bool

Whether to expand detections up the category hierarchy (OID mode). Default: false (only GT is expanded).

Implementations§

Source§

impl Params

Source

pub fn area_range_idx(&self, label: &str) -> Option<usize>

Index of the area range with the given label, or None if not found.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn new(iou_type: IouType) -> Self

Create default parameters for the given evaluation type.

Keypoint evaluation uses 3 area ranges (all/medium/large) and a single max-detections value of 20. All other types use 4 area ranges (all/small/medium/large) and max-detections of [1, 10, 100].

Trait Implementations§

Source§

impl Clone for Params

Source§

fn clone(&self) -> Params

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Params

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V