Frequency-Dynamic Attention Modulation For Dense Prediction

Linwei Chen, Lin Gu, Ying Fu

TL;DR

Vision Transformers (ViTs) struggle with "frequency vanishing" due to their low-pass filtering attention mechanism, losing critical details. This paper introduces Frequency-Dynamic Attention Modulation (FDAM), a plug-and-play module that injects high-frequency information back into ViTs, significantly improving performance on dense prediction tasks like segmentation and object detection.

What Problem Does This Paper Address?

Vision Transformers (ViTs) have revolutionized computer vision, achieving state-of-the-art results on many tasks. However, a critical issue arises when applying them to "dense prediction" tasks, which require understanding fine-grained details and textures (e.g., semantic segmentation, object detection). The core of ViTs is the self-attention mechanism, which, when analyzed in the frequency domain, acts like a low-pass filter. This means it preferentially passes low-frequency information and attenuates high-frequency information. When ViTs stack multiple layers, this low-pass filtering effect is amplified, leading to "frequency vanishing." Essentially, the model loses the high-frequency details crucial for tasks that demand precise visual understanding, resulting in blurred feature representations and a phenomenon called "representation collapse." This limits the ability of ViTs to capture the rich spectral diversity needed for complex visual scenes.

Methods

The paper proposes Frequency-Dynamic Attention Modulation (FDAM), a novel module designed to be easily integrated into existing ViT architectures. FDAM consists of two key techniques:

  • Attention Inversion (AttInv): Inspired by circuit theory, AttInv views the attention matrix as a low-pass filter. It then "inverts" this filter in the frequency domain to create a complementary high-pass filter. By dynamically combining these low-pass and high-pass filters at each layer, AttInv aims to restore the high-frequency information that was lost. This process is spatially adaptive, meaning the combination weights can vary across different regions of the image.
  • Frequency Dynamic Scaling (FreqScale): While AttInv balances low- and high-pass filters, FreqScale provides finer-grained control. It adaptively re-weights feature maps across different frequency bands. This allows the model to selectively amplify high-frequency components (like edges and textures) while preserving low-frequency information, leading to more nuanced and adaptive feature representations.

These two techniques work together to create a full-spectrum feature representation, addressing the limitations of traditional attention mechanisms.

Datasets

The paper evaluates FDAM on several standard datasets for various tasks:

  • ADE20K: For semantic segmentation.
  • COCO: For object detection, instance segmentation, and panoptic segmentation.
  • DOTA: For remote sensing object detection.

Key Insights and Ideas

  • ViTs are inherently low-pass filters: The paper provides strong theoretical and empirical evidence that the self-attention mechanism in ViTs acts as a low-pass filter, leading to frequency vanishing and representation collapse.
  • Circuit theory as inspiration: Applying principles from circuit theory, specifically filter inversion, to the attention mechanism offers a novel way to recover high-frequency information.
  • Frequency domain analysis is crucial: Understanding the spectral properties of attention is key to diagnosing and solving the oversmoothing problem in ViTs.
  • FDAM is a general-purpose plug-in: The proposed module can be easily integrated into various ViT architectures (e.g., SegFormer, DeiT, MaskDINO) and different tasks without significant architectural changes.
  • Avoiding representation collapse: FDAM not only improves performance but also demonstrably prevents representation collapse, as evidenced by effective rank analysis and feature similarity metrics.

Key Results

FDAM consistently improves performance across various tasks and architectures:

  • Semantic Segmentation: Achieved significant improvements in mIoU on ADE20K, e.g., +2.4 mIoU for SegFormer-B0 and +1.4 mIoU for DeiT-S.
  • Object Detection & Instance Segmentation: On COCO, FDAM integrated with Mask DINO achieved notable gains in Apbox (+1.6) and Apmask (+1.4) with minimal parameter and FLOP increase. It also outperformed other state-of-the-art methods like ViTDet-L in terms of efficiency.
  • Panoptic Segmentation: The proposed Mask DINO + FDAM achieved a superior PQ score of 49.6 on COCO.
  • Remote Sensing Object Detection: Achieved state-of-the-art results on the DOTA dataset, with LSKNet-S + FDAM reaching 78.61 mAP.
  • Efficiency: FDAM adds minimal computational overhead and parameters, making it a practical enhancement.

Limitations and Future Work

  • Limitations: While FDAM is effective, the paper focuses on its application to ViTs. Its effectiveness on other transformer architectures or entirely different model families might require further investigation. The paper also mentions that Mamba models are not explicitly designed for FDAM, though it shows some benefit.
  • Future Work: The authors suggest that FDAM offers new theoretical insights into self-attention's spectral properties, paving the way for frequency-adaptive transformers and more robust vision architectures. Further exploration into optimizing the dynamic weighting mechanisms and applying FDAM to a wider range of vision tasks and architectures would be valuable.

Summary updated

BibTeX
@inproceedings{chen2025frequency,
  author = {Linwei Chen and Lin Gu and Ying Fu},
  title = {{Frequency-Dynamic Attention Modulation For Dense Prediction}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure