9
Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin * , Yanwei Fu * , Leonid Sigal and Xiangyang Xue * * The school of Data Science, Fudan University, Disney Research, Corresponding authour: [email protected] Abstract Generating and manipulating human facial images using high-level attributal controls are important and interesting problems. The models proposed in previous work can solve one of these two problems (generation or manipulation), but not both coherently. This paper proposes a novel model that learns how to both generate and modify the facial im- age from high-level semantic attributes. Our key idea is to formulate a Semi-Latent Facial Attribute Space (SL-FAS) to systematically learn relationship between user-defined and latent attributes, as well as between those attributes and RGB imagery. As part of this newly formulated space, we propose a new model – SL-GAN which is a specific form of Generative Adversarial Network. Finally, we present an it- erative training algorithm for SL-GAN. The experiments on recent CelebA and CASIA-WebFace datasets validate the ef- fectiveness of our proposed framework. We will also make data, pre-trained models and code available. 1. Introduction Analysis of faces is important for biometrics, non-verbal communication, and affective computing. Approaches that perform face detection [3, 21], facial recognition [1, 33, 41], landmark estimation [2, 44], face verification [36, 37] and action coding have received significant attention over the past 20+ years in computer vision. However, an important problem of generation (or modification) of facial images based on high-level intuitive descriptions remains largely unexplored. For example, it would be highly desirable to generate a realistic facial composite based on eyewitness’ high level attributal description (e.g., young, male, brown hair, pale skin) of the suspect. Further, modifying facial at- tributes of a given person can help to inform criminal inves- tigation by visualizing how a suspect may change certain aspects of their appearance to avoid capture. In more in- nocuous use cases, modifying facial attributes may help a person visualize what he or she may look like with a differ- Mouth slightly open Male Narrow eyes Smiling Pale skin (a) Generating facial images given an attribute vector Original Narrow eyes Black hair Blond hair Reconstructed Pale skin Male (b) Modifying facial images by giving an attribute Figure 1. Examples of generation and modification of facial im- ages using attributes. Red box indicates that the inverse of an attribute is used in generation or modification (e.g., in top row of (a) red boxes indicate not male and not smiling). Note that in (a) we use an attribute vector for generation, but only one attribute dimension is labeled in each column for clarity of illustration. ent hair color, style, makeup and so on. In this paper, we are interested in two related tasks: (i) generation of facial images based on high-level attribute descriptions and (ii) modifying facial images based on the high-level attributes. The difference in the two tasks is im- portant, for generation one is interested in generating (a sample) image from a distribution of facial images that con- 1 arXiv:1704.02166v1 [cs.CV] 7 Apr 2017

Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

Semi-Latent GAN: Learning to generate and modify facial images fromattributes

Weidong Yin∗, Yanwei Fu∗√

, Leonid Sigal† and Xiangyang Xue∗∗ The school of Data Science, Fudan University,

† Disney Research,√

Corresponding authour: [email protected]

Abstract

Generating and manipulating human facial images usinghigh-level attributal controls are important and interestingproblems. The models proposed in previous work can solveone of these two problems (generation or manipulation), butnot both coherently. This paper proposes a novel modelthat learns how to both generate and modify the facial im-age from high-level semantic attributes. Our key idea is toformulate a Semi-Latent Facial Attribute Space (SL-FAS) tosystematically learn relationship between user-defined andlatent attributes, as well as between those attributes andRGB imagery. As part of this newly formulated space, wepropose a new model – SL-GAN which is a specific form ofGenerative Adversarial Network. Finally, we present an it-erative training algorithm for SL-GAN. The experiments onrecent CelebA and CASIA-WebFace datasets validate the ef-fectiveness of our proposed framework. We will also makedata, pre-trained models and code available.

1. IntroductionAnalysis of faces is important for biometrics, non-verbal

communication, and affective computing. Approaches thatperform face detection [3, 21], facial recognition [1, 33, 41],landmark estimation [2, 44], face verification [36, 37] andaction coding have received significant attention over thepast 20+ years in computer vision. However, an importantproblem of generation (or modification) of facial imagesbased on high-level intuitive descriptions remains largelyunexplored. For example, it would be highly desirable togenerate a realistic facial composite based on eyewitness’high level attributal description (e.g., young, male, brownhair, pale skin) of the suspect. Further, modifying facial at-tributes of a given person can help to inform criminal inves-tigation by visualizing how a suspect may change certainaspects of their appearance to avoid capture. In more in-nocuous use cases, modifying facial attributes may help aperson visualize what he or she may look like with a differ-

Mouth slightly open

MaleNarrow eyes

SmilingPale skin

(a) Generating facial images given an attribute vector

OriginalNarrow eyes

Black hair

Blond hairReconstructed

Pale skin Male

(b) Modifying facial images by giving an attributeFigure 1. Examples of generation and modification of facial im-ages using attributes. Red box indicates that the inverse of anattribute is used in generation or modification (e.g., in top row of(a) red boxes indicate not male and not smiling). Note that in (a)we use an attribute vector for generation, but only one attributedimension is labeled in each column for clarity of illustration.

ent hair color, style, makeup and so on.In this paper, we are interested in two related tasks: (i)

generation of facial images based on high-level attributedescriptions and (ii) modifying facial images based on thehigh-level attributes. The difference in the two tasks is im-portant, for generation one is interested in generating (asample) image from a distribution of facial images that con-

1

arX

iv:1

704.

0216

6v1

[cs

.CV

] 7

Apr

201

7

Page 2: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

tain user-specified attributes. For modification, we are inter-ested in obtaining an image of the pre-specified subject withcertain attributes changed. In both cases, one must take careto ensure that the resulting image is of high visual quality; inthe modification case, however, there is an additional con-straint that identity of the person must be maintained. Intu-itively, solving these two tasks requires a generative modelthat models semantic (attributal) space of faces and is ableto decouple identity-specific and identity-independent as-pects of the generative process.

Inspired by [10], we formulate the Semi-Latent FacialAttribute Space (SL-FAS) which is a composition of two,user-defined and latent, attribute subspaces. Each dimen-sion of user-defined attribute subspace corresponds to onehuman labeled interpretable attribute. The latent attributespace is learned in a data-driven manner and learns a com-pact hidden structure from facial images.

The two subspaces are coupled, making learning of SL-FAS challenging. Recently, in [42], attribute-conditioneddeep variational auto-encoder framework was proposed thatcan learn latent factors (i.e. attributes) of data and generateimages given those attributes. In [42], only the latent factorsare learned and the user-defined attributes are given as input.Because of this, they can not model the distribution of user-defined attributes for a given an image; leading to inabilityto modify the image using semantic attributes. Inspired byInfoGAN [4], we propose a network that jointly models thesubspace of user-defined and latent attributes.

In this paper, to jointly learn the SL-FAS, we proposea Semi-Latent Generative Adversarial Network (SL-GAN)framework which is composed of three main components,namely, (i) encoder-decoder network, (ii) GAN and (iii)recognition network. In encoder-decoder network, the en-coder network projects the facial images into SL-FAS andthe decoder network reconstructs the images by decodingthe attribute vector in SL-FAS. Thus the decoder networkcan be used as a generator to generate an image if givenan attribute vector. The GAN performs the generator anddiscriminator min-max game to ensure the generated im-ages are of good quality, by ensuring that generated imagescannot be discriminated from the real ones. Recognitionnetwork is the key recipe of jointly learning user-definedand latent attributes from data. Particularly, the recognitionnetwork is introduced to maximize the mutual informationbetween generated images and attributes in SL-FAS. Figure1 gives the examples of generating and modifying the facialattributes. As shown in the first and third rows of modifica-tion Figure 1 (b), our SL-GAN can modify the attributes offacial images in very noise background.

Contributions. (1) To the best of our knowledge, there isno previous work that can do both generation and modifica-tion of facial images using visual attributes. Our frameworkonly uses high-level semantic attributes to modify the fa-

cial images. (2) Our SL-GAN can systematically learn theuser-defined and latent attributes from data by formulatinga semi-latent facial attribute space. (3) A novel recognitionnetwork is proposed that is used to jointly learn the user-defined and latent attributes from data. (4) Last but not theleast, we propose an iterative training algorithm to train SL-GAN in order to solve two related and yet different tasks atthe same time.

2. Related WorkAttribute Learning. Attribute-centric semantic represen-tations have been widely investigated in multi-task [31]and transfer learning [19]. Most early works [19] had as-sumed a space of user-defined namable properties as at-tributes. User-defined facial attributes [5, 9, 30, 40, 45, 18]had also been explored. These attributes, however, is hardand prohibitively expensive to specify, due to the manualeffort required in defining the the attributal set and annotat-ing images with that set. To this end, latent attributes [10]have been explored for mining the attributes directly fromdata. It is important to note that user-defined and latent at-tributes are complementary to one another and can be usedand learned simultaneously, forming a semi-latent attributespace. Our SL-GAN model is a form of semi-latent attributespace specifically defined for generation and modificationof facial images.

Deep Generative Image Modeling. Algorithmic genera-tion of realistic images has been the focus of computer vi-sion for some time. Early attempts along these lines dateback to 2006 with Deep Belief Networks (DBNs) [13].DBNs were successful for small image patch generation,but failed to generalize to larger images and more holisticstructures. Recent models that address these challenges, in-clude auto-regressive models [16, 38, 39], Variational Auto-Encoders (VAEs) [20, 35, 42], Generative Adversarial Net-works (GANs) [4, 6, 7, 8, 11, 14, 17, 24, 27, 28, 29], andDeep Recurrent Attention Writer (DRAW) [12]. InfoGAN[4] and stackGAN [14] utilized the recognition network tomodel the latent attributes, while our SL-GAN extends therecognition network to jointly model user-defined and la-tent attributes and thus our framework can both generateand modify the facial images using attributes.

Semantic Image Generation. More recently, there hasbeen a focus on generating images conditioned on seman-tic information (e.g., text, pose or attributes). Reeds et al.[28] studied the problem of automatic synthesis of realis-tic images from text using deep convolutional GANs. Yanet al. [42] proposed an attribute-conditioned deep varia-tional auto-encoder framework that enables image genera-tion from visual attributes. Mathieu et al. [23] learned thehidden factors within a set of observations in the conditionalgenerative model. However, their frameworks can only gen-

Page 3: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

