RandomSaturation layer
- Original Link : https://keras.io/api/keras_cv/layers/augmentation/random_saturation/
- Last Checked at : 2024-11-25
RandomSaturation class
keras_cv.layers.RandomSaturation(factor, seed=None, **kwargs)Randomly adjusts the saturation on given images.
This layer will randomly increase/reduce the saturation for the input RGB images.
Arguments
- factor: A tuple of two floats, a single float or
keras_cv.FactorSampler.factorcontrols the extent to which the image saturation is impacted.factor=0.5makes this layer perform a no-op operation.factor=0.0makes the image to be fully grayscale.factor=1.0makes the image to be fully saturated. Values should be between0.0and1.0. If a tuple is used, afactoris sampled between the two values for every image augmented. If a single float is used, a value between0.0and the passed float is sampled. In order to ensure the value is always the same, please pass a tuple with two identical floats:(0.5, 0.5). - seed: Integer. Used to create a random seed.
Example
(images, labels), _ = keras.datasets.cifar10.load_data()
random_saturation = keras_cv.layers.preprocessing.RandomSaturation()
augmented_images = random_saturation(images)