Skip to Content
Python迁移学习
book

Python迁移学习

by Posts & Telecom Press, Dipanjan Sarkar, Raghav Bali, Tamoghna Ghosh
May 2024
Intermediate to advanced
373 pages
6h 6m
Chinese
Packt Publishing
Content preview from Python迁移学习

第10章 风格迁移

绘画展现了一种内容与风格的复杂互动关系。而另一方面,照片是一种透视和光线的组合。当两者相结合时,产生的结果是壮观且充满惊喜的,这个过程被称为艺术风格迁移。图10.1所示为一个艺术风格迁移的例子,输入图像拍摄自位于德国蒂宾根的内卡河畔,而风格图像是凡·高的著名画作《星空》。产生的结果非常有趣,不是吗?

图片 1

图10.1

仔细观察图10.1,可以发现右边的绘画风格图像似乎从左边的照片中提取了内容,绘画的风格、颜色和笔画模式生成了最终的结果。这个迷人的结果是Gatys等人发表的一篇迁移学习算法论文的成果,论文名为A Neural Algorithm for Artistic Style。我们将从实现算法的角度来讨论这篇论文的复杂之处,并学习如何亲自实现这项技术。

本章将重点利用深度学习和迁移学习来构建一个神经风格迁移系统。本章的重点内容如下所示:

  • 理解神经风格迁移;
  • 图像预处理方法论;
  • 构建损失函数;
  • 构建一个自定义优化器;
  • 风格迁移实战。

本章内容包含与神经风格迁移、损失函数和优化方法相关的理论概念。除此之外,我们将使用一种实际操作方法来实现我们自己的神经风格迁移模型。本章中的代码可以在异步社区网站获取。

神经风格迁移是将参考图像的风格应用于特定的目标图像,而目标图像的原始内容保持不变的过程。此处风格指的是参考图像中出现的颜色、模式和纹理,而内容则被定义为目标图像的总体结构和高级组件。

在风格迁移中,主要目的是保留原始目标图像的内容,同时在目标图像上叠加或采用参考图像的风格。为了从数学的角度定义该概念,可以考虑3张图像:原始内容图像(表示为 ...

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

程序员学数据结构

程序员学数据结构

Posts & Telecom Press, William Smith
Python贝叶斯分析(第2版)

Python贝叶斯分析(第2版)

Posts & Telecom Press, Osvaldo Martin
金融中的人工智能

金融中的人工智能

Posts & Telecom Press, Jeffrey Ng, Subhash Shah
机器学习开发者指南

机器学习开发者指南

Posts & Telecom Press, Rodolfo Bonnin

Publisher Resources

ISBN: 9781836205418