Explicit homography estimation improves contrastive self-supervised learning

David Torpey, Richard Klein

Abstract

Self-supervised learning (SSL) has emerged as a powerful paradigm for learning visual representations from unlabeled data, primarily through contrastive methods that enforce invariance to data augmentations. However, enforcing strict invariance can lead to the loss of critical geometric information. This paper proposes a novel hybrid approach that incorporates an explicit homography estimation task into standard contrastive frameworks like SimCLR and BYOL. By requiring the model to regress the geometric transformation parameters between two views, we encourage the latent space to become "geometrically aware." Experimental results on CIFAR-10, CIFAR-100, and SVHN demonstrate that this method significantly improves linear evaluation accuracy and accelerates convergence.

Introduction

The current state-of-the-art in self-supervised learning (SSL) is dominated by contrastive methods. These techniques typically generate two augmented "views" of an image and train a neural network to map them to similar points in a latent space. While effective, this approach faces two significant challenges: high computational requirements and the "invariance trap."

The invariance trap occurs when a model is forced to ignore transformations that might actually be semantically meaningful. For instance, in digit recognition (e.g., the SVHN dataset), a model that is perfectly invariant to rotation may fail to distinguish between a '6' and a '9'. We hypothesize that instead of ignoring these transformations, models should be taught to explicitly understand the underlying geometry.

Methodology

We propose adding a "homography regressor" module to existing contrastive SSL architectures. The core idea is to move beyond simple invariance by forcing the model to encode the geometric relationship between views.

Architecture

The proposed framework maintains the standard dual-branch structure of contrastive models. Given an image $x$, two augmented views $x_1$ and $x_2$ are produced. We then apply an additional random affine or homography transformation to one of these views, creating $x_1'$.

Proposed architecture integrating a homography regressor into a contrastive SSL framework.

As shown in Figure 1, the "homography regressor" is a small Multi-Layer Perceptron (MLP) that takes the vector difference between the latent representations of the original view ($l_1$) and the transformed view ($l_1'$). The model is then trained using a multi-task loss that combines a standard contrastive loss (e.g., NT-Xent or MSE) with a regression loss requiring the model to predict the exact parameters of the geometric transformation applied.

Geometric Awareness

By regressing the vector difference, the latent space is forced to organize itself such that the distance and direction between vectors correspond to specific geometric changes. This makes the representations more robust and informative for downstream tasks.

Experimental Results

We evaluated our approach on CIFAR-10, CIFAR-100, and SVHN datasets. The results consistently show that explicit homography estimation provides a performance boost over baseline contrastive methods.

Performance and Convergence

Our method consistently outperforms the SimCLR and BYOL baselines across all tested datasets. Notably, on CIFAR-100 with SimCLR, linear evaluation accuracy improved from 28.53% to 31.33%.

Linear evaluation accuracy over 100 epochs for SimCLR and BYOL baselines vs. the proposed method.

Beyond final accuracy, the proposed module significantly accelerates convergence, as illustrated in Figure 2. Models reach higher accuracy levels much earlier in the training process. While the additional regressor increases training time per epoch by approximately 30%, the overall compute required to reach a target performance level is often reduced due to faster convergence.

Transformation Analysis

Our ablation studies revealed several key insights:

  • Affine vs. Homography: Simple affine transformations (6 parameters) generally outperformed full homographies (8 parameters) on the low-resolution datasets tested.
  • The Efficacy of Shear: Among individual transformations, shearing was found to be the most effective. We posit that shear forces the network to learn more complex object geometry to resolve the resulting distortions.
  • Avoiding the Invariance Trap: On the SVHN dataset, our non-invariant approach successfully avoided the performance degradation typically seen when models are forced to be rotation-invariant, preserving the ability to distinguish between similar digits.

Conclusion

Explicitly estimating geometric transformations is a simple yet effective way to enhance contrastive self-supervised learning. By teaching models how images are transformed rather than just telling them to ignore the changes, we produce more geometrically aware and higher-performing representations. Future work will explore the application of this method to higher-resolution images and its impact on spatially sensitive downstream tasks like object detection and semantic segmentation.

Summary updated

BibTeX
@misc{torpey2021explicit,
  author = {David Torpey and Richard Klein},
  title = {{Explicit homography estimation improves contrastive self-supervised learning}},
  year = {2021},
  eprint = {2101.04713},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.04713},
}
Figure