A face recognition model training, face recognition method and related device

By performing distribution smoothing processing and loss function optimization on the training set of the face recognition model, the overfitting and underfitting problems caused by long-tail distribution are solved, and the accuracy of face recognition and model generalization ability are improved.

CN113989905BActive Publication Date: 2024-11-01GUANGDONG LVAN IND & COMMERCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111358142.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-16
Publication Date
2024-11-01
Estimated Expiration
2041-11-16

AI Technical Summary

Technical Problem

Face recognition models are prone to overfitting or underfitting on the training set of long-tail distributions, resulting in low recognition accuracy, especially head data overfitting and tail data underfitting.

Method used

By smoothing the original distribution information of each user's face data, the target distribution information is obtained, and the distribution of the user's face data is considered in the loss function, the loss value is adjusted to balance the influence of the head and tail data. This optimizes the loss function of the training set.

Benefits of technology

It effectively improves the generalization ability of the face recognition model, improves the recognition accuracy and business quality, avoids increasing the training set scale and resource requirements, and fully learns the differences between each user's face data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113989905B_ABST
    Figure CN113989905B_ABST
Patent Text Reader

Abstract

The present invention provides a training of a face recognition model, a face recognition method and a related device, the method comprising: determining multiple users, each user having multiple frames of face data; smoothing the original distribution information of each user's face data to obtain target distribution information; using the face data as a sample, inputting it into the face recognition model to calculate multiple scores indicating that the face data belongs to the user; calculating a loss value for the scores of multiple users according to the target distribution information; updating the face recognition model according to the loss value; judging whether the number of current iterations reaches a preset threshold; if so, determining that the face recognition model training is completed; if not, returning to execute using the face data as a sample, inputting it into the face recognition model to calculate multiple scores indicating that the face data belongs to the user. This embodiment narrows the gap in the distribution of head data and tail data, fully learns the differences between the face data of each user, and improves the generalization ability of the face recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of computer vision, and in particular to a face recognition model training, a face recognition method and related devices. Background Art

[0002] Facial recognition has a wide range of applications in different scenarios of work, study, and life. For example, passenger security checks at transportation hubs such as bus stations and train stations, security deployment in factories, residential areas, etc., identifying residents at doors, and checking employee attendance in offices, etc.

[0003] As the application scenarios become more and more extensive, the design of face recognition has encountered more difficulties. One of the difficulties is that the training set used to train face recognition has a long-tail distribution, that is, due to the channels for collecting face data from users, the face data of a small number of users is large in the training set, and the face data of these users belongs to the head data. The face data of most users is very small in the training set, and the face data of these users belongs to the tail data. When using the training set to train the model for face recognition, the head data is prone to overfitting, while the tail data is prone to underfitting, resulting in poor performance of the model used for face recognition and low accuracy in face recognition. Summary of the invention

[0004] The embodiment of the present invention proposes a face recognition model training, a face recognition method and related devices to solve the problem of how to use a training set with a long-tail distribution to train a model for face recognition and improve the accuracy of face recognition.

[0005] In a first aspect, an embodiment of the present invention provides a method for training a face recognition model, comprising:

[0006] Determine a plurality of users, each of the users having a plurality of frames of face data;

[0007] Smoothing the original distribution information of the face data of each of the users to obtain target distribution information;

[0008] Input the face data as a sample into a face recognition model to calculate a plurality of scores indicating that the face data belongs to the user;

[0009] Calculating loss values ​​for scores of the plurality of users according to the target distribution information;

[0010] Update the face recognition model according to the loss value;

[0011] Determine whether the number of current iterations reaches a preset threshold; if so, determine that the face recognition model training is completed; if not, return to execute the step of taking the face data as a sample, inputting it into the face recognition model, and calculating multiple scores indicating that the face data belongs to the user.

[0012] In a second aspect, an embodiment of the present invention further provides a face recognition method, comprising:

[0013] Loading the face recognition model trained by the method according to the first aspect;

[0014] receiving image data;

[0015] The image data is input into the face recognition model, and the user to which the face data in the image data belongs is detected.

[0016] In a third aspect, an embodiment of the present invention further provides a training device for a face recognition model, comprising:

[0017] A user determination module, used to determine a plurality of users, each of which has a plurality of frames of face data;

[0018] A distribution smoothing module, used for smoothing the original distribution information of the face data of each user to obtain target distribution information;

[0019] A score prediction module, used to take the face data as a sample and input it into a face recognition model to calculate a plurality of scores indicating that the face data belongs to the user;

[0020] A loss value calculation module, used to calculate loss values ​​for scores of the plurality of users according to the target distribution information;

[0021] A face recognition model updating module, used for updating the face recognition model according to the loss value;

[0022] The iteration judgment module is used to judge whether the number of current iterations reaches a preset threshold; if so, the training completion determination module is called; if not, the score prediction module is returned to be called;

[0023] The training completion determination module is used to determine whether the face recognition model training is completed.

[0024] In a fourth aspect, an embodiment of the present invention further provides a face recognition device, comprising:

[0025] A face recognition model loading module, used to load the face recognition model trained by the method according to the first aspect;

[0026] An image data receiving module, used for receiving image data;

[0027] The user identification module is used to input the image data into the face recognition model and detect the user to which the face data in the image data belongs.

[0028] In a fifth aspect, an embodiment of the present invention further provides a computer device, the computer device comprising:

[0029] one or more processors;

[0030] a memory for storing one or more programs,

[0031] When the one or more programs are executed by the one or more processors, the one or more processors implement the training method of the face recognition model as described in the first aspect or the face recognition method as described in the second aspect.

[0032] In the sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the training method of the face recognition model as described in the first aspect or the face recognition method as described in the second aspect is implemented.

