Generative Adversarial Networks Projects
eBook - ePub

Generative Adversarial Networks Projects

Build next-generation generative models using TensorFlow and Keras

  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

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.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

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

  1. Title Page
  2. Copyright and Credits
  3. About Packt
  4. Contributors
  5. Preface
  6. Introduction to Generative Adversarial Networks
  7. 3D-GAN - Generating Shapes Using GANs
  8. Face Aging Using Conditional GAN
  9. Generating Anime Characters Using DCGANs
  10. Using SRGANs to Generate Photo-Realistic Images
  11. StackGAN - Text to Photo-Realistic Image Synthesis
  12. CycleGAN - Turn Paintings into Photos
  13. Conditional GAN - Image-to-Image Translation Using Conditional Adversarial Networks
  14. Predicting the Future of GANs
  15. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
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 990+ topics, we’ve got you covered! Learn about our mission
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 about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
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 & Artificial Intelligence (AI) & Semantics. We have over one million books available in our catalogue for you to explore.