Jigsaw Clustering for Unsupervised Visual Representation Learning

Pengguang Chen, Shu Liu, Jiaya Jia

Abstract

Unsupervised representation learning with contrastive learning achieves great success recently. However, these methods have to duplicate each training batch to construct contrastive pairs, i.e., each training batch and its augmented version should be forwarded simultaneously, leading to nearly double computation resource demand. We propose a novel Jigsaw Clustering pretext task in this paper, which only needs to forward each training batch itself, nearly reducing the training cost by a half. Our method makes use of information from both intra-image and inter-images, and outperforms previous single-batch based methods by a large margin, even comparable to the costly contrastive learning methods with only half the number of training batches. Our method shows that multiple batches during training are not necessary, and opens a new door for future research of single-batch based unsupervised methods. Our models trained on ImageNet datasets achieve state-of-the-art results with linear classification, outperform previous single-batch methods by 2.6%. Models transfer to COCO datasets outperforms MoCo v2 by 0.4% with only half the number of training samples. Our pretrained models outperform supervised ImageNet pretrained models on CIFAR-10 and CIFAR-100 datasets by 0.9% and 4.1% respectively.

Introduction

In the field of unsupervised visual representation learning, researchers design "pretext tasks" to help neural networks learn meaningful features from unlabeled data. Historically, these tasks have been divided into two categories: intra-image tasks (single-batch) and inter-image tasks (dual-batch). Single-batch tasks, like solving a jigsaw puzzle within a single image, are computationally efficient but limited in scope. Conversely, dual-batch contrastive learning methods (e.g., SimCLR or MoCo) compare different images to learn global features but require forwarding a batch and its augmented version simultaneously, doubling memory and compute requirements.

Jigsaw Clustering (JigClu) bridges this gap. It captures the rich inter-image information characteristic of contrastive learning while maintaining the single-batch efficiency of traditional pretext tasks. By forcing the network to identify and locate patches shuffled across an entire batch, JigClu learns powerful representations at half the computational cost of standard contrastive methods.

Methodology

The core of the JigClu framework is a novel "split-shuffle-stitch" pipeline designed to create a complex, multi-image pretext task within a single forward pass.

The Jigsaw Clustering process: splitting original images, shuffling patches across the batch, and stitching them into new montage inputs.

The JigClu Pipeline

  1. The Shuffle: A batch of $n$ images is taken, and each image is split into an $m \times m$ grid of patches. Crucially, these patches are shuffled across the entire batch rather than just within their source image.
  2. The Montage: These random patches are stitched back together to form a new batch of "montage" images. Each montage image contains visual information from several different original images, maintaining a consistent resolution for the backbone network.
  3. Dual Objectives: The model, typically a ResNet-50 backbone, must solve two simultaneous problems:
  4. Clustering Branch: Identifying which patches belong to the same original image (inter-image information). This uses a contrastive loss to pull "same-source" patches together in the feature space.
  5. Location Branch: Predicting the original $m \times m$ grid position of each patch (intra-image information).

By combining these, the network learns both high-level global features required to group disparate patches and fine-grained local features required for spatial placement.

Results and Performance

JigClu was evaluated on standard benchmarks including ImageNet-1k, COCO, and CIFAR. The results demonstrate that inter-image shuffling is a powerful proxy for contrastive learning.

Accuracy comparison on ImageNet-100: JigClu (Ours) significantly outperforms SimCLR and MoCo v2 across various training epochs.

On ImageNet-1k, JigClu achieved 66.4% top-1 accuracy with linear evaluation, outperforming the previous best single-batch method (CPC v2) by 2.6%. Most notably, it achieves results comparable to dual-batch methods like MoCo v2 while using 50% fewer training batches. In data-constrained scenarios, such as the ImageNet-10% subset, JigClu outperformed MoCo v2 by a massive 6.0%, suggesting superior data efficiency.

Transfer learning results further validate the method. When applied to COCO object detection, JigClu outperformed MoCo v2 by 0.4% AP, despite the significantly lower training cost. It also surpassed supervised ImageNet pretrained models on CIFAR-10 and CIFAR-100 by 0.9% and 4.1%, respectively.

Discussion and Future Work

JigClu proves that re-introducing location-based pretext tasks and shuffling across batches allows for high-performance representation learning without the overhead of dual-batch contrastive pairs. However, the method currently relies on a rigid grid ($m=2$ was found to be optimal), and the "split-shuffle-stitch" logic adds some preprocessing complexity.

Future research could explore more flexible or stochastic partitioning to improve robustness. Additionally, while this study focused on ResNet architectures, the patch-based nature of JigClu makes it a natural candidate for Vision Transformers (ViTs), which process images as sequences of patches by design.

Summary updated

BibTeX
@inproceedings{chen2021jigsaw,
  author = {Pengguang Chen and Shu Liu and Jiaya Jia},
  title = {{Jigsaw Clustering for Unsupervised Visual Representation Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=LeWf0e3teI},
}
Figure