Rhonda Software

Highest quality full cycle software development.

Expert in areas of Computer Vision, Multimedia, Messaging, Networking and others. Focused on embedded software development. Competent in building cross-platform solutions and distributed SW systems.

Offer standalone custom solutions as well as integration of existing products. Opened for outsourcing services.

Visit us at: http://www.rhondasoftware.com

Currency recognition using cortex-like model.

Posted on : 09-08-2010 | By : Igor Stepura | In : Uncategorized

0

Currency recognition seems to be one of the popular topic in “applied” computer vision. There are a lot of articles, blog entries describing different approaches to currency recognition. In this post I’ll share my experience of using so-called HMAX model.

Introduction

HMAX aims to model hierarchical object recognition in cortex. I won’t get into details of HMAX model, just provide some useful links for curious readers:

http://riesenhuberlab.neuro.georgetown.edu/hmax.html

http://cbcl.mit.edu/cbcl/publications/index-pubs.html

My approach in using HMAX for currency recognition was pretty simple.

1. Generate proper С1-feature dictionary
2. Using C1-feature dictionary, generate C2 vectors for images in training dataset
3. Train multi-class SVM classifier using C2 vectors.
4. Test classifier on testing dataset
5. PROFIT

C1 dictionary generation
My initial approach was to generate dictionary automatically using an “interesting point” detector and then generate C-1 patches of size corresponding to the size of detected image structure. Hessian-Laplace (see Mikolajczyk K. and Schmid, C. 2004. ) method seemed to suit well for this task, since it detects characteristic scale of interesting points. My implementation of Hessian-Laplace worked reasonable fine, however number of interesting points it detected was big, so it was pretty hard for my C1 extractor to decide which one of these points was really “interesting” for currency recognition.
As a result – none of my automatically generated dictionaries (which contained about 1000 samples) produce suitable classification outputs.

So I decided to start from smaller dictionary, which would contain hand-picked, really descriptive patches from all kind of bills. For each image in C1 dataset I took 8 patches ( see example of pacthes below). All images in C1 dataset were resized to have width 300 pixels. Size of C1 dictionary now became 88.

Classifier training
The size of my training dataset was 337 images of different dollar bills of all classes (1 to 100) + set of “background” images.

I used LibSVM for classifier training and testing, using RBF and Linear classifier kernels.

To train models with RBF kernels I used script easy.py from LibSVM – this handy script automatically scales training data and the searches for the best C/gamma parameters of the kernel.
Linear classifiers were trained using semi-automated approach – I scaled training data first, then used grid.py to find best value for C parameter of the kernel.

Something like that:
svm-scale -s newdict.range newdict.l > newdict.scale

./grid.py -log2g 1,1,1 -log2c -5,15,0.5 -t 0 newdict.scale

svm-train -t 0 -c 0.353553390593 newdict.scale newdict.model

And for testing:
svm-scale -r newdict.range newdict.t > newdict.t.scale

svm-predict newdict.t.scale newdict.model newdict.model.predict

Experiment results

Best classification accuracy I’ve reached so far is 88.62% using linear classifier.

Conclusions and future work

HMAX model has proved successful in classification of currency images and seem to have potential for better results.

Possible directions toward better classification could be:
1. Brightness correction. HMAX implementation I used seems to be pretty sensitive to brightness changes. I’ll need to investigate this more deeply and if necessary – normalize trainig/testing images to get rid of brightness-related issues.

2. Quality of C1-dictionary. While my current dictionary proved to be good enough to recognize dollar bill classes, I suppose it could be improved. For example – data there could be more patches per bill class, taken for different layers (bands) of C1 “pyramid”. The size of the features may also vary to achieve better results.

3. HMAX model tuning. Perhaps model modification according to approach of Jim Mutch и David G. Lowe ( PDF) would give better recognition results.

4. Use Ada-Boost in addition to SVM for better model training.

Write a comment