当前位置:网站首页>Data enhancement
Data enhancement
2022-06-11 16:00:00 【zhao_ crystal】
Catalog
1. Implementation method of data enhancement
2. Data enhancement in tf In the implementation of
2.1 adopt ImageDataGenerator Enhance the data
1. Implementation method of data enhancement
(1) normalization
Normalize the data to a certain range , Make the network easier to learn .
(2) Image transformation
Flip , The tensile , tailoring , deformation ( Rich data )
(3) Color change
Contrast , brightness
(4) Multiscale clipping 
2. Data enhancement in tf In the implementation of
adopt keras.preprocessing.image.ImageDataGenerator Interface to implement data enhancement
rescale = 1./255, # Zoom all pixels to 0——1, Because the values of all pixels are 0——255 Between .
rotation_range = 40, # A way of image enhancement , such as ratation_range = 40, Indicates that the random rotation angle of the image is -40——40 Between degrees .
width_shift_range = 0.2, # Displacement in the horizontal direction , Less than 1, It is the ratio of displacement ; Greater than 1, Is the value of the moving pixel .width_shift_range = 0.2, Indicates random translation of the image 0——20%
height_shift_range = 0.2, # Displacement in the vertical direction
shear_range = 0.2, # Shear strength
zoom_range = 0.2, # Scaling strength
horizontal_flip = True, # Whether to do random inversion in the horizontal direction
fill_mode = 'nearest') # When processing pictures , Use when pixels need to be filled . such as , Enlarge the image , Some pixels need to be filled .
2.1 adopt ImageDataGenerator Enhance the data
# Training data
train_datagen= keras.preprocessing.image.ImageDataGenerator(
rescale = 1./255, # Zoom all pixels to 0——1, Because the values of all pixels are 0——255 Between .
rotation_range = 40, # A way of image enhancement , such as ratation_range = 40, Indicates that the random rotation angle of the image is -40——40 Between degrees .
width_shift_range = 0.2, # Displacement in the horizontal direction , Less than 1, It is the ratio of displacement ; Greater than 1, Is the value of the moving pixel .width_shift_range = 0.2, Indicates random translation of the image 0——20%
height_shift_range = 0.2, # Displacement in the vertical direction
shear_range = 0.2, # Shear strength
zoom_range = 0.2, # Scaling strength
horizontal_flip = True, # Whether to do random inversion in the horizontal direction
fill_mode = 'nearest') # When processing pictures , Use when pixels need to be filled . such as , Enlarge the image , Some pixels need to be filled .
train_generator = train_datagen.flow_from_directory(
train_dir,
target_size = (height, width),
batch_size = batch_size,
seed = 7,
shuffle = True,
class_mode = "categorical")
# Validation data
valid_datagen= keras.preprocessing.image.ImageDataGenerator(
rescale = 1./255 # Zoom all pixels to 0——1, Because the values of all pixels are 0——255 Between .
)
valid_generator = train_datagen.flow_from_directory(
valid_dir,
target_size = (height, width),
batch_size = batch_size,
seed = 7,
shuffle = False,
class_mode = "categorical")For more codes, see : This code is based on convolutional neural network .
边栏推荐
- DHCP协议实例化分析
- 内存优化表MOT管理
- Opengauss AI capability upgrade to create a new AI native database
- 收藏 |彻底搞懂感受野的含义与计算
- [Yugong series] June 2022 Net architecture class 076- execution principle of distributed middleware schedulemaster
- Database resource load management (Part 2)
- PostgreSQL startup process
- GO語言-值類型和引用類型
- [digital signal processing] correlation function (correlation function property | conjugate symmetry property of correlation function | even symmetry of real signal autocorrelation function | conjugat
- Opengauss version 3.0.0 was officially released, and immediately experience the first lightweight version in the community
猜你喜欢

验证码是自动化的天敌?阿里研究出了解决方法

Nielseniq announces appointment of Tracey Massey as chief operating officer

【愚公系列】2022年06月 .NET架构班 079-分布式中间件 ScheduleMaster的集群原理
![[0006] titre, mots clés et description de la page](/img/28/973bdb04420c9e6e9a2331663c6948.png)
[0006] titre, mots clés et description de la page

Code farming essential SQL tuning (Part 2)

openGauss企业版安装

三千字教你使用MOT

How does the taskbar under the computer display open programs

Collection | can explain the development and common methods of machine learning!

DHCP协议实例化分析
随机推荐
After nine years of testing, the salary for interviewing Huawei is 10000. Huawei employees: the company doesn't have such a low salary position
This "invisible" robot may be your future colleague
How to predict SQL statement query time?
Collection | can explain the development and common methods of machine learning!
Go language - value types and reference types
Docker uses redis image
Export configuration to FTP or TFTP server
导入数据:gs_restore or MERGE INTO? 看看哪款更适合你
码农必备SQL调优(下)
Go language slice
Learn automatic testing of postman interface from 0 to 1
Memory optimization table mot management
泰雷兹云安全报告显示,云端数据泄露和复杂程度呈上升趋势
Classmate, have you heard of mot?
[0006] title, keyword and page description
[Yugong series] June 2022 Net architecture class 078 worker cluster of distributed middleware schedulemaster
数据库密态等值查询概述及操作
How AGC security rules simplify user authorization and authentication requests
Yiwenjiaohui your database system tuning
用户界面之工具栏详解-AutoRunner自动化测试工具