OpenCV comes with a tool called traincascade that trains LBP, Haar and HOG. In particular, for face recognition, they even send a 3000-shaped data set with 24-pixel edges of 24 Γ 24 pixels in the format required by the trace.
In my experience, of the three types of trace support, LBP takes less time to train, taking on the order of hours rather than days for Haar.
A brief overview of the learning process is that for a given number of stages (a worthy choice - 20), he is trying to find functions that reject as many people as possible without dropping the faces. The balance between the deviation of non-citizens and restraints is controlled by the speed of a mini-strike (OpenCV chose 99.5%) and a false alarm (OpenCV chose 50%). A specific meta-algorithm used to create a custom LBP OpenCV cascade is Gentle AdaBoost (GAB).
The LBP variant implemented in OpenCV is described here:
Shengcai Liao, Xiangxin Zhu, Zhen Lei, Lun Zhang and Stan Z. Li. Studying multiscale local binary patterns for face recognition. International Conference on Biometrics (ICB), 2007, p. 828-837.
In OpenCV with default options, this is in practice:
OpenCV LBP Cascade Runtime Overview
The detector checks 24x24 windows inside the image looking for a face. After exiting stage 1-20 of the cascading classifier, if it can show that the current 24x24 window is most likely not a face, it rejects it and moves one or two pixels in the window to the next position; Otherwise, he will proceed to the next step.
During each step, 3-10 LBP functions are examined. Each LBP function has an offset within the window and size, and the area it covers is completely contained in the current window. Evaluating the LBP function at a given position may lead to a pass or failure. Depending on whether the LBP function works successfully or not, the positive or negative weight characteristic of this function is added to the battery.
After evaluating all the characteristics of the LBP stage, the battery value is compared with the scene threshold. The scene crashes if the battery is below the threshold and passes if it is higher. Again, if the stage fails, the cascade ends and the window moves to the next position.
Evaluating the LBP function is relatively simple. When this function is shifted, nine rectangles are located in the 3x3 configuration in the window. These nine rectangles are the same size for a specific LBP function, from 1x1 to 8x8.
The sum of all pixels in nine rectangles is calculated, in other words, their integral. Then the integral of the central rectangle is compared with the integral of its eight neighbors. The result of these eight comparisons is eight bits (1 or 0) that are compiled into an 8-bit LBP.
This 8-bit bitvector is used as an index in the 2 ^ 8 == 256-bit LUT calculated by the learning process and, in particular, for each LBP function that determines whether the LBP function passed or failed.
That is all that is needed.