MST: Masked Self-Supervised Transformer for Visual Representation

Zhaowen Li, Zhiyang Chen, Fan Yang, Wei Li, Yousong Zhu, Chaoyang Zhao, Rui Deng, Liwei Wu, Rui Zhao, Ming Tang, Jinqiao Wang

Abstract

Masked Self-supervised Transformer (MST) is a novel pre-training framework that harmonizes instance discrimination with masked image modeling. By leveraging a teacher network's self-attention maps to intelligently mask non-essential image patches and employing a global decoder for pixel-level reconstruction, MST captures both global semantics and local spatial details. Experimental results demonstrate that MST achieves state-of-the-art performance on ImageNet-1k classification and exhibits superior transferability to dense prediction tasks like object detection and semantic segmentation.

Introduction

Self-supervised learning (SSL) has significantly advanced visual representation learning. Current dominant paradigms, such as DINO and MoCo, primarily focus on instance discrimination, treating an entire image as a single entity. While effective for image-level classification, these methods often overlook local features essential for dense prediction tasks like object detection and semantic segmentation.

Conversely, adapting Masked Language Modeling (MLM) from NLP to computer vision presents challenges. Unlike discrete, semantic words in text, image pixels are continuous and redundant. Randomly masking patches can inadvertently remove critical object structures, hindering the model's ability to learn meaningful representations. MST addresses these issues by introducing an attention-guided masking strategy and a global reconstruction objective.

Methodology

MST utilizes a teacher-student framework where both networks share a Transformer-based backbone. The core innovations are the Attention-guided Mask Strategy and the Global Image Decoder.

Attention-guided Mask Strategy

Instead of random masking, MST utilizes the self-attention maps generated by the teacher network. These maps identify "essential" patches (typically the foreground object) versus "non-essential" patches (background or context). MST selectively masks patches with low attention scores. This forces the student network to preserve the core object while learning to relate it to the missing contextual information, effectively modeling the relationship between the object and its environment.

The MST framework featuring a teacher-student architecture with attention-guided masking and a global image decoder.

Global Image Decoder and Multi-task Learning

To enhance local representation learning, MST incorporates a CNN-based decoder into the student network. The model is tasked with reconstructing the original image pixels from the combined set of masked and unmasked tokens. This reconstruction serves as a powerful regularizer, ensuring the Transformer backbone retains spatial information that is often lost in purely contrastive approaches. The final training objective combines a cross-entropy loss for global instance discrimination and a restoration loss for pixel-level reconstruction.

Experimental Results

The authors pre-trained MST on ImageNet-1k and evaluated it across various downstream benchmarks, comparing it against established baselines like MoCo, BYOL, and DINO.

ImageNet Classification

MST demonstrates superior performance on ImageNet-1k classification using both linear and k-NN probes. With a DeiT-S backbone and 300 epochs of pre-training, MST achieves 76.9% Top-1 accuracy, outperforming the popular DINO method by 1.0% and even surpassing supervised training with the same number of epochs.

Comparison of MST against other self-supervised methods on ImageNet-1k classification.

Dense Prediction Tasks

The benefits of MST's local-global approach are most evident in dense tasks:

  • Object Detection: On MS COCO, MST achieves 42.7% mAP, surpassing MoBY and DINO.
  • Semantic Segmentation: On Cityscapes, MST reaches 74.04% mIoU, a significant improvement over the supervised baseline (71.33%) and DINO (72.96%).

Ablation studies confirm the efficacy of the attention-guided mask, which yielded 73.7% accuracy compared to 63.2% for random masking in a 100-epoch baseline, proving that random masking can be destructive to visual learning.

Conclusion

MST successfully bridges the gap between global instance discrimination and local masked modeling. By intelligently masking background patches and reconstructing the full image, it learns representations that are both semantically rich and spatially precise. While sensitive to masking hyperparameters, MST offers a robust and efficient path for pre-training Transformers for a wide range of vision tasks. Future work may explore scaling to larger architectures and applying these principles to other modalities like video.

Summary updated

BibTeX
@inproceedings{li2021mst,
  author = {Zhaowen Li and Zhiyang Chen and Fan Yang and Wei Li and Yousong Zhu and Chaoyang Zhao and Rui Deng and Liwei Wu and Rui Zhao and Ming Tang and Jinqiao Wang},
  title = {{MST: Masked Self-Supervised Transformer for Visual Representation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=y_OmkmCH9w},
}
Figure