Book Image

Hands-On Generative Adversarial Networks with PyTorch 1.x

By : John Hany, Greg Walters
Book Image

Hands-On Generative Adversarial Networks with PyTorch 1.x

By: John Hany, Greg Walters

Overview of this book

With continuously evolving research and development, Generative Adversarial Networks (GANs) are the next big thing in the field of deep learning. This book highlights the key improvements in GANs over generative models and guides in making the best out of GANs with the help of hands-on examples. This book starts by taking you through the core concepts necessary to understand how each component of a GAN model works. You'll build your first GAN model to understand how generator and discriminator networks function. As you advance, you'll delve into a range of examples and datasets to build a variety of GAN networks using PyTorch functionalities and services, and become well-versed with architectures, training strategies, and evaluation methods for image generation, translation, and restoration. You'll even learn how to apply GAN models to solve problems in areas such as computer vision, multimedia, 3D models, and natural language processing (NLP). The book covers how to overcome the challenges faced while building generative models from scratch. Finally, you'll also discover how to train your GAN models to generate adversarial examples to attack other CNN and GAN models. By the end of this book, you will have learned how to build, train, and optimize next-generation GAN models and use them to solve a variety of real-world problems.
Table of Contents (15 chapters)
Free Chapter
1
Section 1: Introduction to GANs and PyTorch
5
Section 2: Typical GAN Models for Image Synthesis

Introduction to Deep Convolutional GANs

DCAGN (Deep Convolutional Generative Adversarial Network) is one of the early well-performing and stable approaches to generate images with adversarial training. Let's take a look back at the simple example in Chapter 1, Generative Adversarial Networks Fundamentals.

Here, even when we only train a GAN to manipulate 1D data, we have to use multiple techniques to ensure a stable training. A lot of things could go wrong in the training of GANs. For example, either a generator or a discriminator could overfit if one or the other does not converge. Sometimes, the generator only generates a handful of sample varieties. This is called mode collapse. The following is an example of mode collapse, where we want to train a GAN with some popular meme images in China called Baozou. We can see that our GAN is only capable of generating one or two...