본문 바로가기

비지도학습/GAN

StyleCLIP: Text-Driven Manipulation of StyleGAN Imagery

StyleCLIP: Text-Driven Manipulation of StyleGAN Imagery

Abstract

Inspired by the ability of StyleGAN to generate highly realistic images in a variety of domains, much recent work has focused on understanding how to use the latent spaces of StyleGAN to manipulate generated and real images. However, discovering semantically meaningful latent manipulations typically involves painstaking human examination of the many degrees of freedom, or an annotated collection of images for each desired manipulation. In this work, we explore leveraging the power of recently introduced Contrastive Language-Image Pre-training (CLIP) models in order to develop a text-based interface for StyleGAN image manipulation that does not require such manual effort. We first introduce an optimization scheme that utilizes a CLIPbased loss to modify an input latent vector in response to a user-provided text prompt. Next, we describe a latent mapper that infers a text-guided latent manipulation step for a given input image, allowing faster and more stable textbased manipulation. Finally, we present a method for mapping a text prompts to input-agnostic directions in StyleGAN’s style space, enabling interactive text-driven image manipulation. Extensive results and comparisons demonstrate the effectiveness of our approaches.

다양한 영역에서 매우 사실적인 이미지를 생성하는 StyleGAN의 능력에서 영감을 받아 생성 된 실제 이미지를 조작하기 위해 StyleGAN의 잠재 공간을 사용하는 방법을 이해하는 데 초점을 맞춘 최근 작업이 많이 진행되었습니다. 그러나 의미론적으로 의미있는 잠재적 조작을 발견하는 것은 일반적으로 많은 자유도에 대한 힘든 인간 검사 또는 원하는 각 조작에 대한 주석이 달린 이미지 모음을 포함합니다. 이 작업에서는 이러한 수동 작업이 필요하지 않은 StyleGAN 이미지 조작을위한 텍스트 기반 인터페이스를 개발하기 위해 최근에 도입 된 CLIP (Contrastive Language-Image Pre-training) 모델의 힘을 활용하는 방법을 살펴 봅니다. 먼저 CLIP 기반 손실을 활용하여 사용자가 제공 한 텍스트 프롬프트에 대한 응답으로 입력 잠재 벡터를 수정하는 최적화 체계를 도입합니다. 다음으로, 주어진 입력 이미지에 대해 텍스트 안내 잠재 조작 단계를 추론하여 더 빠르고 안정적인 텍스트 기반 조작을 허용하는 잠재 매퍼에 대해 설명합니다. 마지막으로, StyleGAN의 스타일 공간에서 텍스트 프롬프트를 입력과 무관 한 방향으로 매핑하여 대화형 텍스트 기반 이미지 조작을 가능하게하는 방법을 제시합니다. 광범위한 결과와 비교는 우리의 접근 방식의 효과를 보여줍니다.

 

1. Introduction

Generative Adversarial Networks (GANs) [12] have revolutionized image synthesis, with recent style-based generative models [18, 19, 16] boasting some of the most realistic synthetic imagery to date. Furthermore, the learnt intermediate latent spaces of StyleGAN have been shown to possess disentanglement properties [6, 40, 13, 45, 50], which enable utilizing pretrained models to perform a wide variety of image manipulations on synthetic, as well as real, images. Harnessing StyleGAN’s expressive power requires developing simple and intuitive interfaces for users to easily carry out their intent. Existing methods for semantic control discovery either involve manual examination (e.g., [13, 40, 50]), a large amount of annotated data, or pretrained classifiers [41, 1]. Furthermore, subsequent manipulations are typically carried out by moving along a direction in one of the latent spaces, using a parametric model, such as a 3DMM in StyleRig [45], or a trained normalized flow in StyleFlow [1]. Specific edits, such as virtual try-on [21] and aging [2] have also been explored. Thus, existing controls enable image manipulations only along preset semantic directions, severely limiting the user’s creativity and imagination. Whenever an additional, unmapped, direction is desired, further manual effort and/or large quantities of annotated data are necessary.

Generative Adversarial Networks (GANs) [12]는 최근의 스타일 기반 생성 모델 [18, 19, 16]이 현재까지 가장 현실적인 합성 이미지를 자랑하는 이미지 합성에 혁명을 일으켰습니다. 또한 StyleGAN의 학습 된 중간 잠복 공간은 사전 훈련 된 모델을 활용하여 합성 이미지뿐만 아니라 실제 이미지에 대한 다양한 이미지 조작을 수행 할 수 있도록 해체 속성 [6, 40, 13, 45, 50]을 갖는 것으로 나타났습니다. . StyleGAN의 표현력을 활용하려면 사용자가 의도를 쉽게 수행 할 수 있도록 간단하고 직관적 인 인터페이스를 개발해야합니다. 시맨틱 제어 발견을위한 기존 방법은 수동 검사 (예 : [13, 40, 50]), 많은 양의 주석 데이터 또는 사전 훈련 된 분류기를 포함합니다 [41, 1]. 또한 후속 조작은 ​​일반적으로 StyleRig [45]의 3DMM 또는 StyleFlow [1]의 훈련 된 정규화 된 흐름과 같은 매개 변수 모델을 사용하여 잠복 공간 중 하나의 방향을 따라 이동하여 수행됩니다. 가상 시착 [21] 및 노화 [2]와 같은 특정 편집도 탐색되었습니다. 따라서 기존 컨트롤을 사용하면 미리 설정된 의미 방향에 따라서 만 이미지를 조작 할 수 있으므로 사용자의 창의성과 상상력이 크게 제한됩니다. 매핑되지 않은 추가 방향이 필요할 때마다 추가 수동 작업 및 / 또는 많은 양의 주석 데이터가 필요합니다.

 

In this work, we explore leveraging the power of recently introduced Contrastive Language-Image Pre-training (CLIP) models in order to enable intuitive text-based semantic image manipulation that is neither limited to preset manipulation directions, nor requires additional manual effort to discover new controls. The CLIP model is pretrained on 400 million image-text pairs harvested from the Web, and since natural language is able to express a much wider set of visual concepts, combining CLIP with the generative power of StyleGAN opens fascinating avenues for image manipulation. Figures 1 shows several examples of unique manipulations produced using our approach. Specifically, in this paper we investigate three techniques that combine CLIP with StyleGAN: 1. Text-guided latent optimization, where a CLIP model is used as a loss network [14]. This is the most versatile approach, but it requires a few minutes of optimization to apply a manipulation to an image. 2. A latent residual mapper, trained for a specific text prompt. Given a starting point in latent space (the input image to be manipulated), the mapper yields a local step in latent space. 3. A method for mapping a text prompt into an inputagnostic (global) direction in StyleGAN’s style space, providing control over the manipulation strength as well as the degree of disentanglement. The results in this paper and the supplementary material demonstrate a wide range of semantic manipulations on images of human faces, animals, cars, and churches. These manipulations range from abstract to specific, and from extensive to fine-grained. Many of them have not been demonstrated by any of the previous StyleGAN manipulation works, and all of them were easily obtained using a combination of pretrained StyleGAN and CLIP models.

이 작업에서는 사전 설정된 조작 방향에 국한되지 않고 검색을 위해 추가적인 수동 노력이 필요하지 않은 직관적 인 텍스트 기반 의미 론적 이미지 조작을 가능하게하기 위해 최근에 도입 된 CLIP (Contrastive Language-Image Pre-training) 모델의 힘을 활용하는 방법을 탐구합니다. 새로운 컨트롤. CLIP 모델은 웹에서 수집 한 4 억 개의 이미지-텍스트 쌍에 대해 사전 훈련되었으며, 자연어는 훨씬 더 광범위한 시각적 개념을 표현할 수 있기 때문에 CLIP과 StyleGAN의 생성 능력을 결합하여 이미지 조작을위한 매력적인 길을 열어줍니다. 그림 1은 우리의 접근 방식을 사용하여 생성 된 고유 한 조작의 몇 가지 예를 보여줍니다. 특히,이 논문에서는 CLIP과 StyleGAN을 결합하는 세 가지 기술을 조사합니다. 1. CLIP 모델이 손실 네트워크로 사용되는 텍스트 안내 잠재 최적화 [14]. 이것은 가장 다양한 접근 방식이지만 이미지에 조작을 적용하려면 몇 분의 최적화가 필요합니다. 2. 특정 텍스트 프롬프트에 대해 훈련 된 잠재 잔여 매퍼. 잠복 공간 (조작 할 입력 이미지)의 시작점이 주어지면 매퍼는 잠복 공간에서 로컬 단계를 생성합니다. 3. StyleGAN의 스타일 공간에서 입력에 구애받지 않는 (전역) 방향으로 텍스트 프롬프트를 매핑하는 방법으로, 조작 강도와 엉킴 정도를 제어 할 수 있습니다. 이 논문의 결과와 보충 자료는 인간의 얼굴, 동물, 자동차 및 교회의 이미지에 대한 광범위한 의미 조작을 보여줍니다. 이러한 조작은 추상에서 특정, 광범위에서 세분화까지 다양합니다. 이들 중 대부분은 이전 StyleGAN 조작 작업으로 시연되지 않았으며 모두 사전 훈련 된 StyleGAN 및 CLIP 모델의 조합을 사용하여 쉽게 얻을 수있었습니다.

 

