Skip to content

build_frame_stacks ​

python
build_frame_stacks(path: TrajectoryRepositoryPath, environment: ReplayEnvironment) -> dict[int, bytes]

Replay a stored route and capture the observation frame stack at each segment boundary.

A snapshot is an emulator state, not a rendered-frame history, so restoring one leaves the environment with a single frame and it fills the stack by repeating it. That is right at a true start and wrong at a midpoint restart: every frame identical says nothing on screen is moving, which is the one thing the policy needs to time anything. Playing the route through produces the real stacks, and they are captured here so a restart can be seeded with them.

The stack belonging to segment i is the observation held after executing every action up to and including that segment's last one -- that is the state a restart from segment.end_state resumes at, with the segment's own frame newest.

Derived state, so it is rebuilt rather than checkpointed: a stack is ~29KB and a route has dozens of segments.

Parameters:

  • path (TrajectoryRepositoryPath) – The stored route to replay.
  • environment (ReplayEnvironment) – A single environment to replay through. Left at the end of the route.

Returns:

  • dict[int, bytes] – Segment index -> the raw stacked-observation bytes at that segment's end state.

Source