Solarization
类keras.layers.Solarization(
addition_factor=0.0, threshold_factor=0.0, value_range=(0, 255), seed=None, **kwargs
)
对图像中的每个像素应用 (max_value - pixel + min_value)
。
当创建时未指定 threshold
参数,该层会对所有值进行 Solarization 处理。当指定了 threshold
参数时,该层仅增强值高于 threshold
的像素。
参数
(0, addition_factor)
。如果指定,此值(乘以输入图像的值范围,例如 255)将在 Solarization 和阈值处理之前添加到每个像素。默认为 0.0。(0, threshold_factor)
。如果指定,只有高于此阈值的像素值会被 Solarization 处理。value_range
范围内。典型的值包括 (0, 255)
(RGB 图像) 或 (0., 1.)
(缩放后的图像)。name
和 dtype
。示例
(images, labels), _ = keras.datasets.cifar10.load_data()
print(images[0, 0, 0])
# [59 62 63]
# Note that images are Tensor with values in the range [0, 255]
solarization = Solarization(value_range=(0, 255))
images = solarization(images)
print(images[0, 0, 0])
# [196, 193, 192]