Overview
Temporal detection smoothing for reducing jitter and stabilizing tracked objects. This module provides advanced buffer-based smoothing algorithms that use temporal context from past, current, and future frames to reduce bounding box jitter, stabilize confidence scores, and interpolate missing detections. Designed to work seamlessly with PixelFlow’s buffer system for high-quality temporal smoothing in real-time applications. Applies sophisticated temporal smoothing using past, current, and future frames with exponential weight decay. Reduces bounding box jitter, stabilizes confidence scores, and interpolates missing detections when objects temporarily disappear.Function Signature
Parameters
Buffer instance containing temporal context with past, current, and future detection frames. Must have temporal context available.
Exponential decay factor for temporal weighting. Current frame weight = 1.0, adjacent frames = decay^1, next frames = decay^2, etc. Range: [0.1, 1.0]. Default is 0.8 (20% decay per frame distance).
Returns
Smoothed detections for the current frame with reduced jitter and stabilized confidence scores. Returns raw current frame results if temporal context is unavailable.
Examples
Error Handling
This function may raise the following exceptions:
- AttributeError: If buffer lacks required methods or temporal context structure.
- ValueError: If temporal_weight_decay is outside valid range [0.1, 1.0].
- TypeError: If buffer is not a valid Buffer instance.
Notes
- Requires buffer to be filled with temporal context (past + current + future frames)
- Returns raw current frame results when temporal context is unavailable
- Automatically interpolates missing detections when objects appear in past/future but not current frame
- Preserves all detection attributes (masks, keypoints, etc.) from current frame
- Weight decay applies exponentially: frame distance 1 = decay^1, distance 2 = decay^2, etc.
- Smoothing quality improves with larger buffer sizes but increases latency
- Computational complexity: O(n*k) where n=detections, k=buffer_size
- Memory usage scales linearly with buffer size and detection count
- Optimized for real-time processing with minimal overhead