RandomPerspective¶
- class torchvision.transforms.RandomPerspective(distortion_scale=0.5, p=0.5, interpolation=InterpolationMode.BILINEAR, fill=0)[source]¶
以給定機率對給定影像執行隨機透視變換。如果影像是 torch Tensor,則期望其形狀為 […, H, W],其中 … 表示任意數量的前導維度。
- 引數:
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的示例