[0033] In this embodiment, multiple users are determined, each user having multiple frames of facial data; the original distribution information of the facial data of each user is smoothed to obtain target distribution information; the facial data is used as a sample and input into a facial recognition model to calculate multiple scores indicating that the facial data belongs to the user; a loss value is calculated for the scores of the multiple users based on the target distribution information; the facial recognition model is updated according to the loss value; it is determined whether the number of current iterations reaches a preset threshold; if so, it is determined that the facial recognition model training is completed; if not, the process returns to execute the facial data as a sample and input into the facial recognition model to calculate multiple scores indicating that the facial data belongs to the user.

[0034] First, this embodiment smoothes the original distribution information of each user's facial data, and does not adjust the facial data of each user itself, so as to avoid losing facial data and fully learn the facial data of each user.

[0035] Secondly, this embodiment mines the facial data of each user used as a training set, thereby optimizing the loss function, avoiding increasing the size of the training set, avoiding adding new demands for resources, and avoiding an increase in costs.

[0036] Furthermore, this embodiment smoothes the distribution of the facial data of each user serving as a training set, narrows the distribution gap between the head data and the tail data, so that the influence of the head data on the loss value is relatively reduced, and the influence of the tail data on the loss value is relatively increased. The differences between the facial data of each user are fully learned to achieve the goal of compactness within a class and dispersion between classes, and the generalization ability of the face recognition model is improved, thereby improving the accuracy of face recognition when the face recognition model is applied, and improving the service quality of face recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A flowchart of a method for training a face recognition model provided in Embodiment 1 of the present invention;

[0038] Figure 2 A schematic diagram of a loss function design provided in the first embodiment of the present invention;

[0039] Figure 3A and Figure 3B This is an example diagram of smoothing distribution provided in the first embodiment of the present invention;

[0040] Figure 4 is a flow chart of a face recognition method provided by Embodiment 2 of the present invention;

[0041] Figure 5 A schematic diagram of the structure of a training device for a face recognition model provided in Embodiment 3 of the present invention;

[0042] Figure 6 A structural diagram of a face recognition device provided in Embodiment 4 of the present invention;

[0043] Figure 7 A schematic diagram of the structure of a computer device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0044] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0045] Embodiment 1

[0046] Figure 1This is a flowchart of a method for training a face recognition model provided in Embodiment 1 of the present invention. This embodiment is applicable to the case where a face recognition model is trained by smoothing the distribution of face data in a training set and narrowing the gap between head data and tail data. The method can be executed by a training device for a face recognition model. The training device for a face recognition model can be implemented by software and / or hardware and can be configured in a computer device, such as a server, a workstation, a personal computer, etc. Specifically, the method includes the following steps:

[0047] Step 101: Determine multiple users.

[0048] In this embodiment, if Figure 2 As shown, a training set for training a face recognition model can be collected through different channels, wherein the face recognition model is used to identify the user's face data. The training set has multiple users (indicated by identifiers such as IDs), one user can represent a category, and each user (category) has multiple frames of face data, which are recorded in the form of image data.

[0049] Assume that the training set is S = {s0,s1,s2,…,s i ,…,s n},s i ={t0,t1,t2,…,t j ,…t m}, where the number of users (represented by IDs, etc.) in the training set S is n (n is a positive integer), i∈n, s i is the set of face data of the ith user, the number of face data of this user is m (m is a positive integer), j∈m, t j is the j-th frame of face data.

[0050] In the example of one channel, training sets for training face recognition models can be collected from public datasets, such as WebFace260m, Glint360K, MS-Celeb-1M, etc. Public datasets are limited by the way they are collected, and the datasets themselves have a strong long-tail distribution. For a small number of relatively famous people (such as basketball players, movie stars, etc.), massive amounts of face data can be collected on the Internet, with the number reaching thousands or tens of thousands. However, the face data of most ordinary people cannot be collected through the Internet, and the number is usually at the level of individual items.

[0051] Of course, the above-mentioned channels for collecting training sets are only used as examples. When implementing the embodiments of the present invention, other channels for collecting training sets can be set according to actual conditions. For example, a manufacturer provides facial recognition services for the entry and exit of an office building. People enter and exit the office building through facial recognition to form a data set. Users working in the office building often enter and exit the office building, and a large amount of facial data can be accumulated. Visitors only enter and exit the office building, and the accumulated facial data is less, making the training set present a long-tail distribution, etc. The embodiments of the present invention do not limit this. In addition, in addition to the above-mentioned channels for collecting training sets, those skilled in the art can also use other channels for collecting training sets according to actual needs, and the embodiments of the present invention do not limit this.

[0052] Step 102: Smoothing the original distribution information of each user's face data to obtain target distribution information.

[0053] Ideally, the training effect of the face recognition model is best when the amount of face data for each user is the same. However, due to the limitations of the channels for collecting face data, long-tail distribution often occurs in the training set.

[0054] The long-tail distribution of the training set will significantly weaken the performance of the face recognition model. Suppose that the sampling rate is changed to solve the long-tail distribution of the training set, that is, oversampling the tail data and / or downsampling the head data to achieve the goal of balancing the data set. However, downsampling will discard the existing face data, and the large amount of face data in the head data cannot be fully learned. The tail data itself has a small amount of data, so even if it is oversampled, the face data does not increase. It can be seen that changing the sampling rate balances the data set to a certain extent. At the same time, there are obvious defects in other aspects.

