enlarge your dataset
列举常见的几种数据集增强方法:
1.flip 翻折(左右,上下)
# NumPy.'img' = A single image.
flip_1 = np.fliplr(img)
# TensorFlow. 'x' = A placeholder for an image.
shape = [height, width, channels]
x = tf.placeholder(dtype = tf.float32, shape = shape)
flip_2 = tf.image.flip_up_down(x)
flip_3 = tf.image.flip_left_right(x)
flip_4 = tf.image.random_flip_up_down(x)
flip_5 = tf.image.random_flip_left_right(x)
2.rotation 旋转
# Placeholders: 'x' = A single image, 'y' = A batch of images
# 'k' denotes the number of 90 degree anticlockwise rotations
shape = [height, width, channels]
x = tf.placeholder(dtype = tf.float32, shape = shape)
rot_90 = tf.image.rot90(img, k=1)
rot_180 = tf.image.rot90(img, k=2)
# To rotate in any angle. In the example below, 'angles' is in radians
shape = [batch, height, width, 3]
y = tf.placeholder(dtype = tf.float32, shape = shape)
rot_tf_180 = tf.contrib.image.rotate(y, angles=3.1415)
# Scikit-Image. 'angle' = Degrees. 'img' = Input Image
# For details about 'mode', checkout the interpolation section below.
rot = skimage.transform.rotate(img, angle=45, mode='reflect')
3.scale 缩放
# Scikit Image. 'img' = Input Image, 'scale' = Scale factor
# For details about 'mode', checkout the interpolation section below.
scale_out = skimage.transform.rescale(img, scale=2.0, mode='constant')
scale_in = skimage.transform.rescale(img, scale=0.5, mode='constant')
# Don't forget to crop the images back to the original size (for
# scale_out)
4.crop 裁剪
# TensorFlow. 'x' = A placeholder for an image.
original_size = [height, width, channels]
x = tf.placeholder(dtype = tf.float32, shape = original_size)
# Use the following commands to perform random crops
crop_size = [new_height, new_width, channels]
seed = np.random.randint(1234)
x = tf.random_crop(x, size = crop_size, seed = seed)
output = tf.images.resize_images(x, size = original_size)
5.translation 水平或竖直移动
# pad_left, pad_right, pad_top, pad_bottom denote the pixel
# displacement. Set one of them to the desired value and rest to 0
shape = [batch, height, width, channels]
x = tf.placeholder(dtype = tf.float32, shape = shape)
# We use two functions to get our desired augmentation
x = tf.image.pad_to_bounding_box(x, pad_top, pad_left, height + pad_bottom + pad_top, width + pad_right + pad_left)
output = tf.image.crop_to_bounding_box(x, pad_bottom, pad_right, height, width)
6.gaussion noise 噪点
#TensorFlow. 'x' = A placeholder for an image.
shape = [height, width, channels]
x = tf.placeholder(dtype = tf.float32, shape = shape)
# Adding Gaussian noise
noise = tf.random_normal(shape=tf.shape(x), mean=0.0, stddev=1.0,
dtype=tf.float32)
output = tf.add(x, noise)
7.gan高级增强
旋转、缩放等操作,有可能造成未知区域弥补,具体细节以及上面各种方法,见下面原文链接介绍。
源文:https://medium.com/nanonets/how-to-use-deep-learning-when-you-have-limited-data-part-2-data-augmentation-c26971dc8ced
译文:https://blog.csdn.net/u010801994/article/details/81914716
enlarge your dataset的更多相关文章
- AlexNet论文翻译-ImageNet Classification with Deep Convolutional Neural Networks
ImageNet Classification with Deep Convolutional Neural Networks 深度卷积神经网络的ImageNet分类 Alex Krizhevsky ...
- Paper: ImageNet Classification with Deep Convolutional Neural Network
本文介绍了Alex net 在imageNet Classification 中的惊人表现,获得了ImagaNet LSVRC2012第一的好成绩,开启了卷积神经网络在cv领域的广泛应用. 1.数据集 ...
- 1 - ImageNet Classification with Deep Convolutional Neural Network (阅读翻译)
ImageNet Classification with Deep Convolutional Neural Network 利用深度卷积神经网络进行ImageNet分类 Abstract We tr ...
- 使用Keras基于RCNN类模型的卫星/遥感地图图像语义分割
遥感数据集 1. UC Merced Land-Use Data Set 图像像素大小为256*256,总包含21类场景图像,每一类有100张,共2100张. http://weegee.vision ...
- Install Tensorflow object detection API in Anaconda (Windows)
This blog is to explain how to install Tensorflow object detection API in Anaconda in Windows 10 as ...
- HTML5 数据集属性dataset
有时候在HTML元素上绑定一些额外信息,特别是JS选取操作这些元素时特别有帮助.通常我们会使用getAttribute()和setAttribute()来读和写非标题属性的值.但为此付出的代价是文档将 ...
- C#读取Excel,或者多个excel表,返回dataset
把excel 表作为一个数据源进行读取 /// <summary> /// 读取Excel单个Sheet /// </summary> /// <param name=& ...
- DataTable DataRow DataColumn DataSet
1.DataTable 数据表(内存) 2.DataRow DataTable 的行 3.DataColumn DataTable 的列 4.DataSet 内存中的缓存
- C# DataSet装换为泛型集合
1.DataSet装换为泛型集合(注意T实体的属性其字段类型与dataset字段类型一一对应) #region DataSet装换为泛型集合 /// <summary> /// 利用反射和 ...
随机推荐
- 33. 完全卸载oracle11g步骤
完全卸载oracle11g步骤:1. 开始->设置->控制面板->管理工具->服务 停止所有Oracle服务.2. 开始->程序->Oracle - OraHome ...
- Flex+BlazeDS+java通信详细笔记2-推送
前台是Air,后台是java 在运行之前,先要在IE地址栏输入http://127.0.0.1:8080/PushDemo/TickCacheServlet?cmd=start 激活它. 地址:htt ...
- mezzanine的page表
class Orderable(with_metaclass(OrderableBase, models.Model)): """ Abstract model that ...
- Xpath选择、操作web元素
11月6日 xpath选择 XPath(XML Path Language)是W3C(World Wide Web Consortium)定义的用来在XML文档中选择节点的语言, 主浏览器也支持XPa ...
- Win7查看开关机记录
通过系统日志可以查看,这里记得的日志很多,需要筛选一下,来个图片看的清楚: 事件ID的12,13就代表开关机,具体信息会在窗口下方显示.
- golang web框架 beego
尝试了下,在go环境ready的情况下,花了2分钟完成了beego安装.项目生成和启动,效率还是不错的 1.安装: go get github.com/astaxie/beego go get git ...
- VirtualBox安装增强工具方法
1.http://blog.csdn.net/wuliowen/article/details/71541561 2.https://segmentfault.com/a/11900000062335 ...
- c#自定义类型的转换方式operator,以及implicit(隐式)和explicit (显示)声明
https://docs.microsoft.com/zh-cn/dotnet/csharp/language-reference/keywords/explicit https://docs.mic ...
- 一个linux内核模块移植到低版本时发生的异常
在3.10的内核版本下,有一个运行稳定的内核模块,移植到suse11的时候,编译正常,运行则直接出现crash: <>[ <>[ 503.347300] Modules lin ...
- linux 3.10 一次softlock排查
x86架构.一个同事分析的crash,我在他基础上再次协助分析,也没有获得进展,只是记录一下分析过程.记录是指备忘,万一有人解决过,也好给我们点帮助. 有一次软锁,大多数cpu被锁,log中第一个认为 ...