Figure 2. Overview of our SL-GAN.

erate the images rather than modifying an existing imagebased on attributes or other form of semantic information.Image Editing and Synthesis. Our work is also relatedto previous work on image editing [15, 26, 34, 46]. Theformulation in [47] also enables task of image editing us-ing GAN, where the user strokes are used to specify theattributes being changed. In contrast, our SL-GAN doesnot need user strokes as input. Very recently, two technicalreports [26, 34] can also enable modifying the attribute offacial images. [34] proposed a GAN-based image transfor-mation networks for face attribute manipulation. In [34],one trained model can only modify one type attribute in fa-cial images; in contrast, our SL-GAN can learn to generateor modify many attributes simultaneously. In fact, our mod-els on CelebA dataset can generate or modify 17 differentfacial attributes all at ones.

3. Semi-Latent GAN (SL-GAN)3.1. Background

GAN [11] aims to learn to discriminate real data samplesfrom generated samples; training the generator network Gto fool the discriminator network D. GAN is optimizedusing the following objective,

minG

maxDLGAN = Ex∼pdata(x) [logD (x)] (1)

+Ez∼pprior(z) [log (1−D (G (z)))] ,

where pdata (x) is the distribution of real data; pprior (z) isa zero-mean Gaussian distribution N (0,1). The parame-ters of G and D are updated iteratively in training. The lossfunction for generator and discriminator are LD = LGAN

and LG = −LGAN respectively. To generate an image,generator draws a sample z ∼ pprior (z) = N (0,1) fromprior (a.k.a., noise distribution) and then transforms thatsample using a generator network G, i.e., G(z).

InfoGAN [4] decomposes the input noise of GAN into la-tent representation y and incompressible noise z by maxi-mizing the mutual information I (y;G (z, y)) and it ensures

no loss information of latent representation during genera-tion. The mutual information term can be described as therecognition loss,Lrg = −Ex∼G(z,y)

[Ey∼pdata(y|x) [logQ(y | x)]

]where Q (y | x) is an approximation of the posteriorpdata (y | x). Thus the parameters of the generator G canthus be updated as LGInfoGAN

= LG − Lrg. InfoGAN canlearn the disentangled, interpretable and meaningful repre-sentations in a completely unsupervised manner.

VAEGAN [20] combines the VAE into GAN and re-places the element-wise errors of GAN with feature-wiseerrors of VAEGAN in the data space. Specifically, it en-codes the data sample x to latent representation z: z ∼Enc (x) = penc (z | x) and decodes the z back to dataspace: x ∼ Dec (x | z) = pdec (x | z). We can definethe loss functions of the regularization prior as Lprior =KL (qenc (z | x) ‖ pprior (z)) , qenc (z | x) is the approxi-mation to the true posterior pdec (z | x). The reconstructionerror is LDl

recon = −Eqenc(z|x) [logpdec (Dl (x) | z)] whereDl (x) is hidden representation of l−th layer of the discrim-inator. Thus this loss minimizes the sum of the expected loglikelihood of the data representation of l − th layer of dis-criminator. Thus the loss function of VAEGAN is

LV AEGAN = LGAN + LDlrecon + Lprior (2)

However the latent representation z is totally unsupervised;there is no way to explicitly control the attributes over thedata or modify facial images using attributes.

CVAE [42, 35] is the conditional VAE. The independentattribute variable y is introduced to control the generatingprocess of x by sampling from p (x | y, z); where p (y, z) =p (y) p (z). The encoder and decoder networks of CVAE arethus z ∼ Enc (x) = qenc (z | x) and x ∼ Dec (z, y) =pdec (x | z, y). The variable y is introduced to control thegenerate process of x by sampling from p (x | y, z); wherep (y, z) = p (y) p (z). Nevertheless, y is still sampled fromdata, rather than being directly optimized and learned fromthe data as our SL-GAN. Thus y can be used to modify theattributes similar to proposed SL-GAN.

3.2. Semi-Latent Facial Attribute Space

The input noise of GAN can be further decomposed intotwo parts: (1) User-defined attributes y are the manuallyannotated attributes of each image x, i.e. y ∼ pdata (y | x);(2) Latent attributes zla indicate the attributes that shouldbe mined from the data1 in a data-driven manner, i.e., zla ∼pdata (zla | x).

Mathematically, the y and zla can be either univariateor multivariate; and these attributes are mutual indepen-dent, i.e., p (y, zla) = p (y) p (zla). Each dimension of y

1Note that the latent attribute zla also includes the incompressiblenoise, which is not explicitly modelled due to less impact to our frame-work.

Page 4: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

is clipped with one type of facial attribute annotated in realimages; our SL-GAN train y in a supervised manner. Incontrast, each dimension of zla is trained totally unsuper-vised. We define semi-latent facial attribute space to com-bine both y attributes and the latent zla attributes.

With the decomposed input noise, the form of generatoris G (zla, y) now. Directly learning zla from input data willlead to the trivial solution that the generator is inclined toignore the latent attributes as pG (x | zla, y) = pG (x | y).In contrast, we maximize the mutual information betweenthe attributes zla and the generator distribution G (zla, y),which can be simplified as minimizing the recognition lossfor the attribute y and zla.

