mindspore.dataset.vision.py_transforms.RandomSharpness

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

Adjust the sharpness of the input PIL Image by a random degree.

Parameters

degrees (sequence) – Range of sharpness adjustment degree to be randomly chosen from, which should be in shape of (min, max) (default=(0.1,1.9)). Degree of 0.0 gives a blurred image, degree of 1.0 gives the original image, and degree of 2.0 increases the sharpness by a factor of 2.

Raises
  • TypeError – If degrees is not a list or a tuple.

  • ValueError – If degrees is negative.

  • ValueError – If degrees is in (max, min) format instead of (min, max).

Supported Platforms:

CPU

Examples

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