delta.data.data_augmentation#
- delta.data.data_augmentation(images_input, aug_par, order=0, rng=None)[source]#
Create an augmented sample based on data augmentation parameters.
- Parameters
- images_inputlist of 2D numpy arrays
Images to apply augmentation operations to.
- aug_pardict
- Augmentation operations parameters. Accepted key-value pairs:
- illumination_voodoo: bool
Whether to apply the illumination voodoo operation. It simulates a variation in illumination along the Y axis.
- histogram_voodoo: bool
Whether to apply the histogram voodoo operation. It performs an elastic deformation on the image histogram to simulate changes in illumination.
- elastic_deformation: dict
If this key exists, the elastic deformation operation is applied. The parameters are given as key-value pairs. Sigma values are given under the sigma key, deformation points are given under the points key, for example
{"sigma": 25, "points": 5}
. See theelasticdeform
doc for more info.- gaussian_noise: float
Apply gaussian noise to the image. The sigma value of the gaussian noise is uniformly sampled between 0 and +gaussian_noise.
- gaussain_blur: float
Apply gaussian blur to the image. The sigma value is the standard deviation of the kernel in the x and y direction.
- horizontal_flip: bool
Whether to flip the images horizontally. Input images have a 50% chance of being flipped.
- vertical_flip: bool
Whether to flip the images vertically. Input images have a 50% chance of being flipped
- rotations90d: bool
Whether to randomly rotate the images in 90° increments. Each 90° rotation has a 25% chance of happening
- resize: bool
Whether to randomly resize the image on both axes.
- rotation: int or float
Range of random rotation to apply. The angle is uniformly sampled in the range
[-rotation, +rotation]
.- zoom: float
Range of random “zoom” to apply. The image is randomly zoomed by a factor that is sampled from an exponential distribution with a
lambda
of3/zoom
. The random factor is clipped at +zoom.- shiftX: int/float
The range of random shifts to apply along X. A uniformly sampled shift between
[-shiftX, +shiftX]
is applied.- shiftY: int/float
The range of random shifts to apply along Y. A uniformly sampled shift between
[-shiftY, +shiftY]
is applied.
Note that the same operations are applied to all inputs except for the timeshift ones.
- orderint or list/tuple of ints, optional
Interpolation order to use for each image in the input stack. If order is a scalar, the same order is applied to all images. If a list of orders is provided, each image in the stack will have its own operation order. See the
skimage.transform.wrap
doc. Note that the histogram voodoo operation is only applied to images with a non-zero order. The default is 0.- rngnpr.Generator | None
Numpy random number generator to use for data augmentation. If None, one will be created from entropy with npr.default_rng(). The default is None.
- Returns
- outputlist of 2D numpy arrays
Augmented images array.