Face recognition method, face recognition device, computer device and storage medium
By using a supervised deep network model, new data generated by a second deep network is used to guide the first deep network in learning facial features. This solves the problems of overfitting and feature dimension collapse in training long-tail datasets, and improves the accuracy and generalization ability of face recognition.
Patent Information
- Application Number
- CN202111616555.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Existing face recognition models trained with long-tail data have low recognition accuracy in practical use and are prone to overfitting and feature dimension collapse.
A deep network model trained with a supervised model is used to generate new face image data through a second deep network model to guide the first deep network model in learning face features. This increases the amount of face image data used for training by face categories. Furthermore, the feature space collapse caused by a lack of intra-class diversity is avoided by adjusting the triplet loss function and network parameters.
It improves the accuracy of the face recognition model, reduces false recognition, enhances the model's generalization ability, ensures that degradation is avoided on the face tail dataset, and improves the recognition accuracy.
Smart Images

Figure CN114529964B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision, and in particular to a face recognition method, a face recognition device, a computer device and a storage medium. BACKGROUND
[0002] In machine learning and its application in visual recognition, face recognition technology has made significant breakthroughs and has been widely applied. Effective information can be extracted from sufficient rich face data to support face recognition feature space, but in most application scenarios, the training data for training the face recognition model belongs to a long-tail face data set, that is, the face image data used for training presents a long-tail distribution, and the number of face image data corresponding to part of the face categories is sufficient, so that the face image data of the part of the face categories meets the diversity requirement within the class. However, the number of face image data corresponding to a small number of face categories is relatively scarce, for example, only a few face image data, so that the face image data of the part of the face categories lacks intra-class diversity, which easily leads to the degradation or overfitting of the face recognition model when training the face recognition model.
[0003] In view of the defect that the face image data lacks intra-class diversity, in the related art, a semi-siamese training (SST) method is used to train the face recognition model, so as to avoid the degradation or overfitting of the face recognition model in the training process. However, this training method is not suitable for training using a long-tail face data set, and if the long-tail face data set is used for training, the face recognition model is easily dominated by head data (i.e., a face category with a large number of images), which causes overfitting in the head, and the lack of tail data causes the model to collapse in the tail data feature space dimension (i.e., a large number of 0s in the feature dimension), which makes it difficult to achieve the ideal degree of feature learning, thereby affecting the generalization performance of the entire deep model, and thus the face recognition model has low recognition accuracy when used for face recognition, which affects the user experience. SUMMARY
[0004] Therefore, the technical problem to be solved by the present application is to overcome the defect that the face recognition model trained using the long-tail data in the prior art has low recognition accuracy in actual use, thereby providing a face recognition method, a face recognition device, a computer device and a storage medium.
[0005] In a first aspect, the present application provides a face recognition method, comprising: obtaining a face image to be recognized; inputting the face image into a pre-trained face recognition model to extract features, and determining a face class corresponding to the face image by comparing the face image with face image features of a plurality of known face classes. The face recognition model is a deep network model obtained by training a supervised model based on a long-tail face dataset.
[0006] In this way, when the face image of an unknown face class is extracted based on the pre-set face recognition model, the face features of the face image can be fully extracted, thereby improving the accuracy of face recognition and helping to reduce the occurrence of misrecognition.
[0007] In combination with the first aspect, in a first embodiment of the first aspect, the supervised model comprises a first deep network model and a second deep network model, and the first deep network model and the second deep network model have the same model structure but different network parameters. The face recognition model is a deep network model obtained by training a supervised model based on a long-tail face dataset, comprising: obtaining first face image data and second face image data corresponding to the same face class according to the long-tail face dataset; performing augmentation processing on the second face image data to obtain third face image data; extracting third image data features of the third face image data by the second deep network model; and training the first deep network model to extract first image data features of the first face image data based on the third image data features and historical image data features pre-extracted by the first deep network model, to obtain the face recognition model, so that the face recognition accuracy can be improved when the trained face recognition model is used for subsequent training.
[0008] In this way, the second deep network model generates new face image data to guide and supervise the first deep network model to learn face features, enhances the number of face image data of face classes used for training, and thereby helps to avoid the hindrance of the lack of intra-class diversity of tail face classes to the optimization of the face recognition model, so as to improve the generalization ability of the model.
[0009] With reference to the first embodiment of the first aspect, in a second embodiment of the first aspect, the training of the first deep network model to extract the first image data features of the first face image data based on the third image data features and the historical image data features pre-extracted by the first deep network model to obtain the face recognition model comprises: extracting the first image data features of the first face image data by the first deep network model, and obtaining a first loss of classification according to the first image data features extracted by the first deep network model. A triplet loss corresponding to the first deep network model is determined according to the first image data features, the third image data features and the historical image data features pre-extracted by the first deep network model. A total loss of the first deep network model is determined according to the first loss and the triplet loss. When the total loss is less than a specified loss threshold, the training of the first deep network model is completed, and the face recognition model is obtained.
[0010] In this way, when the first deep network model is trained, the training can be performed based on the triplet loss function, which helps to avoid the occurrence of dimension collapse in the feature space due to lack of intra-class diversity when the face image data of the face class is small.
[0011] With reference to the second embodiment of the first aspect, in a third embodiment of the first aspect, the method further comprises: if the total loss is greater than or equal to the specified loss threshold, adjusting the first network parameters in the first deep network model by performing a stochastic gradient descent process on the weight parameters in the first network parameters according to the total loss. The first deep network model is trained to extract the first image data features of the first face image data according to the adjusted first network parameters by the second deep network model until the total loss is less than the specified loss threshold.
[0012] With reference to the third embodiment of the first aspect, in a fourth embodiment of the first aspect, the training of the first deep network model to extract the first image data features of the first face image data according to the adjusted first network parameters by the second deep network model comprises: performing an exponential moving average process on the weight parameters of the second network parameters of the second deep network model according to the adjusted first network parameters of the first deep network model to adjust the second network parameters. The first deep network model is trained to extract the first image data features of the first face image data according to the adjusted second network parameters of the second deep network model and the adjusted first network parameters.
[0013] In this mode, by adjusting the respective network parameters of the first and second deep network models in different ways, it is helpful to ensure that the first and second network parameters are always in different states, and thus the first and third image feature data obtained always have differences, so that when the first deep network model is subsequently trained, the degradation phenomenon on the human face tail image dataset can be effectively avoided.
[0014] In combination with the second embodiment of the first aspect, in a fifth embodiment of the first aspect, the first loss of classification according to the first image data features extracted by the first deep network model comprises: obtaining the first loss of classification according to the first image data features extracted by the first deep network model by using a flexible maximum activation function with an interval.
[0015] In combination with any one of the first to fifth embodiments of the first aspect, in a sixth embodiment of the first aspect, the historical image data features are first image data features of first human face image data of other human face categories pre-extracted by the first deep network model.
[0016] In the second aspect, the present application provides a human face recognition device, comprising: an acquisition unit configured to acquire a human face image to be recognized; and a recognition unit configured to recognize a human face category corresponding to the human face image data among a plurality of human face image data of known human face categories by using a pre-trained human face recognition model, and determine the human face category as the category of the human face image data. The human face recognition model is a deep network model trained by a supervised model based on a human face long-tail dataset.
[0017] In combination with the second aspect, in a first embodiment of the second aspect, the supervised model comprises a first deep network model and a second deep network model, and the first deep network model and the second deep network model have the same model structure but different network parameters. The human face recognition model is obtained by training the supervised model based on the human face long-tail dataset by using the following units: a data acquisition unit configured to acquire first human face image data and second human face image data corresponding to the same human face category according to the human face long-tail dataset; a processing unit configured to perform augmentation processing on the second human face image data to obtain third human face image data; an extraction unit configured to extract third image data features of the third human face image data by using the second deep network model; and a training unit configured to train the first deep network model to extract first image data features of the first human face image data based on the third image data features and historical image data features pre-extracted by the first deep network model, to obtain the human face recognition model.
[0018] In conjunction with the first embodiment of the second aspect, in the second embodiment of the second aspect, the training unit includes: a first loss acquisition unit, configured to extract first image data features from the first face image data using the first deep network model, and acquire a first loss for classification based on the first image data features extracted by the first deep network model; a second loss acquisition unit, configured to determine the triplet loss corresponding to the first deep network model based on the first image data features, a third image data feature, and historical image data features pre-extracted by the first deep network model; a determination unit, configured to determine the total loss of the first deep network model based on the first loss and the triplet loss; and a first judgment unit, configured to determine that the first deep network model training is complete and the face recognition model is obtained when the total loss is less than a specified loss threshold.
[0019] In conjunction with the second embodiment of the second aspect, the third embodiment of the second aspect further includes: a second determination unit, configured to adjust the first network parameters by performing stochastic gradient descent processing on the weight parameters of the first network parameters in the first deep network model based on the total loss if the total loss is greater than or equal to the specified loss threshold; and an adjustment unit, configured to train the first deep network model to extract first image data features of the first face image data using the second deep network model based on the adjusted first network parameters, until the total loss is less than the specified loss threshold.
[0020] In conjunction with the third embodiment of the second aspect, in the fourth embodiment of the second aspect, the adjustment unit includes: an adjustment subunit, configured to adjust the weight parameters of the second network parameters of the second deep network model by performing an exponential moving average processing on the weight parameters of the second network parameters of the second deep network model according to the first network parameters adjusted by the first deep network model; and a training subunit, configured to train the first deep network model to extract first image data features from the first face image data according to the second network parameters adjusted by the second deep network model and the adjusted first network parameters.
[0021] In conjunction with the second embodiment of the second aspect, in the fifth embodiment of the second aspect, the first loss acquisition unit includes: a first loss acquisition subunit, used to acquire a first loss for classification based on the first image data features extracted from the first deep network model by using a flexible maximum activation function with increased intervals.
[0022] In conjunction with any one of the first to fifth embodiments of the second aspect, in the sixth embodiment of the second aspect, the historical image data features are the first image data features of the first face image data corresponding to other face categories pre-extracted by the first deep network model.
[0023] According to a third aspect, embodiments of the present invention also provide a computer device, including a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the face recognition method of any one of the first aspect and its optional embodiments.
[0024] According to a fourth aspect, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions for causing the computer to perform the face recognition method of the first aspect and any of its optional embodiments. Attached Figure Description
[0025] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0026] Figure 1 This is a flowchart of a face recognition method according to an exemplary embodiment.
[0027] Figure 2 This is a flowchart of a face recognition model training method proposed according to an exemplary embodiment.
[0028] Figure 3 This is a flowchart of another face recognition model training method proposed according to an exemplary embodiment.
[0029] Figure 4 This is a flowchart of yet another face recognition model training method proposed according to an exemplary embodiment.
[0030] Figure 5 This is a structural block diagram of a face recognition device according to an exemplary embodiment.
[0031] Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an exemplary embodiment. Detailed Implementation
[0032] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] In related technologies, semi-Siamese Training (SST) is used to train face recognition models, thereby avoiding model degradation or overfitting during training. However, this training method is not suitable for training with long-tail face datasets. If long-tail face datasets are used, the face recognition model is prone to overfitting due to the dominance of head data (i.e., face categories with a large number of images). At the same time, the lack of tail data causes the model to collapse in the feature space dimension of the tail data (i.e., a large number of zeros in the feature dimension), making it difficult to achieve ideal feature learning and thus affecting the generalization performance of the entire deep model.
[0034] To address the aforementioned problems, this invention provides a face recognition method for use in a computer device. It should be noted that the executing entity can be a face recognition device, which can be implemented as part or all of a storage device through software, hardware, or a combination of both. The computer device can be a terminal, client, or server. The server can be a single server or a server cluster composed of multiple servers. In this embodiment, the terminal can be a smartphone, personal computer, tablet computer, wearable device, or other intelligent hardware device such as a smart robot. The following method embodiments will use a computer device as the executing entity for illustration.
[0035] The computer device in this embodiment of the invention is applied to a scenario where face recognition detection is performed on face images of unknown face categories. The face recognition method provided by this invention uses a pre-set face recognition model trained on a supervised model based on a long-tail face dataset. This model possesses sufficient generalization ability, enabling it to fully extract facial features from face images of unknown face categories, thereby improving the accuracy of face recognition and helping to reduce false recognition.
[0036] Figure 1 This is a flowchart illustrating a face recognition method according to an exemplary embodiment. Figure 1 As shown, the face recognition method includes the following steps S101 to S102.
[0037] In step S101, the face image to be identified is acquired.
[0038] In this embodiment of the invention, the face image to be identified can be understood as an image for which the specific face category is not clearly defined. Different people's faces correspond to different face categories. For example, the face of person A and the face of person B are two different face categories. In one example, for ease of recording, each face category can be recorded and distinguished in the form of an identity document (id). For example, id1 corresponds to the first face category, id2 corresponds to the second face category.
[0039] In step S102, the face image is input into a pre-trained face recognition model for feature extraction. By comparing the face image features with those of multiple known face categories, the face category corresponding to the face image is determined.
[0040] In this embodiment of the invention, the pre-trained face recognition model is a deep network model trained by supervised model based on a long-tail face dataset. During the training process, it can fully learn face features, so that the face recognition model can avoid the defect of insufficient face tail data affecting the generalization performance of the face model. Therefore, when performing face feature recognition, it can fully extract the face features of the face image, so that when comparing with the face image features of multiple known face categories, it can improve the accuracy of face recognition and reduce the occurrence of false recognition.
[0041] Through the above embodiments, when extracting features from face images of unknown face categories based on a pre-set face recognition model, the facial features of the face image can be fully extracted, thereby improving the accuracy of face recognition and reducing the occurrence of misidentification.
[0042] In this invention, the supervised model includes a first deep network model and a second deep network model. The first and second deep network models have the same model structure but different network parameters. The second deep network model guides and supervises the first deep network model in training on a long-tail face dataset, thereby obtaining a face recognition model. In one example, the first deep network model can be understood as a student model, and the second deep network model as a teacher model with the same model structure but different network parameters. In another example, the first deep network model can be understood as a discriminative model, and the second deep network model as a generative model. During training, the second deep network model generates new face image data to guide and supervise the first deep network model in learning face features, thereby increasing the amount of face image data used for training by face categories. This avoids the obstacle of tail face categories lacking intra-class diversity to the optimization of the face recognition model, thus improving the model's generalization ability. This allows for improved face recognition accuracy when the trained face recognition model is subsequently used for training. The tail face category can be understood as a face category with less face image data used for training.
[0043] The following examples will illustrate the training process of a face recognition model.
[0044] Figure 2 This is a flowchart illustrating a face recognition model training method according to an exemplary embodiment. Figure 2 As shown, the face recognition model training method includes the following steps.
[0045] In step S201, based on the long-tail face dataset, the first face image data and the second face image data corresponding to the same face category are obtained.
[0046] In this embodiment of the invention, the long-tail face dataset is used for training face recognition. In this long-tail face dataset, the number of face images corresponding to different face categories varies. Some face categories have abundant face image data and diverse inliers; others have scarce face image data and relatively homogeneous inliers. If the long-tail face dataset is directly input into a deep network model for training, the face recognition model is easily dominated by face categories with abundant inliers during training, leading to overfitting. Consequently, when training on face categories with scarce inliers, the feature space collapses (i.e., a large number of zeros appear in the feature dimension), affecting the final learning result of the face recognition model.
[0047] Therefore, to avoid the above situation, during training, the first and second face image data corresponding to each face category are obtained from the multiple face image data included in each face category. The first and second face image data can be understood as two different image data for the same face category. For example, they are two different face image data taken from different angles.
[0048] In step S202, the second face image data is augmented to obtain the third face image data.
[0049] In this embodiment of the invention, to enhance the difference in facial features between the first and second face image data, augmentation processing is performed on the second face image data to obtain the augmented third face image data. This helps ensure that the features of the third image data and the features of the first image data satisfy the consistency principle during feature extraction. The augmentation processing can include any of the following methods: rotation, translation, scaling, color inversion, contrast adjustment, etc., and is not limited in this invention. The consistency principle can include the following: for an input, even if it is perturbed, the network can still produce an output consistent with the original, with the output result being approximately the same or having a close vector distance.
[0050] In step S203, the third image data features of the third face image data are extracted through the second deep network model.
[0051] In this embodiment of the invention, the second deep network model is a deep network model used to guide and supervise the training of the first deep network model, and is trained simultaneously with the first deep network model during the training process.
[0052] The third face image data is input into the second deep network model for feature extraction, so as to obtain the third image data features used to enrich the in-class features of the face category. This way, when training the first deep model later, the lack of in-class diversity of the tail face category can be avoided as an obstacle to the optimization of the face recognition model.
[0053] In step S204, based on the third image data features and the historical image data features pre-extracted by the first deep network model, the first deep network model is trained to extract the first image data features of the first face image data, thereby obtaining a face recognition model.
[0054] In this embodiment of the invention, the historical image data features are the first image data features pre-extracted by the first deep network model corresponding to other face categories in the first face image data. By using historical image data features, the first deep network model can increase the feature distance between the first image data features corresponding to different face categories when extracting the first image data features, thereby highlighting the differences between the first image data features corresponding to different face categories. By using third image data features, the first deep network model can reduce the feature distance between the first image data features corresponding to the same face category when extracting the first image data features, thereby weakening the differences between the first image data features corresponding to the same face category.
[0055] Therefore, in the process of training the first deep network model to extract the first image data features of the first face image data, training based on the features of historical image data and the features of the third image data helps the first deep network model to learn face features reasonably even when there is a small amount of face image data used for training, thereby enhancing the generalization ability of the first deep network model.
[0056] Through the above embodiments, the second deep network model generates new face image data to guide and supervise the first deep network model in learning face features, thereby increasing the amount of face image data used for training by face categories. This helps to avoid the obstacles that tail face categories with insufficient intra-class diversity pose to the optimization of face recognition models, thus improving the model's generalization ability.
[0057] In one implementation scenario, before inputting the first face image data into the first deep network model and before inputting the third face image data into the second deep network model, the first face image data and the third face image data are normalized respectively, so that the first deep network model and the second deep network model can fully extract the face features.
[0058] In one embodiment, the training process for training the first deep network model to extract the first image data features of the first face image data based on the third image data features and the historical image data features pre-extracted by the first deep network model can be as follows: Figure 3 As shown. Figure 3 This is a flowchart of another face recognition model training method proposed according to an exemplary embodiment.
[0059] In step S301, the first image data features of the first face image data are extracted through the first deep network model, and the first loss is obtained for classification based on the first image data features extracted by the first deep network model.
[0060] In this embodiment of the invention, the first deep network model is a network model used for feature extraction. Through the output of this first deep network model, the extracted first image data features can be obtained, but the corresponding face category cannot be determined. Therefore, it is also impossible to determine whether the first deep network model has completed learning the first image data features corresponding to the current face category. Therefore, during the training process of the first deep network model to extract the first image data features of the first face image data, the output first image data features are classified, and a first loss for this classification is calculated and determined. This first loss is used to determine the training progress of the first deep network model.
[0061] In one embodiment, the first loss is calculated using an am-softmax loss with increasing intervals. The formula is as follows:
[0062]
[0063] The specific calculation process is the same as that of existing technology, and will not be described in detail here.
[0064] In step S302, the triplet loss corresponding to the first deep network model is determined based on the first image data features, the third image data features, and the historical image data features pre-extracted by the first deep network model.
[0065] In this embodiment of the invention, in order to enable the first deep network model to fully learn facial features and achieve reasonable convergence during the training process, during the adjustment of the network parameters of the first deep network model, based on the acquired first image data features, third image data features and historical image data features pre-extracted by the first deep network model, the triplet loss corresponding to the first deep network model is determined through the triplet loss function, and the triplet loss is used as the consistency loss to measure the consistency of the output results between the first deep network model and the second deep network model.
[0066] The triplet loss function is formulated as follows: L = max(d(a, p) - d(a, n) + m, 0), where d(x, y) represents the feature distance between x and y, such as cosine distance or Euclidean distance. If calculating Euclidean distance, then d(x, y) = ||xy||². a represents the feature value of the first image data feature, p represents the feature value of the third image data feature, and n represents the feature value of the historical image data feature. m represents the margin, typically set between 0.25 and 0.5.
[0067] In step S303, the total loss of the first deep network model is determined based on the first loss and the triplet loss.
[0068] In this embodiment of the invention, the total loss of the first deep network model is the sum of the first loss and the triplet loss. Therefore, when determining the adjustment direction of the network parameters of the first deep network model, the first deep network model can be reasonably adjusted based on the total loss. Thus, when iterating again, it can fully learn by combining the feature extraction process of historical image data.
[0069] In step S304, when the total loss is less than the specified loss threshold, the training of the first deep network model is completed, and the face recognition model is obtained.
[0070] In this embodiment of the invention, the specified loss threshold can be understood as the maximum loss threshold used to determine whether the first deep learning model has completed learning. If the total loss is less than the specified loss threshold, it indicates that the first image data features extracted by the first deep learning model can satisfy the characteristics expressing its corresponding face category, and thus it can be determined that the training of the first deep learning model is complete. If the total loss is greater than or equal to the specified loss threshold, it indicates that the first image data features extracted by the first deep learning model cannot yet effectively express its corresponding face category, and therefore, further training is still required.
[0071] Therefore, when the total loss is determined to be less than the specified loss threshold, the first deep network model can be considered to have been trained, and a face recognition model for face recognition can be obtained.
[0072] Through the above embodiments, when training the first deep network model, training can be based on the triplet loss function, which helps to avoid the situation where dimensionality collapse occurs in the feature space due to the lack of in-class diversity when there are few face image data for the face category.
[0073] In one embodiment, if the total loss is greater than or equal to a specified loss threshold, it indicates that the first image data features extracted by the first deep learning model cannot yet effectively represent the features of its corresponding face category. Therefore, the first deep network model is trained further by applying stochastic gradient descent (SGD) to the first network parameters to adjust their weights. Then, using a second deep network model and based on the adjusted first network parameters, the first deep network model is trained to extract the first image data features of the first face image data until the total loss is less than the specified loss threshold, thus ensuring the smooth training of the first deep network model.
[0074] In another embodiment, when training the first deep network model based on the adjusted first network parameters, the training also includes adjusting the second network parameters of the second deep network model. Based on the adjusted first network parameters of the first deep network model, the weights of the second network parameters of the second deep network model are adjusted using an exponential moving average (EMA). In one implementation scenario, the formula used for EMA processing is: Φ t =mΦ t +(1-m)Φ s , where Φ t Φ s These represent the weight parameters of the second deep network model and the network weight parameters of the first deep network model, respectively. Based on the adjusted second network parameters and the adjusted first network parameters, the first deep network model is trained to extract the first image data features from the first face image data. By adjusting the corresponding network parameters of the first and second deep network models in different ways, it helps to ensure that the first and second network parameters are always in different states. This ensures that there is always a difference between the obtained first and third image feature data, thus effectively avoiding degradation phenomena on the face tail image dataset when training the first deep network model subsequently.
[0075] In one implementation scenario, the process of training a face recognition model using a supervised model based on a long-tail face dataset can be as follows: Figure 4 As shown. Figure 4 This is a flowchart of yet another face recognition model training method proposed according to an exemplary embodiment.
[0076] First and second face image data corresponding to the same ID (face category) are obtained respectively. The first face image data is normalized and then input into the student model for feature extraction to obtain the features of the first image data. The first loss for classification based on the features of the first image data is calculated using am-softmax loss.
[0077] After image augmentation and normalization, the second face image data is input into the teacher model for feature extraction to obtain the features of the second image data.
[0078] Based on the first image data features, the second image data features, and the historical image data features pre-extracted by the student model, the triplet loss corresponding to the student model is determined. Based on the triplet loss and the first loss, the total loss corresponding to the student model is determined.
[0079] If the total loss is less than the specified loss threshold, training the student model is complete, resulting in a face recognition model. If the total loss is greater than or equal to the specified loss threshold, SGD processing is applied to the weight parameters of the first network in the student model to adjust the first network parameters. Based on the adjusted first network parameters, EMA processing is applied to the weight parameters of the second network in the teacher model to adjust the second network parameters. The above steps are repeated to continue training the student model until the total loss is less than the specified loss threshold, completing the training of the student model and obtaining the face recognition model.
[0080] By adopting the above approach, based on the consistency principle, a teacher model can be introduced to avoid the feature space collapse problem caused by the lack of intra-class diversity in face tail data during conventional face recognition training. At the same time, the features of augmented samples are preserved, which helps to alleviate the risk of overfitting. As a result, the face recognition model can have a high recognition accuracy in practical use.
[0081] Based on the same inventive concept, the present invention also provides a face recognition device.
[0082] Figure 5 This is a structural block diagram of a face recognition device according to an exemplary embodiment. Figure 5 As shown, the face recognition device includes an acquisition unit 501 and a recognition unit 502.
[0083] The acquisition unit 501 is used to acquire the face image to be identified.
[0084] The recognition unit 502 is used to input the face image into a pre-trained face recognition model for feature extraction, and to determine the face category corresponding to the face image by comparing it with the face image features of multiple known face categories.
[0085] Among them, the face recognition model is a deep network model trained by a supervised model based on a long-tail face dataset.
[0086] In one embodiment, the supervised model includes a first deep network model and a second deep network model. The first and second deep network models have the same model structure but different network parameters. The face recognition model is trained using the following units based on a long-tail face dataset through supervised model training: a data acquisition unit, used to acquire first and second face image data corresponding to the same face category based on the long-tail face dataset; a processing unit, used to augment the second face image data to obtain third face image data; an extraction unit, used to extract third image data features from the third face image data using the second deep network model; and a training unit, used to train the first deep network model to extract first image data features from the first face image data based on the third image data features and historical image data features pre-extracted by the first deep network model, thus obtaining the face recognition model.
[0087] In another embodiment, the training unit includes: a first loss acquisition unit, configured to extract first image data features from the first face image data using a first deep network model, and acquire a first loss for classification based on the first image data features extracted by the first deep network model; a second loss acquisition unit, configured to determine the triplet loss corresponding to the first deep network model based on the first image data features, a third image data feature, and historical image data features pre-extracted by the first deep network model; a determination unit, configured to determine the total loss of the first deep network model based on the first loss and the triplet loss; and a first judgment unit, configured to determine that the first deep network model training is complete and a face recognition model is obtained when the total loss is less than a specified loss threshold.
[0088] In another embodiment, the system further includes: a second determination unit, configured to adjust the first network parameters by performing stochastic gradient descent on the weight parameters of the first network parameters in the first deep network model based on the total loss if the total loss is greater than or equal to a specified loss threshold; and an adjustment unit, configured to train the first deep network model to extract first image data features of the first face image data using the second deep network model based on the adjusted first network parameters, until the total loss is less than the specified loss threshold.
[0089] In another embodiment, the adjustment unit includes: an adjustment subunit, configured to adjust the weight parameters of the second network parameters of the second deep network model by performing an exponential moving average processing on the weight parameters of the second network parameters of the second deep network model according to the first network parameters adjusted by the first deep network model; and a training subunit, configured to train the first deep network model to extract first image data features from the first face image data according to the second network parameters adjusted by the second deep network model and the adjusted first network parameters.
[0090] In another embodiment, the first loss acquisition unit includes: a first loss acquisition subunit, used to acquire a first loss for classification based on the first image data features extracted from the first deep network model by using a flexible maximum activation function with increased intervals.
[0091] In another embodiment, the historical image data features are the first image data features of the first face image data corresponding to other face categories, which are pre-extracted by the first deep network model.
[0092] The specific limitations and beneficial effects of the aforementioned face recognition device can be found in the limitations of the face recognition method described above, and will not be repeated here. Each of the above modules can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0093] Figure 6 This is a schematic diagram of the hardware structure of a computer device according to an exemplary embodiment. For example... Figure 6 As shown, the device includes one or more processors 610 and a memory 620, the memory 620 including persistent memory, volatile memory, and a hard disk. Figure 6 Taking a processor 610 as an example, the device may also include an input device 630 and an output device 640.
[0094] The processor 610, memory 620, input device 630, and output device 640 can be connected via a bus or other means. Figure 6 Taking the example of a connection between China and Israel via a bus.
[0095] Processor 610 can be a Central Processing Unit (CPU). Processor 610 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof. The general-purpose processor can be a microprocessor or any conventional processor.
[0096] The memory 620, as a non-transitory computer-readable storage medium, includes persistent memory, volatile memory, and a hard disk. It can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the business management method in this embodiment. The processor 610 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions, and modules stored in the memory 620, thereby implementing any of the above-mentioned face recognition methods.
[0097] The memory 620 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data that is needed and required. Furthermore, the memory 620 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 620 may optionally include memory remotely located relative to the processor 610, and these remote memories can be connected to the data processing device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0098] Input device 630 can receive input digital or character information, and generate key signal inputs related to user settings and function control. Output device 640 may include display devices such as a display screen.
[0099] One or more modules are stored in memory 620, and when executed by one or more processors 610, they perform actions such as... Figures 1-4 The method shown.
[0100] The above-described product can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in [reference 1]. Figures 1-4 The relevant descriptions in the illustrated embodiments.
[0101] This invention also provides a non-transitory computer storage medium storing computer-executable instructions that can execute the authentication method in any of the above method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.
[0102] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A face recognition method, characterized in that, The method includes: Acquire the image of the face to be identified; The face image is input into a pre-trained face recognition model for feature extraction. By comparing the face image features with those of multiple known face categories, the face category corresponding to the face image is determined. The face recognition model is a deep network model trained using a supervised model based on a long-tail face dataset. The supervised model includes a first deep network model and a second deep network model. The process involves: acquiring first and second face image data corresponding to the same face category from the long-tail face dataset; augmenting the second face image data to obtain third face image data; extracting third image data features from the third face image data using the second deep network model; and training the first deep network model to extract first image data features from the first face image data based on the third image data features and historical image data features pre-extracted by the first deep network model, thus obtaining the face recognition model. The historical image data features are first image data features pre-extracted by the first deep network model corresponding to other face categories in the first face image data. The method for determining the face recognition model includes: extracting first image data features from the first face image data using the first deep network model, and obtaining a first loss for classification based on the first image data features extracted by the first deep network model; determining the triplet loss corresponding to the first deep network model based on the first image data features, the third image data features, and historical image data features pre-extracted by the first deep network model; determining the total loss of the first deep network model based on the first loss and the triplet loss; and when the total loss is less than a specified loss threshold, the first deep network model is trained and the face recognition model is obtained.
2. The method according to claim 1, characterized in that, The first deep network model and the second deep network model have the same model structure but different network parameters.
3. The method according to claim 1, characterized in that, The method further includes: If the total loss is greater than or equal to the specified loss threshold, then the first network parameters are adjusted by performing stochastic gradient descent on the weight parameters of the first network parameters in the first deep network model based on the total loss. Using the second deep network model, and based on the adjusted first network parameters, the first deep network model is trained to extract the first image data features of the first face image data until the total loss is less than the specified loss threshold.
4. The method according to claim 3, characterized in that, The step of training the first deep network model to extract the first image data features of the first face image data using the second deep network model based on the adjusted first network parameters includes: Based on the first network parameters adjusted from the first deep network model, the weight parameters of the second network parameters of the second deep network model are processed by exponential moving average to adjust the second network parameters. Based on the adjusted second network parameters and the adjusted first network parameters of the second deep network model, the first deep network model is trained to extract the first image data features of the first face image data.
5. The method according to claim 1, characterized in that, The first loss for classification based on the first image data features extracted by the first deep network model includes: By increasing the interval of the flexible maximum activation function, a first loss is obtained for classifying the first image data features extracted from the first deep network model.
6. A face recognition device, characterized in that, The device includes: The acquisition unit is used to acquire the face image to be identified; The recognition unit is used to identify the face category corresponding to the face image data in face image data with multiple known face categories through a pre-trained face recognition model, and to determine the face category as the category of the face image data; The face recognition model is a deep network model trained using a supervised model based on a long-tail face dataset. The supervised model includes a first deep network model and a second deep network model. The face recognition model employs the following units trained using a supervised model based on the long-tail face dataset: a data acquisition unit, used to acquire first and second face image data corresponding to the same face category from the long-tail face dataset; a processing unit, used to augment the second face image data to obtain third face image data; an extraction unit, used to extract third image data features from the third face image data using the second deep network model; and a training unit, used to train the first deep network model to extract first image data features from the first face image data based on the third image data features and historical image data features pre-extracted by the first deep network model, thus obtaining the face recognition model. The supervised model includes a first deep network model and a second deep network model, and the historical image data features are first image data features pre-extracted by the first deep network model corresponding to other face categories in the first face image data. The training unit includes: a first loss acquisition unit, used to extract first image data features from the first face image data through the first deep network model, and acquire a first loss for classification based on the first image data features extracted by the first deep network model; a second loss acquisition unit, used to determine the triplet loss corresponding to the first deep network model based on the first image data features, the third image data features, and the historical image data features pre-extracted by the first deep network model; a determination unit, used to determine the total loss of the first deep network model based on the first loss and the triplet loss; and a first judgment unit, used to determine that the first deep network model training is complete and a face recognition model is obtained when the total loss is less than a specified loss threshold.
7. A computer device, characterized in that, The device includes a memory and a processor, which are interconnected. The memory stores computer instructions, and the processor executes the computer instructions to perform the face recognition method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the face recognition method according to any one of claims 1-5.
Citation Information
Patent Citations
Face recognition method and device, electronic equipment and storage medium
CN110163169A