Akṣi Handwritten-digit-recognizing neural-network
What is Akṣi?Akṣi is a handwritten-digit-recognizing neural-network that I created for a semester project in my Advanced Data Structures and Algorithms class at ASU Poly. Our professor asked up to pick any topic we liked. I've always been interested in Neural Networks, but I never really got the time to learn about them. I decided to use this opportunity to realize my interest. Armed with tutorials, examples, and research papers I set about creating my network. It was challenging, but at the end I learnt a lot.
How did you train Akṣi?Akṣi was trained using the stochastic backpropagation-algorithm with a momentum term. I also used a moving-average of the errors from the last 25 epochs as the error threshold. However, this increased the training-time of the network substantially. The error threshold for the trained network is 0.005, or 0.5%. The training and testing for Akṣi comes from MNIST's database of hand-written digits, which I found here. The digits are represented by a 28x28 matrix with values between 0 and 255. In contrast to standard RGB values, 255 stands for black and 0 stands for white. The images are therefore in greyscale. To normalizes the values to 0 or 1, I used a threshold value of 128.
What language did you use?Akṣi was created using Java, but I didn't use existing neural-net frameworks like Encog to train my network. I created the classes from scratch and implemented the backpropagation algorithm myself. After the network was trained, I persisted the serialzed the objects that represent the network to a file. This way, I could load up previously-trained networks and use them.
So can I try it out?You sure can! Try writing a digit in the square provided and Akṣi will recognize it! However, there are a few things to remember. Please make sure that the digit you write more or less fits into the space provided (so don't make the digit too small). The canvas is 80x80, but I scale and center the image into 20x20 and then center it inside a 28x28 image.
Note: Due to limitations with the training data, the network is not that good at recognizing 7's and 9's. The training data from MNIST originally comes from digits written by census takers. The top horizontal stroke of the 7's are at an angle (pointing down) which means that if you write a 7 with a horizontal stroke that does not point down, it doesn't successfully recognize it. The 9's have a short stem and a smallish loop and so a regular 9 isn't recognized so well. All other digits seem to be recognized without any problem.