SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers

by   Enze Xie, et al.

We present SegFormer, a simple, efficient yet powerful semantic segmentation framework which unifies Transformers with lightweight multilayer perception (MLP) decoders. SegFormer has two appealing features: 1) SegFormer comprises a novel hierarchically structured Transformer encoder which outputs multiscale features. It does not need positional encoding, thereby avoiding the interpolation of positional codes which leads to decreased performance when the testing resolution differs from training. 2) SegFormer avoids complex decoders. The proposed MLP decoder aggregates information from different layers, and thus combining both local attention and global attention to render powerful representations. We show that this simple and lightweight design is the key to efficient segmentation on Transformers. We scale our approach up to obtain a series of models from SegFormer-B0 to SegFormer-B5, reaching significantly better performance and efficiency than previous counterparts. For example, SegFormer-B4 achieves 50.3 smaller and 2.2 SegFormer-B5, achieves 84.0 excellent zero-shot robustness on Cityscapes-C. Code will be released at:


page 5

page 9

page 15

page 16


PP-LiteSeg: A Superior Real-Time Semantic Segmentation Model

Real-world applications have high demands for semantic segmentation meth...

Cross-view Transformers for real-time Map-view Semantic Segmentation

We present cross-view transformers, an efficient attention-based model f...

SSformer: A Lightweight Transformer for Semantic Segmentation

It is well believed that Transformer performs better in semantic segment...

Transformer Scale Gate for Semantic Segmentation

Effectively encoding multi-scale contextual information is crucial for a...

Multiscale Vision Transformers

We present Multiscale Vision Transformers (MViT) for video and image rec...

Conterfactual Generative Zero-Shot Semantic Segmentation

zero-shot learning is an essential part of computer vision. As a classic...

Probabilistic Attention for Interactive Segmentation

We provide a probabilistic interpretation of attention and show that the...

Code Repositories


Official implementation of "SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers"

view repo


Implementation of Segformer, Attention + MLP neural network for segmentation, in Pytorch

view repo


An edited version of SegFormer neural network

view repo