CN110660018B - 一种面向图像的非均匀风格迁移方法 - Google Patents

一种面向图像的非均匀风格迁移方法 Download PDF

Info

Publication number
CN110660018B
CN110660018B CN201910860104.2A CN201910860104A CN110660018B CN 110660018 B CN110660018 B CN 110660018B CN 201910860104 A CN201910860104 A CN 201910860104A CN 110660018 B CN110660018 B CN 110660018B
Authority
CN
China
Prior art keywords
style
image
content
stylization
loss function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910860104.2A
Other languages
English (en)
Other versions
CN110660018A (zh
Inventor
任桐炜
武港山
刘星宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University
Original Assignee
Nanjing University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University filed Critical Nanjing University
Publication of CN110660018A publication Critical patent/CN110660018A/zh
Application granted granted Critical
Publication of CN110660018B publication Critical patent/CN110660018B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/46Descriptors for shape, contour or point-related descriptors, e.g. scale invariant feature transform [SIFT] or bags of words [BoW]; Salient regional features
    • G06V10/462Salient features, e.g. scale invariant feature transforms [SIFT]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Image Processing (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

一种面向图像的非均匀风格迁移方法,在图像中,检测各个像素的显著性,根据各个像素的显著性采用不同的风格化程度,生成非均匀的图像风格迁移结果。本发明首先对于输入的内容图像的每个像素自动计算显著性,进而设定每个像素的风格化程度,然后分特征图计算风格迁移中的内容损失和风格损失,最小化风格迁移的总损失,生成非均匀的风格迁移结果。本发明解决了图像风格迁移中过度风格化或风格化不足的问题,实现了在突出显著区域内容的同时强烈渲染不显眼区域的风格,在风格化的过程中更好的平衡风格化图像的内容保持程度和风格渲染程度。

Description

一种面向图像的非均匀风格迁移方法
技术领域
本发明属于计算机图像技术领域,涉及针对图像的风格迁移方法,具体为一种面向图像的非均匀风格迁移方法。
背景技术
图像风格迁移是指参照给定图像的风格,对另一幅图像进行渲染,使得生成与给定图的风格一致的风格化图像。其中,被风格化的图像称为内容图像,作为风格的图像称为风格图像,图像风格迁移生成的结果称为风格化图像。图像风格迁移可以帮助人们轻松地编辑图像,快速取得所需的图像编辑效果。
早期的图像风格迁移工作通过根据相似性度量对像素或图像块进行采样来合成新的图像,以此实现简单的风格化效果(如参考文献3、6)。但由于这些方法缺少图像的语义表示,无法有效地从图像内容中分离出风格,所以迁移结果的图像质量并不是很高,无法达到预期的风格化效果。近年来,随着卷积神经网络在图像处理中的应用逐步推广,一些学者将卷积神经网络用于图像风格迁移,这类方法可以很好的提取出参考图像的风格和输入图像的内容并将他们融合起来,提供高质量的风格化结果(如参考文献1)。
图像风格迁移中一个关键问题是如何平衡图像内容保持程度和风格渲染程度。现在的图像风格化方法均使用相同的参数设置进行风格化,易使结果过度风格化或者风格化不足,即风格化结果中难以辨别原图像的内容或者难以感受到风格的影响,如图2所示,图2(a)为原视频的视频帧取样,图2(b)显示了过度风格化结果,图2(c)显示了风格化不足的结果,图2(d)为期待的风格化结果。很多情况下,难以选择一个合适的全局参数实现风格化,总是不可避免的会过度风格化或风格化不足。
目前,仅有少量研究工作对非均匀风格化进行了尝试,例如对人脸部分特殊处理(参考文献4),或者对位于不同景深的区域采用不同风格化程度加以区分(参考文献5)。但这些方法只是割裂的考虑图像中特定内容的风格化,而没有关注图像整体的过度风格化和风格化不足的问题。
本发明所涉及的面向图像的非均匀风格迁移方法,提供了一种针对过度风格化或者风格化不足问题的解决方案,实现了在图像中对不同区域采用不同的风格化程度,生成非均匀的风格迁移结果。
发明内容
本发明要解决的问题是:解决图像风格迁移过程中可能产生的过度风格化或风格化不足的问题,目的是平衡风格化图像的内容保持程度和风格渲染程度。
本发明的技术方案为:一种面向图像的非均匀风格迁移方法,在图像中,检测各个像素的显著性,根据各个像素的显著性采用不同的风格化程度,生成非均匀的图像风格迁移结果。
本发明具体包括以下步骤:
1)对于输入的内容图像,自动求取各个像素的显著性,并根据显著性为每个像素设定风格化程度;
2)对于输入的内容图像,将其表示为一层或多层特征图,同时采用相同的方法将风格图像表示为一层或多层特征图,计算对应层的特征图在风格迁移中的内容损失函数和风格损失函数;
3)将内容损失函数和风格损失函数相融合,得到风格迁移总损失函数;
4)最小化风格迁移总损失函数,生成风格迁移结果。
本发明的有益效果是:提供了一种解决图像风格迁移中过度风格化或风格化不足问题的方案,实现了在突出显著区域内容的同时强烈渲染不显眼区域的风格,在风格化的过程中更好的平衡风格化图像的内容保持程度和风格渲染程度。本方法具有良好的广泛性与实用性。
附图说明
图1为本发明的实施流程。
图2为风格化效果展示,(a)为原图像,图2(b)显示了过度风格化结果,图2(c)显示了风格化不足的结果,图2(d)为期待的风格化结果。
图3为本发明结果与现有代表性方法结果的比较示例。
具体实施方式
本发明提出了一种面向图像的非均匀风格迁移方法,如图1所示,包括以下步骤:
本发明具体包括以下步骤:
1)对于输入的内容图像,自动求取各个像素的显著性,并根据显著性为每个像素设定风格化程度。
1.1)自动求取各个像素的显著性,将像素Pij的显著性值设为其初始风格化程度ωij
1.2)对风格化程度ωij其进行线性变换操作,使其值域变成[α,β]的二维矩阵,α默认是0.05,β默认是0.95,防止出现极限大或极限小的情况。
2)对于内容图像和风格图像,将它们表示为多层特征图,并计算风格迁移中的内容损失和风格损失:
2.1)将内容图像、风格图像和随机生成的初始化图像分别作为卷积神经网络的输入,其中随机生成的初始化图像作为风格图像的初始值,使用VGG-19神经网络中relu1_1,relu2_1,relu3_1,relu4_1层提取多层特征图;
2.2)对风格化程度ωij,在relu1_1,relu2_1,relu3_1,relu4_1每层上分别调整其大小至内容图像在对应层的特征图的宽高,形成四个新的二维矩阵。然后每层分别对二维矩阵进行累叠、复制并产生与内容图像在对应卷积层特征图相同个数的四组新矩阵,每组将组内矩阵合并成三维显著区域矩阵,产生四个三维显著区域矩阵,分别对应着relu1_1,relu2_1,relu3_1,relu4_1。
2.3)计算风格迁移中的内容损失和风格损失如下:
其中Fl、Al、Xl分别是内容图像、风格图像、风格化图像的第l层特征图,Ml×Nl表示特征图在第l层的大小,Ωl是由各个像素的风格化程度组成的矩阵调整大小后在第l层上的结果,即三维显著区域矩阵,G(·)表示基于Gram matrix的特征相关性,λl代表每层风格损失占比权重,默认是1。L表示特征图层数,默认值为4。
3)将内容损失和风格损失相融合,计算风格迁移中的总损失:
Ltotal=αLcontentLstyle
其中,α,β分别是对应的内容损失和风格损失的权重参数。
4)最小化风格迁移总损失函数,生成风格迁移结果。
本发明实施在从互联网搜集的图像集上,与现有代表性的方法进行了比较。图3所示为本发明结果和其他方法结果的比较示例,其中图3(a)为内容图像,图3(b)为风格图像,图3(e)为本发明结果。参与比较的代表性方法,图3(c)-(d))分别为:Gatys方法(参考文献1),Johnson方法(参考文献2)。实验结果表明,Gatys方法和Johnson方法所生成的风格化图像中物体与背景相混淆,难以从风格化图像观察到图像内容。本发明生成的风格化图像较好地平衡了图像内容保存与风格样式呈现,在图像实现风格化的同时不影响对原来图像内容的理解。
参考文献:
1.Leon A.Gatys,Alexander S.Ecker,and Matthias Bethge.Image styletransfer using convolutional neural networks.IEEE International Conference onComputer Vision and Pattern Recognition,2414–2423,2016.
2.Justin Johnson,Alexandre Alahi,and Li Fei-Fei.Perceptual losses forreal-time style transfer and super-resolution.European Conference on ComputerVision,2016.
3.Vivek Kwatra,Irfan Essa,Aaron Bobick,and Nipun Kwatra.TextureOptimization for Example-based Synthesis.ACM International Conference onComputer Graphics and Interactive Techniques,795–802,2005.
4.Shaohua Li,Xinxing Xu,Liqiang Nie,and Tatseng Chua.Laplacian-steered neural style transfer.ACM Conference on Multimedia,2017.
5.Xiaochang Liu,Mingming Cheng,Yukun Lai,and Paul L Rosin.Depth-awareneural style transfer.Symposium on Non-Photorealistic Animation andRendering,2017.
6.Li-Yi Wei and Marc Levoy.Fast texture synthesis using tree-structured vector quantization.ACM International Conference on ComputerGraphics and Interactive Techniques,479–488,2000.

