当前位置:网站首页>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只会比原来的数据好一点,不会好很多。
边栏推荐
- 不要用jOOQ串联字符串
- MLX90640 红外热成像仪测温模块开发笔记(完整版)
- Don't know about SynchronousQueue?So ArrayBlockingQueue and LinkedBlockingQueue don't and don't know?
- 22. The support vector machine (SVM), gaussian kernel function
- 基于数据驱动的变电站巡检机器人自抗扰控制
- 路由策略
- 460. LFU cache
- 08-SDRAM: Summary
- AXI4协议介绍
- Transient Stability Distributed Control of Power System with External Energy Storage
猜你喜欢
鲲鹏编译调试插件实战
MLX90640 红外热成像仪测温模块开发笔记(完整版)
unity2D横版游戏教程5-UI
Don't know about SynchronousQueue?So ArrayBlockingQueue and LinkedBlockingQueue don't and don't know?
辨析内存函数memset、memcmp、memmove以及memcpy
go笔记之——goroutine
uni-app项目总结
Web开发
DFS详解
[Solution] Emqx startup under win10 reports Unable to load emulator DLL, node.db_role = EMQX_NODE__DB_ROLE = core
随机推荐
JSP how to obtain the path information in the request object?
go笔记之——goroutine
460. LFU cache
Double queue implementation stack?Dual stack implementation queue?
TCL: Pin Constraints Using the tcl Scripting Language in Quartus
期货开户手续费加一分是主流
els block boundary deformation processing
基于超参数自动寻优的工控网络入侵检测
磁盘与文件系统管理
不要用jOOQ串联字符串
How to find new potential projects?Tools recommended
IO stream basics
Automatic conversion of Oracle-style implicit joins to ANSI JOINs using jOOQ
实现删除-一个字符串中的指定字母,如:字符串“abcd”,删除其中的”a”字母,剩余”bcd”,也可以传递多个需要删除的字符,传递”ab”也可以做到删除”ab”,剩余”cd”。
2022/08/01 Study Notes (day21) Generics and Enums
146. LRU cache
The Statement update Statement execution
146. LRU 缓存
已知中序遍历数组和先序遍历数组,返回后序遗历数组
工业信息物理系统攻击检测增强模型