ElasticTransformation#
- class deeptrack.augmentations.ElasticTransformation(alpha: float | Callable[[...], float] = 20, sigma: float | Callable[[...], float] = 2, ignore_last_dim: bool | Callable[[...], bool] = True, order: int | Callable[[...], int] = 3, cval: float | Callable[[...], float] = 0, mode: str | Callable[[...], str] = 'constant', **kwargs)#
Bases:
AugmentationTransform images using displacement fields.
The augmenter creates a random distortion field using alpha and sigma, which define the strength and smoothness of the field respectively. These are used to transform the input locally.
- Note:
This augmentation does not currently update the position property of the image, meaning that it is not recommended to use it if the data label is derived from the position properties of the resulting image.
For a detailed explanation, see:
Simard, Steinkraus and Platt Best Practices for Convolutional Neural Networks applied to Visual Document Analysis in Proc. of the International Conference on Document Analysis and Recognition, 2003.
Parameters#
- alpha: float
Strength of the distortion field. Common values are in the range (10, 100)
- sigma: float
Standard deviation of the gaussian kernel used to smooth the distortion fields. Common values are in the range (1, 10)
- ignore_last_dim: bool
Whether to skip creating a distortion field for the last dimension. This is often desired if the last dimension is a channel dimension (such as a color image.) In that case, the three channels are transformed identically and do not “bleed” into eachother.
- order: int
Interpolation order to use. Takes integers from 0 to 5
0:
Nearest-neighbor1:
Bi-linear(default)2:
Bi-quadratic(not recommended by skimage)3:
Bi-cubic4:
Bi-quartic5:
Bi-quintic
- cval: float
The constant intensity value used to fill in new pixels. This value is only used if mode is set to
constant.- mode: str
Parameter that defines newly created pixels. May take the same values as in
scipy.ndimage.map_coordinates(), i.e.constant,nearest,reflectorwrap.
Methods#
- get(image: Image | np.ndarray, sigma: PropertyLike[float], alpha: PropertyLike[float], ignore_last_dim: PropertyLike[bool], **kwargs) -> Image
Abstract method which performs the ElasticTransformation augmentation.
Methods Summary
get(image, sigma, alpha, ignore_last_dim, ...)Abstract method which performs the ElasticTransformation augmentation.
Methods Documentation