Random Shadows and Highlights: A new data augmentation method for extreme lighting conditions

Osama Mazhar, Jens KoberarXiv 2021

TL;DR

Random Shadows and Highlights (RSH) is a lightweight, parameter-free data augmentation technique designed to bridge the "reality gap" in computer vision. By injecting synthetic, trapezoidal shadows and highlights into training images, RSH forces neural networks to become immune to extreme lighting perturbations, significantly improving generalization and reducing overfitting in both classification and object detection tasks.

Introduction

Deep learning models often achieve "super-human" performance on curated benchmarks, but they are notoriously fragile when deployed in the real world. One major culprit is the variation in environmental lighting. Standard data augmentation techniques—like random cropping, flipping, or basic color jittering—excel at teaching a model about scale and orientation, but they fail to capture the complex, high-contrast occlusions caused by shadows from buildings or intense glare from windows.

When a self-driving car or a robotic gripper encounters a scene with harsh lighting not present in its training set, the model's performance can degrade catastrophically. The authors aim to solve this by creating a more realistic simulation of these "harsh conditions" during the training phase.

Methodology

The core of the paper is Algorithm 1: Random Shadows and Highlights (RSH). Unlike some modern augmentation methods that require separate neural networks to generate data, RSH is a simple, stochastic geometric approach.

  1. Trapezoidal Modeling: The algorithm assumes that real-world shadows (like those from buildings) and highlights (light through doors/windows) often take the form of trapezoids.
  2. Randomized Geometry: For a given image, the algorithm randomly selects four points along the vertical axes to define a trapezoid.
  3. Dual Modification:
    • Shadows: The pixels inside the trapezoid have their brightness reduced by a random factor ($S_f$).
  4. Highlights: The pixels outside the trapezoid have their brightness increased by a random factor ($H_f$).
  5. Integration: This process is applied with a probability $p$ during training. Because it is computationally inexpensive and doesn't require learning new parameters, it can be "plugged and played" into almost any existing vision pipeline.
Examples of Random Shadows and Highlights (RSH) applied to various indoor scenes, demonstrating the synthetic trapezoidal occlusions.

Experimental Results

The authors evaluated RSH across several standard benchmarks, including Image Classification (Tiny-ImageNet, CIFAR-10/100) and Object Detection (PASCAL VOC 2007). The quantitative improvements were substantial across different architectures (EfficientNet-B0 and DETR):

  • Robustness Boost: On Tiny-ImageNet, when testing on images with lighting corruptions, the RSH-trained model achieved a test error of 0.449, compared to the baseline's 0.630.
  • Superiority over Competitors: RSH outperformed Random Gamma Correction (RGC) by approximately 25% in scenarios with extreme lighting perturbations.
  • Object Detection: Using the DETR (DEtection TRansformer) model on PASCAL VOC, RSH improved robustness against lighting corruption by 10.328% compared to the baseline, while maintaining standard accuracy.
Impact of augmentation probability p on training and testing accuracy, highlighting the regularization effect of RSH.

Key Insights

  • The "Robustness-Accuracy" Trade-off: The paper acknowledges a common phenomenon where making a model more robust can slightly decrease its accuracy on "clean" test sets. However, RSH minimizes this trade-off, outperforming other methods like Gamma Correction or "Disk Illumination" by a wide margin when the test data is corrupted by lighting.
  • Fighting Overfitting with TTD: The authors use a metric called Train-Test Difference (TTD). They found that RSH significantly narrows the gap between training and testing error. As shown in the accuracy plots, as the probability $p$ of applying RSH increases, the training accuracy decreases while testing accuracy remains stable or improves, indicating that the "noise" introduced by RSH acts as a powerful regularizer.
  • Parameter Sensitivity: Interestingly, the results showed that a wider range of highlight and shadow intensities actually improved the model's accuracy. The more "extreme" the training conditions, the better the model performed.

Conclusion and Future Work

While RSH is highly effective for general scenes, the paper notes a few areas for expansion. The current model uses trapezoids, which may not capture the complex, organic shadows found in nature (e.g., dappled sunlight). Future work should explore RSH in more specialized domains, such as facial recognition and person re-identification, where lighting consistency is a major hurdle. Additionally, future iterations might look at how randomizing color temperature alongside shadows could further improve robustness.

Summary updated

BibTeX
@misc{mazhar2021random,
  author = {Osama Mazhar and Jens Kober},
  title = {{Random Shadows and Highlights: A new data augmentation method for extreme lighting conditions}},
  year = {2021},
  eprint = {2101.05361},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.05361},
}
Figure