Geometric Transformations

Resize

class augmax.Resize(width: int, height: int | None = None)[source]
../_images/Resize_0.png ../_images/Resize_1.png ../_images/Resize_2.png

Augmentation Examples for Resize(100, 100)

Crop

class augmax.Crop(x0, y0, w, h)[source]

Crop the image at the specified x0 and y0 with given width and height

Parameters:
  • x0 (float) – x-coordinate of the crop’s top-left corner

  • y0 (float) – y-coordinate of the crop’s top-left corner

  • w (float) – width of the crop

  • h (float) – height of the crop

../_images/Crop_0.png ../_images/Crop_1.png ../_images/Crop_2.png

Augmentation Examples for Crop(0, 0, 100, 100)

CenterCrop

class augmax.CenterCrop(width: int, height: int | None = None)[source]

Extracts a central crop from the image with given width and height.

Parameters:
  • w (float) – width of the crop

  • h (float) – height of the crop

../_images/CenterCrop_0.png ../_images/CenterCrop_1.png ../_images/CenterCrop_2.png

Augmentation Examples for CenterCrop(100, 100)

RandomCrop

class augmax.RandomCrop(width: int, height: int | None = None)[source]

Extracts a random crop from the image with given width and height.

Parameters:
  • w (float) – width of the crop

  • h (float) – height of the crop

../_images/RandomCrop_0.png ../_images/RandomCrop_1.png ../_images/RandomCrop_2.png

Augmentation Examples for RandomCrop(100, 100)

RandomSizedCrop

class augmax.RandomSizedCrop(width: int, height: int | None = None, zoom_range: Tuple[float, float] = (0.5, 2.0), prevent_underzoom: bool = True)[source]

Extracts a randomly sized crop from the image and rescales it to the given width and height.

Parameters:
  • w (float) – width of the crop

  • h (float) – height of the crop

  • zoom_range (float, float) – minimum and maximum zoom level for the transformation

  • prevent_underzoom (bool) – whether to prevent zooming beyond the image size

../_images/RandomSizedCrop_0.png ../_images/RandomSizedCrop_1.png ../_images/RandomSizedCrop_2.png

Augmentation Examples for RandomSizedCrop(100, 100)

HorizontalFlip

class augmax.HorizontalFlip(p: float = 0.5)[source]

Randomly flips an image horizontally.

Parameters:

p (float) – Probability of applying the transformation

../_images/HorizontalFlip_0.png ../_images/HorizontalFlip_1.png ../_images/HorizontalFlip_2.png

Augmentation Examples for HorizontalFlip(p=1.0)

VerticalFlip

class augmax.VerticalFlip(p: float = 0.5)[source]

Randomly flips an image vertically.

Parameters:

p (float) – Probability of applying the transformation

../_images/VerticalFlip_0.png ../_images/VerticalFlip_1.png ../_images/VerticalFlip_2.png

Augmentation Examples for VerticalFlip(p=1.0)

Rotate90

class augmax.Rotate90[source]

Randomly rotates the image by a multiple of 90 degrees.

../_images/Rotate90_0.png ../_images/Rotate90_1.png ../_images/Rotate90_2.png

Augmentation Examples for Rotate90()

Rotate

class augmax.Rotate(angle_range: Tuple[float, float] | float = (-30, 30), p: float = 1.0)[source]

Rotates the image by a random arbitrary angle.

Parameters:
  • angle_range (float, float) – Tuple of (min_angle, max_angle) to sample from. If only a single number is given, angles will be sampled from (-angle_range, angle_range).

  • p (float) – Probability of applying the transformation

../_images/Rotate_0.png ../_images/Rotate_1.png ../_images/Rotate_2.png

Augmentation Examples for Rotate(p=1.0)

Warp

class augmax.Warp(strength: int = 5, coarseness: int = 32)[source]

Warp an image (similar to ElasticTransform).

Parameters:
  • strength (float) – How strong the transformation is, corresponds to the standard deviation of deformation values.

  • coarseness (float) – Size of the initial deformation grid cells. Lower values lead to a more noisy deformation.

../_images/Warp_0.png ../_images/Warp_1.png ../_images/Warp_2.png

Augmentation Examples for Warp()