背景引入
在训练图像识别的深度神经网络时,使用大量更多的训练数据,可能会使网络得到更好的性能,例如提高网络的分类准确率,防止过拟合等。人为扩展训练数据时对数据的操作最好能反映真实世界的变化。人为扩充数据集之后如果分类准确率有明显的提升,说明我们对数据所做的拓展操作是良性的,能够“反映真实世界的变化”,就会被用到整个数据集的扩展。反之,则说明不能用此操作对数据集进行拓展。
例如在2003年Patrice Simard等人所著的一篇论文中[1]他们把MNIST手写数字数据集通过旋转,转换和扭曲进行扩展。通过在这个扩展后的数据集上的训练,他们把MNIST手写数字识别的准确率提升到了98.9%。然后还在“弹性扭曲”的数据集上进行了实验,这是一种特殊的为了模仿手部肌肉的随机抖动的图像扭曲方法。通过使用弹性扭曲扩展的数据,他们最终达到了99.3%的分类准确率。
具体方法
原图
图像强度变换
亮度变化
图像整体加上一个随机偏差,或整体进行尺度的放缩
- 亮度增强
- 亮度减弱
不影响label的位置
对比度变化
扩展图像灰度级动态范围,对两极的像素进行压缩,对中间范围的像素进行扩展
不影响label的位置
图像滤波
锐化
增强图像边缘信息
不影响label的位置
高斯模糊
blur
图像平滑
不影响label的位置
透视变换
镜像翻转
flip
使图像沿长轴进行翻转
第一个位置的参数 pos = 1 - pos,其他信息不变,可以采用脚本自动生成
图像裁剪
crop
裁剪原图80%大小的中心图像,并进行随机移动
可能将目标对象裁减掉,因此采用手工重新标注
图像拉伸
deform
拉伸成长宽为原始宽的正方形图像
原图中比例信息改变,最好重新手工标注
镜头畸变
对图像进行透视变化,模拟鱼眼镜头的镜头畸变
通过播放径向系数k1,k2,k3和切向系数p1,p2实现
最好重新手工标注
注入噪声
椒盐噪声
noise
在图像中随机添加白/黑像素
不影响label的位置
渐晕
对图像添加一个圆范围内的噪声模拟光晕
不影响label的位置
其他
随机抠除
cutout
随机抠出四个位置,并用黑色/彩色矩形填充
不影响label的位置