I'd like to distinguish different types of beers in my fridge using a Raspberry Pi. I saw a very good tutorial on Adafruit that utilized OpenCV for face recognition. Can these same face recognition algorithms, Eigenfaces & Fisherfaces, be used to train my raspberry pi for recognizing different types of beer cans?
-
$\begingroup$ I am not familiar with the area, but I think face recognition is specialized for faces since many faces are very similar and all have exactly the same form. Recognizing labels is likely going to require slightly different algorithms, since they have more variety. $\endgroup$– Godric SeerApr 23, 2014 at 20:50
2 Answers
The Eigenface algorithm transforms image patches (e.g. logo of beer) into a common data space where nearest neighbor search is performed for classification. In order to use Eigenfaces, you will need a training data set to compute the common data space. Therefore it requires some time to define a proper training set.
Once you have a proper training set, I believe that Eigenface will definitely work for the recognition of beer types. As an alternative you could use an unsupervised learning approach that needs no training set. For this take a look at http://deeplearning.net/
-
$\begingroup$ Thank you for the clarification! I'll also dig into deeplearning. Cheers $\endgroup$– AnconiaJun 11, 2014 at 14:11
This OpenCV documentation page suggests that the Eigenfaces algorithm is simply dimensionality reduction using PCA and classification by nearest neighbor search. Fisherfaces uses Linear Discriminant Analysis instead, which aims to maximize between-class variance while minimizing within-class variance, and so may perform better in some cases. Neither of these dimensionality reduction methods is specific to faces (or even to images) in any meaningful way, so you should be able to use the same algorithms for general image classification problems.
One thing to note though, is that the success rate for your run-of-the-mill classification algorithms, like nearest neighbor searches, will be highly dependent on the quality of training data. With faces, you can get away with using grayscale images, because a lot of the variance between images of two different faces is encoded in the spacial distribution of the data. For beer, I would think about taking advantage of the differences in color between bottle types by using color images, even if you have to reduce the number of pixels.
And just for fun, I might also look at other classification algorithms to use on your PCA or LDA processed data. As an example, OpenCV includes Support Vector Machines, which will almost always perform better than a simple nearest neighbor search.