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:
Augmentation
Transform images by moving pixels locally around 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.
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#
- alphanumber
Strength of the distortion field. Common values are in the range (10, 100)
- sigmanumber
Standard deviation of the gaussian kernel used to smooth the distortion fields. Common values are in the range (1, 10)
- ignore_last_dimbool
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.
- orderint
Interpolation order to use. Takes integers from 0 to 5
0
:Nearest-neighbor
1
:Bi-linear
(default)2
:Bi-quadratic
(not recommended by skimage)3
:Bi-cubic
4
:Bi-quartic
5
:Bi-quintic
- cvalnumber
The constant intensity value used to fill in new pixels. This value is only used if mode is set to
constant
.- modestr
Parameter that defines newly created pixels. May take the same values as in
scipy.ndimage.map_coordinates()
, i.e.constant
,nearest
,reflect
orwrap
.
Methods Summary
get
(image, sigma, alpha, ignore_last_dim, ...)Transform an image [abstract method].
Methods Documentation
- get(image, sigma, alpha, ignore_last_dim, **kwargs)#
Transform an image [abstract method].
Abstract method that defines how the feature transforms the input. The current value of all properties will be passed as keyword arguments.
Parameters#
- image‘Image’ or List[‘Image’]
The Image or list of images to transform.
- **kwargsDict[str, Any]
The current value of all properties in properties as well as any global arguments.
Returns#
- ‘Image’ or List[‘Image’]
The transformed image or list of images.
Raises#
- NotImplementedError
Must be overridden by subclasses.