Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Generative Adversarial Networks Cookbook
Generative Adversarial Networks Cookbook

Generative Adversarial Networks Cookbook: Over 100 recipes to build generative models using Python, TensorFlow, and Keras

eBook
$27.98 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Generative Adversarial Networks Cookbook

Data First, Easy Environment, and Data Prep

In this chapter, we'll cover the following recipes:

  • Is data that important?
  • But first, set up your development environment
  • Data types
  • Data preprocessing
  • Anomalous data
  • Balancing data
  • Data augmentation

Introduction

Data can make or break your machine learning (ML) algorithm. This chapter will lay the basic ground work for manipulating data, augmenting data, and balancing imbalanced datasets or data with massive outliers. Each recipe will provide a guide on how to use open source libraries to accelerate our Generative Adversarial Network (GAN) training.

Is data that important?

Data is the lifeblood of ML algorithms. Your models will only be as good as the data you provide to them. After all, you are what you eat. We have to focus on developing a good, clean dataset for learning. This begins with getting an environment set up and preparing the data to be ingested into an algorithm. We do have a fundamental advantage within this process because GANs can take considerably smaller sets of data than other techniques. This advantage comes with the explicit caveat that we will need to ensure that the data we're using encompasses the entire trade space of possibilities for our application.

Getting ready

One of the deep dark secrets they don't teach you about this field...

But first, set up your development environment

What's a development environment? Everyone thinks setting up a development environment needs to be this incredibly arduous process. The installation process could be worse. It's actually quite simple and I intend to show you the basics in this recipe.

Getting ready

Let's lay out the requirements for the equipment you'll need to be successful in this book:

  • GPU: 10 series CUDA-enabled Nidea GPU 
  • Operating system: Ubuntu Linux 16.04+
  • CPU/RAM: i5 or i7 with at least 8 GB of RAM

First and foremost, the GPU is a requirement for this type of book. Although these algorithms can technically train on a CPU, it could take days in some cases for a single model...

Data types

In computer science, data types will represent the way the data is stored in the program. For this section, we are going to discuss the structure of the MNIST data and demonstrate how to simply manipulate the data.

Getting ready

Focusing on data types is where we will begin the data processing journey. Each step in this process is crucial to understand. Data types refer to the structure in which the data is held in Python. Think of a dictionary, array of floats, and so on. These are the data types that we would like to understand and consider. The example that we are going to explore in this set of recipes is going to be a parsing example for images since the first few recipes in this book will revolve around...

Data preprocessing

Data preprocessing is the explicit process of ensuring that your data can be ingested into your algorithm simply. In this section, you will learn how to work with data for ML in future sections.

Getting ready

Why even worry about preprocessing? It's easy to overlook the easy steps. As we ingest data into our algorithms, we'll need to ensure that each of the data points is both useful and accurate. This means we need to ensure that both the X data and Y labels, in a supervised learning problem space, are correct prior to going to a learner. So, how do we ensure that each of the data points is correct? For large datasets, we can look at macro metrics such as a three sigma outlier. For smaller datasets...

Anomalous data

Anomalous data is the risk that your data is not evenly distributed or easily separable. Datasets from the real world are going to contain outliers and data that needs to be adjusted. In this recipe, we will discuss a basic technique used in data analysis to work with anomalous data and distribute the results while maintaining the data distribution.

Getting ready

Outliers are a huge issue with datasets where you want to have a clean distribution of data. In terms of the generative model, we are interested in ensuring that the model can find the right representation of the distribution and model it appropriately. This recipe is going to focus on the tools you will use in these instances to solve problems with...

Balancing data

Balancing data and handling anomalous data are often thought of as the same process. In our case, data balancing involves understanding the techniques used to spread anomalous data without disrupting the underlying data distribution. In this recipe, we will discuss the core concepts in data balancing.

Getting ready

Generative modeling is attempting to build a model that represents the entire data distribution. In order to learn this underlying distribution, the data must represent that data in a verbose but compact form—that is, we want to ensure that each of the traits on features that we are attempting to learn, is represented in similar quantities the way in which they would be generated.

...

Data augmentation

Data augmentation is the idea that one image can be altered or corrupted to encourage deep learning techniques to generalize for the objective, rather than focusing on single features. In this section, we'll show a simple script for applying different augmentations.

Getting ready

The imgaug library is commonly used in deep learning research and this figure demonstrates a subset of available augmentations in this free-to-use library:

Data augmentation is a cornerstone of deep learning data analysis. Each project needs to understand how data augmentation can improve their project. Why would you choose to include data augmentation in your project? In images, it's easy to understand. By augmenting...

Introduction


