Skip to content

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

char-recog

A handwritten digit classifier written from scratch in a single C++ file with no libraries. It is a plain fully connected feed forward neural network (a multilayer perceptron) trained with backpropagation on the MNIST dataset of 28x28 digit images.

data

Download MNIST once before anything else:

mkdir -p data && cd data
for f in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubyte; do
  curl -L -O "https://ossci-datasets.s3.amazonaws.com/mnist/$f.gz"
  gunzip "$f.gz"
done

scripts

Run any of them from anywhere, they build the program first.

  • ./build.sh compiles only
  • ./train.sh trains with the default settings and saves the weights to model.bin
  • ./test.sh loads model.bin, prints the results and draws 10 mistakes
  • ./quick.sh trains a small network for a fast look
  • ./check.sh checks the backpropagation math against numerical gradients

files it creates

data/ holds the four MNIST files, mnist is the compiled program and model.bin is the saved weights. All three are ignored by git and can be deleted and remade at any time.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages