Head-Free Lightweight Semantic Segmentation with Linear Transformer

Bo Dong, Pichao Wang, Fan Wang

Abstract

Semantic segmentation is a critical yet computationally demanding task, traditionally requiring heavy decoder heads and backbones with quadratic complexity. We present AFFormer (Adaptive Frequency Transformer), a novel "head-free" architecture designed for high-resolution semantic segmentation on resource-constrained devices. By replacing traditional serial decoders with a parallel structure and utilizing a linear-complexity Adaptive Frequency Filter (AFF), AFFormer achieves state-of-the-art accuracy with a fraction of the computational cost. On the ADE20K benchmark, AFFormer delivers a +4.4 mIoU improvement while utilizing 45% fewer GFLOPs than Segformer, demonstrating a significant leap in efficiency for real-time vision applications.

Introduction

Semantic segmentation—the process of assigning a class label to every pixel in an image—is fundamental to autonomous driving, robotics, and medical imaging. While Vision Transformers (ViTs) have set new benchmarks for accuracy, they face two primary hurdles: the quadratic complexity ($O(n^2)$) of self-attention relative to image resolution and the reliance on bulky decoder "heads" to refine features. These factors often make high-resolution segmentation prohibitively expensive for edge devices.

AFFormer challenges the necessity of complex decoders by asking whether semantic segmentation can be made as lightweight and streamlined as image classification. By rethinking the relationship between global semantics and local details, the authors introduce a parallel, head-free design that maintains high performance without the traditional architectural bloat.

Methodology: The AFFormer Architecture

AFFormer departs from the standard encoder-decoder paradigm through three primary innovations: a parallel workflow, frequency-domain attention, and heterogeneous operators.

Head-Free Parallel Architecture

Traditional models process images serially, passing features from a backbone to a complex decoder. AFFormer instead employs a parallel setup consisting of two distinct branches:

  1. Prototype Learning (PL) Branch: This branch focuses on capturing global semantic information by learning a grid of "prototypes" or local cluster centers. This drastically reduces the number of tokens the Transformer must process.
  2. Pixel Descriptor (PD) Branch: This branch preserves high-resolution local details and spatial textures.

By merging these branches, the model eliminates the need for a heavy decoder head, requiring only a single convolutional layer for final pixel classification.

Adaptive Frequency Filter (AFF)

To address the $O(n^2)$ complexity of standard Transformers, AFFormer moves operations from the spatial domain to the frequency domain. The Adaptive Frequency Filter (AFF) replaces standard self-attention with a suite of linear-complexity operators:

  • Frequency Similarity Kernels: To model relationships between features.
  • Dynamic Low-Pass and High-Pass Filters: These filters allow the model to explicitly separate semantic content (low-frequency) from boundary details (high-frequency).

This shift ensures that the computational cost scales linearly ($O(n)$) with image resolution, making the model exceptionally efficient for high-definition inputs.

Heterogeneous Operators

The architecture strategically combines the strengths of different operators. It utilizes Convolutional Neural Networks (CNNs) for efficient local pixel embedding and Transformers for global prototype learning. This hybrid approach optimizes the FLOPs-to-performance ratio, ensuring that computational resources are spent where they are most effective.

Experimental Results

AFFormer was evaluated on three major benchmarks: ADE20K, Cityscapes, and COCO-stuff. Across all datasets, it consistently outperformed existing lightweight models in both accuracy and speed.

Performance Benchmarks

  • ADE20K: The base version of AFFormer (3M parameters) achieved 41.8 mIoU using only 4.6 GFLOPs. In comparison to Segformer, this represents a 4.4 mIoU increase with a 45% reduction in computational load.
  • Cityscapes: For high-resolution urban scenes, AFFormer reached 78.7 mIoU with 34.4 GFLOPs, outperforming Segformer by 2.5 mIoU while using 72.5% fewer GFLOPs.
  • Inference Speed: On an NVIDIA V100 GPU, AFFormer processed 1024x2048 images at 22 FPS, nearly doubling the throughput of Segformer (12 FPS).

Model Scaling

Even the "tiny" variant of the model (1.6M parameters) remains highly competitive, suggesting that the head-free design is inherently robust across different model scales.

Discussion and Insights

Frequency Sensitivity

A key insight of this research is the role of image frequencies in model performance. While human vision is somewhat robust to the loss of certain frequencies, segmentation models are highly sensitive to them. By explicitly modeling low-pass components for semantics and high-pass components for boundaries, AFFormer "sees" the scene more effectively than models relying on standard spatial attention.

Linear Scaling

As input resolutions increase, the efficiency gap between AFFormer and its competitors widens. Because of its $O(n)$ complexity, AFFormer remains viable for ultra-high-resolution tasks where traditional Transformers become computationally stalled.

Conclusion

AFFormer provides a new blueprint for efficient computer vision. By ditching the heavy decoder head and embracing frequency-domain operations, it proves that high-performance semantic segmentation does not require massive computational overhead. This "head-free" approach paves the way for more sophisticated vision tasks to be deployed on mobile and edge hardware without sacrificing accuracy.

Summary updated

BibTeX
@inproceedings{dong2023head,
  author = {Bo Dong and Pichao Wang and Fan Wang},
  title = {{Head-Free Lightweight Semantic Segmentation with Linear Transformer}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i1.25126},
}
Figure