Caching Segment ContextΒΆ

Utilities for aggregating segment-level context that supplements frame-level data.

Aggregators run after the per-frame conversion stage and operate one segment at a time, reading the segment’s npz files, computing the context (past / future trajectories, aggregated detection trajectories, …), and writing each frame back in place. Segments are independent β€” disjoint files, no shared aggregator state β€” so the per-segment loop fans out across a multiprocessing.Pool controlled by the same --num_workers and --do_parallel_processing flags as the frame stage. The default start method is "spawn" because the parent process imports TensorFlow / OpenCV at module load and fork would inherit that state into workers.

Note

Custom SegmentContextAggregator subclasses must be picklable: a spawn worker re-imports the class by qualname, so the class needs to live in an installed package (not an ad-hoc test module) and avoid carrying un-picklable state (open file handles, locks, GPU contexts). The escape hatch is to call process(..., do_parallel=False) for a sequential fall-back.

standard_e2e.caching.segment_context.SegmentContextAggregator

Abstract pass to add history/future context back into transformed frames.

standard_e2e.caching.segment_context.FuturePastStatesFromMatricesAggregator

Derive past/future ego-relative trajectories from pose matrices.

standard_e2e.caching.segment_context.FutureDetectionsAggregator

Aggregate future detections into the current frame's modality payload.