Book Image

TensorFlow Deep Learning Projects

By : Alexey Grigorev, Rajalingappaa Shanmugamani
Book Image

TensorFlow Deep Learning Projects

By: Alexey Grigorev, Rajalingappaa Shanmugamani

Overview of this book

TensorFlow is one of the most popular frameworks used for machine learning and, more recently, deep learning. It provides a fast and efficient framework for training different kinds of deep learning models, with very high accuracy. This book is your guide to master deep learning with TensorFlow with the help of 10 real-world projects. TensorFlow Deep Learning Projects starts with setting up the right TensorFlow environment for deep learning. You'll learn how to train different types of deep learning models using TensorFlow, including Convolutional Neural Networks, Recurrent Neural Networks, LSTMs, and Generative Adversarial Networks. While doing this, you will build end-to-end deep learning solutions to tackle different real-world problems in image processing, recommendation systems, stock prediction, and building chatbots, to name a few. You will also develop systems that perform machine translation and use reinforcement learning techniques to play games. By the end of this book, you will have mastered all the concepts of deep learning and their implementation with TensorFlow, and will be able to build and train your own deep learning models with TensorFlow confidently.
Table of Contents (12 chapters)

Putting CGAN to work on some examples

Now that the CGAN class is completed, let's go through some examples in order to provide you with fresh ideas on how to use this project. First of all, we will have to get everything ready for both downloading the necessary data and training our GAN. We start by importing the routine libraries:

import numpy as np
import urllib.request
import tarfile
import os
import zipfile
import gzip
import os
from glob import glob
from tqdm import tqdm

We then proceed by loading in the dataset and CGAN classes that we previously prepared:

from cGAN import Dataset, CGAN

The class TqdmUpTo is just a tqdm wrapper that enables the use of the progress display also for downloads. The class has been taken directly from the project's page at https://github.com/tqdm/tqdm:

class TqdmUpTo(tqdm):
"""
Provides `update_to(n)` which uses `tqdm.update...