Mask Hierarchical Features For Self-Supervised Learning

Fenggang Liu, Yangguang Li, Feng Liang, Jilan Xu, Bin Huang, Jing ShaoarXiv 2023

Abstract

This paper shows that Masking the Deep hierarchical features is an efficient self-supervised method, denoted as MaskDeep. MaskDeep treats each patch in the representation space as an independent instance. We mask part of patches in the representation space and then utilize sparse visible patches to reconstruct high semantic image representation. The intuition of MaskDeep lies in the fact that models can reason from sparse visible patches semantic to the global semantic of the image. We further propose three designs in our framework: 1) a Hierarchical Deep-Masking module to concern the hierarchical property of patch representations, 2) a multi-group strategy to improve the efficiency without any extra computing consumption of the encoder and 3) a multi-target strategy to provide more description of the global semantic. Our MaskDeep brings decent improvements. Trained on ResNet50 with 200 epochs, MaskDeep achieves state-of-the-art results of 71.2% Top1 accuracy linear classification on ImageNet. On COCO object detection tasks, MaskDeep outperforms the self-supervised method SoCo, which specifically designed for object detection. When trained with 100 epochs, MaskDeep achieves 69.6% Top1 accuracy, which surpasses current methods trained with 200 epochs, such as HCSC, by 0.4%.

Introduction

Self-supervised learning (SSL) has traditionally been divided into two major camps: Contrastive Learning (CL) and Masked Image Modeling (MIM). Contrastive methods, such as MoCo or SimSiam, excel at learning global representations for image classification but often struggle with dense tasks like object detection because they ignore local spatial details. Conversely, MIM methods like MAE excel at learning local features by reconstructing masked pixels but typically require massive computational resources and are often tailored for Vision Transformers (ViTs).

The authors of MaskDeep identify a gap: how can we create an efficient SSL framework that works for standard CNNs (like ResNet) and performs exceptionally well on both global classification and local detection tasks?

Methodology

The core innovation of MaskDeep is Hierarchical Deep-Masking. Instead of masking the input image, the model masks features within the representation space.

The MaskDeep architecture featuring Hierarchical Deep-Masking and a momentum encoder.

The framework consists of several key components:

  1. Hierarchical Feature Space: The model uses a standard encoder (ResNet-50) coupled with an FPN-type module to generate features at multiple scales ($P_2$ through $P_5$).
  2. Sparse Masking: It randomly masks these deep features, leaving only a tiny fraction (about 10–12 sparse patches) visible.
  3. Local-to-Global Alignment: The model aligns the joint representation of these sparse local patches with a global representation of the entire image generated by a momentum-updated teacher encoder.
  4. Multi-Group & Multi-Target Strategies: To boost efficiency, multiple groups of patches are sampled from the same image. A multi-target strategy is also employed, where the model predicts several global descriptors to stabilize training.

Experiments and Results

MaskDeep was evaluated on ImageNet-1k for classification, and PASCAL VOC and COCO 2017 for object detection and instance segmentation.

Performance comparison of MaskDeep against other SSL methods on ImageNet and COCO.

MaskDeep sets a new bar for ResNet-50 based self-supervised learning:

  • ImageNet Classification: Achieves 71.2% Top-1 accuracy with 200 epochs, outperforming HCSC and MoCo v2.
  • Object Detection (COCO): Reaches 41.5% box AP, surpassing SoCo and DetCo.
  • Instance Segmentation (COCO): Achieves 36.1% mask AP, showing strong performance on dense pixel-level tasks.
  • Efficiency: In just 100 epochs, it hits 69.6% Top-1 accuracy, surpassing HCSC trained for 200 epochs.

Discussion

Several key insights emerged from this work. First, masking in the deep feature space avoids "pixel noise," allowing the model to focus on high-level semantic reasoning rather than low-level textures. Second, utilizing features from multiple stages ($P_3, P_4, P_5$) is critical for balancing semantic meaning and spatial detail. Finally, the ability to predict global context from sparse local patches confirms that local semantics are highly informative.

While currently focused on CNNs, the hierarchical approach is theoretically applicable to Vision Transformers. Future work could explore more aggressive masking ratios or multi-modal applications, such as aligning sparse image patches with text descriptions.

Summary updated

BibTeX
@misc{liu2023mask,
  author = {Fenggang Liu and Yangguang Li and Feng Liang and Jilan Xu and Bin Huang and Jing Shao},
  title = {{Mask Hierarchical Features For Self-Supervised Learning}},
  year = {2023},
  eprint = {2304.00218},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.00218},
}
Figure