A Transformer-Based Decoder for Semantic Segmentation with Multi-level Context Mining

Bowen Shi, Dongsheng Jiang, Xiaopeng Zhang, Han Li, Wenrui Dai, Junni Zou, Hongkai Xiong, Qi Tian

Abstract

SegDeformer is a lightweight, pure Transformer-based decoder designed to enhance semantic segmentation by mining context both within a single image and across the entire dataset. By introducing learnable "external tokens" and a streamlined internal attention mechanism, it provides consistent accuracy gains across various popular backbones with minimal computational overhead.

Introduction

In semantic segmentation, the goal is to assign a category label to every pixel. While recent breakthroughs have focused on the encoder (backbone), the decoder has often remained relatively simple or reliant on older CNN-based designs. SegDeformer addresses two specific gaps: feature confusion from multi-stage fusion and the isolation of context within a single image.

Context Mining Strategy

Standard models often miss out on cross-image context—visual patterns like "grass" or "car" that are consistent across a whole dataset. SegDeformer introduces a dual-mining approach to capture both local and global dependencies.

Conceptual overview of internal and external context mining in SegDeformer.

Internal Context Mining ($M_{inter}$)

This module uses a single-head self-attention layer to "re-integrate" features. Even though the encoder has a global receptive field, a final pass of attention in the decoder is essential to resolve the "confusion" caused by multi-stage feature fusion.

External Context Mining ($M_{exter}$)

The most novel contribution is the introduction of learnable external tokens (one per category). These tokens act as a global "memory" summarizing information from the entire dataset. Through cross-attention, the current image's pixels can "consult" these tokens to refine their representation.

SegDeformer Architecture

The overall architecture integrates seamlessly with various Transformer encoders such as ViT, MiT, or Swin.

Detailed architecture of SegDeformer, showing the integration of internal and external attention modules.

The decoder handles high-resolution images via "efficient self-attention," which uses strided convolutions to reduce the spatial scale of attention maps, dropping complexity from $O(N^2)$ to $O(N^2/R)$.

Experimental Evaluation

The model was evaluated on three industry-standard benchmarks: ADE20K, COCO-Stuff, and Cityscapes.

Key Results

  • ADE20K: Achieved a +2.91% mIoU gain over the MiT-B1 baseline and reached a top performance of 54.13% MS mIoU with a Swin-L backbone.
  • Cityscapes: Reached 83.52% mIoU, demonstrating that the efficient attention module allows scaling to high resolutions.
  • Efficiency: Replacing the standard UperNet decoder on a DeiT-S backbone reduced the parameter count from 52M to 27M while increasing speed from 30 FPS to 33 FPS.

Conclusion

SegDeformer demonstrates that a single-head attention layer in the decoder is sufficient to significantly improve feature consistency. By leveraging learnable tokens instead of massive memory banks, it achieves state-of-the-art results with high efficiency and universal applicability across different backbones.

Summary updated

BibTeX
@inproceedings{shi2022transformer,
  author = {Bowen Shi and Dongsheng Jiang and Xiaopeng Zhang and Han Li and Wenrui Dai and Junni Zou and Hongkai Xiong and Qi Tian},
  title = {{A Transformer-Based Decoder for Semantic Segmentation with Multi-level Context Mining}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-19815-1\_36},
}
Figure