Skip to main content

StageOutput

Struct StageOutput 

Source
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 detections and tracks in a single StageOutput. The executor merges both into the accumulator. Tracks produced this way can carry per-observation metadata via TrackObservation::metadata.
  • Direct track emitter: set only tracks (leave detections as None). No intermediate DetectionSet is required. Set TrackObservation::detection_id to None since 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) or Track::metadata (per-track), or pass them as artifacts (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: TypedMetadata

Typed 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

Source

pub fn empty() -> Self

Create an empty stage output (no detections, tracks, signals, or artifacts).

Source

pub fn with_detections(detections: DetectionSet) -> Self

Create a stage output containing only detections.

Source

pub fn with_tracks(tracks: Vec<Track>) -> Self

Create a stage output containing only tracks.

Source

pub fn with_signals(signals: Vec<DerivedSignal>) -> Self

Create a stage output containing only signals.

Source

pub fn with_signal(signal: DerivedSignal) -> Self

Create a stage output containing a single signal.

Source

pub fn with_scene_features(features: Vec<SceneFeature>) -> Self

Create a stage output containing only scene features.

Source

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.

Source

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

Source§

fn clone(&self) -> StageOutput

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StageOutput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StageOutput

Source§

fn default() -> StageOutput

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.