吴恩达深度学习4-Week4课后作业2-Neural Style Transfer

本文介绍了神经风格迁移算法,通过该算法可以融合两张图片的风格,形成独特的艺术图像。文章详细阐述了算法步骤,包括计算内容损失、风格损失以及整体损失,并提供了相关代码实现。
摘要由CSDN通过智能技术生成

一、Deeplearning-assignment

在本节的学习中,我们将学习神经风格迁移(Neural Style Transfer)算法,通过该算法使得两张不同风格的图片融合成一张图片。

问题描述:神经风格迁移算法是深度学习中的一种有趣的技术。正如下面的图片所示,算法将两种图片的风格特点融合在了一起。

神经风格迁移:运用了一个预训练的卷积神经网络,这种将一个任务的特点运用到另一个任务的想法叫做迁移学习。

建立NST的三个步骤:

计算content的损失:

计算style的损失:

style矩阵:

定义整体的损失,并优化:

创建一个函数,用来使content损失和style损失最小化:

神经风格迁移算法总体流程:

  1. Create an Interactive Session
  2. Load the content image
  3. Load the style image
  4. Randomly initialize the image to be generated
  5. Load the VGG16 model
  6. Build the TensorFlow graph:
    • Run the content image through the VGG16 model and compute the content cost
    • Run the style image through the VGG16 model and compute the style cost
    • Compute the total cost
    • Define the optimizer and the learning rate
  7. Initialize the
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值