Keras 3 API documentation / KerasCV / Layers / Augmentation layers / RandomSaturation layer

RandomSaturation layer


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.


  • factor: A tuple of two floats, a single float or keras_cv.FactorSampler. factor controls the extent to which the image saturation is impacted. factor=0.5 makes this layer perform a no-op operation. factor=0.0 makes the image to be fully grayscale. factor=1.0 makes the image to be fully saturated. Values should be between 0.0 and 1.0. If a tuple is used, a factor is sampled between the two values for every image augmented. If a single float is used, a value between 0.0 and 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.


(images, labels), _ = keras.datasets.cifar10.load_data()
random_saturation = keras_cv.layers.preprocessing.RandomSaturation()
augmented_images = random_saturation(images)