Module delta.extensions.augmentations
Various helpful augmentation functions.
These are intended to be included in train: augmentations in a yaml file.
See the delta.config documentation for details.
Functions
def random_brightness(probability=0.5, min_factor=0.5, max_factor=1.5)-
Apply a random brightness adjustment.
Parameters
probability:float- Probability to apply the transform.
min_factor:floatmax_factor:float- Brightness will be chosen uniformly at random from [min_factor, max_factor].
Returns
Augmentation function for the specified transform.
def random_flip_left_right(probability=0.5)-
Flip an image left to right.
Parameters
probability:float- Probability to apply the flip.
Returns
Augmentation function for the specified transform.
def random_flip_up_down(probability=0.5)-
Flip an image vertically.
Parameters
probability:float- Probability to apply the flip.
Returns
Augmentation function for the specified transform.
def random_rotate(probability=0.5, max_angle=5.0)-
Apply a random rotation.
Parameters
probability:float- Probability to apply a rotation.
max_angle:float- In radians. If applied, the image will be rotated by a random angle in the range [-max_angle, max_angle].
Returns
Augmentation function for the specified transform.
def random_translate(probability=0.5, max_pixels=7)-
Apply a random translation.
Parameters
probability:float- Probability to apply the transform.
max_pixels:int- If applied, the image will be rotated by a random number of pixels in the range [-max_pixels, max_pixels] in both the x and y directions.
Returns
Augmentation function for the specified transform.