Mastering TensorFlow 1.x
eBook - ePub

Mastering TensorFlow 1.x

  1. 474 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering TensorFlow 1.x

About this book

Build, scale, and deploy deep neural network models using the star libraries in Python

Key Features

  • Delve into advanced machine learning and deep learning use cases using Tensorflow and Keras
  • Build, deploy, and scale end-to-end deep neural network models in a production environment
  • Learn to deploy TensorFlow on mobile, and distributed TensorFlow on GPU, Clusters, and Kubernetes

Book Description

TensorFlow is the most popular numerical computation library built from the ground up for distributed, cloud, and mobile environments. TensorFlow represents the data as tensors and the computation as graphs.

This book is a comprehensive guide that lets you explore the advanced features of TensorFlow 1.x. Gain insight into TensorFlow Core, Keras, TF Estimators, TFLearn, TF Slim, Pretty Tensor, and Sonnet. Leverage the power of TensorFlow and Keras to build deep learning models, using concepts such as transfer learning, generative adversarial networks, and deep reinforcement learning. Throughout the book, you will obtain hands-on experience with varied datasets, such as MNIST, CIFAR-10, PTB, text8, and COCO-Images.

You will learn the advanced features of TensorFlow1.x, such as distributed TensorFlow with TF Clusters, deploy production models with TensorFlow Serving, and build and deploy TensorFlow models for mobile and embedded devices on Android and iOS platforms. You will see how to call TensorFlow and Keras API within the R statistical software, and learn the required techniques for debugging when the TensorFlow API-based code does not work as expected.

The book helps you obtain in-depth knowledge of TensorFlow, making you the go-to person for solving artificial intelligence problems. By the end of this guide, you will have mastered the offerings of TensorFlow and Keras, and gained the skills you need to build smarter, faster, and efficient machine learning and deep learning systems.

What you will learn

  • Master advanced concepts of deep learning such as transfer learning, reinforcement learning, generative models and more, using TensorFlow and Keras
  • Perform supervised (classification and regression) and unsupervised (clustering) learning to solve machine learning tasks
  • Build end-to-end deep learning (CNN, RNN, and Autoencoders) models with TensorFlow
  • Scale and deploy production models with distributed and high-performance computing on GPU and clusters
  • Build TensorFlow models to work with multilayer perceptrons using Keras, TFLearn, and R
  • Learn the functionalities of smart apps by building and deploying TensorFlow models on iOS and Android devices
  • Supercharge TensorFlow with distributed training and deployment on Kubernetes and TensorFlow Clusters

Who this book is for

This book is for data scientists, machine learning engineers, artificial intelligence engineers, and for all TensorFlow users who wish to upgrade their TensorFlow knowledge and work on various machine learning and deep learning problems. If you are looking for an easy-to-follow guide that underlines the intricacies and complex use cases of machine learning, you will find this book extremely useful. Some basic understanding of TensorFlow is required to get the most out of the book.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Transfer Learning and Pre-Trained Models

In simple words, transfer learning means that you take a pre-trained model trained to predict one kind of class, and then either use it directly or re-train only a small part of it, in order to predict another kind of class. For example, you can take a pre-trained model to identify types of cats, and then retrain only small parts of the model on the types of dogs and then use it to predict the types of dogs.
Without transfer learning, training a huge model on large datasets would take several days or even months. However, with transfer learning, by taking a pre-trained model, and only training the last couple of layers, we save a lot of time in training the model from scratch.
Transfer learning is also useful when you don't have a huge dataset. The models trained on small datasets may not be able to detect features that a model trained on large datasets can. Thus with transfer learning, you can get better models, even with smaller datasets.
In this chapter, we shall take pre-trained models and train them on new objects. We show examples of pre-trained models with images and apply them to image classification problems. You should try to find other pre-trained models and apply them to different problems such as object detection, text generation or machine translation. The following topics will be covered in this chapter:
  • ImageNet dataset
  • Retraining or fine-tuning the models
  • COCO animals dataset and preprocessing
  • Image classification using pre-trained VGG16 in TensorFlow
  • Image preprocessing in TensorFlow for pre-trained VGG16
  • Image classification using retrained VGG16 in TensorFlow
  • Image classification using pre-trained VGG16 in Keras
  • Image classification using retrained VGG16 in Keras
  • Image classification using Inception v3 in TensorFlow
  • Image classification using retrained Inception v3 in TensorFlow

ImageNet dataset

According to http://image-net.org:
ImageNet is an image dataset organized according to the WordNet hierarchy. Each meaningful concept in WordNet, possibly described by multiple words or word phrases, is called a synonym set or synset.
The ImageNet has about 100 K synsets and on average, about 1,000 human-annotated images for each synset. ImageNet only stores the references to the images while the images are stored in their original locations on the internet. In deep learning papers, the ImageNet-1K refers to the dataset released as part of ImageNet's Large Scale Visual Recognition Challenge (ILSVRC) to classify the dataset into 1,000 categories:
The 1,000 categories for the challenges can be found at the following URLs:
http://image-net.org/challenges/LSVRC/2017/browse-synsets
http://image-net.org/challenges/LSVRC/2016/browse-synsets
http://image-net.org/challenges/LSVRC/2015/browse-synsets
http://image-net.org/challenges/LSVRC/2014/browse-synsets
http://image-net.org/challenges/LSVRC/2013/browse-synsets
http://image-net.org/challenges/LSVRC/2012/browse-synsets
http://image-net.org/challenges/LSVRC/2011/browse-synsets
http://image-net.org/challenges/LSVRC/2010/browse-synsets.
We have written a custom function to download the ImageNet labels from Google:
def build_id2label(self):
base_url = 'https://raw.githubusercontent.com/tensorflow/models/master/research/inception/inception/data/'
synset_url = '{}/imagenet_lsvrc_2015_synsets.txt'.format(base_url)
synset_to_human_url = '{}/imagenet_metadata.txt'.format(base_url)

filename, _ = urllib.request.urlretrieve(synset_url)
synset_list = [s.strip() for s in open(filename).readlines()]
nu...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Packt Upsell
  4. Foreword
  5. Contributors
  6. Preface
  7. TensorFlow 101
  8. High-Level Libraries for TensorFlow
  9. Keras 101
  10. Classical Machine Learning with TensorFlow
  11. Neural Networks and MLP with TensorFlow and Keras
  12. RNN with TensorFlow and Keras
  13. RNN for Time Series Data with TensorFlow and Keras
  14. RNN for Text Data with TensorFlow and Keras
  15. CNN with TensorFlow and Keras
  16. Autoencoder with TensorFlow and Keras
  17. TensorFlow Models in Production with TF Serving
  18. Transfer Learning and Pre-Trained Models
  19. Deep Reinforcement Learning
  20. Generative Adversarial Networks
  21. Distributed Models with TensorFlow Clusters
  22. TensorFlow Models on Mobile and Embedded Platforms
  23. TensorFlow and Keras in R
  24. Debugging TensorFlow Models
  25. Tensor Processing Units
  26. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Mastering TensorFlow 1.x by Armando Fandango, Nick McClure in PDF and/or ePUB format, as well as other popular books in Computer Science & Artificial Intelligence (AI) & Semantics. We have over one million books available in our catalogue for you to explore.