Skip to Content
基于scikit-learn和PyTorch的实践机器学习
book

基于scikit-learn和PyTorch的实践机器学习

by Aurélien Géron
October 2025
Intermediate to advanced
878 pages
12h 53m
Chinese
O'Reilly Media, Inc.
Content preview from 基于scikit-learn和PyTorch的实践机器学习

第 12 章 使用卷积神经网络的深度计算机视觉 使用卷积神经网络的深度计算机视觉

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

虽然 IBM 的 "深蓝 "超级计算机早在 1996 年就击败了国际象棋世界冠军加里-卡斯帕罗夫(Garry Kasparov),但直到最近,计算机才能够可靠地执行看似琐碎的任务,例如检测图片中的小狗或识别口语。为什么这些任务对我们人类来说如此轻而易举?答案在于,感知主要发生在我们的意识之外,发生在我们大脑中专门的视觉、听觉和其他感官模块中。例如,当你看到一张可爱小狗的照片时,你无法选择不去看小狗,不去注意它的可爱。你也无法解释自己是如何认出可爱的小狗的,它对你来说就是显而易见的。因此,我们不能相信我们的主观经验:感知根本不是小事,要理解它,我们必须研究我们的感官模块是如何工作的。

卷积神经网络(CNN) ,它产生于对大脑视觉皮层的研究,自 20 世纪 80 年代起就被用于计算机图像识别。在过去的 15 年中,得益于计算能力的提升、可用训练数据量的增加,以及第 11 章中介绍的训练深度网络的技巧,卷积神经网络在一些复杂的视觉任务中取得了超人的表现。它们为图像搜索服务、自动驾驶汽车、自动视频分类系统等提供了动力。此外,CNN 并不局限于视觉感知:它们在语音识别和自然语言处理等许多其他任务上也取得了成功。不过,我们现在将重点关注视觉应用。

在本章中,我们将探讨 CNN 的来源、其构建模块的样子以及如何使用 PyTorch 实现它们。然后,我们将讨论一些最好的 CNN 架构,以及其他视觉任务,包括对象检测(对图像中的多个对象进行分类,并在其周围放置有界框)和语义分割(根据对象所属的类别对每个像素进行分类)。

视觉皮层的结构

1958 年和1959年,David H. Hubel 和 Torsten Wiesel 在猫身上进行了一系列实验 1和1959 年2(几年后又在猴子身上进行了实验3他们对视觉皮层的结构提出了重要见解(1981 年,两位作者因此获得诺贝尔生理学或医学奖)。特别是,他们发现视觉皮层 中的许多神经元具有较小的局部感受野,这意味着它们只对位于视野有限区域内的视觉刺激做出反应(见图 12-1,图中五个神经元的局部感受野用虚线圆圈表示)。不同神经元的感受野可能会重叠,共同覆盖整个视野。

Diagram illustrating how biological neurons in the visual cortex respond to specific patterns within small receptive fields and integrate this information to recognize complex shapes like a house.
图 12-1. 视觉皮层中的生物神经元会对视野中称为感受野的小区域中的特定模式做出反应;当视觉信号通过连续的大脑模块时,神经元会对更大感受野中更复杂的模式做出反应

此外,作者还发现,有些神经元只对水平线的图像有反应,而有些神经元则只对不同方向的线有反应(两个神经元可能有相同的感受野,但对不同方向的线有反应)。他们还注意到,有些神经元的感受野较大,它们对更复杂的图案有反应,这些图案是低级图案的组合。这些观察结果让他们想到,高层神经元是基于相邻低层神经元的输出(在图 12-1 中,请注意每个神经元只与上一层的相邻神经元相连)。这种强大的结构能够检测到视野中任何区域的各种复杂模式。

对视觉皮层的这些研究启发了新认知电子系统(neocognitron)。41980年推出的新认知神经网络的灵感,它逐渐发展成为我们现在所说的卷积神经网络。一个重要的里程碑是1998 年5该论文介绍了著名的 ...

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

编写整洁的Python代码(第2版)

编写整洁的Python代码(第2版)

Posts & Telecom Press, Mariano Anaya
生成式人工智能可视化

生成式人工智能可视化

Priyanka Vergadia, Valliappa Lakshmanan
AI工程

AI工程

Chip Huyen

Publisher Resources

ISBN: 0642572270117