Explain LBP(local binary pattern histogram) features extraction works in FACE RECOGNITION PROJECT

Channel:
Subscribers:
108
Published on ● Video Link: https://www.youtube.com/watch?v=dZIInQv1C-4



Duration: 0:00
38 views
3


Calculate LBP code generated value for the central point in the
neighborhood of 8 pixels as shown below.
10 12 18
79 6
92 4

In this video, we'll dive deep into the *LBPH (Local Binary Patterns Histograms)* algorithm and explore how it powers face recognition technology. LBPH is a powerful yet simple technique that excels in facial recognition tasks, making it a popular choice for various applications, from security systems to photo tagging.

Timestamps:
00:00 - Introduction
01:30 - What is LBPH?
02:45 - How LBPH Captures Facial Features
04:20 - Training an LBPH Model
11:10 - Practical Examples of LBPH


Whether you're a beginner in computer vision or an experienced developer looking to enhance your projects, this video will provide valuable insights and hands-on knowledge.

šŸ”” *Don't forget to subscribe* to We Coderz for more tutorials on AI, computer vision, and Python programming!

Face Recognition: Understanding LBPH Algorithm

Today we gonna talk about one of the oldest (not the oldest one) and more popular face recognition algorithms:Ā Local Binary Patterns Histograms (LBPH).

Objective

The objective of this post is to explain theĀ LBPHĀ as simple as possible, showing the method step-by-step.

As it is one of the easier face recognition algorithms I think everyone can understand it without major difficulties.

Introduction

Local Binary PatternĀ (LBP) is a simple yet very efficient texture operator which labels the pixels of an image by thresholding the neighborhood of each pixel and considers the result as a binary
Step-by-Step

Now that we know a little more about face recognition and the LBPH, let’s go further and see the steps of the algorithm:

Parameters: the LBPH uses 4 parameters:

Radius: the radius is used to build the circular local binary pattern and represents the radius around the central pixel. It is usually set to 1.

Neighbors: the number of sample points to build the circular local binary pattern. Keep in mind: the more sample points you include, the higher the computational cost. It is usually set to 8.

Grid X: the number of cells in the horizontal direction. The more cells, the finer the grid, the higher the dimensionality of the resulting feature vector. It is usually set to 8.

Grid Y: the number of cells in the vertical direction. The more cells, the finer the grid, the higher the dimensionality of the resulting feature vector. It is usually set to 8.

Don’t worry about the parameters right now, you will understand them after reading the next steps.

2.Ā Training the Algorithm: First, we need to train the algorithm. To do so, we need to use a dataset with the facial images of the people we want to recognize. We need to also set an ID (it may be a number or the name of the person) for each image, so the algorithm will use this information to recognize an input image and give you an output. Images of the same person must have the same ID. With the training set already constructed, let’s see the LBPH computational steps.

3. Applying the LBP operation: The first computational step of the LBPH is to create an intermediate image that describes the original image in a better way, by highlighting the facial characteristics. To do so, the algorithm uses a concept of a sliding window, based on the parametersĀ radiusĀ andĀ neighbors.

understand it easily:

Suppose we have a facial image in grayscale.

We can get part of this image as a window of 3x3 pixels.

It can also be represented as a 3x3 matrix containing the intensity of each pixel (0~255).

Then, we need to take the central value of the matrix to be used as the threshold.

This value will be used to define the new values from the 8 neighbors.

For each neighbor of the central value (threshold), we set a new binary value. We set 1 for values equal or higher than the threshold and 0 for values lower than the threshold.

Now, the matrix will contain only binary values (ignoring the central value). We need to concatenate each binary value from each position from the matrix line by line into a new binary value (e.g. 10001101). Note: some authors use other approaches to concatenate the binary values (e.g. clockwise direction), but the final result will be the same.

Then, we convert this binary value to a decimal value and set it to the central value of the matrix, which is actually a pixel from the original image.

At the end of this procedure (LBP procedure), we have a new image which represents better the characteristics of the original image.

Note: The LBP procedure was expanded to use a different number of radius and neighbors, it is called Circular LBP.

4. Extracting the Histograms: Now, using the image generated in the last step, we can use theĀ Grid XĀ andĀ Grid YĀ parameters to divide the image into multiple grids, as can be seen in the following image:in video