cerebras.modelzoo.data.vision.classification.mixup#

Mixup and CutMix

This is borrowed from the PyTorch repo: https://github.com/pytorch/vision/blob/main/references/classification/transforms.py

Classes

RandomCutmix

Randomly apply Cutmix to the provided batch and targets. The class implements the data augmentations as described in the paper "CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features". :param num_classes: number of classes used for one-hot encoding. :type num_classes: int :param p: probability of the batch being transformed. Default value is 0.5. :type p: float :param alpha: hyperparameter of the Beta distribution used for cutmix. Default value is 1.0. :type alpha: float :param inplace: boolean to make this transform inplace. Default set to False. :type inplace: bool.

RandomMixup

Randomly apply Mixup to the provided batch and targets. The class implements the data augmentations as described in the paper "mixup: Beyond Empirical Risk Minimization". :param num_classes: number of classes used for one-hot encoding. :type num_classes: int :param p: probability of the batch being transformed. Default value is 0.5. :type p: float :param alpha: hyperparameter of the Beta distribution used for mixup. Default value is 1.0. :type alpha: float :param inplace: boolean to make this transform inplace. Default set to False. :type inplace: bool.