Spatial Frequency Modulation for Semantic Segmentation

Linwei Chen, Ying Fu, Lin Gu, Dezhi Zheng, Jifeng Dai

TL;DR

Standard downsampling operations in deep networks inherently cause aliasing, which destroys the fine high-frequency details crucial for tasks like semantic segmentation. This paper introduces Spatial Frequency Modulation (SFM), a plug-and-play framework that temporarily shifts high-frequency features to lower bands before downsampling and restores them during upsampling. SFM consistently boosts the performance of state-of-the-art CNN and Transformer models across multiple dense prediction benchmarks with minimal computational overhead.

What Problem Does This Paper Address?

Semantic segmentation requires a deep understanding of fine spatial details, such as textures, patterns, and object boundaries. These details correspond to high-frequency components in the spatial frequency domain. However, modern deep neural networks (DNNs) rely heavily on downsampling layers (like strided convolutions or pooling) to expand their receptive fields and reduce computational costs.

According to the Nyquist-Shannon sampling theorem, if a signal contains frequencies higher than half the sampling rate (the Nyquist frequency), downsampling causes aliasing. This means high-frequency details get irreversibly folded and distorted into lower frequencies.

The authors quantify this issue using a metric called the aliasing ratio and discover a clear trend: as the aliasing ratio increases, segmentation accuracy consistently degrades across various architectures.

Fig. 1. Quantitative analysis of the relationship between segmentation accuracy and the aliasing ratio. Aliasing ratio is defined as the ratio of high frequency above the Nyquist frequency to the total power of the spectrum. We observe that image samples with a lower aliasing ratio in the features tend to exhibit better segmentation accuracy. This phenomenon occurs in widely used existing models, including ResNet- 50 [11] (here), Swin-Transformer [13], and ConvNeXt [23] (see Figure 5).

Traditional solutions use low-pass filters to eliminate aliasing, but this simply discards the fine details needed for accurate boundary delineation. The challenge addressed here is how to protect these high-frequency details from aliasing without throwing them away.

Methods

The authors propose Spatial Frequency Modulation (SFM), a novel two-stage framework that protects high-frequency details by dynamically shifting them across the frequency spectrum.

Fig. 2. (a) Illustration of Spatial Frequency Modulation. (b) The mod- ulated feature contains fewer high frequencies above the Nyquist fre- quency, thus mitigating aliasing. (c) High frequencies tend to decay significantly in normally upsampled features, whereas the demodulated feature successfully recovers more high-frequency details.

1. Modulation via Adaptive Resampling (ARS)

Instead of uniform downsampling, ARS uses a lightweight attention generator to identify high-frequency regions (like object boundaries). It then warps the sampling grid to sample these important regions densely and smooth regions (like sky or roads) sparsely.

By the Frequency Scaling Property of Fourier transforms, densely sampling a signal scales it up locally, which effectively lowers its spatial frequency. This pre-emptive frequency shift ensures the signal drops below the Nyquist limit, allowing it to pass safely through subsequent downsampling layers without aliasing.

Illustration of adaptive resampling (ARS).

2. Demodulation via Multi-Scale Adaptive Upsampling (MSAU)

Since ARS deforms the spatial coordinates, standard bilinear upsampling would cause pixel misalignment. MSAU reverses the modulation process using Delaunay triangulation and barycentric interpolation to map the non-uniformly sampled features back onto a uniform grid. It then employs cascaded Local Pixel Relation Modules (LPRM) with varying dilations to model multi-scale pixel interactions and refine the final segmentation boundaries.

Loss Functions

The network is trained end-to-end using two specialized frequency losses alongside standard cross-entropy:

  • Frequency Modulation (FM) Loss: Minimizes the power of frequencies above the Nyquist limit in the modulated features.
  • Semantic High-Frequency (SHF) Loss: Uses a Laplacian filter on the ground truth labels to force the ARS module to sample semantic boundaries more densely.

Datasets

The framework was evaluated on several prominent benchmarks:

  • Cityscapes: 5,000 high-resolution urban street scene images (19 classes).
  • Pascal Context: 4,998 training and 5,105 validation images (59 frequent classes evaluated).
  • ADE20K: A highly challenging dataset containing 150 semantic categories.
  • COCO: Used to test generalizability on instance and panoptic segmentation tasks.
  • CIFAR-100 & Tiny-ImageNet: Used to evaluate image classification and adversarial robustness.

Key Insights and Ideas

  • Hiding Frequencies in Plain Sight: Rather than permanently discarding high frequencies via blurring filters, SFM temporarily "hides" them in lower frequency bands during downsampling and safely recovers them later.
  • Continuity Over Discontinuity: Unlike Deformable Convolutions, which predict pixel offsets independently and risk disrupting the relative spatial order of pixels, the coordinate mapping function in ARS is strictly monotonic. This ensures spatial continuity and stability during downsampling.
  • Widespread Architecture Compatibility: Because ARS and MSAU are lightweight add-ons, they integrate seamlessly into both classic CNNs (like ResNet) and modern vision transformers (like Swin or InternImage).

Key Results

The addition of SFM yielded substantial performance gains across all tested models and datasets:

  • ADE20K: Boosted Mask2Former-Swin-T by +1.5 mIoU and UPerNet-InternImage-T by +1.4 mIoU.
  • Cityscapes: Improved powerful Deformable Convolution baselines by +0.8 mIoU.
  • Boundary Precision: On a ResNet-32× baseline, SFM improved the boundary F-score by +3.5 and boundary IoU by +4.1, while significantly reducing aliasing-induced errors like false responses and merging mistakes.
  • Adversarial Robustness: When combined with existing anti-aliasing pooling methods on CIFAR-10, ARS achieved state-of-the-art robust accuracy against adversarial attacks (e.g., PGD and AutoAttack).

Limitations and Future Work

While SFM introduces negligible computational overhead in terms of FLOPs, the demodulation step relies on Delaunay triangulation and barycentric interpolation. These operations are structurally more complex than standard uniform grid operations and may require optimized hardware implementations for real-time deployment.

The authors note that future research will explore extending spatial frequency modulation to other dense prediction tasks, such as object detection and video tracking, as well as exploring deeper theoretical properties of neural network representations in the Fourier domain.

Summary updated

BibTeX
@misc{chen2025spatial,
  author = {Linwei Chen and Ying Fu and Lin Gu and Dezhi Zheng and Jifeng Dai},
  title = {{Spatial Frequency Modulation for Semantic Segmentation}},
  year = {2025},
  eprint = {2507.11893},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.11893},
}
Figure