TensorFlow (Beginner): Basic Image Classification

Welcome to “Basic Image Classification with TensorFlow”. You will learn to train a neural network to distinguish between images of hand-written digits from 0 to 9. And we will do this with the help of Google’s open source machine learning and deep learning library called TensorFlow. This course will serve as an introduction to both TensorFlow and applied machine learning.

Unavailable
TensorFlow (Beginner): Basic Image Classification

Duration (mins)

Learners

5.0 / 5

Rating

Task List


We will cover the following tasks in 49 minutes:


Introduction

We will understand the Rhyme interface and our learning environment. You will get a virtual machine, you will need Jupyter Notebook and TensorFlow for this course and both of these are already installed on your virtual machine. Jupyter Notebooks are very popular with Data Science and Machine Learning Engineers as one can write code in cells and use other cells for documentation.


Importing the Libraries

We are going to use Tensorflow’s implementation of Keras - a high level API to build and train the model. In addition to using TensorFlow and Keras, we will also import NumPy and Matplotlib’s PyPlot module which will be used in this example as well. NumPy is the fundamental package for scientific computing with Python. Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of formats and interactive environments across platforms.


The Dataset

This tutorial uses the MNIST dataset. MNIST consists of a training set of 60,000 examples and a test set of 10,000 examples where each example is a 28x28 grayscale image, associated with a label from 10 classes. The labels are simply numbered from 0 to 9. The images in the dataset are 28x28 NumPy arrays, with pixel values ranging from 0 to 255.


Data Preprocessing

We will scale the input feature values to a range of 0 to 1. This helps Neural Networks learn significantly better. This type of data normalisation is a standard practice when working with Neural Networks. We will need to do this preprocessing to both the training and test data.


Display the Images

We will loop through first 25 images from our training dataset to take a look at how our images look like along with their given labels. We do this with a simple PyPlot figure and then by adding images to its subplot and then displaying them within the Jupyter Notebook.


Building the Model

Neural Networks are built using multiple layers. In this model we have three layers: An input layer, a hidden layer and an output layer. We will use Keras’ Sequential model to create a model with these three layers. For the input layer, we will need to set an input shape. For the hidden layer and the output, we will need to set the number of nodes in those layers and their activation functions.


Compile the Model

Before we can train the model, we need to compile it with some additional settings. We need to specify Loss Function, Optimizer and Metrics. A loss function is an indicator of the difference between predicted values and the actual values. We try to minimize the loss function to steer the model in the right direction during training. Optimizer species how the model is updated based on the input data and the loss function.


Training the Model

Training the neural network model requires a few steps:

  • Feed the training data to the model: the training examples and training labels.
  • The model updates its internal parameters and learns to associate the images and labels.
  • We ask the model to make predictions on the test data: the test examples. Then we verify the results with the test labels.


Making Predictions

Predictions for each example gives us an array of 10 numbers. These describe the confidence of the model that the image example belongs to each of the 10 different hand-written digits. To make a definitive prediction, however, we will look at the prediction that the model has the highest confidence value for. Then, one can compare it with the actual label.


More Predictions

We will plot first 25 images with their predictions and their actual labels as given in the test dataset. Correct prediction labels will be in green and incorrect prediction labels will be red to help us make the distinction easily. We will use the same method for plotting these images as before: by first creating a PyPlot figure and then iterating over images as we add them to a subplot.

Watch Preview

Preview the instructions that you will follow along in a hands-on session in your browser.

Amit

About the Host (Amit)


I have been writing code since 1993, when I was 11, and my first passion project started with a database management software that I wrote for a local hospital. More recently, I wrote an award winning education Chatbot for a multi-billion-revenue company. I solved a recurrent problem for my client where they wanted to make basic cyber safety and privacy education accessible for their users. This bot enabled my client to reach out to their customers with personalised and real-time education. In the last one year, I’ve continued my interest in this field by constantly learning and growing in Machine Learning, NLP and Deep Learning. I'm very excited to share my variety of experience and learnings with you with the help of Rhyme.com.



Frequently Asked Questions


In Rhyme, all projects are completely hands-on. You don't just passively watch someone else. You use the software directly while following the host's (Amit) instructions. Using the software is the only way to achieve mastery. With the "Live Guide" option, you can ask for help and get immediate response.
Nothing! Just join through your web browser. Your host (Amit) has already installed all required software and configured all data.
You can go to https://rhyme.com/for-companies, sign up for free, and follow this visual guide How to use Rhyme to create your own sessions. If you have custom needs or company-specific environment, please email us at help@rhyme.com
Absolutely. We offer Rhyme for workgroups as well larger departments and companies. Universities, academies, and bootcamps can also buy Rhyme for their settings. You can select sessions and trainings that are mission critical for you and, as well, author your own that reflect your own needs and tech environments. Please email us at help@rhyme.com
Please email us at help@rhyme.com and we'll respond to you within one business day.

No sessions available