wikillm

Paper · 2023-05-05 · cs.CV, cs.AI, cs.LG

Semantic Segmentation using Vision Transformers: A survey

Survey of Vision Transformer architectures for semantic segmentation (SETR, Swin, Segmenter, SegFormer, PVT, Twins, DPT, HRFormer, Mask2Former), with loss functions, label-scarcity methods and a table of mIoU numbers on ADE20K, Cityscapes and PASCAL-Context compiled from reported results. Highest listed: 56.4 ADE20K (Mask2Former), 83.3 Cityscapes (Mask2Former), 60.46 PASCAL-Context (DPT-Hybrid).

Vision Transformer (ViT) backbonesSemantic segmentationHierarchical vision transformersDice losssurveysemantic-segmentationvision-transformer

arXivPDFMarkdown9 min read

AI-compiled by claude-haiku-5-5 on 2026-11-05, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Image segmentation means labelling every pixel of a picture with what it shows, such as road, sky or building. For years this was done mostly with convolutional networks. The Vision Transformer, which first worked well on whole-image classification, was then adapted to this task. This survey walks through the Transformer models built for segmentation, explains how each one fixes the problems of a plain Transformer on pictures, and lists how well they score on three standard benchmark collections.

It also covers the practical side: the datasets, the loss functions used to train the models, and ways to cope when labelled images are scarce. Its main contribution is the side-by-side table of scores. The authors compile those scores from the original papers and do not run the models themselves.

TL;DR

This is a survey, not a method. It reviews Vision Transformer architectures for semantic segmentation, the datasets and loss functions used with them, and compiles mIoU results on ADE20K, Cityscapes and PASCAL-Context. The table mixes inference protocols and pre-training sets, so rankings across rows are not like-for-like. Use it to find candidate architectures and their reported numbers, then check the source paper.

Problem

Plain Vision Transformers (ViT) produce a single low-resolution feature map, which is poor for dense prediction such as segmentation and detection §1 §2.1. Convolutional networks, by contrast, produce a fixed-size output but capture long-range context poorly §2.1. The survey asks which Transformer designs fix this and how they compare on common benchmarks §1. It states that no earlier survey had compared segmentation models on several benchmarks to identify the best-performing model §1.

Dense prediction also has difficulties the survey lists: intra-class variation, context variation, occlusion and low image resolution §1. Labelled segmentation data is expensive, which the survey treats as a separate problem (data scarcity), addressed in §2.3 by self-supervised pre-training.

Method

This is a survey, so the "method" is its scope and organisation.

  1. Background: a ViT splits an image into patches and feeds them as tokens to a Transformer encoder, and self-attention cost grows with the square of the pixel count §2.1 fig. 1.
  2. Applications: remote sensing, medical imaging and video segmentation, each with its own challenges and example models §2.2 §2.2.1 §2.2.2 §2.2.3.
  3. Data scarcity: the survey describes supervised, transfer and self-supervised learning. It names three self-supervised families (generative, contrastive, and generative-contrastive/adversarial) and notes that segmentation is a common downstream task §2.3 fig. 2.
  4. Loss functions: cross-entropy, weighted cross-entropy, focal, Dice and IoU losses, and mean IoU as the evaluation average §2.4.
  5. Datasets: PASCAL-Context, ADE20K, KITTI, Cityscapes, IDD, Virtual KITTI and IDDA, summarised in tab. 1 §3.
  6. Models: one subsection per architecture (SETR, Swin, Segmenter, SegFormer, PVT v1 and v2, Twins, DPT, HRFormer, Mask2Former), each with its figure §4.1–§4.9, and the benchmark table tab. 2 §4.

The loss functions in §2.4 are the part an implementer can use directly. Written as pseudocode in our own words, from the equations in §2.4:

