mindspore.dataset.vision.RandomAutoContrast

View Source On Gitee
class mindspore.dataset.vision.RandomAutoContrast(cutoff=0.0, ignore=None, prob=0.5)[source]

Automatically adjust the contrast of the image with a given probability.

Parameters
  • cutoff (float, optional) – Percent of the lightest and darkest pixels to be cut off from the histogram of the input image. The value must be in range of [0.0, 50.0]. Default: 0.0.

  • ignore (Union[int, sequence], optional) – The background pixel values to be ignored, each of which must be in range of [0, 255]. Default: None.

  • prob (float, optional) – Probability of the image being automatically contrasted, which must be in range of [0.0, 1.0]. Default: 0.5.

Raises
  • TypeError – If cutoff is not of type float.

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

  • TypeError – If prob is not of type float.

  • ValueError – If cutoff is not in range [0.0, 50.0).

  • ValueError – If ignore is not in range [0, 255].

  • ValueError – If prob is not in range [0.0, 1.0].

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

Supported Platforms:

CPU

Examples

>>> import mindspore.dataset as ds
>>> import mindspore.dataset.vision as vision
>>>
>>> image_folder_dataset = ds.ImageFolderDataset("/path/to/image_folder_dataset_directory")
>>> transforms_list = [vision.Decode(), vision.RandomAutoContrast(cutoff=0.0, ignore=None, prob=0.5)]
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns=["image"])
Tutorial Examples: