tfm.vision.preprocess_ops_3d.sample_sequence
Samples a single segment of size num_steps
from a given sequence.
tfm.vision.preprocess_ops_3d.sample_sequence(
sequence: tf.Tensor,
num_steps: int,
random: bool,
stride: int,
seed: Optional[int] = None
) -> tf.Tensor
If random
is not True
, this function will simply sample the central window
of the sequence. Otherwise, a random offset will be chosen in a way that the
desired num_steps
might be extracted from the sequence.
Args |
sequence
|
Any tensor where the first dimension is timesteps.
|
num_steps
|
Number of steps (e.g. frames) to take.
|
random
|
A boolean indicating whether to random sample the single window. If
True , the offset is randomized. If False , the middle frame minus half
of num_steps is the first frame.
|
stride
|
Distance to sample between timesteps.
|
seed
|
A deterministic seed to use when sampling.
|
Returns |
A single tf.Tensor with first dimension num_steps with the sampled
segment.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-02-02 UTC.
[null,null,["Last updated 2024-02-02 UTC."],[],[]]