Pseudocode
# Dice loss for one binary mask  [§2.4, Dice eq.]
# Input:  probs (N,) foreground probabilities; target (N,) in {0, 1}
# Output: scalar
def dice_loss(probs, target, eps):
    # overlap term: sum over pixels of g_i * p_i  [§2.4, Dice eq.]
    overlap = sum(target * probs)
    # denominator: sum g_i + sum p_i + eps  [§2.4, Dice eq.]
    denom = sum(target) + sum(probs) + eps
    # loss = 1 - 2 * overlap / denom  [§2.4, Dice eq.]
    return 1 - 2 * overlap / denom
Pseudocode
# IoU (Jaccard) loss for one binary mask  [§2.4, IoU eq.]
# Input:  probs (N,); target (N,) in {0, 1}
# Output: scalar
def iou_loss(probs, target, eps):
    # intersection: sum g_i * p_i  [§2.4, IoU eq.]
    intersection = sum(target * probs)
    # union: sum g_i + sum p_i - intersection + eps  [§2.4, IoU eq.]
    union = sum(target) + sum(probs) - intersection + eps
    # loss = 1 - intersection / union  [§2.4, IoU eq.]
    return 1 - intersection / union
Pseudocode
# Mean IoU over classes  [§2.4]
# Input:  per_class_iou (C,) one IoU per class
# Output: scalar
def mean_iou(per_class_iou):
    # average of the per-class IoU values  [§2.4]
    return sum(per_class_iou) / len(per_class_iou)

Key equations, as written in §2.4:

CE(p, q) = -\sum_{i=1}^{n} p_i \log q_i \quad \text{[§2.4, cross-entropy eq.]}

F(p_t) = -\alpha_t (1 - p_t)^{\gamma} \log p_t \quad \text{[§2.4, focal eq.]}

D(g, p) = 1 - \frac{2 \sum_i g_i p_i}{\sum_i g_i + \sum_i p_i + \epsilon} \quad \text{[§2.4, Dice eq.]}

IoU(g, p) = 1 - \frac{\sum_i g_i p_i}{\sum_i g_i + \sum_i p_i - \sum_i g_i p_i + \epsilon} \quad \text{[§2.4, IoU eq.]}

Hyperparameters

The survey trains no models of its own, so it states no training hyperparameters. The benchmark table gives only the settings noted per row tab. 2.

NameValueWhereNotes
training setup of the surveynot stated§5no experiments of its own
focal loss α, γnot stated§2.4symbols only, no values
Dice / IoU εnot stated§2.4"small constant", no value
SETR (patch size, iterations)(16, 160k), (16, 80k), (16, 40k)tab. 2written as ρ and per-row notes
HRFormer OCRNet rows(7, 150k), (7, 80k), (7, 60k), (15, 80k)tab. 2pairs as printed; the first number is not defined in the survey (ρ footnote applies to one row)
PVT-Large*320k iterations, multi-scale flip testingtab. 2footnote *
pre-training setsImageNet-1K (†), ImageNet-21K (‡)tab. 2footnotes; other rows unlabelled
input resolution per benchmarknot stated§3tab. 1 gives image sizes only

Results

Author-reported, compiled by the survey from the original papers. The survey does not state how each number was obtained, and the source setups vary (see Pitfalls). Setup: mIoU (%) on ADE20K, Cityscapes and PASCAL-Context, with the SS / MS pair meaning single-scale and multi-scale inference tab. 2.

The dataset summary from tab. 1:

DatasetClassesSizeTrainValidationTestResolution (px)Category
PASCAL-Context54019740499851059637387 × 470No cross-domain
ADE20K150252102021020003000-No cross-domain
KITTI5252140-1121392 × 512No cross-domain
Cityscapes305K fine, 20K coarse297550015251024 × 2048Cross-domain
IDD34100047003100020011678 × 968Cross-domain
Virtual KITTI1421260---1242 × 375Synthetic
IDDA241M---1920 × 1080Synthetic

The full benchmark table tab. 2. Bold marks the best per model family and dataset, as in the source; the source's grey shading (the overall best per dataset) is shown in bold here. Footnotes: ρ patch size and iterations; ℵ single-scale only; § multi-scale only; † ImageNet-1K pre-training; ‡ ImageNet-21K pre-training; * 320k iterations with multi-scale flip testing.

