# 语义分割

语义分割是一项计算机视觉任务，其目标是确定图像中每个像素所属的语义类别。<sup>[1](https://ar5iv.labs.arxiv.org/html/2302.06378)</sup> Mask2Former 等掩码分类模型以统一的范式处理实例分割、语义分割和全景分割，预测一组掩码及对应的标签。<sup>[2](https://par.nsf.gov/servlets/purl/10345853)</sup>

| 关键事实 | 数值 |
|---|---|
| 输出 | 每个像素一个类别标签；推理时取每个像素上响应最大的通道<sup>[3](https://www.tensorflow.org/tutorials/images/segmentation)</sup> |
| 奠基性深度学习成果 | FCN，在 PASCAL VOC 2012 上平均 IU 达 62.2%（相对提升 20%），每张图像推理时间不到五分之一秒<sup>[4](https://openaccess.thecvf.com/content_cvpr_2015/html/Long_Fully_Convolutional_Networks_2015_CVPR_paper.html)</sup> |
| 经典 CNN 时代基准 | DeepLab，在 PASCAL VOC-2012 测试集上 mIoU 达 79.7%；PSPNet，在 PASCAL VOC 2012 上达 85.4%，在 Cityscapes 上达 80.2%<sup>[5](https://doi.org/10.1109/tpami.2017.2699184)</sup><sup> • </sup><sup>[6](https://link.springer.com/article/10.1007/s10462-018-9641-3)</sup> |
| Transformer 时代基准 | SegFormer-B5，在 Cityscapes 验证集上 mIoU 达 84.0%，在 ADE20K 上达 51.8%；Mask2Former（Swin-L），在 ADE20K 上 mIoU 达 57.7<sup>[7](https://arxiv.org/abs/2105.15203)</sup><sup> • </sup><sup>[2](https://par.nsf.gov/servlets/purl/10345853)</sup> |
| 可提示基础模型 | SAM 在来自 1100 万张图像的 10 亿个掩码上训练；SAM 2 在单块 A100 上以 43.8 或 30.2 FPS 运行<sup>[8](https://arxiv.org/html/2408.12957v3)</sup><sup> • </sup><sup>[9](https://doi.org/10.48550/arxiv.2408.00714)</sup> |
| 主要指标 | mIoU，即各类别 IoU = TP / (TP + FP + FN) 的均值<sup>[10](https://www.ipol.im/pub/art/2023/447/article.pdf)</sup> |

## 工作原理

语义分割网络将输入图像映射为空间尺寸相同的逐像素类别概率图。全卷积网络（FCN）的核心思想是用卷积替换全连接层，使网络能够接受任意尺寸的输入并产生相应尺寸的稠密输出；网络内上采样使用反卷积（分数步长卷积，即以因子 \( f \) 上采样等同于输入步长为 \( 1/f \) 的卷积），初始化为双线性核但可学习。<sup>[4](https://openaccess.thecvf.com/content_cvpr_2015/html/Long_Fully_Convolutional_Networks_2015_CVPR_paper.html)</sup> 由于反复池化会缩小输出，跳跃架构将深层粗粒度的语义信息与浅层细粒度的外观信息融合，相比单流 FCN-32s 将验证集平均 IU 提升了 3.0 个点。<sup>[4](https://openaccess.thecvf.com/content_cvpr_2015/html/Long_Fully_Convolutional_Networks_2015_CVPR_paper.html)</sup>

训练采用带损失函数的逐像素分类。最常见的选择是逐像素交叉熵；U-Net 计算逐像素 softmax 并结合加权交叉熵，\( E = \sum_{x} w(x) \log\big(p_{\ell(x)}(x)\big) \)，其中权重图用于补偿类别频率并迫使网络学习相互接触细胞之间的分离边界。<sup>[1](https://ar5iv.labs.arxiv.org/html/2302.06378)</sup><sup> • </sup><sup>[11](https://doi.org/10.48550/arxiv.1505.04597)</sup> 针对强烈的前景/背景不平衡，V-Net 引入了基于 Dice 系数的损失。<sup>[12](https://web.cs.ucla.edu/~dt/papers/pami22/pami22.pdf)</sup> 掩码分类模型则预测一组掩码，损失为 \( L_{\mathrm{mask}} = \lambda_{\mathrm{ce}} \cdot L_{\mathrm{ce}} + \lambda_{\mathrm{dice}} \cdot L_{\mathrm{dice}} \)，其中 \( \lambda_{\mathrm{ce}} = 5.0 \)，\( \lambda_{\mathrm{dice}} = 5.0 \)。<sup>[2](https://par.nsf.gov/servlets/purl/10345853)</sup>

## 实施方法

从业者首先需要获取像素级标注，这是该任务的主要瓶颈，因为人工标注极其繁琐耗时；一些项目转而利用图形平台和游戏引擎生成合成标注数据。<sup>[1](https://ar5iv.labs.arxiv.org/html/2302.06378)</sup> 数据增强很重要：U-Net 的作者发现随机弹性形变是在极少标注图像下训练的关键概念。<sup>[11](https://doi.org/10.48550/arxiv.1505.04597)</sup> 典型的现代训练方案（SegFormer）使用 [AdamW](https://www.edgepedia.org/zh/adamw) 优化器，在 ADE20K 和 Cityscapes 上训练 160K 次迭代，批大小为 16，初始学习率为 0.00006，采用 poly 调度策略。<sup>[7](https://arxiv.org/abs/2105.15203)</sup> 推理时，分配给每个像素的标签是响应值最高的通道。<sup>[3](https://www.tensorflow.org/tutorials/images/segmentation)</sup>

评估使用各类别 \( \mathrm{IoU}_{i} = \mathrm{TP}_{i} / (\mathrm{TP}_{i} + \mathrm{FP}_{i} + \mathrm{FN}_{i}) \) 的均值，这是最常用的质量指标；Dice 以及在医学场景中的 Hausdorff 距离也很常见，顶级医学模型通常结合 Dice 和交叉熵损失。<sup>[10](https://www.ipol.im/pub/art/2023/447/article.pdf)</sup><sup> • </sup><sup>[13](https://arxiv.org/html/2312.05391v1)</sup>

## 起源

在深度学习之前，最先进的方法将问题解耦为三个组件：局部外观模型、局部一致性模型和全局一致性模型。<sup>[14](https://dl.acm.org/doi/10.1007/s11263-010-0344-8)</sup> TextonBoost（ECCV 2006）通过学习 texton 字典、使用共享提升进行分类、并在[条件随机场](https://www.edgepedia.org/zh/conditional-random-field)中用 alpha 扩展图割算法寻找最优标注，分割了 21 个类别。<sup>[15](https://www.johnwinn.org/Publications/papers/TextonBoost_ECCV2006.pdf)</sup> 早期的深度学习前驱工作应用多尺度卷积网络为每个像素产生类别标签，并在超像素上使用 CRF 或基于类别分布熵的多级割进行后处理。<sup>[16](http://yann.lecun.com/exdb/publis/pdf/farabet-pami-13.pdf)</sup> R-CNN 确立了监督预训练后接领域特定微调的范式，在区域提议上使用 CNN 特征。<sup>[17](https://www.cv-foundation.org/openaccess/content_cvpr_2014/papers/Girshick_Rich_Feature_Hierarchies_2014_CVPR_paper.pdf)</sup>

奠基性的深度学习成果是 Evan Shelhamer、Jonathan Long 和 [Trevor Darrell](https://www.edgepedia.org/zh/trevor-darrell) 的全卷积网络（2016 年，[IEEE Transactions on Pattern Analysis and Machine Intelligence](https://www.edgepedia.org/zh/ieee-transactions-on-pattern-analysis-and-machine-intelligence)），其 CVPR 2015 论文指出：“据我们所知，这是首个端到端训练 FCN 的工作，（1）用于逐像素预测，（2）基于监督预训练。”<sup>[4](https://openaccess.thecvf.com/content_cvpr_2015/html/Long_Fully_Convolutional_Networks_2015_CVPR_paper.html)</sup><sup> • </sup><sup>[18](https://doi.org/10.1109/tpami.2016.2572683)</sup>

## 变体

**编码器-解码器 CNN。** U-Net（Ronneberger、Fischer、Brox，2015）将捕获上下文的收缩路径与用于精确定位的对称扩张路径配对，使用与裁剪后的收缩路径特征拼接的上卷积；它以大幅优势赢得了 ISBI 细胞追踪挑战赛 2015。<sup>[11](https://doi.org/10.48550/arxiv.1505.04597)</sup> DeConvNet（Noh、Hong、Han，2015）在 VGG-16 编码器上增加了带反卷积和反池化层的多层反卷积网络。<sup>[19](https://doi.org/10.48550/arxiv.1505.04366)</sup> SegNet 的解码器利用对应编码器中记忆的最大池化索引进行上采样，在 CamVid、KITTI 和 NYU 上达到了当时最先进的场景结果。<sup>[20](https://arxiv.org/pdf/1505.07293)</sup>

**多尺度上下文。** [DeepLab](https://www.edgepedia.org/zh/deeplab)（Chen、Papandreou、Kokkinos、Murphy、Yuille；TPAMI 2017）将空洞卷积（在不增加参数的情况下扩大滤波器视野）与用于多尺度物体的空洞空间金字塔池化（ASPP）以及全连接 CRF 后处理相结合，在 [PASCAL VOC](https://www.edgepedia.org/zh/pascal-voc)-2012 测试集上达到 79.7% mIoU。<sup>[5](https://doi.org/10.1109/tpami.2017.2699184)</sup> PSPNet 增加了金字塔池化模块，报告在 PASCAL VOC 2012 上 mIoU 达 85.4%，在 Cityscapes 上达 80.2%。<sup>[6](https://link.springer.com/article/10.1007/s10462-018-9641-3)</sup>

**Transformer 与掩码分类。** SegFormer 使用带相对[位置编码](https://www.edgepedia.org/zh/position-encoding)的层次化 Transformer 骨干，将注意力复杂度从 \( O((HW)^{2}) \) 降至 \( O((HW/R)^{2}) \)；SegFormer-B5 在 ADE20K 上达到 51.8%，在 Cityscapes 验证集上达到 84.0%。<sup>[7](https://arxiv.org/abs/2105.15203)</sup> MaskFormer（Cheng、Schwing、Kirillov，2021）主张逐像素分类并非全部所需，转而预测一组带标签的掩码；Mask2Former（2021）增加了掩码注意力和多尺度可变形注意力像素解码器，以单一架构在 ADE20K 上达到 57.7 mIoU。<sup>[21](https://doi.org/10.48550/arxiv.2107.06278)</sup><sup> • </sup><sup>[2](https://par.nsf.gov/servlets/purl/10345853)</sup>

**可提示与开放词汇模型。** SAM 在来自 1100 万张图像的 10 亿个掩码上训练，采用可提示分割任务，展现出零样本泛化能力，但其沉重的图像编码器计算开销很大。<sup>[8](https://arxiv.org/html/2408.12957v3)</sup> SAM 2（Ravi 等人，2024）将可提示分割扩展到视频，使用基于 MAE 预训练 Hiera 编码器构建的流式记忆 Transformer；在图像上它比 SAM 更准确且快 6 倍。<sup>[9](https://doi.org/10.48550/arxiv.2408.00714)</sup> 开放词汇分割去除了固定类别列表：OVSeg 在挖掘的掩码区域/描述名词对上微调 CLIP，CAT-Seg 聚合图像与文本嵌入之间的余弦相似度代价体，PixelCLIP 利用无标注图像以及来自 SAM 和 DINO 的掩码来适配 CLIP。<sup>[22](https://arxiv.org/pdf/2210.04150)</sup><sup> • </sup><sup>[23](https://openaccess.thecvf.com/content/CVPR2024/papers/Cho_CAT-Seg_Cost_Aggregation_for_Open-Vocabulary_Semantic_Segmentation_CVPR_2024_paper.pdf)</sup><sup> • </sup><sup>[24](https://papers.nips.cc/paper_files/paper/2024/file/1119587863e78451f080da2a768c4935-Paper-Conference.pdf)</sup>

## 应用

综述文献记录了在医学图像分析、自动驾驶和遥感中的部署，以及领域特定的架构家族：医学变体包括 U-Net、UNet++、V-Net、Ce-Net 和 nnU-Net，遥感变体包括 ResUNet-a、ABCNet 和 Sdfcnv2。<sup>[25](https://dl.acm.org/doi/10.1007/s42979-025-04436-w)</sup> 在医学成像中，U-Net 为生物显微成像而构建，在 30 张透射光显微镜图像上训练，V-Net 则面向 3D 医学分割。<sup>[12](https://web.cs.ucla.edu/~dt/papers/pami22/pami22.pdf)</sup> 城市街景模型在 Cityscapes 上评估，该数据集包含 30 个类别的 5000 张精细标注图像。<sup>[13](https://arxiv.org/html/2312.05391v1)</sup>

## 局限与替代方案

**边界模糊与结构失败。** 交替的卷积和池化对输出进行下采样，因此 FCN 的直接预测分辨率较低，物体边界相对模糊。<sup>[26](https://link.springer.com/article/10.1007/s13735-017-0141-z)</sup> 现代技术也容易在恢复细连接、复杂结构元素、精确定位边界和正确图像拓扑方面失败。<sup>[13](https://arxiv.org/html/2312.05391v1)</sup> 传统 FCN 在实时推理时计算开销大，不能有效利用全局上下文，也不易泛化到 3D。<sup>[12](https://web.cs.ucla.edu/~dt/papers/pami22/pami22.pdf)</sup>

**数据成本与监督。** 逐像素标注是主要瓶颈，最佳方法需要庞大的标注数据集；边界框弱监督在相同训练流程下达到了全监督模型约 95% 的质量，而仅使用图像级标签则不够。<sup>[1](https://ar5iv.labs.arxiv.org/html/2302.06378)</sup><sup> • </sup><sup>[26](https://link.springer.com/article/10.1007/s13735-017-0141-z)</sup>

**经典替代方案。** 深度学习之前的流程使用 CRF、图割、[随机森林](https://www.edgepedia.org/zh/random-forest)和 SVM，基于 CRF 的方法在 CNN 取代它们之前达到了 PASCAL VOC 2010 的顶级性能。<sup>[15](https://www.johnwinn.org/Publications/papers/TextonBoost_ECCV2006.pdf)</sup><sup> • </sup><sup>[27](https://arxiv.org/pdf/1602.06541)</sup> DeepLab 在 CNN 之上保留了稠密 CRF 作为边界细化后处理。<sup>[5](https://doi.org/10.1109/tpami.2017.2699184)</sup> 与语义分割固定的封闭词汇表相比，SAM 等可提示模型按需生成类别无关的掩码，通用掩码分类模型则以单一架构处理语义、实例和全景任务。<sup>[8](https://arxiv.org/html/2408.12957v3)</sup><sup> • </sup><sup>[2](https://par.nsf.gov/servlets/purl/10345853)</sup>

## References

1. [Semantic Image Segmentation: Two Decades of Research](https://ar5iv.labs.arxiv.org/html/2302.06378)
2. [Masked-attention Mask Transformer for Universal Image Segmentation (Mask2Former, CVPR 2022)](https://par.nsf.gov/servlets/purl/10345853)
3. [Image segmentation | TensorFlow Core](https://www.tensorflow.org/tutorials/images/segmentation)
4. [Fully Convolutional Networks for Semantic Segmentation (CVPR 2015)](https://openaccess.thecvf.com/content_cvpr_2015/html/Long_Fully_Convolutional_Networks_2015_CVPR_paper.html)
5. [Liang-Chieh Chen and colleagues (2017). DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs. IEEE Transactions on Pattern Analysis and Machine Intelligence.](https://doi.org/10.1109/tpami.2017.2699184)
6. [Recent progress in semantic image segmentation (Artificial Intelligence Review)](https://link.springer.com/article/10.1007/s10462-018-9641-3)
7. [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers (NeurIPS 2021)](https://arxiv.org/abs/2105.15203)
8. [Image Segmentation in Foundation Model Era: A Survey](https://arxiv.org/html/2408.12957v3)
9. [Ravi, Nikhila and colleagues (2024). SAM 2: Segment Anything in Images and Videos. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2408.00714)
10. [Semantic Segmentation: A Zoology of Deep Architectures (IPOL)](https://www.ipol.im/pub/art/2023/447/article.pdf)
11. [Ronneberger, Olaf, Fischer, Philipp, Brox, Thomas (2015). U-Net: Convolutional Networks for Biomedical Image Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1505.04597)
12. [Image Segmentation Using Deep Learning: A Survey (IEEE TPAMI)](https://web.cs.ucla.edu/~dt/papers/pami22/pami22.pdf)
13. [Loss Functions in the Era of Semantic Segmentation: A Survey and Outlook](https://arxiv.org/html/2312.05391v1)
14. [An Efficient Approach to Semantic Segmentation (Csurka & Perronnin, IJCV 2011)](https://dl.acm.org/doi/10.1007/s11263-010-0344-8)
15. [TextonBoost: Joint Appearance, Shape and Context Modeling for Multi-Class Object Recognition and Segmentation (ECCV 2006)](https://www.johnwinn.org/Publications/papers/TextonBoost_ECCV2006.pdf)
16. [Learning Hierarchical Features for Scene Labeling (Farabet et al., PAMI 2013)](http://yann.lecun.com/exdb/publis/pdf/farabet-pami-13.pdf)
17. [Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation (R-CNN, CVPR 2014)](https://www.cv-foundation.org/openaccess/content_cvpr_2014/papers/Girshick_Rich_Feature_Hierarchies_2014_CVPR_paper.pdf)
18. [Evan Shelhamer, Jonathan Long, Trevor Darrell (2016). Fully Convolutional Networks for Semantic Segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence.](https://doi.org/10.1109/tpami.2016.2572683)
19. [Noh, Hyeonwoo, Hong, Seunghoon, Han, Bohyung (2015). Learning Deconvolution Network for Semantic Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1505.04366)
20. [SegNet: A Deep Convolutional Encoder-Decoder Architecture for Robust Semantic Pixel-Wise Labelling](https://arxiv.org/pdf/1505.07293)
21. [Cheng, Bowen, Schwing, Alexander G., Kirillov, Alexander (2021). Per-Pixel Classification is Not All You Need for Semantic Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2107.06278)
22. [Open-Vocabulary Semantic Segmentation with Mask Adapted CLIP (OVSeg)](https://arxiv.org/pdf/2210.04150)
23. [CAT-Seg: Cost Aggregation for Open-Vocabulary Semantic Segmentation (CVPR 2024)](https://openaccess.thecvf.com/content/CVPR2024/papers/Cho_CAT-Seg_Cost_Aggregation_for_Open-Vocabulary_Semantic_Segmentation_CVPR_2024_paper.pdf)
24. [Towards Open-Vocabulary Semantic Segmentation Without Semantic Labels (PixelCLIP, NeurIPS 2024)](https://papers.nips.cc/paper_files/paper/2024/file/1119587863e78451f080da2a768c4935-Paper-Conference.pdf)
25. [A Comprehensive Investigation into Semantic Segmentation and its Applications (SN Computer Science)](https://dl.acm.org/doi/10.1007/s42979-025-04436-w)
26. [A review of semantic segmentation using deep neural networks (IJMIR)](https://link.springer.com/article/10.1007/s13735-017-0141-z)
27. [Semantic Segmentation: A Survey of Methods (Thoma)](https://arxiv.org/pdf/1602.06541)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Oct 15, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Language and vision AI › Computer vision › Vision methods and geometry › Low-level image analysis

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/semantic-segmentation

English original: https://www.edgepedia.org/semantic-segmentation
