Загрузка
Transform the input with elastic transformations.
If the input is a torch.Tensor or a TVTensor (e.g. Image,
Video, BoundingBoxes etc.)
it can have arbitrary number of leading batch dimensions. For example,
the image can have [..., C, H, W] shape. A bounding box can have [..., 4] shape.
Given alpha and sigma, it will generate displacement vectors for all pixels based on random offsets. Alpha controls the strength and sigma controls the smoothness of the displacements. The displacements are added to an identity grid and the resulting grid is used to transform the input.
Randomly transforms the morphology of objects in images and produces a see-through-water-like effect.
alpha (float or sequence of python:floats, optional) – Magnitude of displacements.
Default is 50.0. A single value is [alpha, alpha].
sigma (float or sequence of python:floats, optional) – Smoothness of displacements.
Default is 5.0. A single value is [sigma, sigma].
interpolation (str or InterpolationMode, optional) – Desired interpolation enum defined by . Accepted string values are , , , , , , and . , , and are only supported for PIL images. Default is . The corresponding enum values and Pillow integer constants, e.g. are accepted as well.
Examples using ElasticTransform:
"nearest""nearest-exact""bilinear""bicubic""box""hamming""lanczos""box""hamming""lanczos""bilinear"InterpolationModePIL.Image.BILINEARfill (number or tuple or dict, optional) – Pixel fill value used when the padding_mode is constant.
Default is 0. If a tuple of length 3, it is used to fill R, G, B channels respectively.
Fill value can be also a dictionary mapping data type to the fill value, e.g.
fill={tv_tensors.Image: 127, tv_tensors.Mask: 0} where Image will be filled with 127 and
Mask will be filled with 0.