Random Erasing Data Augmentation

Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, Yi Yang

Abstract

Random Erasing is a simple yet effective data augmentation strategy designed to improve the robustness of convolutional neural networks (CNNs). By randomly masking rectangular regions of an image with random values during training, the technique forces models to recognize objects from partial information. This approach significantly enhances model performance across various computer vision tasks, including image classification, object detection, and person re-identification, by mitigating the risks of overfitting and improving invariance to occlusion.

Introduction

Deep learning models, particularly CNNs, often struggle with overfitting when training data lacks sufficient diversity. A critical challenge in real-world deployment is occlusion, where objects are partially blocked by other entities, cut off by camera frames, or obscured by environmental factors. Standard datasets frequently lack enough occluded examples, leading models to rely on a limited set of highly discriminative features (e.g., a car's headlight) for identification. If these specific features are hidden during testing, the model fails.

Example of Random Erasing applied to an image of a car using random noise filling.

While adversarial networks can generate "hard" occluded examples, they are computationally expensive and complex to implement. Random Erasing provides a "parameter-free" and lightweight alternative that bakes occlusion invariance directly into the training process without requiring additional network components.

Methodology

The core of Random Erasing is an elegantly simple algorithm applied to images within a mini-batch during the training phase. For each image, the process follows three main steps:

  1. Decision: A probability $p$ (typically 0.5) determines whether an image will undergo erasing.
  2. Region Selection: If selected, the algorithm randomly chooses a rectangular region $I_e$. The area is determined by a range $[s_l, s_h]$ relative to the total image area, and the aspect ratio is sampled from a range $[r_1, r_2]$.
  3. Filling: Pixels within the rectangle are replaced. While the authors tested mean values and constant colors, filling with random noise (RE-R) generally performed best as it effectively simulates "block noise."

Task-Specific Variations

To maximize effectiveness across different vision tasks, the authors introduced specialized erasing schemes:

  • Image-aware Erasing: The standard approach where a region is erased anywhere in the image.
  • Object-aware Erasing (ORE): Specifically for object detection, regions are erased within the bounding boxes of detected objects. This ensures the network learns to handle occlusions of the targets themselves rather than just the background.
  • Person Re-identification: Standard image-level erasing is used to simulate common occlusions like poles or other pedestrians in centered, cropped boxes.
Comparison of Image-aware, Object-aware, and Image-and-Object-aware Random Erasing strategies.

Key Insights

Random Erasing acts as a spatial version of Dropout. While standard Dropout zeroes out individual neurons, Random Erasing "drops" continuous spatial blocks, which more accurately represents physical information loss. This forces the CNN to learn a more distributed, holistic representation of an object's structure rather than becoming overly dependent on specific local features. Notably, Random Erasing is complementary to random cropping; while cropping alters boundaries and scale, erasing modifies internal content, and using both together yields superior results.

Experimental Results

The approach was validated across several standard benchmarks:

  • Image Classification: On CIFAR-10, Random Erasing reduced the error rate of a Wide ResNet (WRN-28-10) from 3.80% to 3.08%. It also provided a consistent ~0.5% boost in Top-1 accuracy on ImageNet.
  • Object Detection: Using the "Image and Object-aware" (I+ORE) scheme on PASCAL VOC 2007, the mean Average Precision (mAP) increased from 69.1% to 71.5%.
  • Person Re-identification: On the Market-1501 dataset, Rank-1 accuracy improved from 83.14% to 85.24% using a ResNet-50 baseline.

Robustness tests confirmed that models trained with Random Erasing maintain significantly higher accuracy as synthetic occlusion levels increase compared to baseline models.

Conclusion

Random Erasing is a powerful, easy-to-implement tool for enhancing CNN robustness. Its simplicity—requiring only a few lines of code and zero extra parameters—makes it a practical addition to any deep learning pipeline. Future work may explore more complex occlusion shapes, such as polygons, or the application of the technique to specialized domains like medical imaging and face recognition.

Summary updated

BibTeX
@inproceedings{zhong2020random,
  author = {Zhun Zhong and Liang Zheng and Guoliang Kang and Shaozi Li and Yi Yang},
  title = {{Random Erasing Data Augmentation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i07.7000},
}
Figure