Params¶
Evaluation parameters. Created automatically by COCOeval, but can be modified before calling evaluate().
Every property below also accepts its pycocotools camelCase spelling — maxDets for max_dets, iouThrs for iou_thrs, and so on. See the alias table.
ev = COCOeval(coco_gt, coco_dt, "bbox")
ev.params.max_dets = [1, 10, 100]
ev.params.area_rng = [[0, 10000000000]]
ev.params.area_rng_lbl = ["all"]
let mut ev = COCOeval::new(coco_gt, coco_dt, IouType::Bbox);
ev.params.max_dets = vec![1, 10, 100];
ev.params.area_rng = vec![[0.0, 1e10]];
ev.params.area_rng_lbl = vec!["all".to_string()];
Constructor¶
Params(iou_type: str = "bbox")
Params::new(iou_type: IouType) -> Self
You rarely need to construct Params directly — COCOeval creates one automatically.
Properties¶
iou_type¶
Evaluation type.
| Python | Rust | |
|---|---|---|
| Type | str |
IouType |
| Default | "bbox" |
IouType::Bbox |
| Values | "bbox", "segm", "keypoints", "obb" |
Bbox, Segm, Keypoints, Obb |
"obb" evaluates oriented boxes with a rotated IoU kernel — see OBB evaluation.
img_ids¶
Image IDs to evaluate. Empty list means all images.
| Python | Rust | |
|---|---|---|
| Type | list[int] |
Vec<u64> |
| Default | [] |
vec![] |
cat_ids¶
Category IDs to evaluate. Empty list means all categories.
| Python | Rust | |
|---|---|---|
| Type | list[int] |
Vec<u64> |
| Default | [] |
vec![] |
iou_thrs¶
IoU thresholds for evaluation.
| Python | Rust | |
|---|---|---|
| Type | list[float] |
Vec<f64> |
| Default | [0.5, 0.55, 0.6, ..., 0.95] (10 values) |
Same |
A grid is stored and evaluated exactly as given, as pycocotools does. That includes the default grid rounded through float32, which is what torch.linspace(...).tolist() returns and what torchmetrics hands every COCO backend: every point sits within about 4e-8 of the default. The rounding is not harmless. An IoU or recall k / n that lands exactly on a grid point is excluded by a point one ulp higher, so on a category with 20 ground truths a float32 recall grid moves some precision cells by up to 0.33. pycocotools moves the same cells, so such a grid counts as the default: reference_deviations() does not list it, summarize() does not warn, and provenance() stays 'parity_verified'. The allowance is 1e-6 per point, a few float32 ulps and far below any deliberate edit to a grid; a grid further off than that is a deviation, and so is one on which summarize() cannot find 0.5 or 0.75 for AP50 and AP75 (those two are exact in float32, so a torch.linspace grid keeps them). Pass a float64 grid, such as numpy.linspace(0.5, 0.95, 10), for the numbers on the exact default grid.
rec_thrs¶
Recall thresholds for precision interpolation.
| Python | Rust | |
|---|---|---|
| Type | list[float] |
Vec<f64> |
| Default | [0.0, 0.01, 0.02, ..., 1.0] (101 values) |
Same |
Stored and evaluated as given, like iou_thrs, including a float32-rounded copy of the default grid.
max_dets¶
Maximum detections per image. The summary metrics report results at each of these thresholds.
| Python | Rust | |
|---|---|---|
| Type | list[int] |
Vec<usize> |
| Default (bbox/segm) | [1, 10, 100] |
Same |
| Default (keypoints) | [20] |
Same |
area_rng¶
Area ranges for size-based evaluation. Each range is [min_area, max_area] in square pixels (pixel area).
| Python | Rust | |
|---|---|---|
| Type | list[list[float]] |
Vec<[f64; 2]> |
| Default (bbox/segm) | [[0, 1e10], [0, 1024], [1024, 9216], [9216, 1e10]] |
Same |
| Default (keypoints) | [[0, 1e10], [1024, 9216], [9216, 1e10]] |
Same |
The defaults correspond to: all, small (area < 32² px²), medium (32² ≤ area < 96² px²), large (area ≥ 96² px²). Keypoints skip the small range.
area_rng_lbl¶
Labels for the area ranges.
| Python | Rust | |
|---|---|---|
| Type | list[str] |
Vec<String> |
| Default (bbox/segm) | ["all", "small", "medium", "large"] |
Same |
| Default (keypoints) | ["all", "medium", "large"] |
Same |
use_cats¶
Whether to evaluate per-category. When False, all detections and ground truth annotations are pooled regardless of category label.
| Python | Rust | |
|---|---|---|
| Type | bool |
bool |
| Default | True |
true |
kpt_oks_sigmas¶
Per-keypoint OKS sigma values. Controls how strictly each keypoint is evaluated — higher sigma means more tolerance.
| Python | Rust | |
|---|---|---|
| Type | list[float] |
Vec<f64> |
| Default | 17 COCO keypoint sigmas | Same |
Default values (nose, eyes, ears, shoulders, elbows, wrists, hips, knees, ankles):
[0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072,
0.062, 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089]
expand_dt¶
Whether to expand detection annotations up the category hierarchy in Open Images mode. When True, a "Dog" detection is also propagated as an "Animal" detection (if Animal is an ancestor of Dog). Each detection expands at its own score: a cat@0.3 and a dog@0.9 on one box become two "Animal" detections, at 0.3 and 0.9.
Only has an effect when oid_style=True and a Hierarchy is attached to the evaluator. Default is False — only GT annotations are expanded.
| Python | Rust | |
|---|---|---|
| Type | bool |
bool |
| Default | False |
false |
ev = COCOeval(coco_gt, coco_dt, "bbox", oid_style=True, hierarchy=h)
ev.params.expand_dt = True
ev.run()