baby.augmentation.SmoothedLabelAugmenter

class baby.augmentation.SmoothedLabelAugmenter(sigmafunc, targetgenfunc=<function segoutline_flattening>, **kwargs)

Bases: Augmenter

Methods

__call__(img, lbl_info)

This augmenter needs to be used in combination with a label preprocessing function that returns both images and info.

elastic_deform(img, lbl[, params])

Slight deformation

hflip(img, lbl)

Horizontal flip

hshift(img, lbl[, maxpix])

Shift along width, max of 10px by default

identity(img, lbl)

Do nothing

movestacks(img, lbl)

Translate stacks in img to increase robustness to shifts in focus

noise(img, lbl)

Add gaussian noise to the img (not the lbl)

rotate(img, lbl)

Random rotation

substacks(img, lbl)

Randomly pick Z-sections to match the chosen substack size

vflip(img, lbl)

Vertical flip

vshift(img, lbl[, maxpix])

Shift along height, max of 10px by default

crop

downscale

__init__(sigmafunc, targetgenfunc=<function segoutline_flattening>, **kwargs)

Random data augmentation of img and lbl.

Parameters
xy_outint or pair of ints as a tuple

The intended width and height of the final augmented image.

probsdict of floats in [0, 1]

Specify non-default probabilities for the named augmentations. Augmentations with zero probability are omitted.

p_noopfloat in [0, 1]

Adjusts the probability for no augmentation operation in the default case. If set to 1, then all operations will be omitted by default (i.e., unless a non-zero probability is specified for that operation in probs).

Methods

__init__(sigmafunc[, targetgenfunc])

Random data augmentation of img and lbl.

crop(img, lbl[, xysize])

downscale(img, lbl[, maxpix])

elastic_deform(img, lbl[, params])

Slight deformation

hflip(img, lbl)

Horizontal flip

hshift(img, lbl[, maxpix])

Shift along width, max of 10px by default

identity(img, lbl)

Do nothing

movestacks(img, lbl)

Translate stacks in img to increase robustness to shifts in focus

noise(img, lbl)

Add gaussian noise to the img (not the lbl)

rotate(img, lbl)

Random rotation

substacks(img, lbl)

Randomly pick Z-sections to match the chosen substack size

vflip(img, lbl)

Vertical flip

vshift(img, lbl[, maxpix])

Shift along height, max of 10px by default

elastic_deform(img, lbl, params={})

Slight deformation

Elastic deformation of images as described in Simard, Steinkraus and Platt, “Best Practices for Convolutional Neural Networks applied to Visual Document Analysis”, in Proc. of the International Conference on Document Analysis and Recognition, 2003. Adapted from: https://gist.github.com/chsasank/4d8f68caf01f041a6453e67fb30f8f5a

Example image:

report/figures/augmentations/elastic_deform.*
hflip(img, lbl)

Horizontal flip

Example image:

report/figures/augmentations/hflip.*
hshift(img, lbl, maxpix=None)

Shift along width, max of 10px by default

Only integer shifts are made (i.e., no interpolation)

Example image:

report/figures/augmentations/hshift.*
identity(img, lbl)

Do nothing

Example image:

report/figures/augmentations/identity.*
movestacks(img, lbl)

Translate stacks in img to increase robustness to shifts in focus

Only movements up or down by one stack are made, and the boundary is repeated

noise(img, lbl)

Add gaussian noise to the img (not the lbl)

rotate(img, lbl)

Random rotation

Example image:

report/figures/augmentations/turn.*
substacks(img, lbl)

Randomly pick Z-sections to match the chosen substack size

By default all Z-sections are used. If substacks was specified in the constructor, then Z-sections are randomly chosen to limit to that number of stacks. All subsets are considered except those where Z-sections are separated by more than one omitted Z-slice.

An error will be raised if the image has fewer Z-sections than the number specified in substacks.

Images presented to the augmenter call do not necessarily all need to have the same number of Z-sections; this will result in consistent output if substacks is specified, but will potentially result in inconsistent output in the default case.

vflip(img, lbl)

Vertical flip

Example image:

report/figures/augmentations/vflip.*
vshift(img, lbl, maxpix=None)

Shift along height, max of 10px by default

Only integer shifts are made (i.e., no interpolation)

Example image:

report/figures/augmentations/vshift.*