Skip to content

Transforms (imgaug.transforms)

IAAAdditiveGaussianNoise

Add gaussian noise to the input image.

Parameters:

Name Type Description Default
loc int

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

required
scale [float, float]

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

required
p float

probability of applying the transform. Default: 0.5.

required

Targets

image

IAAAffine

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 Default
p float

probability of applying the transform. Default: 0.5.

required

Targets

image, mask

IAAEmboss

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

Parameters:

Name Type Description Default
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).

required
strength [float, float]

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

required
p float

probability of applying the transform. Default: 0.5.

required

Targets

image

IAAPerspective

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 Default
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).

required
p float

probability of applying the transform. Default: 0.5.

required

Targets

image, mask

IAAPiecewiseAffine

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 Default
scale [float, float]

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

required
nb_rows int

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

required
nb_cols int

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

required
p float

probability of applying the transform. Default: 0.5.

required

Targets

image, mask

IAASharpen

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

Parameters:

Name Type Description Default
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).

required
lightness [float, float]

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

required
p float

probability of applying the transform. Default: 0.5.

required

Targets

image

IAASuperpixels

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 Default
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.

required
n_segments int

target number of superpixels to generate. Default: 100.

required
p float

probability of applying the transform. Default: 0.5.

required

Targets

image