mindspore.dataset.vision.py_transforms.RandomPerspective
- class mindspore.dataset.vision.py_transforms.RandomPerspective(distortion_scale=0.5, prob=0.5, interpolation=Inter.BICUBIC)[source]
Randomly apply perspective transformation to the input PIL image with a given probability.
- Parameters
distortion_scale (float, optional) – The scale of distortion, a float value between 0 and 1 (default=0.5).
prob (float, optional) – Probability of the image being applied perspective transformation (default=0.5).
interpolation (Inter mode, optional) –
Image interpolation mode (default=Inter.BICUBIC). It can be any of [Inter.BILINEAR, Inter.NEAREST, Inter.BICUBIC].
Inter.BILINEAR, means the interpolation method is bilinear interpolation.
Inter.NEAREST, means the interpolation method is nearest-neighbor interpolation.
Inter.BICUBIC, means the interpolation method is bicubic interpolation.
Examples
>>> import mindspore.dataset.vision.py_transforms as py_vision >>> from mindspore.dataset.transforms.py_transforms import Compose >>> >>> Compose([py_vision.Decode(), >>> py_vision.RandomPerspective(prob=0.1), >>> py_vision.ToTensor()])