# DeepDream

**DeepDream** 是一种计算机视觉技术和开源程序，由谷歌（Google）创造；它对输入图像执行梯度上升，以放大训练好的卷积神经网络中某一选定层的激活，从而生成充满幻觉、图案繁复的图像。它由谷歌工程师亚历山大·莫德温采夫（Alexander Mordvintsev）、克里斯托弗·奥拉（Christopher Olah）和迈克·蒂卡（Mike Tyka）创造，谷歌于 2015 年 7 月 1 日将其开源，形式是一个基于 Caffe 深度学习框架的 [IPython](https://www.edgepedia.org/zh/ipython) 笔记本。<sup>[1](https://research.google/blog/deepdream-a-code-example-for-visualizing-neural-networks/)</sup> 谷歌将其定位为一种可视化工具，用来理解神经网络在不同层“看到”什么，但它生成的图像很快本身就成了艺术现象。<sup>[2](https://blog.google/innovation-and-ai/products/understanding-inner-workings-neural-networks/)</sup>

| 关键事实 | 详情 |
|---|---|
| 创作者 | 谷歌（Google）的亚历山大·莫德温采夫（Alexander Mordvintsev，软件工程师）、克里斯托弗·奥拉（Christopher Olah，软件工程实习生）和迈克·蒂卡（Mike Tyka，软件工程师）<sup>[1](https://research.google/blog/deepdream-a-code-example-for-visualizing-neural-networks/)</sup> |
| 发布 | 2015 年 7 月 1 日开源，形式为基于 Caffe 框架的 IPython 笔记本<sup>[1](https://research.google/blog/deepdream-a-code-example-for-visualizing-neural-networks/)</sup> |
| 机制 | 对输入图像执行梯度上升，以最大化选定网络层激活的 L2 范数，并在称为八度的多个图像尺度上应用<sup>[3](https://www.cs.toronto.edu/~guerzhoy/321/tf_deepdream/)</sup><sup> • </sup><sup>[4](https://www.tensorflow.org/tutorials/generative/deepdream?authuser=80)</sup> |
| 声明目的 | 可视化深度神经网络模型在每一层学到了什么<sup>[5](https://research.google.com/teams/brain/music-and-art/)</sup> |
| 艺术展览 | 《DeepDream：神经网络的艺术》，由 Gray Area（格雷区）与谷歌于 2016 年 2 月在旧金山（San Francisco）呈现<sup>[6](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)</sup> |
| 遗产 | 启发了谷歌大脑（Google Brain）关于机器创造力的 Magenta 项目和 Lucid 可视化库<sup>[5](https://research.google.com/teams/brain/music-and-art/)</sup><sup> • </sup><sup>[2](https://blog.google/innovation-and-ai/products/understanding-inner-workings-neural-networks/)</sup> |

## 工作原理

DeepDream 把训练好的图像分类网络反过来使用。它不是调整网络的权重来识别图像，而是调整图像本身，执行梯度上升，以最大化某一特定层或单元对该输入的激活幅度。<sup>[3](https://www.cs.toronto.edu/~guerzhoy/321/tf_deepdream/)</sup> 图像被逐步改变，使网络已经在其中“看到”的东西得到增强，这一过程会重复数千次。<sup>[7](https://artsandculture.google.com/story/deepdream-the-art-of-neural-networks-gray-area/gAVBUUSCYZ_FNQ?hl=en)</sup>

**八度与技巧。** 在单一尺度上运行上升会生成噪声多、低分辨率的输出，图案都处于同一粒度。标准的补救办法是在多个尺度上应用梯度上升，这些尺度称为八度：在每次处理之间放大图像，使较小尺度上生成的图案被纳入较大尺度，并补充细节。<sup>[4](https://www.tensorflow.org/tutorials/generative/deepdream?authuser=80)</sup> 原始实现还使用了随机抖动（在每一步之前平移图像）和梯度步长归一化；对于非常大的图像，计算可以拆分为分块，并在每次分块计算前施加随机平移，以防止出现可见接缝。<sup>[3](https://www.cs.toronto.edu/~guerzhoy/321/tf_deepdream/)</sup><sup> • </sup><sup>[4](https://www.tensorflow.org/tutorials/generative/deepdream?authuser=80)</sup>

**为什么是狗。** 网络的训练集决定了输出中会出现什么。

## 起源与目的

这项技术源于谷歌理解自身模型的努力。2015 年 6 月，研究团队发布了一个可视化工具，旨在展示神经网络如何执行视觉分类任务，以及每一层学到了什么；用团队的话说，它作为副产品生成的图像奇异、奇妙，又莫名引人入胜。<sup>[6](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)</sup> 亚历山大·莫德温采夫进一步推进了这个想法：他把网络的功能从识别图像中有什么，翻转为生成图像，并增大激活向量的模，使网络对它感知到的任何东西都产出更多。<sup>[8](https://www.wired.com/2015/12/inside-deep-dreams-how-google-made-its-computers-go-crazy/)</sup> 他最初测试用的图像是一只猫和一只比格犬，结果变成他所说的“噩梦怪兽”：背景化为复杂的几何图案，还有蜘蛛破图而出。<sup>[9](https://thereader.mitpress.mit.edu/deepdream-how-alexander-mordvintsev-excavated-the-computers-hidden-layers/)</sup>

可视化博客文章发布两周后，谷歌将代码本身作为 IPython 笔记本发布，邀请用户提供图像、选择要增强的层、设置迭代次数，并接入不同的预训练网络。<sup>[1](https://research.google/blog/deepdream-a-code-example-for-visualizing-neural-networks/)</sup> 这次发布引起了程序员和艺术家的共同兴趣，谷歌还请在社交网络上分享结果的人加上 #deepdream 标签。<sup>[1](https://research.google/blog/deepdream-a-code-example-for-visualizing-neural-networks/)</sup>

## 艺术与文化影响

代码发布后，谷歌报告称，不仅机器学习社区，创意编程社区也表现出巨大兴趣；梅莫·阿克滕（Memo Akten）、萨米姆·维尼格（Samim Winiger）、凯尔·麦克唐纳（Kyle McDonald）和吉恩·科根（Gene Kogan）等艺术家立即开始尝试这项技术。<sup>[6](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)</sup> 2016 年 2 月，谷歌研究（Research at Google）与旧金山的格雷区艺术基金会（Gray Area Foundation for the Arts）联合主办了《DeepDream：神经网络的艺术》，展出了谷歌及世界各地艺术家的 29 件神经网络生成艺术作品，并举行拍卖以资助该基金会，同时举办为期一天的“艺术与机器学习研讨会”。<sup>[6](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)</sup> 谷歌艺术与文化（Google Arts & Culture）称，这是当代艺术机构首次展出由神经网络创作的艺术，共有 11 位艺术家和 30 多件作品参展。<sup>[7](https://artsandculture.google.com/story/deepdream-the-art-of-neural-networks-gray-area/gAVBUUSCYZ_FNQ?hl=en)</sup>

**展览中的技法。** 艺术家们对方法做了相当大的变化。迈克·蒂卡的《生物》系列针对 [GoogLeNet](https://www.edgepedia.org/zh/googlenet) 的高层使用迭代式 DeepDream 缩放，把网络中的动物和昆虫重新组合成想象中的生物；他的《乐器》系列对网络内部关于小提琴、萨克斯管和大提琴的表征进行类别可视化，再用风格迁移调整颜色和纹理。马里奥·克林格曼（Mario Klingemann）用类别可视化来突出人脸，并在《阿基米德原理》中从空白画布开始，反复修改图像，使单个目标神经元越来越激活，而其余神经元保持沉默；一个处于深层的活跃神经元会产生单一高层概念的图像。展览中提到的变体包括分形 DeepDream（Fractal DeepDream），其多尺度特性会产生令人联想到扫描电子显微镜的深度错觉。<sup>[7](https://artsandculture.google.com/story/deepdream-the-art-of-neural-networks-gray-area/gAVBUUSCYZ_FNQ?hl=en)</sup>

这些图像还让观察者觉得它们像人类的幻觉。[伦敦大学学院](https://www.edgepedia.org/zh/university-college-london)（University College London）神经科学教授[卡尔·弗里斯顿](https://www.edgepedia.org/zh/karl-friston)（Karl Friston）说，这些图像“非常像你会想象在迷幻药作用下或幻觉中看到的东西”。<sup>[8](https://www.wired.com/2015/12/inside-deep-dreams-how-google-made-its-computers-go-crazy/)</sup> 《MIT Press Reader》的一篇文章将这种效果与空想性错视联系起来——即人类倾向于在云朵或月亮中看出人脸——并指出莫德温采夫的算法生成的图像与 LSD 体验惊人地相似。<sup>[9](https://thereader.mitpress.mit.edu/deepdream-how-alexander-mordvintsev-excavated-the-computers-hidden-layers/)</sup>

## 与神经风格迁移的关系

DeepDream 之后不久，莱昂·加蒂斯（Leon Gatys）及其在图宾根（Tuebingen）的同事发表了《一种艺术风格的神经算法》，该文使用卷积神经网络将图像分解为独立的风格与内容成分，使新图像能够把一幅图像的风格与另一幅图像的内容结合起来。<sup>[6](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)</sup> 这两种技术不同但相关：DeepDream 增强网络已在图像中检测到的特征，而风格迁移则用另一幅图像的风格重新渲染一幅图像的内容；艺术家们将二者结合，用风格迁移调整 DeepDream 输出的颜色和纹理。<sup>[7](https://artsandculture.google.com/story/deepdream-the-art-of-neural-networks-gray-area/gAVBUUSCYZ_FNQ?hl=en)</sup> 开源社区很快在各种语言和深度学习包中实现了这两种技术。<sup>[6](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)</sup>

## 研究遗产

在谷歌，DeepDream 发展成了一个关于网络可解释性的更大研究计划。在此基础上发展的技术表明，网络在早期层检测边缘和纹理，在较晚层则推进到物体的局部和复杂结论；这一系列工作发表在在线期刊《Distill》上，谷歌还开源了 Lucid 神经网络可视化库，让其他人也能制作这类可视化。<sup>[2](https://blog.google/innovation-and-ai/products/understanding-inner-workings-neural-networks/)</sup> 谷歌大脑（Google Brain）团队还启动了 Magenta 项目，在音乐、视频、图像和文本生成中回应“机器能有创造力吗？”这一问题，并明确表示其灵感来自 DeepDream。<sup>[5](https://research.google.com/teams/brain/music-and-art/)</sup>

此后，这项技术的解释价值受到了质疑。罗伯特·盖尔霍斯（Robert Geirhos）、罗兰·S·齐默尔曼（Roland S. Zimmermann）、布莱尔·比洛多（Blair Bilodeau）、维兰德·布伦德尔（Wieland Brendel）和比恩·金（Been Kim）在 2024 年 ICML（国际机器学习大会）的一篇论文中表明，网络回路能欺骗特征可视化，使其显示与正常网络行为无关的任意图案，并证明特征可视化能够可靠理解的函数集合极其狭小，且不包括黑箱神经网络。<sup>[10](https://deepmind.google/research/publications/49869/)</sup> 在艺术史领域，艾米莉·L·斯普拉特（Emily L. Spratt）2018 年的研究将 DeepDream 与 Grad-CAM 并用，主张艺术史与计算机视觉在解释机器学习生成的图像方面重新展开合作。<sup>[11](https://arxiv.org/abs/1802.01274)</sup>

DeepDream 仍可通过标准框架供实践者使用：TensorFlow 的官方教程实现了基于八度的梯度上升流程，TensorFlow Lucid 项目则将底层思想扩展到神经元级可视化。<sup>[4](https://www.tensorflow.org/tutorials/generative/deepdream?authuser=80)</sup>

## References

1. [Alexander Mordvintsev, Christopher Olah, and Mike Tyka (July 1, 2015). DeepDream - a code example for visualizing Neural Networks. Google Research Blog.](https://research.google/blog/deepdream-a-code-example-for-visualizing-neural-networks/)
2. [Chris Olah (March 12, 2018). Understanding the inner workings of neural networks. Google Blog.](https://blog.google/innovation-and-ai/products/understanding-inner-workings-neural-networks/)
3. [Producing dreams (tf_deepdream), University of Toronto CSC321 course notes.](https://www.cs.toronto.edu/~guerzhoy/321/tf_deepdream/)
4. [DeepDream. TensorFlow Core tutorial.](https://www.tensorflow.org/tutorials/generative/deepdream?authuser=80)
5. [Music and Art Generation. Research at Google.](https://research.google.com/teams/brain/music-and-art/)
6. [Mike Tyka (February 22, 2016). Exploring the Intersection of Art and Machine Intelligence. Google Research Blog.](https://research.google/blog/exploring-the-intersection-of-art-and-machine-intelligence/?m=1)
7. [DeepDream: The art of neural networks. Google Arts & Culture / Gray Area.](https://artsandculture.google.com/story/deepdream-the-art-of-neural-networks-gray-area/gAVBUUSCYZ_FNQ?hl=en)
8. [Inside Deep Dreams: How Google Made Its Computers Go Crazy. WIRED, December 2015.](https://www.wired.com/2015/12/inside-deep-dreams-how-google-made-its-computers-go-crazy/)
9. [DeepDream: How Alexander Mordvintsev Excavated the Computer's Hidden Layers. The MIT Press Reader.](https://thereader.mitpress.mit.edu/deepdream-how-alexander-mordvintsev-excavated-the-computers-hidden-layers/)
10. [Geirhos, Robert, Zimmermann, Roland S., Bilodeau, Blair, Brendel, Wieland, and Kim, Been (2024). Don't trust your eyes: on the (un)reliability of feature visualizations. ICML 2024 / Google DeepMind.](https://deepmind.google/research/publications/49869/)
11. [Emily L. Spratt (2018). Dream Formulations and Deep Neural Networks: Humanistic Themes in the Iconology of the Machine-Learned Image. arXiv.](https://arxiv.org/abs/1802.01274)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 19, 2026; Oct 15, 2026 · Edited: Sep 19, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Language and vision AI › Computer vision › Vision datasets, software, and community › CV software and toolkits

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/deepdream

English original: https://www.edgepedia.org/deepdream
