pub struct DetectionBatch {
pub v: u16,
pub model_id: String,
pub camera_id: String,
pub frame_id: u64,
pub ts_ms: i64,
pub frame_width: u32,
pub frame_height: u32,
pub detections: Vec<Detection>,
}Expand description
The payload on vision.detection, labelled by source model and frame so
overlays and consumers can align boxes to the frame they came from.
Fields§
§v: u16Wire version, stamped on every batch and checked on decode. A consumer that sees a version it does not speak rejects the batch instead of mis-parsing it. Deliberately carries no serde default: a payload missing this field fails to decode.
model_id: String§camera_id: String§frame_id: u64§ts_ms: i64Capture time of the source frame: the frame’s host CLOCK_MONOTONIC
timestamp in milliseconds (FrameDescriptor::ts_ns / 1_000_000).
frame_width: u32The source frame’s pixel size, so a consumer scales the pixel-space boxes
to the rendered frame. 0 when the source did not report it (the consumer
then falls back to its own default). Additive + serde-default, so a batch
from an older producer (no dims) still decodes (mirrors attributes).
frame_height: u32§detections: Vec<Detection>Implementations§
Source§impl DetectionBatch
impl DetectionBatch
pub fn to_msgpack(&self) -> Result<Vec<u8>, Error>
Sourcepub fn from_msgpack(bytes: &[u8]) -> Result<Self, DetectionBatchError>
pub fn from_msgpack(bytes: &[u8]) -> Result<Self, DetectionBatchError>
Decode from a msgpack map, rejecting a batch whose wire version this build
does not speak. A missing v field fails the msgpack decode; a
present-but-unknown v returns DetectionBatchError::Version.