A deep face recognition method based on minimum margin loss function
By combining Softmax, center, and minimum margin loss functions, the Inception-ResNet-v1 model is optimized, which solves the margin bias problem of deep neural networks on imbalanced datasets and improves the accuracy of face recognition.
Patent Information
- Application Number
- CN202211461807.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-11-16
AI Technical Summary
Existing deep neural networks cannot effectively solve the gap bias problem when dealing with imbalanced datasets, which limits the performance of face recognition.
By combining the Softmax loss function, the center loss function, and the minimum margin loss function, the Inception-ResNet-v1 model is used to optimize intra-class compactness and inter-class separation using the minimum margin loss function, and the Tensorflow framework is used for training and testing.
It significantly improves the technical performance of facial recognition, reduces the negative impact of interval bias, and achieves higher recognition accuracy.
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of face recognition, and particularly, a deep face recognition method based on minimum margin loss function is designed. BACKGROUND
[0002] In recent years, the rapid development of deep neural networks has made great success in face recognition. Different loss functions can be used in deep neural networks, resulting in different performance. Some loss functions have been proposed recently, which improve the technical level. However, they cannot solve the problem of interval bias in unbalanced data sets, that is, the so-called long-tail distribution. Therefore, it is still necessary to propose a deep face recognition method based on minimum margin loss. SUMMARY
[0003] The present application aims to overcome the above-mentioned problems in the prior art, and provides a deep face recognition method based on minimum margin loss function. The present application combines the advantages of Softmax loss function, Center loss function and Minimum Margin Loss function, wherein the Center loss is used to enhance the intra-class compactness, and the Softmax loss and Minimum Margin Loss are used to improve the inter-class separation. Experimental results show that the proposed Minimum Margin Loss makes the technical performance of face recognition reach a new height, and reduces the negative impact of interval bias.
[0004] To achieve the above-mentioned purpose, the technical scheme adopted by the present application is as follows:
[0005] A deep face recognition method based on minimum margin loss function, characterized in that it comprises the following steps:
[0006] S1, preparing a data set, wherein the data set does not contain face images that may overlap with the reference data set;
[0007] S2, building a network model based on Inception-ResNet-vl model using Tensorflow framework;
[0008] S3, inputting the pictures in the training set in the data set into the network model for training;
[0009] S4, inputting the pictures in the test set in the data set into the trained network model to recognize face images
[0010] In step S1, the data set is VGGFace2, and all face images that may overlap with the reference data set are deleted. Since the label noise in VGGFace2 is very low, no data cleaning is performed.
[0011] In the step S1, the MTCNN is applied to all face images for landmark localization, face alignment and face detection. If face detection fails on a training image, it is discarded directly; if it fails on a test image, the provided landmarks are used instead. All training and test images are cropped to 160*160 RGB images. Random horizontal flips are applied to training images, and the features of the original test image and the flipped image are concatenated as the final features.
[0012] In the step S2, the batch size is set to 90, the embedding size is set to 512, the weight decay is set to 5e-4, the keep probability of the fully connected layer is set to 0.4, the total number of iterations t is set to 275,000, and the learning rate μ t is set to 0.05, and is divided by 10 every 100,000 iterations.
[0013] In the step S2, the total loss is L = L S + αL C + βL M , the class center positions updated by the center loss are reused, and the minimum margin loss filters all pairs of class centers according to the specified minimum margin. For those pairs of class centers with a distance less than the threshold, the corresponding penalty is added to the loss value. Wherein α and β are hyperparameters for adjusting the influence of the center loss and the minimum margin loss, L S is the Sofftmax loss, L C is the center loss, and L M is the minimum margin loss.
[0014] In the step S2, the detailed description of the minimum margin loss is as follows: Wherein K is the class number of a batch, c i and c i are the class centers of the i-th and j-th classes, and M is the specified minimum margin. In each training batch, the class centers are updated by the center loss, and are calculated and updated using the formula and , wherein γ is the learning rate of the class center, t is the number of iterations, and δ(condition) is a conditional function. When the condition is met, δ(condition) = 1, otherwise δ(condition) = 0.
[0015] In the step S4, during the test, the parameters that can bring the highest performance are set. The hyperparameters α and β are set to 5e-5 and 5e-8 respectively, and the minimum margin M of the minimum margin loss function is set to 280. The deep features of each image come from the output of the fully connected layer, and the features of the original test image and the corresponding flipped image are concatenated. The feature size of each image is 2*512 dimensions.
[0016] The beneficial effects of the present application include:
[0017] The deep face recognition method based on minimum margin loss function proposed in the present application is the first method considering setting minimum margin loss function between different classes. The proposed loss function is easy to implement in CNN, and our CNN model can be directly optimized by standard SGD. Extensive experiments are carried out on seven publicly available datasets. We compare the face recognition model trained based on the minimum margin loss function with the methods published in top conferences and journals in recent years. We also directly compare the minimum margin function and other related loss functions in the same framework. The results show that the deep face recognition method based on the minimum margin loss function has the most advanced performance. DETAILED DESCRIPTION
[0018] The present application discloses a deep face recognition method based on minimum margin loss function, which comprises the following steps:
[0019] S1, preparing a dataset, which does not contain face images that may overlap with the benchmark dataset.
[0020] In the step, the dataset is the dataset VGGFace2, and all face images that may overlap with the benchmark dataset are deleted to ensure the reliability and accuracy of the experimental results. Since the label noise in VGGFace2 is very low, no data cleaning is performed. The final training dataset contains 305 million face images of 8 thousand identities.
[0021] MTCNN is applied to all face images for landmark positioning, face alignment and face detection. If face detection fails on the training image, it is directly discarded; if it fails on the test image, the provided landmark is used instead. All training and test images are cropped to 160*160 RGB images. Random horizontal flipping is performed on the training images, and the features of the original test images and the horizontally flipped images are concatenated as the final features.
[0022] S2, building a network model based on Inception-ResNet-v1 model using Tensorflow framework.
[0023] In the step, the batch size is set to 90, the embedding size is set to 512, the weight decay is set to 5e-4, the keep probability of the fully connected layer is set to 0.4, the total number of iterations t is set to 275,000, and the learning rate μ t is initially 0.05, and is divided by 10 every 100,000 iterations.
[0024] The total loss is set to L=L S +αL C +βLM The minimum margin loss filters all pairs of class centers according to the specified minimum margin by reusing the updated class center positions of the center loss. For those pairs of class centers with distance less than the threshold, the corresponding penalty is added to the loss value. Wherein α and β are hyperparameters to adjust the influence of the center loss and the minimum margin loss, L S is the Softmax loss, L C is the center loss, L M is the minimum margin loss.
[0025] The detailed description of the minimum margin loss is Wherein K is the class number of a batch, c i and c j are the class centers of the i-th and j-th classes respectively, and M is the specified minimum margin. In each training batch, the class centers are updated by the center loss using the formula and are calculated and updated, wherein γ is the learning rate of the class center, t is the iteration number, and δ(condition) is a conditional function. When the condition is met, δ(condition) = 1, otherwise δ(condition) = 0.
[0026] S3, input the pictures of the training set in the data set into the network model for training;
[0027] S4, input the pictures of the test set in the data set into the trained network model to identify the face image.
[0028] In the step, the parameters that can bring the highest performance are set, the hyperparameters α and β are set to 5e-5 and 5e-8 respectively, and the minimum margin M of the minimum margin loss function is set to 280. The deep features of each image come from the output of the full connection layer, and the features of the original test image are connected with the features of the corresponding image horizontally flipped. The feature size of each image is 2*512 dimensions.
Claims
1. A deep face recognition method based on a minimum margin loss function, characterized in that, The method comprises the following steps: S1, preparing a data set, wherein the data set does not contain face images overlapping with a benchmark data set; S2, building a network model based on an Inception-ResNet-v1 model by using a Tensorflow framework; S3, inputting pictures in a training set in the data set into the network model for training; S4, inputting pictures in a test set in the data set into the trained network model to identify face images; The total loss in step S2 is The minimum margin loss filters all class center pairs according to the specified minimum margin by reusing the updated class center positions of the center loss; for those class center pairs whose distance is less than the threshold, the corresponding penalty is added to the loss value, where α and β are hyperparameters that adjust the influence of the center loss and the minimum margin loss, is the Softmax loss, is the center loss, is the minimum margin loss; Detailed description of minimum margin loss is where K is the class number of a batch, and are the class centers of the i-th and j-th classes, respectively, and M is the specified minimum margin; In each training batch, the class centers are updated by center loss using the formula and are computed and updated, where γ is the learning rate for class centers, t is the iteration number, δ(condition) is a condition function; δ(condition) = 1 when the condition is satisfied, otherwise δ(condition) = 0. 2.The deep face recognition method based on minimum margin loss function of claim 1, wherein: In the step S1, the data set is a data set VGGFace2, all face images overlapping with the benchmark data set are deleted, and no data cleaning is performed. 3.The deep face recognition method based on minimum margin loss function of claim 1, wherein: The step S1 of preparing the data set specifically comprises: S1-1, applying MTCNN to all face images to perform benchmark point positioning, face alignment and face detection; S1-2, if face detection fails on a training image, the training image is directly discarded; if face detection fails on a test image, a provided benchmark point is used instead; S1-3, all training and test images are cropped into 160*160 RGB images; S1-4, the training images are randomly horizontally flipped, and features of the original test images and the horizontally flipped images are concatenated to serve as final features. 4.The deep face recognition method based on minimum margin loss function of claim 1, wherein: In the step S2, the batch size is set to 90, the embedding size is set to 512, the weight decay is set to 5e-4, the keep probability of the full connection layer is set to 0.4, the total iteration number t is set to 275,000, and the learning rate is initially set to 0.05 and is divided by 10 every 100,000 iterations.
5. The deep face recognition method based on minimum margin loss function according to claim 1, wherein: In the step S4, the hyperparameters α and β are respectively set as 5e-5 and 5e-8, a minimum interval M of a minimum interval loss function is set as 280; depth features of each image come from an output of a full connection layer, features of the original test images and corresponding features of the horizontally flipped images are concatenated, and the feature size of each image is 2*512 dimensions.
Citation Information
Patent Citations
Deep neural network facial expression recognition method based on dynamic target training
CN111160189A
Human face composite emotional expression recognition method and system
CN112070058A