Title Page Copyright and Credits Generative Adversarial Networks Cookbook About Packt Why subscribe? Packt.com Dedication Contributors About the author About the reviewer Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Download the color images Conventions used Sections Getting ready How to do it… How it works… There's more… See also Get in touch Reviews Dedication2 What Is a Generative Adversarial Network? Introduction Generative and discriminative models How to do it... How it works... A neural network love story How to do it... How it works... Deep neural networks How to do it... How it works... Architecture structure basics How to do it... How it works... Basic building block – generator How to do it... How it works... Basic building block – discriminator How to do it... How it works... Basic building block – loss functions How to do it... How it works... Training How to do it... How it works... GAN pieces come together in different ways How to do it... How it works... What does a GAN output? How to do it... How it works... Working with limited data – style transfer Dreaming new scenes – DCGAN Enhancing simulated data – simGAN Understanding the benefits of a GAN structure How to do it... How it works... Exercise Data First, Easy Environment, and Data Prep Introduction Is data that important? Getting ready How to do it... How it works... There's more... But first, set up your development environment Getting ready How to do it... Installing the NVIDIA driver for your GPU Installing Nvidia-Docker Purging all older versions of Docker  Adding package repositories Installing NVIDIA-Docker2 and reloading the daemon Testing nvidia-smi through the Docker container Building a container for development There's more... Data types Getting ready How to do it... How it works... Running this code in the Docker container There's more... Data preprocessing Getting ready How to do it... How it works... There's more... Anomalous data Getting ready How to do it... Univariate method There's more... Balancing data Getting ready How to do it... Sampling techniques Random undersampling Random oversampling Synthetic minority oversampling technique Ensemble techniques Bagging Boosting AdaBoost There's more... Data augmentation Getting ready How to do it... How it works... There's more... Exercise My First GAN in Under 100 Lines Introduction From theory to code – a simple example Getting ready How to do it... Discriminator base class Generator base class GAN base class See also Building a neural network in Keras and TensorFlow Getting ready How to do it... Building the Docker containers The Docker container The run file See also Explaining your first GAN component – discriminator Getting ready How to do it... Imports Initialization variables (init in the Discriminator class) Model definition for the discriminator Helper methods in the Discriminator class Explaining your second GAN component – generator Getting ready How to do it... Imports Generator initialization Model definition of the generator Helper methods of the generator Putting all the GAN pieces together Getting ready How it works... Step 1 – GAN class initialization Step 2 – model definition Step 3 – helper functions Training your first GAN Getting ready How to do it... Training class definition Imports init method in class Load data method Training method Helper functions Run script definition Training the model and understanding the GAN output Getting ready How to do it... How it works... Exercise Dreaming of New Outdoor Structures Using DCGAN Introduction What is DCGAN? A simple pseudocode example Getting ready How to do it... Generator Discriminator See also Tools – do I need any unique tools? Getting ready How to do it... The development environment for DCGAN Downloading and unpacking LSUN data There's more... See also Parsing the data – is our data unique? Getting ready How to do it... Code implementation – generator Getting ready How to do it... Initializing generator – the DCGAN update Building the DCGAN structure See also Code implementation – discriminator Getting ready How to do it... Initializing the Discriminator class Building the model structure See also Training Getting ready How to do it... Changes to class initialization Understanding the changes in pseudocode The new and improved training script Python run script Shell run script Evaluation – how do we know it worked? Getting ready How it works... Adjusting parameters for better performance How to do it... Training parameters Discriminator and generator architecture parameters Exercise Pix2Pix Image-to-Image Translation Introduction Introducing Pix2Pix with pseudocode Getting ready How to do it... Discriminator Generator Parsing our dataset Getting ready How to do it... Building the Docker container with a new Dockerfile Building the auxiliary scripts Code implementation – generator Getting ready How to do it... Code – the GAN network Getting ready How to do it... Code implementation – discriminator Getting ready How it works... Training Getting ready How to do it... Setting up the class Training method Plotting the results Helper functions Running the Training Script Exercise Style Transfering Your Image Using CycleGAN Introduction Pseudocode – how does it work? Getting ready How to do it... What is so powerful about CycleGAN? Parsing the CycleGAN dataset Getting ready How to do it... Docker implementation The data download script What does the data actually look like? Code implementation – generator Getting ready How to do it.... Code implementation – discriminator Getting ready How to do it... Code implementation – GAN Getting ready How to do it... On to training Getting ready How to do it... Initialization Training  method Helper method Exercise Using Simulated Images To Create Photo-Realistic Eyeballs with SimGAN Introduction How SimGAN architecture works Getting ready How to do it... Pseudocode – how does it work? Getting ready How to do it... How to work with training data Getting ready How to do it... Kaggle and its API Building the Docker image Running the Docker image Code implementation – loss functions Getting ready How to do it... Code implementation – generator Getting ready How to do it... Boilerplate items Model development Helper functions Code implementation – discriminator Getting ready How to do it... Boilerplate Model architecture Helper functions Code implementation – GAN Getting ready How to do it... Training the simGAN network Getting ready How to do it... Initialization Training function Helper functions Python run script Shell run script Exercise From Image to 3D Models Using GANs Introduction Introduction to using GANs in order to produce 3D models Getting ready How to do it... For a 2D image – learning an encoding space for an image Training a model using 3D convolutions Environment preparation Getting ready How to do it... Creating the Docker container Building the Docker container Encoding 2D data and matching to 3D objects Getting ready How to do it... Code to run a simple encoder The shell script to run the encoder with our Docker container Code implementation – generator Getting ready How to do it... Generator class preparation Building the generator model Code implementation – discriminator Getting ready How to do it... Discriminator class preparation Building the discriminator model Code implementation – GAN Getting ready How to do it... Training this model Getting ready How to do it... Training class preparation Helper functions The training method Plotting the output of the network Running the training script Exercise Other Books You May Enjoy Leave a review - let other readers know what you think