[0055] Objective, the loss functions for training face recognition models include softmax, cosface, arcface, etc. The goal of loss function design is to explicitly increase the inter-class distance and reduce the intra-class distance, but the design process of these loss functions does not consider the distribution of face data, that is, the parameters of the face recognition model are generally designed based on the original distribution information. Due to the limitations of data collection, the data set is a long-tail distribution. The long-tail distribution makes it easier for the face recognition model to overfit the head data and underfit the tail data. The intuitive reason is that the sampling rate of the head data is high and the sampling rate of the tail data is low. Moreover, the performance of the face recognition model is not linearly related to the distribution information of the face data, and cannot be truly reflected in the face recognition model.

[0056] In this regard, this embodiment considers the distribution of face data of each user in the training set as a factor in designing the loss function, such as Figure 2As shown, the original distribution information of the face data of each user in the training set is smoothed to obtain the target distribution information, wherein the original distribution information may refer to the actual number of face data of each user in the training set, and these numbers may be equivalently converted into the probability distribution of the face data belonging to these users.

[0057] Furthermore, the smoothing process is to smooth the amount of face data of each user, thereby smoothing the probability distribution of the face data belonging to these users.

[0058] It should be noted that the smoothing process targets the distribution of facial data and does not adjust the facial data of each user in the training set. That is, the facial data of each user in the training set maintains the original quantity and does not increase, delete, or perform other processing on the facial data of each user in the training set with the smoothing process.

[0059] For example, suppose there are 3 users in the training set, the number of face data of these 3 users is [1, 2, 3] respectively, and the original distribution information is [1 / 6, 2 / 6, 3 / 6]. After smoothing, the number of face data of these 3 users remains [1, 2, 3], and the target distribution information is [1 / 3, 1 / 3, 1 / 3].

[0060] In an example of smoothing, the number of face data of each user can be counted. For the sake of distinction, the number before smoothing is recorded as the first number s. i .

[0061] The first quantity s i Mapping from constant space to logarithmic space, we obtain the smoothed quantity log(s i ), that is, for the first quantity s i Taking the logarithm, with the base usually being 10, will not change the nature and correlation of each user's facial data, but will compress the scale of each user's facial data, making the amount of each user's facial data more stable, reducing the difference between the head data and the tail data, and reducing the variance of the amount of facial data for each user, so as to achieve the goal of balancing the data set.

[0062] The smoothed number is rounded up or down to obtain the number of face data of each user. For the convenience of distinction, the number after smoothing is recorded as the second number s i_new .

[0063] If rounding up is applied, the smoothing process can be expressed as s i_new =ceil(log(s i )), where the ceil function represents rounding up.

[0064] In one example, if Figure 3A As shown, a coordinate system is constructed, where the horizontal axis is id (user) and the vertical axis is sample (sample, i.e., the first number of user's facial data). Users are sorted in order according to the size of the first number. The facial data of users sorted at the front are tail data, and the facial data of users sorted at the end are head data. There is an extreme imbalance between the head data and the tail data.

[0065] like Figure 3B As shown, according to s i_new =ceil(log(s i )) is smoothed to construct a coordinate system, where the horizontal axis is id (user) and the vertical axis is sample (sample, that is, the second number of the user's face data). The users are sorted in order according to the size of the second number. The face data of the users sorted at the front are tail data, and the face data of the users sorted at the end are head data. The head data and the tail data are smoother, the absolute difference of the second number between the users' face data is reduced, and the variance of the users' face data is reduced, which is convenient for the subsequent training of the parameters of the face recognition model.

[0066] Of course, the above-mentioned smoothing process is only used as an example. When implementing the embodiment of the present invention, other smoothing processes may be set according to actual conditions, such as Box-Cox transformation, etc., and the embodiment of the present invention does not limit this. In addition, in addition to the above-mentioned smoothing process, those skilled in the art may also use other smoothing processes according to actual needs, and the embodiment of the present invention does not limit this.

[0067] Step 103: Use the facial data as a sample and input it into a facial recognition model to calculate multiple scores indicating that the facial data belongs to the user.

[0068] In this embodiment, the structure of the face recognition model can be pre-designed to make it more suitable for the task of face recognition. Generally, models of the ResNet series, such as ResNet18, ResNet 34, ResNet 50, and ResNet 100, have high accuracy for face recognition and can all be used as face recognition models.

[0069] Of course, the structure of the face recognition model is not limited to artificially designed neural networks, and can also be a neural network optimized by a model quantization method, a neural network searched by a NAS (Network Architecture Search) method, and so on. This embodiment does not impose any restrictions on this.

[0070] In addition, the face recognition model can be an originally constructed model, in which case the face recognition model is retrained; the face recognition model can also be a pre-trained model (Pre-trained Model), in which case the face recognition model is fine-tuned (Fine Tune), and so on. This embodiment does not impose any restrictions on this.

[0071] Face data is extracted from the training set as training samples and input into the face recognition model. The face recognition model processes the face data according to its structure. The face recognition model sets neurons in the output layer that are equal to the number of users. Each neuron corresponds to a user. Each neuron can output a score (also called probability) for each user indicating that the face data belongs to the user, so as to predict the user to whom the face data belongs. It is usually believed that the face data belongs to the user with the highest score. So, assuming that the number of users (indicated by IDs, etc.) in the training set S is n, the number of scores is also n.

[0072] Step 104: Calculate loss values ​​for the scores of multiple users according to the target distribution information.

[0073] There are usually two optimization directions for face recognition. One optimization direction is to mine the information of the data set during training, including loss function, data enhancement, label smoothing, network structure, etc. The other optimization direction is to increase the size of the training data set. Practice has proved that this can improve the performance of face recognition to a certain extent.

[0074] However, not only are datasets difficult to obtain, but their growth in size will also place more demands on resources such as video memory, bandwidth, and graphics cards, resulting in higher costs. Therefore, based on resource and cost considerations, the optimization of face recognition is more inclined to loss functions, data enhancement, and network structures.

[0075] Based on resource and cost considerations, in this embodiment, the loss function can be optimized. Considering that face recognition is a classification problem, a loss function suitable for classification can be pre-designed.

[0076] When training a face recognition model, the target distribution information can be substituted into the loss function for operation, thereby calculating the loss value for the scores of multiple users, which represents the difference between the true value (the user to whom the face data actually belongs) and the predicted value (the user to whom the face data is predicted to belong). Since the target distribution information is obtained through smoothing processing to reduce the difference between the head data and the tail data, the loss function can reduce the weight of the head data and increase the weight of the tail data.

[0077] In one embodiment of the present invention, step 104 may include the following steps:

[0078] Step 1041: Determine the user to whom the sample facial data belongs as the target user.

[0079] For the face data used as sample input into the face recognition model, the user to whom the face data belongs in the training set can be queried. As the user to whom the face data actually belongs, for the sake of distinction, this user is recorded as the target user.

[0080] The target user is used as a label to supervise the training of the face recognition model.

[0081] Step 1042: Use the target distribution information to generate the distribution probability of the target user's face data.

[0082] like Figure 2 As shown, for the target user, the distribution probability of his face data can be counted according to the target distribution information. Since the target distribution information has been smoothed, the distribution probability is also equivalent to having been smoothed.

[0083] In a specific implementation, on the one hand, the second quantity of face data of each user is queried from the target distribution information, and on the other hand, the second quantity of face data of all users (including the target user) is summed as the total quantity, thereby calculating the ratio between the second quantity of face data of the target user and the total quantity as the distribution probability of the face data of the target user. The distribution probability of the face data of the target user is expressed as follows:

[0084]

[0085] Among them, P label is the distribution probability of the target user’s face data. Suppose there are n users in the training set, S 1_new , S 2_new ,...,S n_new is the second number of facial data of the first user, the second number of facial data of the second user, ..., the second number of facial data of the nth user, S label_new is the second quantity of the target user's face data.

[0086] Furthermore, the score of facial data belonging to the user output by the traditional face recognition model is processed using softmax and converted into a probability distribution. The loss value is calculated based on cross entropy. This method does not take into account the distribution information of the user's facial data. That is, the head data has a greater impact on the loss value and a greater weight, while the tail data has a relatively smaller impact on the loss and a lower weight. The parameter update of the model used for face recognition is basically determined by the head data.

[0087] The loss function based on softmax cross entropy is as follows:

[0088]

[0089] Among them, y label_sof_trmax is the loss value, assuming there are n users in the training set, x1, x2, ..., x n is the score of the first user, the score of the second user, ..., the score of the nth user, x label is the score of the target user.

[0090] In this embodiment, the weight of the tail data may be increased and the weight of the head data may be reduced by adding a priori distribution probability, thereby balancing the weights between the head data and the tail data.

[0091] Assume that the loss function after adding the prior distribution probability is as follows:

[0092]

[0093] Among them, y label_sof_tmax is the loss value, P label is the distribution probability of the target user’s face data. Suppose there are n users in the training set, x1, x2, ..., x n is the score of the first user, the score of the second user, ..., the score of the nth user, x label is the score of the target user.

[0094] Then, comparing the loss value calculated based on the cross entropy of softmax and the loss value calculated by adding the prior distribution probability, the change in loss value is:

[0095]

[0096] Among them, the change in the loss value Δy1 is a positive number, that is, after adding the prior probability, the loss value increases, the gradient of the parameters of the face recognition model increases, and the face recognition model can iterate to the optimal point faster.

[0097] Furthermore, the difference between the changes in the loss values ​​of the head data and the tail data is calculated:

[0098] Δy tail_head =y tail -y head =p head -p tail >0

[0099] Among them, y tail Represents the change in the loss value of the tail data, y head Represents the change in the loss value of the header data, Δy tail_head It represents the difference between the change in the loss value of the tail data and the change in the loss value of the head data. The distribution probability P of the head datalabel The larger the loss value, the smaller the change Δy1, and the distribution probability P of the tail data. label is smaller, the change in loss value Δy1 is larger, so Δy tai_lhead When it is greater than 0, it explicitly increases the weight of the tail data on the loss value and balances the impact of the head and tail data on the gradient of the face recognition model.

[0100] Step 1043: Calculate a smoothing coefficient for the target user using the target distribution information.

[0101] Face recognition is a classification problem, especially a multi-classification problem. Face data (vector) is often converted into a one-hot-vector. For the loss function, the predicted probability is used to fit the actual probability. Fitting the one-hot actual probability will cause two problems:

[0102] (1) The generalization ability of the face recognition model cannot be guaranteed, which easily leads to overfitting;

[0103] (2) Full probability and 0 probability encourage the gap between the user (category) and other users (categories) to be as large as possible. However, as we know from the bounded gradient, this situation is difficult to adapt to and will cause the face recognition model to over-trust the predicted user (category).

[0104] In this embodiment, if Figure 2 As shown in the figure, the above two problems can be alleviated by smoothing. In this case, the target distribution information can be used to calculate the smoothing coefficient ε for the target user. The smoothing coefficient ε is closer to the training set, which can alleviate the long-tail distribution in the training set. Then, the confidence of the sample in the training set is (1-ε), which can reduce the confidence of one-hot.

[0105] Considering that there are more head data in the training set, the probability of noise is relatively large, and the corresponding smoothing coefficient should be larger. Therefore, the second number of face data of each user can be queried from the target distribution information, and the second number of face data of each user can be compared, and the maximum value from the second number of face data of each user can be taken as the maximum number.

[0106] The ratio between the second number and the maximum number of face data of the target user is calculated as the adjustment coefficient, and the product between the adjustment coefficient and the preset smoothing experience value is calculated as the smoothing coefficient of the target user. The smoothing coefficient of the target user is expressed as follows:

[0107]

[0108] Among them, ε is the smoothing coefficient of the target user. Assume that there are n users in the training set, S 1_new , S 2_new,...,S n_new is the second number of facial data of the first user, the second number of facial data of the second user, ..., the second number of facial data of the nth user, S label_new is the second number of face data of the target user, the max function is to take the maximum value, and α is the smoothing empirical value.

[0109] Furthermore, the smoothing experience value is generally based on empirical settings, such as 0.1. At this time, the smoothing coefficient of the category (user) with the second largest number of face data is α (such as 0.1), and the smoothing coefficients of other categories (users) are proportional to the second number.

[0110] The loss function of cross entropy based on softmax (i.e., the loss function of non-smooth processing) is as follows:

[0111]

[0112] in, is the loss value, assuming there are n users in the training set, x1, x2, …, x n is the score of the first user, the score of the second user, ..., the score of the nth user, x label is the score of the target user.

[0113] Assume that the loss function after adding the smoothing coefficient for smoothing is as follows:

[0114]

[0115] in, is the loss value, ε is the smoothing coefficient, and there are n users in the training set, x1, x2, ..., x n is the score of the first user, the score of the second user, ..., the score of the nth user, x label is the score of the target user.

[0116] Then, for the smoothed and non-smoothed face recognition models, the change in loss value is:

[0117]

[0118] Among them, β represents the average loss value of all negative samples (users other than the target user).

[0119] The head data is given a larger smoothing coefficient ε and a large Δy2, which encourages the head data to learn the similarities between data and reduce the impact of noise data on the loss value; the tail data is given a smaller smoothing coefficient ε and a small Δy2, which encourages the tail data to learn the similarities within the data, so as to achieve uniform learning of the facial data information of each user and fully explore the connection between the facial data of each user.

[0120] Step 1044: Under the condition that the face data of the target user maintains the distribution probability, use the smoothing coefficient to smooth the difference between the score of the target user and the scores of other users to calculate the loss value.

[0121] like Figure 2 As shown, it is assumed that the face data of the target user maintains the distribution probability. In this case, the difference between the score of the target user and the scores of other users except the target user is smoothed using a smoothing coefficient to calculate the loss value.

[0122] Furthermore, if the loss function gives the greatest incentive to accurate classification (user) and the greatest penalty to incorrect classification (user), it means that the annotated labels are considered accurate. However, in fact, due to factors such as errors in manual labeling and automatic labeling algorithms, some annotated labels may not be accurate, that is, overfitting occurs, which leads to a decrease in the generalization ability of the face recognition model.

[0123] Therefore, this embodiment gives some penalties to accurate classification (i.e., target users) and reduces rewards, and gives some incentives to wrong classification (i.e., other users except the target user) and reduces penalties, so as to achieve smoothing processing, reduce overfitting, and improve the generalization ability of the face recognition model.

[0124] In a specific implementation, on the one hand, the first cross entropy of the target user's score relative to the scores of all users can be calculated under the condition that the face data maintains the distribution probability. On the other hand, the second cross entropy of the scores of users other than the target user relative to the scores of all users can be calculated, so that the first cross entropy and the second cross entropy are fused using a smoothing coefficient to obtain a loss value, that is, a weight is given to the calculation of the smoothing coefficient, and the weighted sum of the first cross entropy and the second cross entropy is used as the loss value.

[0125] Among them, the first cross entropy and the second cross entropy are cross entropy, and cross entropy is used to measure the difference information between two probability distributions.

[0126] In one example, for the first cross entropy, on the one hand, multiple first target values ​​are calculated with a natural number as the base and the score of each user as the exponent, and all the first target values ​​are summed to obtain the second target value.

[0127] On the other hand, the third target value is calculated by taking a natural number as the base and the sum of the score of the target user and the distribution probability as the exponent.

[0128] Thus, the logarithm of the ratio between the second target value and the third target value is taken to obtain the first cross entropy.

[0129] For the second cross entropy, on the one hand, multiple first target values ​​are calculated with natural numbers as the base and the score of each user as the exponent, and all the first target values ​​are summed to obtain the second target value.

[0130] On the other hand, the logarithm of the ratio between the first target value and the second value of other users except the target user is taken to obtain a fourth target value.

[0131] Sum all fourth target values, the second cross entropy.

[0132] Then, during the smoothing process, the difference between the logarithmic value one and the smoothing coefficient is negative as the first target coefficient, and the ratio between the smoothing coefficient and the second number of users other than the target user is calculated, and the ratio is negative as the second target coefficient.

[0133] The loss value is obtained by multiplying the product of the first target coefficient and the first cross entropy and summing the second target coefficient and the second cross entropy.

[0134] In this example, the loss values ​​are expressed as follows:

[0135]

[0136] Among them, y label is the loss value, ε is the smoothing coefficient, P label is the distribution probability of the target user’s face data. Suppose there are n users in the training set, x1, x2, ..., x n is the score of the first user, the score of the second user, ..., the score of the nth user, x label is the score of the target user.

[0137] Step 105: Update the face recognition model according to the loss value.

[0138] In a specific implementation, the face recognition model can be back-propagated, and the loss value can be substituted into algorithms such as SGD (stochastic gradient descent) and Adam (Adaptive momentum) to calculate the update amplitude of the parameters in the face recognition model, thereby updating the parameters in the face recognition model according to the update amplitude.

[0139] Step 106 , determine whether the number of current iterations reaches a preset threshold; if so, execute step 107 , if not, return to execute step 103 .

[0140] Step 107: Determine whether the face recognition model training is completed.

[0141] In this embodiment, a threshold value may be set in advance for the number of iterations as a stop condition. In each round of iterative training, the number of current iterations is counted to determine whether the threshold value is reached.

[0142] If the threshold is reached, the face recognition model training can be considered complete, at which point the weights in the face recognition model are recorded.

[0143] If the threshold is not reached, the next round of iterative training can be entered, and the iterative training will be repeated until the face recognition model training is completed.

[0144] Furthermore, the face recognition model is trained offline, the structure and parameters of the face recognition model are recorded, and the face recognition model (including parameters) is distributed to the device to be recognized by face through various means, so as to perform face detection in real time.

[0145] In this embodiment, multiple users are determined, each user having multiple frames of facial data; the original distribution information of the facial data of each user is smoothed to obtain target distribution information; the facial data is used as a sample and input into a facial recognition model to calculate multiple scores indicating that the facial data belongs to the user; a loss value is calculated for the scores of the multiple users based on the target distribution information; the facial recognition model is updated according to the loss value; it is determined whether the number of current iterations reaches a preset threshold; if so, it is determined that the facial recognition model training is completed; if not, the process returns to execute the facial data as a sample and input into the facial recognition model to calculate multiple scores indicating that the facial data belongs to the user.

[0146] First, this embodiment smoothes the original distribution information of each user's facial data, and does not adjust the facial data of each user itself, so as to avoid losing facial data and fully learn the facial data of each user.

[0147] Secondly, this embodiment mines the facial data of each user used as a training set, thereby optimizing the loss function, avoiding increasing the size of the training set, avoiding adding new demands for resources, and avoiding an increase in costs.

[0148] Furthermore, this embodiment smoothes the distribution of the facial data of each user serving as a training set, narrows the distribution gap between the head data and the tail data, so that the influence of the head data on the loss value is relatively reduced, and the influence of the tail data on the loss value is relatively increased. The differences between the facial data of each user are fully learned to achieve the goal of compactness within a class and dispersion between classes, and the generalization ability of the face recognition model is improved, thereby improving the accuracy of face recognition when the face recognition model is applied, and improving the service quality of face recognition.

[0149] Embodiment 2

[0150] Figure 4This is a flow chart of a face recognition method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case where face recognition is performed using the face recognition model trained in Embodiment 1. The method can be performed by a face recognition device, which can be implemented by software and / or hardware and can be configured in a computer device, such as a server, a workstation, a personal computer, a mobile terminal, etc., and specifically includes the following steps:

[0151] Step 401: Load the face recognition model.

[0152] In this embodiment, a face recognition model may be pre-trained, and the face recognition model is used for face recognition.

[0153] In the specific implementation, the training method of the face recognition model is as follows:

[0154] Determine multiple users, each user having multiple frames of face data;

[0155] Smoothing the original distribution information of each user's face data to obtain target distribution information;

[0156] The facial data is used as a sample and input into a facial recognition model to calculate multiple scores indicating that the facial data belongs to the user;

[0157] Calculate loss values ​​for scores of multiple users based on target distribution information;

[0158] Update the face recognition model according to the loss value;

[0159] Determine whether the number of current iterations reaches a preset threshold; if so, determine that the face recognition model training is complete; if not, return to execute the face data as a sample, input it into the face recognition model to calculate multiple scores indicating that the face data belongs to the user.

[0160] In this embodiment, since the training method of the face recognition model is basically similar to the application of the first embodiment, the description is relatively simple. For the relevant parts, please refer to the partial description of the first embodiment. The embodiment of the present invention is not described in detail here.

[0161] During face recognition, the face recognition model (including parameters) is loaded into the memory for execution.

[0162] Step 402: Receive image data.

[0163] In a specific implementation, if the computer device is a client-side device (such as a personal computer, a mobile terminal, etc.), its operating system may include Android, iOS, Windows, etc., and may have a built-in camera or an external independent camera.

[0164] These operating systems support running a variety of applications, such as lock screen applications, instant messaging tools, payment applications, banking applications, etc. These applications can have built-in facial recognition services to ensure user data security.

[0165] When these applications are started by the user, they can call the camera to collect video data from the user, thereby extracting image data containing the user. At this time, the image data contains the user's facial data.

[0166] If the computer device is a device on the server side (such as a server, workstation, etc.), it can provide face recognition services to the device on the client side, receive video data uploaded by the device on the client side, and collect video data of the user, thereby extracting image data containing the user. At this time, the image data contains the user's face data.

[0167] Step 403: input the image data into a face recognition model and detect the user to which the face data in the image data belongs.

[0168] The image data (including face data) is input into the face recognition model. The face recognition model processes the image data (including face data) according to its structure and outputs the user to whom the face data belongs, thereby performing business operations for the user, such as application unlocking, attendance clocking in, opening access control, etc.

[0169] Of course, in addition to the face recognition model, other means may be used to assist face recognition, such as liveness detection, age detection, emotion detection, etc., which is not limited in this embodiment.

[0170] In this embodiment, a face recognition model is loaded; image data is received; the image data is input into the face recognition model, and the user to whom the face data in the image data belongs is detected.

[0171] First, this embodiment smoothes the original distribution information of each user's facial data, and does not adjust the facial data of each user itself, so as to avoid losing facial data and fully learn the facial data of each user.

[0172] Secondly, this embodiment mines the facial data of each user used as a training set, thereby optimizing the loss function, avoiding increasing the size of the training set, avoiding adding new demands for resources, and avoiding an increase in costs.

[0173] Furthermore, this embodiment smoothes the distribution of the facial data of each user serving as a training set, narrows the distribution gap between the head data and the tail data, so that the influence of the head data on the loss value is relatively reduced, and the influence of the tail data on the loss value is relatively increased. The differences between the facial data of each user are fully learned to achieve the goal of compactness within a class and dispersion between classes, and the generalization ability of the face recognition model is improved, thereby improving the accuracy of face recognition when the face recognition model is applied, and improving the service quality of face recognition.

[0174] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0175] Embodiment 3

[0176] Figure 5 The structural block diagram of a training device for a face recognition model provided in the third embodiment of the present invention may specifically include the following modules:

[0177] A user determination module 501, used to determine a plurality of users, each of which has a plurality of frames of face data;

[0178] A distribution smoothing module 502 is used to smooth the original distribution information of the face data of each user to obtain target distribution information;

[0179] A score prediction module 503 is used to input the face data as a sample into a face recognition model to calculate a plurality of scores indicating that the face data belongs to the user;

[0180] A loss value calculation module 504, configured to calculate loss values ​​for scores of the plurality of users according to the target distribution information;

[0181] A face recognition model updating module 505, used to update the face recognition model according to the loss value;

[0182] The iteration judgment module 506 is used to judge whether the number of current iterations reaches a preset threshold; if so, the training completion determination module 507 is called; if not, the score prediction module 503 is returned to be called;

[0183] The training completion determination module 507 is used to determine whether the face recognition model training is completed.

[0184] In one embodiment of the present invention, the distribution smoothing module 502 includes:

[0185] A first quantity counting module, used for counting a first quantity of the facial data of each user;

[0186] A smoothing quantity mapping module, used for mapping the first quantity from a constant space to a logarithmic space to obtain a smoothing quantity;

[0187] The second quantity rounding module is used to round the smoothed quantity to obtain a second quantity of the facial data of each of the users.

[0188] In one embodiment of the present invention, the loss value calculation module 504 includes:

[0189] A target user determination module, used to determine the user to which the face data as a sample belongs as the target user;

[0190] A distribution probability generating module, used to generate the distribution probability of the face data of the target user using the target distribution information;

[0191] A smoothing coefficient calculation module, used to calculate a smoothing coefficient for the target user using the target distribution information;

[0192] A score smoothing module is used to smooth the difference between the score of the target user and the scores of other users using the smoothing coefficient under the condition that the face data of the target user maintains the distribution probability, so as to calculate the loss value.

[0193] In one embodiment of the present invention, the distribution probability generation module includes:

[0194] A second quantity query module, used for querying a second quantity of the face data of each of the users from the target distribution information;

[0195] A second quantity summing module, used for summing the second quantity of the face data of all the users as a total quantity;

[0196] The first ratio calculation module is used to calculate the ratio between the second quantity of the facial data of the target user and the total quantity as the distribution probability of the facial data of the target user.

[0197] In one embodiment of the present invention, the smoothing coefficient calculation module includes:

[0198] A second quantity query module, used for querying a second quantity of the face data of each of the users from the target distribution information;

[0199] A maximum number selection module, used for taking the maximum value from the second number of face data of each of the users as the maximum number;

[0200] A second ratio calculation module, used for calculating the ratio between the second amount of the face data of the target user and the maximum amount as an adjustment coefficient;

[0201] The coefficient product calculation module is used to calculate the product between the adjustment coefficient and a preset smoothing experience value as the smoothing coefficient of the target user.

[0202] In one embodiment of the present invention, the score smoothing module comprises:

[0203] A first cross entropy calculation module, configured to calculate a first cross entropy of the score of the target user relative to the scores of all the users under the condition that the face data maintains the distribution probability;

[0204] A second cross entropy calculation module, used to calculate a second cross entropy of scores of other users except the target user relative to scores of all the users;

[0205] A cross entropy fusion module is used to use the smoothing coefficient to fuse the first cross entropy and the second cross entropy to obtain a loss value.

[0206] In one example of the present invention, the first cross entropy calculation module is further used for:

[0207] Calculate a plurality of first target values ​​respectively using a natural number as a base and a score of each of the users as an exponent;

[0208] summing all the first target values ​​to obtain a second target value;

[0209] Calculate a third target value by taking a natural number as the base and the sum of the score of the target user and the distribution probability as an exponent;

[0210] Taking the logarithm of the ratio between the second target value and the third target value to obtain a first cross entropy;

[0211] The second cross entropy calculation module is also used for:

[0212] Calculate a plurality of first target values ​​respectively using a natural number as a base and a score of each of the users as an exponent;

[0213] summing all the first target values ​​to obtain a second target value;

[0214] Taking the logarithm of the ratio between the first target value and the second value of the other users except the target user, respectively, to obtain a fourth target value;

[0215] summing all the fourth target values, a second cross entropy;

[0216] The cross entropy fusion module is also used for:

[0217] Negating the difference between the value 1 and the smoothing coefficient as the first target coefficient;

[0218] Calculate a ratio between the smoothing coefficient and a second number of the other users except the target user, and negate the ratio to obtain a second target coefficient;

[0219] The loss value is obtained by multiplying the product of the first target coefficient and the first cross entropy and summing the second target coefficient and the second cross entropy.

[0220] The training device for the face recognition model provided in the embodiment of the present invention can execute the training method for the face recognition model provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0221] Embodiment 4

