Improvements to Self-Supervised Representation Learning for Masked Image Modeling

Jiawei Mao, Xuesong Yin, Yuanqi Chang, Honggu ZhouarXiv 2022 · DOI

Abstract

Contrastive Masked AutoEncoders (CMAE) is a novel self-supervised learning framework designed to enhance Masked Image Modeling (MIM) by incorporating spatial awareness and contrastive objectives. By intentionally weakening the decoder and requiring the encoder to perform auxiliary tasks—such as token position prediction and object-centric contrastive learning—CMAE achieves a +2.89% accuracy improvement over standard Masked AutoEncoders (MAE) on the Tiny ImageNet dataset.

Introduction

Masked Image Modeling (MIM), exemplified by models like MAE, has become a standard approach for pre-training Vision Transformers (ViTs). The core mechanism involves masking portions of an input image and training the model to reconstruct the missing pixels. Despite its success, current MIM paradigms suffer from several limitations:

  1. The "Lazy" Encoder: A powerful decoder can handle much of the reconstruction task, allowing the encoder to learn suboptimal, low-level features.
  2. Limited Task Diversity: Relying solely on reconstruction loss fails to capture global image consistency or precise spatial relationships.
  3. Background Noise: Random masking often prioritizes reconstructing irrelevant background pixels over semantically meaningful objects.

Methods: The CMAE Framework

CMAE addresses these issues through a multi-task learning approach that combines generative reconstruction with discriminative contrastive learning.

The CMAE architecture featuring dual encoders and multiple auxiliary tasks.

Contrastive Tasks with Momentum Encoding

CMAE utilizes a Siamese network structure. Two differently augmented and masked views of an image are processed by an online encoder and a momentum-updated encoder. An InfoNCE loss is applied to the resulting representations, encouraging the model to learn features that are invariant across different views of the same object.

Location Prediction and Spatial Awareness

To improve geometric understanding, CMAE introduces a "disorder recovery" task. The encoder is required to predict the original 2D coordinates of unmasked tokens. This forces the model to grasp the spatial layout of the image, which is often neglected in standard random-masking regimes.

ContrastiveCrop

Standard random cropping can often miss the primary subject of an image. CMAE employs ContrastiveCrop, which uses the model's own attention maps to identify and crop around the "main object." This ensures that the contrastive signal is focused on semantically relevant content.

Visualization of ContrastiveCrop and various masking strategies compared to standard blocked images.

Weakened Decoder

The authors found that reducing the complexity of the decoder (e.g., using fewer layers or simple MLPs) improves the quality of the encoder's representations. By making the reconstruction task more difficult for the decoder, the encoder is forced to produce more informative and robust features.

Experimental Results

The framework was evaluated on Tiny ImageNet (100,000 images, 200 classes, 64x64 resolution). CMAE was compared against several baselines using a ViT-Base backbone.

Method Architecture Epochs Batch Top-1 Accuracy
MOCO-v1 ResNet-18 500 512 47.09%
MOCO-v2 ResNet-50 200 128 45.82%
MAE ViT-B 300 64 62.95%
CMAE (Ours) ViT-B 300 64 65.84%

CMAE demonstrates a significant +2.89% improvement over the standard MAE, validating the effectiveness of integrating contrastive learning and spatial tasks into the MIM pipeline.

Discussion and Key Insights

  • Decoder Complexity: A "lazy" encoder is a real risk in MIM; weakening the decoder is a simple yet effective way to ensure the encoder learns high-level semantics.
  • Semantic Augmentation: Bridging generative and discriminative modeling via ContrastiveCrop makes the contrastive loss significantly more effective by focusing on objects rather than background noise.
  • Spatial Priors: Explicitly training for spatial awareness through location prediction helps Transformers better utilize the geometric structure of visual data.

Limitations

While promising, CMAE increases training complexity due to the momentum encoder and multiple loss terms. Future work should investigate its scalability on larger datasets like ImageNet-1K and further optimize the weighting of its various objective functions.

Summary updated

BibTeX
@misc{mao2022improvements,
  author = {Jiawei Mao and Xuesong Yin and Yuanqi Chang and Honggu Zhou},
  title = {{Improvements to Self-Supervised Representation Learning for Masked Image Modeling}},
  year = {2022},
  eprint = {2205.10546},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.10546},
}
Figure