Abstract
We introduce InstaAug, a method for automatically learning input-specific augmentations from data. Previous methods for learning augmentations have typically assumed independence between the original input and the transformation applied to that input. This can be highly restrictive, as the invariances we hope our augmentation will capture are themselves often highly input dependent. InstaAug instead introduces a learnable invariance module that maps from inputs to tailored transformation parameters, allowing local invariances to be captured. This can be simultaneously trained alongside the downstream model in a fully end-to-end manner, or separately learned for a pre-trained model. We empirically demonstrate that InstaAug learns meaningful input-dependent augmentations for a wide range of transformation classes, which in turn provides better performance on both supervised and self-supervised tasks.
1. Introduction
Data augmentation is a cornerstone of modern deep learning, acting as a powerful regularizer by teaching models which transformations—such as rotations, crops, or color shifts—should not alter an object's semantic label. However, standard augmentation strategies typically employ global policies, applying the same distribution of transformations to every image in a dataset regardless of its specific content.
This "one-size-fits-all" approach is fundamentally restrictive because invariances are often instance-specific. As illustrated in Figure 1, a green leaf can be shifted to yellow without changing its identity, but shifting a yellow lemon to green transforms it into a different class (a lime). Similarly, in spatial domains, a random crop on a texture-heavy image like grass is likely to preserve the label, whereas a random crop on an image containing a single cow might miss the subject entirely, effectively changing the label to "grass."
InstaAug addresses this by learning to apply transformations based on the actual content of the input image, bridging the gap between global policies and local image characteristics.
2. Methodology: The InstaAug Framework
The core of our approach is the invariance module ($\phi$). Unlike traditional methods that sample a transformation $\tau$ from a fixed distribution, InstaAug uses this module to predict parameters for a transformation distribution $p(\tau; \phi(x))$ tailored to the input image $x$.
2.1 Training Objective
The system is trained using a joint loss function that balances classification accuracy with transformation diversity: $$\min_{f, \phi} \mathbb{E} [L(f(\tau(x)), y) - \lambda H[p(\tau; \phi(x))]]$$ Here, $L$ is the prediction error of the downstream model $f$, and $H$ represents the entropy of the transformation distribution. The entropy term is critical: it incentivizes the module to discover the widest possible range of transformations that do not degrade the classifier's performance. To maintain stability, we employ Dynamic Entropy Weighting, automatically tuning $\lambda$ to keep the transformations within a manageable range for the classifier.
2.2 Location-Related Parameterization (LRP)
Learning spatial augmentations like cropping presents a unique challenge, as outputting raw coordinates is often unstable for neural networks. We introduce LRP, which leverages the receptive fields of a convolutional neural network (CNN) to map spatial locations to crop "logits." This architectural choice significantly stabilizes the learning of sensible, object-centric crops.
3. Experimental Evaluation
We evaluated InstaAug across supervised, self-supervised, and test-time augmentation (TTA) tasks using several benchmarks:
- Synthetic Rotated 2D Images: Using Mario and Iggy characters to test rotation invariance.
- Tiny-ImageNet & ImageNet: Standard classification benchmarks for cropping and general performance.
- RawFooT: A texture dataset for testing color jittering and out-of-distribution (OOD) generalization.
3.1 Supervised and Contrastive Learning
On Tiny-ImageNet, InstaAug achieved a top-1 accuracy of 66.02%, significantly outperforming heavily tuned random cropping (64.49%) and automated methods like Augerino. In a self-supervised setting using the SimCLR framework, InstaAug reached 55.05% linear probe accuracy, compared to 51.63% for standard random cropping.
3.2 Out-of-Distribution Generalization
Using the RawFooT dataset—which contains food categories under 46 different lighting conditions—we tested InstaAug's ability to handle distribution shifts. When trained on a single lighting condition, InstaAug demonstrated superior generalization to unseen, "hard" lighting environments compared to global augmentation baselines, effectively learning which color shifts were identity-preserving.
3.3 Test-Time Augmentation (TTA)
TTA typically involves averaging predictions over multiple random crops, which can hurt performance if crops miss the primary subject. Because InstaAug learns to produce "sensible" crops that focus on relevant features, its application during test-time consistently improved accuracy, even when applied to fixed, pre-trained models like XCiT or ResNet.
4. Conclusion and Future Work
InstaAug demonstrates that moving beyond global augmentation policies to instance-specific transformations can yield significant gains in model robustness and accuracy. By maximizing transformation entropy, the model "discovers" the local invariances inherent in each image. The invariance module itself is lightweight (e.g., a slimmed-down ResNet-18), adding minimal computational overhead.
Future work includes extending the transformation scope to non-geometric augmentations, such as GAN-based style transfers, and further refining the automated tuning of entropy bounds to reduce hyperparameter sensitivity.
Summary updated