Solarization classkeras.layers.Solarization(
addition_factor=0.0, threshold_factor=0.0, value_range=(0, 255), seed=None, **kwargs
)
Applies (max_value - pixel + min_value) for each pixel in the image.
When created without threshold parameter, the layer performs solarization
to all values. When created with specified threshold the layer only
augments pixels that are above the threshold value.
Note: This layer is safe to use inside a tf.data or grain pipeline
(independently of which backend you're using).
Arguments
(0, addition_factor). If specified, this value
(times the value range of input images, e.g. 255), is
added to each pixel before solarization and thresholding.
Defaults to 0.0.(0, threshold_factor). If specified, only pixel
values above this threshold will be solarized.value_range. Typical values to pass
are (0, 255) (RGB image) or (0., 1.) (scaled image).name and dtype.Example
(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]