mindspore.dataset.vision.py_transforms.RandomColor

class mindspore.dataset.vision.py_transforms.RandomColor(degrees=(0.1, 1.9))[source]

Adjust the color balance of the input PIL Image by a random degree.

Parameters

degrees (sequence) – Range of color adjustment degree to be randomly chosen from, which should be in shape of (min, max) (default=(0.1,1.9)).

Raises
  • TypeError – If degrees is not of type sequence of float.

  • ValueError – If degrees is negative.

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

Supported Platforms:

CPU

Examples

>>> from mindspore.dataset.transforms.py_transforms import Compose
>>> transforms_list = Compose([py_vision.Decode(),
...                            py_vision.RandomColor((0.5, 2.0)),
...                            py_vision.ToTensor()])
>>> # apply the transform to dataset through map function
>>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list,
...                                                 input_columns="image")