Skip to content

badass-techie/Handwritten-Text-Reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handwritten Text Reader

A simple neural network to recognize handwritten digits

deep-learning, machine-learning, neural-network, computer-vision, ai, data-science

This neural network was implemented from scratch (no frameworks were used). The training and test data was obtained from the MNIST Dataset. The network was not tested on the same data it trained on.


Table of Contents


Getting Started

  • Navigate to bin/ and run HandwrittenTextReader.exe if you are on windows (if you use linux/mac, you'll have to build the source files and run the output).

  • Enter the relative path of the image. The program supports bitmap images of 28 by 28 pixels. You can use the images in data/sample-images/

  • See magic

Screenshot


Deploying

Build all .cpp files in the workspace folder.

#build with g++

g++ src/*.cpp EASYBMP_1.06/*.cpp -o bin/HandwrittenTextReader

Training the neural network

Call train() from src/main.cpp

int main(){
    train();
    return 0;
}

The training process may take a while, as the training set has 60,000 inputs and outputs. Expect favorable results with a learning rate of around 0.8. After only one epoch, the network may classify more than 90% of all its inputs correctly.


Reading data from a file

After the training process is complete, the program writes the values of all weights and biases to a csv file. You can initialize the neural network with data from a file previously generated by this program. Call test() from src/main.cpp and pass the relative path of the file as an argument.

int main(){
    test("../data/weights_and_biases.csv");
    return 0;
}

Final thoughts

Almost all aspects of this neural network were implemented from scratch for the sake of learning. As such, it's poorly optimized - you're better off using libraries for certain tasks, such as matrix multiplication.


© 2020 Moses Odhiambo

Releases

No releases published

Packages

No packages published