LogosIntelligenceLab/SETR

[CVPR 2021 & IJCV 2024] Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers

What it solves

Traditional semantic segmentation models often rely on convolutional neural networks (CNNs) that look at local image regions. This project proposes an alternative: treat the entire segmentation problem as a sequence-to-sequence task. By splitting an image into small patches and feeding them to a transformer, the model can capture long-range dependencies and global context more easily, leading to better segmentation results.

How it works

The model uses a Vision Transformer (ViT) backbone to encode the image as a sequence of patch embeddings. Then, different decoder heads convert these embeddings back into a dense per-pixel prediction map:

  • SETR-Naive simply reshapes the transformer output into an image-like structure.
  • SETR-MLA combines features from multiple transformer layers to improve detail.
  • SETR-PUP progressively upsamples the sequence to full resolution.

The whole framework is built on top of MMsegmentation, so it integrates with standard training and testing workflows. The repository includes configuration files, training scripts, and pretrained models for datasets such as Cityscapes, ADE20K, and Pascal Context. It also introduces an extension called HLG (Hierarchical Local-Global) that adapts the same transformer ideas to classification and detection tasks, with results on ImageNet and COCO.

Who it's for

This project is aimed at computer vision researchers and practitioners who want to experiment with transformer-based models for semantic segmentation and other dense prediction tasks. It is also useful for those who want to compare sequence-to-sequence approaches against standard CNN-based baselines, or who need a backbone that works across segmentation, classification, and detection.

Highlights

  • Introduces a sequence-to-sequence perspective for semantic segmentation using transformers (CVPR 2021).
  • Provides three segmentation variants: SETR-Naive, SETR-MLA, and SETR-PUP, each with a different decoder strategy.
  • Includes pretrained models and configs for Cityscapes, ADE20K, and Pascal Context, with reported mIoU scores.
  • Extends to HLG models for classification (ImageNet), segmentation, and detection (COCO), showing strong results.
  • Built on MMsegmentation, making it easy to integrate with existing tools and datasets.

Related

  • Project
  • Project
  • Project
  • Project