A face recognition method and system based on TensorFlow network
Through the face recognition method based on the TensorFlow network, through preprocessing and occlusion area labeling, and combining the overall features and key feature maps for similarity calculation, the problem of low face recognition accuracy in occlusion areas is solved, achieving higher recognition accuracy and security.
Patent Information
- Application Number
- CN202410189368.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-20
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-02-20
AI Technical Summary
In the prior art, occlusion areas have a significant impact on the accuracy of face recognition, resulting in low face recognition accuracy.
A face recognition method based on the TensorFlow network is adopted. By preprocessing the collected face images, identifying and labeling the occluded areas, a convolutional neural network model is constructed to extract facial features. The similarity is calculated by combining the overall feature map, key feature map and occluded area map, and the recognition result is judged using the similarity factor.
The accuracy and security of face recognition are improved. Through multi-dimensional feature fusion and occlusion area processing, the effectiveness and accuracy of recognition are enhanced, and the impact of occlusion areas on recognition is solved.
Smart Images

Figure CN118334721B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of biometric recognition technology, and in particular to a face recognition method and system based on a TensorFlow network. Background Art
[0002] Biometrics is a technology that uses computers to identify individuals using inherent physiological characteristics (fingerprints, irises, facial features, DNA, etc.) or behavioral traits (gait, typing habits, etc.). Accurately verifying a person's identity while effectively protecting personal information is a critical societal challenge facing biometrics. In recent years, facial recognition, as the most important and oldest branch of biometrics, has seen tremendous application in various aspects of life, including intelligent facial image retrieval and intelligent human-computer interaction systems.
[0003] Face recognition involves locating and detecting key points on a face. Within the realm of machine learning, facial key point detection technology holds unique application value. It's a crucial step in face recognition and analysis, serving as a prerequisite and breakthrough for other face-related problems, such as automatic face recognition, expression analysis, 3D face reconstruction, and 3D animation.
[0004] At present, facial key point detection refers to locating the key areas of the face, including eyebrows, eyes, nose, mouth, etc., given a face image. Due to factors such as occlusion, the information that can be used to identify the face will be greatly reduced, and the accuracy of face recognition based on key areas will be greatly reduced, resulting in low face recognition accuracy. Summary of the Invention
[0005] In view of the shortcomings of the existing technology, the purpose of the present invention is to provide a face recognition method and system based on TensorFlow network, aiming to solve the technical problem in the existing technology that the influence of occluded areas leads to low face recognition accuracy.
[0006] An aspect of the present invention is to provide a face recognition method based on a TensorFlow network, the face recognition method based on a TensorFlow network comprising:
[0007] Collecting a face image, pre-processing the collected image, and obtaining a face image of a preset size;
[0008] Identifying the occluded area of the face image and marking the occluded area;
[0009] A convolutional neural network model constructed based on TensorFlow is trained on the facial image to extract facial features;
[0010] Inputting the facial features into a feature classifier to obtain a facial plane feature map of the facial position, wherein the facial plane feature map includes an overall facial feature map, each key feature map, and an occlusion area map;
[0011] Calculate the similarity between the overall facial feature map and each key feature map and the trained convolutional neural network model to obtain an initial similarity;
[0012] Calculating based on the overall facial feature map, the key feature maps, and the occlusion area map to obtain a similarity factor;
[0013] Based on the initial similarity and the similarity factor, similarity is calculated, and it is determined whether the similarity exceeds a threshold to obtain a recognition result.
[0014] Compared with the prior art, the beneficial effects of the present invention are: a face recognition method based on TensorFlow network provided by the present invention can effectively improve the accuracy of face recognition, specifically, collect a face image, pre-process the collected image, and obtain a face image of a preset size; the pre-processing can effectively reduce recognition errors and improve recognition accuracy; the occluded area of the face image is identified and the occluded area is marked; so as to facilitate the identification of the occluded area, reduce the recognition time and improve the recognition accuracy; a convolutional neural network model constructed based on TensorFlow is used to train the face image and extract face features; the face features are input into a feature classifier to obtain a face plane feature map of the face position, and the face plane feature map includes the overall face features The invention discloses a method for detecting the facial features of a human face, a facial contour, a facial feature map, a facial key feature map and an occlusion area map; performing similarity calculation on the facial overall feature map and the facial key feature map with the trained convolutional neural network model to obtain an initial similarity; combining the overall contour and the key features for recognition to realize multi-dimensional facial feature fusion and enhance the accuracy of face recognition; calculating based on the facial overall feature map, the key feature maps and the occlusion area map to obtain a similarity factor, realize the expression of fused occlusion area and key features, improve the effectiveness of face recognition, improve the security of face recognition, and thus improve the accuracy of recognition; calculating based on the initial similarity and the similarity factor to obtain the similarity, and judging whether the similarity exceeds a threshold to obtain a recognition result, thereby solving the technical problem that the influence of the ubiquitous occlusion area leads to low face recognition accuracy.
[0015] According to one aspect of the above technical solution, the step of calculating the similarity between the overall facial feature map and each key feature map and the trained convolutional neural network model to obtain the initial similarity specifically includes:
[0016] The contour similarity between the contour of the overall facial feature map and the contour of the trained convolutional neural network model is calculated. The calculation formula of the contour similarity is:
[0017]
[0018] Among them, H ni is the contour of the ith position of the face overall feature map in the nth face plane feature map; H oi is the contour of the i-th position of the overall face feature map in the o-th trained convolutional neural network model; i = 1,...,x; S L is the contour similarity;
[0019] The feature similarity between each key feature graph and the key feature graph of the trained convolutional neural network model is calculated. The calculation formula of the feature similarity is:
[0020]
[0021] Among them, S Gz is the key feature similarity of the zth key feature graph; W z is the weight of the z-th key feature map; z=1,...,y; S G is the feature similarity;
[0022] An initial similarity is calculated based on the contour similarity and the feature similarity.
[0023] According to one aspect of the above technical solution, the calculation formula for the key feature similarity is:
[0024]
[0025] Among them, S Gz is the key feature similarity of the zth key feature graph; T na is the position feature of the zth key feature map in the nth face plane feature map; T oza is the position feature of the zth key feature map in the oth trained convolutional neural network model; a=1,...,y.
[0026] According to one aspect of the above technical solution, the calculation formula of the initial similarity is:
[0027] S=(1-S L )×S G ,
[0028] Among them, S is the initial similarity, S G is the feature similarity, S L Contour similarity.
[0029] According to one aspect of the above technical solution, the step of obtaining a similarity factor based on the calculation of the overall facial feature map, the key feature maps, and the occlusion area map specifically includes:
[0030] Calculating the areas of the occlusion region map and the overall facial feature map, and calculating the area ratio of the occlusion region map to the overall facial feature map, and determining whether the area ratio exceeds a preset area ratio;
[0031] If yes, judging the validity of the facial image based on the number and position of each key feature map;
[0032] If not, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps.
[0033] According to one aspect of the above technical solution, the similarity factor calculation formula is:
[0034]
[0035] Among them, m is the area ratio, B is the similarity factor, z is the number of key feature maps, and f is the number of key feature maps in the trained convolutional neural network model.
[0036] According to one aspect of the above technology, the step of determining the validity of the facial image based on the number and position of each key feature map specifically includes:
[0037] Obtaining the number of positions of each key feature graph on the coordinates of the key point, and determining whether the number exceeds a preset number;
[0038] If yes, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps;
[0039] If not, the facial image is marked as invalid and needs to be re-acquired.
[0040] According to one aspect of the above technology, the steps of calculating the similarity based on the initial similarity and the similarity factor, and determining whether the similarity exceeds a threshold to obtain a recognition result, specifically include:
[0041] Based on the initial similarity and the similarity factor, the similarity is calculated. The calculation formula of the similarity is:
[0042] C=B×S,
[0043] Among them, C is the similarity, B is the similarity factor, and S is the initial similarity;
[0044] Determining whether the similarity exceeds a threshold;
[0045] If yes, the recognition is successful;
[0046] If not, the recognition fails.
[0047] According to one aspect of the above technology, the steps of constructing the convolutional neural network model specifically include:
[0048] Build an initial convolutional neural network model based on the TensorFlow deep learning framework;
[0049] The long short-term memory neural network is integrated into the initial convolutional neural network model, and learning and training are performed to form a convolutional neural network model.
[0050] Another aspect of the present invention is to provide a face recognition system based on a TensorFlow network, which is implemented using the above-mentioned face recognition method based on a TensorFlow network. The face recognition system based on a TensorFlow network includes:
[0051] An image acquisition module is used to acquire facial images and pre-process the acquired images to obtain facial images of a preset size;
[0052] An image marking module, configured to identify and mark the occluded area of the face image;
[0053] A feature extraction module is used to train a convolutional neural network model constructed based on TensorFlow and extract facial features from the facial image;
[0054] A feature classification module, configured to input the facial features into a feature classifier to obtain a face plane feature map of the face position, wherein the face plane feature map includes an overall face feature map, each key feature map, and an occlusion area map;
[0055] A data calculation module is used to calculate the similarity between the overall facial feature map and each key feature map and the trained convolutional neural network model to obtain an initial similarity;
[0056] A factor calculation module, configured to obtain a similarity factor based on the overall facial feature map, the key feature maps, and the occlusion region map;
[0057] The recognition and determination module is configured to calculate the similarity based on the initial similarity and the similarity factor, and determine whether the similarity exceeds a threshold value to obtain a recognition result. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments with reference to the accompanying drawings, in which:
[0059] Figure 1 Flowchart of the face recognition method based on TensorFlow network in the first embodiment of the present invention;
[0060] Figure 2 4 is a structural block diagram of a face recognition system based on a TensorFlow network in a third embodiment of the present invention;
[0061] Component symbol description in the attached figure:
[0062] Image acquisition module 100, image labeling module 200, feature classification extraction module 300, feature classification module 400, data calculation module 500, factor calculation module 600, recognition and determination module 700. DETAILED DESCRIPTION
[0063] To make the objectives, features, and advantages of the present invention more readily apparent, the following detailed description of specific embodiments of the present invention is provided in conjunction with the accompanying drawings. The accompanying drawings illustrate several embodiments of the present invention. However, the present invention may be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and comprehensive understanding of the present invention.
[0064] Example 1
[0065] See also Figure 1 , which shows a face recognition method based on a TensorFlow network provided by a first embodiment of the present invention, the method includes steps S10-S16:
[0066] Step S10, collecting an image of a human face, and pre-processing the collected image to obtain a human face image of a preset size;
[0067] In order to improve the accuracy of face recognition, it is necessary to preprocess the face image to reduce recognition errors.
[0068] Specifically, the image of the human face is located, the image of only the human face is captured, and then the image is grayscaled. Since the images are all in color, each pixel is determined by the three values of the RGB channels. Therefore, to process the image, the three channels need to be converted in sequence, which will increase the complexity and efficiency of the system calculation. Therefore, in order to improve the calculation efficiency, the image needs to be grayscaled so that each pixel of the image has a value to determine it.
[0069] Among them, the grayscale processing is calculated using the weighted average method, and each channel is weighted and averaged inversely with different weights to make the grayscale image more reasonable.
[0070] The calculation formula is: D(j, k) = 0.30R(j, k) + 0.59G(j, k) + 011B(j, k),
[0071] D(j, k) is the grayscale value of the pixel with coordinates (j, k), R(j, k) is the red value of the pixel with coordinates (j, k), G(j, k) is the green value of the pixel with coordinates (j, k), and B(j, k) is the blue value of the pixel with coordinates (j, k).
[0072] In addition, in order to reduce the influence of environmental factors such as lighting, which may cause inconsistency in image clarity and contrast, it is necessary to equalize the image, adjust the image contrast, and improve clarity.
[0073] In addition, after adjusting the contrast, the image needs to be normalized so that the image becomes a face image of a unified standard preset size.
[0074] Specifically, the formula for normalization is:
[0075] P(j, k) is the normalized value of the pixel with coordinates (j, k), D max is the maximum grayscale value of the pixels in the image, D min is the minimum grayscale value of pixels in the image.
[0076] Among them, the preset size is 28×28.
[0077] Step S11, identifying the occluded area of the face image and marking the occluded area;
[0078] The occluded areas are marked to facilitate identification, reduce recognition time, and improve recognition accuracy. Examples, but not limitations, include facial bandages for injuries, sun protection for different facial areas, and masks.
[0079] Step S12: A convolutional neural network model constructed based on TensorFlow is trained on the facial image to extract facial features;
[0080] Specifically, in step S120, an initial convolutional neural network model is constructed based on the TensorFlow deep learning framework;
[0081] Among them, based on the TensorFlow deep learning framework, three convolutional layers, two pooling layers, and one fully connected layer are used, and the convolutional layers and pooling layers are set alternately.
[0082] In this embodiment, a convolutional layer is used to extract features from a facial image, and then a pooling layer is used to reduce the dimension of the features and reduce the size of the feature image. The convolutional layer and the pooling layer are alternately set for extraction, and then a fully connected layer is used to globally connect the features.
[0083] Step S121, integrating the long short-term memory neural network into the initial convolutional neural network model, and performing learning and training to form a convolutional neural network model.
[0084] Among them, adding a long short-term memory neural network after the pooling layer makes the initial convolutional neural network model time-related, which will expand the types of data processed by the initial convolutional neural network model and output a predicted data at each time step, thereby improving the recognition accuracy and increasing the data processing speed.
[0085] Step S13, inputting the facial features into a feature classifier to obtain a facial plane feature map of the facial position, wherein the facial plane feature map includes an overall facial feature map, each key feature map, and an occlusion area map;
[0086] The overall facial feature map includes the overall face outline and the fusion of various features to form a global map. Each key feature map includes individual feature maps of the eyes, nose, mouth, and eyebrows.
[0087] In this embodiment, each key feature map is formed by removing the fully connected layer to form the feature map of each key part, wherein the feature classifier is a softmax layer.
[0088] Step S14, performing similarity calculation between the overall facial feature map and each key feature map and the trained convolutional neural network model to obtain an initial similarity;
[0089] Specifically, in step S140, the contour similarity between the contour of the overall facial feature map and the contour of the trained convolutional neural network model is calculated. The calculation formula of the contour similarity is:
[0090]
[0091] Among them, H ni is the contour of the ith position of the face overall feature map in the nth face plane feature map; H oi is the contour of the i-th position of the overall face feature map in the o-th trained convolutional neural network model; i = 1,...,x; S L is the contour similarity;
[0092] Calculating facial contour similarity can further improve face recognition accuracy. When facial images contain occluded areas, the corresponding features will be obscured, resulting in low face recognition accuracy. Adding facial contour similarity calculation further improves recognition accuracy.
[0093] In step S141, the feature similarity between each key feature graph and the key feature graph of the trained convolutional neural network model is calculated. The calculation formula of the feature similarity is:
[0094]
[0095] Among them, S Gz is the key feature similarity of the zth key feature graph; W z is the weight of the z-th key feature map; z=1,...,y; S G is the feature similarity;
[0096] The calculation formula for the key feature similarity is:
[0097]
[0098] Among them, S Gz is the key feature similarity of the zth key feature graph; T na is the position feature of the zth key feature map in the nth face plane feature map; T oza is the position feature of the zth key feature map in the oth trained convolutional neural network model; a=1,...,y.
[0099] Furthermore, the vector angle distance between the calculated key feature map and the key feature map in the trained convolutional neural network model is compared to strengthen the recognition of each key feature and improve the accuracy and reliability of recognition.
[0100] Step S142: Calculate and obtain an initial similarity based on the outline similarity and the feature similarity.
[0101] The calculation formula of the initial similarity is:
[0102] S=(1-S L )×S G ,
[0103] Among them, S is the initial similarity, S G is the feature similarity, S L Contour similarity.
[0104] By fusing contour similarity and feature similarity to calculate the initial similarity, the accuracy of the initial similarity calculation will be improved, avoiding the occlusion area blocking the key features and causing poor face recognition.
[0105] Step S15, obtaining a similarity factor based on calculation of the overall facial feature map, the key feature maps, and the occlusion region map;
[0106] Specifically, in step S150, the areas of the occlusion region map and the overall facial feature map are calculated, and the area ratio of the occlusion region map to the overall facial feature map is calculated, and it is determined whether the area ratio exceeds a preset area ratio;
[0107] Step S151: If yes, then judging the validity of the face image based on the number and position of each key feature map;
[0108] Step S152: If not, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps.
[0109] The calculation formula of the similarity factor is:
[0110]
[0111] Among them, m is the area ratio, B is the similarity factor, z is the number of key feature maps, and f is the number of key feature maps in the trained convolutional neural network model.
[0112] When the occlusion area is too large, face recognition is performed only through a small number of features, which is insecure. Therefore, it is necessary to judge the validity of the face image by the area of the occlusion area to improve the accuracy of recognition and reduce the problem of low recognition security caused by single feature recognition when the occlusion area is too large.
[0113] At the same time, calculating the similarity factor by the area ratio and the number of key feature maps, that is, calculating the security factor of face recognition, can effectively improve the security of face recognition and thus improve the accuracy of recognition.
[0114] Step S16: Calculate the similarity based on the initial similarity and the similarity factor, and determine whether the similarity exceeds a threshold to obtain a recognition result.
[0115] Specifically, the calculation formula of the similarity is:
[0116] C=B×S,
[0117] Among them, C is the similarity, B is the similarity factor, and S is the initial similarity;
[0118] Determining whether the similarity exceeds a threshold;
[0119] If yes, the recognition is successful;
[0120] If not, the recognition fails.
[0121] Among them, the initial degree and similarity factor are fused to obtain the similarity, and the overall contour and key features are combined for recognition to achieve multi-dimensional facial feature fusion and enhance the accuracy of face recognition; at the same time, the similarity factor is added to improve the effectiveness of face recognition by fusing the quantitative expression of occluded areas and key features, thereby improving the security of face recognition.
[0122] : Compared with the existing technology, the face recognition method based on TensorFlow network provided by this embodiment has the following beneficial effects: the face recognition method based on TensorFlow network provided by the present invention can effectively improve the accuracy of face recognition, specifically, collect facial images, preprocess the collected images, and obtain facial images of preset sizes; the preprocessing can effectively reduce recognition errors and improve recognition accuracy; identify the occluded areas of the facial images and mark the occluded areas to facilitate the identification of occluded areas, reduce recognition time and improve recognition accuracy; a convolutional neural network model constructed based on TensorFlow is used to train the facial images and extract facial features; the facial features are input into a feature classifier to obtain a facial plane feature map of the facial position, and the facial plane The facial feature map includes an overall facial feature map, key feature maps and an occlusion area map; the overall facial feature map and the key feature maps are similarly calculated with a trained convolutional neural network model to obtain an initial similarity; the overall contour and key features are combined for recognition to achieve multi-dimensional facial feature fusion and enhance the accuracy of face recognition; based on the calculation of the overall facial feature map, the key feature maps and the occlusion area map, a similarity factor is obtained to achieve the expression of the fused occlusion area and key features, thereby improving the effectiveness of face recognition, improving the security of face recognition, and thus improving the accuracy of recognition; based on the initial similarity and the similarity factor, the similarity is calculated, and it is judged whether the similarity exceeds a threshold to obtain a recognition result, thereby solving the technical problem of low face recognition accuracy caused by the ubiquitous influence of occlusion areas.
[0123] Example 2
[0124] The second embodiment of the present invention provides a face recognition method based on a TensorFlow network. The difference between the face recognition method based on a TensorFlow network provided in the first embodiment is that:
[0125] Step S151: If yes, then judging the validity of the face image based on the number and position of each key feature map;
[0126] Specifically, obtaining the number of positions of the key feature graphs on the coordinates of the key points, and determining whether the number exceeds a preset number;
[0127] If yes, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps;
[0128] If not, the facial image is marked as invalid and needs to be re-acquired.
[0129] Furthermore, in order to improve the accuracy and security of face recognition and avoid large occlusion areas, for example, the phenomenon of blocking all non-key points on the face by sun protection equipment is screened out. Therefore, by judging the number of positions of each key feature map on the coordinates of the key points, the face image is marked as valid, reducing errors and thus improving the accuracy and security of face recognition.
[0130] Example 3
[0131] See also Figure 2 , shown is a face recognition system based on a TensorFlow network provided by a third embodiment of the present invention, the system comprising:
[0132] The image acquisition module 100 is used to acquire an image of a human face and pre-process the acquired image to obtain a human face image of a preset size;
[0133] An image marking module 200 is used to identify and mark the occluded area of the face image;
[0134] A feature extraction module 300 is used to train a convolutional neural network model constructed based on TensorFlow on the facial image to extract facial features;
[0135] A feature classification module 400 is configured to input the facial features into a feature classifier to obtain a face plane feature map of the face position, wherein the face plane feature map includes an overall face feature map, key feature maps, and an occlusion region map;
[0136] A data calculation module 500 is used to calculate the similarity between the overall facial feature map and each key feature map and the trained convolutional neural network model to obtain an initial similarity;
[0137] Furthermore, the contour similarity between the contour of the overall facial feature map and the contour of the trained convolutional neural network model is calculated. The calculation formula of the contour similarity is:
[0138]
[0139] Among them, H ni is the contour of the ith position of the face overall feature map in the nth face plane feature map; H oi is the contour of the i-th position of the overall face feature map in the o-th trained convolutional neural network model; i = 1,...,x; S L is the contour similarity;
[0140] Furthermore, the feature similarity between each key feature graph and the key feature graph of the trained convolutional neural network model is calculated, and the calculation formula of the feature similarity is:
[0141]
[0142] Among them, S Gz is the key feature similarity of the zth key feature graph; W z is the weight of the z-th key feature map; z=1,...,y; S G is the feature similarity;
[0143] The calculation formula of the key feature similarity is:
[0144]
[0145] Among them, S Gz is the key feature similarity of the zth key feature graph; T na is the position feature of the zth key feature map in the nth face plane feature map; T oza is the position feature of the zth key feature map in the oth trained convolutional neural network model; a=1,...,y.
[0146] Furthermore, an initial similarity is calculated based on the contour similarity and the feature similarity.
[0147] The calculation formula of the initial similarity is:
[0148] S=(1-S L )×S G ,
[0149] Among them, S is the initial similarity, S G is the feature similarity, S L Contour similarity.
[0150] A factor calculation module 600 is configured to calculate a similarity factor based on the overall facial feature map, the key feature maps, and the occlusion region map;
[0151] Further, calculating the areas of the occlusion region map and the overall facial feature map, and calculating the area ratio of the occlusion region map to the overall facial feature map, and determining whether the area ratio exceeds a preset area ratio;
[0152] If yes, judging the validity of the facial image based on the number and position of each key feature map;
[0153] If not, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps.
[0154] The calculation formula of the similarity factor is:
[0155]
[0156] Among them, m is the area ratio, B is the similarity factor, z is the number of key feature maps, and f is the number of key feature maps in the trained convolutional neural network model.
[0157] The recognition determination module 700 is configured to calculate the similarity based on the initial similarity and the similarity factor, and determine whether the similarity exceeds a threshold to obtain a recognition result.
[0158] The calculation formula of the similarity is:
[0159] C=B×S,
[0160] Among them, C is the similarity, B is the similarity factor, and S is the initial similarity;
[0161] Determining whether the similarity exceeds a threshold;
[0162] If yes, the recognition is successful;
[0163] If not, the recognition fails.
[0164] Compared with the existing technology, the knuckle print recognition system provided by this embodiment has the following beneficial effects: a face recognition system based on the TensorFlow network provided by the present invention can effectively improve the accuracy of face recognition. Specifically, the collected images are preprocessed by the image acquisition module, which can effectively reduce recognition errors and improve recognition accuracy; the occluded areas are marked by the image marking module to facilitate the identification of occluded areas, reduce recognition time and improve recognition accuracy; the data calculation module combines the overall contour and key features for recognition, realizes multi-dimensional face feature fusion, and enhances the accuracy of face recognition; the factor calculation module realizes the expression of fused occluded areas and key features, improves the effectiveness of face recognition, improves the security of face recognition, and thus improves recognition accuracy; the recognition result is obtained by the recognition judgment module, thereby solving the technical problem of low face recognition accuracy caused by the influence of the ubiquitous occlusion area.
[0165] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0166] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0167] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. A face recognition method based on TensorFlow network, characterized in that: The face recognition method based on the TensorFlow network includes: Collecting a face image, pre-processing the collected image, and obtaining a face image of a preset size; Identifying the occluded area of the face image and marking the occluded area; A convolutional neural network model constructed based on TensorFlow is trained on the facial image to extract facial features; Inputting the facial features into a feature classifier to obtain a facial plane feature map of the facial position, wherein the facial plane feature map includes an overall facial feature map, each key feature map, and an occlusion area map; Calculate the similarity between the overall face feature map and each key feature map and the overall face feature map and the key feature map of the trained convolutional neural network model to obtain an initial similarity; Calculation based on the overall facial feature map, the key feature maps, and the occlusion region map to obtain a similarity factor includes: Calculating the areas of the occlusion region map and the overall facial feature map, and calculating the area ratio of the occlusion region map to the overall facial feature map, and determining whether the area ratio exceeds a preset area ratio, If yes, then the validity of the face image is determined based on the number and position of each key feature map. If not, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps. The calculation formula of the similarity factor is: , in, is the area ratio, is the similarity factor, z is the number of key feature maps, and f is the number of key feature maps in the trained convolutional neural network model; Based on the initial similarity and the similarity factor, the similarity is calculated, and it is determined whether the similarity exceeds a threshold to obtain a recognition result.
2. The face recognition method based on TensorFlow network according to claim 1, characterized in that The step of calculating similarity between the overall face feature map and the key feature maps and the overall face feature map and the key feature maps of the trained convolutional neural network model to obtain an initial similarity specifically includes: The contour similarity between the contour of the overall facial feature map and the contour of the overall facial feature map of the trained convolutional neural network model is calculated. The calculation formula of the contour similarity is: , in, is the contour of the ith position of the face overall feature map in the nth face plane feature map; is the contour of the i-th position of the overall face feature map in the o-th trained convolutional neural network model; i=1,...,x; is the contour similarity; The feature similarity between each key feature graph and the key feature graph of the trained convolutional neural network model is calculated. The calculation formula of the feature similarity is: , in, is the key feature similarity of the z-th key feature graph; is the weight of the z-th key feature map; z=1,...,y; is the feature similarity; An initial similarity is calculated based on the contour similarity and the feature similarity.
3. The face recognition method based on TensorFlow network according to claim 2, characterized in that: The calculation formula of the key feature similarity is: , in, is the key feature similarity of the z-th key feature graph; is the position feature of the zth key feature map in the nth face plane feature map; is the position feature of the zth key feature map in the oth trained convolutional neural network model; a=1,...,y.
4. The face recognition method based on TensorFlow network according to claim 2, characterized in that The step of calculating an initial similarity based on the contour similarity and the feature similarity specifically includes: The calculation formula of the initial similarity is: , Among them, S is the initial similarity, is the feature similarity, Contour similarity.
5. The face recognition method based on TensorFlow network according to claim 1, characterized in that: The step of judging the validity of the facial image based on the number and position of each key feature map specifically includes: Obtaining the number of positions of the key feature graphs on the coordinates of the key points, and determining whether the number exceeds a preset number; If yes, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps; If not, the facial image is marked as invalid and needs to be re-acquired.
6. The face recognition method based on TensorFlow network according to claim 4, characterized in that: The calculation formula of the similarity is: , Among them, C is the similarity, B is the similarity factor, and S is the initial similarity; Determining whether the similarity exceeds a threshold; If so, the recognition is successful; If not, the recognition fails.
7. The face recognition method based on TensorFlow network according to claim 1, characterized in that: The steps of constructing the convolutional neural network model specifically include: Build an initial convolutional neural network model based on the TensorFlow deep learning framework; The long short-term memory neural network is integrated into the initial convolutional neural network model, and learning and training are performed to form a convolutional neural network model.
8. A face recognition system based on TensorFlow network, characterized in that: The face recognition method based on the TensorFlow network according to any one of claims 1 to 7 is implemented, and the face recognition system based on the TensorFlow network includes: An image acquisition module is used to acquire facial images and pre-process the acquired images to obtain facial images of a preset size; An image marking module, configured to identify and mark the occluded area of the face image; A feature extraction module is used to train a convolutional neural network model constructed based on TensorFlow and extract facial features from the facial image; A feature classification module, configured to input the facial features into a feature classifier to obtain a face plane feature map of the face position, wherein the face plane feature map includes an overall face feature map, each key feature map, and an occlusion area map; A data calculation module is used to calculate the similarity between the overall facial feature map and the key feature maps and the overall facial feature map and the key feature map of the trained convolutional neural network model to obtain an initial similarity; A factor calculation module is used to calculate the similarity factor based on the overall facial feature map, the key feature maps, and the occlusion area map, including: Calculating the areas of the occlusion region map and the overall facial feature map, and calculating the area ratio of the occlusion region map to the overall facial feature map, and determining whether the area ratio exceeds a preset area ratio, If yes, then the validity of the face image is determined based on the number and position of each key feature map. If not, the face image is marked as valid, and a similarity factor is calculated based on the area ratio and the key feature maps. The calculation formula of the similarity factor is: , in, is the area ratio, is the similarity factor, z is the number of key feature maps, and f is the number of key feature maps in the trained convolutional neural network model; The recognition and determination module is configured to calculate the similarity based on the initial similarity and the similarity factor, and determine whether the similarity exceeds a threshold value to obtain a recognition result.
Citation Information
Patent Citations
Face image recognition method and equipment, electronic device and storage medium
CN113657195A