Generative Adversarial Networks Projects
eBook - ePub

Generative Adversarial Networks Projects

Build next-generation generative models using TensorFlow and Keras

Kailash Ahirwar

  1. 316 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Generative Adversarial Networks Projects

Build next-generation generative models using TensorFlow and Keras

Kailash Ahirwar

Book details
Book preview
Table of contents
Citations

About This Book

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.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Generative Adversarial Networks Projects an online PDF/ePUB?
Yes, you can access Generative Adversarial Networks Projects by Kailash Ahirwar in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.

Information

Year
2019
ISBN
9781789134193
Edition
1

StackGAN - Text to Photo-Realistic Image Synthesis

Text to image synthesis is one of the use cases for Generative Adversarial Networks (GANs) that has many industrial applications, just like the GANs described in previous chapters. Synthesizing images from text descriptions is very hard, as it is very difficult to build a model that can generate images that reflect the meaning of the text. One network that tries to solve this problem is StackGAN. In this chapter, we will implement a StackGAN in the Keras framework, using TensorFlow as the backend.
In this chapter, we will cover the following topics:
  • Introduction to StackGAN
  • The architecture of StackGAN
  • Data gathering and preparation
  • A Keras implementation of StackGAN
  • Training a StackGAN
  • Evaluating the model
  • Practical applications of a pix2pix network

Introduction to StackGAN

A StackGAN is named as such because it has two GANs that are stacked together to form a network that is capable of generating high-resolution images. It has two stages, Stage-I and Stage-II. The Stage-I network generates low-resolution images with basic colors and rough sketches, conditioned on a text embedding, while the Stage-II network takes the image generated by the Stage-I network and generates a high-resolution image that is conditioned on a text embedding. Basically, the second network corrects defects and adds compelling details, yielding a more realistic high-resolution image.
We can compare a StackGAN network to the work of a painter. As a painter starts working, they draw primitive shapes such as lines, circles, and rectangles. Then, they try to fill in the colors. As the painting progresses, more and more detail is added. In a StackGAN, Stage-I is about drawing primitive shapes, while Stage-II is about correcting defects in the image generated by the Stage-I network. Stage-II also adds more detail to make the image look more photo-realistic. The generator networks in both stages are Conditional Generative Adversarial Networks (CGANs). The first GAN is conditioned on the text descriptions, while the second network is conditioned on the text descriptions and the images generated by the first GAN as well.

Architecture of StackGAN

StackGAN is a two-stage network. Each stage has two generators and two discriminators. StackGAN is made up of many networks, which are as follows:
  • Stack-I GAN: text encoder, Conditioning Augmentation network, generator network, discriminator network, embedding compressor network
  • Stack-II GAN: text encoder, Conditioning Augmentation network, generator network, discriminator network, embedding compressor network
Source: arXiv:1612.03242 [cs.CV]
The preceding image is self-explanatory. It represents both stages of the StackGAN network. As you can see, the first stage is generating images with dimensions of 64x64. Then the second stage takes these low-resolution images and generates high-resolution images with dimensions of 256x256. In the next few sections, we will explore the different components in the StackGAN network. Before doing this, however, let's get familiar with the notations that are used in this chapter:
Notation
Description
t
This is a text description of the true data distribution.
z
This is a randomly sampled nois...

Table of contents