Tue. Jul 5th, 2022

Introduction: What is TensorFlow and How Does it Work?

WHAT IS TENSORFLOW? TensorFlow is a library for building and training deep learning models. It supports whole-graph training, where you can train a model from the ground up, or you can use an existing pretrained network to speed up training. It also has native support for neural networks and convolutional neural networks as well as multi-GPU/CPU systems with NVidia cuDNN and CUDA 9, Intel MKL, AMD OpenCL, and Imagination PowerVR G6430 GPUs. TensorFlow includes several pre-trained networks for image classification, speech recognition, and machine translation. TensorFlow also supports distributed training so you can work on multiple computers simultaneously or train the same model on different hardware or the same hardware at different times.
WHAT IS TENSORFLOW USED FOR?
· Deep Learning. Hundreds of millions of computers worldwide run neural networks to classify images and predict stock prices, but no one knows how these models actually work behind the scenes. TensorFlow lets you implement your own deep learning models from first principles, including multilayer perceptrons, deep belief nets, and more.
· Robotics. TensorFlow lets you build robots that interact with the real world through sensors and actuators without writing a single line of code. You can also train models to autonomously learn how to move around an environment without repeating the same task over and over again.
· Augmented Reality. Improve training for vision and gesture recognition by adding virtual objects to the real world.
· Artificial intelligence. Use TensorFlow to build your own artificially intelligent systems that can learn from their experience in an environment and improve over time.

learning tensorflow: a guide to building deep learning systems
learning tensorflow: a guide to building deep learning systems

A Brief History of Machine Learning

Today, deep learning is everywhere. With GPUs, the amount of computation that is possible has increased by an order of magnitude; and with these increased computational resources, researchers have trained deep neural networks to recognize handwritten digits , driving licences , and even bedrooms .
But where did deep learning come from? How did it start? And why did it become popular now?
This post will try to answer these questions. In this post, we will explore the history of machine learning in three different periods: (1) the pre-deep learning era, (2) the deep learning era, and (3) post-deep learning era. This can be roughly split to a nonlinear period, a linear period and a neural network period.

learning tensorflow: a guide to building deep learning systems
learning tensorflow: a guide to building deep learning systems

How TensorFlow Works with the ML Module to Build Deep Learning Systems

The ML module in TensorFlow allows you to build deep learning models. You can use a whole-graph approach where you train from the ground up, or you can use an existing pretrained network as a starting point . In either case, TensorFlow will automatically parallelize the data generation and store it in the same node that is being trained. The training system uses the data from all the workers on your distributed TensorFlow cluster. During training, one of the workers will assume role of master node and coordinate all communication between workers for that particular session. The other workers are designated as satellite nodes and will not execute any code. Instead, they are responsible for serving data to the master during training. TensorFlow will automatically send images to every satellite node in your cluster in order to serve them onto the master during training. This can significantly speed up training on a GPU-equipped machine since full-graph training is faster than distributed training .

learning tensorflow: a guide to building deep learning systems
learning tensorflow: a guide to building deep learning systems

How to Build a Convolutional Neural Network with TensorFlow

Convolutional neural networks (CNNs) are a popular choice for artificial intelligence applications. CNNs work by applying filters to data, performing the computation on multiple layers, and averaging across the output of each layer. CNNs are ideal for applications that require image recognition, as this is a natural fit for the probabilistic methods used in artificial neural networks. With TensorFlow, you can build CNNs by implementing and training your own convolution layers, or you can save time by using pre-trained models that are available on the Internet.
This tutorial starts with a quick tour of CNNs and their core elements, then shows you how to use TensorFlow’s CNN library to build and train a CNN from scratch.
Convolution
Before diving into how to build a CNN, let’s look at the types of convolution operations.
A convolution layer filters data from an input layer by applying a filter to a portion of the input. The filter matches each pixel in the image to the corresponding location of a kernel matrix. This operation is often called convolution, and it’s performed by convolutions on layers.
Convolution operations can be applied to input data in either spatial (sometimes called cross-correlation) or temporal (sometimes called sliding-window correlation) formats. To get started, let’s learn more about the spatial format. A popular choice for representing images is the RGB color space, where each pixel is represented as a three-element vector. An image of size 256 by 256 pixels can be stored in a single matrix of size 256x256x3.
Convolving with Matrices

learning tensorflow: a guide to building deep learning systems
learning tensorflow: a guide to building deep learning systems

How to Train Your Neural Network with Data and Test Your System

You can perform training and testing on the same node or you can use a different machine for the training and testing phases. When you train a model, TensorFlow will automatically keep track of the errors that are made during training. When you test the model, TensorFlow will compare your predictions with the correct answers and calculate how accurately your model is performing. You can then use this data to tune your model and make it better.
* * * * *
Artificial neural networks (ANNs) are a computational method for learning and extracting information from data. They are typically modeled on the human brain, but they can be used to learn other kinds of input/output relationships. Deep learning ANNs have many applications, including computer vision, natural language processing, speech recognition and robotics. To solve problems that were previously intractable using other methods, ANNs have led to significant progress in many fields of research since their inception in the 1950s.
Deep learning ANNs are composed of a neural network that is “deep” in the sense that it has many layers. A neural network consists of nodes (also called neurons) connected to other nodes by weighted links called “weights”. The weights are typically distributed across many nodes, which increases the number of calculations that need to be performed. In addition, to make the internal computation more efficient, often only a subset of the entire graph is used. Deep learning ANNs are sometimes described as “deep because they have many layers, which implicitly represent their structure.
This kind of neural network is large in size, and it is known as a deep neural network (DNN). Because the data that feed into these networks is typically heterogeneous and complex, the size of deep learning ANNs can become very large.

learning tensorflow: a guide to building deep learning systems
learning tensorflow: a guide to building deep learning systems