MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / get_sequence

Function get_sequence

slowfast/datasets/utils.py:50–70  ·  view source on GitHub ↗

Sample frames among the corresponding clip. Args: center_idx (int): center frame idx for current clip half_len (int): half of the clip length sample_rate (int): sampling rate for sampling frames inside of the clip num_frames (int): number of expected sampled

(center_idx, half_len, sample_rate, num_frames)

Source from the content-addressed store, hash-verified

48
49
50def get_sequence(center_idx, half_len, sample_rate, num_frames):
51 """
52 Sample frames among the corresponding clip.
53
54 Args:
55 center_idx (int): center frame idx for current clip
56 half_len (int): half of the clip length
57 sample_rate (int): sampling rate for sampling frames inside of the clip
58 num_frames (int): number of expected sampled frames
59
60 Returns:
61 seq (list): list of indexes of sampled frames in this clip.
62 """
63 seq = list(range(center_idx - half_len, center_idx + half_len, sample_rate))
64
65 for seq_idx in range(len(seq)):
66 if seq[seq_idx] < 0:
67 seq[seq_idx] = 0
68 elif seq[seq_idx] >= num_frames:
69 seq[seq_idx] = num_frames - 1
70 return seq
71
72
73def pack_pathway_output(cfg, frames):

Callers 1

get_input_clipMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected