Book Image

Hands-On Deep Learning with TensorFlow

By : Dan Van Boxel
Book Image

Hands-On Deep Learning with TensorFlow

By: Dan Van Boxel

Overview of this book

Dan Van Boxel’s Deep Learning with TensorFlow is based on Dan’s best-selling TensorFlow video course. With deep learning going mainstream, making sense of data and getting accurate results using deep networks is possible. Dan Van Boxel will be your guide to exploring the possibilities with deep learning; he will enable you to understand data like never before. With the efficiency and simplicity of TensorFlow, you will be able to process your data and gain insights that will change how you look at data. With Dan’s guidance, you will dig deeper into the hidden layers of abstraction using raw data. Dan then shows you various complex algorithms for deep learning and various examples that use these deep neural networks. You will also learn how to train your machine to craft new features to make sense of deeper layers of data. In this book, Dan shares his knowledge across topics such as logistic regression, convolutional neural networks, recurrent neural networks, training deep networks, and high level interfaces. With the help of novel practical examples, you will become an ace at advanced multilayer networks, image recognition, and beyond.
Table of Contents (12 chapters)

Preface

TensorFlow is an open source software library for machine learning and training neural networks. TensorFlow was originally developed by Google, and was made open source in 2015.

Over the course of this book, you will learn how to use TensorFlow to solve a novel research problem. You'll use one of the most popular machine learning approaches, neural networks with TensorFlow. We'll work on both the simple and deep neural networks to improve our models.

You'll study images of letters and digits in various fonts with the goal of identifying fonts based on one specific image of a single letter. This will be a straightforward classification problem.

As no single pixel or position—but local structures among pixels—is important, it's an ideal problem for deep learning with TensorFlow. Though we'll start with simple models, this series will gradually introduce more nuanced approaches and explain the code line by line. By the end of this book, you'll have created your own advanced model for font recognition.

So let's put on our helmets; we're going deep into data mines with TensorFlow.

What this book covers

Chapter 1, Getting Started, discusses the techniques and the models we'll apply using TensorFlow. In this chapter, we will install TensorFlow on a machine we can use. After some small steps with basic computations, we will jump into a machine learning problem, successfully building a decent model with just logistic regression and a few lines of TensorFlow code.

Chapter 2, Deep Neural Networks, shows TensorFlow in its prime with deep neural networks. You will learn about the single and multiple hidden layer model. You will also learn about the different types of neural networks and build and train our first neural network with TensorFlow.

Chapter 3, Convolutional Neural Networks, talks about the most powerful developments in deep learning and applies the concepts of convolution to a simple example in TensorFlow. We will tackle the practical aspects of understanding convolution. We will explain what a convolutional and pooling layer is in a neural net, following with a TensorFlow example.

Chapter 4, Introducing Recurrent Neural Networks, introduces the concept of RNN models, and their implementation in TensorFlow. We will look at a simple interface to TensorFlow called TensorFlow learn. We will also walk through dense neural networks as well as understand convolutional neural networks and extracting weights in detail.

Chapter 5, Wrapping Up, wraps up our look at TensorFlow. We'll revisit our TensorFlow models for font classification, and review their accuracy.

What you need for this book

While this book will show you how to install TensorFlow, there are a few dependencies you need to be aware of. At a minimum, you need a recent version of Python 2 or 3 and NumPy. To get the most out of the book, you should also have Matplotlib and IPython.

Who this book is for

With deep learning going mainstream, making sense of data and getting accurate results using deep networks is possible. Dan Van Boxel is your guide to exploring the possibilities with deep learning; he will enable you to understand data like never before. With the efficiency and simplicity of TensorFlow, you will be able to process your data and gain insights that will change how you look at data.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The first thing you need to do is download the source code pack for this book and open the simple.py file."

A block of code is set as follows:

import tensorflow as tf
# You can create constants in TF to hold specific values
a = tf.constant(1)
b = tf.constant(2)

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

import tensorflow as tf
# You can create constants in TF to hold specific values
a = tf.constant(1)
b = tf.constant(2)

Any command-line input or output is written as follows:

sudo pip3 install ./tensorflow-1.2.1-cp35-cp35m-linux_x86_64.whl

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on +New to create a new file. Here we'll create a Jupyter notebook".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an email to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Hands-On-Deep-Learning-with-TensorFlow. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/HandsOnDeepLearningwithTensorFlow.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.