Affine transformation estimation improves visual self-supervised learning

David Torpey, Richard KleinarXiv 2024 · DOI

Abstract

Modern visual self-supervised learning (SSL) primarily leverages the principle of invariance, training models to produce identical representations for different augmented views of the same image. While effective, this approach often discards valuable geometric information. This paper introduces a "plug-and-play" Affine Module designed to imbue SSL models with geometric equivariance. By tasking the model with estimating the parameters of an affine transformation between views, we demonstrate significant improvements in representation quality and training efficiency. Our method achieves a relative performance boost of up to 16% when integrated into standard frameworks like BYOL, SimCLR, and Barlow Twins.

Introduction

Self-supervised learning has revolutionized computer vision by enabling models to learn from vast amounts of unlabeled data. The dominant paradigm, contrastive learning, focuses on invariance: ensuring that a model's output remains unchanged despite transformations like cropping, flipping, or color jittering. However, a truly robust visual system should also be equivariant—it should understand how a specific transformation changes an object's appearance.

We address this by proposing a secondary task: predicting the geometric "path" between two views. By adding a simple affine transformation estimation head to existing SSL architectures, we force the encoder to retain geometric sensitivity in its latent space.

Methodology

The proposed Affine Module can be integrated into any multi-view SSL algorithm. The workflow consists of two parallel paths:

  1. Invariance Path: Following standard SSL procedures, an image $x$ is transformed into two random views ($x_1, x_2$). These are passed through an encoder $f$ and a projection head $g$ to calculate a standard SSL loss ($l_{ssl}$), such as contrastive or redundancy-reduction loss.
  2. Equivariance Path: One view ($x_1$) undergoes an additional, known affine transformation $w_\phi$ (encompassing rotation, translation, scaling, and shearing). The model then attempts to estimate the 6 parameters of $\phi$ using the representations $h_1$ and $h_1^a$.
The proposed Affine Module (highlighted in red) integrated into a standard SSL pipeline.

The key to this estimation is the "transition vector," created by taking the vector difference ($h_1 - h_1^a$) between the original and transformed representations. A small Multi-Layer Perceptron (MLP) then predicts the affine parameters from this difference. The final training objective is the sum of the standard SSL loss and the Mean Squared Error (MSE) of the affine parameter estimation.

Experiments and Results

We pretrained models on Tiny ImageNet and evaluated the learned representations via linear probing on CIFAR10, CIFAR100, and Caltech101. The inclusion of the Affine Module yielded consistent improvements across all tested frameworks:

  • BYOL: Experienced the most significant gains, with a relative performance increase of over 16% on average across downstream datasets.
  • SimCLR & Barlow Twins: Both showed relative improvements of approximately 6%.
  • Efficiency: The geometric task acts as a guide that helps the model find useful features earlier in the training process, leading to faster convergence.
Linear evaluation accuracy over training epochs for the BYOL framework with and without the Affine Module.

Discussion

Several design choices were critical to the module's success. First, using the vector difference was found to be superior to concatenation, as it more naturally represents the "direction" and "magnitude" of the transformation in latent space. Second, predicting the transformation from the encoder's output ($h$) rather than the projection head ($z$) ensures that the core features used for downstream tasks are imbued with geometric knowledge.

While the module is highly effective, some limitations remain. For instance, the dramatic improvement in BYOL compared to other methods suggests a unique synergy between its architecture and the affine task that warrants further study. Additionally, the model may occasionally rely on edge artifacts created by affine transforms rather than the object's geometry, a challenge for future refinement.

Conclusion

By supplementing the standard invariance objective with a geometric equivariance task, we provide a simple yet powerful way to improve visual SSL. The Affine Module is computationally inexpensive, adding only 4% more parameters, yet it delivers substantial gains in both accuracy and training efficiency across diverse datasets and frameworks.

Summary updated

BibTeX
@misc{torpey2024affine,
  author = {David Torpey and Richard Klein},
  title = {{Affine transformation estimation improves visual self-supervised learning}},
  year = {2024},
  eprint = {2402.09071},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.09071},
}
Figure