# SegFormer (2021)

> Paired a hierarchical, position-free Vision Transformer encoder with a tiny all-MLP decoder.

Page: https://mralbu.github.io/ai-datasets/p/segformer

## Key facts

- Title: SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
- Authors: Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping Luo
- Venue: NeurIPS 2021
- Category: Vision
- Paper: https://www.alphaxiv.org/abs/2105.15203

## Why it matters

Early Vision Transformer segmenters like SETR were heavy, slow, and broke whenever test images changed resolution because their positional embeddings had to be interpolated. SegFormer showed that a clean multi-scale Transformer needs almost no decoder at all, setting the practical template for Transformer semantic segmentation.

## The idea

Replace ViT's single-scale patch grid and fixed positional encodings with Mix Transformer (MiT), a four-stage pyramid that mixes overlapping patch embeddings with lightweight 3×3 depthwise convolutions inside each feed-forward block—so it adapts cleanly to any test resolution. Because self-attention already sees far across the image, a small all-MLP head suffices to fuse the four stages and predict masks.

## The result

50.3% mIoU on ADE20K val with SegFormer-B4 (64M parameters, 5× smaller than earlier Transformer baselines) and 51.8% with B5, plus 84.0% mIoU on Cityscapes val.

## The data

- [ADE20K (2017)](https://mralbu.github.io/ai-datasets/d/ade20k.md): 27,000 scenes where every object, and often its parts, is outlined and named.
- [Cityscapes (2016)](https://mralbu.github.io/ai-datasets/d/cityscapes.md): 5,000 street photos from 50 cities, every pixel labeled as road, car, person, sky and so on.

## Builds on

- [ViT (2020)](https://mralbu.github.io/ai-datasets/p/vit.md)
- [DeepLabv3+ (2018)](https://mralbu.github.io/ai-datasets/p/deeplabv3-plus.md)
- [FCN (2014)](https://mralbu.github.io/ai-datasets/p/fcn.md)

## Led to

- [Mask2Former (2021)](https://mralbu.github.io/ai-datasets/p/mask2former.md)

## Part of

- [Segmentation](https://mralbu.github.io/ai-datasets/t/segmentation.md) (step 5 of 7)
