Skip to content

cameronfabbri/cWGANs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conditional Wasserstein GANs

This is an implementation of conditional GANs using the Improved Wasserstein (WGAN-GP) method. Currently I'm trying it out on multiple datasets, though Celeba has been the main target.

Results

Results can be seen on MNIST, CelebA, and the EFIGI Galaxy dataset.

MNIST

Below show two examples of the ability to capture style on the MNIST dataset. Each row uses the same z vector, and each column contains a different y vector representing the label. These can be reproduced via generate_mnist.py.

m1 m2

For these two images, I generated the four corners of each grid, and interpolated between both z and y. Although the model was not trained on continuous attributes (binary only), it still is able to accurately capture the latent space when given them. These can be reproduced via grid.py.

m3 m4

CelebA

These are some results generated by taking random attribute values from the Celeba test set.

Image Attributes
g1 Male, Smiling
g2 Female, Blonde
g3 Female, Heavy Makeup
g4 Female, Heavy Makeup, Smiling

Attributes in consideration: bald, bangs, black hair, blond hair, eyeglasses, heavy makeup, male, pale skin, smiling

Male attribute while alternating the others m1

m2

Female attribute while alternating the others f1

f2

Interpolation results

On just y

Same z vector being used, but interpolating along the attribute.

Bald → not bald

b1

Female → male

b2

Male, glasses, smiling, → male, no glasses, not smiling

b3

Male, glasses, smiling, bangs → no glasses, not smiling, pale skin, no bangs

b4

On just z

These are interpolating between two different z vectors but using the same y (same attributes). i1

i2

i3

Grid representation

This shows interpolation between four faces (four corners) using random attributes for each face, and interpolating between the attributes as well.

i4

How to run

  1. Download the cropped and aligned celebA dataset from here as well as the annotations.

  2. Your folder layout must be like so:

root_celeba/
   img_align_celeba/
   img_align_celeba_cropped/
   list_attr_celeba.txt
  1. Run the crop script on the downloaded images. img_align_celeba_cropped/ is an empty folder made by you. Then copy the ops/crop_images.py file to your root_celeba/ folder and run

    python crop_images.py

TODO

Everything is in different folders. Ideally, I'd like to have just one.

About

Conditional Wasserstein GANs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published