|
| 1 | +# Generating fake faces using GANs |
| 2 | + |
| 3 | +## Algorithm |
| 4 | +In this project, you'll define and train a DCGAN on a dataset of faces. Your goal is to get a generator network to generate new images of faces that look as realistic as possible!<br> |
| 5 | + |
| 6 | +1. Get the celeb faces data, pre-process it and load the data. |
| 7 | +2. Define the model : Discriminator and Generator |
| 8 | + * **Discriminator** |
| 9 | + * The inputs to the discriminator are 32x32x3 tensor images |
| 10 | + * 3 convolutional layers, 1 fully-connected layer and leaky_relu activation function. |
| 11 | + * The output should be a single value that will indicate whether a given image is real or fake |
| 12 | + * **Generator** |
| 13 | + * The inputs to the generator are vectors of some length z_size |
| 14 | + * 3 transpose_convolutional_layer, 1 fully-connected layer and 1 relu activation function |
| 15 | + * The output should be a image of shape 32x32x3 |
| 16 | +3. Generate discriminator and generator losses |
| 17 | + * **Discriminator Loss** |
| 18 | + * For the discriminator, the total loss is the sum of the losses for real and fake images, `d_loss = d_real_loss + d_fake_loss.` |
| 19 | + * Remember that we want the discriminator to output 1 for real images and 0 for fake images, so we need to set up the losses to reflect that. |
| 20 | + * **Generator Loss** |
| 21 | + * The generator loss will look similar only with flipped labels. |
| 22 | +4. Train the network |
| 23 | +5. Plot the loss |
| 24 | +6. Generator samples from training |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +## Results |
| 29 | + |
| 30 | +1. Final discriminator and generator loss are as follows - <br> |
| 31 | + * Discriminator loss : 0.4530 |
| 32 | + * Generator loss : 3.5706 |
| 33 | + |
| 34 | +2. Training loss of discrimiator and generator plotted over each epoch - <br> |
| 35 | +<img src="./images/generator_discriminator_loss.png"></img><br><br> |
| 36 | + |
| 37 | +3. Fake face images generated after training the GAN -<br> |
| 38 | +<img src="./images/generated_faces.png"></img><br><br> |
1 | 39 |
|
0 commit comments