🐠

【ML Method】RandAugment Explained

2024/09/02に公開

1. What is the RandAugmnet

RandAugment is an automated data augmentation method. There is also AutoAugment as a traditional method.

2. More deeper

In RandAugment, a set of predefined image transformations (e.g., rotation, shear, translation, contrast adjustment) are available. During training, a fixed number of these transformations are randomly selected and applied to each image in the training dataset.

Transformations applied include identity transformation, autoContrast, equalize, rotation, solarixation, colorjittering, posterizing, changing contrast, changing brightness, changing sharpness, shear-x, shear-y, translate-x, translate-y.

3. Hyperparameters

The search space for data augmentation has 2 interpretable hyperparameters N and M.

・N determines the number of transformations to apply to each image.
M controls the magnitude (or severity) of the transformations. Higher values of M result in stronger augmentations.

4. Advantages

Unlike other methods that may require different augmentation policies for different datasets, RandAugment is designed to work well across various datasets(whole small to big various datasets) with minimal tuning(hyperparams). This makes it a versatile and easy-to-use augmentation technique.

5. Example Usage

from torchvision.transforms import RandAugment

# Example of applying RandAugment to an image
transform = RandAugment(num_ops=N, magnitude=M)
augmented_image = transform(original_image)

6. Summary

RandAugment is also used at the top solution of Kaggle, it works well many situation and easy-to-use, so let's try to use it.

Reference

[1] PapersWithCode, RandAugment

Discussion