列举常见的几种数据集增强方法:

1.flip  翻折(左右,上下)

  1. # NumPy.'img' = A single image.
  2. flip_1 = np.fliplr(img)
  3. # TensorFlow. 'x' = A placeholder for an image.
  4. shape = [height, width, channels]
  5. x = tf.placeholder(dtype = tf.float32, shape = shape)
  6. flip_2 = tf.image.flip_up_down(x)
  7. flip_3 = tf.image.flip_left_right(x)
  8. flip_4 = tf.image.random_flip_up_down(x)
  9. flip_5 = tf.image.random_flip_left_right(x)

2.rotation 旋转

  1. # Placeholders: 'x' = A single image, 'y' = A batch of images
  2. # 'k' denotes the number of 90 degree anticlockwise rotations
  3. shape = [height, width, channels]
  4. x = tf.placeholder(dtype = tf.float32, shape = shape)
  5. rot_90 = tf.image.rot90(img, k=1)
  6. rot_180 = tf.image.rot90(img, k=2)
  7. # To rotate in any angle. In the example below, 'angles' is in radians
  8. shape = [batch, height, width, 3]
  9. y = tf.placeholder(dtype = tf.float32, shape = shape)
  10. rot_tf_180 = tf.contrib.image.rotate(y, angles=3.1415)
  11. # Scikit-Image. 'angle' = Degrees. 'img' = Input Image
  12. # For details about 'mode', checkout the interpolation section below.
  13. rot = skimage.transform.rotate(img, angle=45, mode='reflect')

3.scale 缩放

  1. # Scikit Image. 'img' = Input Image, 'scale' = Scale factor
  2. # For details about 'mode', checkout the interpolation section below.
  3. scale_out = skimage.transform.rescale(img, scale=2.0, mode='constant')
  4. scale_in = skimage.transform.rescale(img, scale=0.5, mode='constant')
  5. # Don't forget to crop the images back to the original size (for
  6. # scale_out)

4.crop 裁剪

  1. # TensorFlow. 'x' = A placeholder for an image.
  2. original_size = [height, width, channels]
  3. x = tf.placeholder(dtype = tf.float32, shape = original_size)
  4. # Use the following commands to perform random crops
  5. crop_size = [new_height, new_width, channels]
  6. seed = np.random.randint(1234)
  7. x = tf.random_crop(x, size = crop_size, seed = seed)
  8. output = tf.images.resize_images(x, size = original_size)

5.translation 水平或竖直移动

  1. # pad_left, pad_right, pad_top, pad_bottom denote the pixel
  2. # displacement. Set one of them to the desired value and rest to 0
  3. shape = [batch, height, width, channels]
  4. x = tf.placeholder(dtype = tf.float32, shape = shape)
  5. # We use two functions to get our desired augmentation
  6. x = tf.image.pad_to_bounding_box(x, pad_top, pad_left, height + pad_bottom + pad_top, width + pad_right + pad_left)
  7. output = tf.image.crop_to_bounding_box(x, pad_bottom, pad_right, height, width)

6.gaussion noise 噪点

  1. #TensorFlow. 'x' = A placeholder for an image.
  2. shape = [height, width, channels]
  3. x = tf.placeholder(dtype = tf.float32, shape = shape)
  4. # Adding Gaussian noise
  5. noise = tf.random_normal(shape=tf.shape(x), mean=0.0, stddev=1.0,
  6. dtype=tf.float32)
  7. 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的更多相关文章

  1. AlexNet论文翻译-ImageNet Classification with Deep Convolutional Neural Networks

    ImageNet Classification with Deep Convolutional Neural Networks 深度卷积神经网络的ImageNet分类 Alex Krizhevsky ...

  2. Paper: ImageNet Classification with Deep Convolutional Neural Network

    本文介绍了Alex net 在imageNet Classification 中的惊人表现,获得了ImagaNet LSVRC2012第一的好成绩,开启了卷积神经网络在cv领域的广泛应用. 1.数据集 ...

  3. 1 - ImageNet Classification with Deep Convolutional Neural Network (阅读翻译)

    ImageNet Classification with Deep Convolutional Neural Network 利用深度卷积神经网络进行ImageNet分类 Abstract We tr ...

  4. 使用Keras基于RCNN类模型的卫星/遥感地图图像语义分割

    遥感数据集 1. UC Merced Land-Use Data Set 图像像素大小为256*256,总包含21类场景图像,每一类有100张,共2100张. http://weegee.vision ...

  5. 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 ...

  6. HTML5 数据集属性dataset

    有时候在HTML元素上绑定一些额外信息,特别是JS选取操作这些元素时特别有帮助.通常我们会使用getAttribute()和setAttribute()来读和写非标题属性的值.但为此付出的代价是文档将 ...

  7. C#读取Excel,或者多个excel表,返回dataset

    把excel 表作为一个数据源进行读取 /// <summary> /// 读取Excel单个Sheet /// </summary> /// <param name=& ...

  8. DataTable DataRow DataColumn DataSet

    1.DataTable 数据表(内存) 2.DataRow DataTable 的行 3.DataColumn DataTable 的列 4.DataSet 内存中的缓存

  9. C# DataSet装换为泛型集合

    1.DataSet装换为泛型集合(注意T实体的属性其字段类型与dataset字段类型一一对应) #region DataSet装换为泛型集合 /// <summary> /// 利用反射和 ...

随机推荐

  1. 电脑IP设置

    方法一: echo offecho 修改[本地连接]IP......netsh interface IP set address "本地连接" static 138.8.8.111 ...

  2. <记录> PHP Redis操作类

    namespace common\controller; class Redis { public $redisObj = null; //redis实例化时静态变量 static protected ...

  3. Windows下开启Redis PHP拓展

    1. 安装Redis windows下redis的版本,git地址https://github.com/MSOpenTech/redis/releases 2. 打开phpInfo,查看当前PHP是N ...

  4. eclipse中无法新建Android工程 出现问题:Plug-in org.eclipse.ajdt.ui was unable to load

    转自:http://www.bubuko.com/infodetail-757338.html eclipse中打开后新建Android项目区仍无法创建,出现下列提示对话框: Plug-in org. ...

  5. django 使用mysql 数据库

    在 django 创建项目中 默认使用的是  splite3 数据库,不是mysql 数据库,要使用mysql ,要做一些配置: 在 settings.py 中修改如下: DATABASES = { ...

  6. nginx压缩,缓存

    https://www.darrenfang.com/2015/01/setting-up-http-cache-and-gzip-with-nginx/ https://www.linuxdashe ...

  7. Oracle部署安装

    1.用户有数据库服务器则不需要安装Oracle服务器端,若没有需要安装 https://jingyan.baidu.com/article/363872eccfb9266e4aa16f5d.html ...

  8. P12, cer, provisioning profile

    p12,本地私钥(实际上证书和私钥可以一起导出成p12,这里我们仅指私钥) cer,证书,即苹果签名后的公钥 provisioning profile描述文件 一个证书对应一个私钥,也就是本地的p12 ...

  9. pandas 笔记

    删除: del df["A"]  # 原地修改 df.drop("a")  # 返回修改后的新对象 df.drop(["a", " ...

  10. Structs复习 简单数据校验

    jar包 web.XML <?xml version="1.0" encoding="UTF-8"?> <web-app version=&q ...