ParticleDetection.modelling.augmentations

Collection of custom image augmentations extending the Detectron2 augmentation pool. These augmentations are intended to be used during the training process of a neural network using the Detectron2 framework.

Author: Adrian Niemann (adrian.niemann@ovgu.de)

Date: 31.10.2022

class GaussianBlur(*args: Any, **kwargs: Any)[source]

Bases: Transform

Applies a Gaussian blur using the imgaug library.

Parameters:

sigmas (Tuple[float, float]) –

Mean and variance of the constructed Gaussian kernel.

Default is (0.0, 2.0).

apply_coords(coords: ndarray)[source]
apply_image(img: ndarray) ndarray[source]
inverse() detectron2.data.transforms.Transform[source]
class GaussianBlurAugmentation(*args: Any, **kwargs: Any)[source]

Bases: Augmentation

Defines a strategy to blur images with a Gaussian blur operation.

Parameters:

sigmas (Tuple[float, float]) –

Mean and variance of the constructed Gaussian kernel.

Default is (0.0, 2.0).

get_transform(*args) detectron2.data.transforms.Transform[source]
class Multiply(*args: Any, **kwargs: Any)[source]

Bases: Transform

Applies a multipliction of each pixel with a certain value.

Parameters:

mul (Tuple[float, float]) – The value with which to multiply the pixel values in each image. A value from the interval will be sampled per image and used for all pixels. Default is (0.8, 1.2)

apply_coords(coords: ndarray)[source]
apply_image(img: ndarray)[source]
inverse() detectron2.data.transforms.Transform[source]
class MultiplyAugmentation(*args: Any, **kwargs: Any)[source]

Bases: Augmentation

Defines an augmentation strategy to multiply each pixel with a certain value.

Parameters:

mul (Tuple[float, float]) –

The value with which to multiply the pixel values in each image. A value from the interval will be sampled per image and used for all pixels.

Default is (0.8, 1.2)

get_transform(*args) detectron2.data.transforms.Transform[source]
class Sharpen(*args: Any, **kwargs: Any)[source]

Bases: Transform

Applies a sharpening transformation using the imgaug library.

Parameters:
  • alpha (Tuple[float, float]) –

    Blending factor of the sharpened image. A random value will be sampled from the interval for every image.

    Default is (0.0, 0.2).

  • lightness (Tuple[float, float]) –

    Lightness/brightness of the sharped image. A random value will be sampled from the interval per image.

    Default is (0.8, 1.2).

apply_coords(coords: ndarray)[source]
apply_image(img: ndarray) ndarray[source]
inverse() detectron2.data.transforms.Transform[source]
class SharpenAugmentation(*args: Any, **kwargs: Any)[source]

Bases: Augmentation

Defines an augmentation strategy to sharpen images.

Parameters:
  • alpha (Tuple[float, float]) –

    Blending factor of the sharpened image. A random value will be sampled from the interval for every image.

    Default is (0.0, 0.2).

  • lightness (Tuple[float, float]) –

    Lightness/brightness of the sharped image. A random value will be sampled from the interval per image.

    Default is (0.8, 1.2).

get_transform(*args) detectron2.data.transforms.Transform[source]
class SomeOf(*args: Any, **kwargs: Any)[source]

Bases: AugmentationList

A list of Augmentations only some will be used of.

Randomly chooses Augmentation from the given list within the range of possible numbers of Augmentation ‘s.

Parameters:
  • augments (List[Augmentation]) – List of possible augmentations to choose from.

  • lower (int) – Minimum amount of augmentations to choose.

  • upper (int) – Maximum amount of augmentations to choose.

get_transform(*args) detectron2.data.transforms.Transform[source]