[0222] Figure 6 A structural block diagram of a face recognition device provided in Embodiment 4 of the present invention may specifically include the following modules:

[0223] A face recognition model loading module 601 is used to load a face recognition model;

[0224] An image data receiving module 602, used for receiving image data;

[0225] The user identification module 603 is used to input the image data into the face recognition model and detect the user to which the face data in the image data belongs.

[0226] The training method of the face recognition model is as follows:

[0227] Determine a plurality of users, each of the users having a plurality of frames of face data;

[0228] Smoothing the original distribution information of the face data of each of the users to obtain target distribution information;

[0229] Input the face data as a sample into a face recognition model to calculate a plurality of scores indicating that the face data belongs to the user;

[0230] Calculating loss values ​​for scores of the plurality of users according to the target distribution information;

[0231] Update the face recognition model according to the loss value;

[0232] Determine whether the number of current iterations reaches a preset threshold; if so, determine that the face recognition model training is completed; if not, return to execute the step of taking the face data as a sample, inputting it into the face recognition model, and calculating multiple scores indicating that the face data belongs to the user.

[0233] The face recognition device provided in the embodiment of the present invention can execute the face recognition method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0234] Embodiment 5

[0235] Figure 7 A schematic diagram of the structure of a computer device provided in Embodiment 5 of the present invention. Figure 7 A block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 7 The computer device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0236] like Figure 7 As shown, the computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0237] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0238] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0239] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0240] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0241] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the computer device 12, and / or may communicate with any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the computer device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computer device 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0242] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the training method of the face recognition model or the face recognition method provided in the embodiment of the present invention.

