Sequential frame reads, parallel camera processing, and live dashboard#969
Closed
Sequential frame reads, parallel camera processing, and live dashboard#969
Conversation
…board Phase 1: FrameSource.read_frame_at() with sequential access optimization. Tracks decode position to avoid per-frame keyframe seeks — O(1) for sequential reads vs O(GOP) for random access. Three paths: fast (gap=1), small-gap (decode forward), and seek fallback. Phase 2: ThreadPoolExecutor for per-camera processing within each sync index. Each camera gets its own FrameSource and thread. Callbacks remain single-threaded (invoked from the sync-index loop, not pool threads). parallel=True by default with serial escape hatch. Phase 3: ETA display after 3s warmup, incremental coverage heatmap matrix updated O(1) per sync index with throttled signal emission every 5s. Coverage content panel shown during processing for live feedback. Charuco profiling: 1.41x speedup (64.8 vs 46.0 cam-frames/s on 5-cam demo). GIL-bound OpenCV limits thread parallelism; ONNX expected better. 389/389 tests pass, 60/60 stability runs clean, 0 type errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FrameSource.read_frame_at()tracks decode position to avoid per-frame keyframe seeks. O(1) for sequential reads vs O(GOP) for random access. Three paths: fast (gap=1), small-gap (decode forward ≤10 frames), and seek fallback.ThreadPoolExecutorprocesses all cameras concurrently within each sync index. Each camera gets its ownFrameSourceand thread. Callbacks remain single-threaded.parallel=Trueby default with serial escape hatch.Performance
Charuco profiling: 1.41x speedup (64.8 vs 46.0 cam-frames/s on 5-cam demo). GIL-bound OpenCV limits thread parallelism; ONNX expected to benefit more.
Key design decisions
C{cam_id}), not index-basedQueuedConnectionforcoverage_updatedsignal (worker thread → main thread)progress_updatedsignal extended:Signal(int, int, int)→Signal(int, int, int, str)for ETA stringTest plan
test_frame_source_sequential.pytests with pixel-exact assertions