Skip to content

Transforms (imgaug.transforms)

class albumentations.imgaug.transforms.IAAAdditiveGaussianNoise (loc=0, scale=(2.5500000000000003, 12.75), per_channel=False, always_apply=False, p=0.5) [view source on GitHub]

Add gaussian noise to the input image.

Parameters:

Name Type Description
loc int

mean of the normal distribution that generates the noise. Default: 0.

scale [float, float]

standard deviation of the normal distribution that generates the noise. Default: (0.01 * 255, 0.05 * 255).

p float

probability of applying the transform. Default: 0.5.

Targets: image

class albumentations.imgaug.transforms.IAAAffine (scale=1.0, translate_percent=None, translate_px=None, rotate=0.0, shear=0.0, order=1, cval=0, mode='reflect', always_apply=False, p=0.5) [view source on GitHub]

Place a regular grid of points on the input and randomly move the neighbourhood of these point around via affine transformations.

Note: This class introduce interpolation artifacts to mask if it has values other than {0;1}

Parameters:

Name Type Description
p float

probability of applying the transform. Default: 0.5.

Targets: image, mask

class albumentations.imgaug.transforms.IAAEmboss (alpha=(0.2, 0.5), strength=(0.2, 0.7), always_apply=False, p=0.5) [view source on GitHub]

Emboss the input image and overlays the result with the original image.

Parameters:

Name Type Description
alpha [float, float]

range to choose the visibility of the embossed image. At 0, only the original image is visible,at 1.0 only its embossed version is visible. Default: (0.2, 0.5).

strength [float, float]

strength range of the embossing. Default: (0.2, 0.7).

p float

probability of applying the transform. Default: 0.5.

Targets: image

class albumentations.imgaug.transforms.IAAPerspective (scale=(0.05, 0.1), keep_size=True, always_apply=False, p=0.5) [view source on GitHub]

Perform a random four point perspective transform of the input.

Note: This class introduce interpolation artifacts to mask if it has values other than {0;1}

Parameters:

Name Type Description
scale [float, float]

standard deviation of the normal distributions. These are used to sample the random distances of the subimage's corners from the full image's corners. Default: (0.05, 0.1).

p float

probability of applying the transform. Default: 0.5.

Targets: image, mask

class albumentations.imgaug.transforms.IAAPiecewiseAffine (scale=(0.03, 0.05), nb_rows=4, nb_cols=4, order=1, cval=0, mode='constant', always_apply=False, p=0.5) [view source on GitHub]

Place a regular grid of points on the input and randomly move the neighbourhood of these point around via affine transformations.

Note: This class introduce interpolation artifacts to mask if it has values other than {0;1}

Parameters:

Name Type Description
scale [float, float]

factor range that determines how far each point is moved. Default: (0.03, 0.05).

nb_rows int

number of rows of points that the regular grid should have. Default: 4.

nb_cols int

number of columns of points that the regular grid should have. Default: 4.

p float

probability of applying the transform. Default: 0.5.

Targets: image, mask

class albumentations.imgaug.transforms.IAASharpen (alpha=(0.2, 0.5), lightness=(0.5, 1.0), always_apply=False, p=0.5) [view source on GitHub]

Sharpen the input image and overlays the result with the original image.

Parameters:

Name Type Description
alpha [float, float]

range to choose the visibility of the sharpened image. At 0, only the original image is visible, at 1.0 only its sharpened version is visible. Default: (0.2, 0.5).

lightness [float, float]

range to choose the lightness of the sharpened image. Default: (0.5, 1.0).

p float

probability of applying the transform. Default: 0.5.

Targets: image

class albumentations.imgaug.transforms.IAASuperpixels (p_replace=0.1, n_segments=100, always_apply=False, p=0.5) [view source on GitHub]

Completely or partially transform the input image to its superpixel representation. Uses skimage's version of the SLIC algorithm. May be slow.

Parameters:

Name Type Description
p_replace float

defines the probability of any superpixel area being replaced by the superpixel, i.e. by the average pixel color within its area. Default: 0.1.

n_segments int

target number of superpixels to generate. Default: 100.

p float

probability of applying the transform. Default: 0.5.

Targets: image