Intro
This is a Gentle introduction to neural networks and deep learning. In this article I will use jupyter notebook with python and Keras.
Click here to have a idea on How to Install and Import Keras in Anaconda/Jupyter Notebooks.
There also exists Python packages for neural networks and deep learning. Here are some popular packages:
- TensorFlow (Google)
- Pytorch (Facebook)
- Keras (François Chollet)
- Caffe (Berkeley)
Image Classfication using Dense Networks
In this section, you will learn how to build and use a fully connected or dense neural network to perform simple classification tasks on images of hand-written digits.
To do this, we will use the MNIST data set that is included with the Keras package.
We will do this in four steps:
-
Loading data - Here we download the images into numpy arrays.
-
Constructing the network - In this step we specify the architecture of the network that we plan to use.
-
Training the network - In this step we use an optimization algorithm known as stochastic gradient descent to minimize a loss function of our choosing.
-
Testing the network - In this step, we run our test data through the network to determine the accuracy of our classifications.
Loading Data
import keras
from keras.datasets import mnist
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
print(type(train_images))
print(type(train_images[0,0,0])