RandomPosterize¶
- class torchaug.transforms.RandomPosterize(bits, p=0.5, batch_inplace=False, batch_transform=False)[source]¶
Posterize the image or video with a given probability by reducing the number of bits for each color channel.
The input should be of type torch.uint8 and it is expected to have […, 1 or 3, H, W] shape, where … means an arbitrary number of leading dimensions.
- Parameters:
bits (
int) – number of bits to keep for each channel (0-8)p (
float, optional) – probability of the image being posterized. Default:0.5batch_inplace (
bool, optional) – whether to apply the batch transform in-place. Does not prevent functionals to make copy but can reduce time and memory consumption. Default:Falsebatch_transform (
bool, optional) – whether to apply the transform in batch mode. Default:False