Augmentation

Functions used to increase and diversify a dataset by duplicating and transforming images. Available transformations are:

  • Identity

  • Transpose

  • Inverse transpose

  • Horizontal flip

  • Vertical flip

  • 90° rotation

  • 180° rotation

  • 270° rotation

Apply a random transformation on a 2D image:

Apply all the possible transformations on a 2D image:

bigfish.stack.augment_2d(image)

Augment an image applying a random operation.

Parameters:
imagenp.ndarray

Image to augment with shape (y, x, channels) or (y, x, channels).

Returns:
image_augmentednp.ndarray

Image augmented with shape (y, x, channels).

bigfish.stack.augment_2d_function(identity=False)

Choose a random operation to augment a 2-d image.

Parameters:
identitybool

Return identity function instead of a random transformation.

Returns:
random_operationcallable

Function to transform a 2-d image.

bigfish.stack.augment_8_times(image)

Apply every transformation to a 2-d image.

Parameters:
imagenp.ndarray

Image to augment with shape (y, x, channels).

Returns:
images_augmentedList[np.ndarray]

List of images augmented with shape (y, x, channels).

bigfish.stack.augment_8_times_reversed(images_augmented)

Apply every transformation back to return the original 2-d image.

Parameters:
images_augmentedList[np.ndarray]

List of images augmented with shape (y, x, channels).

Returns:
images_originalList[np.ndarray]

List of original images with shape (y, x, channels).