RandomPerspective¶
- class torchvision.transforms.RandomPerspective(distortion_scale=0.5, p=0.5, interpolation=InterpolationMode.BILINEAR, fill=0)[source]¶
以給定的機率對給定的影像執行隨機透視轉換。如果影像是 torch Tensor,則預期具有 […, H, W] 形狀,其中 … 表示任意數量的 leading dimension。
- 參數:
distortion_scale (float) – 用於控制失真程度的引數,範圍從 0 到 1。預設值為 0.5。
p (float) – 影像被轉換的機率。預設值為 0.5。
interpolation (InterpolationMode) – 所需的插值列舉,由
torchvision.transforms.InterpolationMode
定義。預設值為InterpolationMode.BILINEAR
。如果輸入是 Tensor,則僅支援InterpolationMode.NEAREST
和InterpolationMode.BILINEAR
。也接受相應的 Pillow 整數常數,例如PIL.Image.BILINEAR
。fill (sequence 或 number) – 用於轉換後影像外部區域的像素填充值。預設值為
0
。如果給定一個數字,則該值分別用於所有波段。
使用
RandomPerspective
的範例