当前位置:网站首页>实现批量数据增强 | keras ImageDataGenerator使用
实现批量数据增强 | keras ImageDataGenerator使用
2022-07-28 07:55:00 【51CTO】
微信公众号:AI算法与图像处理
内容目录
什么是数据不均衡问题这里简单说明一下,重点是操作和应用:1、数据不均衡问题2、常见的解决方法函数说明准备工作功能说明参数说明参数完整代码效果展示总结
什么是数据不均衡问题
这里简单说明一下,重点是操作和应用:
1、数据不均衡问题
在大部分情况下,我们认为不同类别的数据是均匀分布的,很多算法也是基于这个假设,但是在真实的情况下,往往都不是如此的。例如,机器发送故障的情况是我们想要预测的,但实际上故障的概率是很低的,所以导致故障的样本量很少,即使你将所有的预测结果都设置为正常,准确率依然很高,但这个模型是一个没有用的模型,这种类似的例子是非常常见的。
2、常见的解决方法
解决的方案很多,主要从两个方面考虑(面试的时候可能会问)
在项目中,我们可能没那么多时间去思考从算法方面去解决,更多的时候想的是能用就行,但是网上很多的例子很多是基于内置的数据,这是非常让人难受的,或者是基于一张图片进行数据增强,很痛苦。更一般的情况是,对训练集下的某一个文件夹的所有图片进行数据增强,这就是我写这个的理由。
函数说明
准备工作
所使用的环境
功能说明
1)ImageDataGenerator 图片生成器
参数说明
备注:对于单张图片的数据增强,可以参看ImageDataGenerator和flow的使用说明
参数
rotation_range:整数,数据提升时图片随机转动的角度
2)flow_from_directory
完整代码
效果展示


总结
1、能基本实现我们需要的数据增强的要求
这里需要强调一点,ImageDataGenerator里面应该是每一张图片进去都会随机有可能受到所有的操作(例如裁剪,旋转等)的作用
希望每一篇用心写的推文都能帮助到你,可能你已经是大神了,这些对你没啥用,但是这却是新手一开始都会遇到的难题,不想大家因为一点小小的挫折就放弃,所以推文一方面是记录自己真实遇到的坑,另一面也希望能够提升自己的表达能力。
代码已经更新到:https://github.com/SCUTPZW/AI_study/tree/master
希望能够得到你们一颗真心的star(还没被点过)

END


边栏推荐
- mysql主从架构 ,主库挂掉重启后,从库怎么自动连接主库
- [soft test software evaluator] 2013 comprehensive knowledge over the years
- Flink Window&Time 原理
- CSV文件存储
- Vk1620 temperature controller / smart meter LED digital display driver chip 3/4-wire interface with built-in RC oscillator to provide technical support
- Among China's top ten national snacks, it is actually the first
- Go waitgroup and defer
- This flick SQL timestamp_ Can ltz be used in create DDL
- HCIP第八天
- What are the main uses of digital factory management system
猜你喜欢

修改虚拟机IP地址
![Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]](/img/97/6c3662ef36b02bc42eec95abaa6bc5.png)
Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]

Go waitgroup and defer

推荐一个摆脱变量名纠结的神器和批量修改文件名方法

Uniapp ---- detailed steps to obtain the longitude and latitude of the current position and other information (including applet)

Why is the text box of Google material design not used?

台大林轩田《机器学习基石》习题解答和代码实现 | 【你值得拥有】

Huid learning 7: Hudi and Flink integration

CSV文件存储

View the dimensions of the list
随机推荐
PostgreSQL: cannot change the type of column used by a view or rule
看得清比走得快更重要,因为走得对才能走得远
Wechat applet - wechat applet browsing PDF files
Round C financing has been completed! Smart software leads domestic Bi ecological empowerment, and products and services are a step forward
ES查询索引字段的分词结果
A new method of exposing services in kubernetes clusters
kubernetes之Deployment
Service current limiting and fusing of micro service architecture Sentinel
Completion report of communication software development and Application
How to execute the SQL assembled in ODPs SQL function and get the return value?
Centralized log management with sentry
Machine learning how to achieve epidemic visualization -- epidemic data analysis and prediction practice
象棋机器人夹伤7岁男孩手指,软件测试工程师的锅?我笑了。。。
Recruiting talents, gbase high-end talent recruitment in progress
Js继承方法
MDM数据质量应用说明
When I use MySQL CDC, there are 100 million pieces of data in the source table. In the full volume phase, when I synchronize 10 million, I stop, and then pass
What are the main uses of digital factory management system
看完这12个面试问题,新媒体运营岗位就是你的了
Learn to draw with nature communications -- complex violin drawing