API Reference (auto)
BBoxXYWHNorm
Bases: BaseModel
Canonical TL-normalized bbox: [x, y, w, h] with invariants.
to_xyxy_px(b, W, H)
Convert canonical bbox to pixel XYXY coordinates.
from_xyxy_px(x1, y1, x2, y2, W, H)
Convert pixel XYXY coordinates to canonical bbox.
iou_xyxy(a, b)
Intersection over Union for two xyxy pixel-space boxes.
Returns 0.0 when there is no overlap (including edge-touching).
area_xyxy(b)
Area of a pixel-space xyxy rectangle.
Negative extents are clamped to zero to be robust to degenerate inputs.
intersect_xyxy(a, b)
Intersection rectangle of two xyxy boxes or None if disjoint/touching.
clamp_xyxy(b, W, H)
Clamp an xyxy box to image bounds [0,W] x [0,H].
Ordering is preserved so that the output always has x1 <= x2 and y1 <= y2.
to_xywh_px(bbox_norm, W, H)
Convert normalized TL-xywh to pixel TL-xywh using image dimensions.
Uses simple scaling without rounding to preserve fractional pixel information.
from_xywh_px(x, y, w, h, W, H)
Convert pixel TL-xywh to normalized TL-xywh using image dimensions.
Values are clamped to [0,1] to avoid float precision edge cases, with a
minimal positive width/height enforced by the BBoxXYWHNorm model.
xyxy_to_xywh(b)
Convert pixel-space xyxy → pixel TL-xywh (no clamping).
xywh_to_xyxy(b)
Convert pixel TL-xywh → pixel-space xyxy (no clamping).
group_detections_by_frame(dets)
Group detections by frame_number preserving per-frame order.
Returns a dict with integer keys sorted in ascending order.
detection_xyxy_px(det, W, H)
Return pixel xyxy tuple for a Detection using image dimensions.
Prefers the canonical bbox_norm if present. If only the legacy bbox
(pixel xywh) is provided, falls back to converting that to xyxy.