pub struct TiledFrameAccumulator { /* private fields */ }Expand description
Streaming collector for one frame’s tiled detections. A pipelined runtime pushes each tile’s per-tile-decoded boxes as inference completes (any order), then finalizes once every tile has arrived — the “collect after the final tile” fan-in. Not internally synchronized; keep one accumulator per in-flight frame.
Implementations§
Source§impl TiledFrameAccumulator
impl TiledFrameAccumulator
Sourcepub fn new(
frame_dims: (f32, f32),
tiles_total: usize,
cfg: MergeConfig,
est_per_tile: usize,
) -> Self
pub fn new( frame_dims: (f32, f32), tiles_total: usize, cfg: MergeConfig, est_per_tile: usize, ) -> Self
Create an accumulator for a frame with tiles_total tiles. frame_dims
is (frame_w, frame_h) in pixels, used by Self::finalize_normalized.
est_per_tile pre-reserves the detection buffer.
§Examples
use edgefirst_decoder::tiling::{MergeConfig, TiledFrameAccumulator};
let acc = TiledFrameAccumulator::new((1920.0, 1080.0), 12, MergeConfig::default(), 16);
assert_eq!(acc.remaining(), 12);
assert!(!acc.is_complete());Sourcepub fn push_tile(
&mut self,
tile_boxes: Vec<DetectBox>,
placement: &TilePlacement,
) -> bool
pub fn push_tile( &mut self, tile_boxes: Vec<DetectBox>, placement: &TilePlacement, ) -> bool
Lift one tile’s per-tile-decoded boxes to full-frame pixels and append
them. Idempotent per placement.index: a duplicate, out-of-range, or
foreign placement (one whose count disagrees with this accumulator’s
tiles_total, i.e. from a different plan/frame) is ignored and its boxes
dropped, so out-of-order and at-least-once delivery both converge to
the same result. Returns true if the tile was newly accepted, false
otherwise.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
True once every tile of the frame has been pushed (by distinct index).
Sourcepub fn finalize(self) -> Vec<DetectBox>
pub fn finalize(self) -> Vec<DetectBox>
Merge all accumulated detections into full-frame pixel boxes.
Sourcepub fn finalize_normalized(self) -> Vec<DetectBox>
pub fn finalize_normalized(self) -> Vec<DetectBox>
Merge then renormalize to [0,1] by frame_dims (for the tracker,
matching the non-tiled normalized-detection contract).
Returns an empty list when frame_dims are non-finite or non-positive
rather than emitting Inf/NaN coordinates.
Trait Implementations§
Source§impl Clone for TiledFrameAccumulator
impl Clone for TiledFrameAccumulator
Source§fn clone(&self) -> TiledFrameAccumulator
fn clone(&self) -> TiledFrameAccumulator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TiledFrameAccumulator
impl RefUnwindSafe for TiledFrameAccumulator
impl Send for TiledFrameAccumulator
impl Sync for TiledFrameAccumulator
impl Unpin for TiledFrameAccumulator
impl UnsafeUnpin for TiledFrameAccumulator
impl UnwindSafe for TiledFrameAccumulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more