View source on GitHub |
Samples a single segment of size num_frames
from a given sequence.
tfm.vision.preprocess_ops_3d.sample_segment_sequence(
sequence: tf.Tensor,
num_frames: int,
is_training: bool,
seed: Optional[int] = None
) -> tf.Tensor
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.
Returns | |
---|---|
A single tf.Tensor with first dimension num_steps with the sampled
segment.
|