Claims (3)

1.一种面向图像的非均匀风格迁移方法,其特征是在图像中,检测各个像素的显著性,根据各个像素的显著性采用不同的风格化程度,生成非均匀的图像风格迁移结果,包括以下步骤:
1)对于输入的内容图像,自动求取各个像素的显著性,并根据显著性为每个像素设定风格化程度;
2)对于输入的内容图像,将其表示为一层或多层特征图,同时采用相同的方法将风格图像表示为一层或多层特征图,计算对应层的特征图在风格迁移中的内容损失函数和风格损失函数;所述的风格迁移中内容损失函数Lcontent和风格损失函数Lstyle为:
其中,Fl、Al、Xl分别表示内容图像、风格图像、风格化图像的第l层特征图,Ml×Nl表示特征图在第l层的大小,Ωl是由各个像素的风格化程度组成的矩阵调整大小后在第l层上的结果,G(·)表示基于Gram matrix的特征相关性,λl代表每层风格损失占比权重,L表示特征图层数;
3)将内容损失函数和风格损失函数相融合,得到风格迁移总损失函数;
4)最小化风格迁移总损失函数,生成风格迁移结果。
2.根据权利要求1所述的一种面向图像的非均匀风格迁移方法,其特征是λl默认为1,L默认值为4。
3.根据权利要求1所述的一种面向图像的非均匀风格迁移方法,其特征是风格迁移总损失函数Ltotal为:
Ltotal=αLcontent+βLstyle
其中,α,β分别是对应的内容损失函数Lcontent和风格损失函数Lstyle的权重参数。
CN201910860104.2A 2018-09-13 2019-09-11 一种面向图像的非均匀风格迁移方法 Active CN110660018B (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811068809 2018-09-13
CN2018110688092 2018-09-13

Publications (2)

Publication Number Publication Date
CN110660018A CN110660018A (zh) 2020-01-07
CN110660018B true CN110660018B (zh) 2023-10-17

Family

ID=69038158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910860104.2A Active CN110660018B (zh) 2018-09-13 2019-09-11 一种面向图像的非均匀风格迁移方法

Country Status (1)

Country Link
CN (1) CN110660018B (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113052757A (zh) * 2021-03-08 2021-06-29 Oppo广东移动通信有限公司 图像处理方法、装置、终端及存储介质
CN114266943A (zh) * 2021-12-28 2022-04-01 中移(杭州)信息技术有限公司 图像风格迁移方法、装置、设备及存储介质
CN115631091B (zh) * 2022-12-23 2023-03-21 南方科技大学 一种选择性风格迁移方法及终端

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705242A (zh) * 2017-07-20 2018-02-16 广东工业大学 一种结合深度学习与深度感知的图像风格化迁移方法

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107705242A (zh) * 2017-07-20 2018-02-16 广东工业大学 一种结合深度学习与深度感知的图像风格化迁移方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Image Style Transfer Using Convolutional Neural Networks;Leon A. Gatys等;《2016 IEEE Conference on Computer Vision and Pattern Recognition》;20161231;第2414-2423页 *
StyleBank: An Explicit Representation for Neural Image Style Transfer;Chen D D 等;《2017 IEEE Conference on Computer Vision and Pattern Recognition》;20170728;第2770-2779页 *

Also Published As

Publication number Publication date
CN110660018A (zh) 2020-01-07

Similar Documents

Publication Publication Date Title
Hou et al. Context-aware image matting for simultaneous foreground and alpha estimation
Guo et al. LIME: Low-light image enhancement via illumination map estimation
Frühstück et al. Tilegan: synthesis of large-scale non-homogeneous textures
CN110660018B (zh) 一种面向图像的非均匀风格迁移方法
CN102800094A (zh) 一种快速彩色图像分割方法
CN110706151B (zh) 一种面向视频的非均匀风格迁移方法
Li et al. Globally and locally semantic colorization via exemplar-based broad-GAN
CN110782419B (zh) 一种基于图形处理器的三维人脸融合方法及系统
CN109272568B (zh) 一种采用基元发现的人脸风格图像处理方法
Fan et al. Stereoscopic image retargeting based on deep convolutional neural network
Zhang et al. Imageadmixture: Putting together dissimilar objects from groups
Wang et al. Unsupervised deep exemplar colorization via pyramid dual non-local attention
Zhao et al. Structure-aware nonlocal optimization framework for image colorization
Xu et al. Artistic color virtual reality implementation based on similarity image restoration
Jin et al. CWAN: Self-supervised learning for deep grape disease image composition
Wu et al. Color transfer with salient features mapping via attention maps between images
Ye et al. Hybrid scheme of image’s regional colorization using mask r-cnn and Poisson editing
Ayubi et al. A new seam carving method for image resizing based on entropy energy and lyapunov exponent
Liu et al. Palette-based recoloring of natural images under different illumination
Jin et al. SRNPD: Spatial rendering network for pencil drawing stylization
Zhang et al. Image copy-and-paste with optimized gradient
Grogan et al. Image Decomposition using Geometric Region Colour Unmixing
Cui et al. Towards natural object-based image recoloring
Jetchev et al. Copy the Old or Paint Anew? An Adversarial Framework for (non-) Parametric Image Stylization
Wang et al. Enhanced use of mattes for easy image composition

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant