OPTICAL CHARACTER RECOGNITION

Draw a letter or a digit in the grid below.

OCR using a tiny feedforward neural network of 80 neurons.

This code has no dependencies, doesn't load any external data, and fits inside 1000 lines. There are fewer 280 lines of actual code. The serialized network takes up 720 lines.

I trained this network on a small set of inputs of my own handwriting, so it's a little overfitted and its performance will be a bit wonky until I replace it with a version trained against the larger EMNIST data set released in 2017.