2. Related Work

2.1. Vision and Language

Joint representations

Multiple works learn cross-modal Vision and language (VL) representations [8, 39, 44, 29, 24, 43, 23, 4, 26] for a variety of tasks, such as languagebased image retrieval, image captioning, and visual question answering. Following the success of BERT [9] in various language tasks, recent VL methods typically use Transformers [47] to learn the joint representations. A recent model, based on Contrastive Language-Image Pre-training (CLIP) [34], learns a multi-modal embedding space, which may be used to estimate the semantic similarity between a given text and an image. CLIP was trained on 400 million text-image pairs, collected from a variety of publicly available sources on the Internet. The representations learned by CLIP have been shown to be extremely powerful, enabling state-of-the-art zero-shot image classification on a variety of datasets. We refer the reader to OpenAI’s Distill article [11] for an extensive exposition and discussion of the visual concepts learned by CLIP.

여러 작품이 언어 기반 이미지 검색, 이미지 캡션 및 시각적 질문과 같은 다양한 작업에 대한 교차 모드 시각 및 언어 (VL) 표현 [8, 39, 44, 29, 24, 43, 23, 4, 26]을 학습합니다. 응답. 다양한 언어 작업에서 BERT [9]의 성공에 따라 최근 VL 방법은 일반적으로 Transformers [47]를 사용하여 공동 표현을 학습합니다. Contrastive Language-Image Pre-training (CLIP) [34]에 기반한 최근 모델은 주어진 텍스트와 이미지 간의 의미 적 유사성을 추정하는 데 사용될 수있는 다중 모달 임베딩 공간을 학습합니다. CLIP은 인터넷에서 공개적으로 사용 가능한 다양한 소스에서 수집 한 4 억 개의 텍스트 이미지 쌍으로 훈련되었습니다. CLIP에서 학습 한 표현은 매우 강력하여 다양한 데이터 세트에서 최첨단 제로 샷 이미지 분류를 가능하게합니다. 독자는 CLIP에서 배운 시각적 개념에 대한 광범위한 설명과 논의를 위해 OpenAI의 Distill 기사 [11]를 참조합니다.

 

Text-guided image generation and manipulation 텍스트 안내 이미지 생성 및 조작

The pioneering work of Reed et al. [37] approached text-guided image generation by training a conditional GAN [30], conditioned by text embeddings obtained from a pretrained encoder. Zhang et al. [54, 55] improved image quality by using multi-scale GANs. AttnGAN [52] incorporated an attention mechanism between the text and image features. Additional supervision was used in other works [37, 25, 20] to further improve the image quality. A few studies focus on text-guided image manipulation. Some methods [10, 31, 27] use a GAN-based encoderdecoder architecture, to disentangle the semantics of both input images and text descriptions. ManiGAN [22] introduces a novel text-image combination module, which produces high-quality images. Differently from the aforementioned works, we propose a single framework that combines the high-quality images generated by StyleGAN, with the rich multi-domain semantics learned by CLIP. Recently, DALL·E [35, 36], a 12-billion parameter version of GPT-3 [3], which at 16-bit precision requires over 24GB of GPU memory, has shown a diverse set of capabilities in generating and applying transformations to images guided by text. In contrast, our approach is deployable even on a single commodity GPU. A concurrent work to ours, TediGAN [51], also uses StyleGAN for text-guided image generation and manipulation. By training an encoder to map text into the StyleGAN latent space, one can generate an image corresponding to a given text. To perform text-guided image manipulation, TediGAN encodes both the image and the text into the latent space, and then performs style-mixing to generate a corresponding image. In Section 7 we demonstrate that the manipulations achieved using our approach reflect better the semantics of the driving text. In a recent online post, Perez [33] describes a text-toimage approach that combines StyleGAN and CLIP in a manner similar to our latent optimizer in Section 4. Rather than synthesizing an image from scratch, our optimization scheme, as well as the other two approaches described in this work, focus on image manipulation. While text-toimage generation is an intriguing and challenging problem, we believe that the image manipulation abilities we provide constitute a more useful tool for the typical workflow of creative artists.

Reed [37]의 선구적인 작업은 사전 훈련 된 인코더에서 얻은 텍스트 임베딩에 의해 조건화 된 조건부 GAN [30]을 훈련하여 텍스트 안내 이미지 생성에 접근했습니다. Zhang [54, 55]은 다중 스케일 GAN을 사용하여 이미지 품질을 향상 시켰습니다. AttnGAN [52]은 텍스트와 이미지 기능 사이에주의 메커니즘을 통합했습니다. 이미지 품질을 더욱 향상시키기 위해 다른 작업 [37, 25, 20]에서는 추가적인 감독이 사용되었습니다. 몇 가지 연구는 텍스트 안내 이미지 조작에 중점을 둡니다. 일부 방법 [10, 31, 27]은 GAN 기반 인코더 디코더 아키텍처를 사용하여 입력 이미지와 텍스트 설명의 의미를 분리합니다. ManiGAN [22]는 고품질 이미지를 생성하는 새로운 텍스트 이미지 조합 모듈을 소개합니다. 앞서 언급 한 작업과 달리 StyleGAN에서 생성 한 고품질 이미지와 CLIP에서 학습 한 풍부한 다중 도메인 의미를 결합한 단일 프레임 워크를 제안합니다. 최근에는 16 비트 정밀도에서 24GB 이상의 GPU 메모리를 필요로하는 GPT-3의 120 억 매개 변수 버전 인 DALL · E [35, 36] [3]는 변환 생성 및 적용에있어 다양한 기능을 보여주었습니다. 텍스트로 안내하는 이미지에. 반대로 우리의 접근 방식은 단일 상용 GPU에서도 배포 할 수 있습니다. 우리의 동시 작업 인 TediGAN [51]은 텍스트 안내 이미지 생성 및 조작을 위해 StyleGAN을 사용합니다. 인코더를 훈련시켜 텍스트를 StyleGAN 잠재 공간에 매핑함으로써 주어진 텍스트에 해당하는 이미지를 생성 할 수 있습니다. 텍스트 안내 이미지 조작을 수행하기 위해 TediGAN은 이미지와 텍스트를 모두 잠재 공간으로 인코딩 한 다음 스타일 믹싱을 수행하여 해당 이미지를 생성합니다. 섹션 7에서는 우리의 접근 방식을 사용하여 얻은 조작이 운전 텍스트의 의미를 더 잘 반영한다는 것을 보여줍니다. 최근 온라인 게시물에서 Perez [33]는 섹션 4의 잠재 최적화 프로그램과 유사한 방식으로 StyleGAN과 CLIP을 결합하는 텍스트-이미지 접근 방식을 설명합니다. 처음부터 이미지를 합성하는 대신 최적화 체계와 다른 이 작업에서 설명하는 두 가지 접근 방식은 이미지 조작에 중점을 둡니다. 텍스트-이미지 생성은 흥미롭고 도전적인 문제이지만, 우리가 제공하는 이미지 조작 능력은 크리에이티브 아티스트의 일반적인 워크 플로우에 더 유용한 도구를 구성한다고 믿습니다.

 

2.2. Latent Space Image Manipulation 잠재 공간 이미지 조작

Many works explore how to utilize the latent space of a pretrained generator for image manipulation [6, 45, 50]. Specifically, the intermediate latent spaces in StyleGAN have been shown to enable many disentangled and meaningful image manipulations. Some methods learn to perform image manipulation in an end-to-end fashion, by training a network that encodes a given image into a latent representation of the manipulated image [32, 38, 2]. Other methods aim to find latent paths, such that traversing along them result in the desired manipulation. Such methods can be categorized into: (i) methods that use image annotations to find meaningful latent paths [40, 1], and (ii) methods that find meaningful directions without supervision, and require manual annotation for each direction [13, 42, 48, 49]. While most works perform image manipulations in the W or W+ spaces, Wu et al. [50] proposed to use the StyleSpace S, and showed that it is better disentangled than W and W+. Our latent optimizer and mapper work in the W+ space, while the input-agnostic directions that we detect are in S. In all three, the manipulations are derived directly from text input, and our only source of supervision is a pretrained CLIP model. As CLIP was trained on hundreds of millions of text-image pairs, our approach is generic and can be used in a multitude of domains without the need for domain- or manipulation-specific data annotation.

많은 연구가 이미지 조작을 위해 사전 훈련 된 생성기의 잠재 공간을 활용하는 방법을 탐구합니다 [6, 45, 50]. 특히 StyleGAN의 중간 잠재 공간은 많은 분리되고 의미있는 이미지 조작을 가능하게하는 것으로 나타났습니다. 일부 방법은 주어진 이미지를 조작 된 이미지의 잠재 표현으로 인코딩하는 네트워크를 훈련함으로써 종단 간 방식으로 이미지 조작을 수행하는 방법을 배웁니다 [32, 38, 2]. 다른 방법은 잠재 경로를 찾는 것을 목표로하여 경로를 따라 이동하면 원하는 조작이 이루어집니다. 이러한 방법은 다음과 같이 분류 할 수 있습니다. (i) 이미지 주석을 사용하여 의미있는 잠재 경로를 찾는 방법 [40, 1], (ii) 감독없이 의미있는 방향을 찾고 각 방향에 대한 수동 주석을 요구하는 방법 [13, 42, 48, 49]. 대부분의 작품은 W 또는 W + 공간에서 이미지 조작을 수행하지만 Wu et al. StyleSpace S의 사용을 제안했으며 W와 W +보다 엉킴이 더 낫다는 것을 보여주었습니다. 우리의 잠재 최적화 기와 매퍼는 W + 공간에서 작동하는 반면, 우리가 감지하는 입력에 구애받지 않는 방향은 S에 있습니다. 세 가지 모두에서 조작은 텍스트 입력에서 직접 파생되며, 우리의 유일한 감독 소스는 사전 훈련 된 CLIP 모델입니다. CLIP은 수억 개의 텍스트 이미지 쌍에 대해 학습되었으므로 우리의 접근 방식은 일반적이며 도메인 또는 조작 관련 데이터 주석이 필요없이 여러 도메인에서 사용할 수 있습니다.

 

3. StyleCLIP Text-Driven Manipulation StyleCLIP 텍스트 기반 조작

In this work we explore three ways for text-driven image manipulation, all of which combine the generative power of StyleGAN with the rich joint vision-language representation learned by CLIP. We begin in Section 4 with a simple latent optimization scheme, where a given latent code of an image in StyleGAN’s W+ space is optimized by minimizing a loss computed in CLIP space. The optimization is performed for each (source image, text prompt) pair. Thus, despite it’s versatility, several minutes are required to perform a single manipulation, and the method can be difficult to control. A more stable approach is described in Section 5, where a mapping network is trained to infer a manipulation step in latent space, in a single forward pass. The training takes a few hours, but it must only be done once per text prompt. The direction of the manipulation step may vary depending on the starting position in W+, which corresponds to the input image, and thus we refer to this mapper as local. Our experiments with the local mapper reveal that, for a wide variety of manipulations, the directions of the manipulation step are often similar to each other, despite different starting points. Also, since the manipulation step is performed in W+, it is difficult to achieve fine-grained visual effects in a disentangled manner. Thus, in Section 6 we explore a third text-driven manipulation scheme, which transforms a given text prompt into an input agnostic (i.e., global in latent space) mapping direction. The global direction is computed in StyleGAN’s style space S [50], which is better suited for fine-grained and disentangled visual manipulation, compared to W+. Table 1 summarizes the differences between the three methods outlined above, while visual results and comparisons are presented in the following sections.

이 작업에서 우리는 텍스트 기반 이미지 조작을위한 세 가지 방법을 탐구합니다.이 모든 방법은 StyleGAN의 생성 능력과 CLIP에서 배운 풍부한 공동 비전 언어 표현을 결합합니다. 섹션 4에서는 StyleGAN의 W + 공간에있는 이미지의 주어진 잠재 코드가 CLIP 공간에서 계산 된 손실을 최소화하여 최적화되는 간단한 잠재 최적화 체계로 시작합니다. 최적화는 각 (소스 이미지, 텍스트 프롬프트) 쌍에 대해 수행됩니다. 따라서 다재다능 함에도 불구하고 한 번의 조작을 수행하는 데 몇 분이 걸리며 방법을 제어하기 어려울 수 있습니다. 보다 안정적인 접근 방식은 섹션 5에서 설명합니다. 여기서 매핑 네트워크는 단일 순방향 패스에서 잠복 공간에서 조작 단계를 추론하도록 훈련됩니다. 교육은 몇 시간이 걸리지 만 텍스트 프롬프트 당 한 번만 수행해야합니다. 조작 단계의 방향은 입력 이미지에 해당하는 W +의 시작 위치에 따라 달라질 수 있으므로이 매퍼를 로컬이라고합니다. 로컬 매퍼를 사용한 실험은 다양한 조작에 대해 시작점이 다르지만 조작 단계의 방향이 종종 서로 유사하다는 것을 보여줍니다. 또한 조작 단계는 W +에서 수행되기 때문에 얽 히지 않은 방식으로 세밀한 시각 효과를 얻기가 어렵습니다. 따라서 섹션 6에서는 주어진 텍스트 프롬프트를 입력 불가지론 (즉, 잠복 공간에서 전역) 매핑 방향으로 변환하는 세 번째 텍스트 기반 조작 체계를 살펴 봅니다. 전역 방향은 StyleGAN의 스타일 공간 S [50]에서 계산되며, W +에 비해 세밀하고 얽 히지 않은 시각적 조작에 더 적합합니다. 표 1에는 위에서 설명한 세 가지 방법의 차이점이 요약되어 있으며 시각적 결과와 비교는 다음 섹션에 나와 있습니다.

 

4. Latent Optimization 잠재 최적화

A simple approach for leveraging CLIP to guide image manipulation is through direct latent code optimization. Specifically, given a source latent code ws ∈ W+, and a directive in natural language, or a text prompt t, we solve the following optimization problem: arg min w∈W+ DCLIP(G(w), t) + λL2 kw − wsk2 + λIDLID(w), (1) where G is a pretrained StyleGAN1 generator and DCLIP is the cosine distance between the CLIP embeddings of its two arguments. Similarity to the input image is controlled by the L2 distance in latent space, and by the identity loss [38]: LID (w) = 1 − hR(G(ws)), R(G(w))i, (2) where R is a pretrained ArcFace [7] network for face recognition, and h·, ·i computes the cosine similarity between it’s arguments. We solve this optimization problem through gradient descent, by back-propagating the gradient of the objective in (1) through the pretrained and fixed StyleGAN generator G and the CLIP image encoder. In Figure 3 we provide several edits that were obtained using this optimization approach after 200-300 iterations. The input images were inverted by e4e [46]. Note that visual characteristics may be controlled explicitly (beard, blonde) or implicitly, by indicating a real or a fictional person (Beyonce, Trump, Elsa). The values of λL2 and λID depend on the nature of the desired edit. For changes that shift towards another identity, λID is set to a lower value.

CLIP을 활용하여 이미지 조작을 안내하는 간단한 접근 방식은 직접적인 잠재 코드 최적화를 이용하는 것입니다. 특히 소스 잠재 코드 ws ∈ W +, 자연어의 지시문 또는 텍스트 프롬프트 t가 주어지면 다음 최적화 문제를 해결합니다. arg min w∈W + DCLIP (G (w), t) + λL2 kw − wsk2 + λIDLID (w), (1) 여기서 G는 사전 훈련 된 StyleGAN1 생성기이고 DCLIP는 두 인수의 CLIP 임베딩 사이의 코사인 거리입니다. 입력 영상과의 유사성은 잠복 공간에서 L2 거리와 동일성 손실에 의해 제어됩니다 [38] : LID (w) = 1 − hR (G (ws)), R (G (w)) i, (2 ) 여기서 R은 얼굴 인식을 위해 사전 훈련 된 ArcFace [7] 네트워크이고 h ·, · i는 인수 간의 코사인 유사성을 계산합니다. 사전 훈련되고 고정 된 StyleGAN 생성기 G 및 CLIP 이미지 인코더를 통해 (1)의 목표 기울기를 역 전파하여 기울기 하강을 통해이 최적화 문제를 해결합니다. 그림 3에서는 200-300 회 반복 후이 최적화 접근 방식을 사용하여 얻은 몇 가지 편집 내용을 제공합니다. 입력 이미지는 e4e에 의해 반전되었습니다 [46]. 시각적 특성은 실제 또는 가상의 인물 (비욘세, 트럼프, 엘사)을 표시하여 명시 적으로 (수염, 금발) 또는 묵시적으로 제어 할 수 있습니다. λL2 및 λID의 값은 원하는 편집의 특성에 따라 다릅니다. 다른 ID로 이동하는 변경의 경우 λID가 더 낮은 값으로 설정됩니다.

 

5. Latent Mapper

The latent optimization described above is versatile, as it performs a dedicated optimization for each (source im age, text prompt) pair. On the downside, several minutes of optimization are required to edit a single image, and the method is somewhat sensitive to the values of its parameters. Below, we describe a more efficient process, where a mapping network is trained, for a specific text prompt t, to infer a manipulation step Mt(w) in the W+ space, for any given latent image embedding w ∈ W+.

위에서 설명한 잠재 최적화는 각 (소스 이미지, 텍스트 프롬프트) 쌍에 대해 전용 최적화를 수행하기 때문에 다재다능합니다. 단점은 단일 이미지를 편집하는 데 몇 분의 최적화가 필요하며이 방법은 매개 변수 값에 다소 민감합니다. 아래에서는 w ∈ W +를 포함하는 주어진 잠상 이미지에 대해 W + 공간에서 조작 단계 Mt (w)를 추론하기 위해 특정 텍스트 프롬프트 t에 대해 매핑 네트워크가 훈련되는보다 효율적인 프로세스를 설명합니다.

 

Architecture

The architecture of our text-guided mapper is depicted in Figure 2. It has been shown that different StyleGAN layers are responsible for different levels of detail in the generated image [18]. Consequently, it is common to split the layers into three groups (coarse, medium, and fine), and feed each group with a different part of the (extended) latent vector. We design our mapper accordingly, with three fully-connected networks, one for each group/part. The architecture of each of these networks is the same as that of the StyleGAN mapping network, but with fewer layers (4 rather than 8, in our implementation). Denoting the latent code of the input image as w = (wc, wm, wf ), the mapper is defined by Mt(w) = (Mc t (wc), Mm t (wm), Mf t (wf )). (3) Note that one can choose to train only a subset of the three mappers. There are cases where it is useful to preserve some attribute level and keep the style codes in the corresponding entries fixed.

텍스트 안내 매퍼의 아키텍처는 그림 2에 나와 있습니다. 생성 된 이미지에서 서로 다른 StyleGAN 레이어가 서로 다른 수준의 세부 정보를 담당하는 것으로 나타났습니다 [18]. 결과적으로 레이어를 세 그룹 (거친, 중간 및 미세)으로 분할하고 각 그룹에 (확장 된) 잠재 벡터의 다른 부분을 공급하는 것이 일반적입니다. 우리는 각 그룹 / 파트에 대해 하나씩 3 개의 완전히 연결된 네트워크를 사용하여 그에 따라 매퍼를 설계합니다. 이러한 각 네트워크의 아키텍처는 StyleGAN 매핑 네트워크의 아키텍처와 동일하지만 레이어 수가 더 적습니다 (구현에서 8 개가 아닌 4 개). 입력 이미지의 잠복 코드를 w = (wc, wm, wf)로 표시하면 매퍼는 Mt (w) = (Mc t (wc), Mm t (wm), Mf t (wf))로 정의됩니다. (3) 세 매퍼 중 일부만 훈련하도록 선택할 수 있습니다. 일부 속성 수준을 유지하고 해당 항목의 스타일 코드를 고정 된 상태로 유지하는 것이 유용한 경우가 있습니다.

 

Losses

Our mapper is trained to manipulate the desired attributes of the image as indicated by the text prompt t, while preserving the other visual attributes of the input image. The CLIP loss, LCLIP(w) guides the mapper to minimize the cosine distance in the CLIP latent space: LCLIP(w) = DCLIP(G(w + Mt(w)), t), (4) where G denotes again the pretrained StyleGAN generator. To preserve the visual attributes of the original input image, we minimize the L2 norm of the manipulation step in the latent space. Finally, for edits that require identity preservation, we use the identity loss defined in eq. (2). Our total loss function is a weighted combination of these losses: L(w) = LCLIP(w) + λL2 kMt(w)k2 + λIDLID(w). (5) As before, when the edit is expected to change the identity, we do not use the identity loss. The parameter values we use for the examples in this paper are λL2 = 0.8, λID = 0.1, except for the “Trump” manipulation in Figure 9, where the parameter values we use are λL2 = 2, λID = 0. In Figure 4 we provide several examples for hair style edits, where a different mapper used in each column. In all of these examples, the mapper succeeds in preserving the identity and most of the other visual attributes that are not related to hair. Note, that the resulting hair appearance is adapted to the individual; this is particularly apparent in the “Curly hair” and “Bob-cut hairstyle” edits. It should be noted that the text prompts are not limited to a single attribute at a time. Figure 5 shows four different combinations of hair attributes, straight/curly and short/long, each yielding the expected outcome. This degree of control has not been demonstrated by any previous method we’re aware of. Since the latent mapper infers a custom-tailored manipulation step for each input image, it is interesting to examine the extent to which the direction of the step in latent space varies over different inputs. To test this, we first invert the test set of CelebA-HQ [28, 15] using e4e [46]. Next, we feed the inverted latent codes into several trained mappers and compute the cosine similarity between all pairs of the resulting manipulation directions. The mean and the standard deviation of the cosine similarity for each mapper is reported in Table 2. The table shows that even though the mapper infers manipulation steps that are adapted to the input image, in practice, the cosine similarity of these steps for a given text prompt is high, implying that their directions are not as different as one might expect.

우리의 매퍼는 입력 이미지의 다른 시각적 속성을 유지하면서 텍스트 프롬프트 t에 표시된대로 이미지의 원하는 속성을 조작하도록 훈련되었습니다. CLIP 손실 인 LCLIP (w)는 CLIP 잠재 공간에서 코사인 거리를 최소화하도록 매퍼를 안내합니다. LCLIP (w) = DCLIP (G (w + Mt (w)), t), (4) 여기서 G는 다시 사전 훈련 된 StyleGAN 생성기. 원본 입력 이미지의 시각적 속성을 보존하기 위해 잠복 공간에서 조작 단계의 L2 표준을 최소화합니다. 마지막으로, 신원 보존이 필요한 편집을 위해 eq에 정의 된 신원 손실을 사용합니다. (2). 총 손실 함수는 L (w) = LCLIP (w) + λL2 kMt (w) k2 + λIDLID (w)와 같은 손실의 가중 조합입니다. (5) 이전과 마찬가지로 편집으로 인해 신원이 변경 될 것으로 예상되는 경우 신원 상실을 사용하지 않습니다. 이 백서의 예제에 사용하는 매개 변수 값은 λL2 = 0.8, λID = 0.1입니다. 단, 우리가 사용하는 매개 변수 값은 λL2 = 2, λID = 0 인 그림 9의 "트럼프"조작을 제외하면 그림 4에서 우리는 각 열에 다른 매퍼가 사용되는 헤어 스타일 편집에 대한 몇 가지 예를 제공합니다. 이 모든 예에서 매퍼는 머리카락과 관련이없는 대부분의 다른 시각적 속성과 정체성을 유지하는 데 성공했습니다. 결과적인 머리카락 모양은 개인에 맞게 조정됩니다. 이것은 "Curly hair"및 "Bob-cut hairstyle"편집에서 특히 분명합니다. 텍스트 프롬프트는 한 번에 하나의 속성으로 제한되지 않습니다. 그림 5는 똑 바른 / 곱슬 머리 및 짧은 / 긴 머리카락 속성의 네 가지 조합을 보여 주며 각각 예상되는 결과를 산출합니다. 이러한 제어 수준은 우리가 알고있는 이전 방법으로는 입증되지 않았습니다. 잠재 매퍼는 각 입력 이미지에 대해 맞춤형 조작 단계를 추론하므로 잠재 공간에서 단계의 방향이 입력에 따라 달라지는 정도를 조사하는 것이 흥미 롭습니다. 이를 테스트하기 위해 먼저 e4e [46]을 사용하여 CelebA-HQ [28, 15]의 테스트 세트를 반전합니다. 다음으로, 우리는 반전 된 잠복 코드를 여러 훈련 된 매퍼에 공급하고 결과 조작 방향의 모든 쌍 간의 코사인 유사성을 계산합니다. 각 매퍼에 대한 코사인 유사성의 평균과 표준 편차는 표 2에보고되어 있습니다. 표는 매퍼가 입력 이미지에 적용되는 조작 단계를 추론하더라도 실제로는 주어진 단계에 대한 이러한 단계의 코사인 유사성을 보여줍니다. 텍스트 프롬프트가 높아서 방향이 예상과 다르지 않음을 의미합니다.

 

6. Global Directions

While the latent mapper allows fast inference time, we find that it sometimes falls short when a fine-grained disentangled manipulation is desired. Furthermore, as we have seen, the directions of different manipulation steps for a given text prompt tend to be similar. Motivated by these observations, in this section we propose a method for mapping a text prompt into a single, global direction in StyleGAN’s style space S, which has been shown to be more disentangled than other latent spaces [50].

잠재 매퍼를 사용하면 추론 시간이 빨라지지만 세밀하게 얽 히지 않은 조작이 필요할 때 때때로 부족합니다. 또한 우리가 살펴본 바와 같이 주어진 텍스트 프롬프트에 대한 다른 조작 단계의 방향은 유사한 경향이 있습니다. 이러한 관찰에 동기를 부여하여이 섹션에서는 텍스트 프롬프트를 StyleGAN의 스타일 공간 S에서 단일 전역 방향으로 매핑하는 방법을 제안합니다. 이는 다른 잠복 공간보다 더 얽 히지 않는 것으로 나타났습니다 [50].

 

Let s ∈ S denote a style code, and G(s) the corresponding generated image. Given a text prompt indicating a desired attribute, we seek a manipulation direction ∆s, such that G(s + α∆s) yields an image where that attribute is introduced or amplified, without significantly affecting other attributes. The manipulation strength is controlled by α. Our high-level idea is to first use the CLIP text encoder to obtain a vector ∆t in CLIP’s joint language-image embedding and then map this vector into a manipulation direction ∆s in S. A stable ∆t is obtained from natural language, using prompt engineering, as described below. The corresponding direction ∆s is then determined by assessing the relevance of each style channel to the target attribute.

s ∈ S는 스타일 코드를 나타내고 G (s)는 생성 된 해당 이미지를 나타냅니다. 원하는 속성을 나타내는 텍스트 프롬프트가 주어지면 G (s + α∆s)가 다른 속성에 큰 영향을주지 않고 해당 속성이 도입되거나 증폭되는 이미지를 생성하도록 조작 방향 ∆s를 찾습니다. 조작 강도는 α에 의해 제어됩니다. 우리의 높은 수준의 아이디어는 먼저 CLIP 텍스트 인코더를 사용하여 CLIP의 공동 언어 이미지 임베딩에서 벡터 ∆t를 얻은 다음이 벡터를 S의 조작 방향 ∆s에 매핑하는 것입니다. 안정적인 ∆t는 자연어에서 얻습니다. 아래에 설명 된대로 프롬프트 엔지니어링을 사용합니다. 그런 다음 해당 방향 ∆s는 각 스타일 채널과 대상 속성의 관련성을 평가하여 결정됩니다.

 

More formally, denote by I the manifold of image embeddings in CLIP’s joint embedding space, and by T the manifold of its text embeddings. We distinguish between these two manifolds, because there is no one-to-one mapping between them: an image may contain a large number of visual attributes, which can hardly be comprehensively described by a single text sentence; conversely, a given sentence may describe many different images. During CLIP training, all embeddings are normalized to a unit norm, and therefore only the direction of embedding contains semantic information, while the norm may be ignored. Thus, in well trained areas of the CLIP space, we expect directions on the T and I manifolds that correspond to the same semantic changes to be roughly collinear (i.e., have large cosine similarity), and nearly identical after normalization.

보다 공식적으로 I는 CLIP의 조인트 임베딩 공간에있는 이미지 임베딩의 다양 함을 나타내고 T는 텍스트 임베딩의 다양 함을 나타냅니다. 일대일 매핑이 없기 때문에 우리는이 두 가지 매니 폴드를 구별합니다. 이미지는 하나의 텍스트 문장으로 종합적으로 설명 할 수없는 많은 시각적 속성을 포함 할 수 있습니다. 반대로 주어진 문장은 다양한 이미지를 설명 할 수 있습니다. CLIP 훈련 중에 모든 임베딩은 단위 표준으로 정규화되므로 임베딩 방향에만 의미 정보가 포함되고 표준은 무시 될 수 있습니다. 따라서 CLIP 공간의 잘 훈련 된 영역에서 동일한 의미 변경에 해당하는 T 및 I 매니 폴드의 방향이 대략 공선 (즉, 큰 코사인 유사성)이고 정규화 후에 거의 동일 할 것으로 예상합니다.

 

Given a pair of images, G(s) and G(s+α∆s), we denote their I embeddings by i and i + ∆i, respectively. Thus, the difference between the two images in CLIP space is given by ∆i. Given a natural language instruction encoded as ∆t, and assuming collinearity between ∆t and ∆i, we can determine a manipulation direction ∆s by assessing the relevance of each channel in S to the direction ∆i.

한 쌍의 이미지 G (s) 및 G (s + α∆s)가 주어지면 I 임베딩을 각각 i 및 i + ∆i로 표시합니다. 따라서 CLIP 공간에서 두 이미지의 차이는 ∆i로 표시됩니다. ∆t로 인코딩 된 자연어 명령이 주어지고 ∆t와 ∆i 사이의 공선 성을 가정하면 S의 각 채널과 ∆i 방향의 관련성을 평가하여 조작 방향 ∆s를 결정할 수 있습니다.

 

From natural language to ∆t In order to reduce text embedding noise, Radford et al. [34] utilize a technique called prompt engineering that feeds several sentences with the same meaning to the text encoder, and averages their embeddings. For example, for ImageNet zero-shot classification, a bank of 80 different sentence templates is used, such as “a bad photo of a {}”, “a cropped photo of the {}”, “a black and white photo of a {}”, and “a painting of a {}”. At inference time, the target class is automatically substituted into these templates to build a bank of sentences with similar semantics, whose embeddings are then averaged. This process improves zero-shot classification accuracy by an additional 3.5% over using a single text prompt. Similarly, we also employ prompt engineering (using the same ImageNet prompt bank) in order to compute stable directions in T . Specifically, our method should be provided with text description of a target attribute and a corresponding neutral class. For example, when manipulating images of cars, the target attribute might be specified as “a sports car”, in which case the corresponding neutral class might be “a car”. Prompt engineering is then applied to produce the average embeddings for the target and the neutral class, and the normalized difference between the two embeddings is used as the target direction ∆t.

자연어에서 ∆t로 텍스트 임베딩 노이즈를 줄이기 위해 Radford et al. [34] 동일한 의미를 가진 여러 문장을 텍스트 인코더에 공급하고 임베딩을 평균화하는 프롬프트 엔지니어링이라는 기술을 사용합니다. 예를 들어 ImageNet 제로 샷 분류의 경우 "{}의 불량 사진", "{}의 잘린 사진", "A의 흑백 사진"과 같은 80 개의 서로 다른 문장 템플릿 뱅크가 사용됩니다. {} ","{}의 그림 ". 추론 시간에 대상 클래스는 자동으로 이러한 템플릿으로 대체되어 유사한 의미 체계를 가진 문장 뱅크를 구축하고 임베딩의 평균을 구합니다. 이 프로세스는 단일 텍스트 프롬프트를 사용하는 것보다 3.5 % 추가로 제로 샷 분류 정확도를 향상시킵니다. 마찬가지로 T에서 안정적인 방향을 계산하기 위해 동일한 ImageNet 프롬프트 뱅크를 사용하는 프롬프트 엔지니어링도 사용합니다. 특히, 우리의 메소드는 대상 속성에 대한 텍스트 설명과 해당 중립 클래스를 제공해야합니다. 예를 들어 자동차 이미지를 조작 할 때 대상 속성이 "스포츠카"로 지정 될 수 있으며이 경우 해당 중립 클래스는 "자동차"가 될 수 있습니다. 그런 다음 프롬프트 엔지니어링을 적용하여 대상 및 중립 클래스에 대한 평균 임베딩을 생성하고 두 임베딩 간의 정규화 된 차이를 대상 방향 ∆t로 사용합니다.

 

Channelwise relevance 채널 별 관련성

Next, our goal is to construct a style space manipulation direction ∆s that would yield a change ∆i, collinear with the target direction ∆t. For this purpose, we need to assess the relevance of each channel c of S to a given direction ∆i in CLIP’s joint embedding space. We generate a collection of style codes s ∈ S, and perturb only the c channel of each style code by adding a negative and a positive value. Denoting by ∆ic the CLIP space direction between the resulting pair of images, the relevance of channel c to the target manipulation is estimated as the mean projection of ∆ic onto ∆i:

다음으로, 목표 방향 ∆t와 동일 선상에있는 변화 ∆i를 산출하는 스타일 공간 조작 방향 ∆s를 구성하는 것이 목표입니다. 이를 위해 CLIP의 조인트 임베딩 공간에서 S의 각 채널 c와 주어진 방향 ∆i의 관련성을 평가해야합니다. 스타일 코드 s ∈ S 모음을 생성하고 음수 값과 양수 값을 추가하여 각 스타일 코드의 c 채널 만 섭동합니다. 결과 이미지 쌍 사이의 CLIP 공간 방향을 ∆ic로 표시하면 타겟 조작에 대한 채널 c의 관련성은 ∆i에 대한 ∆ic의 평균 투영으로 추정됩니다.

 

Rc(∆i) = Es∈S {∆ic · ∆i} (6)

In practice, we use 100 image pairs to estimate the mean. The pairs of images that we generate are given by G(s ± α∆sc), where ∆sc is a zero vector, except its c coordinate, which is set to the standard deviation of the channel. The magnitude of the perturbation is set to α = 5. Having estimated the relevance Rc of each channel, we ignore channels whose Rc falls below a threshold β. This parameter may be used to control the degree of disentanglement in the manipulation: using higher threshold values results in more disentangled manipulations, but at the same time the visual effect of the manipulation is reduced. Since various high-level attributes, such as age, involve a combination of several lower level attributes (for example, grey hair, wrinkles, and skin color), multiple channels are relevant, and in such cases lowering the threshold value may be preferable, as demonstrated in Figure 6. To our knowledge, the ability to control the degree of disentanglement in this manner is unique to our approach. In summary, given a target direction ∆i in CLIP space, we set ∆s =  ∆ic · ∆i if |∆ic · ∆i| ≥ β 0 otherwise (7) Figures 7 and 8 show a variety of edits along text-driven manipulation directions determined as described above on images of faces, cars, and dogs. The manipulations in Figure 7 are performed using StyleGAN2 pretrained on FFHQ [18]. The inputs are real images, embedded in W+ space using the e4e encoder [46]. The figure demonstrates textdriven manipulations of 18 attributes, including complex concepts, such as facial expressions and hair styles. The manipulations in Figure 8 use StyleGAN2 pretrained on LSUN cars [53] (on real images) and on generated images from StyleGAN2-ada [17] pretrained on AFHQ dogs [5].

