pub struct Detection {
pub bbox: Option<BoundingBox>,
pub class_label: String,
pub confidence: f32,
pub track_id: Option<u64>,
pub assoc_confidence: Option<f32>,
pub lock_state: Option<LockState>,
pub attributes: Option<BTreeMap<String, Value>>,
pub mask: Option<Vec<[f32; 2]>>,
pub keypoints: Option<Vec<Keypoint>>,
pub depth: Option<f32>,
pub world_pos: Option<[f64; 3]>,
}Expand description
One percept from a model: the self-describing per-frame unit a consumer reads. It began as a 2D box and grows by ADDING typed optional fields (each serde-default + skipped when absent), so a producer emits only what it measured and an older producer/reader round-trips unchanged. The 2D box is itself now optional: a box detector always sets it, while a box-less percept (a segmentation mask, a pose, a depth-only reading) may omit it and carry its geometry in the typed fields below.
Fields§
§bbox: Option<BoundingBox>The 2D bounding box in the frame’s own pixel resolution. Some for the
common box detector (always set before box-less percepts existed, so an
older producer’s payload still decodes to Some); None for a box-less
percept. Skipped on the wire when absent.
class_label: String§confidence: f32§track_id: Option<u64>Stable track id across frames (tracking models only).
assoc_confidence: Option<f32>How confident the tracker is that this detection is the same object as
its track_id (0..1). None when the source does not score
association (e.g. a stateless detector). Distinct from confidence,
which scores the class/object detection itself.
lock_state: Option<LockState>Discrete lock state of the track’s identity this frame. None when the
source does not report a lock state.
attributes: Option<BTreeMap<String, Value>>Open, self-describing per-detection attributes: the extension point for richer perception a model may carry beyond the 2D box — a segmentation mask reference, keypoints, a depth estimate, a world-frame position — as well as any model-specific metadata, keyed by name. A concrete primitive promotes to its own typed field once a consumer needs it as first-class; until then it rides here so the contract extends without a schema change. Absent (skipped on the wire) when the source reports none.
mask: Option<Vec<[f32; 2]>>Segmentation mask as a polygon of (x, y) vertices tracing the object
outline, in the frame’s own pixel resolution. None when the source
reports no mask.
keypoints: Option<Vec<Keypoint>>Keypoints (pose joints or landmarks) for this detection, in frame pixels.
None when the source reports none.
depth: Option<f32>Estimated distance from the camera to the detection, in metres. None
when the source reports no depth.
world_pos: Option<[f64; 3]>The detection’s position in a world frame, as a bare 3-array so the frame
convention can evolve without a schema change: local ENU metres
[x, y, z], or geographic [lat, lon, alt] once a producer geolocates.
None when the source reports no world position.