INTRODUCTION

Welcome to the chapter on Generative Adversarial Networks or GAN's. In this chapter, we will be building a Neural Network that fills in the missing part of a handwritten digit. Previously, we have built a digit classifier for the restaurant chain. But, they have also noticed that sometimes when customers write in their phone number,  small sections/regions of the digits are missing. This may be a combination of the customer not having a smooth flow when writing on the iPad application as well as issues with iPad application not processing the complete user gesture on the screen. This makes it hard for the handwritten digit classifier to predict the right digit corresponding to the handwritten number. Now, they want us to reconstruct (generate back) the missing parts of the handwritten numbers so that the classifier receives clear handwritten numbers for conversion into digits. With this, the classifier will be able to do a much more accurate job of classifying handwritten digits and the notice gets sent to the right hungry customer!

We will mostly focus on the generation/reconstruction of the missing sections of a digit and we will do this with the help of Neural Impainting with Generative Adversarial Networks or GAN's.

Figure 14.1: Generative Adversarial Network flow chart

What we'll learn in this chapter is:

  1. What is a Generative Adversarial Network
  2. What is a Generator and a Discriminator
  3.  Code the model and define hyperparameters
  4. Build and understand the training loop
  5. Test the model
  6. Extend the model to new datasets

In this chapter, you will implement the following,

  1. Build an MNIST digit classifier
  2. Simulate a dataset of handwritten digits with sections of the handwritten numbers missing.
  3. Use the MNIST classifier to predict on noised/masked MNIST digits dataset (Simulated dataset).
  4. Implement GAN to generate back the missing regions of the digit.
  5. Use the MNIST classifier to predict on the generated digits from GAN.
  6. Compare performance between masked data and generated data.

It would be better if you implement the code snippets as you go along this chapter either in a jupyter notebook or any source code editor.  This will make it easier for you to follow along as well as understand what each part of the code does.

All the python files and the jupyter notebooks for this chapter can be found here https://github.com/PacktPublishing/Python-Deep-Learning-Projects/tree/master/Chapter%2014

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.39.144