실제로 평균을 추정하기 위해 100 개의 이미지 쌍을 사용합니다. 우리가 생성하는 이미지 쌍은 G (s ± α∆sc)로 주어지며, 여기서 ∆sc는 채널의 표준 편차로 설정된 c 좌표를 제외하고 0 벡터입니다. 섭동의 크기는 α = 5로 설정됩니다. 각 채널의 관련성 Rc를 추정 한 후 Rc가 임계 값 β 아래로 떨어지는 채널을 무시합니다. 이 매개 변수는 조작에서 엉킴의 정도를 제어하는 ​​데 사용할 수 있습니다. 임계 값이 더 높으면 조작이 더 많이 엉키지 않지만 동시에 조작의 시각적 효과가 감소합니다. 연령과 같은 다양한 상위 수준 속성은 여러 하위 수준 속성 (예 : 회색 머리카락, 주름 및 피부색)의 조합을 포함하므로 여러 채널이 관련되며 이러한 경우 임계 값을 낮추는 것이 바람직 할 수 있습니다. 우리가 아는 한 이러한 방식으로 풀림 정도를 제어하는 ​​능력은 우리의 접근 방식에 고유합니다. 요약하면 CLIP 공간에서 목표 방향 ∆i가 주어지면 ∆s = ∆ic · ∆i if | ∆ic · ∆i | ≥ β 0 그렇지 않은 경우 (7) 그림 7 및 8은 얼굴, 자동차 및 개 이미지에 대해 위에서 설명한대로 결정된 텍스트 기반 조작 방향에 따라 다양한 편집을 보여줍니다. 그림 7의 조작은 FFHQ [18]에서 사전 훈련 된 StyleGAN2를 사용하여 수행됩니다. 입력은 e4e 인코더를 사용하여 W + 공간에 포함 된 실제 이미지입니다 [46]. 이 그림은 얼굴 표정 및 헤어 스타일과 같은 복잡한 개념을 포함하여 18 가지 속성의 텍스트 기반 조작을 보여줍니다. 그림 8의 조작은 LSUN 차량 [53] (실제 이미지)과 AFHQ 개 [5]에서 사전 훈련 된 StyleGAN2-ada [17]에서 생성 된 이미지에 대해 사전 훈련 된 StyleGAN2를 사용합니다.

 

7. Comparisons and Evaluation 비교 및 ​​평가

We now turn to compare the three methods presented and analyzed in the previous sections among themselves and to other methods. All the real images that we manipulate are inverted using the e4e encoder [46].

이제 이전 섹션에서 제시하고 분석 한 세 가지 방법과 다른 방법을 비교해 보겠습니다. 우리가 조작하는 모든 실제 이미지는 e4e 인코더를 사용하여 반전됩니다 [46].

Text-driven image manipulation methods: We begin by comparing several text-driven facial image manipulation methods in Figure 9. We compare between our latent mapper method (Section 5), our global direction method (Section 6), and TediGAN [51]. For TediGAN, we use the authors’ official implementation, which has been recently updated to utilize CLIP for image manipulation, and thus is somewhat different from the method presented in their paper. We do not include results of the optimization method presented in Section 4, since its sensitivity to hyperparameters makes it time-consuming, and therefore not scalable.

텍스트 기반 이미지 조작 방법 : 그림 9에서 여러 텍스트 기반 얼굴 이미지 조작 방법을 비교하는 것으로 시작합니다. 잠재 매퍼 방법 (섹션 5), 글로벌 방향 방법 (섹션 6) 및 TediGAN [51]을 비교합니다. TediGAN의 경우 최근 이미지 조작에 CLIP을 활용하도록 업데이트 된 저자의 공식 구현을 사용하므로 논문에 제시된 방법과 다소 다릅니다. 섹션 4에 제시된 최적화 방법의 결과는 포함하지 않습니다. 하이퍼 파라미터에 대한 민감도는 시간이 많이 걸리고 확장 할 수 없기 때문입니다.

 

We perform the comparison using three kinds of attributes ranging from complex, yet specific (e.g., “Trump”), less complex and less specific (e.g., “Mohawk”), to simpler and more common (e.g., “without wrinkles”). The complex “Trump” manipulation, involves several attributes such as blonde hair, squinting eyes, open mouth, somewhat swollen face and Trump’s identity. While a global latent direction is able to capture the main visual attributes, which are not specific to Trump, it fails to capture the specific identity. In contrast, the latent mapper is more successful. The “Mohawk hairstyle” is a less complex attribute, as it involves only hair, and it isn’t as specific. Thus, both our methods are able to generate satisfactory manipulations. The manipulation generated by the global direction is slightly less pronounced, since the direction in CLIP space is an average one. Finally, for the “without wrinkles” prompt, the global direction succeeds in removing the wrinkles, while keeping other attributes mostly unaffected, while the mapper fails. We attribute this to W+ being less disentangled. We observed similar behavior on another set of attributes (“Obama”,“Angry”,“beard”). We conclude that for complex and specific attributes (especially those that involve identity), the mapper is able to produce better manipulations. For simpler and/or more common attributes, a global direction suffices, while offering more disentangled manipulations. We note that the results produced by TediGAN fail in all three manipulations shown in Figure 9.

복잡하지만 구체적인 속성 (예 : '트럼프'), 덜 복잡하고 덜 구체적인 속성 (예 : '모 호크'), 더 단순하고 일반적인 속성 (예 : '주름 없음')을 사용하여 비교를 수행합니다. 복잡한 '트럼프'조작은 금발 머리, 눈을 가늘게 뜨고 보는 눈, 열린 입, 다소 부은 얼굴, 트럼프의 정체성과 같은 여러 속성을 포함합니다. 글로벌 잠재 방향은 트럼프에만 국한되지 않는 주요 시각적 속성을 포착 할 수 있지만 특정 정체성은 포착하지 못합니다. 대조적으로 잠재 매퍼가 더 성공적입니다. '모 호크 헤어 스타일'은 머리카락 만 포함하고 구체적이지 않기 때문에 덜 복잡한 속성입니다. 따라서 두 방법 모두 만족스러운 조작을 생성 할 수 있습니다. 전역 방향에 의해 생성 된 조작은 CLIP 공간의 방향이 평균이므로 약간 덜 뚜렷합니다. 마지막으로 "주름 없음"프롬프트의 경우 전역 방향은 주름 제거에 성공하고 다른 속성은 대부분 영향을받지 않고 매퍼는 실패합니다. 우리는 이것을 W +가 덜 얽 히지 않았기 때문이라고 생각합니다. 우리는 다른 속성 세트 ( "Obama", "Angry", "beard")에서 유사한 동작을 관찰했습니다. 우리는 복잡하고 구체적인 속성 (특히 신원과 관련된 속성)의 경우 매퍼가 더 나은 조작을 생성 할 수 있다고 결론지었습니다. 더 간단하거나 더 일반적인 속성의 경우 전역 방향으로도 충분하며 더 많은 분리 된 조작을 제공합니다. TediGAN에 의해 ​​생성 된 결과는 그림 9에 표시된 세 가지 조작 모두에서 실패합니다.

 

Other StyleGAN manipulation methods: 기타 StyleGAN 조작 방법 :

In Figure 10, we show a comparison between our global direction method and several state-of-the-art StyleGAN image manipulation methods: GANSpace [13], InterFaceGAN [41], and StyleSpace [50]. The comparison only examines the attributes which all of the compared methods are able to manipulate (Gender, Grey hair, and Lipstick), and thus it does not include the many novel manipulations enabled by our approach. Since all of these are common attributes, we do not include our mapper in this comparison. Following Wu et al. [50], the manipulation step strength is chosen such that it induces the same amount of change in the logit value of the corresponding classifiers (pretrained on CelebA). It may be seen that in GANSpace [13] manipulation is entangled with skin color and lighting, while in InterFaceGAN [41] the identity may change significantly (when manipulating Lipstick). Our manipulation is very similar to StyleSpace [50], which only changes the target attribute, while all other attributes remain the same. In the supplementary material, we also show a comparison with StyleFLow [1], a state-of-the-art non-linear method. Our method produces results of similar quality, despite the fact that StyleFlow simultaneously uses several attribute classifiers and regressors (from the Microsoft face API), and is thus can manipulate a limited set of attributes. In contrast, our method requires no extra supervision.

