An interactive demonstration of single digit classification using deep artificial neural networks.
Two neural networks have been trained on the MNIST data set using the Google TensorFlow library.
- A simple, fully connected 3 layer neural network, trained to a test accuracy of 91.8%.
- A convolutional neural network, with 2 convolutional layers and a fully connected layer, trained to a test accuracy of 99.2%.
This web application demonstrates the ability of both networks to classify handwritten digits.
This application is available at mnist-demo.herokuapp.com
Once you draw an image it is scaled to the appropriate 28x28 pixel resolution and evaluated with both networks:
The front-end is a single page web application developed with the React and and Redux.js frameworks.
The server is a python Flask server which uses Google's TensorFlow library to evaluation pre-trained neural networks for handwriting recogntion.
Both the fully connnected and convolutional neural networks have been trained using TensorFlow and following the tutorials MNIST for ML beginners and Deep MNIST for Experts. The training data used are the 60,000 training images from the MNIST database of handwritten digits.
(Linux)
pip install -r requirements.txt
(Mac)
pip install -r requirements-mac.txt
npm install
To build and run the app locally run:
npm run build && npm run gunicorn
The app will be running at localhost:8000
To run the app with the front-end development server run:
npm run gunicorn
npm run dev
The development server will be running at localhost:8080
and proxying requests to localhost:8000
The pre-trained neural networks are saved in the models directory.
To re-train the networks run:
python networks/fully_connected.py
python networks/convolutional.py
The trained networks will be saved to the /tmp
directory
To deploy the application to Heroku, run the following:
heroku apps:create <NAME>
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add heroku/python
git push heroku master
Released under GPLv3, see LICENSE.txt