randaugment_image#

composer.functional.randaugment_image(img, severity=9, depth=2, augmentation_set=[<function autocontrast>, <function equalize>, <function posterize>, <function rotate>, <function solarize>, <function shear_x>, <function shear_y>, <function translate_x>, <function translate_y>, <function color>, <function contrast>, <function brightness>, <function sharpness>])[source]#

Randomly applies a sequence of image data augmentations to an image or batch of images.

This technique is adapted from Cubuk et al, 2019).

See RandAugment or the Method Card for details. This function only acts on a single image (or batch of images) per call and is unlikely to be used in a training loop. Use RandAugmentTransform to use RandAugment as part of a torchvision.datasets.VisionDataset transform.

Example

import composer.functional as cf

from composer.algorithms.utils import augmentation_sets

randaugmented_image = cf.randaugment_image(
    img=image,
    severity=9,
    depth=2,
    augmentation_set=augmentation_sets["all"]
)
Parameters
Returns

PIL.Image โ€“ RandAugmented image.