Data Augmentation Through Random Style Replacement

Qikai Yang, Cheng Ji, Huaiying Luo, Panfeng Li, Zhicheng DingarXiv 2025 · DOI

Abstract

Deep learning models often struggle with limited labeled data, particularly in specialized domains like medical imaging. While traditional data augmentation (DA) techniques like flipping or cropping help, they frequently fail to account for complex environmental style variations. This paper introduces Random Style Replacement (RSR), a novel augmentation strategy that combines the structural benefits of random erasing with the texture diversity of style transfer. By replacing specific image subregions with stylized versions, RSR encourages models to prioritize global structure over local texture, resulting in improved accuracy and faster convergence on benchmarks like STL-10.

Introduction

The performance of deep neural networks is heavily dependent on the volume and variety of training data. In scenarios where data acquisition is costly or restricted, data augmentation serves as a critical tool for expanding the effective dataset size. However, standard geometric transformations do not address the "texture bias" inherent in many convolutional neural networks (CNNs), where models over-rely on local patterns rather than object shapes.

Previous attempts to solve this include Style Augmentation, which applies global style transfers, and Random Erasing, which masks image regions to simulate occlusions. While effective, global style transfer can be computationally expensive and may overly distort the image, while random erasing removes potentially useful semantic information.

Methods

Random Style Replacement (RSR) addresses these limitations by selectively "patching" images with stylized content. The process involves two primary stages:

  1. Efficient Style Transfer: To maintain training efficiency, the method utilizes a parameter-free style transfer approach. This technique applies random textures and color distributions to the input image on the fly, avoiding the need for heavy generative models during the training loop.
  2. Strategic Patching: The algorithm replaces portions of the original image with the generated stylized version. The researchers explored two primary modes of replacement: Subregion Replacement (swapping a random rectangular area) and Pixel-level Replacement (randomly selecting individual pixels).
Comparison of data augmentation techniques: (a) Original, (b) Random Erasing, (c) Full Style Transfer, (d) Subregion Style Replacement, and (e) Pixel-level Style Replacement.

The study found that Subregion Replacement is superior to pixel-level replacement. By maintaining local structural integrity within the stylized patch, the model is forced to learn that the underlying shape remains consistent despite drastic changes in texture (e.g., a cat's ear rendered in a painterly style).

Experimental Evaluation

The proposed method was evaluated using the STL-10 dataset, a benchmark specifically designed for testing algorithms on limited labeled data (5,000 training images). The higher resolution (96x96) and complex backgrounds of STL-10 provide a more rigorous test than simpler datasets like CIFAR-10.

Key Results

Testing across the ResNet architecture family (ResNet18 through ResNet152) yielded several significant findings:

  • Accuracy: RSR achieved a peak classification accuracy of 81.6% on STL-10, outperforming standard augmentation and previous style-based benchmarks.
  • Convergence: The method demonstrated significantly faster convergence. RSR reached high performance levels in just 100 epochs, whereas previous style-transfer-based methods required up to 100,000 epochs to achieve comparable results.
  • Robustness: The "Subregion" approach provided the most stable training curves and the lowest test loss, suggesting that "structured noise" is more effective for regularization than simple information deletion.

Discussion and Future Work

RSR effectively bridges the gap between texture-based and occlusion-based augmentation. By preserving semantic information (edges and shapes) within the stylized patches, it prevents the model from simply ignoring the augmented regions, as might happen with black-box erasing.

Future research directions include evaluating RSR's efficacy in object detection and semantic segmentation, as well as testing scalability on massive datasets like ImageNet. Additionally, the authors suggest using Large Language Models (LLMs) to intelligently select which regions to stylize—for instance, stylizing only backgrounds to force the model to focus more intensely on foreground objects.

Conclusion

Random Style Replacement offers a computationally efficient and highly effective means of improving CNN robustness. By forcing models to look past local textures to the global structure of objects, RSR provides a powerful tool for training high-performing models on small, complex datasets.

Summary updated

BibTeX
@misc{yang2025data,
  author = {Qikai Yang and Cheng Ji and Huaiying Luo and Panfeng Li and Zhicheng Ding},
  title = {{Data Augmentation Through Random Style Replacement}},
  year = {2025},
  eprint = {2504.10563},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.10563},
}
Figure