Masked Frequency Modeling for Self-Supervised Visual Pre-Training

Jiahao Xie, Wei Li, Xiaohang Zhan, Ziwei Liu, Yew-Soon Ong, Chen Change Loy

Introduction

Masked Frequency Modeling (MFM) shifts the popular "mask-and-predict" self-supervised learning paradigm from the spatial domain to the frequency domain. By masking frequency components instead of image patches, MFM provides a unified, architecture-agnostic framework that works seamlessly for both Vision Transformers (ViT) and Convolutional Neural Networks (CNNs), achieving state-of-the-art performance and superior robustness.

Most recent breakthroughs in self-supervised visual pre-training rely on Masked Image Modeling (MIM), where parts of an image are hidden and the model learns by predicting the missing pieces. However, current methods like MAE or BEiT perform masking in the spatial domain (removing square patches of pixels).

Comparison of Masking Strategies

The authors argue this spatial approach has two major drawbacks:

  1. Redundancy: Raw pixels are highly redundant. To make the task challenging enough for a model to learn meaningful features, a massive portion of the image (often 75% or more) must be masked.
  2. Architectural Limitations: Spatial masking often requires "mask tokens"—special placeholders for missing patches. These are easy to use in Transformers but difficult to integrate into CNNs because they break the local "sliding window" nature of convolutions.

Methods

To overcome these limitations, MFM introduces a "corrupt-and-predict" pipeline based on the Fourier Transform:

The MFM Pipeline
  1. Frequency Masking: The input image is converted into the frequency domain using a Fast Fourier Transform (FFT). Instead of cutting out spatial patches, the authors mask out either high-frequency components (removing edges/details) or low-frequency components (removing color/style).
  2. Spatial Reconstruction: An Inverse FFT (iFFT) converts the masked spectrum back into a "corrupted" spatial image, which is then fed into a standard encoder (ViT or ResNet). Crucially, no mask tokens are used, making the input look like a naturally blurred or noisy image.
  3. Frequency Prediction: A lightweight linear head takes the encoder's output and predicts the missing values on the frequency spectrum.
  4. Unified Loss: The model is trained using a frequency distance metric that considers both the amplitude and phase of the predicted frequencies.

This approach allows the model to learn from both structural information (high frequencies) and low-level statistics (low frequencies) in a unified way.

Key Insights

  • Frequency vs. Space: Masking in the frequency domain is more efficient at revealing underlying image patterns. While spatial patches are local, a single frequency component carries global information about the image's structure or style.
  • Architecture Agnostic: Because MFM doesn't rely on mask tokens, it is one of the first MIM-style methods to work effectively on both ViTs and standard CNNs (like ResNet-50) without complex modifications.
  • Relation to Classical Tasks: MFM is essentially a generalized version of classical image restoration tasks like super-resolution (recovering high frequencies) and denoising. However, MFM's random masking strategy provides a much stronger "pretext task" for representation learning than any single restoration task.
  • Predicting the "Invisible": The model performs better when it only tries to predict the masked frequencies rather than reconstructing the entire spectrum, confirming that the "challenge" of the pretext task is key to learning.

Key Results

The authors evaluated MFM across several benchmarks, pre-training on ImageNet-1K without labels:

  • Classification: On ImageNet-1K, a ViT-Base pre-trained with MFM achieved 83.1% top-1 accuracy, slightly outperforming MAE (82.9%).
  • CNN Success: MFM achieved 78.5% on ResNet-50, significantly higher than the supervised baseline (76.1%) and other self-supervised methods like SimCLR or MoCo v2.
  • Robustness: MFM models showed advanced robustness. On the ImageNet-C benchmark (mean Corruption Error), MFM outperformed spatial masking methods, likely because it learns to be invariant to frequency-domain perturbations during pre-training.
  • Segmentation: On ADE20K, MFM achieved 48.6 mIoU, surpassing both BEiT and MAE.

Limitations and Future Work

  • Scaling: The study primarily focuses on base-sized models (ViT-B, ResNet-50). The scaling behavior to "Huge" models or "Extra-Large" datasets remains under-explored.
  • Information Redundancy: While frequency masking reduces spatial redundancy, some redundancy still exists in the Fourier domain that could be further optimized.
  • Modality Expansion: The current work is limited to static images. The frequency-domain perspective could be highly effective for other modalities like video or audio, where temporal and spectral patterns are dominant.

Summary updated

BibTeX
@inproceedings{xie2023masked,
  author = {Jiahao Xie and Wei Li and Xiaohang Zhan and Ziwei Liu and Yew-Soon Ong and Chen Change Loy},
  title = {{Masked Frequency Modeling for Self-Supervised Visual Pre-Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=9-umxtNPx5E},
}
Figure