Solarization
classkeras_cv.layers.Solarization(
value_range, addition_factor=0.0, threshold_factor=0.0, 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
Reference
Arguments
value_range
.keras_cv.FactorSampler
. For each augmented image a value is
sampled from the provided range. If a float is passed, the range is
interpreted as (0, addition_factor)
. If specified, this value is
added to each pixel before solarization and thresholding. The
addition value should be scaled according to the value range
(0, 255), defaults to 0.0.keras_cv.FactorSampler
. For each augmented image a value is
sampled from the provided range. If a float is passed, the range is
interpreted as (0, threshold_factor)
. If specified, only pixel
values above this threshold will be solarized.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]
Call arguments