ModelVariantBackbone#Params (M)ADE20KCityscapesPASCAL-Context
SETRSETR-Naïve (16, 160k) ρViT-L ‡305.6748.06 / 48.80--
SETRSETR-PUP (16, 160k)ViT-L ‡318.3148.58 / 50.09--
SETRSETR-MLA (16, 160k)ViT-L ‡310.5748.64 / 50.28--
SETRSETR-PUP (16, 40k)ViT-L ‡318.31-78.39 / 81.57-
SETRSETR-PUP (16, 80k)ViT-L ‡318.31-79.34 / 82.15-
SETRSETR-Naïve (16, 80k)ViT-L ‡305.67--52.89 / 53.61
SETRSETR-PUP (16, 80k)ViT-L ‡318.31--54.40 / 55.27
SETRSETR-MLA (16, 80k)ViT-L ‡310.57--54.87 / 55.83
Swin ℵSwin-TSwin-T6046.1--
Swin ℵSwin-SSwin-S8149.3--
Swin ℵSwin-BSwin-B ‡12151.6--
Swin ℵSwin-LSwin-L ‡23453.5--
Segmenter §Seg-BDeiT-B †8648.0580.553.9
Segmenter §Seg-B/MaskDeiT-B †8650.0880.655.0
Segmenter §Seg-LViT-L ‡30752.2580.756.5
Segmenter §Seg-L/MaskViT-L ‡30753.6381.359.0
SegFormerMiT-B0MiT-B0 †3.437.4 / 38.076.2 / 78.1-
SegFormerMiT-B1MiT-B1 †13.142.2 / 43.178.5 / 80.0-
SegFormerMiT-B2MiT-B2 †24.246.5 / 47.581.0 / 82.2-
SegFormerMiT-B3MiT-B3 †44.049.4 / 50.081.7 / 83.3-
SegFormerMiT-B4MiT-B4 †60.850.3 / 51.182.3 / 83.9-
SegFormerMiT-B5MiT-B5 †81.451.0 / 51.882.4 / 84.0-
PVT v1 ℵPVT-TinyPVT-Tiny ‡17.035.7--
PVT v1 ℵPVT-SmallPVT-Small ‡28.239.8--
PVT v1 ℵPVT-MediumPVT-Medium ‡48.041.6--
PVT v1 ℵPVT-LargePVT-Large ‡65.142.1--
PVT v1 ℵPVT-Large *PVT-Large ‡65.144.8--
PVT v2 ℵPVT v2-B0PVT v2-B0 ‡7.637.2--
PVT v2 ℵPVT v2-B1PVT v2-B1 ‡17.842.5--
PVT v2 ℵPVT v2-B2PVT v2-B2 ‡29.145.2--
PVT v2 ℵPVT v2-B3PVT v2-B3 ‡49.047.3--
PVT v2 ℵPVT v2-B4PVT v2-B4 ‡66.347.9--
PVT v2 ℵPVT v2-B5PVT v2-B5 ‡85.748.7--
TwinsTwins-PCPVT-STwins-PCPVT-S †54.646.2 / 47.5--
TwinsTwins-PCPVT-BTwins-PCPVT-B †74.347.1 / 48.4--
TwinsTwins-PCPVT-LTwins-PCPVT-L †91.548.6 / 49.8--
TwinsTwins-SVT-STwins-SVT-S †54.446.2 / 47.1--
TwinsTwins-SVT-BTwins-SVT-B †88.547.7 / 48.9--
TwinsTwins-SVT-LTwins-SVT-L †13348.8 / 50.2--
DPT §DPT-HybridViT-Hybrid ‡12349.02-60.46
DPT §DPT-LargeViT-L ‡34347.63--
HRFormerOCRNet (7, 150k) ρHRFormer-S13.544.0 / 45.1--
HRFormerOCRNet (7, 150k)HRFormer-B50.346.3 / 47.6--
HRFormerOCRNet (7, 80k)HRFormer-S13.5-80.0 / 81.0-
HRFormerOCRNet (7, 80k)HRFormer-B50.3-81.4 / 82.0-
HRFormerOCRNet (15, 80k)HRFormer-B50.3-81.9 / 82.657.6 / 58.5
HRFormerOCRNet (7, 60k)HRFormer-B50.3--56.3 / 57.1
HRFormerOCRNet (7, 60k)HRFormer-S13.5--53.8 / 54.6
Mask2FormerSwin-TSwin-T-47.7 / 49.6--
Mask2FormerSwin-LSwin-L ‡21656.1 / 57.3--
Mask2FormerSwin-L-FaPNSwin-L ‡-56.4 / 57.7--
Mask2FormerSwin-LSwin-L ‡216-83.3 / 84.3-
Mask2FormerSwin-BSwin-B ‡--83.3 / 84.5-

