Ask Your Question
1

XML file too large in LBP

asked 2013-03-04 13:10:51 -0600

Preeti gravatar image

updated 2013-03-04 13:11:23 -0600

i am doing my project on face, age and gender recognition. i am using the LBP technique for the same. but, when i initially train the system for the first time, the XML file created is about 44MB, and this makes the further processes slow. could anyone tell me how big the XML file should actually be? also could you give me suggestions to improve the efficiency of the face recognition code?

edit retag flag offensive close merge delete

Comments

1

yml will take much less space/time than xml

alternatively, you could retrieve the histograms after the training, like:

Mat histograms = reco.get("histograms");

and do your own (binary) serialization

berak gravatar imageberak ( 2013-03-04 13:15:14 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2013-03-06 04:15:05 -0600

updated 2013-03-06 04:20:01 -0600

The large file is also due to a missing dimensionality reduction in the implementation, which can be applied for Local Binary Patterns without a great loss of information. If you read up some literature on Local Binary Patterns, you'll notice there is something called Uniform Patterns. This is due to the LBP definition and its a-priori probabilities for building some patterns :

  • Francesco Bianconi and Antonio Fernández, "On the occurrence probability of local binary patterns: a theoretical study". Journal of Mathematical Imaging and Vision 01/2011; 40:259-268. (PDF)

The Scholarpedia page on LBP states:

Another extension to the original operator is the definition of so called uniform patterns, which can be used to reduce the length of the feature vector and implement a simple rotation-invariant descriptor. This extension was inspired by the fact that some binary patterns occur more commonly in texture images than others. A local binary pattern is called uniform if the binary pattern contains at most two bitwise transitions from 0 to 1 or vice versa when the bit pattern is traversed circularly. For example, the patterns 00000000 (0 transitions), 01110000 (2 transitions) and 11001111 (2 transitions) are uniform whereas the patterns 11001001 (4 transitions) and 01010010 (6 transitions) are not. In the computation of the LBP labels, uniform patterns are used so that there is a separate label for each uniform pattern and all the non-uniform patterns are labeled with a single label. For example, when using (8,R) neighborhood, there are a total of 256 patterns, 58 of which are uniform, which yields in 59 different labels.

Ojala et al. (2002) noticed in their experiments with texture images that uniform patterns account for a little less than 90% of all patterns when using the (8,1) neighborhood and for around 70% in the (16,2) neighborhood. Each bin (LBP code) can be regarded as a micro-texton. Local primitives which are codified by these bins include different types of curved edges, spots, flat areas etc.

It should be easy to add this to the implementation, please open up a ticket with the specific feature request on http://code.opencv.org if you would like to see it implemented.

edit flag offensive delete link more

Comments

i lately tried implementing uniform LBP ( unfortunately not using opencv ).

it can be easily done using a lookup table

in the (8,R) case, it reduced the histogram size(and the size of the training dataset) to 22% of the original, and had no visible loss in recognition

.. might try again with opencv now ;)

berak gravatar imageberak ( 2013-03-06 04:59:37 -0600 )edit

Probably you can share some code. :-)

Philipp Wagner gravatar imagePhilipp Wagner ( 2013-03-06 06:46:07 -0600 )edit

will do!

berak gravatar imageberak ( 2013-03-06 07:02:52 -0600 )edit

Then make an answer out of it, so I can upvote at least!

Philipp Wagner gravatar imagePhilipp Wagner ( 2013-03-06 07:03:50 -0600 )edit

@berak could you please share code for uniform LBP using look-up table? badly needed.....is it in C++ or OpenCV? thanks!

learner123 gravatar imagelearner123 ( 2013-06-20 10:18:12 -0600 )edit

it's currently here unfortunately, that's opencv2.4.9, and yes, c++

berak gravatar imageberak ( 2013-06-20 12:16:23 -0600 )edit

Question Tools

Stats

Asked: 2013-03-04 13:10:51 -0600

Seen: 608 times

Last updated: Mar 06 '13