A face recognition method based on optimal margin Bayesian classification model

By using the optimal spacing Bayesian classification model and local binary mode feature extraction in facial recognition, the accuracy problem of traditional methods under changes in lighting, posture and expression is solved, and more efficient face recognition performance is achieved.

CN117523642BActive Publication Date: 2024-11-22BEIJING INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311633669.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-01
Publication Date
2024-11-22
Estimated Expiration
2043-12-01

AI Technical Summary

Technical Problem

Traditional face recognition methods have problems of decreased accuracy when dealing with image complexity, lighting changes, posture changes and expression changes, especially due to the strong assumptions and category overlapping problems of feature independence by the naive Bayes classification model.

Method used

Using the face recognition method based on the optimal spacing Bayesian classification model, the face image is captured in real time through the Haar classifier, histogram equalization preprocessing is performed, local binary mode features are extracted, dimensionality reduction is reduced using principal component analysis, and multiple The target particle swarm algorithm optimizes the optimal spacing Bayesian classification model for identification.

Benefits of technology

It significantly improves the accuracy and robustness of face recognition, and can effectively recognize faces under different lighting, postures and expressions, improving security and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117523642B_ABST
    Figure CN117523642B_ABST
Patent Text Reader

Abstract

The present invention proposes a novel method of an optimal spacing Bayesian classification model for application in the field of face recognition. This face recognition method is different from the traditional naive Bayesian classification method. The core concept of the proposed optimal spacing Bayesian is to utilize the probabilistic inference ability of the naive Bayesian classification, while considering the optimal spacing metric between samples to solve the possible category overlap problem, so that the classifier can better distinguish categories. The method includes: first, using a camera to capture the target face in real time, and using histogram equalization to pre-process the image; then using a local binary pattern feature extraction method to extract facial features, and using PCA to perform dimensionality reduction processing; finally, using the proposed optimal spacing Bayesian classification model to classify the extracted features, thereby outputting the final face recognition result. Experimental results show that the method proposed by the present invention shows better performance in face recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of biometric identification, and in particular to a face recognition method based on an optimal spacing Bayesian classification model. Background Art

[0002] In today's digital age, biometrics is a revolutionary technology that has made great contributions to the security and convenience of human society. Biometric methods are unique because they rely on the uniqueness of individual biological features, such as identity authentication and recognition of face, fingerprint, iris, voice, etc. Face recognition, as a biometric solution, is popular for its excellent performance and wide application. However, traditional face recognition methods still have some challenges in dealing with image complexity, lighting changes, posture changes, and expression changes. Naive Bayes is widely used in face recognition, but the traditional naive Bayes classification model has some limitations. One of the main limitations is its strong assumption of feature independence, which means that the model assumes that all features are conditionally independent, while in actual applications, correlations between features may exist. At the same time, when dealing with complex data sets, you may encounter overlapping categories, resulting in a decrease in the accuracy of the classifier. Although there are some algorithms to solve the spacing problem between categories, there are still some potential defects and room for improvement in practical applications. Summary of the invention

[0003] The purpose of the present invention is to overcome the above technical shortcomings and deficiencies and provide a face recognition method based on an optimal spacing Bayesian classification model.

[0004] The technical solution adopted by the present invention is as follows:

[0005] A face recognition method based on an optimal spacing Bayesian classification model comprises the following steps:

[0006] Step 1: Capture facial images in real time through a camera or image acquisition device;

[0007] Step 2: Preprocess the captured face image and use histogram equalization technology to eliminate uneven lighting or other image quality issues;

[0008] Step 3: Use the local binary pattern (LBP) feature extraction method to extract the most representative and robust features in the face image;

[0009] Step 4: Use principal component analysis (PCA) technology to perform feature dimensionality reduction to reduce feature dimensions, improve computational efficiency, and retain the main feature information;

[0010] Step 5: Use the optimal spacing Bayesian classification model to train and identify the classification;

[0011] Step 6: Output face recognition results.

[0012] Step 1: Capture face images and use the Haar classifier to detect the face area in real time to capture face images in real time. The specific steps are as follows:

[0013] Step 1.1, calculate the Haar feature, using the difference and pixel of the adjacent rectangles at the specified position of the detection range;