Reading the table: the introduction says the comparison should reveal the best patch size and iteration count per variant §1. The table varies these only for SETR and OCRNet-based HRFormer rows, and the survey does not analyse them.

Paper vs code

No official code. The paper is a survey and has no implementation to release. Checks: the LaTeX source contains no URL or repository link (the only URL is a template comment); no project page is linked; a GitHub repository search for "vision transformer semantic segmentation survey" returned zero results.

Pitfalls

  • Mixed protocols in the table. Rows differ in single-scale versus multi-scale inference (ℵ, §, SS / MS), in training length (for example PVT-Large* uses 320k iterations and flip testing tab. 2), and in pre-training data (ImageNet-1K † versus ImageNet-21K ‡). A row-to-row ranking is therefore not a like-for-like comparison. The survey does not normalise these.
  • Source of the numbers is not stated. The survey does not say whether each value was taken from the original paper or re-measured. Check the source paper before quoting a number.
  • Single-scale and multi-scale numbers come as pairs. Where the table shows two values, the first is single-scale and the second multi-scale tab. 2. Some rows have only one of them (see the footnote symbols).
  • Scores are from 2023. The card covers arXiv v1 (2023-05-05). Later models and benchmark results are not in it.
  • Loss constants are not given. The focal α and γ and the Dice/IoU ε are written as symbols only §2.4. Pick values from the source papers, not from this survey.
  • Cross-entropy averaging is implied, not written. The text says the loss is averaged over all pixels §2.4, but the equation shows a sum over classes for one pixel. The per-pixel averaging step is left to the implementer.
  • Unsupported comparative claims. The text says the Dice loss gives higher accuracy than cross-entropy, citing no result §2.4. It says SegFormer-B5 is "4× faster than SETR" §4.4, but tab. 2 has no runtime column and the survey gives no runtime figure.
  • Citation mismatches to check. A statement that Transformers are easy to train on large data cites a 1998 vanishing-gradient paper §2.1. A statement that plain ViTs lack segmentation heads cites the Efficient Transformer for remote sensing §2.2.1. Verify both against the original papers before using them.
  • Dataset class counts are as stated. Cityscapes is listed with 30 classes and IDD with 34 tab. 1. The survey does not say which label set these counts refer to.
  • Figures are third-party. Figures 1–13 are adapted from the original model papers fig. 1–fig. 13. They are not reproduced here; describe them from the source papers instead.

Lineage

  • Builds on: the survey cites earlier ViT and segmentation surveys (khan2022transformers, liu2023survey, han2022survey) as the work it extends §1. Their arXiv ids are not given in the paper.
  • Compared against: the same three surveys, which the paper says did not compare segmentation models across several benchmarks §1.
  • Superseded by: not known from content in this wiki.

Source and license

Adapted from “Semantic Segmentation using Vision Transformers: A survey” by Hans Thisanke, Chamli Deshan, Kavindu Chamith, Sachith Seneviratne, Rajith Vidanaarachchi, Damayanthi Herath (arXiv:2305.03273), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors.