Abstract
We propose spatially-adaptive normalization, a simple but effective layer for synthesizing photorealistic images given an input semantic layout. Previous methods directly feed the semantic layout as input to the deep network, which is then processed through stacks of convolution, normalization, and nonlinearity layers. We show that this is suboptimal as the normalization layers tend to ``wash away’’ semantic information. To address the issue, we propose using the input layout for modulating the activations in normalization layers through a spatially-adaptive, learned transformation. Experiments on several challenging datasets demonstrate the advantage of the proposed method over existing approaches, regarding both visual fidelity and alignment with input layouts. Finally, our model allows user control over both semantic and style. Code is available at \url{https://github.com/NVlabs/SPADE}
我们提出了空间自适应归一化,一个简单但有效的层合成真实感图像给定一个输入语义布局。以前的方法直接将语义布局作为输入输入到深度网络,然后通过卷积、归一化和非线性层堆栈处理深度网络。我们表明,这是次优的,因为规范化层倾向于“洗去”语义信息这与我观察到的结果是一致的,带有复杂和大量规范化操作的结构不适合做回归。为了解决这个问题,我们建议使用输入布局来通过一个空间自适应的、学习的转换来调节规范化层中的激活。在几个具有挑战性的数据集上进行的实验表明,在视觉逼真度和输入布局对齐方面,本文提出的方法优于现有的方法。最后,我们的模型允许用户控制语义和样式。代码可在\url{https://github.com/NVlabs/SPADE}
\section{Introduction}
Conditional image synthesis refers to the task of generating photorealistic images conditioning on certain input data. Seminal work computes the output image by stitching pieces from a single image (e.g., Image Analogies~\cite{hertzmann2001image}) or using an image collection ~\cite{johnson2006semantic,hays2007scene,lalonde2007photo,chen2009sketch2photo,Eitz:2009:PhotoSketch}. Recent methods directly learn the mapping using neural networks~\cite{isola2017image,chen2017photographic,wang2018pix2pixHD,wang2018video,zhang2017stackgan,zhang2017stackgan++,zhang2018self,brock2018large}. The latter methods are faster and require no external database of images.
条件图像合成是指对一定的输入数据进行条件处理,生成逼真的图像。重要的工作是通过将单个图像的片段拼接来计算输出图像(例如,image ies~ cite{hertzmann2001image}),或者使用一个图像集合~ cite{johnson2006semantic,hays2007scene,lalonde2007photo,chen2009sketch2photo,Eitz:2009:PhotoSketch}。最近的方法使用神经网络直接学习映射~\cite{isola2017image,chen2017photographic,wang2018pix2pixHD,wang2018video,zhang2017stackgan,zhang2017stackgan++,zhang2018self,brock2018large}。后一种方法更快,不需要外部的图像数据库。
差不多可以使用了
We are interested in a specific form of conditional image synthesis, which is converting a semantic segmentation mask to a photorealistic image. This form has a wide range of applications such as content generation and image editing~\cite{isola2017image,chen2017photographic,wang2018pix2pixHD}. We refer to this form as semantic image synthesis. In this paper, we show that the conventional network architecture~\cite{isola2017image,wang2018pix2pixHD}, which is built by stacking convolutional, normalization, and nonlinearity layers, is at best suboptimal because their normalization layers tend to ``wash away’’ information contained in the input semantic masks. To address the issue, we propose \textit{spatially-adaptive normalization}, a conditional normalization layer that modulates the activations using input semantic layouts through a spatially-adaptive, learned transformation and can effectively propagate the semantic information throughout the network.
我们感兴趣的是一种特殊形式的条件图像合成,它是将语义分割蒙版转换为逼真的图像。此表单具有广泛的应用,如内容生成和图像编辑~\cite{isola2017image,chen2017photographic,wang2018pix2pixHD}。我们将这种形式称为语义图像合成。在本文中,我们证明了传统的网络结构~\cite{isola2017image,wang2018pix2pixHD}是由卷积、归一化和非线性层叠加而成的,它在最好的情况下是次优的,因为它们的归一化层往往会“洗去”输入语义掩码中包含的信息。为了解决这一问题,我们提出了一种条件归一化层(textit{spatial -adaptive normalization}),该层通过空间自适应、学习转换来调节使用输入语义布局的激活,并能有效地在整个网络中传播语义信息。
We conduct experiments on several challenging datasets including the COCO-Stuff~\cite{caesar2018coco,lin2014microsoft}, the ADE20K~\cite{zhou2017scene}, and the Cityscapes~\cite{cordts2016cityscapes}. We show that with the help of our spatially-adaptive normalization layer, a compact network can synthesize significantly better results compared to several state-of-the-art methods. Additionally, an extensive ablation study demonstrates the effectiveness of the proposed normalization layer against several variants for the semantic image synthesis task. Finally, our method supports multi-modal and style-guided image synthesis, enabling controllable, diverse outputs, as shown in Figure~\ref{fig::teaser}. Also, please see our SIGGRAPH 2019 Real-Time Live \href{https://www.youtube.com/watch?v=Gz9weuemhDA&feature=youtu.be&t=2949}{demo} and try our online \href{https://github.com/NVlabs/SPADE}{demo} by yourself.
我们在几个具有挑战性的数据集上进行了实验,包括COCO-Stuff~ cite{caesar2018coco,lin2014microsoft}, ADE20K~ cite{zhou2017scene}和citylandscapes ~ cite{cordts2016citylandscapes}。我们表明,在我们的空间自适应归一化层的帮助下,一个紧凑的网络可以合成明显更好的结果,相比于几种最先进的方法。此外,一项广泛的消融研究证明了所提出的归一层对于语义图像合成任务的有效性。最后,我们的方法支持多模态和样式引导的图像合成,可以实现可控的、多样的输出,如图~\ref{fig::teaser}所示。此外,请查看我们的SIGGRAPH 2019 Real-Time Live \href{https://www.youtube.com/watch?v=Gz9weuemhDA&feature=youtu.be&t=2949}{demo},并尝试我们的在线\href{https://github.com/NVlabs/SPADE}{demo}自己。
\section{Related Work}
\mysubsection{Deep generative models} can learn to synthesize images. Recent methods include generative adversarial networks (GANs)~\cite{goodfellow2014generative} and variational autoencoder (VAE)~\cite{kingma2013auto}. Our work is built on GANs but aims for the conditional image synthesis task. The GANs consist of a generator and a discriminator where the goal of the generator is to produce realistic images so that the discriminator cannot tell the synthesized images apart from the real ones.
mysubch {Deep generative models}可以学习合成图像。最近的方法包括生成对抗网络(gan)~引用{goodfellow2014生成}和变分自动编码器(VAE)~引用{kingma2013auto}。我们的工作建立在GANs上,但目标是有条件的图像合成任务。该gan由一个生成器和一个鉴别器组成,其目标是生成真实的图像,从而使鉴别器无法区分合成的图像和真实的图像。
\mysubsection{Conditional image synthesis} exists in many forms that differ in the type of input data. For example, class-conditional models~\cite{odena2016conditional,miyato2018cgans,mescheder2018training,brock2018large,mirza2014conditional} learn to synthesize images given category labels. Researchers have explored various models for generating images based on text ~\cite{reed2016generative,zhang2017stackgan,xu2017attngan,hong2018inferring}. Another widely-used form is image-to-image translation based on a type of conditional GANs ~\cite{karacan2016learning,isola2017image,zhu2017unpaired,liu2017unsupervised,zhu2017toward,huang2018multimodal,Zhao2018layout,karacan2018manipulating}, where both input and output are images. Compared to earlier non-parametric methods~\cite{hertzmann2001image,johnson2006semantic,chen2009sketch2photo}, learning-based methods typically run faster during test time and produce more realistic results. In this work, we focus on converting segmentation masks to photorealistic images. We assume the training dataset contains registered segmentation masks and images. With the proposed spatially-adaptive normalization, our compact network achieves better results compared to leading methods.
mysubar{条件图像合成}以多种形式存在,不同的输入数据类型。例如,类条件模型~\cite{odena2016conditional,miyato2018cgans,mescheder2018training,brock2018large,mirza2014conditional}学习合成给定类别标签的图像。研究人员已经探索了各种基于文本生成图像的模型~\cite{reed2016generative,zhang2017stackgan,xu2017attngan,hong2018inferring}。另一种广泛使用的形式是基于一种条件GANs的图像到图像的翻译~\引用{karacan2016learning,isola2017image,zhu2017unpaired,liu2017unsupervised,zhu2017toward,huang2018multimodal,Zhao2018layout,karacan2018},其中输入和输出都是图像。与早期的非参数方法相比~\引用{hertzmann2001 - image,johnson2006semantic,chen2009sketch2photo},基于学习的方法通常在测试期间运行更快,产生更真实的结果。在这项工作中,我们专注于转换分割蒙版到逼真的图像。我们假设训练数据集包含注册的分割掩码和图像。通过提出的空间自适应归一化,我们的紧凑网络取得了比现有方法更好的结果。
\mysubsection{Unconditional normalization layers} have been an important component in modern deep networks and can be found in various classifiers, including the Local Response Normalization in the AlexNet~\cite{krizhevsky2012imagenet} and the Batch Normalization (BatchNorm) in the Inception-v2 network~\cite{ioffe2015batch}. Other popular normalization layers include the Instance Normalization (InstanceNorm)~\cite{ulyanov1607instance}, the Layer Normalization~\cite{ba2016layer}, the Group Normalization~\cite{wu2018group}, and the Weight Normalization~\cite{salimans2016weight}. We label these normalization layers as unconditional as they do not depend on external data in contrast to the conditional normalization layers discussed below.
mysub{无条件归一化层}已经成为现代深度网络的重要组成部分,可以在各种分类器中找到,包括AlexNet~引用{krizhevsky2012imagenet}中的局部响应归一化和incep -v2网络~引用{ioffe2015batch}中的批处理归一化(BatchNorm)。其他流行的归一化层包括实例归一化(InstanceNorm)~引用{ulyanov1607instance},层归一化~引用{ba2016layer},组归一化~引用{wu2018group},权重归一化~引用{salimans2016weight}。与下面讨论的条件归一化层相比,我们将这些归一化层标记为无条件的,因为它们不依赖外部数据。
\mysubsection{Conditional normalization layers} include the Conditional Batch Normalization (Conditional BatchNorm)~\cite{dumoulin2016learned} and Adaptive Instance Normalization (AdaIN)~\cite{huang2017adain}. Both were first used in the style transfer task and later adopted in various vision tasks~\cite{de2017modulating,perez2017learning,huang2018multimodal,miyato2018cgans,zhang2018self,mescheder2018training,wang2018recovering,chen2018on,brock2018large,karras2018style}. Different from the earlier normalization techniques, conditional normalization layers require external data and generally operate as follows. First, layer activations are normalized to zero mean and unit deviation. Then the normalized activations are \textit{denormalized} by modulating the activation using a learned affine transformation whose parameters are inferred from external data.
my小节{条件归一化层}包括条件批处理归一化(Conditional BatchNorm)~\引用{dumoulin2016learned}和自适应实例归一化(AdaIN)~\引用{huang2017adain}。这两种方法首先被用于风格传递任务,后来又被用于各种视觉任务~\引用{de2017modulating,perez2017learning,huang2018multimodal,miyato2018 - cgans,zhang2018self,mescheder2018 - training,wang2018recovering,chen2018on,brock2018 - large,karras2018 - style}。与早期的规范化技术不同,条件规范化层需要外部数据,一般操作如下。首先,将层激活归一化为零均值和单位偏差。然后,通过使用从外部数据推断出参数的仿射变换调制激活,规范化激活被\textit{去规范化}。
For style transfer tasks~\cite{dumoulin2016learned,huang2017adain}, the affine parameters are used to control the global style of the output, and hence are uniform across spatial coordinates. In contrast, our proposed normalization layer applies a spatially-varying affine transformation, making it suitable for image synthesis from semantic masks. Wang~\etal proposed a closely related method for image super-resolution~\cite{wang2018recovering}. Both methods are built on spatially-adaptive modulation layers that condition on semantic inputs. While they aim to incorporate semantic information into super-resolution, our goal is to design a generator for style and semantics disentanglement. We focus on providing the semantic information in the context of modulating normalized activations. We use semantic maps in different scales, which enables coarse-to-fine generation. The reader is encouraged to review their work for more details.
对于风格传递任务~\引用{dumoulin2016learned,huang2017adain},仿射参数用于控制输出的全局风格,因此在空间坐标上是一致的。相比之下,我们提出的归一化层应用了空间变化的仿射变换,使其适合于从语义蒙版合成图像。Wang etal提出了一种与之密切相关的图像超分辨率恢复方法。这两种方法都建立在以语义输入为条件的空间自适应调制层上。他们的目标是将语义信息整合到超分辨率中,而我们的目标是设计一个用于风格和语义分解的生成器。我们的重点是在调节规范化激活的上下文中提供语义信息。我们在不同的尺度上使用语义映射,从而实现从粗到细的生成。鼓励读者回顾他们的工作以获得更多的细节。
启发式的纹理迁移要强调不需要训练
\section{Semantic Image Synthesis}\label{sec::body}
Let $\mathbf{m} \in \mathbb{L}^{H\times W}$ be a semantic segmentation mask where $\mathbb{L}$ is a set of integers denoting the semantic labels, and $H$ and $W$ are the image height and width. Each entry in $\mathbf{m}$ denotes the semantic label of a pixel. We aim to learn a mapping function that can convert an input segmentation mask $\mathbf{m}$ to a photorealistic image.
设\mathbb{L}^{H\乘以W}$中的$ mathbf{m} \为语义分割蒙版,其中$ mathbb{L}$是表示语义标签的一组整数,$H$和$W$为图像的高度和宽度。$\mathbf{m}$中的每个条目表示像素的语义标签。我们的目标是学习一个映射函数,可以将输入分割掩码$ mathbf{m}$转换为逼真的图像。
