FeedFormer: Revisiting Transformer Decoder for Efficient Semantic Segmentation

Jae-hun Shim, Hyunwoo Yu, Kyeongbo Kong, Suk-Ju Kang

Abstract

Semantic segmentation requires a delicate balance between high-level semantic understanding and fine-grained spatial detail. While Vision Transformers (ViTs) have significantly advanced encoder designs, decoders have often relied on either simple MLP structures that lose detail or complex learnable query systems that incur high computational costs. This paper introduces FeedFormer, a novel transformer decoder that utilizes high-level encoder features as queries and low-level features as spatial anchors. By incorporating a "reformation trick" to reuse encoder self-attention blocks, FeedFormer achieves superior accuracy with reduced computational overhead on standard benchmarks like ADE20K and Cityscapes.

Introduction

In semantic segmentation, the objective is to assign a class label to every pixel. Current state-of-the-art decoders generally fall into two categories: simple MLP-based decoders (e.g., SegFormer), which are efficient but struggle with fine spatial details, and learnable query decoders (e.g., Mask2Former), which are powerful but computationally intensive due to multi-scale pixel decoders and iterative passes.

The core challenge identified by the authors is the "semantic-spatial trade-off": as networks deepen, they gain semantic richness but lose the spatial precision necessary for accurate boundary delineation. FeedFormer addresses this by efficiently injecting lost spatial detail back into high-level semantic features.

Methodology: The FeedFormer Architecture

FeedFormer introduces two primary innovations to the transformer decoder paradigm: the Feature Query Decoder and the Reformation Trick.

Feature Query Decoder

Unlike Mask2Former, which uses randomly initialized learnable queries, FeedFormer uses actual high-level features ($F_2, F_3, F_4$) from the encoder as queries. It designates the lowest-level feature ($F_1$), which retains the most spatial and structural information, as the Key and Value for the cross-attention mechanism. This allows semantic features to "look back" at the original spatial structure to refine object boundaries.

Comparison of decoder architectures: (a) Feature Decoder (SegFormer), (b) Learnable Object Query Decoder (Mask2Former), and (c) the proposed Feature Query Decoder (FeedFormer).

The Reformation Trick

To further optimize efficiency, the authors observed that both the encoder and decoder utilize self-attention modules. They proposed "pushing" the encoder's self-attention blocks into the decoder. By restructuring the architecture such that the encoder stage block effectively serves as the self-attention component of the decoder, redundant computations are eliminated, creating a more streamlined data flow.

Detailed architecture of FeedFormer and the 'Reformation Trick' showing the integration of encoder stages into the transformer decoder structure across four steps.

Experimental Evaluation

The model was evaluated on two industry-standard benchmarks:

  • ADE20K: 150 fine-grained semantic categories.
  • Cityscapes: Urban driving scenes with 19 categories and high-resolution imagery.

Key Results

FeedFormer demonstrates a superior performance-to-computation trade-off:

  • Efficiency Gains: FeedFormer-B0 (with a Mix Transformer backbone) outperformed SegFormer-B0 by 1.8% mIoU on ADE20K while requiring 7.1% less computation (GFLOPs).
  • Cityscapes Performance: It achieved a 1.7% higher mIoU with 14.4% less computation than SegFormer-B0.
  • Lightweight Deployment: The FeedFormer-LVT variant achieved 41.0% mIoU on ADE20K and 78.6% on Cityscapes with only 4.6 million parameters, making it ideal for edge devices.
  • Boundary Precision: Qualitative analysis confirms that FeedFormer is significantly better at capturing complex boundaries, such as thin poles or distant objects, compared to traditional MLP-based decoders.

Conclusion and Future Work

FeedFormer successfully revisits the transformer decoder to provide a more efficient and spatially aware solution for semantic segmentation. While it significantly reduces theoretical computational costs (GFLOPs), a current limitation is inference latency on standard hardware, where CNN-optimized libraries like TensorRT still outperform transformer-specific attention mechanisms. Future research will focus on optimizing these attention blocks to bridge the gap between theoretical efficiency and real-world execution speed.

Summary updated

BibTeX
@inproceedings{shim2023feedformer,
  author = {Jae-hun Shim and Hyunwoo Yu and Kyeongbo Kong and Suk-Ju Kang},
  title = {{FeedFormer: Revisiting Transformer Decoder for Efficient Semantic Segmentation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i2.25321},
}
Figure