计算机视觉之风格迁移(一)——CVPR2016论文Image Style Transfer复现

本文介绍了计算机视觉中的风格迁移技术,重点是复现CVPR2016论文《Image Style Transfer Using Convolutional Neural Networks》。内容包括风格迁移的基本概念、论文的关键点,如内容和风格的表示,以及使用VGG网络的代码复现过程,探讨了内容和风格的平衡对结果的影响,并分享了初步的实验结果和未来优化计划。
摘要由CSDN通过智能技术生成

一、风格迁移简介

风格迁移可以说是计算机视觉领域一大热点,简单来说就是有两副图片,一张内容图片 ,一张风格图片,该技术可以实现以风格图片的风格+内容图片的内容重新生成一张目标图片,例如:

内容图片 风格图片 目标图片

说到风格迁移,不得不提到该领域的经典论文:

【CVPR-2016】Image Style Transfer Using Convolutional Neural Networks

有很多小伙伴已经对论文进行过解析,本文就简单介绍一下该论文,主要聚焦在论文的代码复现上。

论文地址:https://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Gatys_Image_Style_Transfer_CVPR_2016_paper.pdf

二、论文简介

1.定睛之处

该论文之所以能够成功登上顶会,并且受到广大计算机视觉爱好者的推崇,最关键的一点就是——它证实了卷积神经网络可以将图像的内容和风格分离出来!!

如果说内容我们还可以勉强理解的话,那对于风格这个词就有点天方夜谭了。在现实中,我们可以说这个作家是抽象派,那个作家是抽象派,可以通过对画家作品的印象、直观感受进行区分。然而对于计算机而言,将画家的风格剥离出来貌似令人难以置信,该论文作者提出我们可以独立的操纵内容和风格来产生新的图像。

2.内容表示

该网络使用VGG19对图像进行特征提取,网络中的每一层都定义了一个非线性滤波器组(卷积),其复杂性随着该层在网络中的位置而增加,给定输入图像,每一层都会对其进行编码。

例如,在某l层有Nl个滤波器,则会产生Nl个大小为Ml的特征图,Ml为特征图的高×宽,所以在l层的响应可以存储在矩阵

当网络的处理层次逐渐加深时,网络中的较高层根据输入图像的排列来捕捉高级内容,但并不太注重精确像素值。相比之下,较低层的重建只是简单地再现原始图像的精确像素值,对于内容并不敏感。因此,我们将网络较高层中的特征响应称为内容表示。

低层的内容输出和高层的内容输出如下:

content_relu1_2 content_relu2_2 content_relu3_2 content_rel4_2 content_relu5_2
  • 15
    点赞
  • 76
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
Gatys et al. (2016) proposed an algorithm for style transfer, which can generate an image that combines the content of one image and the style of another image. The algorithm is based on the neural style transfer technique, which uses a pre-trained convolutional neural network (CNN) to extract the content and style features from the input images. In this algorithm, the content and style features are extracted from the content and style images respectively using the VGG-19 network. The content features are extracted from the output of one of the convolutional layers in the network, while the style features are extracted from the correlations between the feature maps of different layers. The Gram matrix is used to measure these correlations. The optimization process involves minimizing a loss function that consists of three components: the content loss, the style loss, and the total variation loss. The content loss measures the difference between the content features of the generated image and the content image. The style loss measures the difference between the style features of the generated image and the style image. The total variation loss is used to smooth the image and reduce noise. The optimization is performed using gradient descent, where the gradient of the loss function with respect to the generated image is computed and used to update the image. The process is repeated until the loss function converges. The code for this algorithm is available online, and it is implemented using the TensorFlow library. It involves loading the pre-trained VGG-19 network, extracting the content and style features, computing the loss function, and optimizing the generated image using gradient descent. The code also includes various parameters that can be adjusted, such as the weight of the content and style loss, the number of iterations, and the learning rate.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值