pub struct StageOutput {
pub detections: Option<DetectionSet>,
pub tracks: Option<Vec<Track>>,
pub signals: Vec<DerivedSignal>,
pub scene_features: Vec<SceneFeature>,
pub artifacts: TypedMetadata,
}Expand description
Output returned by a stage’s process() method.
Each field is optional — a stage only sets the fields it produces.
The pipeline executor merges this into the PerceptionArtifacts accumulator.
§Joint-model and direct-track-emitter patterns
A stage is not limited to producing a single artifact type. Common patterns beyond classical detection:
- Joint det+track model: set both
detectionsandtracksin a singleStageOutput. The executor merges both into the accumulator. Tracks produced this way can carry per-observation metadata viaTrackObservation::metadata. - Direct track emitter: set only
tracks(leavedetectionsasNone). No intermediateDetectionSetis required. SetTrackObservation::detection_idtoNonesince there are no upstream detections to reference. - Richer observations: stages that produce typed artifacts
(embeddings, feature maps, attention weights) can store them in
TrackObservation::metadata(per-observation) orTrack::metadata(per-track), or pass them asartifacts(per-frame typed metadata) for downstream stage consumption.
Fields§
§detections: Option<DetectionSet>New or updated detection set.
If Some, replaces the current detection set in the accumulator.
If None, the previous detection set is kept.
tracks: Option<Vec<Track>>New or updated track set.
Some(Vec<Track>) is authoritative for this frame: it replaces
the current track set in the accumulator and marks the output as
authoritative. Previously-known tracks absent from this set are
treated as normally ended (TrackEnded) by the temporal store.
None means this stage does not produce tracks — the previous
track set is kept and authoritativeness is unchanged.
signals: Vec<DerivedSignal>Derived signals — always appended to the accumulator.
scene_features: Vec<SceneFeature>Scene-level features — always appended to the accumulator.
artifacts: TypedMetadataTyped artifacts for downstream stages — merged (last-writer-wins by TypeId).
This is the primary extension seam for inter-stage communication
beyond the built-in fields. Any Clone + Send + Sync + 'static
value can be stored here by type, and downstream stages retrieve
it from StageContext::artifacts.stage_artifacts.
Example uses:
- Feature maps or embeddings from a detector for a downstream classifier.
- Prepared multi-frame input tensors for a temporal/clip-based model.
- Confidence calibration metadata from an upstream stage.
Implementations§
Source§impl StageOutput
impl StageOutput
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create an empty stage output (no detections, tracks, signals, or artifacts).
Sourcepub fn with_detections(detections: DetectionSet) -> Self
pub fn with_detections(detections: DetectionSet) -> Self
Create a stage output containing only detections.
Sourcepub fn with_tracks(tracks: Vec<Track>) -> Self
pub fn with_tracks(tracks: Vec<Track>) -> Self
Create a stage output containing only tracks.
Sourcepub fn with_signals(signals: Vec<DerivedSignal>) -> Self
pub fn with_signals(signals: Vec<DerivedSignal>) -> Self
Create a stage output containing only signals.
Sourcepub fn with_signal(signal: DerivedSignal) -> Self
pub fn with_signal(signal: DerivedSignal) -> Self
Create a stage output containing a single signal.
Sourcepub fn with_scene_features(features: Vec<SceneFeature>) -> Self
pub fn with_scene_features(features: Vec<SceneFeature>) -> Self
Create a stage output containing only scene features.
Sourcepub fn with_artifact<T: Clone + Send + Sync + 'static>(value: T) -> Self
pub fn with_artifact<T: Clone + Send + Sync + 'static>(value: T) -> Self
Create a stage output containing a single typed artifact.
This is useful for stages that produce a single custom artifact type for downstream consumption.
Sourcepub fn build() -> StageOutputBuilder
pub fn build() -> StageOutputBuilder
Start building a StageOutput incrementally.
§Example
use nv_perception::StageOutput;
let output = StageOutput::build()
.detections(Default::default())
.artifact(42_u32)
.finish();Trait Implementations§
Source§impl Clone for StageOutput
impl Clone for StageOutput
Source§fn clone(&self) -> StageOutput
fn clone(&self) -> StageOutput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more