[0014] Step 1.2: Accelerate the acquisition of Haar features and use integral images to speed up the calculation of Haar features:

[0015] O sum =I(A)+I(B)+I(C)+I(D)

[0016] Where O represents the detection window, A, B, C, and D represent the four vertices of the detection window, and I (x, y) represents the pixel value of the coordinate point;

[0017] Step 1.3: Normalize Haar eigenvalues ​​to make them have a uniform scale or range. The steps are as follows:

[0018] Step 1.3.1: Calculate the grayscale value and the sum of the squares of the grayscale values ​​in the image in the detection window:

[0019] sum=ΣI(x,y)

[0020] sq sum =ΣI 2 (x,y)

[0021] Step 1.3.2, calculate the average value:

[0022]

[0023] Step 1.3.3, normalization factor:

[0024]

[0025] Step 1.3.4, normalized eigenvalues:

[0026]

[0027] Finally, the normalized feature value is compared with the threshold;

[0028] Step 1.4: Use the AdaBoost algorithm to train and distinguish between faces and non-faces. The steps of AdaBoost algorithm training are as follows:

[0029] Step 1.4.1: Initialize sample weights. Give each sample an equal weight value;

[0030] Step 1.4.2, iteratively train multiple weak classifiers. Train a weak classifier to learn to classify data based on the current sample weights. Then, by calculating the error rate of the classifier on the weighted data set, adjust the sample weights, increase the weights of incorrectly classified samples, and reduce the weights of correctly classified samples. Finally, based on the classification accuracy of the weak classifier under the current weight, calculate its weight. This process is iterated continuously to generate multiple weak classifiers;

[0031] Step 1.4.3: Construct an integrated strong classifier. All weak classifiers are weighted and combined according to their weights to construct an integrated strong classifier.

[0032] Step 2: Preprocess the captured face image using histogram equalization technology. The steps are as follows:

[0033] Step 2.1: Convert the captured face image into a grayscale image and calculate the grayscale histogram:

[0034]

[0035] Among them, N γ is the number of pixels with grayscale γ, N is the total number of image pixels, and the grayscale value is γ i The frequency is P γ (γ i ) represents, and the gray level of the image is represented by k;

[0036] Step 2.2: Calculate the cumulative distribution function based on the grayscale histogram:

[0037]

[0038] Where n is the total number of pixels in the frame, k is the number of gray levels corresponding to the image, k = 0, 1, 2, ..., L-1. L is the total number of gray levels, n i is the number of pixels of the current gray level;

[0039] Step 2.3: Perform histogram equalization. For each pixel value, use the cumulative distribution function to map the pixel value of the original image to obtain the equalized pixel value.

[0040] Step 3: Use local binary pattern (LBP) to extract facial features. The specific steps are as follows:

[0041] Step 3.1: Calculate the LBP value for each pixel. For each pixel in the image, compare it with the surrounding pixels, compare the grayscale values ​​of the surrounding pixels with the grayscale value of the central pixel, and encode the result into a binary number. Finally, a binary number, i.e., the LBP code, can be obtained for each pixel.

[0042] Step 3.2: Calculate the LBP feature vector. By counting the LBP codes of all pixels, we can get an LBP feature vector.

[0043] Step 4: Use principal component analysis (PCA) technology to perform feature dimensionality reduction. The specific steps are as follows:

[0044] Step 4.1: Calculate the mean of the feature matrix and perform centralization:

[0045]

[0046] Where n is the number of samples, x j For each feature;

[0047] Step 4.2: Calculate the covariance matrix. Calculate the covariance matrix C for the standardized data matrix:

[0048]

[0049] Where n is the number of samples, X′ is the standardized data matrix;

[0050] Step 4.3: Calculate eigenvalues ​​and eigenvectors and select the number of principal components. Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues ​​and corresponding eigenvectors, and select the number of principal components k to be retained based on the size of the eigenvalues;

[0051] Step 4.4: Construct the projection matrix and data projection. Select the first k eigenvectors with the largest eigenvalues ​​to form the projection matrix W, and use the projection matrix W to project the standardized data matrix X′ into the new k-dimensional space:

[0052] X n =X′·W

