Skip to content

trackforge / utils / detections


Module detections

Conversion helpers that turn detector output into tracker input.

Quick Reference

Item Kind Description
detections_from_xyxy fn Convert flat [x1, y1, x2, y2, conf, cls] detector output into tracker detections.

Functions

detections_from_xyxy

fn detections_from_xyxy(data: &[f32]) -> Vec<([f32; 4], f32, i64)>

Convert flat [x1, y1, x2, y2, conf, cls] detector output into tracker detections.

This is the layout most YOLO-style detectors produce after NMS, including the data array of Ultralytics Boxes. Each group of six values becomes a (tlwh, score, class_id) tuple, the input every tracker's update takes. Trailing values that do not form a full group of six are ignored.

Example

use trackforge::utils::detections_from_xyxy;

let data = [10.0, 20.0, 50.0, 80.0, 0.9, 0.0];
let dets = detections_from_xyxy(&data);
assert_eq!(dets, vec![([10.0, 20.0, 40.0, 60.0], 0.9, 0)]);