image_generator module

image_generator.apply_default_transformations(X)[source]
image_generator.deepaugment_image_generator(X, y, policy, batch_size=64, augment_chance=0.5)[source]

Yields batch of images after applying random augmentations from the policy

Each image is augmented by 50% chance. If augmented, one of the augment-chain in the policy is applied. Which augment-chain to apply is chosen randomly.

Args:
X (numpy.array): labels (numpy.array): policy (list): list of dictionaries

Returns:

image_generator.random_flip(x)[source]

Flip the input x horizontally with 50% probability.

image_generator.test_deepaugment_image_generator()[source]
image_generator.zero_pad_and_crop(img, amount=4)[source]

Zero pad by amount zero pixels on each side then take a random crop. Args:

img: numpy image that will be zero padded and cropped. amount: amount of zeros to pad img with horizontally and verically.
Returns:
The cropped zero padded img. The returned numpy array will be of the same shape as img.