RandomChannelShift classkeras_cv.layers.RandomChannelShift(
value_range, factor, channels=3, seed=None, **kwargs
)
Randomly shift values for each channel of the input image(s).
The input images should have values in the [0-255] or [0-1] range.
Input shape
3D (unbatched) or 4D (batched) tensor with shape:
(..., height, width, channels), in channels_last format.
Output shape
3D (unbatched) or 4D (batched) tensor with shape:
(..., height, width, channels), in channels_last format.
Arguments
[0, 1] or [0, 255] depending
on how your preprocessing pipeline is set up.[0.0, 1.0]. If factor is a single value, it will
interpret as equivalent to the tuple (0.0, factor). The factor
will sample between its range for every image to augment.Example
(images, labels), _ = keras.datasets.cifar10.load_data()
rgb_shift = keras_cv.layers.RandomChannelShift(value_range=(0, 255),
factor=0.5)
augmented_images = rgb_shift(images)