augmix_image#

composer.functional.augmix_image(img, severity=3, depth=-1, width=3, alpha=1.0, 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]#

Applies the AugMix (Hendrycks et al, 2020) data augmentation.

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

Example

import composer.functional as cf

from composer.algorithms.utils import augmentation_sets

augmixed_image = cf.augmix_image(
    img=image,
    severity=3,
    width=3,
    depth=-1,
    alpha=1.0,
    augmentation_set=augmentation_sets["all"]
)
Parameters
  • img (Image | Tensor) โ€“ Image or batch of images to be AugMixโ€™d.

  • severity (int, optional) โ€“ See AugMix.

  • depth (int, optional) โ€“ See AugMix.

  • width (int, optional) โ€“ See AugMix.

  • alpha (float, optional) โ€“ See AugMix.

  • augmentation_set (str, optional) โ€“ See AugMix.

Returns

PIL.Image โ€“ AugMixโ€™d image.