Chris Pollett > Students > Sodhi

    Print View

    [Bio]

    [Blog]

    [CS 297 Proposal]

    [Power Point Presentations]

    [Deliverable 1]

    [Deliverable 2]

    [Deliverable 3]

    [Deliverable 4]

    [CS 297_Report - PDF]

    [CS 298 Project Proposal]

    [CS 298 Project Report - PDF]

    [CS 298 Project Presentation - PDF]

























Program that predicts a digit in real time, while its being drawn by the user



Description:

Now that the neural network has been built, it is important to observe how well it performs with actual pictures instead of the MNIST dataset. Hence this deliverable involved applying the neural network model we built in the previous deliverable to observe if its able to correctly predict what digit the user scribbled on a simple application like Gimp, after a screenshot of the same is taken by a python program. Once the screenshot is taken, the image is downscaled and then stored in a folder, the predicted model grabs the image from that folder and supplies it to the CNN model so that its label can be predicted.


About the program: (cnn.py)
  1. The first hidden layer is a convolutional layer - Convolution2D. It haa 30 feature maps, with the size of 5 by 5 and a rectifier activation function. This is the input layer, expecting images with the structure outline above [pixels][width][height].
  2. Next is a pooling layer that takes the max called MaxPooling2D. ( configured with a pool size of 2 by 2.)
  3. The third hidden layer is a convolutional layer - Convolution2D. It haa 15 feature maps, with the size of 3 by 3.
  4. Next is a pooling layer that takes the max called MaxPooling2D. ( configured with a pool size of 2 by 2.)
  5. The next layer is a regularization layer using dropout called Dropout. It is configured to randomly exclude 20% of neurons in the layer in order to reduce overfitting.
  6. Next is a layer that converts the 2D matrix data to a vector called Flatten. It allows the output to be processed by standard fully connected layers.
  7. Next a fully connected layer with 128 neurons and rectifier activation function.
  8. The layer after that is another fully connected layer with 50 neurons and rectifier activation function.
  9. Finally, the output layer has 10 neurons for the 10 classes and a softmax activation function to output probability-like predictions for each class.

About the program: (cnn_del.py)

Steps to make the program run:
  1. Download the program from here
  2. Use the model ("my_model.h5") generated by running cnn.py from Deliverable 3 or run cnn.py, after following the instructions mentioned in the section of the 3rd deliverable

Note: cnn.py might take a long time to run. To decrease the time, decrease the number of epochs.

Page Down