It is important to jointly learn the attributes y and zla; andmake sure that zla can represent un-modeled aspects of theinput facial images rather than re-discovering y. The “re-discovering” means that some dimensions of zla have verysimilar distribution as the distribution of y over the inputimages, i.e., the same patterns in y repeatedly discoveredfrom latent attributes zla

3.3. Semi-Latent GAN

Our SL-GAN is illustrated in Fig. 2; it is composed ofthree parts, namely, encoder-decoding network, GAN andrecognition network. The user-defined and latent attributesare encoded and decoded by the encoder-decoder network.Recognition network helps learn the SL-FAS from data. Inour SL-GAN, the recognition network and discriminatorshares the same network structure and have different soft-max layer at the last layer. The loss functions of the gener-ator GSL−GAN and discriminator DSL−GAN are thus,

LGSL−GAN= LG + λ1

(Lrgz + Lrgy−G

)+ λ2LDl

recon

(3)

LDSL−GAN= LD +

(Lrgy−D + Lrgz

)(4)

where Lrgz is the recognition loss on zla. For recognitionloss on y, we use Lrgy−D and Lrgy−G as the loss for thediscriminator and generator respectively. We also define thedecoder loss as Ldec = LGSL−GAN

; and the encoder lossas Lenc = LV AE .

Encoder loss Lenc is the sum of reconstruction errorof the variational autoencoder and a prior regulariza-tion term over the latent distribution zla; thus it isdefined as LV AE = Lprior + Lrecon; and the Lprior =KL (qenc (zla | x) ‖ pprior (zla)) measures the KL-divergence between approximate posterior qenc (zla | x)and the prior pprior (zla). The reconstruction loss Lrecon =−Ez∼qenc(zla|x),y∼pdata(y|x) [log pdec (x | zla, y)] measuresloss of reconstructing generated images by sampling theattributes in SL-FAS. Here, qenc (zla | x) is an approxima-tion of penc (zla | x) parameterized by a neural network,e.g., the encoder.

The recognition loss of zla is trained on both generateddata and real data. It aims at predicting the values of latentattributes. Suppose the latent zla ∼ penc (z | x) is sampledfrom the distribution of encoder network. The update stepsof generator and discriminator use the same recognition losson zla defined as,

Lrgz = −Ex∼pdata(x),z∼penc(zla|x) [log (Q (z | x))] (5)−Ex∼pdec(x|z,y),y∼pdata(y|x),z∼penc(zla|x) [log (Q (z | x))]−Ex∼pdec(x|y,z),y∼pdata(y),z∼pprior(zla) [log (Q (z | x))]−Ex∼pdec(x|z,y),y∼pdata(y),z∼penc(zla|x) [log (Q (z | x))] ,

where −Ex∼pdata(x),z∼penc(zla|x) [log (Q (z | x))] mea-sures the loss of predicting errors on real data; and restthree term are the loss functions on generated data. Q (·) isstill an approximation of the corresponding posterior datadistribution. penc (zla | x) is the distribution of zla givenx parameterized by the encoder network; pdata (y) is thedata distribution of y on real data; pdata (y | x) is the datadistribution of y given x on the real data; pdata (x) is thedata distribution of x on the real data; pprior (zla) is theprior distribution of z and we use the Gaussian distributionN (0,1); pdec (x | zla, y) is the distribution of x given zlaand y, and the distribution is parameterized by the decodernetwork; penc (zla | x) is the distribution of z given x andthe distribution parameterized by the encoder network;

The recognition loss of y can be trained on real dataand generated data. In training stage of discriminatorDSL−GAN , we have the ground-truth attribute annotationsfor user-defined y without using the generated data. Thereason is that the quality of generated data relies on thetraining quality of generator GSL−GAN , which is alsotrained from the real data; thus we will observe a phenom-ena of “semantic drift” if the data is generated by a not welltrained generator. To that end, only the manually labeled at-tribute y can be used for updating DSL−GAN ; and the lossof updating D is

Lrgy−D=−Ex∼pdata(x),y∼pdata(y|x) [log (Q (y | x))] (6)

GSL−GAN is corresponding to the decoder-network, andthus only generated data can be used to compute the loss ofgenerator,

Lrgy−G =−Ex∼pdec(x|y,z),z∼penc(z|x),y∼pdata(y) [log (Q (y | x))]−Ex∼pdec(x|y,z),z∼penc(z|x),y∼pdata(y|x) [log (Q (y | x))]−Ex∼pdec(x|y,z),z∼pprior(z),y∼pdata(y|x) [log (Q (y | x))]

(7)Note that intrinsically in each term in Eq (5) and (7) couldbe weighted by a coefficient. Here we omit these coeffi-cients for the ease of notation.

Page 5: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

3.4. The training algorithms

Our SL-GAN aims at solving generation and modifica-tion of facial images via attributes. The key ingredientsare to learn a disentangled representation of data-driven at-tributes zla and user-defined attributes y unified in our SL-GAN framework. Our SL-GAN is composed of three keycomponents and aims at solving two related and yet verydifferent problems – generation and modification of facialimages. The conventional way of training GAN does notwork in our problem. Thus we propose a new training al-gorithms to train our SL-GAN. Specifically, one iteration ofour algorithm needs to finish the following three stages,

