The dataset used in this assignment is the so-called Celebrity Attributes set ( celebA for short), which consists of more than 200,000 photos of people faces. There is a text file, celebA_attrs.txt, which describe the 40 attributes of these photos. In celebA_attrs.txt, the first line is the total number of photos, the second line is the list of 40 feature names, each line of the rest of the file gives the file name of the photo and its attribute list in the form of a binary string of length 40 (0 means it doesn't have attribute; 1 means it has that attribute). In this assignment, we will use only one attribute, Male (index 20), as a label for the conditional GAN.
To run the modified code on Argon, you need to download the file dcgan-argon.tgz onto Argon, unzip it in a working directory, and submit a job like
qsub train-dcgan.shTo save time of training, you may use a pre-trained model: copy the directory /nfsscratch/checkpoint into your working directory, and submit a job like
qsub test-dcgan.shIt will generate quickly 100 images of human faces in the sub-directory samples.
The current program cannot generate human faces with a given set of attributes. For example, suppose we want to generate only men's faces, we need to modify the program as a conditional GAN which takes a label for men and generates what we wanted. So, your task is to implement this conditional GAN.
The code already has the implementation of conditional GAN for the MNIST dataset where the label is the one-hot vector of 10 bits (y_dim = 10). You may follow this approach by setting y_dim = 1 for celebA. (A more general approach would be y_dim = 40 for all 40 attributes.) Since you would have changed the network by letting y_dim > 0, you cannot use the pre-trained network and have to delete the checkpoint sub-directory before you run train-dcgan.sh.
An ad hoc approach is to add the Male attribute value to one of the x-input for both the discriminator and the generator, and keep the parameters of the network unchanged. In this case, you can reuse the pre-trained network, but you still need some training for the changed x-input. The default train set size is 10,000. You may need to set the train set size to 100,000 (in train-dcgan.sh) in order to obtain better results:
python decgan.py --train True --train_set_size 100000
In either approach, you need to create some negative examples for the discrimator where the image is real but the attribute value is wrong.
To make the implementation easier, we have provided a function in utils.py, called read_attribute, which reads the file celebA_attrs.txt and returns a numpy vector of binary numbers for the specified set of photos and the specified attribute.
Please submit the modified code, the execution log for the test run which generates 50 male faces and 50 female faces (these photos should be submitted, too). Please submit everything required in the ICON dropbox for Homework 10 before the deadline.
Thank you!