class UniformSampleFrames:
"""Uniformly sample frames from the video.
To sample an n-frame clip from the video. UniformSampleFrames basically
divide the video into n segments of equal length and randomly sample one
frame from each segment. To make the testing results reproducible, a
random seed is set during testing, to make the sampling results
deterministic.
Required keys are "total_frames", "start_index" , added or modified keys
are "frame_inds", "clip_len", "frame_interval" and "num_clips".
Args:
clip_len (int): Frames of each sampled output clip.
num_clips (int): Number of clips to be sampled. Default: 1.
seed (int): The random seed used during test time. Default: 255.
"""
在"UniformSampleFrames"这个采样方法中,
clip_len
这个参数就代表了要从视频中采样出的每个子clip的帧数n
。也就是说,
clip_len
参数指定了:
- 将整个视频时长均匀地划分成多少个等长的时间段
- 在每个时间段内随机采样出一个帧
这样就可以得到
clip_len
个采样帧,组成一个子clip。重复这个过程,就可以从整个视频中采样出多个这样的子clip。
[ 1 4 9 14 18 22 27 29 34 37 42 45 51 55 59 60 64 68
73 79 83 84 88 92 97 103 105 111 112 119 123 124]总共是32个帧
a = UniformSampleFrames(clip_len=32)
pyskl/pyskl/datasets/pipelines/sampling.py at main · kennymckormick/pyskl · GitHub