Posterization classkeras_cv.layers.Posterization(value_range, bits, **kwargs)
Reduces the number of bits for each color channel.
References
Arguments
value_range. Defaults to (0, 255).Example
(images, labels), _ = keras.datasets.cifar10.load_data()
print(images[0, 0, 0])
# [59 62 63]
# Note that images are Tensors with values in the range [0, 255] and uint8
dtype
posterization = Posterization(bits=4, value_range=[0, 255])
images = posterization(images)
print(images[0, 0, 0])
# [48., 48., 48.]
# NOTE: the layer will output values in tf.float32, regardless of input
dtype.
Call arguments
"images" key.