NEW: RESOURCE PAGE

Searching for tutorials and software about Deep Learning and Neural Nets? Be sure to look at my Resource Page!
Looking for Octave? Go to my Easy Octave on Mac page!

Tuesday, April 7, 2015

Andrea Burattin does MNIST in one hour with Fann



While doing a net search, I came across an italian language text, Andrea Burattin's work on recognising handwritten digits from the MNIST dataset by brute force, with one hour's training on a standard PC, by means of an off the shelf net library called FANN, written by Steffen Nissen.

MNIST digits displayes on Andrea Burattin's website

When I was doing my PhD, MNIST, digit recognition was the nec plus ultra, the bleeding edge of neural net classification, attempted only by crack teams like Yann Le Cun and his associates at ATT's Bell labs with large computational resources and feasible only by means of inventions like convolutional neural nets. Now the Bell labs real estate has been sold off, and any 14 year old  or even a geriatric researcher like me can play with the same problem. 


What I find more admirable than Andrea's frankly mediocre net's classification results, of ca. 80% recognition in his first attempt at the problem, are the hour-short training times, and his accounting of having spent 33 hours on the project from beginning to end, see slide crop above. Of which 4 hours to write up the project report and the presentation — 4 hours for a report - the young are so quick!

Reproducing Andrea's work seemed a good way to flip myself back into programming mode. This means getting FANN to compile, getting to know and testing FANN,  getting Andrea's code to compile, getting the samples, setting up a numerical experiment scheme and performing the experiments.

So I spent yesterday's hacking time downloading and installing the FANN library, which on my Mac meant the preliminary step of installing Brew to get CMAKE, without which building FANN on the Mac is problematic.

By the time I'd finished installing, the only problem was figuring out how to compile an example program. Here, for memory,  is the one-line shell script mfann which I used to successfully compile and run the provided xor example and some minor modified versions of this example.  
#!/bin/bash
/usr/bin/gcc $1.c -o $1 -lm -I/usr/local/include/ -L/usr/local/lib -lfann
I guess I could have done better, but I'm old and wary of optimising compiler maths bugs, and totally hopeless at anything practical. Anyway, I'm off to download the MNIST data files, and my own first run at MNIST, something I'd never have seen myself trying when I was a student — science does progress. 

Edmund














No comments:

Post a Comment

Hey, let me know what you think of my blog, and what material I should add!