Learning facial image reconstruction. This stage mainlyupdates the encoder-decoder network and learns to recon-struct the image given corresponding user-defined attributeswith the steps of,

• Sampling a batch of images x ∼ pdata(x) and at-tributes y ∼ pdata(y|x), zla ∼ penc (z | x)

• Updating the SL-GAN by minimizing the en-coder Lenc, Decoder Ldec and Discriminator withLDSL−GAN

iteratively.

Learning to modify the facial image. We sample an im-age x and the attribute y from all data. This stage trainsthe SL-GAN to be able to modify the image x by supply-ing y. Note that the image x does not necessarily have theattribute y. Another important question here is how to keepthe same identity of sampled images when modifying thefacial image; two strategies are employed here: first, zlais sampled from penc (z | x) parameterized by the encodernetwork which is not updated in this sub-step; second, ourSL-GAN minimizing theLDl

recon essentially to guarantee theidentity of the same person. Thus this step encourages thegenerator to learn a disentangled representation of y and zla.

• Learning to modify the attributes: Sample a batch ofimages x ∼ pdata(x) and the attribute y ∼ pdata(y),zla ∼ penc (z | x);

• Update the SL-GAN by minimizing the Decoder Ldec

and Discriminator with LDSL−GANiteratively;

Learning to generate facial images. We sample zla fromtheir prior distributions and y from the distribution of data,i.e.

• Sample a batch of latent vectors zla ∼ pprior(z) andattribute vectors y ∼ pdata(y).

• Update the SL-GAN by minimizing the Decoder Ldec

and Discriminator with LDSL−GANiteratively;

Once the network is trained, we can solve the task of gener-ation and modification; particularly,

• Generating new facial images with any attributes. Thiscan be achieved by sampling zla from pprior (z) andsetting y to any desired attributes. We can then getfrom the generator the image x′ ∼ G (zla, y) .

• Modifying the existing images with any attributes.Given an image x and the desired attribute y, we cansample zla ∼ p (z | x). Then the modified image canbe generated by x′ ∼ pdec (x | zla, y).

4. Experiments

4.1. Experimental settings

Dataset. We conduct the experiments on two datasets. TheCelebA dataset [22] contains approximately 200k images of10k identities. Each image is annotated with 5 landmarks(two eyes, the nose tips, the mouth corners) and binary la-bels of 40 attributes. Since the distribution of the binaryannotations of attributes is very unbalanced, we select 17attributes with relatively balanced annotations for our ex-periments. We use the standard split for our model: first160k images are used for training, 20k images for valida-tion and remaining 20k for test. CASIA-WebFace dataset iscurrently the largest publicly released dataset for face veri-fication and identification tasks. It contains 10, 575 celebri-ties and 494, 414 face images which are crawled from theweb. Each person has 46.8 images on average. The CASIA-WebFace [43] doesnot have any facial attribute labels. Weuse the 17 attributes of CelebA dataset [22] to train the fa-cial attribute classifier, i.e., MOON model [30]. The trainedmodel can be utilized to predict the facial attributes on theCAISIA-WebFace dataset. The predicted results are used asthe facial attribute annotation. We will release these anno-tations, trained models and code upon acceptance.

Evaluation. We employ different evaluation metrics. (1)For the generation task, we utilize inception score and at-tribute errors. Inception score [32] measures whether var-ied images are generated and whether the generated imagescontains meaningful objects. Also, inspired by the attributesimilarity in [42], we propose the attribute error. Specif-ically, we uses the MOON attribute [30] models to pre-dict the user-defined attributes of generated images and thepredicted attributes are compared against the specified at-tributes by mean square error. (2) For the modification task,we employ the user-study for the evaluation.

Implementation details. Training converges in 9-11 hourson CelebA dataset on GeForce GTX 1080; our model needsaround 2GB GPU memory. The input size of images is 64×64. The methods to which we compare have code availableon the web, which we use to directly compare to our results.

Page 6: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

0

0.5

1

1.5

2

2.5

Attri

bute

Erro

rs R

ate(

%)

Attribute Errors on CelebA dataset

Pale_S

kin

Black_

Hair

Arched

_Eye

brows

Male

Gray_H

air

Blond_

Hair

Bags_

Under_

Eyes

Smiling

Bangs

Rosy_

Cheek

s

Young

Brown_

Hair

Bushy

_Eye

brows

Mouth_

Slightl

y_Ope

n

Big_Nos

e

Narrow

_Eye

s

Big_Lip

s

Averag

ed

AC-GANSL-GANAttrb2Img

0

0.05

0.1

0.15

0.2

Attri

bute

Erro

rs R

ate(

%)

Attribute Errors on CASIA-WebFace dataset

Pale_S

kin

Black_

Hair

Arched

_Eye

brows

Male

Gray_H

air

Blond_

Hair

Bags_

Under_

Eyes

Smiling

Bangs

Rosy_

Cheek

s

Young

Brown_

Hair

Bushy

_Eye

brows

Mouth_

Slightl

y_Ope

n

Big_Nos

e

Narrow

_Eye

s

Big_Lip

s

Averag

ed

AC-GANSL-GANAttrb2Img

Figure 3. Attribute Errors of user-defined attributes on CelebA and CASIA- dataset. The lower values, the better results. The attributenames are listed in the X-axis.