[0053] Among them, X n is the data matrix in the new k-dimensional space.

[0054] Step 5: The optimal spacing Bayesian classification model consists of four steps. The specific steps are as follows:

[0055] Step 5.1, calculation of prior probability and conditional probability of Gaussian Naive Bayes:

[0056]

[0057] Among them, y i represents the category of the i-th data in the training data set, y represents the category label, n represents the number of samples in the training data, s represents the total number of categories, and x j represents the jth attribute, x ij is the jth attribute of the i-th sample, μj is the mean of the jth attribute, is the variance of the jth attribute;

[0058] Step 5.2: Define the fitness evaluation function. In the optimal distance Bayesian classification model, the proposed optimal distance metric and the accuracy of the training set are used as the fitness evaluation function. The optimal distance is defined as the difference between the joint probability of all samples of one class and all samples of another class:

[0059]

[0060] For multi-classification problems, a one-to-many strategy is used to build a multi-classification model;

[0061] Step 5.3: Optimal spacing Bayesian classification model training optimization. The multi-objective particle swarm algorithm is used to maximize the optimal spacing and the accuracy of the training set. Through iterative updates, the Pareto solution set is output, that is, multiple groups of attribute weight vectors are obtained. Cross-validation is used to evaluate the obtained multiple groups of attribute weights, and finally the optimal global attribute weight vector W is obtained;

[0062] Step 5.4: Use the attribute weight vector and class conditional probability to calculate the weighted posterior probability of each instance in each category, and finally predict the category to which the data belongs by maximizing the posterior probability:

[0063]

[0064] Among them, y represents the category label to which the data belongs, Y represents the set of all category labels in the training data set, n represents the number of all attributes in the data set, and w i Represents the weight given to the i-th attribute.

[0065] Step 6: Output face recognition results.

[0066] The optimal spacing Bayesian classification model is used to classify the target face, and the face with the highest probability is taken as the final recognition result.

[0067] Advantages and beneficial effects of the present invention

[0068] The present invention proposes a face recognition method based on an optimal spacing Bayesian classification model, which is based on a naive Bayesian classification model and takes into account the optimal spacing between samples. It can effectively increase the boundaries between different categories and improve the classifier's ability to accurately recognize different facial features. At the same time, the present invention can capture facial images under various conditions of expression, posture, and lighting changes, and uses histogram equalization technology to improve image quality. In terms of feature extraction, a local binary model is used to extract more robust and discriminative facial features, and PCA is used to avoid the dimensionality disaster. Finally, the optimal spacing Bayesian classification method is used for classification, which significantly improves the performance of face recognition classification and brings significant improvements in security, user experience, and other aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 It is an overall flow chart of the implementation of the face recognition method of the present invention;

[0070] Figure 2 It is the overall flow chart of the optimal spacing Bayesian classification model;

[0071] Figure 3 It is a flowchart of multi-objective particle swarm optimization attribute weights; DETAILED DESCRIPTION

[0072] The present invention is described in detail below with reference to the accompanying drawings and examples.

[0073] A face recognition method based on the optimal spacing Bayesian classification model, the overall implementation process is as follows Figure 1 As shown; the face image data of 8 people are collected in the present invention, each person has 26 images, and the optimal spacing Bayesian classification model is used for training and testing. The specific implementation plan includes the following contents and steps:

[0074] Step 1: Use the camera to capture facial images in real time. The captured images will be saved in the specified folder for subsequent facial feature extraction and training test model process;

[0075] Step 2: grayscale the acquired face image, and perform histogram equalization on the grayscale face image;

[0076] Step 3: Use the local binary pattern algorithm to extract facial features from the grayscale face image;

[0077] Step 4: Use principal component analysis technology to perform feature dimensionality reduction;

[0078] Step 5: Use the optimal spacing Bayesian classification model to train and identify face data. The specific flow chart is as follows: Figure 2 As shown in the figure, the multi-objective particle swarm optimization attribute weight process is as follows Figure 3 As shown;

