Giter Site home page Giter Site logo

digit-recogniser's Introduction

Digit Recogniser

After completing my Intro to Machine Learning (COMP70050) module at Imperial College London I wanted to try building a small digit recogniser using the MNIST dataset.
It uses tensorflow for the model and pygame for the GUI. To run the program run:

python3 recogniser.py

You can then use these events:

c: clears the board of all you've drawn
r: picks a random digit from the MNIST's dataset
SPACE: makes a prediction based on what you've drawn
ESC: quits the GUI

LEFT MOUSEBUTTON: draws
RIGHT MOUSEBUTTON: clears

The GUI is initially loaded with a drawing of 5 to showcase the tool.
A problem I have encountered is the MNIST's inability to generalise to digits not seen in the dataset. This could be due to the shading of the pixels being slightly different and the shapes looking different. It seems as though copying how test data looks works perfectly but generalising to any way of drawing a digit can cause it to predict incorrectly. This can also be seen drawing the exact same shape in a different portion of the screen leading to different predictions. However, 2, 3 and 7 seem to be the most accuracte to predict.
If you draw the digit in slightly different ways it usually ends up getting the right prediction - use the r command to see MNIST data. A better network may help as mine is a simple feedforward rather than a CNN.

Model

To run the model there are two options, running with the -train flag and running with no flag. Using the -train flag will perform a hyperparameter search on the MNIST dataset then run tests and print out the confusion matrix. No flag will load a pre-trained model and perform predictions on the test data, printing out the confusion matrix.

digit-recogniser's People

Contributors

euanscottwatson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.