Home » Uncategorized

Tensorflow Tutorial : Part 1 – Introduction

In this multi-part series, we will explore how to get started with tensorflow. This tensorflow tutorial will lay a solid foundation to this popular tool that everyone seems to be talking about. The first part will focus on introducing tensorflow, go through some applications and touch upon the architecture.

This post is the first part of the multi-part series on a complete tensorflow tutorial –

  • Tensorflow Tutorial – Part 1: Introduction
  • Tensorflow Tutorial – Part 2: Getting Started
  • Tensorflow Tutorial – Part 3: Building the first model

Tensorflow Tutorial : Goals

tensorflow tutorial

Why Tensorflow?

Well, for starters, it is an open source library from Google. Tensorflow has been gaining a lot of traction in the market given the rising popularity of neural networks and deep learning.

Many applications as of today have tensorflow embedded as part of their machine learning applications. Some broad applications have been listed below –

Applications

Some of the most popular cutting edge real world applications are using tensorflow.

tensorflow tutorial - applications

They have reported great accuracy scores which keeps on increasing over time.

  1. Image Recognition – Ever since Alex Krizhevsky winning the ImageNet challenge in 2012, convolutional neural networks have burst out in popularity and almost every month new architectures are surfacing with increased accuracy scores. Tensorflow is one of the foremost implementation choices for these applications
  2. Virtual Assistant – Chatbots have seen a significant rise in popularity in the year 2017. It is expected to maintain this trend. Understanding computational linguistics and deliver a high-end deep learning algorithm that can process text is one of the most sought after skills as of today.
  3. Self-driving cars – They use a variety of sensory inputs to determine every move, be it changing lanes to detecting traffic signals and stopping, detecting humans, other cars etc. Tensorflow is used in almost all the current self-driving cars that we see.

What is TensorFlow?

An interface for expressing machine learning algorithms and an implementation for executing such algorithms; A framework for creating ensemble algorithms for today’s most challenging problems. – Google Brain Team

tensorflow tutorial - getting started

Tensorflow is not just a pre-defined library of algorithms that you can use out of the box. It is a low-level library where you can orchestrate and design complex algorithms. It is very flexible in the way it lets you define your own computation graph.

For people not wanting to leverage such low-level flexibilities,  there is a rich set of pre-defined algorithms that you can use off the shelf. These algorithms have been the architectures used in latest research papers known to push accuracies to new levels.

So, in a way Transfer Learning (a feature of TensorFlow to be discussed later in the series) brings the Industry and Academia together.

TensorFlow Environment

Let’s explore the tensorflow environment and how the flexible architecture makes implementation so easy.

Language Interface

All technology components need an underlying programming language so that a programmer can talk to the technology. Tensorflow is one such technologies that requires SDKs in other programming languages to implement.

Right now, tensorflow supports the following only –

  1. Python – TensorFlow is available as a python library. Most of the operating system dependencies have been resolved, so apart from Windows (which required Python 3.5), TensorFlow supports all combinations of operating systems/python versions.
  2. C++ – TensforFlow is available in C++ in the form of an API.

For all of this series, we will only be using the Python implementations to build our solutions. I will happily willing to make C++ additions in case someone is willing to contribute.

tensorflow tutorial - environment

Execution Environment

Once the computation graph has been specified, it is sent to the execution environment to be executed. The execution master uses process execution device commands, to determine where to execute code.

This means you can execute code locally in your laptop with a CPU of a GPU if you have one. It also means you can trigger remote execution to a distributed system with multiple nodes, CPUs and GPUs.

tensorflow tutorial - execution env

This means you can build code and try it out with small data in your local machine. If it works out, you can easily scale it across large clusters with very little effort on your part.

Computation Graph

A tensor is an n-dimensional structure –

  • n=0 : Single Value
  • n=1: List of Values
  • n=2 : Matrix of values

Example: (a+b) * c

tensorflow tutorial - computation graph

As in the above diagram, we start with two tensors a and b. Since these can be multi-dimensional arrays of data, they can be taken to be complex data objects – such as images. Therefore, it might produce an n-dimensional array – which might be the result of multiplying the pixels of the two images, although I am not sure what the output image might look like.

The result is then added with another multi-dimensional array c, which might result in varying brightness of the images perhaps (depends on whether c is positive or negative).

I will be referring to these computation graphs as simply graphs.

These tensors flow through and are altered by operations (multiply and add for example). The flow of these tensors through these operations is what renders the name tensorflow.

Pre-requisites

Skills Required Skills Not Required
Knowledge of at least 1 programming language Expertise in TensorFlow
Basic Math and Statistics Expertise in Python
Passion to Understand Advanced Math and Statistics

Conclusion

I hope this sets the expectations for what is about to come. In the next post we will talk about installing and a simple TensorFlow implementation.

Let me know your opinions in the comments section below.