[0079] Step 6: Output the face recognition results. Taking the recognition result of face image No. 8 as an example, the comparison results are as follows: the probability of being similar to face image No. 1 is 0, the probability of being similar to face image No. 2 is 0, the probability of being similar to face image No. 3 is 0, the probability of being similar to face image No. 4 is 0, the probability of being similar to face image No. 5 is 0, the probability of being similar to face image No. 6 is 0, the probability of being similar to face image No. 7 is 0, and the probability of being similar to face image No. 8 is 100%, so the final recognition result is image No. 8.

[0080] The optimal spacing Bayesian classification model proposed in the present invention was repeatedly tested using the UCI standard data set and compared with the traditional algorithm. Six data sets were selected: Inonosphere, Glass, Spambase, kr-vs-kp, Blood, and Rice. The experimental results are shown in Figure 1.

[0081] Table 1 Comparison of experimental results (classification accuracy)

[0082] KNN Traditional Bayesian Algorithm Optimal Margin Bayes Ionosphere 86.79% 83.81% 90.48% Glass 66.155 51.16% 76.92% Spambase 79.65% 80.94% 91.23% kr-vs-kp 63.98% 60.17% 73.93% Blood 72.00% 74.11% 80.00% Rice 88.45% 91.69% 92.40%

[0083] The optimal spacing Bayesian classification model proposed in this invention was repeatedly tested using the ORL face database and compared with other common face recognition methods. The ORL face database consists of face images of 40 people. The researchers collected face images of each person under different facial expressions, lighting conditions and other environments, and each person collected 10 photos under different environments. We conducted experiments on the ORL face database and compared it with algorithms such as EDLPP, LDENP, 2DJLNDA, OR-NMF, PCA+SVM, etc. The experimental results are shown in Figure 2.

[0084] Table 2 Experimental results of ORL face database

[0085]

[0086] The above description is only a preferred example of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the claims of the present invention.

Claims

1. A face recognition method based on the optimal spacing Bayesian classification model, It is characterized in that The following steps are involved: Step 1: Capture facial images in real time through a camera or image acquisition device; Step 2: Preprocess the captured face image and use histogram equalization technology to eliminate uneven lighting or other image quality issues; Step 3: Use the local binary pattern (LBP) feature extraction method to extract the most representative and robust features in the face image; Step 4: Use principal component analysis (PCA) technology to perform feature dimensionality reduction to reduce feature dimensions, improve computational efficiency, and retain the main feature information; Step 5: Use the optimal spacing Bayesian classification model to train and identify the classification. The specific steps are as follows: Step 5.1, calculation of prior probability and conditional probability of Gaussian Naive Bayes: Among them, y i represents the category of the i-th data in the training data set, y represents the category label, n represents the number of samples in the training data, s represents the total number of categories, and x j represents the jth attribute, x ij is the jth attribute of the i-th sample, μ j is the mean of the jth attribute, is the variance of the jth attribute; Step 5.2: Define the fitness evaluation function. In the optimal spacing Bayesian classification model, the proposed optimal spacing metric and the accuracy of the training set are used as the fitness evaluation function. The optimal spacing is defined as the difference between the joint probabilities of all samples of one class and all samples of another class: For multi-classification problems, a one-to-many strategy is used to build a multi-classification model; Step 5.3: Optimal spacing Bayesian classification model training optimization, using a multi-objective particle swarm algorithm to maximize the optimal spacing and the accuracy of the training set, outputting the Pareto solution set through iterative updates, that is, obtaining multiple sets of attribute weight vectors, using cross-validation to evaluate the obtained multiple sets of attribute weights, and finally obtaining the optimal global attribute weight vector W; Step 5.4: Use the attribute weight vector and class conditional probability to calculate the weighted posterior probability of each instance in each category, and finally predict the category to which the data belongs by maximizing the posterior probability: Among them, y represents the category label to which the data belongs, Y represents the set of all category labels in the training data set, n represents the number of all attributes in the data set, and w i represents the weight given to the i-th attribute; Step 6: Output face recognition results.

