deepblink.augment module

Model utility functions for augmentation.

deepblink.augment.augment_batch_baseline(images: numpy.ndarray, masks: numpy.ndarray, flip_: bool = False, illuminate_: bool = False, gaussian_noise_: bool = False, rotate_: bool = False, translate_: bool = False, cell_size: int = 4) → Tuple[numpy.ndarray, numpy.ndarray][source]

Baseline augmentation function.

Probability of augmentations is determined in the corresponding functions and not in this baseline.

Parameters:
  • images – Batch of input image to be augmented with shape (n, x, y).
  • masks – Batch of corresponding prediction matrix with ground truth values with shape (n, x, y).
  • flip_ – If True, images might be flipped.
  • illuminate_ – If True, images might be altered in illumination.
  • gaussian_noise_ – If True, gaussian noise might be added.
  • rotate_ – If True, images might be rotated.
  • translate_ – If True, images might be translated.
  • cell_size – Size of one cell in the prediction matrix.
deepblink.augment.flip(image: numpy.ndarray, mask: numpy.ndarray) → Tuple[numpy.ndarray, numpy.ndarray][source]

Augment through horizontal/vertical flipping.

deepblink.augment.gaussian_noise(image: numpy.ndarray, mask: numpy.ndarray, mean: int = 0) → Tuple[numpy.ndarray, numpy.ndarray][source]

Augment through the addition of gaussian noise.

Parameters:
  • image – Image to be augmented.
  • mask – Corresponding prediction matrix with ground truth values.
  • mean – Average noise pixel values added. Zero means no net difference occurs.
deepblink.augment.illuminate(image: numpy.ndarray, mask: numpy.ndarray) → Tuple[numpy.ndarray, numpy.ndarray][source]

Augment through changing illumination.

deepblink.augment.rotate(image: numpy.ndarray, mask: numpy.ndarray) → Tuple[numpy.ndarray, numpy.ndarray][source]

Augment through rotation.

deepblink.augment.translate(image: numpy.ndarray, mask: numpy.ndarray, cell_size: int = 4) → Tuple[numpy.ndarray, numpy.ndarray][source]

Augment through translation along all axes.

Parameters:
  • image – Image to be augmented.
  • mask – Corresponding prediction matrix with ground truth values.
  • cell_size – Size of one cell in the prediction matrix.