그림 10에서는 GANSpace [13], InterFaceGAN [41] 및 StyleSpace [50]와 같은 몇 가지 최첨단 StyleGAN 이미지 조작 방법과 전역 방향 방법을 비교합니다. 비교는 모든 비교 방법이 조작 할 수있는 속성 (Gender, Gray hair, Lipstick) 만 검사하므로 우리의 접근 방식에 의해 활성화 된 많은 새로운 조작은 포함되지 않습니다. 이 모든 것이 공통 속성이므로이 비교에 매퍼를 포함하지 않습니다. Wu et al. [50] 조작 단계 강도는 해당 분류기 (CelebA에 대해 사전 훈련 된)의 로짓 값에서 동일한 양의 변화를 유도하도록 선택됩니다. GANSpace [13]에서 조작은 피부색과 조명과 얽혀있는 반면 InterFaceGAN [41]에서는 정체성이 크게 변경 될 수 있습니다 (립스틱 조작시). 우리의 조작은 대상 속성 만 변경하고 다른 모든 속성은 동일하게 유지하는 StyleSpace [50]와 매우 유사합니다. 보충 자료에서는 최첨단 비선형 방법 인 StyleFLow [1]과의 비교도 보여줍니다. 우리의 방법은 StyleFlow가 여러 속성 분류기 및 회귀 변수 (Microsoft face API)를 동시에 사용하므로 제한된 속성 집합을 조작 할 수 있음에도 불구하고 유사한 품질의 결과를 생성합니다. 대조적으로, 우리의 방법은 추가 감독이 필요하지 않습니다.

 

Limitations.

Our method relies on a pretrained StyleGAN generator and CLIP model for a joint language-vision embedding. Thus, it cannot be expected to manipulate images to a point where they lie outside the domain of the pretrained generator (or remain inside the domain, but in regions that are less well covered by the generator). Similarly, text prompts which map into areas of CLIP space that are not well populated by images, cannot be expected to yield a visual manipulation that faithfully reflects the semantics of the prompt. We have also observed that drastic manipulations in visually diverse datasets are difficult to achieve. For example, while tigers are easily transformed into lions (see Figure 1), we were less successful when transforming tigers to wolves, as demonstrated in the supplementary material.

우리의 방법은 공동 언어 비전 임베딩을 위해 사전 훈련 된 StyleGAN 생성기와 CLIP 모델에 의존합니다. 따라서 이미지가 사전 훈련 된 생성기의 도메인 외부에있는 지점 (또는 도메인 내부에 남아 있지만 생성기가 잘 적용되지 않는 영역)으로 이미지를 조작 할 수 없습니다. 마찬가지로 이미지로 채워지지 않은 CLIP 공간 영역에 매핑되는 텍스트 프롬프트는 프롬프트의 의미를 충실하게 반영하는 시각적 조작을 생성 할 것으로 기대할 수 없습니다. 우리는 또한 시각적으로 다양한 데이터 세트에서 과감한 조작을 달성하기 어렵다는 것을 관찰했습니다. 예를 들어, 호랑이는 쉽게 사자로 변형되지만 (그림 1 참조), 보충 자료에서 입증 된 것처럼 호랑이를 늑대로 변형 할 때는 덜 성공적이었습니다.

 

8. Conclusions

We introduced three novel image manipulation methods, which combine the strong generative powers of StyleGAN with the extraordinary visual concept encoding abilities of CLIP. We have shown that these techniques enable a wide variety of unique image manipulations, some of which are impossible to achieve with existing methods that rely on annotated data. We have also demonstrated that CLIP provides fine-grained edit controls, such as specifying a desired hair style, while our method is able to control the manipulation strength and the degree of disentanglement. In summary, we believe that text-driven manipulation is a powerful image editing tool, whose abilities and importance will only continue to grow.

StyleGAN의 강력한 생성 능력과 CLIP의 뛰어난 시각적 개념 인코딩 능력을 결합한 세 가지 새로운 이미지 조작 방법을 도입했습니다. 우리는 이러한 기술이 다양한 고유 한 이미지 조작을 가능하게한다는 것을 보여주었습니다.이 중 일부는 주석이 달린 데이터에 의존하는 기존 방법으로는 달성 할 수 없습니다. 또한 CLIP이 원하는 헤어 스타일을 지정하는 등 세밀한 편집 컨트롤을 제공하는 반면, 우리의 방법은 조작 강도와 엉킴 정도를 제어 할 수 있음을 보여주었습니다. 요약하면 텍스트 기반 조작은 강력한 이미지 편집 도구이며 그 능력과 중요성은 계속해서 증가 할 것입니다.

 

A. Latent Mapper – Ablation Study 잠재 매퍼 – 절제 연구

In this section, we study the importance of various choices in the design of our latent mapper (Section 5).

이 섹션에서는 잠재 매퍼 설계에서 다양한 선택의 중요성을 연구합니다 (섹션 5).

 

A.1. Architecture

The architecture of the mapper is rather simple and with relatively small number of parameters. Moreover, it has negligible effect on the inference time. Yet, it is natural to compare the presented architecture, which consists of three different mapping networks, to an architecture with a single mapping network. Intuitively, using a separate network for each group of style vector entries should better enable changes at several different levels of detail in the image. Indeed, we find that with driving text that requires such changes, e.g. “Donald Trump”, a single mapping network does not yield results that are as effective as those produced with three. An example is shown in Figure 11. Although the full, three network mapper, gives better results for some driving texts, as mentioned in Section 5, we note that not all the three are needed when the manipulation should not affect some attributes. For example, for the hairstyle edits shown in Figure 5, the manipulation should not affect the color scheme of the image. Therefore, we perform these edits when training Mc and Mm only, that is, Mt(w) = (Mc t (wc), Mm t (wm), 0). We show a comparison in Figure 12. As can be seen, by removing Mf from the architecture, we get slightly better results. Therefore, for the sake of simplicity and generalization of the method, we chose to describe the method with all three networks. In the main paper, the results shown were obtained with all three networks, while here we also show results with only two (without Mf).

매퍼의 아키텍처는 비교적 간단하고 매개 변수 수가 상대적으로 적습니다. 또한 추론 시간에 거의 영향을 미치지 않습니다. 그러나 세 개의 다른 매핑 네트워크로 구성된 제시된 아키텍처를 단일 매핑 네트워크가있는 아키텍처와 비교하는 것은 당연합니다. 직관적으로, 스타일 벡터 항목의 각 그룹에 대해 별도의 네트워크를 사용하면 이미지의 여러 세부 수준에서 변경을 더 잘 수행 할 수 있습니다. 사실, 우리는 그러한 변경이 필요한 운전 텍스트에서 그것을 발견합니다. 단일 매핑 네트워크 인 "Donald Trump"는 3 개로 생성 된 것만 큼 효과적인 결과를 산출하지 못합니다. 그림 11에 예제가 나와 있습니다. 전체 3 개의 네트워크 매퍼가 섹션 5에서 언급 한 것처럼 일부 운전 텍스트에 대해 더 나은 결과를 제공하지만 조작이 일부 속성에 영향을주지 않아야하는 경우 세 가지 모두가 필요하지는 않습니다. 예를 들어 그림 5에 표시된 헤어 스타일 편집의 경우 조작이 이미지의 색 구성표에 영향을주지 않아야합니다. 따라서 Mc와 Mm 만 훈련 할 때, 즉 Mt (w) = (Mc t (wc), Mm t (wm), 0)을 훈련 할 때 이러한 편집을 수행합니다. 그림 12에서 비교를 보여줍니다. 알 수 있듯이 아키텍처에서 Mf를 제거하면 약간 더 나은 결과를 얻을 수 있습니다. 따라서 방법의 단순성과 일반화를 위해 세 네트워크 모두에서 방법을 설명하기로 선택했습니다. 주요 논문에서 표시된 결과는 세 네트워크 모두에서 얻은 반면 여기에서는 Mf가없는 두 개의 결과 만 표시합니다.

 

A.2. Losses

CLIP Loss

To show the uniqueness of using a “celeb edit” with CLIP, we perform the following experiment. Instead of using the CLIP loss, we use the identity loss with respect to a single image of the desired celeb. Specifically, we perform this experiment by using an image of Beyonce. The results are shown in Figure 13. As can be seen, CLIP guides the mapper to perform a unique edit which cannot be achieved by simply using a facial recognition network.

CLIP에서 "명사 편집"을 사용하는 고유성을 보여주기 위해 다음과 같은 실험을 수행합니다. CLIP 손실을 사용하는 대신 원하는 유명인의 단일 이미지에 대해 ID 손실을 사용합니다. 구체적으로 비욘세의 이미지를 사용하여이 실험을 수행합니다. 그 결과는 그림 13에 나와 있습니다. 볼 수 있듯이 CLIP는 단순히 얼굴 인식 네트워크를 사용하여 달성 할 수없는 고유 한 편집을 수행하도록 매퍼를 안내합니다.

ID Loss

