get_context_from_sequence

lightning_pose.models.base.get_context_from_sequence(img_seq: Float[Tensor, 'seq_len RGB image_height image_width'] | Float[Tensor, 'seq_len n_features rep_height rep_width'], context_length: int) Float[Tensor, 'seq_len context_length RGB image_height image_width'] | Float[Tensor, 'seq_len context_length n_features rep_height rep_width'][source]

Build overlapping context windows from a sequence of frames or feature maps.

The sequence is padded at the start and end by repeating the first/last element so that every original frame has a full context_length-frame window centred on it.

Parameters:
  • img_seq – sequence tensor of shape (seq_len, ...).

  • context_length – number of frames in each context window (e.g., 5).

Returns:

Tensor of shape (seq_len, context_length, ...) where each row is the context window centred on the corresponding input frame.