mindspore.dataset.vision.RandomPosterize

class mindspore.dataset.vision.RandomPosterize(bits=(8, 8))[source]

Reduce the number of bits for each color channel to posterize the input image randomly with a given probability.

Parameters

bits (Union[int, Sequence[int]], optional) – Range of random posterize to compress image. Bits values must be in range of [1,8], and include at least one integer value in the given range. It must be in (min, max) or integer format. If min=max, then it is a single fixed magnitude operation. Default: (8, 8).

Raises
  • TypeError – If bits is not of type integer or sequence of integer.

  • ValueError – If bits is not in range [1, 8].

  • RuntimeError – If given tensor shape is not <H, W> or <H, W, C>.

Supported Platforms:

CPU

Examples

>>> transforms_list = [vision.Decode(), vision.RandomPosterize((6, 8))]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])