RandomElasticTransform
类keras.layers.RandomElasticTransform(
factor=1.0,
scale=1.0,
interpolation="bilinear",
fill_mode="reflect",
fill_value=0.0,
value_range=(0, 255),
seed=None,
data_format=None,
**kwargs
)
一个应用随机弹性变换的预处理层。
此层通过应用弹性形变来扭曲输入图像,模拟物理上真实的变换。形变的大小由 scale
参数控制,而 factor
决定应用变换的概率。
参数
factor
控制应用变换的概率。factor=0.0
确保不应用擦除。factor=1.0
表示始终应用擦除。(min, max)
,则为每张图像在 min
和 max
之间采样一个概率值。0.0
和给定浮点数之间采样一个概率。默认值为 1.0。(min, max)
,则在此范围内随机采样一个比例值。0.0
和给定浮点数之间随机采样一个比例值。默认值为 1.0。"nearest"
、"bilinear"
。"constant"
、"nearest"
、"wrap"
和 "reflect"
。默认为 "constant"
。"reflect"
: `(d c b a | a b c d | d c b a)` 输入通过围绕最后一个像素的边缘进行反射来扩展。"constant"
: `(k k k k | a b c d | k k k k)` 输入通过用 `fill_value` 指定的相同常量值 k 填充边缘以外的所有值来扩展。"wrap"
: `(a b c d | a b c d | a b c d)` 输入通过环绕到相对边缘进行扩展。"nearest"
:(a a a a | a b c d | d d d d)
输入通过最近的像素进行扩展。请注意,当使用 torch 后端时,"reflect"
会被重定向到 "mirror"
(c d c b | a b c d | c b a b)
,因为 torch 不支持 "reflect"
。请注意,torch 后端不支持 "wrap"
。fill_mode="constant"
时用于填充边界之外的值。[low, high]
。这通常是 [0, 1]
或 [0, 255]
,具体取决于您的预处理管道设置。