Frequency-Dynamic Attention Modulation for Dense Prediction
Linwei Chen, Lin Gu, Ying Fu
TL;DR
Vision Transformers suffer from frequency vanishing due to attention acting as a low-pass filter, which degrades fine-grained details in dense prediction. The authors propose Frequency-Dynamic Attention Modulation (FDAM), a circuit-inspired, plug-in framework consisting of Attention Inversion (AttInv) and Frequency Dynamic Scaling (FreqScale) to create a learnable, dynamic frequency response for ViTs. AttInv inverts low-pass attention per location to yield complementary high-pass components, enabling $2^L$ possible filter combinations across $L$ layers, while FreqScale re-weights spectral bands via an MLP-generated dynamic kernel to fine-tune the response. Across segmentation, detection, instance and panoptic tasks, and remote sensing detection, FDAM delivers consistent gains with minimal overhead, mitigates representation collapse, and provides new spectral insights into self-attention behavior, establishing a practical approach to frequency-aware transformers.
Abstract
Vision Transformers (ViTs) have significantly advanced computer vision, demonstrating strong performance across various tasks. However, the attention mechanism in ViTs makes each layer function as a low-pass filter, and the stacked-layer architecture in existing transformers suffers from frequency vanishing. This leads to the loss of critical details and textures. We propose a novel, circuit-theory-inspired strategy called Frequency-Dynamic Attention Modulation (FDAM), which can be easily plugged into ViTs. FDAM directly modulates the overall frequency response of ViTs and consists of two techniques: Attention Inversion (AttInv) and Frequency Dynamic Scaling (FreqScale). Since circuit theory uses low-pass filters as fundamental elements, we introduce AttInv, a method that generates complementary high-pass filtering by inverting the low-pass filter in the attention matrix, and dynamically combining the two. We further design FreqScale to weight different frequency components for fine-grained adjustments to the target response function. Through feature similarity analysis and effective rank evaluation, we demonstrate that our approach avoids representation collapse, leading to consistent performance improvements across various models, including SegFormer, DeiT, and MaskDINO. These improvements are evident in tasks such as semantic segmentation, object detection, and instance segmentation. Additionally, we apply our method to remote sensing detection, achieving state-of-the-art results in single-scale settings. The code is available at https://github.com/Linwei-Chen/FDAM.
