Generative Adversarial Networks Projects

Book Description

Explore various Generative Adversarial Network architectures using the Python ecosystem

Key Features

  • Use different datasets to build advanced projects in the Generative Adversarial Network domain
  • Implement projects ranging from generating 3D shapes to a face aging application
  • Explore the power of GANs to contribute in open source research and projects

Book Description

Generative Adversarial Networks (GANs) have the potential to build next-generation models, as they can mimic any distribution of data. Major research and development work is being undertaken in this field since it is one of the rapidly growing areas of machine learning. This book will test unsupervised techniques for training neural networks as you build seven end-to-end projects in the GAN domain.

Generative Adversarial Network Projects begins by covering the concepts, tools, and libraries that you will use to build efficient projects. You will also use a variety of datasets for the different projects covered in the book. The level of complexity of the operations required increases with every chapter, helping you get to grips with using GANs. You will cover popular approaches such as 3D-GAN, DCGAN, StackGAN, and CycleGAN, and you'll gain an understanding of the architecture and functioning of generative models through their practical implementation.

By the end of this book, you will be ready to build, train, and optimize your own end-to-end GAN models at work or in your own projects.

What you will learn

  • Train a network on the 3D ShapeNet dataset to generate realistic shapes
  • Generate anime characters using the Keras implementation of DCGAN
  • Implement an SRGAN network to generate high-resolution images
  • Train Age-cGAN on Wiki-Cropped images to improve face verification
  • Use Conditional GANs for image-to-image translation
  • Understand the generator and discriminator implementations of StackGAN in Keras

Who this book is for

If you're a data scientist, machine learning developer, deep learning practitioner, or AI enthusiast looking for a project guide to test your knowledge and expertise in building real-world GANs models, this book is for you.

Publisher Resources