11

1.5

2

2.5

Ince

pti

on

Sco

re

Generated Images on CelebA

VAEGANAC-GANAttrb2ImgSL-GAN

11.2

1.4

1.6

1.8

2

2.2

2.4

Ince

pti

on

Sco

re

Reconstructed Images on CelebA

VAEGANAttrb2ImgSL-GAN

11

1.5

2

2.5

Ince

pti

on

Sco

re

Generated Images on Casia-Face

VAEGANAC-GANAttrb2ImgSL-GAN

11

1.5

2

2.5

Ince

pti

on

Sco

re

Reconstructed Images on Casia-Face

VAEGANAttrb2ImgSL-GAN

Figure 4. Inception Scores on two datasets. The higher values, thebetter results.

Att

r2Im

gA

C-G

AN

SL-G

AN

GT

Figure 5. Qualitative results of the generation task.

4.2. Generation by user-defined attributes

Competitors. We compare various open-source methodson this task, including VAE-GAN [20], AC-GAN [25],and Attrb2img [42]. Attrb2img is an enhanced version ofCVAE. All the methods are trained with the same settingsand have the same number dimensions for attribute repre-sentation. For a fair comparison, each method only trainsone model on all 17 user-defined attributes.Attribute errors are compared on CelebA and CASIA-WebFace dataset and illustrated in Fig. 3. Since VAEGANdoesnot model the attributes, our model can be only com-pared against AC-GAN and Attrib2img methods. On mostof the 17 attributes, our method has lower attribute errorsthan the other methods. This indicates the efficacy of ourSL-GAN on learning user-defined attributes. In contrast,the relatively higher attribute errors of Attrib2img werelargely due to the fact that Attrib2img is based on CVAEand user-defined attributes are only given as the model in-put, rather than explicitly learned as in our SL-GAN andAC-GAN. The advantages of our SL-GAN results over AC-GAN are in part due to our generator model with feature-wise error encoded by LDl

recon in Eq (3).Inception scores are also compared on two datasets andshown in Fig. 4. We compare the inception scores on bothgenerated and reconstructed image settings. The differencesbetween generated and reconstructed images lies in how toobtain the attribute vectors: the attribute vectors of recon-structed images is computed by the encoder network, whilesuch vectors of generated images are either sampled fromGaussian prior (for zla) or pre-defined (for y).

As an objective evaluation metric, inception score, firstproposed in [32], was found to correlate well with the hu-

Page 7: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

Metric Saliency Quality Similarity GuessAttrb2img 3.02 4.01 4.43 30.0%

icGAN 4.10 3.83 4.30 65.4%SL-GAN 4.37 4.20 4.45 75.0%

Table 1. The user-study of modification of user-defined attributes.The “Guess” results are reported as the accuracy of guessing.

man evaluation of visual quality of samples. Thus higherinception scores can reflect the relatively better visual qual-ity. (1) On generated image setting, we use the same type ofattribute vector to generate the facial images for VAEGAN,AC-GAN, and Attrib2img. On both dataset, our SL-GANhas higher inception scores than all the other methods, stillthanks to our training algorithm for more efficiently and ex-plicitly learning user-defined and latent attribute in SL-FAS.These results indicate that our generated images in generalhave better visual quality than those generated by the othermethods. We note that AC-GAN has relatively lower incep-tion scores since it does not model the feature-wise error asour SL-GAN. (2) On reconstructed image setting, AC-GANis not compared since it does not have the encoder-decoderstructure to reconstruct the input image. On both dataset,our SL-GAN again outperforms the other baselines, whichsuggests that the visual quality of our reconstructed imagesis better than that from the other competitors.Qualitative results. Figure 5 gives some qualitative exam-ples of the generated images by VAEGAN, AC-GAN, At-trib2img and SL-GAN as well as the ground-truth images.For all the methods, the same attribute vectors are used forall methods to generate the images. The generated imagesare compared against the ground-truth image which is an-notated by the corresponding attribute vector. As we cansee, samples generated by Attrib2img has successfully gen-erated the images with rich and clear details of human facesand yet very blurred hair styles2. In contrast, the image gen-erated by AC-GAN can model the details of both humanfaces and hair styles. However, it has lower visual qualitythan our SL-GAN, which generates a more consistency andnature style of human faces and hair styles.

4.3. Modification by user-defined attributes

Competitors. We compare various open source methods onthis task, including attrib2img [42] and icGAN [26]. Notethat attrb2img can not directly modify the attributes of im-ages. Instead, we take it as an “attribute-conditioned imageprogression” which interpolates the attributes by graduallychanging the values along attribute dimension. We still usethe same settings for all the experiments.User-study experiments. We design a user study experi-ment to compare attrib2img with our SL-GAN. Specifically,

2This point is also consistency with the example figures given [42]which has blurred hair style details.

