Self-supervised Learning with Local Attention-Aware Feature

Trung X. Pham, Rusty Mina, Chang D. YooOpenReview 2021

Abstract

In this work, we propose a novel methodology for self-supervised learning for generating global and local attention-aware visual features. Our approach is based on training a model to differentiate between specific image transformations of an input sample and the patched images. Utilizing this approach, the proposed method is able to outperform the previous best competitor by 1.03% on the Tiny-ImageNet dataset and by 2.32% on the STL-10 dataset. Furthermore, our approach outperforms the fully-supervised learning method on the STL-10 dataset. Experimental results and visualizations show the capability of successfully learning global and local attention-aware visual representations.

Introduction

Deep learning's success is heavily reliant on large-scale labeled datasets like ImageNet. However, manual labeling is prohibitively expensive and time-consuming. Self-supervised learning (SSL) offers a solution by leveraging unlabeled data through "pretext tasks"—synthetic puzzles that force a model to learn meaningful visual representations. While tasks like predicting image rotation (RotNet) or solving jigsaw puzzles have proven effective, they primarily emphasize global image structure. This paper introduces a method to bridge the gap in local attention, ensuring models understand both the "big picture" and fine-grained local details.

Methodology: The Resize-and-Paste Strategy

The core of the proposed method is a novel pretext task designed to sensitize the network to local anomalies within a global context. The process involves three primary stages:

  1. Rotation: An unlabeled input image is rotated by one of four cardinal angles (0°, 90°, 180°, or 270°).
  2. Patching: This rotated image is resized into a small patch (typically 40% of the original dimensions) and pasted onto the original, upright (0°) version of the image at a random location.
  3. Prediction: A Convolutional Neural Network (CNN) is then trained to identify the rotation angle of the embedded patch.
The proposed self-supervised learning pipeline, illustrating the generation of rotated and patched images followed by feature encoding and classification.

To implement this, two distinct architectures were explored:

  • Patch RotNet: An 8-class classifier that distinguishes between four types of full-image rotations and four types of patched-image rotations.
  • Patch RelNet: A pairwise approach that processes a rotated image and a patched image simultaneously, concatenating their features to predict the relationship across 4 classes.

By requiring the model to locate and identify the rotation of a small patch against a standard background, the network is forced to develop a nuanced understanding of local features that deviate from the global orientation.

Experimental Results

The researchers evaluated the methodology on two standard benchmarks: Tiny-ImageNet (200 classes, 64x64 resolution) and STL-10 (100,000 unlabeled images, 96x96 resolution).

The proposed method achieved state-of-the-art (SOTA) performance, surpassing the previous best competitor by 1.03% on Tiny-ImageNet and 2.32% on STL-10. Remarkably, on the STL-10 dataset, the self-supervised features achieved 78.38% accuracy, outperforming a fully supervised model (74.54%). This suggests that the pretext task captures fundamental visual properties more effectively than simple categorical labels.

Visualizing Local Attention

To verify that the model was indeed learning local features, the authors employed GradCAM to visualize the network's attention.

GradCAM visualizations demonstrating the model's ability to focus on the boundaries and internal features of the rotated patches.

As shown in the visualizations, the model specifically targets the boundaries and contents of the local patches. In contrast, standard rotation-based models tend to distribute attention more broadly across the entire image. This confirms that the "resize-and-paste" strategy successfully directs the network's focus toward local anomalies.

Conclusion

This research demonstrates that integrating local attention into self-supervised learning significantly enhances the quality of learned visual representations. By forcing a model to reconcile local patches with global backgrounds, the approach achieves superior performance on standard benchmarks and even exceeds supervised baselines in specific contexts. Future work may explore more sophisticated patch placement strategies and scaling the methodology to higher-resolution datasets like COCO or the full ImageNet.

Summary updated

BibTeX
@misc{pham2021self,
  author = {Trung X. Pham and Rusty Mina and Chang D. Yoo},
  title = {{Self-supervised Learning with Local Attention-Aware Feature}},
  year = {2021},
  eprint = {2108.00475},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.00475},
  howpublished = {OpenReview},
}
Figure