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. UseRandAugmentTransform
to useRandAugment
as part of atorchvision.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
img (Image | Tensor) โ Image or batch of images to be RandAugmented.
severity (int, optional) โ See
RandAugment
.depth (int, optional) โ See
RandAugment
.augmentation_set (str, optional) โ See
RandAugment
.
- Returns
PIL.Image โ RandAugmented image.