[0243] Embodiment 6

[0244] Embodiment 6 of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the training method of the above-mentioned face recognition model or each process of the face recognition method, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0245] Among them, computer-readable storage media may include, for example, but are not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device.

[0246] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A training method for a face recognition model, characterized in that: include: Determine a plurality of users, each of the users having a plurality of frames of face data; Smoothing the original distribution information of the face data of each of the users to obtain target distribution information; Input the face data as a sample into a face recognition model to calculate a plurality of scores indicating that the face data belongs to the user; Calculating loss values ​​for scores of the plurality of users according to the target distribution information; Update the face recognition model according to the loss value; Determine whether the number of current iterations reaches a preset threshold; if so, determine that the face recognition model training is completed; if not, return to execute the step of taking the face data as a sample, inputting it into the face recognition model, and calculating a plurality of scores indicating that the face data belongs to the user; The step of calculating the loss value for the scores of the plurality of users according to the target distribution information includes: Determine the user to whom the facial data as a sample belongs as the target user; Generate a distribution probability of the face data of the target user using the target distribution information; Calculate a smoothing coefficient for the target user using the target distribution information; Under the condition that the face data of the target user maintains the distribution probability, using the smoothing coefficient to smooth the difference between the score of the target user and the scores of other users to calculate the loss value; The step of calculating a smoothing coefficient for the target user using the target distribution information includes: Querying a second amount of the face data of each of the users from the target distribution information; Taking the maximum value from the second quantities of the face data of each of the users as the maximum quantity; Calculating a ratio between the second amount of the face data of the target user and the maximum amount as an adjustment coefficient; The product of the adjustment coefficient and a preset smoothing experience value is calculated as the smoothing coefficient of the target user.

