Random Erase

Learn to perform data augmentation with the Random Erase method.

We'll cover the following

Random Erase is a special image augmentation technique that works by: Selecting a region from an image randomly. Removing the pixels from the region. Filling the region with random pixels. It generates training images with various levels of occlusion. As a result, it makes our image classification models robust to occlusions, which improves performance and reduces overfitting.

The RandomErasing class

The PyTorch Image Model implements this technique under the RandomErasing class. We can easily test it with the timm.data.random_erasing module.

Let’s look at the following interactive playground:

Get hands-on with 1400+ tech skills courses.