Here we show that the identity loss is significant for preserving the identity of the person in the input image. When using the default parameter setting of λL2 = 0.8 with λID = 0 (i.e., no identity loss), we observe that the mapper fails to preserve the identity, and introduces large changes. Therefore, we also experiment with λL2 = 1.6, however, this still does not preserve the original identity well enough. The results are shown in Figure 14.

여기서 우리는 입력 이미지에서 사람의 신원을 보존하기 위해 신원 손실이 중요하다는 것을 보여줍니다. λID = 0 (즉, 신원 손실 없음)과 함께 λL2 = 0.8의 기본 매개 변수 설정을 사용할 때 매퍼가 신원을 유지하지 못하고 큰 변화를 도입하는 것을 관찰합니다. 따라서 우리는 또한 λL2 = 1.6으로 실험하지만 이것은 여전히 ​​원래의 정체성을 충분히 잘 보존하지 못합니다. 결과는 그림 14에 나와 있습니다.

B. Additional Results

In this section we provide additional results to those presented in the paper. Specifically, we begin with a variety of image manipulations obtained using our latent mapper. All manipulated images are taken from the CelebA-HQ and were inverted by e4e [46]. In Figure 15 we show a large gallery of hair style manipulations. In Figures 16 and 17 we show “celeb” edits, where the input image is manipulated to resemble a certain target celebrity. In Figure 18 we show a variety of expression edits.

이 섹션에서는 논문에 제시된 추가 결과를 제공합니다. 특히, 우리는 잠재 매퍼를 사용하여 얻은 다양한 이미지 조작으로 시작합니다. 모든 조작 된 이미지는 CelebA-HQ에서 가져온 것이며 e4e [46]에 의해 반전되었습니다. 그림 15에서는 헤어 스타일 조작의 큰 갤러리를 보여줍니다. 그림 16과 17에서는 입력 이미지가 특정 대상 유명인과 유사하도록 조작되는 "명사"편집을 보여줍니다. 그림 18에서는 다양한 표현식 편집을 보여줍니다.

Next, Figure 19 shows a variety of edits on non-face datasets, performed along text-driven global latent manipulation directions (Section 6).

다음으로, 그림 19는 텍스트 기반 글로벌 잠재 조작 방향 (섹션 6)에 따라 수행 된 얼굴이 아닌 데이터 세트에 대한 다양한 편집을 보여줍니다.

Figure 20 shows image manipulations driven by the prompt “a photo of a male face” for different manipulation strengths and disentanglement thresholds. Moving along the global direction, causes the facial features to become more masculine, while steps in the opposite direction yields more feminine features. The effect becomes stronger as the strength α increases. When the disentanglement threshold β is high, only the facial features are affected, and as β is lowered, additional correlated attributes, such as hair length and facial hair are affected as well.

그림 20은 다양한 조작 강도와 풀림 임계 값에 대한 프롬프트 "남성 얼굴 사진"에 의해 구동되는 이미지 조작을 보여줍니다. 글로벌 방향을 따라 이동하면 얼굴 특징이 더 남성적이되고 반대 방향으로 단계가 더 여성스러운 특징이 생성됩니다. 강도 α가 증가할수록 효과가 더 강해집니다. 풀림 임계 값 β가 높으면 얼굴 특징 만 영향을 받고 β가 낮아지면 머리카락 길이 및 얼굴 털과 같은 추가 상관 속성도 영향을받습니다.

In Figure 21, we show another comparison between our global direction method and several state-of-the-art StyleGAN image manipulation methods: GANSpace [13], InterFaceGAN [41], and StyleSpace [50]. The comparison only examines the attributes which all of the compared methods are able to manipulate (Gender, Grey hair, and Lipstick), and thus it does not include the many novel manipulations enabled by our approach. Following Wu et al. [50], the manipulation step strength is chosen such that it induces the same amount of change in the logit value of the corresponding classifiers (pretrained on CelebA). It may be seen that in GANSpace [13] manipulation is entangled with skin color and lighting, while in InterFaceGAN [41] the identity may change significantly (when manipulating Lipstick). Our manipulation is very similar to StyleSpace [50], which only changes the target attribute, while all other attributes remain the same.

그림 21에서는 GANSpace [13], InterFaceGAN [41] 및 StyleSpace [50]와 같은 몇 가지 최신 StyleGAN 이미지 조작 방법과 글로벌 방향 방법을 비교합니다. 비교는 모든 비교 방법이 조작 할 수있는 속성 (Gender, Gray hair, Lipstick) 만 검사하므로 우리의 접근 방식에 의해 활성화 된 많은 새로운 조작은 포함되지 않습니다. Wu et al. [50] 조작 단계 강도는 해당 분류기 (CelebA에 대해 사전 훈련 된)의 로짓 값에서 동일한 양의 변화를 유도하도록 선택됩니다. GANSpace [13]에서 조작은 피부색과 조명과 얽혀있는 반면 InterFaceGAN [41]에서는 정체성이 크게 변경 될 수 있습니다 (립스틱 조작시). 우리의 조작은 대상 속성 만 변경하고 다른 모든 속성은 동일하게 유지하는 StyleSpace [50]와 매우 유사합니다.

Figure 22 shows a comparison between StyleFlow [1] and our global directions method. It may be seen that our method is able to produce results of comparable visual quality, despite the fact that StyleFlow requires the simultaneous use of several attribute classifiers and regressors (from the Microsoft face API), and is thus able to manipulate a limited set of attributes. In contrast, our method required no extra supervision to produce these and all of the other manipulations demonstrated in this work.

그림 22는 StyleFlow [1]과 글로벌 길 찾기 방법을 비교 한 것입니다. StyleFlow가 여러 속성 분류기 및 회귀 자 (Microsoft face API에서)를 동시에 사용해야하고 따라서 제한된 집합을 조작 할 수 있다는 사실에도 불구하고 우리의 방법이 비슷한 시각적 품질의 결과를 생성 할 수 있음을 알 수 있습니다. 속성. 대조적으로, 우리의 방법은 이러한 작업과이 작업에서 입증 된 다른 모든 조작을 생성하기 위해 추가 감독이 필요하지 않았습니다.

Figure 23 shows an additional comparison between textdriven manipulation using our global directions method and our latent mapper. Our observations are similar to the ones we made regarding Figure 10 in the main paper. Finally, Figure 24 demonstrates that drastic manipulations in visually diverse datasets are sometimes difficult to achieve using our global directions. Here we use StyleGAN-ada [17] pretrained on AFHQ wild [5], which contains wolves, lions, tigers and foxes. There is a smaller domain gap between tigers and lions, which mainly involves color and texture transformations. However, there is a larger domain gap between tigers and wolves, which, in addition to color and texture transformations, also involves more drastic shape deformations. This figure demonstrates that our global directions method is more successful in transforming tigers into lions, while failing in some cases to transform tigers to wolves.

그림 23은 글로벌 길 찾기 방법과 잠재 매퍼를 사용한 텍스트 기반 조작 간의 추가 비교를 보여줍니다. 우리의 관찰은 본문의 그림 10과 관련하여 우리가 만든 것과 유사합니다. 마지막으로, 그림 24는 시각적으로 다양한 데이터 세트에서 과감한 조작이 때때로 글로벌 방향을 사용하여 달성하기 어렵다는 것을 보여줍니다. 여기에서는 늑대, 사자, 호랑이 및 여우가 포함 된 AFHQ 야생 [5]에 대해 사전 훈련 된 StyleGAN-ada [17]를 사용합니다. 주로 색상 및 질감 변환과 관련된 호랑이와 사자 사이에 더 작은 도메인 간격이 있습니다. 그러나 호랑이와 늑대 사이에는 더 큰 도메인 갭이 있으며, 색상 및 질감 변형 외에도 더 급격한 모양 변형이 포함됩니다. 이 그림은 우리의 글로벌 방향 방법이 호랑이를 사자로 바꾸는 데 더 성공적 이었지만 경우에 따라 호랑이를 늑대로 바꾸는 데 실패했음을 보여줍니다.

 

C. Video

We show examples of interactive text-driven image manipulation in our supplementary video. We use a simple heuristic method to determine the initial disentanglement threshold (β). The threshold is chosen such that k channels will be active. For real face manipulation, we set the initial strength to α = 3 and the disentanglement threshold so that k = 20. For real car manipulation, we set the initial values to α = 3 and k = 100. For generated cat manipulation, we set the initial values to α = 7 and k = 100.

보충 비디오에서 대화 형 텍스트 기반 이미지 조작의 예를 보여줍니다. 간단한 휴리스틱 방법을 사용하여 초기 풀림 임계 값 (β)을 결정합니다. 임계 값은 k 채널이 활성화되도록 선택됩니다. 실제 얼굴 조작의 경우 초기 강도를 α = 3으로 설정하고 풀림 임계 값을 k = 20으로 설정합니다. 실제 자동차 조작의 경우 초기 값을 α = 3 및 k = 100으로 설정합니다. 생성 된 고양이 조작에 대해 설정합니다. 초기 값은 α = 7 및 k = 100입니다.