This project is a quick port of the "Standard Model of Visual Cortex" (CBCL, MIT, by Riesenhuber M., Poggio T., Serre T., Wolf L., ; I've got some missing names please let me know)
I first started
... [More]
working on this model in 2007, but I only worked a month or two on the project (after coding a working gpu port). After some years of research in computational neuroscience (and mastering GPU programming) I've decided to start the code from scratch, as I needed to experiment a bit further with it, comparing it to other models and simulations. The resulting code is fast and robust, it's a mere ~500 lines of code and I managed to code it in less than a week (probably it would have taken just an afternoon if it wasn't GPU code, which requires days to fix small bugs :P).
Code is released under GPL2. Feel free to use it without problems.
Benchmark:
The code has been benchmarked on the BASS supercomputer, by University of North Carolina. The test node features an nVidia Quadro FX 5600 GPU (equivalent to nVidia GTX 8800) GPU cores, 4GB RAM, 1.35Ghz shader clock, 76GB/s memory speed.
Time to process a 256x256 image is ~345ms (of which ~330ms to compute S2 features); to process a 320x240 image requires ~405ms.
I'll try to compare with the official (released) code to determine the speedup.
Some quick notes:
** Current implementation only allows 4x4 and 8x8 C1 patches to be used at S2 level (test programs use 1024 4x4 features and 256 8x8 ones).
** I'm exploring a variant of the base model (code is not in the repository, though) which adds a DoG filter before passing the input image on to the StandardModel. Performance on Car Vs Non-Car (UIUC database) with C1 patches extracted at random from a different database is about ~70-75% with normal model, and ~85% using DoG images as input. To try it out just modify this piece of code under cuda/standard.cu, SetPyramid_0() function, at the top:
cvCvtColor(im, pyr0, CV_BGR2GRAY);
IplImage *g1=cvCreateImage(cvSize(im->width, im->height), 8, 1);
IplImage *g2=cvCreateImage(cvSize(im->width, im->height), 8, 1);
cvSmooth(pyr0, g1, CV_GAUSSIAN, 5, 0, 1.5);
cvSmooth(pyr0, g2, CV_GAUSSIAN, 5, 0, 1.0);
cvAbsDiff(g1, g2, pyr0);
cvThreshold(pyr0, pyr0, 5.0, 255.0, CV_THRESH_TOZERO);
cvReleaseImage(&g1);
cvReleaseImage(&g2);
References:
- 1) "Object Recognition with Features Inspired by Visual Cortex", Serre T., Wolf L., Poggio T. link
- 2) "Robust Object Recognition with Cortex-Like Mechanisms", Serre T., Wolf L., Bileschi S., Riesenhuber M., Poggio T. link
- 3) "Multiclass Object Recognition with Sparse, Localized Features", Mutch J., Lowe D. G. link
- 4) "A Theory of Object Recognition: Computations and Circuits in the Feedforward Path of the Ventral Stream in Primate Visual Cortex", Serre T., Kouh M., Cadieu C., Knoblich U., Kreiman G., Poggio T. link [Less]