A face recognition method based on data analysis
By dividing the face image into rectangular detection areas, calculating the grayscale value and feature change value, and generating feature vectors for similarity calculation, it solves the problem of high computational complexity in large-scale face recognition, and achieves efficient and real-time face recognition.
Patent Information
- Application Number
- CN202510670741.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-23
AI Technical Summary
The existing deep learning-based face recognition algorithm has high computational complexity when recognizing large-scale crowds, which cannot meet real-time requirements, resulting in slow recognition speed.
By dividing the face image into a rectangular detection area, calculating the grayscale value mean and feature change value of the feature area, generating target points and establishing a two-dimensional coordinate system, and calculating the comprehensive similarity based on the feature vector for identification.
The calculation process is simplified, the processing volume is reduced, the recognition efficiency and real-time are improved, and the robustness is enhanced for complex scenes and expression changes.
Smart Images

Figure CN120198951B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of face recognition, and in particular to a face recognition method based on data analysis. Background Art
[0002] Facial recognition technology is a biometric technology that identifies people based on their facial features. It uses a camera or camcorder to capture images or video streams containing faces, automatically detects and tracks faces in the images, and then performs a series of facial-related technical processing on the detected faces.
[0003] First, face detection is required. Face detection is the first step in face recognition. The system searches for the location of a face in the input image. This process involves using a specific algorithm to identify the facial area in the image, ignoring other non-face elements. Then, through face alignment technology, the position of key feature points such as the eyes, nose, and mouth in the image is kept consistent, thereby reducing the difficulty of subsequent recognition. The system then extracts key facial features, such as the shape and positional relationship of the eyes, nose, and mouth, and converts these features into mathematical vector representations to form feature templates. These vectors can capture the unique attributes of the face, such as shape, size, skin color, etc. The extracted feature templates are matched and compared with known facial features in the database to determine whether the identity matches. Common methods include calculating the cosine similarity between vectors.
[0004] In existing technologies, certain application scenarios, such as access control systems and real-time monitoring, require facial image recognition systems to quickly respond and identify faces. However, some existing recognition algorithms, especially those based on deep learning, have high accuracy but relatively high computational complexity, resulting in recognition speeds that may not meet real-time requirements. For real-time recognition of large crowds, such as monitoring large events or public places, recognition speed becomes an even greater challenge. When processing large-scale facial datasets, the amount of computation increases dramatically, resulting in low computational efficiency and an inability to meet real-time requirements. Therefore, in order to reduce the amount of computation and computational complexity, it is necessary to design a face recognition method based on data analysis to reduce the computation time of facial images, thereby enhancing the real-time performance of face recognition. Summary of the Invention
[0005] The purpose of the present invention is to provide a face recognition method based on data analysis to solve the above technical problems.
[0006] The purpose of the present invention can be achieved through the following technical solutions:
[0007] A face recognition method based on data analysis includes the following steps:
[0008] S1: Obtain a facial image and divide the facial image into several detection areas. The detection areas are The rectangle L is the preset length. The facial features and cheeks in the facial image are recorded as the feature area. The grayscale value W of the pixel points in the feature area is obtained and the mean grayscale value W is calculated. ave , calculate the characteristic value of the pixel point in the feature area , where the scaling factor λ=W ave / W sta , W sta are preset standard values, R is the value of the red channel of the pixel, G is the value of the green channel of the pixel, and B is the value of the blue channel of the pixel;
[0009] S2: The mean value D of the characteristic values in the characteristic area ave As the second eigenvalue T, calculate the feature change value of the feature area in the i-th row and j-th column , where T i,j is the second feature value of the feature area in the i-th row and j-th column. If the feature change value is greater than the preset judgment value T sta , then the corresponding feature area is recorded as the target area;
[0010] S3: Establish a two-dimensional coordinate system and generate a target point A(x, y) corresponding to the target area, where the horizontal coordinate x is the column number of the target area and the vertical coordinate y is the row number of the target area;
[0011] Sort the target points in descending order of the vertical coordinate y, obtain two adjacent target points i and target point i+1 in the sort, connect target point i and target point i+1 to obtain a feature vector, and the feature vector points from target point i to target point i+1. Calculate the comprehensive similarity X based on the face images and feature vectors in the database, and select the face image with the largest comprehensive similarity X as the recognition object.
[0012] As a further solution of the present invention: in the step S1, the number N of pixels in the detection area is obtained, and it is ensured that the number of pixels N is greater than or equal to 4 and N is less than or equal to 16.
[0013] As a further solution of the present invention, in the step S1, the number of bytes used to represent the pixel is obtained. If the number of bytes Byte≠3, the ratio K=3 / Byte is calculated, and the formula for calculating the characteristic value D of the pixel in the characteristic area is replaced by .
[0014] As a further solution of the present invention: in step S2, if the number of target areas is less than the preset minimum number M min , then stop the subsequent steps.
[0015] As a further solution of the present invention: in the step S1, the contrast of the facial image of the human face is adjusted to a preset standard contrast.
[0016] As a further solution of the present invention: in the step S3, if there are target points with the same ordinate y, the target point with a larger abscissa x is placed in a front position.
[0017] As a further solution of the present invention: in step S3, the step of calculating the comprehensive similarity X based on the face image and feature vector in the database specifically includes:
[0018] Get target point A n-1 and target point A n The corresponding eigenvector A n-1,n , calculate the comprehensive similarity , where M represents the number of eigenvectors, Represents the feature vector corresponding to the face image stored in the database.
[0019] As a further solution of the present invention: in the step S3, if the maximum value of the comprehensive similarity X is less than 60%, the facial image of the face does not exist in the database, and it is suggested that the face is an outsider.
[0020] Beneficial Effects of the Present Invention: In the present invention, a facial image is first obtained as a reference. Because facial images contain a large number of pixels, processing each pixel individually would consume a significant amount of time and computing resources, reducing processing efficiency. Therefore, to simplify the operational process and improve computing efficiency, the facial image is divided into a number of rectangular areas of specified sizes.
[0021] Treating these rectangular regions as independent processing units reduces the amount of data required. Specifically, instead of processing all pixels in the entire image, only pixels within the divided rectangular regions need to be processed. The facial features and cheeks are crucial for distinguishing faces. This approach not only simplifies the process but also significantly reduces processing effort and increases speed.
[0022] Furthermore, when processing pixels, they contain three primary colors: red, blue, and green. If these three colors were processed separately, each would need to be processed separately, significantly increasing the amount of computation. To further reduce this computational complexity, converting all three colors into eigenvalues for processing simplifies the operation.
[0023] To more comprehensively extract facial features and improve identification accuracy, the mean of the eigenvalues is used as the eigenvalue for the entire detection area. This approach not only better captures the overall concept but also effectively reduces interference caused by overly trivial local details. Furthermore, when dividing the detection area, attention should be paid to the size of the detection area. If the detection area is too large, the calculated mean eigenvalue may not accurately reflect the specific features within that area. Conversely, if the detection area is too small, the mean eigenvalue may be affected by noise and fail to represent the true characteristics of the entire detection area.
[0024] After determining the appropriate detection area size, the next step is to calculate the feature change values of these detection areas. The feature change value here refers to the grayscale value difference between the current detection area and its surrounding detection areas. This effectively screens out detection areas with excessively large feature change values and marks them as target areas. These selected target areas are actually those parts of the facial image that have significantly changed compared to the surrounding areas. They often contain rich identity information and therefore serve as an important basis for determining the specific identity of the subject to be identified. This method, combining the feature value mean and feature change value, not only enables more accurate feature extraction of facial images but also effectively improves the accuracy of identity recognition.
[0025] After the target areas are screened, a two-dimensional coordinate system is established, and corresponding target points are generated for each target area. The core of this step is to convert the target area, which has an area, into a specific point, simplifying subsequent operations and calculations. The target area's column is used as the horizontal coordinate (x-axis), and the row as the vertical coordinate (y-axis), accurately calibrating the position of each target point in the two-dimensional coordinate system. This conversion not only makes the data presentation more intuitive and concise, but also greatly simplifies the subsequent calculation process.
[0026] Next, the generated target points are sorted according to the size of their ordinates (y-values). This ensures that the overall direction remains consistent when subsequently generating feature vectors, avoiding calculation errors caused by a mismatch in the order of feature points. This orderly arrangement allows for more efficient generation and comparison of feature vectors—a key step in face recognition. The feature vectors formed by these target points actually contain all the key information about the entire face, especially those points that are unique. Together, they form a vector in a high-dimensional space that not only represents a person's facial features but can also be used for comparison with other facial images. By calculating the similarity between different feature vectors, the facial image that most resembles the person to be identified can be found.
[0027] To ensure recognition accuracy, a comprehensive similarity is calculated. This factor takes into account the contributions of all target points and evaluates similarity by comparing the distances or angles between them. Ultimately, the face image with the maximum comprehensive similarity is selected as the recognized object. This approach not only improves recognition accuracy but also enhances the system's robustness to complex scenarios and changes in facial expressions.
[0028] In summary, the present invention designs a face recognition method based on data analysis to improve the efficiency of face recognition. Face recognition is performed by performing a series of simplifications and calculations on the facial image of the face, which reduces a large amount of complex calculations, improves recognition efficiency, and enhances the real-time performance of face recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The present invention will be further described below with reference to the accompanying drawings.
[0030] Figure 1 It is a flow chart of a face recognition method based on data analysis of the present invention. DETAILED DESCRIPTION
[0031] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0032] See also Figure 1 As shown, the present invention is a face recognition method based on data analysis, comprising the following steps:
[0033] S1: Obtain a facial image and divide the facial image into several detection areas. The detection areas are The rectangle L is the preset length. The facial features and cheeks in the facial image are recorded as the feature area. The grayscale value W of the pixel points in the feature area is obtained and the mean grayscale value W is calculated. ave , calculate the characteristic value of the pixel point in the feature area , where the scaling factor λ=W ave / W sta , W sta are preset standard values, R is the value of the red channel of the pixel, G is the value of the green channel of the pixel, and B is the value of the blue channel of the pixel;
[0034] S2: The mean value D of the characteristic values in the characteristic area ave As the second eigenvalue T, calculate the feature change value of the feature area in the i-th row and j-th column , where T i,jis the second feature value of the feature area in the i-th row and j-th column. If the feature change value is greater than the preset judgment value T sta , then the corresponding feature area is recorded as the target area;
[0035] S3: Establish a two-dimensional coordinate system and generate a target point A(x, y) corresponding to the target area, where the horizontal coordinate x is the column number of the target area and the vertical coordinate y is the row number of the target area;
[0036] Sort the target points in descending order of the vertical coordinate y, obtain two adjacent target points i and target point i+1 in the sort, connect target point i and target point i+1 to obtain a feature vector, and the feature vector points from target point i to target point i+1. Calculate the comprehensive similarity X based on the face images and feature vectors in the database, and select the face image with the largest comprehensive similarity X as the recognition object.
[0037] It's important to note that we first need to obtain a facial image as a reference. Because facial images contain a large number of pixels, processing each pixel individually would consume a significant amount of time and computing power, reducing processing efficiency. Therefore, to simplify the process and improve computational efficiency, we divide the facial image into several rectangular regions of specified sizes.
[0038] Treating these rectangular regions as independent processing units reduces the amount of data required. Specifically, instead of processing all pixels in the entire image, only pixels within the divided rectangular regions need to be processed. The facial features and cheeks are crucial for distinguishing faces. This approach not only simplifies the process but also significantly reduces processing effort and increases speed.
[0039] Furthermore, when processing pixels, they contain three primary colors: red, blue, and green. If these three colors were processed separately, each would need to be processed separately, significantly increasing the amount of computation. To further reduce this computational complexity, converting all three colors into eigenvalues for processing simplifies the operation.
[0040] To more comprehensively extract facial features and improve identification accuracy, the mean of the eigenvalues is used as the eigenvalue for the entire detection area. This approach not only better captures the overall concept but also effectively reduces interference caused by overly trivial local details. Furthermore, when dividing the detection area, attention should be paid to the size of the detection area. If the detection area is too large, the calculated mean eigenvalue may not accurately reflect the specific features within that area. Conversely, if the detection area is too small, the mean eigenvalue may be affected by noise and fail to represent the true characteristics of the entire detection area.
[0041] After determining the appropriate detection area size, the next step is to calculate the feature change values of these detection areas. The feature change value here refers to the grayscale value difference between the current detection area and its surrounding detection areas. This effectively screens out detection areas with excessively large feature change values and marks them as target areas. These selected target areas are actually those parts of the facial image that have significantly changed compared to the surrounding areas. They often contain rich identity information and therefore serve as an important basis for determining the specific identity of the subject to be identified. This method, combining the feature value mean and feature change value, not only enables more accurate feature extraction of facial images but also effectively improves the accuracy of identity recognition.
[0042] After the target areas are screened, a two-dimensional coordinate system is established, and corresponding target points are generated for each target area. The core of this step is to convert the target area, which has an area, into a specific point, simplifying subsequent operations and calculations. The target area's column is used as the horizontal coordinate (x-axis), and the row as the vertical coordinate (y-axis), accurately calibrating the position of each target point in the two-dimensional coordinate system. This conversion not only makes the data presentation more intuitive and concise, but also greatly simplifies the subsequent calculation process.
[0043] Next, the generated target points are sorted according to the size of their ordinates (y-values). This ensures that the overall direction remains consistent when subsequently generating feature vectors, avoiding calculation errors caused by a mismatch in the order of feature points. This orderly arrangement allows for more efficient generation and comparison of feature vectors—a key step in face recognition. The feature vectors formed by these target points actually contain all the key information about the entire face, especially those points that are unique. Together, they form a vector in a high-dimensional space that not only represents a person's facial features but can also be used for comparison with other facial images. By calculating the similarity between different feature vectors, the facial image that most resembles the person to be identified can be found.
[0044] To ensure recognition accuracy, a comprehensive similarity is calculated. This factor takes into account the contributions of all target points and evaluates similarity by comparing the distances or angles between them. Ultimately, the face image with the maximum comprehensive similarity is selected as the recognized object. This approach not only improves recognition accuracy but also enhances the system's robustness to complex scenarios and changes in facial expressions.
[0045] In another preferred embodiment of the present invention, the number N of pixels in the detection area is obtained, ensuring that the number N of pixels is greater than or equal to 4 and less than or equal to 16.
[0046] It is worth noting that when dividing the detection area, it is necessary to pay attention to the size of the detection area. If the detection area is divided too large, the calculated grayscale value mean may not reflect the specific characteristics of the area in detail; conversely, if the detection area is divided too small, the grayscale value mean may be affected by noise and cannot represent the true characteristics of the entire detection area.
[0047] In another preferred embodiment of the present invention, the number of bytes used to represent the pixel is obtained. If the number of bytes Byte≠3, the ratio K=3 / Byte is calculated, and the formula for calculating the characteristic value D of the pixel in the characteristic area is replaced by .
[0048] Understandably, in practice, not all systems use the same number of bytes to represent the three primary colors. Different systems or devices may choose different ways to represent color information for various reasons, such as display accuracy, storage space, and processing power. This means that color representation may be more refined on some systems, while it may be relatively coarse on others.
[0049] This discrepancy can pose significant challenges for subsequent image processing or computational tasks. To ensure the accuracy of the final result, the color information in these different representations must be adjusted. Specifically, the intensities of the three primary colors (red, green, and blue) must be proportionally converted.
[0050] The purpose of scaling is to quantize and compare colors using a unified standard, regardless of the number of bytes used by the original system to represent color. This not only improves the accuracy of subsequent calculations but also ensures color consistency and accuracy when exchanging color information between different systems or devices.
[0051] By using proportional conversion, color information from different representations can be converted into a universal format, allowing subsequent image processing or computing tasks to be performed on a unified basis. This not only improves calculation accuracy but also greatly simplifies the image processing process across platforms and devices, bringing great convenience to our work and life.
[0052] In another preferred embodiment of the present invention, if the number of target areas is less than the preset minimum number M min , then stop the subsequent steps.
[0053] It should be noted that when performing the steps of feature area screening and processing, a key parameter is set - the preset minimum number M minThis parameter represents the minimum number of target areas required for effective face recognition or image analysis. Its significance is that if the number of target areas is less than this preset value, it means that the current image may lack sufficient information for accurate recognition or analysis.
[0054] Specifically, if the number of available target areas obtained after a series of preprocessing and feature extraction steps is less than M min This usually indicates that the image quality is poor, the amount of information it contains is insufficient, or it is difficult to extract sufficient features from the facial area in the image due to various reasons (such as angle, lighting, occlusion, etc.). In this case, even if we continue to perform subsequent calculation and analysis steps, it is difficult to obtain reliable and accurate results.
[0055] Therefore, in order to ensure the accuracy and effectiveness of recognition or analysis, a conservative strategy is adopted: once the number of feature areas is less than the preset minimum number M min , immediately stop the subsequent steps. This not only avoids unnecessary waste of computing resources, but also promptly reminds users or system administrators to check image quality and take appropriate measures (such as adjusting the shooting angle, improving lighting conditions, reducing obstructions, etc.) to obtain better image data, thereby improving the success rate of recognition or analysis.
[0056] In another preferred embodiment of the present invention, the contrast of the facial image of the human face is adjusted to a preset standard contrast.
[0057] It's important to note that to ensure the accuracy and consistency of face recognition or image analysis, we need to preprocess the input facial images. This involves adjusting the image's contrast to a preset standard. This step is crucial because it helps reduce the impact of irrelevant variables on the accuracy of the results, making the subsequent feature extraction and recognition processes more robust and reliable.
[0058] In another preferred embodiment of the present invention, if there are target points with the same ordinate y, the target point with a larger abscissa x is placed in a front position.
[0059] It is understandable that a coping method for a special case is proposed to enhance the anti-interference capability of the present invention.
[0060] In another preferred embodiment of the present invention, the step of calculating the comprehensive similarity X based on the facial images and feature vectors in the database specifically includes:
[0061] Get target point A n-1 and target point A n The corresponding eigenvector A n-1,n , calculate the comprehensive similarity , where M represents the number of eigenvectors, Represents the feature vector corresponding to the face image stored in the database.
[0062] In another preferred embodiment of the present invention, if the maximum value of the comprehensive similarity X is less than 60%, the facial image of the face does not exist in the database, indicating that the face is an outsider.
[0063] It's worth noting that in face recognition systems, the comprehensive similarity X is a key indicator for measuring the degree of match between the face being recognized and the facial images stored in the database. When the comprehensive similarity X is less than 60%, this threshold is set as a critical cutoff point, used to determine whether the facial image of the face in question is likely to exist in the database.
[0064] Specifically, if the calculated overall similarity X is less than 60%, the system will determine that the currently compared facial image is not sufficiently similar to any facial image in the database. This situation generally indicates two possibilities: either the currently captured face does not belong to any known individual in the database, possibly an outsider; or the quality of the facial image acquisition has been reduced due to certain external factors (such as lighting, angle, occlusion, etc.), thus affecting the accuracy of the similarity.
[0065] The solutions described in this invention are intended for use in legal situations. The data generated during the facial recognition process involves user privacy, and any unauthorized access, disclosure, or commercial abuse is strictly prohibited.
[0066] The above is a detailed description of an embodiment of the present invention. However, the content is only a preferred embodiment of the present invention and should not be considered to limit the scope of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the present invention.
Claims
1. A face recognition method based on data analysis, characterized in that: The following steps are involved: S1: Obtain a facial image and divide the facial image into several detection areas. The detection areas are The rectangle L is the preset length. The facial features and cheeks in the facial image are recorded as the feature area. The grayscale value W of the pixel points in the feature area is obtained and the mean grayscale value W is calculated. ave , calculate the characteristic value of the pixel point in the feature area , where the scaling factor λ=W ave / W sta , W sta are preset standard values, R is the value of the red channel of the pixel, G is the value of the green channel of the pixel, and B is the value of the blue channel of the pixel; S2: The mean value D of the characteristic values in the characteristic area ave As the second eigenvalue T, calculate the feature change value of the feature area in the i-th row and j-th column , where T i,j is the second feature value of the feature area in the i-th row and j-th column. If the feature change value is greater than the preset judgment value T sta , then the corresponding feature area is recorded as the target area; S3: Establish a two-dimensional coordinate system and generate a target point A(x, y) corresponding to the target area, where the horizontal coordinate x is the column number of the target area and the vertical coordinate y is the row number of the target area; The target points are sorted in descending order according to the vertical coordinate y, and two adjacent target points i and i+1 are obtained in the sorting. The target points i and i+1 are connected to obtain a feature vector, and the feature vector points from the target point i to the target point i+1. The steps of calculating the comprehensive similarity X based on the face images in the database and the feature vectors include: Get target point A n-1 and target point A n The corresponding eigenvector A n-1,n , calculate the comprehensive similarity , where M represents the number of eigenvectors, Represents the feature vector corresponding to the face image stored in the database, and the face image with the largest comprehensive similarity X is taken as the recognition object.
2. The face recognition method based on data analysis according to claim 1, characterized in that: In the step S1, the number N of pixels in the detection area is obtained, and it is ensured that the number of pixels N is greater than or equal to 4 and less than or equal to 16.
3. The face recognition method based on data analysis according to claim 1, characterized in that: In the step S1, the number of bytes used to represent the pixel is obtained. If the number of bytes Byte≠3, the ratio K=3 / Byte is calculated, and the formula for calculating the characteristic value D of the pixel in the characteristic area is replaced by .
4. The face recognition method based on data analysis according to claim 1, characterized in that: In step S2, if the number of target areas is less than the preset minimum number M min , then stop the subsequent steps.
5. The face recognition method based on data analysis according to claim 1, characterized in that: In step S1, the contrast of the facial image of the human face is adjusted to a preset standard contrast.
6. The face recognition method based on data analysis according to claim 1, characterized in that: In step S3, if there are target points with the same ordinate y, the target point with a larger abscissa x is positioned closer to the front.
7. The face recognition method based on data analysis according to claim 1, characterized in that: In step S3, if the maximum value of the comprehensive similarity X is less than 60%, the facial image of the face does not exist in the database, indicating that the face is an outsider.
Citation Information
Patent Citations
Rapid picture correction method realized based on classical statistical method
CN115272120A
Intelligent elevator behavior recognition method based on artificial intelligence
CN117935125A