mmaction2 指南
4. 自定义数据处理流程
流程设计
RawframeDataset 原始数据
SampleFrames 帧采样(原视频切clip,clip长度,帧间隔,clip数量,【后续流程继承 frame_inds 帧index】)
FrameSelector(【后续流程继承imgs 图片列表】,原尺寸)
Resize(新尺寸,scale=(-1, 256))
MultiScaleScrop(网络的输入大小 224,一系列长宽缩放比例)
Resize (新尺寸,scale=(-1, 256))
Flip(翻转,flip_ratio)
Normalize(**img_norm_cfg)
FormatShape(input_format=‘NCHW’)
Collect(keys=[‘imgs’, ‘label’], meta_keys=[])
ToTensor(keys=[‘imgs’, ‘label’])
几种重要的数据增强方案:
TSN 开始采用的:
MultiScaleCrop
图片多种比例缩放resize,再随机or固定位置裁剪crop
Randomly select the w and h scales from a list of scales. Scale of 1 means
the base size, which is the minimal of image weight and height. The scale
level of w and h is controlled to be smaller than a certain value to
prevent too large or small aspect ratio.
Required keys are “imgs”, “img_shape”, added or modified keys are “imgs”,
“crop_bbox”, “img_shape”, “lazy” and “scales”. Required keys in “lazy” are
“crop_bbox”, added or modified key is “crop_bbox”.
=>
带着例子走一下,随机从scales=(1, 0.875, 0.75, 0.66)中选择图片的长宽缩放比例,合适的缩放比例使得原始图片的横纵比例不至于太夸张
参数列表
Args:
input_size (