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, in range of [0, 1] (default=0.5). 
- prob (float, optional) – Probability of the image being applied perspective transformation (default=0.5). 
- interpolation (Inter, optional) – - Image interpolation mode (default=Inter.BICUBIC). It can be any of [Inter.BILINEAR, Inter.NEAREST, Inter.BICUBIC]. - Inter.BILINEAR, bilinear interpolation. 
- Inter.NEAREST, nearest-neighbor interpolation. 
- Inter.BICUBIC, bicubic interpolation. 
 
 
- Raises
- TypeError – If distortion_scale is not of type float. 
- TypeError – If prob is not of type float. 
- TypeError – If interpolation is not of type Inter. 
- ValueError – If distortion_scale is not in range [0, 1]. 
- ValueError – If prob is not in range [0, 1]. 
 
 - Supported Platforms:
- CPU
 - Examples - >>> from mindspore.dataset.transforms.py_transforms import Compose >>> transforms_list = Compose([py_vision.Decode(), ... py_vision.RandomPerspective(prob=0.1), ... py_vision.ToTensor()]) >>> # apply the transform to dataset through map function >>> image_folder_dataset = image_folder_dataset.map(operations=transforms_list, ... input_columns="image")