Ara*_*san 16 python machine-learning data-generation python-3.x keras
Keras 的文档ImageDataGenerator class说——
width_shift_range: Float, 1-D array-like or int - float: 总宽度的分数,如果 < 1,或者像素,如果 >= 1。 - 1-D array-like: 来自数组的随机元素。- int:间隔的整数像素
(-width_shift_range, +width_shift_range)-width_shift_range=2可能的值为整数[-1, 0, +1],与 相同width_shift_range=[-1, 0, +1],而width_shift_range=1.0可能的值为区间 [-1.0, +1.0) 中的浮点数。
height_shift_range: Float, 1-D array-like or int - float: 总高度的分数,如果 < 1,或者像素,如果 >= 1。 - 1-D array-like: 来自数组的随机元素。- int:间隔的整数像素
(-height_shift_range, +height_shift_range)-height_shift_range=2可能的值为整数[-1, 0, +1],与 相同height_shift_range=[-1, 0, +1],而height_shift_range=1.0可能的值为区间 [-1.0, +1.0) 中的浮点数。
我是 Keras 和机器学习的新手,我刚刚开始学习。
我正在努力理解 Keras 这两个参数的文档和使用 ImageDataGenerator class,namedwidth_shift_range和height_shift_range. 我搜索了很多,但除了官方之外找不到任何好的文档。这两个论点究竟有什么作用?什么时候必须使用它们?
这个演讲在这里似乎不合适,但由于互联网上没有任何地方进行讨论,我认为在这里进行讨论会很好。
如果有人帮助我理解这些,我将不胜感激。非常感谢。
Say*_*han 15
ImageDataGenerator classwhich 使用的这两个参数用于在将图像输入网络之前对其进行预处理。如果你想让你的模型更健壮,那么少量的数据是不够的。这就是数据增强派上用场的地方。这用于生成随机数据。
width_shift_range:它实际上将图像向左或向右移动(水平移动)。如果值为float and <=1,它将以总宽度的百分比作为范围。假设图像width is 100px。如果width_shift_range = 1.0它会采取-100% to +100%手段-100px to +100px。它会在这个范围内随机移动图像。随机选择的正值将使图像向右移动,负值将向左移动图像。我们也可以通过选择像素来做到这一点。如果我们设置width_shift_range = 100它也会有同样的效果。更重要的是integer value>=1 count pixel as range和float value<=1 count percentage of total width as range。下面的图片是为width_shift_range = 1.0.
height_shift_range:它的工作原理与width_shift_range垂直移动(向上或向下)相同。下面的图片是为height_shift_range=0.2,fill_mode="constant"
fill_mode: 它为输入区域中新移动的像素设置规则。
## fill_mode: One of {"constant", "nearest", "reflect" or "wrap"}.
## Points outside the boundaries of the input are filled according to the given mode:
## "constant": kkkkkkkk|abcd|kkkkkkkk (cval=k)
## "nearest": aaaaaaaa|abcd|dddddddd
## "reflect": abcddcba|abcd|dcbaabcd
## "wrap": abcdabcd|abcd|abcdabcd
Run Code Online (Sandbox Code Playgroud)
有关更多信息,您可以查看此博客
| 归档时间: |
|
| 查看次数: |
4681 次 |
| 最近记录: |