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:
- Detection / Detection3D -- Object detection results with bounding boxes
- BoundingBox2D / BoundingBox3D -- Bounding box types
- SegmentationMask -- Semantic, instance, and panoptic segmentation masks
- GenericMessage -- Flexible cross-language messaging for custom ML outputs
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)]):
| Field | Type | Description |
|---|---|---|
width | u32 | Mask width in pixels |
height | u32 | Mask height in pixels |
num_classes | u32 | Number of semantic classes |
mask_type | u32 | 0=semantic, 1=instance, 2=panoptic |
timestamp_ns | u64 | Nanoseconds since epoch |
seq | u64 | Sequence number |
frame_id | [u8; 32] | Camera frame identifier |
Methods:
| Method | Returns | Description |
|---|---|---|
semantic(w, h, num_classes) | SegmentationMask | Create semantic mask header |
instance(w, h) | SegmentationMask | Create instance mask header |
panoptic(w, h, num_classes) | SegmentationMask | Create panoptic mask header |
with_frame_id(id) | Self | Set frame ID (builder) |
with_timestamp(ts) | Self | Set timestamp (builder) |
frame_id() | &str | Get frame ID as string |
data_size() | usize | Mask data size in bytes (w * h) |
See Also
- TensorPool API - Zero-copy tensor memory management
- Vision Messages - Image, camera, and detection messages
- Perception Messages - Point cloud and depth sensing