A face recognition model training method and system
By preprocessing data and constructing networks for face recognition models, and combining encoding/decoding and transfer learning methods, the encoding network parameters are optimized, which solves the recognition bias problem caused by class imbalance and improves the recognition accuracy and generalization ability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 杭州半云科技有限公司
- Filing Date
- 2022-11-30
- Publication Date
- 2026-05-19
AI Technical Summary
Existing face recognition models suffer from large biases and low recognition accuracy when class imbalance occurs, especially on small sample datasets. Furthermore, existing optimization methods require large amounts of data, resulting in insufficient model generalization ability.
By preprocessing the dataset, dividing it into large and small sample datasets, constructing encoding and decoding networks, optimizing the encoding network parameters using reconstruction regression, enriching the small sample features through transfer learning, constructing triplet feature samples to train the fine-grained network, and optimizing the model using adaptive gradient descent.
It improves the recognition accuracy and generalization ability of the face recognition model, can correctly match and recognize profile face images, reduces errors caused by data imbalance, and improves the model's recognition accuracy and adaptability.
Smart Images

Figure CN116051920B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a training method and system for a face recognition model. Background Technology
[0002] Face recognition technology is one of the fundamental and long-standing research topics in computer vision. With the development of deep convolutional neural networks and large-scale datasets, deep learning-based face recognition technology has made unprecedented progress and is widely applied to real-life needs. Given a pair of image or video frames as input, a face recognition neural network outputs facial features, thereby achieving face recognition.
[0003] While current face recognition methods based on neural network models can achieve good detection results, the weight files obtained from training the models are large, resulting in a huge number of parameters and computational costs, leading to long processing times. Furthermore, previous deep neural network face recognition algorithms required training with large datasets of face samples to achieve good recognition results. However, when the number of training samples for a single category is small, the model lacks the ability to represent a limited number of face images, reducing recognition accuracy. Most publicly available face datasets, such as WiderFace, MegaFace, LFW, and MS1MV2, exhibit severe class imbalance, i.e., a long-tail effect. From an ethnic perspective, Caucasians and Greater Caucasians dominate, accounting for approximately 72% of the dataset, while East Asians and Black Africans account for approximately 8%. From an age perspective, data from the 17-46 age group dominates, accounting for approximately 65%. From a facial image perspective, frontal view data accounts for approximately 52%, half-face view data accounts for approximately 16%, and oblique side view data accounts for approximately 32%. The aforementioned imbalances in the distribution of data categories result in the Arcface model, based on this data, being a biased estimation model.
[0004] Moreover, most face recognition models are optimized and trained by adding a regularization factor to the softmax cost function. This method has two drawbacks: 1) It requires a large dataset and a large number of face samples in each face ID, otherwise the trained model will have difficulty having good generalization ability; 2) When there is a large number of class imbalances in the data, the model trained in this way often has a large bias, resulting in poor accuracy on data with fewer classes. Summary of the Invention
[0005] Based on the above analysis, the embodiments of the present invention aim to provide a training method and system for a face recognition model to solve the problem of large bias in existing face recognition models caused by class imbalance.
[0006] On one hand, embodiments of the present invention provide a method for training a face recognition model, comprising the following steps:
[0007] The face dataset was preprocessed and divided into large-sample and small-sample datasets;
[0008] Construct encoding and decoding networks, and train them based on a large sample dataset. Extract features from the face dataset using the trained encoding network and add them to the feature set. Transfer the features from the large sample face dataset to the features from the small sample face dataset and update the feature set.
[0009] A fine-grained network is constructed. Based on the updated feature set, triplet feature samples are constructed, and the fine-grained network is trained using the triplet function as the loss function. The trained encoding network and the fine-grained network constitute the face recognition model.
[0010] Based on further improvements to the above method, the face dataset is preprocessed, including:
[0011] The RetinaFace facial landmark detection model was used to detect landmarks in facial images in the face dataset and obtain the coordinates of the landmarks. The landmarks include: left eye, right eye, left corner of mouth, right corner of mouth and nose.
[0012] By horizontally flipping a face image, the coordinates of key points after the flip are obtained;
[0013] Calculate the absolute distance between the coordinates of each key point in each face image and the coordinates of the corresponding key point after flipping, and sum them to obtain the difference value of each face image before and after flipping.
[0014] Filter out face images with a difference value greater than the difference threshold to obtain the preprocessed face dataset.
[0015] Based on the further improvement of the above method, the encoding network includes multiple bottleneck layers, one flattening layer, and one fully connected layer. The first bottleneck layer includes three convolutional layers, and the other bottleneck layers include four convolutional layers. Each convolutional layer includes one convolution operation, one batch normalization, and one linear rectifier. The input of the encoding network is sample data in M×M×3 format, where 96≤M≤168. The output of the encoding network is an N×1 feature vector, where 256≤N≤320.
[0016] Based on the further improvement of the above method, the decoding network includes one fully connected layer, one reshape layer, and multiple upsampling layers. The number of upsampling layers in the decoding network is the same as the number of bottleneck layers in the encoding network. Each upsampling layer includes one transposed convolutional layer and three convolutional layers.
[0017] Based on further improvements to the above method, the fine-grained network is a multi-layer structure, with each layer consisting of a fully connected layer, a batch normalizer, and a linear rectifier.
[0018] Further improvements to the above method involve training the encoder and decoder networks using a large sample dataset, including:
[0019] Combine the encoding and decoding networks into a reconstructed network and set the initial network parameters;
[0020] Based on a large sample dataset, the L2 regression function is used as the loss function, and the SGD stochastic gradient descent method is used to optimize and reconstruct the network parameters. After training, the determined encoding network model parameters are obtained.
[0021] Based on the above method, further improvements are made to extract the features of the face dataset from the trained encoding network and put them into the feature set. That is, each sample from the large sample face dataset and the small sample face dataset in the preprocessed face dataset is input into the trained encoding network, and the resulting feature vector is used as the feature of the corresponding large sample face dataset or the small sample face dataset and put into the feature set.
[0022] Further improvements to the above method involve transferring features from a large-sample face dataset to features from a small-sample face dataset, including:
[0023] Based on the features of a large sample face dataset, calculate the mean of the feature vectors of each class of samples, and construct the covariance matrix of the large sample.
[0024] PCA is used to reduce the dimensionality of the covariance matrix, and the first S eigenvectors are taken to obtain the feature matrix;
[0025] Based on the feature matrix and the features of the large-sample face dataset, the following formula is used to perform transfer learning on the features of each small-sample face dataset:
[0026] z jk =u jp +QQ T (z lq -u lr )
[0027] Among them, z jk Let u be the feature vector of the k-th sample in the j-th class of the small sample dataset. jp Let z be the mean of the sample vectors of the j-th class in the small sample dataset. lq Let u be the feature vector of the q-th sample from the l-th class of a large dataset. lr Let be the mean of the l-th class sample vectors randomly selected from the large sample dataset, and Q be the feature matrix.
[0028] Based on further improvements to the above method, triplet feature samples are constructed according to the updated feature set, including:
[0029] The algorithm iterates through the feature set, taking a feature vector as an anchor point, and then taking a feature vector belonging to the same class as the current anchor point as a positive example. This positive example is then combined with the anchor point to form a binary pair. Finally, it iterates through the feature set and takes a feature vector belonging to a different class than the current anchor point. When the absolute value of the difference between the distance between feature vectors of the same class and the distance between feature vectors of different classes is less than the distance threshold, this feature vector is taken as a negative example and added to the current binary pair, thus constructing a triplet vector sample.
[0030] On the other hand, embodiments of the present invention provide a training system for a face recognition model, comprising:
[0031] The data preprocessing module is used to preprocess the face dataset and divide it into large sample datasets and small sample datasets;
[0032] The network training module is reconstructed to build the encoding and decoding networks. Based on a large sample dataset, the encoding and decoding networks are trained. The features of the face dataset are extracted from the trained encoding network and added to the feature set. The features of the large sample face dataset are transferred to the features of the small sample face dataset and the feature set is updated.
[0033] The face recognition model training module is used to build a fine-grained network. Based on the updated feature set, it constructs triplet feature samples and trains the fine-grained network using the triplet function as the loss function. The trained encoding network and the fine-grained network constitute the face recognition model.
[0034] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0035] 1. The parameters of the encoding network are optimized by using reconstruction regression and adaptive gradient descent optimization methods through encoding and decoding, so that the facial image features extracted from the encoding network have rich image semantic features;
[0036] 2. By using transfer learning, the semantics of images in small samples are enriched, and the error caused by data imbalance is reduced, so that the face recognition model can correctly match and recognize the side profile of the same person based on the frontal face image in a small sample, thereby improving the recognition accuracy.
[0037] 3. By training the encoding network and decryption network, the parameters of the encoding network are solidified. Then, based on the output of the encoding network, a fine-grained network is trained. By repeating these two stages, the overall face recognition model is optimized, so that the face recognition model has good generalization ability and high recognition accuracy.
[0038] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0039] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0040] Figure 1 This is a flowchart of a training method for a face recognition model in Embodiment 1 of the present invention;
[0041] Figure 2 This is a schematic diagram of the face recognition model in Embodiment 1 of the present invention. Detailed Implementation
[0042] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0043] Example 1
[0044] A specific embodiment of the present invention discloses a method for training a face recognition model, such as... Figure 1 As shown, it includes the following steps:
[0045] S11: Preprocess the face dataset and divide it into large sample dataset and small sample dataset.
[0046] It should be noted that face datasets can be obtained in real-world applications by detecting historical video images containing faces, or by collecting photos of people, or by using publicly available face datasets. Examples of publicly available face datasets include: WiderFace, MegaFace, LFW, MS1MV2, etc.
[0047] After obtaining the face dataset, preprocess the face dataset, including:
[0048] The RetinaFace facial landmark detection model was used to detect landmarks in facial images in the face dataset and obtain the coordinates of the landmarks. The landmarks include: left eye, right eye, left corner of mouth, right corner of mouth and nose.
[0049] By horizontally flipping a face image, the coordinates of key points after the flip are obtained;
[0050] Calculate the absolute distance between the coordinates of each key point in each face image and the coordinates of the corresponding key point after flipping, and sum them to obtain the difference value of each face image before and after flipping.
[0051] Filter out face images with a difference value greater than the difference threshold to obtain the preprocessed face dataset.
[0052] It should be noted that in many cases, using a completely profile face to identify a face ID can easily cause confusion, and even manual identification has a high probability of misidentification. This embodiment filters out most of the more skewed face images in this way, which greatly reduces the possibility of the network failing to converge during training due to these abnormal data.
[0053] Because face images collected in real-world applications often exhibit imbalanced categories and limited facial angles, in order to enable the trained face recognition model to adapt to these applications and possess high recognition accuracy and low error, the face dataset is preprocessed and then divided into large-sample and small-sample datasets based on the number of face images of the same person in each category. The specific face categories and division rules are determined according to the actual situation.
[0054] For example, face categories include: ethnicity, age, face image perspective, etc. If an ethnicity is selected, a large sample dataset is formed by selecting data from each ethnicity category with a number of face images of the same person >= 50, that is, each face ID contains more than 50 face images from different angles. A small sample dataset is formed by selecting ethnicity categories different from the large sample dataset and data from each ethnicity category with a number of face images of the same person < 5, that is, each face ID has at most 4 face images, mostly frontal.
[0055] It should be noted that large and small sample datasets can be further divided into training and test sets. The training set is used to train the network, while the test set is used to test the network's performance, preventing overfitting and undertraining of the network to the training dataset. This embodiment uses both training and test sets for network training, which are standard practices and will not be elaborated upon separately.
[0056] S12: Construct the encoding and decoding networks. Train the encoding and decoding networks based on the large sample dataset. Extract the features of the face dataset from the trained encoding network and put them into the feature set. Transfer the features of the large sample face dataset to the features of the small sample face dataset and update the feature set.
[0057] It should be noted that in this embodiment, the encoding network is used to extract features from face images, and the decoding network is used together with the encoding network to optimize the parameters of the encoding network using reconstruction regression and adaptive gradient descent optimization methods, so that the features output by the encoding network have rich image semantic features.
[0058] Specifically, the encoding network includes multiple bottleneck layers, one flatten layer, and one fully connected dense layer. The first bottleneck layer includes three convolutional layers, and the other bottleneck layers include four convolutional layers. Each convolutional layer includes one convolutional operation (conv), one batch normalization (batch normalization), and one linear rectifier (relu).
[0059] The input to the encoding network is the input to the entire face recognition model. The purpose of the encoding network is to encode and compress high-dimensional image data into a low-dimensional vector feature with rich image semantics. In this embodiment, the input to the encoding network is sample data in M×M×3 format, where 96≤M≤168; the output of the encoding network is an N×1 feature vector, where 256≤N≤320.
[0060] It's important to note that when the face size exceeds 168 pixels, adding more face pixels does not improve the model's feature vector representation ability; instead, it increases the number of model parameters, leading to slower inference performance. Conversely, a value below 96 will reduce the model's recognition accuracy. Since a low-dimensional feature vector needs to be output, the dimension of N cannot be too high, otherwise the compression purpose will be lost. When the model dimension is below 256, the variance of the feature vector statistics begins to decrease, thus reducing the richness of facial features contained in the feature vector. Therefore, a value of 320 is chosen as the upper bound for N, and 256 as the lower bound.
[0061] Preferably, since the kernel size in the convolution operator is typically chosen to be 7 or 3, M is selected as a number within the range (96, 168) that is divisible by 7 or 3. For example... Figure 2 As shown, the encoding network includes 4 bottleneck layers. The kernel size of the first convolutional layer in the first bottleneck layer is set to 7, and the kernel size of the other 4 convolutional layers in the bottleneck layer is set to 3, with only the first convolutional layer being downsampled by 1 / 2.
[0062] It should be noted that the purpose of the decoding network is to decode the output of the encoding network back into the original image output, and the final output feature vector is the same as the input of the encoding network. Although the output of the decoding network cannot completely recover the information of the original image after training, the purpose is not to recover the original image information, but to optimize the parameters of the encoding network by using reconstruction regression and adaptive gradient descent optimization methods through encoding and decoding, so that the output features of the encoding network have rich image semantic features.
[0063] Specifically, the decoding network includes one fully connected dense layer, one reshape layer, and multiple upsampling layers. The number of upsampling layers in the decoding network is the same as the number of bottleneck layers in the encoding network. Each upsampling layer includes one transposed convolutional layer and three convolutional layers.
[0064] For example, in Figure 2 In this model, a 6-layer encoding network and a 6-layer decoding network are constructed. The input of the encoding network is 112×112×3, where 112 and 112 represent the height and width of the image, respectively, and 3 represents the number of color gamut channels of the image, i.e., an RGB image; the output is 320×1; the output of the decoding network is 112×112×3.
[0065] Based on a large sample dataset, the encoding and decoding networks are trained, including: combining the encoding and decoding networks into a reconstruction network and setting initial network parameters; using the L2 regression function as the loss function and SGD stochastic gradient descent to optimize the reconstruction network parameters based on the large sample dataset, and obtaining the determined encoding network model parameters after training. Each sample from the preprocessed face dataset (both large and small sample datasets) is input into the trained encoding network, and the resulting feature vectors are used as the features of the corresponding large or small sample face datasets, and added to the feature set.
[0066] Because large-sample data contains images of the same face taken from multiple angles, and varies due to factors such as different hairstyles, age groups, and lighting conditions, the data samples are diverse. Therefore, transfer learning is used to transfer features from large-sample data to small-sample data, reducing recognition bias caused by data imbalance and enabling the correct matching and recognition of profile images of the same person based on frontal images. Specifically, the features transferred from the large-sample face dataset to the small-sample face dataset include:
[0067] ① Based on the features of the large-sample face dataset, calculate the mean of the feature vectors of each class of samples and construct the covariance matrix of the large sample.
[0068] It should be noted that this embodiment assumes that the feature vectors follow a Gaussian distribution. The arithmetic mean of each component of the feature vector for each class of samples is calculated to obtain the mean of the feature vector for each class of samples. The covariance matrix of the large sample is then constructed according to the following formula:
[0069]
[0070] Among them, u ir Let z be the mean of the i-th class sample vectors in a large dataset. ik Let be the feature vector of the k-th sample in the i-th class of the large sample dataset, m be the total number of samples in the i-th class of the large sample dataset, and n be the total number of sample classes in the large sample dataset.
[0071] ② Perform PCA dimensionality reduction on the covariance matrix and take the first S eigenvectors to obtain the eigenma matrix.
[0072] For example, if each sample feature vector is 320×1 and S is set to 100, the resulting feature matrix is 320×100.
[0073] ③ Based on the feature matrix and the features of the large-sample face dataset, perform transfer learning on the features of each small-sample face dataset using the following formula:
[0074] z jk =u jp +QQ T (z lq -u lr ) Formula (2)
[0075] Among them, z jk Let u be the feature vector of the k-th sample in the j-th class of the small sample dataset. jp Let z be the mean of the sample vectors of the j-th class in the small sample dataset. lq Let u be the feature vector of the q-th sample from the l-th class of a large dataset. lr Let be the mean of the l-th class sample vectors randomly selected from the large sample dataset, and Q be the feature matrix.
[0076] After transfer learning of each feature in a small sample face dataset, the feature set is updated.
[0077] Compared with existing technologies, this embodiment transfers the rich semantic features of large-sample images to the features of small samples, thereby improving the discriminative ability of subsequent fine-grained networks.
[0078] S13: Construct a fine-grained network. Based on the updated feature set, construct triplet feature samples and train the fine-grained network using the triplet function as the loss function. The trained encoding network and the fine-grained network constitute the face recognition model.
[0079] It should be noted that the encoding and decoding networks are first trained in step S12. After training, the parameters of the encoding network are fixed, and then the fine-grained network in this step is trained. The fine-grained network is used to enable the output features to separate different types of faces, so that the Euclidean distance between the facial feature vectors of the same person is small, and the Euclidean distance between the facial feature vectors of different people is large.
[0080] Specifically, the fine-grained network has a multi-layer structure, with each layer consisting of a fully connected dense layer, a batch normalization layer, and a ReLU linear rectifier.
[0081] For example, in Figure 2 In this fine-grained network, there is a two-layer structure. The first layer consists of a fully connected dense layer, followed by a batch normalization layer and a ReLU linear rectifier. The second layer is the same as the first layer, and it outputs a feature vector for face recognition.
[0082] It should be noted that the updated feature set includes features from both the large-sample face dataset and the small-sample face dataset after transfer learning. Based on the updated feature set, triplet feature samples are constructed, including:
[0083] The algorithm iterates through the feature set, taking a feature vector as an anchor point, and then taking a feature vector belonging to the same class as the current anchor point as a positive example. This positive example is then combined with the anchor point to form a binary pair. Finally, it iterates through the feature set and takes a feature vector belonging to a different class than the current anchor point. When the absolute value of the difference between the distance between feature vectors of the same class and the distance between feature vectors of different classes is less than the distance threshold, this feature vector is taken as a negative example and added to the current binary pair, thus constructing a triplet vector sample.
[0084] Specifically, the absolute value of the difference between the distances between feature vectors of the same class and the distances between feature vectors of different classes is less than a distance threshold, as expressed by the following formula:
[0085]
[0086]
[0087] Among them, z a For the current anchor point, z p As a current positive example, z n As the current counterexample, α represents the distance threshold, α>0, and norm(z) represents normalizing the feature z into a unit vector.
[0088] After constructing the triplet feature samples, they are input into the fine-grained network in the order of anchor point, positive example, and negative example, with the data volume in each batch being an integer multiple of 3. This yields the face feature vectors corresponding to the triplet feature samples. The fine-grained network is then trained using the triplet function as the loss function, and the fine-grained network parameters are optimized.
[0089] Specifically, the loss function is shown in the following equation:
[0090]
[0091] in, and α represents the feature vector output by the fine-grained network after the anchor point, positive example, and negative example in the r-th triplet feature sample are input into the network, R is the total number of triplet feature samples, and α is the distance threshold in formula (4).
[0092] After the fine-grained network is trained, the trained encoding network and the fine-grained network are combined to form a face recognition model for practical face recognition. Specifically, the preprocessed face image to be recognized is input into the trained face recognition model. The output feature vector has rich semantic features, which is compared with face feature vectors stored in a face image database. Based on the face image corresponding to the matched feature vector, the recognition result is obtained.
[0093] Compared with existing technologies, this embodiment provides a face recognition model training method that optimizes the encoding network parameters using reconstruction regression and adaptive gradient descent optimization methods through encoding and decoding. This results in face image features extracted from the encoding network possessing rich image semantic features. Through transfer learning, the semantics of small sample images are enriched, reducing errors caused by data imbalance. This enables the face recognition model to correctly match and recognize profile face images of the same person based on small sample frontal face images, improving recognition accuracy. By training the encoding and decryption networks, the encoding network parameters are solidified. Then, based on the output of the encoding network, a fine-grained network is trained. By repeating these two stages, the overall face recognition model is optimized, giving the face recognition model good generalization ability and high recognition accuracy.
[0094] Example 2
[0095] Another embodiment of the present invention discloses a training system for a face recognition model, thereby implementing the face recognition model training method in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. The system includes:
[0096] The data preprocessing module is used to preprocess the face dataset and divide it into large sample datasets and small sample datasets;
[0097] The network training module is reconstructed to build the encoding and decoding networks. Based on a large sample dataset, the encoding and decoding networks are trained. The features of the face dataset are extracted from the trained encoding network and added to the feature set. The features of the large sample face dataset are transferred to the features of the small sample face dataset and the feature set is updated.
[0098] The face recognition model training module is used to build a fine-grained network. Based on the updated feature set, it constructs triplet feature samples and trains the fine-grained network using the triplet function as the loss function. The trained encoding network and the fine-grained network constitute the face recognition model.
[0099] Since the training system for a face recognition model in this embodiment and the aforementioned training method for a face recognition model can be mutually referenced, this description is redundant and will not be repeated here. Because this system embodiment shares the same principle as the aforementioned method embodiment, it also possesses the corresponding technical effects of the aforementioned method embodiment.
[0100] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0101] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for training a face recognition model, characterized in that, Includes the following steps: The preprocessed face dataset is divided into a large-sample dataset and a small-sample dataset based on the number of face images of the same person in each category; the categories include: ethnicity, age, and face image perspective. Construct encoding and decoding networks, and train them based on a large sample dataset. Extract features from the trained encoding network into a feature set. Transfer the features from the large sample face dataset to the features from the small sample face dataset, and update the feature set. The transfer of features from the large sample face dataset to the small sample face dataset includes: calculating the mean of the feature vectors for each class of samples based on the features of the large sample face dataset, and constructing the covariance matrix of the large sample; performing PCA dimensionality reduction on the covariance matrix, and taking the first S feature vectors to obtain the feature matrix; and performing transfer learning on the features of each small sample face dataset using the following formula based on the feature matrix and the features of the large sample face dataset: , in, For the first in a small sample dataset In the class of samples, the first The feature vector of each sample For the first in a small sample dataset Class sample vector mean, The first one randomly selected from the large sample dataset The first class of samples The feature vector of each sample The first one randomly selected from the large sample dataset Class sample vector mean, The characteristic matrix; A fine-grained network is constructed. Based on the updated feature set, triplet feature samples are constructed, and the fine-grained network is trained using the triplet function as the loss function. The trained encoding network and the fine-grained network constitute the face recognition model.
2. The training method for the face recognition model according to claim 1, characterized in that, The preprocessed face dataset includes: The RetinaFace facial landmark detection model was used to detect landmarks in facial images in the facial dataset and obtain the coordinates of the landmarks. The landmarks include: left eye, right eye, left corner of mouth, right corner of mouth and nose. By horizontally flipping a face image, the coordinates of key points after the flip are obtained; Calculate the absolute distance between the coordinates of each key point in each face image and the coordinates of the corresponding key point after flipping, and sum them to obtain the difference value of each face image before and after flipping. Filter out face images with a difference value greater than the difference threshold to obtain the preprocessed face dataset.
3. The training method for the face recognition model according to claim 1, characterized in that, The encoding network comprises multiple bottleneck layers, one flattening layer, and one fully connected layer. The first bottleneck layer includes three convolutional layers, and the other bottleneck layers each include four convolutional layers. Each convolutional layer includes one convolution operation, one batch normalization, and one linear rectifier. The input to the encoding network is sample data in M×M×3 format, where 96 ≤ M ≤ 168. The output of the encoding network is an N×1 feature vector, where 256 ≤ N ≤ 320.
4. The training method for the face recognition model according to claim 3, characterized in that, The decoding network includes one fully connected layer, one reshape layer, and multiple upsampling layers. The number of upsampling layers in the decoding network is the same as the number of bottleneck layers in the encoding network. Each upsampling layer includes one transposed convolutional layer and three convolutional layers.
5. The training method for the face recognition model according to claim 3, characterized in that, The fine-grained network has a multi-layer structure, with each layer consisting of a fully connected layer, a batch normalizer, and a linear rectifier.
6. The training method for the face recognition model according to claim 4, characterized in that, The process of training the encoder and decoder networks based on a large sample dataset includes: Combine the encoding and decoding networks into a reconstructed network and set the initial network parameters; Based on a large sample dataset, the L2 regression function is used as the loss function, and the SGD stochastic gradient descent method is used to optimize and reconstruct the network parameters. After training, the determined encoding network model parameters are obtained.
7. The training method for the face recognition model according to claim 6, characterized in that, The process involves extracting features from the face dataset using the trained encoding network and placing them into a feature set. Specifically, each sample from the large-sample and small-sample face datasets in the preprocessed face dataset is input into the trained encoding network, and the resulting feature vectors are used as the features of the corresponding large-sample or small-sample face datasets, and then placed into the feature set.
8. The training method for the face recognition model according to claim 7, characterized in that, The step of constructing triplet feature samples based on the updated feature set includes: The algorithm iterates through the feature set, taking a feature vector as an anchor point, and then taking a feature vector belonging to the same class as the current anchor point as a positive example. This positive example is then combined with the anchor point to form a binary pair. Finally, it iterates through the feature set and takes a feature vector belonging to a different class than the current anchor point. When the absolute value of the difference between the distance between feature vectors of the same class and the distance between feature vectors of different classes is less than the distance threshold, this feature vector is taken as a negative example and added to the current binary pair, thus constructing a triplet vector sample.
9. A training system for a face recognition model, characterized in that, include: The data preprocessing module is used to preprocess the face dataset, dividing it into large-sample datasets and small-sample datasets based on the number of face images of the same person in each category. The categories include: ethnicity, age, and facial image perspective; The network training module is reconstructed to build encoding and decoding networks. Based on a large sample dataset, the encoding and decoding networks are trained. Features of the face dataset are extracted from the trained encoding network and placed into a feature set. Features from the large sample face dataset are transferred to features from a small sample face dataset, and the feature set is updated. The transfer of features from the large sample face dataset to the small sample face dataset includes: calculating the mean of the feature vectors for each class of samples based on the features of the large sample face dataset, constructing the covariance matrix of the large sample; performing PCA dimensionality reduction on the covariance matrix, and taking the first S feature vectors to obtain the feature matrix; and performing transfer learning on the features of each small sample face dataset using the following formula based on the feature matrix and the features of the large sample face dataset: , in, For the first in a small sample dataset The first class of samples The feature vector of each sample For the first in a small sample dataset Class sample vector mean, The first one randomly selected from the large sample dataset In the class of samples, the first The feature vector of each sample The first one randomly selected from the large sample dataset Class sample vector mean, The characteristic matrix; The face recognition model training module is used to build a fine-grained network. Based on the updated feature set, it constructs triplet feature samples and trains the fine-grained network using the triplet function as the loss function. The trained encoding network and the fine-grained network constitute the face recognition model.