GANs in Action

Book description

GANs in Action teaches you how to build and train your own Generative Adversarial Networks, one of the most important innovations in deep learning. In this book, you'll learn how to start building your own simple adversarial system as you explore the foundation of GAN architecture: the generator and discriminator networks.



About the Technology

Generative Adversarial Networks, GANs, are an incredible AI technology capable of creating images, sound, and videos that are indistinguishable from the "real thing." By pitting two neural networks against each other—one to generate fakes and one to spot them—GANs rapidly learn to produce photo-realistic faces and other media objects. With the potential to produce stunningly realistic animations or shocking deepfakes, GANs are a huge step forward in deep learning systems.



About the Book

GANs in Action teaches you to build and train your own Generative Adversarial Networks. You'll start by creating simple generator and discriminator networks that are the foundation of GAN architecture. Then, following numerous hands-on examples, you'll train GANs to generate high-resolution images, image-to-image translation, and targeted data generation. Along the way, you'll find pro tips for making your system smart, effective, and fast.



What's Inside

  • Building your first GAN
  • Handling the progressive growing of GANs
  • Practical applications of GANs
  • Troubleshooting your system


About the Reader

For data professionals with intermediate Python skills, and the basics of deep learning–based image processing.



About the Authors

Jakub Langr is a Computer Vision Cofounder at Founders Factory (YEPIC.AI). Vladimir Bok is a Senior Product Manager overseeing machine learning infrastructure and research teams at a New York–based startup.



Quotes
Comprehensive and in-depth coverage of the future of AI.
- Simeon Leyzerzon, Excelsior Software

An incredibly useful mix of practical and academic information.
- Dana Robinson, The HDF Group

A great systematization of the rapidly evolving and vast GAN landscape.
- Grigory V. Sapunov, Intento

Excellent writing combined with easy-to-grasp mathematical explanations.
- Bachir Chihani, C3

Strikes that rare balance between an applied programming book, an academic book heavy on theory, and a conversational blog post on machine learning techniques.
- Dr. Erik Sapper, California Polytechnic State University

Publisher resources

View/Submit Errata