Data can make or break your machine learning (ML) algorithm. This chapter will lay the basic ground work for manipulating data, augmenting data, and balancing imbalanced datasets or data with massive outliers. Each recipe will provide a guide on how to use open source libraries to accelerate our Generative Adversarial Network (GAN) training.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand the common architecture of different types of GANs
  • Train, optimize, and deploy GAN applications using TensorFlow and Keras
  • Build generative models with real-world data sets, including 2D and 3D data

Description

Developing Generative Adversarial Networks (GANs) is a complex task, and it is often hard to find code that is easy to understand. This book leads you through eight different examples of modern GAN implementations, including CycleGAN, simGAN, DCGAN, and 2D image to 3D model generation. Each chapter contains useful recipes to build on a common architecture in Python, TensorFlow and Keras to explore increasingly difficult GAN architectures in an easy-to-read format. The book starts by covering the different types of GAN architecture to help you understand how the model works. This book also contains intuitive recipes to help you work with use cases involving DCGAN, Pix2Pix, and so on. To understand these complex applications, you will take different real-world data sets and put them to use. By the end of this book, you will be equipped to deal with the challenges and issues that you may face while working with GAN models, thanks to easy-to-follow code solutions that you can implement right away.

Who is this book for?

This book is for data scientists, machine learning developers, and deep learning practitioners looking for a quick reference to tackle challenges and tasks in the GAN domain. Familiarity with machine learning concepts and working knowledge of Python programming language will help you get the most out of the book.

What you will learn

  • Structure a GAN architecture in pseudocode
  • Understand the common architecture for each of the GAN models you will build
  • Implement different GAN architectures in TensorFlow and Keras
  • Use different datasets to enable neural network functionality in GAN models
  • Combine different GAN models and learn how to fine-tune them
  • Produce a model that can take 2D images and produce 3D models
  • Develop a GAN to do style transfer with Pix2Pix

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 31, 2018
Length: 268 pages
Edition : 1st
Language : English
ISBN-13 : 9781789139587
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Dec 31, 2018
Length: 268 pages
Edition : 1st
Language : English
ISBN-13 : 9781789139587
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 146.97
Keras 2.x Projects
$48.99
Generative Adversarial Networks Cookbook
$48.99
Generative Adversarial Networks Projects
$48.99
Total $ 146.97 Stars icon

Table of Contents

9 Chapters
What Is a Generative Adversarial Network? Chevron down icon Chevron up icon
Data First, Easy Environment, and Data Prep Chevron down icon Chevron up icon
My First GAN in Under 100 Lines Chevron down icon Chevron up icon
Dreaming of New Outdoor Structures Using DCGAN Chevron down icon Chevron up icon
Pix2Pix Image-to-Image Translation Chevron down icon Chevron up icon
Style Transfering Your Image Using CycleGAN Chevron down icon Chevron up icon
Using Simulated Images To Create Photo-Realistic Eyeballs with SimGAN Chevron down icon Chevron up icon
From Image to 3D Models Using GANs Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(4 Ratings)
5 star 50%
4 star 0%
3 star 0%
2 star 0%
1 star 50%
joe m. Jun 04, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm a full time software developer who is looking to build some GANs to learn and this book was exactly what I was looking for. Breaking down the code and referencing the original papers is perfect, especially since I do not know python extremely well.From here I plan on buying a couple other ML books and then I would like to learn more about the math details but this book got me started on the right foot for me to go find out answers to all/most of my questions.
Amazon Verified review Amazon
Oliver Wesche Apr 16, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book was very insightful and I am glad that there are such niece books available to learn about emerging ML and AI technologies.
Amazon Verified review Amazon
Tony ZHu Mar 02, 2022
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
I have nothing to say, it does not worth your money
Amazon Verified review Amazon
Y. Cheng Oct 03, 2019
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
A lot of none sense printed in big fonts "How to do it" "Get ready". Legend are all in very tiny small font. He likes to say "here is how to do it" Then show part of codes. Then say "now you know how to do it." He also likes to waste readers' time by saying "Do you think I will stop here? No...." This book is watery. Not substantial. Figures are crapy. Some figures are corrupted and hard to read. Some scatter plots ought to be printed with different markers, o, x , square, because it's a black and white book. But author just print three groups of markers all in circle but with different color. Which makes readingthe figure impossible from the printed book. You can go to github to download figures. But it's so stupid. The listings of the codes wasted a lot of space on import packages and set up shells. The key part of the code are often omitted. Some genereated figures by GAN are shown as a block of grey image. Author does not even bother to generate a figure to be used in his book. But author spend time to mention he owned 36 cars. Anyway, I found Another book by Rowel Atienza is much more readable and helpful. I regret so much buying this book. Don't buy it.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.