ten students who are kept unknown from our projects areinvited for our user study. Given one image, we employattrib2img and SL-GAN to modify the same attribute andobtain two images; totally 100 images are sampled and theresults are generated. We ask the participants to compareeach generated image with the original given image; andthey should rate their judgement on a five-point scale fromthe less to the most likely by the following metrics: (1)Saliency: the salient degree of the attributes that has beenmodified in the image. (2) Quality: the overall quality ofgenerated image; (3) Identity: Whether the generated im-age and the original image are the same person. (4) Guess:we also introduce a guessing game as the fourth metrics.Given one modified image and the original image, we askthe participants to guess which attributes have been mod-ified from four candidate choices; among these candidatechoices, only one is the correct answer (chance = 0.25).Results. The user-study results are compared in Tab. 1.Our results of SL-GAN outperforms those of Attrb2img onall the metrics. These results suggest that our SL-GAN cannot only saliently modify the image attribute given, but alsoguarantee the overall quality of generated image and keepthe same identity as the original input image. To betterunderstand the difference of different methods, we qualita-tively compare these three methods in Fig. 6. As observedfrom the figure, our results has better overall visual qualityand more salient modified attributes.Qualitative results of our modification examples. We fur-ther show some qualitative visualization of modifying user-defined attribute as illustrated in Fig. 7. Please refer to sup-plementary material for larger size figures. All the attributesare trained by only one SL-GAN model. In fact, our modelcan not only change the very detailed local attribute suchas “rosy cheeks”, “arched eyebrows”, “Bags under eyes”,but also modify the global attributes, such as “Male”, “Paleskin”, and “Smiling”. Furthermore, our methods are alsoable to change the hair styles and hair color; and such de-tails of hairs are usually not captured by Attrb2img.

5. Conclusion

In this paper, we introduce a semi-latent facial attributespace to jointly learn the user-defined and latent attributesfrom facial images. To learn such a space, we propose aunified framework– SL-GAN which for the first time canboth learn to generate and modify facial image attributes.Our model is compared against the state-of-the-art methodsand achieves better performance.

References[1] T. Ahonen, A. Hadid, and M. Pietikainen. Face description

with local binary patterns: Application to face recognition.IEEE TPAMI, 2006. 1

Page 8: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

SL-G

AN

IcG

AN

Att

r2Im

g

SL-G

AN

IcG

AN

Att

r2Im

g

SL-G

AN

IcG

AN

Att

r2Im

g

Figure 6. Qualitative results of comparing different modification methods. The red box indicates that the attribute modified is inverse tothe attribute of each row.

Original

Reconstructed

Black hair

Smiling

Rosy cheeks

Pale skin

Mouth slightly open

Male

Brown hair

Blond hair

Figure 7. Results of modifying attributes on CelebA dataset. Each column indicates modifying by adding one type of attribute to image,while the red box means the image is modified to not have that attribute.

[2] X. P. Burgos-Artizzu, P. Perona, and P. Dollar. Robust facelandmark estimation under occlusion. In ICCV, 2013. 1

[3] D. Chen, S. Ren, Y. Wei, X. Cao, and J. Sun. Joint cascadeface detection and alignment. In ECCV, 2014. 1

[4] X. Chen, Y. Duan, R. Houthooft, J. Schulman, I. Sutskever,

and P. Abbeel. Infogan: Interpretable representation learningby information maximizing generative adversarial nets. InICML, 2016. 1, 2, 3.1

[5] A. Datta, R. Feris, and D. Vaquero. Hierarchical ranking offacial attributes. In IEEE FG, 2011. 2

Page 9: Semi-Latent GAN: Learning to generate and modify …Semi-Latent GAN: Learning to generate and modify facial images from attributes Weidong Yin , Yanwei Fu p, Leonid Sigalyand Xiangyang

[6] E. Denton, S. Chintala, A. Szlam, and R. Fergus. Deep gen-erative image models using a laplacian pyramid of adversar-ial networks. In NIPS, 2015. 2

[7] A. Dosovitskiy, J. T. Springenberg, M. Tatarchenko, andT. Brox. learning to generate chairs with convolutional neu-ral network. In CVPR, 2015. 2

[8] I. Durugkar, I. Gemp, and S. Mahadevan. Generative multi-adversarial networks. In ICLR, 2017. 2

[9] M. Ehrlich, T. J. Shields, T. Almaev, and M. R. Amer. Fa-cial attributes classification using multi-task representationlearning. In CVPR Workshops, 2016. 2

[10] Y. Fu, T. M. Hospedales, T. Xiang, and S. Gong. Learningmulti-modal latent attributes. IEEE TPAMI, 2013. 1, 2

[11] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu,DavidWarde-Farley, S. Ozair, A. Courville, and Y. Bengio.Generative adversarial nets. In NIPS, 2014. 2, 3.1

[12] K. Gregor, I. Danihelka, A. Graves, D. J. Rezende, andD. Wierstra. Draw: A recurrent neural network for imagegeneration. In ICML, 2015. 2

[13] G. E. Hinton and R. R. Salakhutdinov. reducing the dimen-sionality of data with neural networks. 2006. 2

[14] X. Huang, Y. Li, O. Poursaeed, J. Hopcroft, and S. Belongie.Stacked generative adversarial networks. In CVPR, 2017. 2

[15] I. Kemelmacher-Shlizerman, S. Suwajanakorn, and S. M.Seitz. Illumination-aware age progression. In CVPR, 2014.2

[16] K.Gregor, I. Danihelka, A. Mnih, C.Blundell, andD.Wierstra. Deep autoregressive networks. In ICML, 2014.2

