AI-driven site to identify your handwritten digits

For many years, the MNIST dataset has been the introductory data for all computer vision enthusiasts.

I built a production implementation of a Convolutional Neural Net MNIST classifier. The final website, with a full AI, can be found here if you want to play around:

http://mnist-classifer-alb-1431583388.us-east-1.elb.amazonaws.com/
(The site doesn’t work well on mobile, so I’d recommend viewing it on a desktop).

Here is the Github Repo.

Note: I didn’t hyperparameter tune as much as I could’ve. The online prediction performance is not great. Next steps are to improve the model performance.

Here are a few screenshots:

Technologies Used:

  1. Python
  2. Keras
  3. Flask
  4. Unittest Framework
  5. AWS Container Registry / AWS Container Service
  6. Javascript / HTML

Acknowledgments:

Most of the Javascript code on the front end was found here. I did some minor refactoring and replaced the hard-coded prediction implementation with an API call.

Neural Network

This is a pretty boilerplate CNN built with Keras.

Architecture

The hidden layers are the following:

  1. Convolution Layer
    1. Filters: 25
    2. Kernel Size: (3,3)
    3. Activation Function: Relu
  2. Max Pooling
    1. Pool Size: (2,2)
  3. Fully Connected
    1. Num Units: 240
    2. Activation Function: Relu
  4. Output Layer

Training Parameters

  1. Optimization Algorithm was Adam, a variation of SGB
  2. Loss Function was categorical cross entropy
  3. Batch Size: 300
  4. Epochs: 7

Site Hosting

Nothing too fancy here. I am running a Flask app inside of a Docker Container. That app has the website front end (the home page of the site) and a /predict endpoint where we run the actual predictions.

For hosting, I used AWS for everything here – Elastic Container Registry to store my Docker Images, Elastic Container Service to run the containers, and an Application Load Balancer as my gateway.


Recent Posts