ElasticTransform¶
- class torchvision.transforms.ElasticTransform(alpha=50.0, sigma=5.0, interpolation=InterpolationMode.BILINEAR, fill=0)[原始碼]¶
使用彈性變換來轉換張量影像。給定 alpha 和 sigma,它將根據隨機偏移為所有像素生成位移向量。Alpha 控制強度,而 sigma 控制位移的平滑度。位移被添加到單位網格,並且產生的網格用於從影像進行 grid_sample。
- 應用
隨機變換影像中物體的形態,並產生類似看穿水面的效果。
- 參數:
alpha (float 或 python:floats 序列) – 位移的大小。預設值為 50.0。
sigma (float 或 python:floats 序列) – 位移的平滑度。預設值為 5.0。
interpolation (InterpolationMode) – 期望的插值列舉,由
torchvision.transforms.InterpolationMode
定義。預設值為InterpolationMode.BILINEAR
。如果輸入是張量,則僅支援InterpolationMode.NEAREST
、InterpolationMode.BILINEAR
。也接受對應的 Pillow 整數常數,例如PIL.Image.BILINEAR
。fill (sequence 或 number) – 轉換後影像外部區域的像素填充值。預設值為
0
。如果給定數字,則該值將分別用於所有頻帶。
使用
ElasticTransform
的範例