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 参数,该层会对所有值执行曝光。当创建并指定 threshold 时,该层只会增强高于 threshold 值的像素。
注意:该层可以在 tf.data 或 grain 管道中使用(无论您使用的是哪个后端),且是安全的。
参数
(0, addition_factor)。如果指定了此参数,则在曝光和阈值处理之前,会将此值(乘以输入图像的值范围,例如 255)加到每个像素上。默认为 0.0。(0, threshold_factor)。如果指定了此参数,则只有高于此阈值的像素值才会被曝光。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]