Machine learning face recognition method for different distribution data
Through the machine learning method of three-stage training, combined with convolutional neural network and attention mechanism, the problem of non-distributed data and data perturbation in face recognition is solved, and robustness is achieved for lighting, occlusion and makeup, and the accuracy and stability of face recognition are improved.
Patent Information
- Application Number
- CN202510178689.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2045-02-18
AI Technical Summary
The prior art is difficult to process non-distributed data in the field of face recognition, especially under factors such as lighting, angle and facial expression changes, resulting in limited model generalization ability and personalization effects. At the same time, existing approaches have challenges in privacy protection, scarcity of labeled data and model efficiency.
A face recognition method for machine learning with non-distributed data is proposed, and three-stage training is carried out by obtaining the training set. The first stage is used to extract conventional face features using convolutional neural networks. The second phase enhances the robustness of the model to light and occlusion by adding perturbations and extracting face features using attention mechanisms. The third stage is used to train the face data set after makeup to improve the generalization ability of the model and its adaptability to data perturbations.
This method can adapt to changes in scenes and characters, is not affected by the introduction of new data, and is robust to face data with low light and facial occlusion, improving the accuracy of face recognition and the stability of the model.
Smart Images

Figure CN119693989A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of face recognition technology, and in particular to a face recognition method for machine learning of non-identical distribution data. Background Art
[0002] In the field of machine learning for non-identically distributed data, especially face recognition technology, existing technologies mainly include federated learning and federated clustering. Federated learning, as a distributed machine learning method, aims to solve the privacy and scalability problems of centralized methods, allowing multiple clients to collaboratively train models while protecting data privacy. However, federated learning faces challenges when dealing with non-IID data, especially in the field of face recognition, where the data distribution of different users varies greatly, resulting in limited model generalization ability and personalization effect. Federated clustering achieves better personalization effect by creating a dedicated global model for similar user groups. However, federated clustering relies on each client having available labeled data, which is often difficult to achieve in practical applications, especially in face recognition scenarios where the cost of obtaining labeled data is high. In addition, existing technologies have problems in privacy protection, scarcity of labeled data, and model efficiency. The challenge of privacy protection lies in how to achieve effective data collaborative training while protecting user privacy. The scarcity of labeled data limits the effect and accuracy of model training, especially in face recognition tasks that require a large amount of high-quality labeled data. Finally, existing semi-supervised federated learning methods may require a large number of active learning queries, which increases the computational cost and communication cost of model training.
[0003] In security monitoring, face recognition systems are used to identify and track people entering the monitoring area. Since monitoring systems usually face multiple challenges, such as changes in lighting, angles, facial expressions, and changes in the crowd at different times, the system needs to be highly robust and be able to continuously learn new data to adapt to parameter changes. In addition, the monitoring system may receive a large amount of data, and the newly added data may destroy the existing features, that is, the new features are very different from the existing features, resulting in the face recognition model being incompatible with the new data set and the existing data set. In addition, when there is interference in the data set, such as when the data set includes faces with makeup, faces in low light and occlusion conditions, the face recognition model will be affected by the input disturbance, making the face recognition model less robust.
[0004] Therefore, a face recognition method is needed that can continuously update the model to adapt to changes in scenes and characters and is suitable for face data with interference, such as low light and face occlusion, that is, a face recognition method that is robust to data perturbations. Summary of the invention
[0005] In order to overcome the problems existing in the related art, the purpose of the present invention is to provide a face recognition method for machine learning of non-identically distributed data, which can continuously update the model to adapt to changes in scenes and characters, and is suitable for face data with interference, such as face data in low light and with facial occlusion, that is, it is robust to data disturbances.
[0006] A face recognition method for machine learning of non-identical distribution data, comprising: Obtaining a training set, and using the training set to perform a first-stage training on a face recognition model to obtain a first classification set; Adding disturbance to the training data in the training set to obtain supplementary data; extracting facial features in the supplementary data based on an attention mechanism; Performing a second-stage training on the face recognition model using the face features in the supplementary data to obtain a second classification set; Inputting the face data set after makeup into the face recognition model, and performing the third stage training on the face recognition model with the similarity between the output third classification set and the second classification set as a constraint item; If the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model; The trained model is used to identify the user.
[0007] In a preferred technical solution of the present invention, before extracting facial features in the supplementary data based on the attention mechanism, the method further includes: The convolutional neural network model is used as the face recognition model; An attention module is added between the feature extraction module and the output module of the face recognition model.
[0008] In a preferred technical solution of the present invention, the attention module is added between the feature extraction module and the output module of the face recognition model, including: Adding N feature extraction layers between the feature extraction module and the output module of the convolutional neural network model; Or a Transformer model is added between the feature extraction module and the output module of the convolutional neural network model.
[0009] In a preferred technical solution of the present invention, the step of adding disturbance to the training data in the training set to obtain supplementary data includes: Converting the training data in the training set into a plurality of training vectors; wherein the training data is in matrix form; Randomly generate tiny vectors; Adding the tiny vector to each of the training vectors to obtain a plurality of disturbance vectors; The disturbance vector is converted into a matrix form to obtain supplementary data.
[0010] In a preferred technical solution of the present invention, the face recognition model is trained in the second stage using the face features in the supplementary data to obtain a second classification set, including: Inputting facial features in the supplementary data into a face recognition model and outputting recognition labels; Compare the identified label with the true label and calculate a second loss function; According to the second loss function, updating the model parameters of the face recognition model by back propagation; All of the identification tags are grouped into a second classification set.
[0011] In a preferred technical solution of the present invention, the third stage of training the face recognition model includes: Using a third loss function to measure the difference between the second classification set and the third classification set; Adjust the model parameters of the face recognition model according to the third loss function.
[0012] In a preferred technical solution of the present invention, if the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model, including: If the accuracy of the face recognition model is greater than or equal to the accuracy threshold, and the recall rate is less than the recall rate threshold, then detecting whether the face recognition model is robust to occlusion and illumination; If the face recognition model is robust to occlusion and illumination, the third stage training is stopped to obtain a trained model.
[0013] In a preferred technical solution of the present invention, the calculation of the second loss function includes: The second loss function is calculated according to the following formula: ; Where t is the true label, x is the training data, and x' is the supplementary data; f(x) is the first predicted label of the training data predicted by the face recognition model, and f(x') is the second predicted label of the supplementary data predicted by the face recognition model; ||f(x)-t||2 is the standard classification loss, ||f(x')-f(x)||2 is the consistency loss, λ(t) is the first dynamic weight function, L2(x,x ’ ,t) is the second loss function.
[0014] In a preferred technical solution of the present invention, the using of a third loss function to measure the difference between the second classification set and the third classification set includes: ; Among them, β(t) is the second dynamic weight function, L3(x,x ’ ,t) is the third loss function.
[0015] In a preferred technical solution of the present invention, the first stage training of the face recognition model using the training set to obtain the first classification set includes: Inputting the training set into a face recognition model to extract global features from the training set; Output a first classification set according to the global feature; A cross entropy loss function between the first classification set and the true label is calculated, and model parameters of the face recognition model are updated according to the value of the cross entropy loss function.
[0016] The beneficial effects of the present invention are: The face recognition method for machine learning of non-identical distribution data provided by the present invention includes obtaining a training set, using the training set to perform first-stage training on a face recognition model, and obtaining a first classification set. During the first-stage training process, a face recognition model based on a convolutional neural network is used to extract face features so that the face recognition model can recognize conventional face features such as eyes, nose and mouth. Perturbations are added to the training data in the training set to obtain supplementary data; and face features in the supplementary data are extracted based on an attention mechanism. The face recognition model is trained in the second stage using the face features in the supplementary data to obtain a second classification set. On the basis of the first-stage training, supplementary data with perturbations are used to enhance the robustness of the face recognition model to illumination and occlusion using an incremental learning method. A face data set after makeup is input into the face recognition model, and the face recognition model is trained in the third stage using the similarity between the output third classification set and the second classification set as a constraint item. If the face recognition performance of the face recognition model meets expectations, the third-stage training is stopped to obtain a trained model, and the trained model is used to identify the user identity. The third stage of training is to add the features of the face after makeup on the basis of the existing face recognition model, so that the face recognition model can focus on more subtle changes, such as traces of makeup on the eyes and mouth, thereby increasing the generalization ability of the model. After the above three stages of training, the trained model can adapt to changes in scenes and characters, and the accuracy of face recognition will not be affected by the introduction of new data. In addition, the trained model is suitable for face data with interference, such as low light and face occlusion, that is, it is robust to data disturbances. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flow chart of a face recognition method for machine learning of non-identical distribution data of the present invention; Figure 2It is a flow chart of the first stage training of the face recognition model using the training set of the present invention; Figure 3 It is a flow chart of adding disturbance to the training data in the training set of the present invention. DETAILED DESCRIPTION
[0018] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.
[0019] Example 1 like Figure 1 As shown, this embodiment provides a face recognition method for machine learning of non-identical distribution data, including: S1: Obtain a training set, and use the training set to perform a first-stage training on a face recognition model to obtain a first classification set.
[0020] S2: Add disturbance to the training data in the training set to obtain supplementary data; extract facial features in the supplementary data based on an attention mechanism.
[0021] S3: Performing a second phase of training on the face recognition model using the face features in the supplementary data to obtain a second classification set.
[0022] S4: Inputting the makeup face dataset into the face recognition model, and performing the third stage training on the face recognition model with the similarity between the output third classification set and the second classification set as a constraint item.
[0023] S5: If the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model.
[0024] S6: Using the trained model to identify the user identity.
[0025] The training set uses a regular face dataset, that is, a face dataset with normal lighting and no occlusion. Add lighting adjustment and facial occlusion to the training data in the training set, and rotate and crop the training data to enhance the robustness of the face recognition model to lighting and occlusion in the second stage of training. The face dataset after makeup includes the features of the face after makeup. At this stage, the self-attention mechanism can be used to make the face recognition model pay attention to more subtle changes in the area, such as makeup marks on the eyes and mouth.
[0026] like Figure 2As shown, the training set is used to perform the first stage training on the face recognition model to obtain the first classification set, including: S12: Input the training set into a face recognition model to extract global features in the training set.
[0027] S13: Output a first classification set according to the global feature.
[0028] S14: Calculate the cross entropy loss function between the first classification set and the true label, and update the model parameters of the face recognition model according to the value of the cross entropy loss function.
[0029] Before step S12, step S11 is also included: obtaining a training set. The training set is input into a face recognition model, which includes a convolutional layer, a fully connected layer, and an output layer. The convolutional layer is used to extract facial features in the training set, and the fully connected layer is used to integrate the facial features extracted by different convolutional layers. The facial features extracted in the first stage of training include eyes, nose, and mouth, etc. In the first stage of training, the cross entropy loss function, i.e., the first loss function, is used to measure the difference between the identification labels output by the output layer and the real labels, and the face recognition model is trained according to the difference between the labels.
[0030] like Figure 3 As shown, the adding of disturbance to the training data in the training set to obtain supplementary data includes: S21: Convert the training data in the training set into a plurality of training vectors; wherein the training data is in matrix form.
[0031] S22: Randomly generate tiny vectors.
[0032] S23: Add the tiny vector to each of the training vectors to obtain multiple disturbance vectors.
[0033] S24: Convert the disturbance vector into a matrix form to obtain supplementary data.
[0034] In the second stage of training, the face recognition model is required to produce consistent predictions when given slightly different inputs, thereby reducing the face recognition model's sensitivity to small perturbations of the input. In the second stage of training, adding adversarial perturbations can prevent the face recognition model from overfitting when faced with a changing data distribution.
[0035] Add tiny vectors to each training vector, which can represent lighting, occlusion, rotation, translation, and cropping. Use random generation so that multiple perturbation vectors can correspond to different scenes. Add perturbations to the training data and use supplementary data to perform the second phase of training on the face recognition model to avoid the model's over-reliance on specific data patterns. Perturbations are mainly used to simulate image noise, lighting changes, and facial occlusion in real environments, making the learning process of the face recognition model diverse.
[0036] The similarity between the perturbation vector and the corresponding training vector is greater than 0.6 to ensure the consistency of the identity of the person in the training vector, that is, the person corresponding to the training vector does not change. The illumination distribution and the position of the occlusion area can be changed while the size of the occlusion area is fixed; or the illumination distribution and the size of the occlusion area can be changed while the position of the occlusion area is fixed; or the illumination distribution and the shape of the occlusion area can be changed while the position of the occlusion area and the size of the occlusion area are fixed, for example, the occlusion area can be changed from a square to a rectangle, and then from a rectangle to a circle.
[0037] The following formula is used to describe the light distribution: ; Among them, K(z) is the illumination intensity of the z-th pixel of the current face image in the training data, the horizontal coordinate of the z-th pixel is m1, and the vertical coordinate is n1. t(z) is the transmittance corresponding to the z-th pixel in the transmittance spectrum, J(z) is the distant illumination at the z-th pixel, and B(z) is the near illumination at the z-th pixel. Near illumination refers to the illumination within the spherical area with a radius of R1 centered on the target face. Distant illumination refers to the illumination outside the spherical area with a radius of R1 centered on the target face.
[0038] Since the light source of the near-view lighting is relatively close to the target face, the near-view lighting is mainly reflected in the area near the target face. The present invention assumes that the near-view light is only reflected and the far-view light is only transmitted. Therefore, the product of t(z) and J(z) is used to describe the effect of the far-view lighting on the target face, that is, the intensity of light irradiated from the distant light source onto the target face. 1-t(z) represents the reflectivity corresponding to the zth pixel point, and the product of B(z) and (1-t(z)) is used to describe the effect of the near-view lighting on the target face, that is, the intensity of light irradiated from the nearby light source onto the target face. Combining the intensity of light after reflection from the near-view light source and the intensity of light after transmission from the far-view light source, the intensity of light at the zth pixel point of the current face image in the training data can be obtained.
[0039] After the third stage of training, the face recognition model of the present invention is applicable to regular face data without disturbance and makeup, face data with disturbance, and face data after makeup, so that the face recognition model of the present invention has strong robustness to non-identically distributed data.
[0040] The face recognition method for machine learning of non-identical distribution data provided in this embodiment includes obtaining a training set, using the training set to perform the first stage training on the face recognition model, and obtaining a first classification set. During the first stage training, a face recognition model based on a convolutional neural network is used to extract face features so that the face recognition model can recognize conventional face features such as eyes, nose and mouth. Perturbations are added to the training data in the training set to obtain supplementary data; and face features in the supplementary data are extracted based on the attention mechanism. The face recognition model is trained in the second stage using the face features in the supplementary data to obtain a second classification set. On the basis of the first stage training, supplementary data with perturbations are used to enhance the robustness of the face recognition model to illumination and occlusion using an incremental learning method. The face data set after makeup is input into the face recognition model, and the face recognition model is trained in the third stage using the similarity between the output third classification set and the second classification set as a constraint item. If the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model, and the trained model is used to identify the user identity. The third stage of training is to add the features of the face after makeup on the basis of the existing face recognition model, so that the face recognition model can focus on more subtle changes, such as traces of makeup on the eyes and mouth, thereby increasing the generalization ability of the model. After the above three stages of training, the trained model can adapt to changes in scenes and characters, and the accuracy of face recognition will not be affected by the introduction of new data. In addition, the trained model is suitable for face data with interference, such as low light and face occlusion, that is, it is robust to data disturbances.
[0041] Example 2 This embodiment provides a face recognition method for machine learning of non-identical distribution data. This embodiment only describes the differences from Embodiment 1. Before extracting the face features in the supplementary data based on the attention mechanism, it also includes: S11': A convolutional neural network model is used as the face recognition model.
[0042] S12': adding an attention module between the feature extraction module and the output module of the face recognition model.
[0043] The attention module is added between the feature extraction module and the output module of the face recognition model, including: S121': Add N feature extraction layers between the feature extraction module and the output module of the convolutional neural network model.
[0044] S122': or adding a Transformer model between the feature extraction module and the output module of the convolutional neural network model.
[0045] By adding an attention mechanism to the neural network model, the face recognition model can focus on more subtle changes, such as makeup marks on the eyes and mouth. The traditional self-attention mechanism only focuses on the global relationship in the input when calculating attention, but in face recognition, the facial features after makeup may produce local changes, so the multi-head self-attention mechanism is introduced, so that the face recognition model can learn the relationship between local features and global features from multiple angles.
[0046] Furthermore, through the multi-head attention mechanism, the face recognition model can learn the relationship between local areas such as eyes, mouth and nose while maintaining attention to global facial features.
[0047] A Transformer model is added between the feature extraction module and the output module to gradually fuse local features such as eyes and mouth, and global features such as the overall facial contour. By dynamically adjusting the attention weights, the face recognition model can better cope with face recognition scenarios under makeup and occlusion. Combining the multi-head attention mechanism and local feature fusion can improve the face recognition model's ability to focus on complex facial features such as faces with makeup, making the face recognition model more robust and accurate during the face recognition process.
[0048] If the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model, including: S51: If the accuracy of the face recognition model is greater than or equal to the accuracy threshold, and the recall rate is less than the recall rate threshold, then detect whether the face recognition model is robust to occlusion and illumination.
[0049] S52: If the face recognition model is robust to occlusion and illumination, stop the third stage training to obtain a trained model.
[0050] The accuracy of face recognition refers to the proportion of samples that are correctly predicted as positive samples among all samples predicted as positive samples. The accuracy is calculated by dividing the number of positive samples predicted as positive by the total number of samples predicted as positive samples, where the total number of samples predicted as positive samples is the sum of the number of positive samples correctly predicted as positive and the number of negative samples incorrectly predicted as positive. The recall rate of face recognition refers to the proportion of positive samples that are correctly identified among all positive samples. The higher the recall rate, the more positive samples the face recognition model can identify. The recall rate is calculated by dividing the number of correctly identified faces by the total number of positive samples, where the total number of positive samples is the sum of the number of positive samples predicted as positive and the number of positive samples incorrectly predicted as negative. Positive samples are images that contain the target object, and negative samples are images that do not contain the target object.
[0051] Before extracting facial features from the supplementary data based on the attention mechanism, this embodiment also includes using a convolutional neural network model as a face recognition model, and adding an attention module between the feature extraction module and the output module of the face recognition model. The attention module is an N-layer feature extraction layer or a Transformer model. By dynamically adjusting the attention weights, the face recognition model can better cope with face recognition scenarios under makeup and occlusion. Combining the multi-head attention mechanism and local feature fusion can enhance the face recognition model's ability to focus on complex facial features, such as faces after makeup, so that the face recognition model has higher robustness and accuracy during the face recognition process.
[0052] Example 3 This embodiment provides a face recognition method for machine learning of non-identical distribution data. This embodiment only describes the differences from Embodiment 1. The face recognition model is trained in the second stage using the face features in the supplementary data to obtain a second classification set, including: S31: Input the facial features in the supplementary data into a face recognition model and output a recognition label.
[0053] S32: Compare the identified label with the true label and calculate a second loss function.
[0054] S33: According to the second loss function, the model parameters of the face recognition model are updated by back propagation.
[0055] S34: All the identification tags are grouped into a second classification set.
[0056] The supplementary data is the data after adding disturbance to the training data in the training set, and the forms of disturbance include increasing the light intensity, decreasing the light intensity, increasing the facial occlusion, rotating the image, translating the image, and cropping the image. In an ideal case, the input image is disturbed, and the output classification label is still the same as the true label. Therefore, the present invention adopts a second loss function to train the face recognition model, and the second loss function is composed of a standard classification loss and a consistency loss, which can improve the robustness of the face recognition model when the face data is disturbed.
[0057] The calculating of the second loss function comprises: The second loss function is calculated according to the following formula: ; Where t is the true label, x is the training data, and x' is the supplementary data; f(x) is the first predicted label of the training data predicted by the face recognition model, and f(x') is the second predicted label of the supplementary data predicted by the face recognition model; ||f(x)-t||2 is the standard classification loss, ||f(x')-f(x)||2 is the consistency loss, λ(t) is the first dynamic weight function, L2(x,x ’ ,t) is the second loss function.
[0058] The standard classification loss is used to measure the difference between the first predicted label of the training data predicted by the face recognition model and the true label. The consistency loss is used to measure the difference between the second predicted label of the supplementary data predicted by the face recognition model and the first predicted label of the training data predicted by the face recognition model. Combining the standard classification loss and the consistency loss can reduce the impact of disturbances on face recognition while allowing the face recognition model to accurately identify the user's identity. The value of the first dynamic weight function is variable and is used to adjust the proportion of the standard classification loss and the consistency loss.
[0059] After the first stage of training, the face recognition model gradually introduces face data with illumination changes and occlusion. In order to avoid catastrophic forgetting, the present invention adopts an incremental learning method so that the face recognition model can maintain the memory of conventional face data while learning new data.
[0060] In each round of training in the second stage, the difference between the training data and the supplementary data is calculated to ensure that the feature learning of the new data does not destroy the feature learning of the old data. In the second stage of training, when there are fewer supplementary data with disturbances, the value of the first dynamic weight function gradually increases to enhance the adaptability of the face recognition model to disturbances such as illumination changes and occlusion.
[0061] The third stage of training the face recognition model includes: Using a third loss function to measure the difference between the second classification set and the third classification set; Adjust the model parameters of the face recognition model according to the third loss function.
[0062] The adopting a third loss function to measure the difference between the second classification set and the third classification set comprises: ; Among them, β(t) is the second dynamic weight function, L3(x,x ’ ,t) is the third loss function.
[0063] The key to dynamic consistency regularization is to automatically adjust the weight of consistency loss according to the stability requirements of the model at different stages. During the third stage of training, as the face recognition model gradually stabilizes, the value of the second dynamic weight function is continuously reduced, thereby reducing the proportion of consistency loss and focusing on optimizing classification capabilities.
[0064] The third loss function not only focuses on the consistency of the perturbed data, but also takes into account the distribution differences between the data. Especially in the face recognition scenario with non-identical distribution data, it dynamically adjusts the intensity of the consistency loss to avoid the influence of the perturbed supplementary data on the original ability of the face recognition model. It can effectively alleviate the deviation of the data distribution under the premise of introducing the dataset of makeup faces.
[0065] After the second stage of training, the face recognition model of the present invention has good robustness to face data with illumination changes and occlusion. In the third stage of training, a face data set after makeup is added to enhance the adaptability of the face recognition model to face images after makeup, so that the face recognition model can handle complex face changes.
[0066] In this embodiment, as the data set changes, it is necessary to adjust the ratio between the standard classification loss and the consistency loss. During the second stage of training, since supplementary data with disturbances such as illumination changes and occlusions are introduced, the weight of the consistency loss, i.e., the first dynamic weight function, is gradually increased, thereby enhancing the adaptability of the face recognition model to the disturbed data. After the introduction of the face data set after makeup, the face recognition model may pay insufficient attention to non-critical areas. During the third stage of training, since the influence of the face data after makeup on the face recognition model is increasing, the weight of the consistency loss, i.e., the second dynamic weight function, is continuously reduced. At this time, the face recognition model focuses on learning the face data after makeup.
[0067] Example 4 A computer device is also provided in an embodiment of the present application, which may be a server, wherein the computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection.
[0068] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the face recognition method for machine learning of non-identical distribution data described in any one of Embodiments 1 to 3 is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0069] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0070] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A face recognition method for machine learning of non-identical distribution data, characterized in that: include: Obtaining a training set, and using the training set to perform a first-stage training on a face recognition model to obtain a first classification set; Adding disturbance to the training data in the training set to obtain supplementary data; extracting facial features in the supplementary data based on an attention mechanism; Performing a second-stage training on the face recognition model using the face features in the supplementary data to obtain a second classification set; Inputting the face data set after makeup into the face recognition model, and performing the third stage training on the face recognition model with the similarity between the output third classification set and the second classification set as a constraint item; If the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model; The trained model is used to identify the user.
2. The face recognition method for machine learning of non-identical distribution data according to claim 1, characterized in that: Before extracting the facial features in the supplementary data based on the attention mechanism, the method further includes: The convolutional neural network model is used as the face recognition model; An attention module is added between the feature extraction module and the output module of the face recognition model.
3. The face recognition method for machine learning of non-identical distribution data according to claim 2, characterized in that: The attention module is added between the feature extraction module and the output module of the face recognition model, including: Adding N feature extraction layers between the feature extraction module and the output module of the convolutional neural network model; Or a Transformer model is added between the feature extraction module and the output module of the convolutional neural network model.
4. The face recognition method for machine learning of non-identical distribution data according to claim 1, characterized in that: The step of adding disturbance to the training data in the training set to obtain supplementary data comprises: Converting the training data in the training set into a plurality of training vectors; wherein the training data is in matrix form; Randomly generate tiny vectors; Adding the tiny vector to each of the training vectors to obtain a plurality of disturbance vectors; The disturbance vector is converted into a matrix form to obtain supplementary data.
5. The face recognition method for machine learning of non-identical distribution data according to claim 1, characterized in that: The face recognition model is trained in the second stage using the face features in the supplementary data to obtain a second classification set, including: Inputting facial features in the supplementary data into a face recognition model and outputting recognition labels; Compare the identified label with the true label and calculate a second loss function; According to the second loss function, updating the model parameters of the face recognition model by back propagation; All of the identification tags are grouped into a second classification set.
6. The face recognition method for machine learning of non-identical distribution data according to claim 5, characterized in that: The third stage of training the face recognition model includes: Using a third loss function to measure the difference between the second classification set and the third classification set; Adjust the model parameters of the face recognition model according to the third loss function.
7. The face recognition method for machine learning of non-identical distribution data according to claim 1, characterized in that: If the face recognition performance of the face recognition model meets expectations, the third stage training is stopped to obtain a trained model, including: If the accuracy of the face recognition model is greater than or equal to the accuracy threshold, and the recall rate is less than the recall rate threshold, then detecting whether the face recognition model is robust to occlusion and illumination; If the face recognition model is robust to occlusion and illumination, the third stage training is stopped to obtain a trained model.
8. The face recognition method for machine learning of non-identical distribution data according to claim 6, characterized in that: The calculating of the second loss function comprises: The second loss function is calculated according to the following formula: ; Where t is the true label, x is the training data, and x' is the supplementary data; f(x) is the first predicted label of the training data predicted by the face recognition model, and f(x') is the second predicted label of the supplementary data predicted by the face recognition model; ||f(x)-t||2 is the standard classification loss, ||f(x')-f(x)||2 is the consistency loss, λ(t) is the first dynamic weight function, L2(x,x ’ ,t) is the second loss function.
9. The face recognition method for machine learning of non-identical distribution data according to claim 8, characterized in that: The adopting a third loss function to measure the difference between the second classification set and the third classification set comprises: ; Among them, β(t) is the second dynamic weight function, L3(x,x ’ ,t) is the third loss function.
10. The face recognition method for machine learning of non-identical distribution data according to claim 1, characterized in that: The first stage of training the face recognition model using the training set to obtain a first classification set includes: Inputting the training set into a face recognition model to extract global features from the training set; Output a first classification set according to the global feature; A cross entropy loss function between the first classification set and the true label is calculated, and model parameters of the face recognition model are updated according to the value of the cross entropy loss function.
Citation Information
Patent Citations
Model training method, face recognition method, device, equipment, medium and product
CN114140862A
Mine electric locomotive road condition identification method under uneven illumination
CN115775381A
Method and system for verifying bank user identity based on image
CN116631038A
Bank user identity verification method and system based on face recognition mode
CN116739608A
Fraud detection method and system for face makeup
CN117935380A