[17] T. Kulkarni, W.Whitney, P. Kohli, and J. Tenenbaum. Deepconvolutional inverse graphics network. In NIPS, 2015. 2

[18] N. Kumar, A. C. Berg, P. N. Belhumeur, and S. K. Nayar.Attribute and simile classifiers for face verification. In ICCV,2009. 2

[19] C. H. Lampert, H. Nickisch, and S. Harmeling. Attribute-based classification for zero-shot visual object categoriza-tion. IEEE TPAMI, 2013. 2

[20] A. B. L. Larsen, S. K. Sonderby, H. Larochelle, andOleWinther. Autoencoding beyond pixels using a learnedsimilarity metric. In ICML, 2016. 2, 3.1, 4.2

[21] H. Li, Z. Lin, X. Shen, J. Brandt, and G. Hua. A convolu-tional neural network cascade for face detection. In CVPR,2015. 1

[22] Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning faceattributes in the wild. In ICCV, pages 3730–3738, 2015. 4.1

[23] M. Mathieu, J. Zhao, P. Sprechmann, A. Ramesh, and Y. Le-Cun. Disentangling factors of variation in deep representa-tions using adversarial training. In nips, 2016. 2

[24] A. Nguyen, J. Yosinski, Y. Bengio, A. Dosovitskiy, andJ. Clune. Plug & play generative networks: Conditional it-erative generation of images in latent space. In arxiv, 2016.2

[25] A. Odena, C. Olah, and J. Shlens. Conditional image synthe-sis with auxiliary classifier gans. In arxiv, 2016. 4.2

[26] G. Perarnau, J. van deWeijer, B. Raducanu, and J. M.Alvarez. Invertible conditional gans for image editing. InNIPS Workshop on Adversarial Training, 2016. 2, 4.3

[27] S. Reed, Z. Akata, S. Mohan, S. Tenka, B. Schiele, andH. Lee. Learning what and where to draw. In nips, 2016.2

[28] S. Reed, Z. Akata, X. Yan, L. Logeswaran, B. Schiele, andH. Lee. Generative adversarial text-to-image synthesis. InICML, 2016. 2

[29] S. Reed, K. Sohn, Y. Zhang, and H. Lee. learning to dis-entangle factors of variation with manifold interaction. InICML, 2014. 2

[30] E. M. Rudd, M. Gunther, and T. E. Boult. Moon:a mixedobjective optimization network for the recognition of facialattributes. In ECCV, 2016. 2, 4.1

[31] R. Salakhutdinov, A. Torralba, and J. Tenenbaum. Learningto share visual appearance for multiclass object detection. InCVPR, 2011. 2

[32] T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Rad-ford, and X. Chen. Improved techniques for training gans. Innips, 2016. 4.1, 4.2

[33] F. Schroff, D. Kalenichenko, and J. Philbin. Facenet: A uni-fied embedding for face recognition and clustering. In CVPR,2015. 1

[34] W. Shen and R. Liu. Learning residual images for face at-tribute manipulation. In arxiv, 2017. 2

[35] K. Sohn, X. Yan, and H. Lee. Learning structured outputrepresentation using deep conditional generative models. InNIPS, 2016. 2, 3.1

[36] Y. Sun, Y. Chen, X. Wang, and X. Tang. Deep learning facerepresentation by joint identification-verification. In NIPS,2014. 1

[37] Y. Taigman, M. Yang, M. Ranzato, and L. Wolf. Deepface:Closing the gap to human-level performance in face verifica-tion. In CVPR, 2014. 1

[38] L. Theis and M. Bethge. Generative image modeling usingspatial lstms. In NIPS, 2015. 2

[39] A. van den Oord, N. Kalchbrenner, O. Vinyals, L. Espeholt,A. Graves, and K. Kavukcuoglu. conditional image genera-tion with pixelcnn decoders. In NIPS, 2016. 2

[40] J. Wang, Y. Cheng, and R. Feris. Walk and learn: Facialattribute representation learning from egocentric video andcontextual data. CVPR, 2016. 2

[41] Y. Wen, K. Zhang, Z. Li, and Y. Qiao. A discriminative fea-ture learning approach for deep face recognition. In ECCV,2016. 1

[42] X. Yan, J. Yang, K. Sohn, and H. Lee. attribute2image: con-ditional image generation from visual attributes. In ECCV,2016. 1, 2, 3.1, 4.1, 4.2, 4.3, 2

[43] D. Yi, Z. Lei, S. Liao, and S. Z. Li. Learning face represen-tation from scratch. arXiv, 2014. 4.1

[44] Z. Zhang, P. Luo, C. C. Loy, and X. Tang. Facial landmarkdetection by deep multi-task learning. In ECCV. 2014. 1

[45] Y. Zhong, J. Sullivan, and H. Li. Face attribute predictionusing off-the-shelf cnn features. In IEEE ICB, 2016. 2

[46] T. Zhou, S. Tulsiani, W. Sun, J. Malik, and A. A. Efros. Viewsynthesis by appearance flow. In ECCV, 2016. 2

[47] J.-Y. Zhu, P. Krahenbuhl, E. Shechtman, and A. A. Efros.Generative visual manipulation on the natural image mani-fold. In ECCV, 2016. 2