当前位置:网站首页>21.数据增强
21.数据增强
2022-08-02 00:14:00 【派大星的最爱海绵宝宝】
目录
big data
防止过度拟合的关键
网络参数量越来越大,网络的表达能力越来越强,如果要train一个很好的性能,我们需要大的数据集,big data。
limited data
对有限的数据进行优化:
small network capacity
减小网络的参数量,网络不容易过度拟合。网络结构固定,可以使网络的一部分权值为0,达到减小参数量的目的。
regularization
data argumentation
对原来的数据进行多样化处理,例如拍摄稀有动物的照片,对拍摄到的少量的图片进行旋转、调色、加噪声等操作,可得到更大的数据集。
常用的数据增强手段
都在torchvision中,对图片的处理都在视觉领域。compose功能类似于nn.Sequential,把一系列功能打包在一起使用。
flip翻转
train_loader = torch.utils.data.DataLoader(
datasets.MNIST('mnist_data', train=True, download=True,
transform=torchvision.transforms.Compose([
transform.RandomHorizontalFlip(),
transform.RamdomVerticalFlip(),
transforms.ToTensor(),
])),
batch_size=batch_size, shuffle=True)
图片按照transform里的顺序进行
RandomHorizonFlip水平角度翻转,random指的是这一步不一定进行,增加了随机性。
RandomVerticalFlip是竖直角度翻转。
rotate旋转
更加通用
train_loader = torch.utils.data.DataLoader(
datasets.MNIST('mnist_data', train=True, download=True,
transform=torchvision.transforms.Compose([
transform.RandomHorizontalFlip(),
transform.RamdomVerticalFlip(),
transform.RandomRotation(15),
transform.RandomRotation([90,180,270]),
transforms.ToTensor(),
])),
batch_size=batch_size, shuffle=True)
第一种,旋转某个角度,参数x即翻转-x到x内进行翻转操作。
第二种,固定角度翻转,[90,180,270]随机的在这三个数中挑一个数进行旋转。
scale缩放
在中心店往外进行缩放
train_loader = torch.utils.data.DataLoader(
datasets.MNIST('mnist_data', train=True, download=True,
transform=torchvision.transforms.Compose([
transform.RandomHorizontalFlip(),
transform.RamdomVerticalFlip(),
transform.RandomRotation(15),
transform.RandomRotation([90,180,270]),
transform.Resize([32,32])
transforms.ToTensor(),
])),
batch_size=batch_size, shuffle=True)
把原图片缩放到32×32。
crop part裁剪部分
随机裁剪一部分,剩下部分填充空白。
transform.RandomCrop([28,28])
noise
增加一些噪声,pytorch中并没有直接借口,需要人为的在numpy中添加。也可以使用torch中提供的高斯分布等叠加到上面。
GAN
可生成更多的样本
特点
无穷多的照片和原来的照片的分布非常接近,variance非常的小,所以即使得到无穷多的照片进行train时,performance只会比原来的数据好一点,不会好很多。
边栏推荐
- 鲲鹏编译调试插件实战
- JSP built-in object out object function introduction
- 工业信息物理系统攻击检测增强模型
- Don't concatenate strings with jOOQ
- Transient Stability Distributed Control of Power System with External Energy Storage
- Unknown CMake command “add_action_files“
- nodeJs--mime module
- [Headline] Written test questions - minimum stack
- MLX90640 红外热成像仪测温传感器模块开发笔记(十) 成果展示-红眼睛相机
- els block deformation
猜你喜欢

146. LRU 缓存

辨析内存函数memset、memcmp、memmove以及memcpy

Knowing the inorder traversal of the array and the preorder traversal of the array, return the postorder history array

go笔记之——goroutine

测试用例:四步测试设计法
![[Headline] Written test questions - minimum stack](/img/67/08f2be8afc780e3848371a1b5e04db.png)
[Headline] Written test questions - minimum stack

这 4 款电脑记事本软件,得试试

MLX90640 红外热成像仪测温传感器模块开发笔记(十) 成果展示-红眼睛相机

傅立叶变换相关公式

Disk and file system management
随机推荐
What is Low-Code?What scenarios is low code suitable for?
磁盘与文件系统管理
渗透测试与攻防对抗——渗透测试基础
Task execution control in Ansible
回顾历史5次经济衰退时期:这一次可能会有何不同?
C language character and string function summary (2)
JS中localStorage和sessionStorage
严格模式,use strict
扫雷小游戏
06-SDRAM : SDRAM control module
js中内存泄漏的几种情况
Cyber-Physical System State Estimation and Sensor Attack Detection
Short video SEO optimization tutorial Self-media SEO optimization skills and methods
ES6对箭头函数的理解
What is the function of the JSP out.println() method?
面试:简单介绍你参与的一个项目
基于超参数自动寻优的工控网络入侵检测
期货开户交返是行内公开的秘密
els block deformation judgment.
Web开发