Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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
£7.99 £29.99
Paperback
£36.99
Subscription
Free Trial
Renews at £16.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. £16.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781789139907
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. £16.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.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
£169.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
£234.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 £ 110.97
Keras 2.x Projects
£36.99
Generative Adversarial Networks Cookbook
£36.99
Generative Adversarial Networks Projects
£36.99
Total £ 110.97 Stars icon
Banner background image

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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.