Psychology 149
Machine Learning & AI

Lab Project 9:  Deep network for handwritten digit recognition




1) Write a program using Matlab's built-in functions that can recognize handwritten digits when you point a webcam to it.
Load the training data using the following matlab function:    digitTrain4DArrayData
This function loads a 4D matrix that contains 5000 images of hand written digits.  
The matrix has dimensions of 28x28x1x5000.   This means that the images are grayscale with each of them made up of  28 pixels along the horizontal and 28 pixels along the vertical dimension (28x28x1).  If they were color images, each image would be (28x28x3) where the 3 would contain the RGB color information.  The function also loads the labels (correct answers) associated with images.
The program should have:
1) an input layer
2) Three convolution layers (and their corresponding activation function layers, ReLU)
3) Pooling layers 
4) a softmax layer
5) a classification layer
6) Train the network for 20 epochs at a learning rate of 0.1
7) Save thr trained network (for example in a file called "digitnet").
8) If you have a USB webcam, attach it and see if the network you just trained can recognize your handwriting.

Step 1

Step 2

Step 3

Step 4

Step 5 

Step 6

Step 7

Step 8

Step 9

Step 10

Step 11

Step 12

Step 13

Step 14