Abstract
We investigate the problem of zero-shot semantic image painting. Instead of painting modifications into an image using only concrete colors or a finite set of semantic concepts, we ask how to create semantic paint based on open full-text descriptions: our goal is to be able to point to a location in a synthesized image and apply an arbitrary new concept such as rustic'' oropulent’’ or ``happy dog.’’ To do this, our method combines a state-of-the art generative model of realistic images with a state-of-the-art text-image semantic similarity network. We find that, to make large changes, it is important to use non-gradient methods to explore latent space, and it is important to relax the computations of the GAN to target changes to a specific region. We conduct user studies to compare our methods to several baselines.
研究了零镜头语义图像绘制问题。而不是绘画只使用混凝土颜色修改成一个图像或一组有限的语义概念,我们问如何创建语义涂料基于开放全文描述:我们的目标是能够指出一个位置在图像合成和应用任意新概念,如“乡村”或“华丽的”或“快乐的狗。“为了做到这一点,我们的方法结合了现实图像的最先进的生成模型和最先进的文本图像语义相似度网络。我们发现,为了实现较大的变化,重要的是使用非梯度方法来探索潜在空间,重要的是放松GAN的计算,以目标区域的变化。我们进行用户研究,将我们的方法与几个基线进行比较。
\section{Introduction}
A writer can create vivid verbal imagery using just a few carefully-chosen words, but written scenes are abstract, without any specific physical form.
In this paper, we ask how to enable an artist to use words to build an image concretely, painting textually described visual concepts at specific locations in a scene. Our work is inspired and enabled by recent dramatic progress in text-to-image generation~\cite{razavi2019generating,radford2021learning}. %
However, rather than having the AI compose the whole image, we ask how large models can be used collaboratively to let a person apply words as a paintbrush. We wish to enable a user to paint brushstrokes on specific objects and regions within a generated image, then restyle, alter, or insert new objects by describing the desired visual concept with words.
作家可以用一些精心挑选的词汇创造出生动的语言意象,但写作场景是抽象的,没有任何具体的物理形式。
在这篇文章中,我们探讨了如何使一个艺术家能够使用文字具体地构建一个图像,在一个场景中特定的位置用文字描述视觉概念。我们的工作受到最近在文本到图像生成方面取得的巨大进展的启发和支持~引用{razavi2019generating,radford2021learning}。%
然而,我们的问题不是让人工智能组成整个图像,而是如何通过协作使用大型模型来让人们将文字作为画笔使用。我们希望用户能够在生成的图像中的特定对象和区域上绘制画笔,然后通过使用文字描述所需的视觉概念来重新设计、修改或插入新的对象。
The current work introduces the problem of zero-shot semantic image manipulation, in which the words and painting gestures available to the user are unconstrained and unknown ahead of time during model training. Our goal is to enable a user to point an image and apply an arbitrary new concept that may include visual concepts as wide-ranging as rustic'' oropulent’’ or ``happy dog.’’
本文提出了零拍语义图像处理的问题,即在模型训练过程中,用户可以使用的文字和绘画手势是不受约束的,且是事先未知的。我们的目标是让用户能够指向一个图像,并应用一个任意的新概念,其中可能包括广泛的视觉概念,如“乡村”、“豪华”或“快乐的狗”。
To paint with words, we pair large-scale generative adversarial networks (GANs~\cite{goodfellow2014generative}) that are trained unconditionally or with simple class conditioning~\cite{karras2020analyzing,brock2018large}, together with a full-text image retrieval network trained to measure the semantic similarity between text and an image~\cite{radford2021learning}. We ask whether such a semantic similarity model can provide enough information to drive the image synthesis process to match a specific description within or beyond the domain on which the GAN is trained. Then we ask how the structure of a GAN can be exploited to generate realistic images where a specific part of the image is modified to match a textual description. We propose a simple architecture to enable painting with words, and we apply it using CLIP~\cite{razavi2019generating} paired with StyleGAN2~\cite{karras2020analyzing} and BigGAN~\cite{brock2018large}.
为了用文字来描绘,我们将无条件训练的大规模生成式对抗网络(GANs~引用{goodfellow2014 - generative})或使用简单的阶级条件反射~引用{karras2020analysis, brock2018large},再加上经过训练的用于度量文本和图像之间语义相似度的全文图像检索网络~\引用{radford2021learning}。我们询问这样的语义相似模型是否能够提供足够的信息来驱动图像合成过程,以匹配GAN所训练的领域内或之外的特定描述。然后,我们问如何利用GAN的结构来生成逼真的图像,其中图像的特定部分被修改以匹配文本描述。我们提出了一个简单的架构来实现文字绘画,我们使用CLIP~ cite{razavi2019generating},搭配StyleGAN2~ cite{karras2020analyzing}和BigGAN~ cite{brock2018large}来应用它。
We conduct user studies to quantify the realism and accuracy of the changes made when using our method to edit a part of a generated image; we compare our method to several baselines, and we ask which types of visual concepts are easier or harder to paint by word. Finally we investigate several new semantic image manipulations that are enabled using our method. Code and data will be available upon publication.
当使用我们的方法编辑生成的图像的一部分时,我们进行用户研究,以量化变化的真实性和准确性;我们将我们的方法与几个基线进行比较,并询问通过文字绘制哪种类型的视觉概念更容易或更困难。最后,我们研究了几种新的语义图像处理方法。代码和数据将在发布时提供。
\section{Related Work}
Our application is inspired by recent progress in the text-to-image synthesis problem~\cite{ramesh2021zero,radford2021learning} as well as paint-based semantic image manipulation methods~\cite{bau2019semantic,park2019semantic}.
我们的应用程序的灵感来自于最近在文本到图像合成问题上的进展~引用{ramesh2021zero,radford2021learning}以及基于绘画的语义图像处理方法~引用{bau2019semantic,park2019semantic}。
\vspace{3pt} \noindent \textbf{Text-to-image synthesis.} Synthesizing an image based on a text description is an ambitious problem that has attracted a variety of proposed solutions: initial RNN-based generators~\cite{gregor2015draw,mansimov2016generating} have been followed a series of by GAN-based~\cite{goodfellow2014generative} methods that have produced increasingly plausible images. The GAN methods have adopted two distinct approaches to generating realistic images from text. One is to generate images corresponding to text by sampling GAN latents that match semantics according to a separately trained image-text matching model~\cite{reed2016generative}; this idea can be refined by viewing the sampling as an energy-based modeling procedure~\cite{nguyen2017plug}. The second approach is to train a conditional generator that explicitly takes a language embedding as input~\cite{reed2016generative}; the image quality of this approach can be improved using multi-stage generators~\cite{zhang2017stackgan,zhang2018stackgan++,zhang2018photographic}, and semantic consistency can be improved through careful design of architectures and training losses~\cite{xu2018attngan,zhu2019dm,qiao2019mirrorgan,yin2019semantics,li2019object,tao2020df}.
\vspace{3pt} \noindent \textbf{文本到图像的合成。}合成图像基于文本描述是一个雄心勃勃的吸引了各种各样的问题提出解决方案:初始RNN-based发电机~ \引用{gregor2015draw, mansimov2016generating}所遵循一系列GAN-based ~ \ {goodfellow2014generative}引用方法,产生了越来越多的似是而非的图像。GAN方法采用了两种不同的方法来从文本生成逼真的图像。一种是根据单独训练的图像-文本匹配模型~\cite{reed2016generative},通过采样匹配语义的GAN潜能生成与文本对应的图像;这个想法可以通过将采样看作一个基于能量的建模过程来改进~第二种方法是训练一个条件生成器,它明确地将语言嵌入作为输入~\引用{reed2016generative};这种方法的图像质量可以提高使用多级发电机~ \引用{zhang2017stackgan zhang2018stackgan + +, zhang2018photographic},可以提高和语义一致性通过精心设计的架构和训练的损失~ \引用{xu2018attngan、zhu2019dm qiao2019mirrorgan, yin2019semantics, li2019object, tao2020df}。
As an alternative approach, generating images from scene graphs instead of sentences~\cite{johnson2018image} can allow a generator to exploit logical structure explicitly. Recent work stands apart by eschewing the use of GANs: the DALL-E~\cite{ramesh2021zero} model generates images from text autoregressively using a transformer~\cite{vaswani2017attention} based on GPT-3~\cite{brown2020language} to jointly generate natural text and image tokens using a VQ-VAE encoding~\cite{razavi2019generating}; outputs are sampled to maximize semantic consistency via a state-of-the-art image-text matching model CLIP~\cite{radford2021learning}. Artist Murdock has observed that CLIP can be used as a source of gradients to guide a generator~\cite{murdock2021bigsleep,murdock2021aleph2image}. The current paper is different from prior text-to-image work, because our goal is not to generate an image from text, but to define a paintbrush using text that enables a user to manipulate a semantics of a generated image at a specific painted location.
作为一种替代方法,从场景图而不是句子生成图像~\引用{johnson2018image}可以让生成器显式地利用逻辑结构。最近的工作是被回避使用甘斯:DALL-E ~ \引用{ramesh2021zero}从文本自回归模型生成图像使用变压器~ \引用基于GPT-3 ~ {vaswani2017attention} \引用{brown2020language},共同使用VQ-VAE编码生成自然文本和图像标记~ \引用{razavi2019generating};通过最先进的图像-文本匹配模型CLIP~引用{radford2021learning}对输出进行采样,以最大限度地提高语义一致性。艺术家Murdock已经观察到CLIP可以作为一个梯度源来引导一个生成器~引用{Murdock 2021bigsleep,murdock2021aleph2image}。当前的论文与之前的文本到图像的工作不同,因为我们的目标不是从文本生成图像,而是使用文本定义一个画笔,使用户能够在特定的绘制位置操作生成的图像的语义。
\vspace{3pt} \noindent \textbf{Semantic image painting.} Our work is also inspired by a series of methods that have enabled users to construct realistic images by painting a finite selection of chosen concepts at user-specified locations; these can be thought of as ``paint by number.’’ In this setting, there have again been two approaches enabled by GANs. One approach is to find GAN latents to generate images that match a user’s painted intention: this can be done to match color~\cite{zhu2016generative} or a finite vocabulary of visual concepts~\cite{bau2019gandissect,bau2019semantic} at a given location. The second approach is to train an image-conditional Pix2Pix~\cite{isola2017image,wang2018high} model on the task of generating a realistic image with a semantic segmentation that matches a given painted input; the SPADE method \cite{park2019semantic} refines this approach to improve image quality given the limited information available in flat segmentation inputs. While these methods all enable a user to paint images using a finite vocabulary of semantic concepts, the goal of the current work is to enable a user to paint an unlimited vocabulary of visual concepts, specified by free text.
\vspace{3pt} \noindent \textbf{语义图像绘制。我们的工作也受到了一系列方法的启发,这些方法使用户能够通过在用户指定的位置绘制有限选择的概念来构建真实的图像;这些可以被认为是“按数字绘画”。在此设置中,GANs再次启用了两种方法。一种方法是找到GAN潜能来生成匹配用户绘制意图的图像:这可以在给定位置匹配颜色~引用{zhu2016generative}或有限的视觉概念词汇~引用{bau2019gandissect,bau2019semantic}。第二种方法是训练基于图像条件的Pix2Pix模型,通过语义分割生成与给定绘制输入相匹配的真实图像;考虑到平面分割输入中可用的信息有限,SPADEGANGAN前作方法对这种方法进行了改进,以提高图像质量。虽然这些方法都允许用户使用有限的语义概念词汇表来绘制图像,但当前工作的目标是让用户能够绘制由自由文本指定的无限的视觉概念词汇表。
\vspace{3pt} \noindent \textbf{GAN latent space methods.} Semantic manipulations in GAN latent spaces have been explored from several other perspectives. Early work on GANs observed the presence of some latent vector directions corresponding to semantic concepts~\cite{radford2016unsupervised}, and further explorations have developed methods to identify interesting vector directions that steer latent space by using reconstruction losses~\cite{jahanian2019steerability,shen2020interpreting} or by learning from classification losses~\cite{denton2019detecting,goetschalckx2019ganalyze}. One disadvantage of this approach is that a semantic direction can only be found if we train a model to look for it in advance. On the other hand, it has been observed that interior latents in GANs are partially disentangled~\cite{bau2019gandissect}. So recent work has developed unsupervised methods for identifying disentangled interpretable directions in these interior latents~\cite{harkonen2020ganspace,wu2020stylespace}. Our approach differs from the above because our method for identifying latent manipulations is supervised neither by a set of finite classes nor does it rely on disentanglement; rather it identifies semantic latent changes in a zero-shot manner using full-text image semantic similarity.
\vspace{3pt} \noindent \textbf{GAN潜空间方法。GAN潜在空间中的语义操纵已经从其他几个角度进行了探索。早期的gan工作观察到与语义概念对应的一些潜在向量方向的存在~引用{radford2016unsupervised},进一步的探索已经发展出一些方法,通过使用重建损失~引用{jahanian2019steering ability,shen2020interpreting}或通过学习分类损失~引用{denton2019, goetschalckx2019ganalyze}来识别引导潜在空间的有趣向量方向。这种方法的一个缺点是,只有通过训练模型提前寻找语义方向,才能找到语义方向。另一方面,我们观察到gan的内部潜态是部分解纠缠的。因此,最近的工作开发了一种无监督的方法来识别这些内部潜在的解纠缠可解释方向~引用{harkonen2020ganspace,wu2020stylespace}。我们的方法与上述方法不同,因为我们识别潜在操作的方法既不受有限类集合的监督,也不依赖于解纠缠;相反,它使用全文图像的语义相似度以零镜头的方式识别语义潜在变化。
\vspace{3pt} \noindent \textbf{GAN inversion methods.} We note that the leading state-of-the-art generative models are not trained with an encoder. Therefore, in order to apply GAN manipulation methods on real user-provided images, one must solve GAN inversion. That is, we must be able to encode a given image in the latent space of the GAN. Because several powerful editing methods are enabled by GAN latent manipulation, the problem of inverting a GAN is of widespread interest and is the subject of an active line of ongoing research~\cite{zhu2016generative,lipton2017precise,bau2019inverting,abdal2019image2stylegan,abdal2020image2stylegan,guan2020collaborative,richardson2020encoding,zhu2020indomain,zhu2020improved,huh2020ganprojection}. The GAN inversion problem is complementary to our work. In this paper, we shall assume that the image to be edited is represented in the latent space of the generator.
\vspace{3pt} \noindent \textbf{GAN反演方法。我们注意到领先的最先进的生成模型不是用编码器训练的。因此,要在真实的用户提供的图像上应用氮化镓操作方法,必须解决氮化镓反演问题。也就是说,我们必须能够在GAN的潜在空间中对给定的图像进行编码。由于GAN潜伏操作可以实现几种强大的编辑方法,反相氮化镓是普遍关心的问题,是目前研究的一个活跃的主题行~ \引用{zhu2016generative、lipton2017precise bau2019inverting, abdal2019image2stylegan, abdal2020image2stylegan, guan2020collaborative, richardson2020encoding, zhu2020indomain, zhu2020improved, huh2020ganprojection}。氮化镓反演问题是对我们工作的补充。在本文中,我们假定待编辑的图像在生成器的潜在空间中表示。
