Machine Learning Messages

The ML message types (TensorData, Predictions, Classification, FeatureVector, ModelInfo, ModelFormat, InferenceMetrics, TrainingMetrics, MlTrajectoryPoint, DeploymentConfig, ChatMessage, LLMRequest, LLMResponse) have been removed from horus_library.

For ML inference pipelines, use the zero-copy Tensor and TensorPool APIs to transport model inputs and outputs between nodes. For structured inference results, use the Pod detection types:

SegmentationMask

Pod segmentation mask header (64 bytes). The actual pixel data follows the header in shared memory -- each pixel is a u8 class/instance ID.

use horus::prelude::*;

// Create semantic segmentation mask header
let mask = SegmentationMask::semantic(640, 480, 21)
    .with_frame_id("camera_front")
    .with_timestamp(1234567890);

println!("Mask: {}x{}, {} classes", mask.width, mask.height, mask.num_classes);
println!("Data size: {} bytes", mask.data_size());

// Create instance segmentation mask
let instance_mask = SegmentationMask::instance(640, 480);

// Create panoptic segmentation mask
let panoptic_mask = SegmentationMask::panoptic(640, 480, 80);

Fields (64 bytes, #[repr(C)]):

FieldTypeDescription
widthu32Mask width in pixels
heightu32Mask height in pixels
num_classesu32Number of semantic classes
mask_typeu320=semantic, 1=instance, 2=panoptic
timestamp_nsu64Nanoseconds since epoch
sequ64Sequence number
frame_id[u8; 32]Camera frame identifier

Methods:

MethodReturnsDescription
semantic(w, h, num_classes)SegmentationMaskCreate semantic mask header
instance(w, h)SegmentationMaskCreate instance mask header
panoptic(w, h, num_classes)SegmentationMaskCreate panoptic mask header
with_frame_id(id)SelfSet frame ID (builder)
with_timestamp(ts)SelfSet timestamp (builder)
frame_id()&strGet frame ID as string
data_size()usizeMask data size in bytes (w * h)

See Also