Code Monkey home page Code Monkey logo

digitrecognizer's Introduction

Digit Recognizer

Table of contents

Project description

Project Digit Recognizer was made for recognizing handwritten equations and calculating their results. It consists of two programs. Main application is a window with white field in which user can write natural numbers and basic arithmetical signs (+, -, *, /). Thanks to previously prepared artificial neural network, the program analyzes user's input and displays result of the equation.

Second program is so-called Learning Place which is simply artificial neural network that waits for learning. To teach it we use MNIST database which consists of 70 000 handwritten digits. We also prepared own digits' database as well as own arithemtical signs' databse, so the network has become more precise. Network used in this process has 784 input neurons (MNIST database's digits are saved in dimensions 28x28 and there needs to be one neuron per pixel), 14 output neurons (for classifying; 10 digits and 4 arithmetical signs) and 4 hidden layers with 100 neurons each.

How to use main application

To run main application, you just need two files: DigitRecognizer.exe and weights.txt. Second one is network configuration and consists of thousands of lines. In first line you can find there some numbers; first one is alpha coefficient used in bipolar linear activation function, other ones are numbers of neurons on specific layers (input, hidden, output). Other lines are weights of network's neurons.

DigitRecognizer

Before you start writing an equation in white field, you need to launch the neural network by clicking on the first button. Then, to calculate the result after writing an equation, you need to click the last button. If you want to clear the field, you need to click the button which is in the middle. And that's it!

How to use Learning Place

If main application doesn't work fine, the network needs to learn again. This time, you need more files: NeuralNetwork.exe, weights.txt and whole Datasets directory with MNIST database's files and some .png files. Program uses all signs*.png and digits*.png files, so you can add your own digits and arithmetical signs to make the program even more precise in analyzing your handwriting.

You may also want to change the build of the network. In this case you just have to edit code in Program.cs. From the code that you can see below, simply uncomment line with Network constructor and comment the line with LoadNetworkFromFile function. Then change it's arguments - alpha coefficient and table of hidden layers' neurons' amounts. You can also edit parameters of Train function: change amount of iterations, disable showing info about current Mean Square Error (change true to false) or enable breaking the loop in situations when error grows (add 4th argument: true). If your own handwritten datasets are much bigger you can also change MNISTDatasetSizeDivider value to smaller number - this variable helps in keeping good proportions between MNIST datasets and own datasets.

int MNISTDatasetSizeDivider = 50; // 1 -> 60000+10000; 5 -> 12000+2000; 10 -> 6000+1000; and so on...
double[][][] datasets = Data.PrepareDatasets(MNISTDatasetSizeDivider);

//Network network = new Network(0.8, datasets[0][0].Length, new int[] { 100, 100, 100, 100}, datasets[1][0].Length);
Network network = Network.LoadNetworkFromFile("weights.txt");
network.CalculatePrecision(datasets);
network.Train(datasets, 15, true);
network.CalculatePrecision(datasets);

Project status

The project is considered as finished.

digitrecognizer's People

Contributors

kamil-matula avatar roizdnab avatar wkoziel avatar

Watchers

 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.