Download Example Code

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Generative Adversarial Networks Projects
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  6. Introduction to Generative Adversarial Networks
    1. What is a GAN?
      1. What is a generator network?
      2. What is a discriminator network?
      3. Training through adversarial play in GANs
    2. Practical applications of GANs
    3. The detailed architecture of a GAN
      1. The architecture of the generator 
      2. The architecture of the discriminator
      3. Important concepts related to GANs
        1. Kullback-Leibler divergence
        2. Jensen-Shannon divergence
        3. Nash equilibrium
        4. Objective functions
      4. Scoring algorithms
        1. The inception score
        2. The Fréchet inception distance
    4. Variants of GANs
      1. Deep convolutional generative adversarial networks
      2. StackGANs
      3. CycleGANs
      4. 3D-GANs
      5. Age-cGANs
      6. pix2pix
    5. Advantages of GANs
    6. Problems with training GANs
      1. Mode collapse
      2. Vanishing gradients
      3. Internal covariate shift
    7. Solving stability problems when training GANs
      1. Feature matching
      2. Mini-batch discrimination
      3. Historical averaging
      4. One-sided label smoothing
      5. Batch normalization
      6. Instance normalization
    8. Summary
  7. 3D-GAN - Generating Shapes Using GANs
    1. Introduction to 3D-GANs
      1. 3D convolutions
      2. The architecture of a 3D-GAN
        1. The architecture of the generator network
        2. The architecture of the discriminator network
      3. Objective function
      4. Training 3D-GANs
    2. Setting up a project
    3. Preparing the data
      1. Download and extract the dataset
      2. Exploring the dataset
        1. What is a voxel?
        2. Loading and visualizing a 3D image
        3. Visualizing a 3D image
    4. A Keras implementation of a 3D-GAN
      1. The generator network
      2. The discriminator network
    5. Training a 3D-GAN
      1. Training the networks
      2. Saving the models
      3. Testing the models
      4. Visualizing losses
      5. Visualizing graphs
    6. Hyperparameter optimization
    7. Practical applications of 3D-GANs
    8. Summary
  8. Face Aging Using Conditional GAN
    1. Introducing cGANs for face aging
      1. Understanding cGANs
      2. The architecture of the Age-cGAN
        1. The encoder network
        2. The generator network
        3. The discriminator network
        4. Face recognition network
      3. Stages of the Age-cGAN
        1. Conditional GAN training
          1. The training objective function
        2. Initial latent vector approximation
        3. Latent vector optimization
    2. Setting up the project
    3. Preparing the data
      1. Downloading the dataset
      2. Extracting the dataset
    4. A Keras implementation of an Age-cGAN
      1. The encoder network
      2. The generator network
      3. The discriminator network
    5. Training the cGAN
      1. Training the cGAN
      2. Initial latent vector approximation
      3. Latent vector optimization
      4. Visualizing the losses
      5. Visualizing the graphs
    6. Practical applications of Age-cGAN
    7. Summary
  9. Generating Anime Characters Using DCGANs
    1. Introducing to DCGANs
      1. Architectural details of a DCGAN
        1. Configuring the generator network
        2. Configuring the discriminator network
    2. Setting up the project
    3. Downloading and preparing the anime characters dataset
      1. Downloading the dataset
      2. Exploring the dataset
      3. Cropping and resizing images in the dataset
    4. Implementing a DCGAN using Keras
      1. Generator
      2. Discriminator
    5. Training the DCGAN
      1. Loading the samples
      2. Building and compiling the networks
      3. Training the discriminator network
      4. Training the generator network
      5. Generating images
      6. Saving the model
      7. Visualizing generated images
      8. Visualizing losses
      9. Visualizing graphs
      10. Tuning the hyperparameters
    6. Practical applications of DCGAN
    7. Summary
  10. Using SRGANs to Generate Photo-Realistic Images
    1. Introducing SRGANs
      1. The architecture of SRGANs
        1. The architecture of the generator network
        2. The architecture of the discriminator network
      2. The training objective function
        1. Content loss
          1. Pixel-wise MSE loss
          2. VGG loss
        2. Adversarial loss
    2. Setting up the project
    3. Downloading the CelebA dataset
    4. The Keras implementation of SRGAN
      1. The generator network
      2. The discriminator network
      3. VGG19 network
      4. The adversarial network
    5. Training the SRGAN
      1. Building and compiling the networks
      2. Training the discriminator network
      3. Training the generator network
      4. Saving the models
      5. Visualizing generated images
      6. Visualizing losses
      7. Visualizing graphs
    6. Practical applications of SRGANs
    7. Summary
  11. StackGAN - Text to Photo-Realistic Image Synthesis
    1. Introduction to StackGAN
    2. Architecture of StackGAN
      1. The text encoder network
      2. The conditioning augmentation block
        1. Getting the conditioning augmentation variable
      3. Stage-I
        1. The generator network
        2. The discriminator network
        3. Losses for Stage-I of StackGAN
      4. Stack-II
        1. The generator network
        2. The discriminator network
        3. Losses for Stage-II of StackGAN
    3. Setting up the project
    4. Data preparation
      1. Downloading the dataset
      2. Extracting the dataset
      3. Exploring the dataset
    5. A Keras implementation of StackGAN
      1. Stage-I
        1. Text encoder network
        2. Conditional augmentation network
        3. The generator network
        4. The discriminator network
        5. The adversarial model
      2. Stage-II
        1. Generator network
          1. Downsampling blocks
          2. The residual blocks
          3. Upsampling Blocks
        2. The discriminator network
          1. Downsampling blocks
          2. The concatenation block
          3. The fully connected classifier
    6. Training a StackGAN
      1. Training the Stage-I StackGAN
        1. Loading the dataset
        2. Creating models
        3. Training the model
      2. Training the Stage-II StackGAN
        1. Loading the dataset
        2. Creating models
        3. Training the model
      3. Visualizing the generated images
      4. Visualizing losses
      5. Visualizing the graphs
    7. Practical applications of StackGAN
    8. Summary
  12. CycleGAN - Turn Paintings into Photos
    1. An introduction to CycleGANs
      1. The architecture of a CycleGAN
        1. The architecture of the generator
        2. The architecture of the discriminator
      2. The training objective function
        1. Adversarial loss
        2. Cycle consistency loss
        3. Full objective function
    2. Setting up the project
    3. Downloading the dataset
    4. Keras implementation of CycleGAN
      1. The generator network
      2. The discriminator network
    5. Training the CycleGAN
      1. Loading the dataset
      2. Building and compiling the networks
        1. Creating and compiling an adversarial network
      3. Starting the training
        1. Training the discriminator networks
        2. Training the adversarial network
      4. Saving the model
      5. Visualizing the images generated
      6. Visualizing losses
      7. Visualizing the graphs
    6. Practical applications of CycleGANs
    7. Summary
    8. Further reading
  13. Conditional GAN - Image-to-Image Translation Using Conditional Adversarial Networks
    1. Introducing Pix2pix
      1. The architecture of pix2pix
        1. The generator network
          1. The encoder network
          2. The decoder network
        2. The discriminator network
      2. The training objective function
    2. Setting up the project
    3. Preparing the data
      1. Visualizing images
    4. A Keras implementation of pix2pix
      1. The generator network
      2. The discriminator network
      3. The adversarial network
    5. Training the pix2pix network
      1. Saving the models
      2. Visualizing the generated images
      3. Visualizing the losses
      4. Visualizing the graphs
    6. Practical applications of a pix2pix network
    7. Summary
  14. Predicting the Future of GANs
    1. Our predictions about the future of GANs
      1. Improving existing deep learning methods
      2. The evolution of the commercial applications of GANs
      3. Maturation of the GAN training process
    2. Potential future applications of GANs
      1. Creating infographics from text
      2. Generating website designs
      3. Compressing data
      4. Drug discovery and development
      5. GANs for generating text
      6. GANs for generating music
    3. Exploring GANs
    4. Summary
  15. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product Information

  • Title: Generative Adversarial Networks Projects
  • Author(s): Kailash Ahirwar
  • Release date: January 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789136678