2. The face recognition method based on the optimal spacing Bayesian classification model according to claim 1, Features: As mentioned in step 1, the face image is captured in real time by the camera and the Haar classifier is used. The specific steps are as follows: Step 1.1, calculate the Haar feature, using the difference and pixel of the adjacent rectangles at the specified position of the detection range; Step 1.2: Accelerate the acquisition of Haar features and use integral images to speed up the calculation of Haar features: O sum =I(A)+I(B)+I(C)+I(D) Where O represents the detection window, A, B, C, and D represent the four vertices of the detection window, and I (x, y) represents the pixel value of the coordinate point; Step 1.3: Normalize the Haar eigenvalues ​​to make them have a uniform scale or range. The steps are as follows: Step 1.3.1: Calculate the grayscale value and the sum of the squares of the grayscale values ​​in the image in the detection window: sum=∑I(x,y) sq sum =ΣI 2 (x,y) Step 1.3.2, calculate the average value: Step 1.3.3, normalization factor: Step 1.3.4, normalized eigenvalues: Finally, the normalized feature value is compared with the threshold; Step 1.4: Use the AdaBoost algorithm to train and distinguish between faces and non-faces. The steps of AdaBoost algorithm training are as follows: Step 1.4.1: Initialize sample weights and assign equal weight values ​​to each sample; Step 1.4.2, iteratively train multiple weak classifiers, train a weak classifier, learn to classify data according to the current sample weight, then adjust the sample weight by calculating the error rate of the classifier on the weighted data set, increase the weight of the wrongly classified samples, and reduce the weight of the correctly classified samples. Finally, according to the classification accuracy of the weak classifier under the current weight, calculate its weight. This process is iterated continuously to generate multiple weak classifiers; Step 1.4.3: Build an integrated strong classifier. All weak classifiers are weighted and combined according to their weights to build an integrated strong classifier.

3. The face recognition method based on the optimal spacing Bayesian classification model according to claim 1, Features: The captured face image is preprocessed using the histogram equalization technique described in step 2. The specific steps are as follows: Step 2.1: Convert the captured face image into a grayscale image and calculate the grayscale histogram: Among them, N γ is the number of pixels with grayscale γ, N is the total number of image pixels, and the grayscale value is γ i The frequency is P γ (γi) represents, and the gray level of the image is represented by k; Step 2.2: Calculate the cumulative distribution function based on the grayscale histogram: Where n is the total number of pixels in the frame, k is the number of gray levels corresponding to the image, k = 0, 1, 2, ..., L-1, L is the total number of gray levels, n i is the number of pixels of the current gray level; Step 2.3: Perform histogram equalization. For each pixel value, use the cumulative distribution function to map the pixel value of the original image to obtain the equalized pixel value.

4. The face recognition method based on the optimal spacing Bayesian classification model according to claim 1, Features: The local binary pattern (LBP) is used to extract facial features in step 3. The specific steps are as follows: Step 3.1: Calculate the LBP value for each pixel. For each pixel in the image, compare it with the surrounding pixels, compare the grayscale values ​​of the surrounding pixels with the grayscale value of the central pixel, and encode the result into a binary number. Finally, a binary number, i.e., LBP code, can be obtained for each pixel. Step 3.2: Calculate the LBP feature vector. By counting the LBP codes of all pixels, an LBP feature vector can be obtained.

5. The face recognition method based on the optimal spacing Bayesian classification model according to claim 1, Features: The principal component analysis (PCA) technique described in step 4 is used to perform feature dimensionality reduction. The specific steps are as follows: Step 4.1: Calculate the mean of the feature matrix and perform centralization: Where n is the number of samples, x j For each feature; Step 4.2: Calculate the covariance matrix and find the covariance matrix C for the standardized data matrix: Where n is the number of samples, X' is the standardized data matrix; Step 4.3: Calculate the eigenvalues ​​and eigenvectors and select the number of principal components. Perform eigenvalue decomposition on the covariance matrix to obtain the eigenvalues ​​and corresponding eigenvectors. Select the number of principal components k to be retained based on the size of the eigenvalues. Step 4.4: Construct the projection matrix and data projection, select the first k eigenvectors with the largest eigenvalues ​​to form the projection matrix W, and use the projection matrix W to project the standardized data matrix X' into the new k-dimensional space: X n =X’·W Among them, X n is the data matrix in the new k-dimensional space.

6. The face recognition method based on the optimal spacing Bayesian classification model according to claim 1, Features: The method for outputting face recognition results described in step 6 is: using the optimal spacing Bayesian classification model to classify the target face, and taking the face with the highest probability as the final recognition result.