ElasticTransform¶
- class torchvision.transforms.ElasticTransform(alpha=50.0, sigma=5.0, interpolation=InterpolationMode.BILINEAR, fill=0)[原始碼]¶
使用彈性變換轉換張量影像。給定 alpha 和 sigma,它將基於隨機偏移量為所有畫素生成位移向量。Alpha 控制位移的強度,sigma 控制位移的平滑度。將位移新增到身份網格,並將生成的網格用於從影像中進行 grid_sample。
- 應用
隨機變換影像中的物體形態,產生一種“水下”般的視覺效果。
- 引數:
alpha (float 或 sequence of python:floats) – 位移的幅度。預設為 50.0。
sigma (float 或 sequence of python:floats) – 位移的平滑度。預設為 5.0。
interpolation (InterpolationMode) – 由
torchvision.transforms.InterpolationMode定義的所需插值列舉。預設為InterpolationMode.BILINEAR。如果輸入是 Tensor,則僅支援InterpolationMode.NEAREST和InterpolationMode.BILINEAR。也接受相應的 Pillow 整數常量,例如PIL.Image.BILINEAR。fill (sequence 或 number) – 轉換影像外部區域的畫素填充值。預設為
0。如果給定一個數字,則該值分別用於所有波段。
使用
ElasticTransform的示例