2. The method according to claim 1, characterized in that The smoothing process is performed on the original distribution information of the face data of each user to obtain target distribution information, including: Counting a first amount of the facial data for each of the users; Mapping the first quantity from a constant space to a logarithmic space to obtain a smoothed quantity; The smoothed number is rounded to obtain a second number of the facial data of each of the users.

3. The method according to claim 1, characterized in that The using the target distribution information to generate the distribution probability of the face data of the target user includes: Querying a second amount of the face data of each of the users from the target distribution information; summing up the second quantities of the facial data of all the users as a total quantity; A ratio between a second amount of the facial data of the target user and the total amount is calculated as a distribution probability of the facial data of the target user.

4. The method according to claim 1, characterized in that: The step of smoothing the difference between the score of the target user and the scores of other users using the smoothing coefficient under the condition that the face data of the target user maintains the distribution probability, so as to calculate the loss value, comprises: Under the condition that the face data maintains the distribution probability, calculating a first cross entropy of the score of the target user relative to the scores of all the users; Calculate a second cross entropy of scores of the other users except the target user relative to scores of all the users; The first cross entropy and the second cross entropy are fused using the smoothing coefficient to obtain a loss value.

5. The method according to claim 4, characterized in that The step of calculating the first cross entropy of the score of the target user relative to the scores of all the users under the condition that the face data maintains the distribution probability includes: Calculate a plurality of first target values ​​respectively using a natural number as a base and a score of each of the users as an exponent; summing all the first target values ​​to obtain a second target value; Calculate a third target value by taking a natural number as the base and the sum of the score of the target user and the distribution probability as an exponent; Taking the logarithm of the ratio between the second target value and the third target value to obtain a first cross entropy; The calculating a second cross entropy of scores of the other users except the target user relative to scores of all the users comprises: Calculate a plurality of first target values ​​respectively using a natural number as a base and a score of each of the users as an exponent; summing all the first target values ​​to obtain a second target value; Taking the logarithm of the ratio between the first target value and the second target value of the other users except the target user, respectively, to obtain a fourth target value; summing all the fourth target values, a second cross entropy; The using the smoothing coefficient to fuse the first cross entropy with the second cross entropy to obtain a loss value includes: Negating the difference between the value 1 and the smoothing coefficient as the first target coefficient; Calculate a ratio between the smoothing coefficient and a second number of the other users except the target user, and negate the ratio to obtain a second target coefficient; The loss value is obtained by multiplying the product of the first target coefficient and the first cross entropy and summing the second target coefficient and the second cross entropy.

6. A face recognition method, characterized in that: include: Loading a face recognition model trained by the method described in any one of claims 1 to 5; receiving image data; The image data is input into the face recognition model, and the user to which the face data in the image data belongs is detected.

7. A computer device, characterized in that: The computer device comprises: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the training method of the face recognition model as described in any one of claims 1 to 5 or the face recognition method as described in claim 6.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, it implements the training method of the face recognition model as described in any one of claims 1 to 5 or the face recognition method as described in claim 6.