Skip to Content
变形金刚权威指南 (Chinese Edition)
book

变形金刚权威指南 (Chinese Edition)

by Nicole Koenigstein
March 2026
Intermediate
372 pages
4h 53m
Chinese
O'Reilly Media, Inc.
Content preview from 变形金刚权威指南 (Chinese Edition)

第3章. 用于视觉任务的Transformer

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

该领域中Transformer模型的一大优势 在于其少样本和零样本学习能力。 图像标注成本高昂,且往往缺乏足够的标注数据,癌症检测便是如此。拥有一个仅凭少量样本就能表现优异的图像分类或分割模型,将是一次重大的飞跃。这使得Transformer在数据稀缺性成为关键问题的任务中尤为宝贵——而这正是基于传统卷积神经网络(CNN) 的模型常常力不从心的挑战。

Transformer 显然已彻底革新了自然语言处理(NLP)领域。接下来,Transformer 正在进军视觉任务领域。视觉 Transformer(ViT)1 是展示Transformer在计算机视觉中全部潜力的里程碑。

在接下来的章节中,我将向您展示如何利用 Transformer 处理分类、图像分割、实例分割和全景分割等视觉任务。我将解释您可能遇到的挑战,说明在处理图像时如何缓解这些问题,以及如何监控模型的训练过程。

此外,我还将探讨不同损失函数对结果质量的影响。例如,在医学影像领域,复合损失函数通常最为稳健,因为它们更适合处理高度不平衡的分割任务。这种对损失函数的精心选择可以显著提升模型性能,特别是在癌症检测等关键应用中。

不同视觉任务概述

在视觉领域,有几个关键区别对于理解计算机视觉中的各种应用和技术至关重要。在本节中,我将区分最常用的几种任务:分类、图像分割、实例分割和全景分割。在后续章节中,我将探讨目标检测、姿态估计、图像描述和视觉问答,因为这些任务更适合视频和多模态Transformer模型的场景:

分类

分类( )是指预测图像中对象所属类别或类别的过程。该任务涉及根据图像中占主导地位的对象或特征,为整张图像分配标签。例如,在动物图像数据集中,分类模型可能会将每张图像归类为“猫”、“狗”、“鸟”等。此处的主要目标是识别对象的整体,而不考虑其位置或具体部位。

语义图像分割

语义图像分割( )则更进一步,将图像划分为多个片段或区域,每个片段代表不同的物体。这种方法将图像中的每个像素归类到特定类别中。例如,在一张街道场景的图像中,像素可能被分类为“道路”、“汽车”、“行人”或“建筑物”。其主要目标是在像素级别理解图像,其中每个片段代表一个类别标签。

实例分割

这种图像分割()方法则更进一步,不仅将图像划分为多个片段或区域,甚至将图像中物体的不同部分也区分开来。也就是说,实例分割能够区分同一类别中的不同物体。在上述街道场景的例子中,实例分割不仅会将像素标记为“汽车”,还会区分出每辆具体的汽车。通过识别物体的独立实例,这种方法能提供对图像更详细的理解。

全景分割

全景分割(Panoptic segmentation)结合了实例分割和语义图像分割,从而对图像提供全面的理解。它不仅为图像中的每个像素标注对象类别(例如“汽车”、“道路”、“行人”),还能区分这些对象的不同实例。这种方法对场景进行了详细的分割,既能捕捉对象,又能连贯地识别其各个实例。图 3-1突出了语义图像分割、实例分割和全景分割之间的差异。

Three images comparing segmentation types: the left shows semantic image segmentation with uniform coloring for objects, the middle shows instance segmentation with distinct coloring for individual objects, and the right shows panoptic segmentation combining both methods for a detailed scene understanding.
图 3-1。左图 展示了语义图像分割,中图展示了实例分割,右图展示了全景分割,后者将这两种分割方式清晰地融合为一种综合方法。 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

LLM 网格 (Chinese Edition)

LLM 网格 (Chinese Edition)

Kurt Muehmel

Publisher Resources

ISBN: 0642572364274