Table of contents

  1. GANs in Action: Deep learning with Generative Adversarial Networks
    1. Jakub Langr and Vladimir Bok
  2. Copyright
    1. Dedication
    2. Brief Table of Contents
    3. Table of Contents
    4. Preface
      1. Jakub Langr
      2. Vladimir Bok
    5. Acknowledgments
      1. Jakub Langr
      2. Vladimir Bok
    6. About this book
      1. Who should read this book
      2. About the code
      3. liveBook discussion forum
      4. Other online resources
      5. How this book is organized: a roadmap
        1. Part 1, “Introduction to GANs and generative modeling”
        2. Part 2, “Advanced topics in GANs”
        3. Part 3, “Where to go from here”
      6. About the authors
    7. About the cover illustration
      1. Saint-Sauveur
  3. Part 1. Introduction to GANs and generative modeling
  4. Chapter 1. Introduction to GANs
    1. 1.1. What are Generative Adversarial Networks?
    2. 1.2. How do GANs work?
    3. 1.3. GANs in action
      1. 1.3.1. GAN training
      2. 1.3.2. Reaching equilibrium
    4. 1.4. Why study GANs?
    5. Summary
  5. Chapter 2. Intro to generative modeling with autoencoders
    1. 2.1. Introduction to generative modeling
    2. 2.2. How do autoencoders function on a high level?
    3. 2.3. What are autoencoders to GANs?
    4. 2.4. What is an autoencoder made of?
    5. 2.5. Usage of autoencoders
    6. 2.6. Unsupervised learning
      1. 2.6.1. New take on an old idea
      2. 2.6.2. Generation using an autoencoder
      3. 2.6.3. Variational autoencoder
    7. 2.7. Code is life
    8. 2.8. Why did we try aGAN?
      1. Summary
  6. Chapter 3. Your first GAN: Generating handwritten digits
    1. 3.1. Foundations of GANs: Adversarial training
      1. 3.1.1. Cost functions
      2. 3.1.2. Training process
    2. 3.2. The Generator and the Discriminator
      1. 3.2.1. Conflicting objectives
      2. 3.2.2. Confusion matrix
    3. 3.3. GAN training algorithm
    4. 3.4. Tutorial: Generating handwritten digits
      1. 3.4.1. Importing modules and specifying model input dimensions
      2. 3.4.2. Implementing the Generator
      3. 3.4.3. Implementing the Discriminator
      4. 3.4.4. Building the model
      5. 3.4.5. Training
      6. 3.4.6. Outputting sample images
      7. 3.4.7. Running the model
      8. 3.4.8. Inspecting the results
    5. 3.5. Conclusion
    6. Summary
  7. Chapter 4. Deep Convolutional GAN
    1. 4.1. Convolutional neural networks
      1. 4.1.1. Convolutional filters
      2. 4.1.2. Parameter sharing
      3. 4.1.3. ConvNets visualized
    2. 4.2. Brief history of the DCGAN
    3. 4.3. Batch normalization
      1. 4.3.1. Understanding normalization
      2. 4.3.2. Computing batch normalization
    4. 4.4. Tutorial: Generating handwritten digits with DCGAN
      1. 4.4.1. Importing modules and specifying model input dimensions
      2. 4.4.2. Implementing the Generator
      3. 4.4.3. Implementing the Discriminator
      4. 4.4.4. Building and running the DCGAN
      5. 4.4.5. Model output
    5. 4.5. Conclusion
    6. Summary
  8. Part 2. Advanced topics in GANs
  9. Chapter 5. Training and common challenges: GANing for success
    1. 5.1. Evaluation
      1. 5.1.1. Evaluation framework
      2. 5.1.2. Inception score
      3. 5.1.3. Fréchet inception distance
    2. 5.2. Training challenges
      1. 5.2.1. Adding network depth
      2. 5.2.2. Game setups
      3. 5.2.3. Min-Max GAN
      4. 5.2.4. Non-Saturating GAN
      5. 5.2.5. When to stop training
      6. 5.2.6. Wasserstein GAN
    3. 5.3. Summary of game setups
    4. 5.4. Training hacks
      1. 5.4.1. Normalizations of inputs
      2. 5.4.2. Batch normalization
      3. 5.4.3. Gradient penalties
      4. 5.4.4. Train the Discriminator more
      5. 5.4.5. Avoid sparse gradients
      6. 5.4.6. Soft and noisy labels
    5. Summary
  10. Chapter 6. Progressing with GANs
    1. 6.1. Latent space interpolation
    2. 6.2. They grow up so fast
      1. 6.2.1. Progressive growing and smoothing of higher-resolution layers
      2. 6.2.2. Example implementation
      3. 6.2.3. Mini-batch standard deviation
      4. 6.2.4. Equalized learning rate
      5. 6.2.5. Pixel-wise feature normalization in the generator
    3. 6.3. Summary of key innovations
    4. 6.4. TensorFlow Hub and hands-on
    5. 6.5. Practical applications
    6. Summary
  11. Chapter 7. Semi-Supervised GAN
    1. 7.1. Introducing the Semi-Supervised GAN
      1. 7.1.1. What is a Semi-Supervised GAN?
      2. 7.1.2. Architecture
      3. 7.1.3. Training process
      4. 7.1.4. Training objective
    2. 7.2. Tutorial: Implementing a Semi-Supervised GAN
      1. 7.2.1. Architecture diagram
      2. 7.2.2. Implementation
      3. 7.2.3. Setup
      4. 7.2.4. The dataset
      5. 7.2.5. The Generator
      6. 7.2.6. The Discriminator
      7. 7.2.7. Building the model
      8. 7.2.8. Training
    3. 7.3. Comparison to a fully supervised classifier
    4. 7.4. Conclusion
    5. Summary
  12. Chapter 8. Conditional GAN
    1. 8.1. Motivation
    2. 8.2. What is Conditional GAN?
      1. 8.2.1. CGAN Generator
      2. 8.2.2. CGAN Discriminator
      3. 8.2.3. Summary table
      4. 8.2.4. Architecture diagram
    3. 8.3. Tutorial: Implementing a Conditional GAN
      1. 8.3.1. Implementation
      2. 8.3.2. Setup
      3. 8.3.3. CGAN Generator
      4. 8.3.4. CGAN Discriminator
      5. 8.3.5. Building the model
      6. 8.3.6. Training
      7. 8.3.7. Outputting sample images
      8. 8.3.8. Training the model
      9. 8.3.9. Inspecting the output: Targeted data generation
    4. 8.4. Conclusion
    5. Summary
  13. Chapter 9. CycleGAN
    1. 9.1. Image-to-image translation
    2. 9.2. Cycle-consistency loss: There and back aGAN
    3. 9.3. Adversarial loss
    4. 9.4. Identity loss
    5. 9.5. Architecture
      1. 9.5.1. CycleGAN architecture: building the network
      2. 9.5.2. Generator architecture
      3. 9.5.3. Discriminator architecture
    6. 9.6. Object-oriented design of GANs
    7. 9.7. Tutorial: CycleGAN
      1. 9.7.1. Building the network
      2. 9.7.2. Building the Generator
      3. 9.7.3. Building the Discriminator
      4. 9.7.4. Training the CycleGAN
      5. 9.7.5. Running CycleGAN
    8. 9.8. Expansions, augmentations, and applications
      1. 9.8.1. Augmented CycleGAN
      2. 9.8.2. Applications
    9. Summary
  14. Part 3. Where to go from here
  15. Chapter 10. Adversarial examples
    1. 10.1. Context of adversarial examples
    2. 10.2. Lies, damned lies, and distributions
    3. 10.3. Use and abuse of training
    4. 10.4. Signal and the noise
    5. 10.5. Not all hope is lost
    6. 10.6. Adversaries to GANs
    7. 10.7. Conclusion
    8. Summary
  16. Chapter 11. Practical applications of GANs
    1. 11.1. GANs in medicine
      1. 11.1.1. Using GANs to improve diagnostic accuracy
      2. 11.1.2. Methodology
      3. 11.1.3. Results
    2. 11.2. GANs in fashion
      1. 11.2.1. Using GANs to design fashion
      2. 11.2.2. Methodology
      3. 11.2.3. Creating new items matching individual preferences
      4. 11.2.4. Adjusting existing items to better match individual preferences
    3. 11.3. Conclusion
    4. Summary
  17. Chapter 12. Looking ahead
    1. 12.1. Ethics
    2. 12.2. GAN innovations
      1. 12.2.1. Relativistic GAN
      2. 12.2.2. Self-Attention GAN
      3. 12.2.3. BigGAN
    3. 12.3. Further reading
    4. 12.4. Looking back and closing thoughts
    5. Summary
  18. Training Generative Adversarial Networks (GANs)
  19. Index
    1. A
    2. B
    3. C
    4. D
    5. E
    6. F
    7. G
    8. H
    9. I
    10. J
    11. K
    12. L
    13. M
    14. N
    15. O
    16. P
    17. R
    18. S
    19. T
    20. U
    21. V
    22. W
    23. Z
  20. List of Figures
  21. List of Tables
  22. List of Listings

Product information

  • Title: GANs in Action
  • Author(s): Jakub Langr, Vladimir Bok
  • Release date: September 2019
  • Publisher(s): Manning Publications
  • ISBN: 9781617295560