tfm.vision.preprocess_ops_3d.sample_segment_sequence

Samples a single segment of size num_frames from a given sequence.

This function follows the temporal segment network sampling style (https://arxiv.org/abs/1608.00859). The video sequence would be divided into num_frames non-overlapping segments with same length. If is_training is True, we would randomly sampling one frame for each segment, and when is_training is False, only the center frame of each segment is sampled.

sequence Any tensor where the first dimension is timesteps.
num_frames Number of frames to take.
is_training A boolean indicating sampling in training or evaluation mode.
seed A deterministic seed to use when sampling.

A single tf.Tensor with first dimension num_steps with the sampled segment.