Face recognition method, device and face recognition access control system

By training the face recognition model and using known and unknown face image samples for joint training, the problem of high misjudgment rate of the face recognition access control system is solved, and the recognition accuracy and robustness are improved.

CN118366206BActive Publication Date: 2024-09-24INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410791996.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-09-24
Estimated Expiration
2044-06-19

AI Technical Summary

Technical Problem

The existing face recognition access control system has a high probability of misjudgment and poor robustness, making it difficult to effectively reduce the rate of misjudgment.

Method used

By training the face recognition model, we use known face image samples and unknown face image samples to jointly train, reduce the output probability of unknown face image samples under the category label of known face image samples, and improve the feature model of known face image samples. The value is enlarged and the feature model value of the unknown face image sample is reduced, thereby improving the recognition accuracy.

Benefits of technology

It effectively reduces the probability of misjudgment in face recognition, improves the generalization ability of the model and the accuracy of the recognition results, and enhances the robustness of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118366206B
    Figure CN118366206B
Patent Text Reader

Abstract

The present application provides a face recognition method, device and face recognition access control system, which relates to the field of computer technology, and includes: obtaining a face image to be recognized; inputting the face image to be recognized into a face recognition model to obtain a recognition result of the face image to be recognized output by the face recognition model; the face recognition model is obtained by a model training device training an initial model based on known face image samples and unknown face image samples; the calculation unit in the model training device is used to reduce the output probability of unknown face image samples under the category label corresponding to the known face image samples during the training process of the initial model, amplify the characteristic modulus value of the known face image samples, and reduce the characteristic modulus value of the unknown face image samples. The method, device and system provided by the present application reduce the probability of misjudgment of face recognition, and improve the generalization ability of the model and the accuracy of the recognition results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a face recognition method, device and face recognition access control system. Background Art

[0002] With the rapid development of technology, the recognition accuracy of face recognition technology based on deep learning has been continuously improved, which has promoted the application of face recognition technology in various fields (such as mobile phone startup, financial payment, access control system, etc.), bringing great convenience to social management and daily life. At the same time, users of face recognition access control systems have also begun to pay attention to the security risks of face recognition technology (such as personal information leakage, identity forgery, etc.).

[0003] Taking the access control system that deploys face recognition technology as an example, the optimal operating state of the system is: all registered users can be correctly identified by the face recognition access control system and allowed to enter; all unregistered users are rejected by the face recognition access control system. However, the face recognition access control system in the related art still has a high probability of misjudgment and poor system robustness.

[0004] Therefore, how to reduce the probability of misjudgment in face recognition and improve the robustness of the system has become a technical problem that needs to be urgently solved in the industry. Summary of the invention

[0005] The present application provides a face recognition method, device and face recognition access control system, which are used to solve the technical problem of how to reduce the probability of misjudgment of face recognition and improve the robustness of the system.

[0006] The present application provides a face recognition method, comprising:

[0007] Obtain a face image to be recognized;

[0008] Inputting the face image to be recognized into a face recognition model, and obtaining a recognition result of the face image to be recognized output by the face recognition model;

[0009] In which, the face recognition model is obtained by training the initial model based on known face image samples and unknown face image samples of the model training device; the computing unit in the model training device is used to reduce the output probability of the unknown face image samples under the category label corresponding to the known face image samples during the training process of the initial model, amplify the feature module values ​​of the known face image samples, and reduce the feature module values ​​of the unknown face image samples.

[0010] In some embodiments, the face recognition model is trained based on the following steps:

[0011] Determine a training data set; the training data set includes a first sample set and a second sample set; the first sample set is determined based on the known face image samples; the second sample set is determined based on the unknown face image samples;

[0012] Training the initial model based on the training data set to obtain the face recognition model;

[0013] Among them, the first computing subunit in the computing unit is used to determine the first classification loss function of each known face image sample, and to determine the second classification loss function of each unknown face image sample; the second computing subunit in the computing unit is used to determine the first constraint function of each known face image sample, and to determine the second constraint function of each unknown face image sample; the third computing subunit in the computing unit is used to determine the loss function based on the first classification loss function and the first constraint function of each known face image sample, and the second classification loss function and the second constraint function of each unknown face image sample, and to update the model parameters of the initial model based on the loss function.

[0014] In some embodiments, the first classification loss function is used to determine the classification loss of the known face image sample; the first constraint function is used to amplify the feature modulus value of the known face image sample; the second classification loss function is used to determine the classification loss of the unknown face image sample under the category label corresponding to the known face image sample; the second constraint function is used to reduce the feature modulus value of the unknown face image sample.

[0015] In some embodiments, determining a first classification loss function for each known face image sample includes:

[0016] Determine the extraction features of each known face image sample and the output weight of each known face image sample under the corresponding category label;

[0017] Determining a normalized exponential function of any known face image sample based on a dot product of an extracted feature and an output weight of any known face image sample and a dot product of an extracted feature and an output weight of each known face image sample;

[0018] Based on the logarithm of the normalized exponential function of each known face image sample, a first classification loss function of each known face image sample is determined.

[0019] In some embodiments, determining the first constraint function for each known face image sample includes:

[0020] Determine the characteristic modulus value of each known face image sample;

[0021] When the feature modulus value of any known face image sample is greater than or equal to the first feature modulus value constraint threshold, setting the first constraint function of any known face image sample to zero;

[0022] When the feature modulus value of any known face image sample is less than the first feature modulus constraint threshold, the first constraint function of any known face image sample is determined based on the ratio of the first feature modulus constraint threshold to the feature modulus value of any known face image sample.

[0023] In some embodiments, determining the second classification loss function for each unknown face image sample includes:

[0024] Determining the extraction features of each unknown face image sample and the output weight of each unknown face image sample under the category label corresponding to the known face image sample;

[0025] Determine the dot product of the extracted features and output weights for each unknown face image sample;

[0026] sorting the dot products in descending order, selecting a preset number of dot products in order from large to small, and determining target category labels corresponding to the preset number of dot products;

[0027] Determine a normalized exponential function of any unknown face image sample based on a dot product of an extracted feature of any unknown face image sample and an output weight under a target category label, and a dot product of an extracted feature of each unknown face image sample and an output weight under a target category label;

[0028] Based on the logarithm of the normalized exponential function of each unknown face image sample and the number of target category labels, a second classification loss function of each unknown face image sample is determined.

[0029] In some embodiments, the determining of the second constraint function for each unknown face image sample includes:

[0030] Determine the characteristic modulus value of each unknown face image sample;

[0031] When the feature modulus value of any unknown face image sample is less than or equal to the second feature modulus value constraint threshold, setting the second constraint function of any unknown face image sample to zero;

[0032] When the characteristic modulus value of any unknown facial image sample is greater than the second characteristic modulus value constraint threshold, the second constraint function of any unknown facial image sample is determined based on the ratio of the second characteristic modulus value constraint threshold to the characteristic modulus value of any unknown facial image sample.

[0033] In some embodiments, the training of the initial model based on the training data set includes:

[0034] In a current training cycle, a first number of known face image samples are selected from the first sample set, and a second number of unknown face image samples are selected from the second sample set; the first number is equal to the second number;

[0035] Determine the first number of known face image samples and the second number of unknown face image samples as training samples corresponding to a current batch in a current training cycle;

[0036] Training the initial model based on the training samples corresponding to the current batch;

[0037] Determining training samples corresponding to a next batch based on unselected facial image samples in the first sample set and the second sample set;

[0038] When all known face image samples in the first sample set have been selected, the current training cycle ends.

[0039] In some embodiments, before selecting a first number of known face image samples from the first sample set and selecting a second number of unknown face image samples from the second sample set, the method further includes:

[0040] The order of samples in the first sample set and the second sample set is randomly arranged.

[0041] In some embodiments, determining the training data set includes:

[0042] Obtain known face image samples and unknown face image samples;

[0043] Aligning the known face image samples and the face images in the unknown face image samples.

[0044] In some embodiments, the face recognition model includes a feature extraction network, a second fully connected layer, and a loss function layer connected in sequence;

[0045] The feature extraction network includes a plurality of sequentially connected convolutional layers and a first fully connected layer.

[0046] The present application provides a face recognition device, comprising:

[0047] An acquisition unit, used for acquiring a face image to be recognized;

[0048] A recognition unit, used for inputting the face image to be recognized into a face recognition model, and obtaining a recognition result of the face image to be recognized output by the face recognition model;

[0049] In which, the face recognition model is obtained by training the initial model by a model training device based on known face image samples and unknown face image samples; the computing unit in the model training device is used to reduce the output probability of the unknown face image samples under the category label corresponding to the known face image samples during the training process of the initial model, amplify the feature module values ​​of the known face image samples, and reduce the feature module values ​​of the unknown face image samples.

[0050] The present application provides a face recognition access control system, comprising:

[0051] The acquisition module is used to acquire images of the user to be identified and obtain the face image to be identified;

[0052] A recognition module, used for inputting the face image to be recognized into a face recognition model, and obtaining a recognition result of the face image to be recognized output by the face recognition model;

[0053] An access control module, used to determine the access control permission of the user to be identified based on the recognition result of the face image to be identified;

[0054] Wherein, the face recognition model is determined based on the face recognition method.

[0055] In some embodiments, the identification module is used to:

[0056] Inputting the face image to be identified into a face recognition model, obtaining the maximum output probability of the face image to be identified output by the face recognition model, the category label corresponding to the maximum output probability, and the characteristic module value of the face image to be identified;

[0057] In the case where the maximum output probability is greater than a preset probability threshold and the characteristic modulus is greater than a preset modulus threshold, determining that the user to be identified is a registered user;

[0058] Based on the category label corresponding to the maximum output probability, the identity information of the registered user is determined.

[0059] In some embodiments, the identification module is used to:

[0060] In the case where there are multiple facial images to be identified corresponding to the user to be identified, determining a category label corresponding to each facial image to be identified;

[0061] When the proportion of the number of images belonging to any category label is greater than a preset proportion threshold, the user to be identified is determined to be a registered user, and the identity information of the registered user is determined based on the any category label.

[0062] In some embodiments, the access control module is used to:

[0063] Based on the identity information of the registered user, the access permission of the registered user is determined.

[0064] In some embodiments, the system further comprises:

[0065] A model building module, used to obtain a network model description file; and build the face recognition model based on the network model description file;

[0066] The network model description file is used to store weight parameters and structural parameters of the face recognition model.

[0067] In some embodiments, the system further comprises:

[0068] A sample construction module, used to obtain facial images of registered users and unregistered users in the facial recognition access control system;

[0069] Determine the facial image of the registered user as a known facial image sample, and determine a category label corresponding to the known facial image sample based on the registered user;

[0070] The facial image of the unregistered user is determined as an unknown facial image sample.

[0071] The present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the face recognition method when executing the computer program.

[0072] The present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, and the computer program implements the face recognition method when executed by a processor.

[0073] The face recognition method, device and face recognition access control system provided by the embodiments of the present application input the face image to be recognized into the face recognition model to obtain the recognition result of the face image to be recognized output by the face recognition model; because the face recognition model is trained based on known face image samples and unknown face image samples, the samples of the known class and the samples of the unknown class together provide more comprehensive information for the model, which helps the model to fully learn the distribution law of face features of different categories; because the face recognition model can reduce the output probability of the unknown face image sample under the category label corresponding to the known face image sample, the unknown class sample is not easily misidentified as a known class; because the face recognition model can amplify the feature modulus value of the known face image sample and reduce the feature modulus value of the unknown face image sample, the model can more easily recognize the features in the known class sample; in the above manner, the probability of misjudgment of face recognition is reduced, and the generalization ability of the model and the accuracy of the recognition result are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0075] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0076] Figure 1 It is a flowchart of the face recognition method provided by this application.

[0077] Figure 2 This is a schematic diagram of the hardware architecture of face recognition provided by this application.

[0078] Figure 3 It is a schematic diagram of the training process of the face recognition model provided in this application.

[0079] Figure 4 It is a schematic diagram of the reasoning process of the face recognition model provided in this application.

[0080] Figure 5 It is a structural diagram of the face recognition model provided in this application.

[0081] Figure 6 It is a structural schematic diagram of the face recognition device provided in this application.

[0082] Figure 7 This is one of the structural diagrams of the face recognition access control system provided in this application.

[0083] Figure 8 This is the second structural diagram of the face recognition access control system provided by this application.

[0084] Fig. 9 This is the third structural diagram of the face recognition access control system provided by this application.

[0085] Fig.10 It is a schematic diagram of the application scenario of the face recognition method provided in this application.

[0086] Fig.11 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0087] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0088] It should be noted that the terms "first", "second" etc. in the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0089] The face recognition task can be regarded as a multi-class classification task, where registered users in the face recognition access control system are regarded as known classes, and unregistered users are regarded as unknown classes. One of the related technologies is to merge all unknown classes into a single class. When a certain class of samples in the unknown class is very close to a known class, it will make it difficult to correctly identify the samples of this unknown class; the second related technology is to set multiple known classes. A certain class of samples in the unknown class will also output high probability values ​​on certain known classes, making it very difficult to pass the threshold selection and the samples are difficult to be correctly identified.

[0090] In order to solve the shortcomings of related technologies, Figure 1 It is a flowchart of the face recognition method provided by this application, such as Figure 1As shown, the method includes step 110 and step 120.

[0091] Step 110: Obtain a face image to be recognized.

[0092] Specifically, the face recognition method provided in the embodiment of the present application is performed by a face recognition device. The device can be implemented by software, such as a face recognition program that can be run on a computer; or it can be a device that performs the face recognition method, such as a smart terminal, a tablet computer, a computer or a server.

[0093] The facial image to be identified is a facial image of a user that needs to be identified. Taking an access control system that deploys facial recognition technology as an example, the facial image to be identified can be a facial image of a user that has been registered in the access control system, or a facial image of a user that has not been registered in the access control system.

[0094] Step 120: input the face image to be identified into the face recognition model to obtain the recognition result of the face image to be identified output by the face recognition model; wherein the face recognition model is obtained by training the initial model based on known face image samples and unknown face image samples by a model training device; the computing unit face recognition model in the model training device is used to reduce the output probability of the unknown face image samples under the category label corresponding to the known face image samples during the training process of the initial model, amplify the feature module values ​​of the known face image samples, and reduce the feature module values ​​of the unknown face image samples.

[0095] Specifically, the recognition result of the face image to be recognized may include output probability, category label, feature modulus value, etc.

[0096] The category label refers to the user information corresponding to the face image to be identified, for example, it may include the user's identity information, etc. Each registered user may be regarded as a known class, and the user's identity information may be determined as the category label corresponding to the face image.

[0097] The output probability refers to the possibility that the face image to be identified corresponds to each category label. The greater the output probability of the face image to be identified corresponding to any category label, the more likely the face image to be identified belongs to the user corresponding to the category label.

[0098] The feature modulus refers to the vector norm of the facial features extracted from the face image to be recognized. The larger the feature modulus, the more important the extracted facial features are, the stronger the distinguishing ability is, the greater the impact on the recognition results is, and it is conducive to improving the recognition accuracy.

[0099] The face recognition model can be obtained by pre-training. Specifically, the face recognition model can be obtained by the following training method: first, a large number of known face image samples and unknown face image samples are collected. The known face image samples can be obtained by collecting face images of registered users, and the unknown face image samples can be obtained by collecting face images of unregistered users or generated by computer simulation; secondly, the category label of each face image sample (including known face image samples and unknown face image samples) is determined. Then, the initial model is trained according to the known face image samples and the unknown face image samples to improve the recognition ability of the initial model for face images, and the face recognition model is obtained.

[0100] The embodiment of the present application does not specifically limit the selection of the initial model. For example, the initial model may be ResNet18, ResNet50, ResNet100 or MobileNet.

[0101] Figure 2 This is a schematic diagram of the hardware architecture of face recognition provided by this application, such as Figure 2 As shown, it includes a collection device 210, a database 240, a model training device 220 and a face recognition device 230.

[0102] The acquisition device 210 may specifically be an image acquisition sensor such as a video camera or a still camera.

[0103] The model training device 220 may include a computing unit 221 and a storage unit 222. The model training device may specifically be a computer or a server. The computing unit may specifically be a processor, including a central processing unit or a graphics processing unit for model training. The storage unit may specifically be a storage device such as a solid state drive. The computing unit 221 may specifically include a first computing subunit 2211, a second computing subunit 2212, and a third computing subunit 2213.

[0104] Figure 3 This is a schematic diagram of the training process of the face recognition model provided by this application. Figure 3 As shown, the first computing subunit can be used to calculate the classification loss during the model training process, the second computing subunit can be used to calculate the constraints during the model training process, and the third computing subunit can determine the loss based on the classification loss and the constraints, and update the model parameters based on the loss.

[0105] The face recognition device 230 may include an acquisition unit 231 and a recognition unit 232. The face recognition device may be a computer or a server. The acquisition unit may be a data communication or interface device. The recognition unit may be a processor, including a central processing unit or a graphics processor for model inference.

[0106] From a functional point of view, the acquisition unit is mainly used to acquire images of registered users or unregistered users to obtain face images. The database is used to store the acquired face images. The face images stored in the database can be recognized face images or unrecognized face images. The recognized face images (including registered users and unregistered users) can be input into the model training device as face image samples for training to obtain a face recognition model. The computing unit is mainly used to train the initial model to obtain a face recognition model, and the storage unit is used to store model parameters to obtain a network model description file.

[0107] The recognition unit in the face recognition device obtains the network model description file from the model training device to build the face recognition model, and receives the face image to be recognized from the acquisition unit, and obtains the recognition result after recognition. The face image to be recognized and its recognition result can be stored in the database as a new sample.

[0108] Figure 4 This is a schematic diagram of the reasoning process of the face recognition model provided by this application, such as Figure 4 As shown, the face recognition model can also distinguish unknown class samples from known class samples by comparing probability thresholds and comparing feature modulus values, thereby improving the accuracy of the recognition results.

[0109] During the model training process, this application makes improvements in the following aspects:

[0110] On the one hand, the face recognition model can extract features and identify unknown face image samples, reducing the output probability of unknown face image samples under the category labels corresponding to known face image samples, that is, making the unknown class samples output smaller probability values ​​on the known class, making it less likely for unknown class samples to be misidentified as known classes;

[0111] On the other hand, the face recognition model can amplify the feature modulus values ​​of known face image samples and reduce the feature modulus values ​​of unknown face image samples, that is, amplify the influence of features in known class samples on the recognition results and reduce the influence of features in unknown class samples on the recognition results.

[0112] The face recognition method provided in the embodiment of the present application obtains a face image to be recognized, inputs the face image to be recognized into a face recognition model, and obtains a recognition result of the face image to be recognized output by the face recognition model; since the face recognition model is trained based on known face image samples and unknown face image samples, samples of known classes and samples of unknown classes together provide more comprehensive information for the model, which helps the model to fully learn the distribution patterns of face features of different classes; since the face recognition model can reduce the output probability of unknown face image samples under the class labels corresponding to known face image samples, it is not easy for unknown class samples to be misidentified as known classes; since the face recognition model can amplify the feature modulus values ​​of known face image samples and reduce the feature modulus values ​​of unknown face image samples, it is easier for the model to recognize features in known class samples; in the above manner, the probability of misjudgment of face recognition is reduced, and the generalization ability of the model and the accuracy of the recognition results are improved.

[0113] It should be noted that each implementation method of the present application can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.

[0114] In some embodiments, the face recognition model is trained based on the following steps:

[0115] Determine a training data set; the training data set includes a first sample set and a second sample set; the first sample set is determined based on known face image samples; the second sample set is determined based on unknown face image samples;

[0116] The initial model is trained based on the training data set to obtain a face recognition model;

[0117] Among them, the first computing subunit in the computing unit is used to determine the first classification loss function of each known face image sample, and to determine the second classification loss function of each unknown face image sample; the second computing subunit in the computing unit is used to determine the first constraint function of each known face image sample, and to determine the second constraint function of each unknown face image sample; the third computing subunit in the computing unit is used to determine the loss function based on the first classification loss function and the first constraint function of each known face image sample, and the second classification loss function and the second constraint function of each unknown face image sample, and to update the model parameters of the initial model based on the loss function.

[0118] Specifically, known face image samples can be selected as the first sample set, and unknown face image samples can be selected as the second sample set. A training data set is generated based on the first sample set and the second sample set to train the initial model to obtain a face recognition model.

[0119] For example, the face recognition training set includes two subsets: the first sample set and the second sample set . It is a set of samples of known classes, that is, the set of samples that the face recognition system needs to correctly identify the identity; is a sample set of unknown classes, that is, a sample set of identities that the face recognition system needs to reject (in the model training process, the set The samples in the collection simulate illegal intruders of the face recognition system). Ideally, the collection Should include collection All categories except the included categories. However, it is impossible to obtain samples of all unknown classes for training models, so this application defines the set is a subset of all unknown classes. If the set contains tens of thousands of unknown classes, then the face recognition model trained using this application has sufficient generalization ability, and the model can not only reject It can also reject samples of unknown classes contained in it and refuse to recognize samples of other unknown classes.

[0120] In the process of training the initial model, a classification loss function and a constraint function can be defined. According to the results of the classification loss function and the constraint function, the model parameters are adjusted. The above method steps are mainly implemented by the calculation unit in the model training device. The calculation unit includes a first calculation subunit, a second calculation subunit and a third calculation subunit.

[0121] For each known face image sample, a first classification loss function and a first constraint function can be determined. The first classification loss function is used to determine the classification loss of the known face image sample. The first constraint function is used to amplify the feature modulus value of the known face image sample. The first classification loss function is calculated by the first calculation subunit in the calculation unit, and the first constraint function is calculated by the second calculation subunit in the calculation unit.

[0122] For each unknown face image sample, a second classification loss function and a second constraint function can be determined. The second classification loss function is used to determine the classification loss of the unknown face image sample under the category label corresponding to the known face image sample. The second constraint function is used to reduce the feature modulus value of the unknown face image sample. The second classification loss function is calculated by the first calculation subunit in the calculation unit, and the second constraint function is calculated by the second calculation subunit in the calculation unit.

[0123] According to the first classification loss function and the first constraint function of each known face image sample, and the second classification loss function and the second constraint function of each unknown face image sample, a total loss function is determined. According to the total loss function, the model parameters of the initial model are updated to obtain a face recognition model. The determination of the loss function and the updating of the model parameters are performed by the third computing subunit.

[0124] The face recognition method provided in the embodiment of the present application determines a first classification loss function and a first constraint function for known face image samples, and determines a second classification loss function and a second constraint function for unknown face image samples; the classification loss function can reduce the output probability of unknown face image samples under the category label corresponding to the known face image samples, and the constraint function can amplify the feature module values ​​of the known face image samples and reduce the feature module values ​​of the unknown face image samples; the misjudgment probability of face recognition is reduced, and the generalization ability of the model and the accuracy of the recognition results are improved.

[0125] In some embodiments, determining a first classification loss function for each known face image sample includes:

[0126] Determine the extraction features of each known face image sample and the output weight of each known face image sample under the corresponding category label;

[0127] Determine a normalized exponential function for any known face image sample based on a dot product of an extracted feature and an output weight for any known face image sample and a dot product of an extracted feature and an output weight for each known face image sample;

[0128] Based on the logarithm of the normalized exponential function of each known face image sample, a first classification loss function of each known face image sample is determined.

[0129] Specifically, in order to facilitate the reading and use of data during the face recognition model training process, the face images are first grouped according to the user identity information (ID) (each group contains the face images of one person), and then a category label (class label) is given to each group. The total number of user identity information (ID) (the total number of IDs is also the total number of people) is expressed as , the category label can be expressed as ; Second sample set The total number of user identity information (ID) is expressed as , the category label can be expressed as .

[0130] When training the face recognition model, the number of samples contained in each training batch is . Input A sample face image is . yes The corresponding category label.

[0131] The extracted features after the face recognition model processes the face image samples can be expressed as , a given input face image sample can be represented as , the extracted features of face image samples are , is considered as a column vector. The face recognition model is used for face image samples The output weight of can be expressed as The weight matrix of the face recognition model is , is the weight matrix of List, represent The transposed vector of . represents the dot product of two vectors, Represents the L2 norm of the vector, that is, the modulus of the vector. In the face recognition model, the output may not contain the bias term. The present application can be extended to the case where a bias term is included. However, there is no significant difference in performance after adding the bias term.

[0132] if , indicating that the current sample is a known face image sample, and determining the extraction features of each known face image sample , and the output weights of each known face image sample under the corresponding category label .

[0133] According to the dot product of the extracted features and output weights of any known face image sample, and the dot product of the extracted features and output weights of each known face image sample, the normalized exponential function of any known face image sample is determined, and according to the logarithm of the normalized exponential function of each known face image sample, the first classification loss function of each known face image sample is determined, which is expressed by the formula:

[0134] , .

[0135] In the formula, is a known face image sample The first classification loss function, in this formula Indicates the serial number of the category label corresponding to the known face image sample.

[0136] The face recognition method provided in the embodiment of the present application determines the first classification loss function of each known face image sample based on the logarithm of the normalized exponential function of each known face image sample, thereby improving the accuracy of determining the classification loss and improving the accuracy of the face recognition result.

[0137] In some embodiments, determining the first constraint function of each known face image sample includes:

[0138] Determine the characteristic modulus value of each known face image sample;

[0139] When the feature modulus value of any known face image sample is greater than or equal to the first feature modulus value constraint threshold, setting the first constraint function of any known face image sample to zero;

[0140] When the feature modulus value of any known face image sample is less than the first feature modulus value constraint threshold, the first constraint function of any known face image sample is determined based on the ratio of the first feature modulus value constraint threshold to the feature modulus value of any known face image sample.

[0141] Specifically, the feature modulus value of a known face image sample can be expressed by the L2 norm of the extracted feature, and the first constraint function of any known face image sample can be expressed as:

[0142]

[0143] In the formula, is a known face image sample The first constraint function is is the first characteristic modulus value constraint threshold.

[0144] The purpose of the first constraint function is to amplify the feature modulus of the known face image sample, thereby achieving the constraint. When the feature modulus of any known face image sample is greater than or equal to the first feature modulus constraint threshold ( ≥ ), the value of the first constraint function is zero; when the feature modulus value of any known face image sample is less than the first feature modulus value constraint threshold, the value of the first constraint function is .

[0145] Using the first constraint function as a constraint term can make the characteristic modulus value of the known face image sample tend to a larger value (that is, away from That is to say, after the model training is completed, if the input sample is a sample of a known class, then the input sample The output characteristic modulus value is greater than .

[0146] The first characteristic modulus value constraint threshold Should satisfy In this embodiment, it is set .

[0147] The face recognition method provided in the embodiment of the present application amplifies the feature modulus value of a known face image sample according to a first constraint function, so that the model can more easily recognize features in known class samples, thereby improving the accuracy of face recognition results.

[0148] In some embodiments, determining a second classification loss function for each unknown face image sample includes:

[0149] Determine the extraction features of each unknown face image sample and the output weight of each unknown face image sample under the category label corresponding to the known face image sample;

[0150] Determine the dot product of the extracted features and output weights for each unknown face image sample;

[0151] Sort the dot products in descending order, select a preset number of dot products in order from large to small, and determine the target category labels corresponding to the preset number of dot products;

[0152] Determine a normalized exponential function of any unknown face image sample based on a dot product of an extracted feature of any unknown face image sample and an output weight under a target category label, and a dot product of an extracted feature of each unknown face image sample and an output weight under a target category label;

[0153] Based on the logarithm of the normalized exponential function of each unknown face image sample and the number of target category labels, a second classification loss function of each unknown face image sample is determined.

[0154] Specifically, if , indicating that the current sample is an unknown face image sample. Indicates the serial number of the category label corresponding to the known face image sample, . Indicates the category label corresponding to the unknown face image sample in the known face image sample The extracted features of each unknown face image sample can be expressed as .

[0155] The features extracted from each unknown face image sample can be , and the output weights of each unknown face image sample under the category label corresponding to the known face image sample , calculate the dot product of the extracted features and output weights of each unknown face image sample , a total of The preset quantity can be expressed as . Sort these dot products in descending order, and select the preset number in order from large to small The dot product of , and determines the target category label corresponding to the preset number of dot products. The serial number of the target category label can be expressed as .

[0156] The preset quantity can be determined as needed. Needs to be satisfied ,For example .

[0157] According to the dot product of the extracted features of any unknown face image sample and the output weight under the target category label, and the dot product of the extracted features of each unknown face image sample and the output weight under the target category label, the normalized exponential function of any unknown face image sample is determined, and according to the logarithm of the normalized exponential function of each unknown face image sample and the number of target category labels, the second classification loss function of each unknown face image sample is determined, which can be expressed by the formula:

[0158] ,

[0159] In the formula, is an unknown face image sample The second classification loss function is Indicates the sequence number of the target category label, The sequence number representing the category label.

[0160] When the input sample , To limit the input samples The output probability value of , in each training iteration, the training algorithm makes the input sample exist The output probability of the known categories remains close to zero. The output probabilities of known categories are kept uniformly distributed. To better achieve this goal, this application will The probability values ​​are arranged from large to small, and then the first M values ​​are restricted to maintain a uniform distribution. Ignore other These probability values ​​are close to zero and do not need further restriction.

[0161] The face recognition method provided in the embodiment of the present application determines the second classification loss function of each unknown face image sample based on the logarithm of the normalized exponential function of each unknown face image sample and the number of target category labels, thereby improving the accuracy of determining the classification loss and improving the accuracy of the face recognition results.

[0162] In some embodiments, determining the second constraint function for each unknown face image sample includes:

[0163] Determine the characteristic modulus value of each unknown face image sample;

[0164] When the feature modulus value of any unknown face image sample is less than or equal to the second feature modulus value constraint threshold, setting the second constraint function of any unknown face image sample to zero;

[0165] When the feature modulus value of any unknown face image sample is greater than the second feature modulus value constraint threshold, the second constraint function of any unknown face image sample is determined based on the ratio of the second feature modulus value constraint threshold to the feature modulus value of any unknown face image sample.

[0166] Specifically, the feature modulus value of the unknown face image sample can be expressed by the L2 norm of the extracted feature, and the second constraint function of any unknown face image sample can be expressed as:

[0167]

[0168] In the formula, is an unknown face image sample The second constraint function is is the second characteristic modulus value constraint threshold.

[0169] The purpose of the second constraint function is to reduce the feature modulus value of the unknown face image sample, thereby achieving the constraint. When the feature modulus value of any unknown face image sample is less than or equal to the second feature modulus value constraint threshold ( ), the second constraint function of any unknown face image sample is set to zero; when the feature modulus value of any unknown face image sample is greater than the second feature modulus constraint threshold, based on the ratio of the second feature modulus constraint threshold to the feature modulus value of any unknown face image sample, the second constraint function of any unknown face image sample is determined to be .

[0170] Using the second constraint function as a constraint term, the characteristic modulus value of the unknown face image sample can be tends to a smaller value (that is, tends to zero). That is to say, after the model training is completed, if the input sample is a sample of an unknown class, then the input sample The output characteristic modulus value is less than .

[0171] The second characteristic modulus value constraint threshold Should satisfy In this embodiment, it is set .

[0172] The face recognition method provided in the embodiment of the present application reduces the feature modulus value of the unknown face image sample according to the second constraint function, so that the model pays less attention to the features in the unknown class samples, thereby improving the accuracy of the face recognition results.

[0173] In some embodiments, the first feature modulus constraint threshold is greater than the second feature modulus constraint threshold, so that the feature modulus of the known face image sample is greater than the feature modulus of the unknown face image sample, which has a stronger distinguishing ability and a greater impact on the recognition results, and is conducive to improving the recognition accuracy.

[0174] In some embodiments, the loss function of a single sample (known face image sample or unknown face image sample) is It can be expressed as:

[0175]

[0176] in, , .

[0177] In the formula, For any sample, is the weight coefficient of the first constraint function, is the weight coefficient of the second constraint function, , .

[0178] On this basis, the overall loss function of a batch is It can be expressed as:

[0179]

[0180] In the formula, is the number of samples in a batch, is the sample serial number.

[0181] In some embodiments, training the initial model based on the training data set includes:

[0182] In a current training cycle, a first number of known face image samples are selected from a first sample set, and a second number of unknown face image samples are selected from a second sample set; the first number is equal to the second number;

[0183] Determine a first number of known face image samples and a second number of unknown face image samples as training samples corresponding to a current batch in a current training cycle;

[0184] Train the initial model based on the training samples corresponding to the current batch;

[0185] Determine the training samples corresponding to the next batch based on the facial image samples that are not selected in the first sample set and the second sample set;

[0186] When all known face image samples in the first sample set have been selected, the current training cycle ends.

[0187] Specifically, training the initial model may include multiple training cycles, and multiple batches of face image samples are used for training in each training cycle.

[0188] The training data set includes the first sample set and the second sample set In each training batch, this application selects samples from the first sample set and the second sample set Extract a part of the samples to form a batch of samples. In each batch of samples, it is the optimal setting to extract the same number of samples from the above two sets. Assuming that the total number of samples in a batch is N, then from the training set and training set Extract N / 2 samples respectively.

[0189] For example, depending on the configuration of the training server (memory or video memory limitations), the number of samples in each batch can be set to 128, 256, 512, or 1024, etc. This application recommends that the number of samples in a batch be at least 1024. The training algorithm reads a batch of training samples each time, starting from the first sample set. and the second sample set 512 samples are taken from each, and these samples are used to calculate the loss function value and the constraint value of the loss function, and then the neural network back propagation algorithm is used to update the model parameters.

[0190] The total training cycle (epoch) is set to 20 training cycles. One training cycle is the first sample set All training samples are used once without duplication. In one training cycle, All training samples of have been used, so the second sample set After being reshuffled, Extract samples from the first sample set; if In one training cycle, If all training samples are not used, then at the beginning of the next training cycle, the second sample set The order is also reshuffled, and then from the second sample set Extract samples from.

[0191] When one training cycle (epoch) ends, the next training cycle (epoch) begins. When the total number of training cycles reaches the preset value, the training ends. It is worth noting that in special cases, within a training cycle, the total number of samples in the data set cannot be divided into integer batches, and some samples are not used (discarded directly) or are used multiple times (in order to complete the data, for example, adding several samples that have been used to the end of the data set). The impact of these cases on the training results can be ignored.

[0192] The following describes in detail the training process of the face recognition model.

[0193] Training input: From the first sample set and the second sample set Read data in; initial training cycle , total training cycle ; Stochastic gradient descent algorithm related parameters: The initial learning rate is , momentum coefficient , the weight decay coefficient is , in the 10th training cycle, the learning rate drops to , in the 15th training cycle, the learning rate drops to , in the 18th training cycle, the learning rate dropped to The number of samples in a batch is 1024, from and Take 512 samples respectively.

[0194] Training output: face recognition model.

[0195] Loss function: Set the classification loss function (including the first classification loss function and the second classification loss function) and the feature modulus constraint function (including the first constraint function and the second constraint function).

[0196] Training step 1: (Start training) Use random initialization method to initialize the learnable parameters of the initial model.

[0197] Training step 2: When When ( for the current cycle), do the following:

[0198] (a) ; (b) Data collection and dataset The order of samples in are randomly shuffled; (c) a batch of training samples is selected from the data set and data collection Take 512 samples respectively; (d) Calculate the loss value according to the above training samples and parameter settings, and then use the stochastic gradient descent algorithm to update the model parameters; (e) Repeat operations (c) and (d) until the data set All samples are utilized; (f) the current training cycle ends.

[0199] Training step three: End training and output the face recognition model.

[0200] The face recognition method provided in the embodiment of the present application selects multiple batches of samples through multiple training cycles to train the initial model to obtain a face recognition model, thereby improving the generalization ability of the model and the accuracy of the recognition results.

[0201] In some embodiments, before selecting a first number of known face image samples from the first sample set and selecting a second number of unknown face image samples from the second sample set, the method further includes:

[0202] The order of samples in the first sample set and the second sample set is randomly arranged.

[0203] Specifically, in order to prevent the order of samples in the data set from affecting the performance of the model and to improve the generalization performance of the model, at the beginning of each training cycle, the first sample set and the second sample set All samples in are randomly rearranged (that is, the order is shuffled).

[0204] In some embodiments, determining a training data set includes:

[0205] Obtain known face image samples and unknown face image samples;

[0206] Align the face images in the known face image samples and the unknown face image samples.

[0207] Specifically, the training samples of the face recognition model need to meet certain specifications. Generally speaking, the input image of the face recognition model is a color image with three channels (R, G, and B channels) of a fixed size. The face images in the training data set of this application are also color images with three channels (R, G, and B channels) of a fixed size, for example, the image width is 112 pixels, the image height is 112 pixels, and the number of channels is 3. When the size of the input image is not the above size, this application can be simply expanded to adapt to changes in the size of the input image. When the input image is a single-channel grayscale image or an image in other formats (such as YUV format), this application can also be simply expanded to adapt to changes in the input image (channel).

[0208] One of the prerequisites for deep learning-based face recognition technology to achieve high accuracy is to use a large-scale face recognition training set to train the face recognition model. In order to train a high-precision face recognition model, the face recognition training set needs to have sufficient depth and breadth, where: depth refers to the number of face images per person (ID) (the more face images, the better, and these images should come from a variety of scenes and include factors such as changes in lighting, occlusion, accessories, facial posture, and age); breadth refers to the number of people included in the training set (the more people, the better, and it should include people of different races, genders, and skin colors). The first sample set The number of identities included is a fixed number, that is, the number of identities that the face recognition system needs to recognize; the second sample set Including unknown classes, the more categories and samples of unknown classes, the better. In order to obtain a high-performance face recognition model, this application recommends that the number of categories of unknown classes should be no less than 10,000, and each category should have no less than 10 samples. In general, when the face training data set contains more training data, the face recognition model trained using the method proposed in this application has higher accuracy. Here, the training samples are normalized face images preprocessed by the face alignment algorithm.

[0209] The face recognition method provided in the embodiment of the present application aligns the face images in the known face image samples and the face images in the unknown face image samples, which can improve the accuracy of face recognition.

[0210] In some embodiments, the face recognition model includes a feature extraction network, a second fully connected layer, and a loss function layer connected in sequence;

[0211] The feature extraction network includes multiple sequentially connected convolutional layers and a first fully connected layer.

[0212] Specifically, Figure 5 It is a structural diagram of the face recognition model provided by this application, such as Figure 5 As shown, the face recognition model may include a feature extraction network, a second fully-connected layer, and a loss function layer. The feature extraction network may include multiple convolutional layers and a first fully-connected layer.

[0213] The first five groups of convolutional layers (conv1, conv2_x, conv3_x, conv4_x, conv5_x) and the first fully-connected layer of ResNet50 can be connected in sequence as a feature extraction network. The feature extraction network is used to extract the features of face images.

[0214] The input of the first fully connected layer is the output feature of the convolutional layer (conv5_x). The output of the first fully connected layer is a 512-dimensional feature. Here, 512 dimensions is an example, and other dimensions can also be selected, such as 128, 256, and 1024. The 512-dimensional features output by the input sample after passing through the backbone network (feature extraction network) are called the features of the input sample.

[0215] The second fully connected layer input is the output feature of the first fully connected layer. The dimension of the output feature of the second fully connected layer and the first sample set The number of category labels in is the same, and one dimension corresponds to one category label.

[0216] The input of the loss function layer is the output of the second fully connected layer. The output of the loss function layer is the classification probability of the input image. The loss function layer is also used to calculate the loss function. The loss function includes: a loss function constructed based on the total number of categories in the sample set and the input sample, and the loss function is a multi-class classification loss function; a constraint function constructed based on the input sample. The loss function is a linear combination of the multi-class classification loss function and the constraint function.

[0217] The face recognition method provided in the embodiment of the present application, the feature extraction network in the face recognition model includes multiple convolutional layers and fully connected layers, which can extract richer features and improve the accuracy of the model recognition results.

[0218] The device provided in the embodiment of the present application is described below. The device described below and the method described above can be referenced to each other.

[0219] Figure 6 is a schematic diagram of the structure of the face recognition device provided by this application, such as Figure 6 As shown, the face recognition device 230 includes:

[0220] An acquisition unit 231 is used to acquire a face image to be recognized;

[0221] The recognition unit 232 is used to input the face image to be recognized into the face recognition model, and obtain the recognition result of the face image to be recognized output by the face recognition model;

[0222] Among them, the face recognition model is obtained by training the initial model by the model training device based on known face image samples and unknown face image samples; the computing unit face recognition model in the model training device is used to reduce the output probability of unknown face image samples under the category label corresponding to the known face image samples during the training process of the initial model, amplify the feature module values ​​of the known face image samples, and reduce the feature module values ​​of the unknown face image samples.

[0223] The face recognition device provided in the embodiment of the present application obtains a face image to be recognized, inputs the face image to be recognized into a face recognition model, and obtains a recognition result of the face image to be recognized output by the face recognition model; since the face recognition model is trained based on known face image samples and unknown face image samples, samples of known classes and samples of unknown classes together provide more comprehensive information for the model, which helps the model to fully learn the distribution patterns of face features of different classes; since the face recognition model can reduce the output probability of unknown face image samples under the class labels corresponding to known face image samples, unknown class samples are not easily misidentified as known classes; since the face recognition model can amplify the feature modulus values ​​of known face image samples and reduce the feature modulus values ​​of unknown face image samples, the model can more easily recognize features in known class samples; in the above manner, the probability of misjudgment of face recognition is reduced, and the generalization ability of the model and the accuracy of the recognition results are improved.

[0224] In some embodiments, the apparatus further comprises:

[0225] A computing unit, used to determine a training data set; the training data set includes a first sample set and a second sample set; the first sample set is determined based on known face image samples; the second sample set is determined based on unknown face image samples;

[0226] The initial model is trained based on the training data set to obtain a face recognition model;

[0227] Among them, the first computing subunit in the computing unit is used to determine the first classification loss function of each known face image sample, and to determine the second classification loss function of each unknown face image sample; the second computing subunit in the computing unit is used to determine the first constraint function of each known face image sample, and to determine the second constraint function of each unknown face image sample; the third computing subunit in the computing unit is used to determine the loss function based on the first classification loss function and the first constraint function of each known face image sample, and the second classification loss function and the second constraint function of each unknown face image sample, and to update the model parameters of the initial model based on the loss function.

[0228] In some embodiments, a first classification loss function is used to determine the classification loss of known face image samples; a first constraint function is used to amplify the characteristic modulus values ​​of known face image samples; a second classification loss function is used to determine the classification loss of unknown face image samples under the category labels corresponding to the known face image samples; and a second constraint function is used to reduce the characteristic modulus values ​​of unknown face image samples.

[0229] In some embodiments, the computing unit is configured to:

[0230] Determine the extraction features of each known face image sample and the output weight of each known face image sample under the corresponding category label;

[0231] Determine a normalized exponential function for any known face image sample based on a dot product of an extracted feature and an output weight for any known face image sample and a dot product of an extracted feature and an output weight for each known face image sample;

[0232] Based on the logarithm of the normalized exponential function of each known face image sample, a first classification loss function of each known face image sample is determined.

[0233] In some embodiments, the computing unit is configured to:

[0234] Determine the characteristic modulus value of each known face image sample;

[0235] When the feature modulus value of any known face image sample is greater than or equal to the first feature modulus value constraint threshold, setting the first constraint function of any known face image sample to zero;

[0236] When the feature modulus value of any known face image sample is less than the first feature modulus value constraint threshold, the first constraint function of any known face image sample is determined based on the ratio of the first feature modulus value constraint threshold to the feature modulus value of any known face image sample.

[0237] In some embodiments, the computing unit is configured to:

[0238] Determine the extraction features of each unknown face image sample and the output weight of each unknown face image sample under the category label corresponding to the known face image sample;

[0239] Determine the dot product of the extracted features and output weights for each unknown face image sample;

[0240] Sort the dot products in descending order, select a preset number of dot products in order from large to small, and determine the target category labels corresponding to the preset number of dot products;

[0241] Determine a normalized exponential function of any unknown face image sample based on a dot product of an extracted feature of any unknown face image sample and an output weight under a target category label, and a dot product of an extracted feature of each unknown face image sample and an output weight under a target category label;

[0242] Based on the logarithm of the normalized exponential function of each unknown face image sample and the number of target category labels, a second classification loss function of each unknown face image sample is determined.

[0243] In some embodiments, the computing unit is configured to:

[0244] Determine the characteristic modulus value of each unknown face image sample;

[0245] When the feature modulus value of any unknown face image sample is less than or equal to the second feature modulus value constraint threshold, setting the second constraint function of any unknown face image sample to zero;

[0246] When the feature modulus value of any unknown face image sample is greater than the second feature modulus value constraint threshold, the second constraint function of any unknown face image sample is determined based on the ratio of the second feature modulus value constraint threshold to the feature modulus value of any unknown face image sample.

[0247] In some embodiments, the computing unit is configured to:

[0248] In a current training cycle, a first number of known face image samples are selected from a first sample set, and a second number of unknown face image samples are selected from a second sample set; the first number is equal to the second number;

[0249] Determine a first number of known face image samples and a second number of unknown face image samples as training samples corresponding to a current batch in a current training cycle;

[0250] Train the initial model based on the training samples corresponding to the current batch;

[0251] Determine the training samples corresponding to the next batch based on the facial image samples that are not selected in the first sample set and the second sample set;

[0252] When all known face image samples in the first sample set have been selected, the current training cycle ends.

[0253] In some embodiments, the computing unit is configured to:

[0254] The order of samples in the first sample set and the second sample set is randomly arranged.

[0255] In some embodiments, the computing unit is configured to:

[0256] Obtain known face image samples and unknown face image samples;

[0257] Align the face images in the known face image samples and the unknown face image samples.

[0258] In some embodiments, the face recognition model includes a feature extraction network, a second fully connected layer, and a loss function layer connected in sequence; the feature extraction network includes multiple convolutional layers and a first fully connected layer connected in sequence.

[0259] Figure 7 This is one of the structural diagrams of the face recognition access control system provided by this application, such as Figure 7 As shown, the face recognition access control system 400 includes:

[0260] The acquisition module 410 is used to acquire images of the user to be identified and obtain a face image to be identified;

[0261] The recognition module 420 is used to input the face image to be recognized into the face recognition model, and obtain the recognition result of the face image to be recognized output by the face recognition model;

[0262] The access control module 430 is used to determine the access control permission of the user to be identified based on the recognition result of the face image to be identified;

[0263] The face recognition model is determined based on the face recognition method in the above embodiment.

[0264] Specifically, the function of the face recognition access control system in the embodiment of the present application is: if a registered user logs in to the face recognition system, the face recognition system returns the identity information of the user and allows the user to pass through the access control system; if an unregistered user logs in to the face recognition system, the face recognition system returns a prompt word and refuses the unregistered user to pass through the access control system.

[0265] The acquisition module may be an image acquisition device that acquires the user's facial image, and then uses image processing operations such as face detection technology, facial feature point positioning technology, and image affine transformation technology to obtain a facial image to be recognized (input image) that meets the input specifications of the face recognition model. The facial image to be recognized may be one facial image of the user or multiple facial images of the user.

[0266] The recognition module takes as input one or more face images to be recognized. ,in , N represents the number of face images, which are input into the face recognition model to obtain one or more maximum probability values ​​of the input face image to be recognized , the corresponding category label , and the characteristic modulus The recognition module determines the recognition result of the face image to be recognized based on these outputs, for example, it can determine whether the user to be recognized is a registered user.

[0267] The access control module can determine the access control permission of the user to be identified based on the recognition result of the face image to be identified. For example, if the recognition result is that the user is a registered user, the access control module outputs the category of the face sample and allows the user to pass through the access control system; or it displays that the logged-in face sample belongs to an unregistered user (returns a prompt word) and refuses the unregistered user to pass through the access control system.

[0268] The face recognition access control system provided in the embodiment of the present application has a recognition module that uses the face recognition model in the above embodiment to recognize the face image of the user to be recognized, thereby reducing the probability of misjudgment of face recognition, improving the generalization ability of the model and the accuracy of the recognition results, and improving the robustness of the face recognition access control system.

[0269] In some embodiments, the identification module is used to:

[0270] Inputting the face image to be recognized into the face recognition model, obtaining the maximum output probability of the face image to be recognized output by the face recognition model, the category label corresponding to the maximum output probability, and the characteristic modulus value of the face image to be recognized;

[0271] When the maximum output probability is greater than a preset probability threshold and the characteristic modulus is greater than a preset modulus threshold, determining that the user to be identified is a registered user;

[0272] Based on the category label corresponding to the maximum output probability, the identity information of the registered user is determined.

[0273] Specifically, in the process of applying the face recognition model to the recognition module for reasoning, the present application can set two thresholds to judge the input sample Whether it belongs to a known class.

[0274] Input Sample The output probability value of the face recognition model can be expressed as:

[0275]

[0276] Select the maximum output probability from This application uses a preset probability threshold , , to judge Whether it belongs to a known class. If , Belongs to a known class, otherwise Belongs to the unknown category.

[0277] Input Sample Output features of the feature extraction network of the face recognition model , the corresponding modulus value is , this application uses a preset modulus threshold , , to judge Whether it belongs to a known class. If , Belongs to a known class, otherwise Belongs to the unknown category.

[0278] When the input sample When the output of satisfies both of the above conditions, the input sample Belongs to a known class, otherwise the input sample Belongs to the unknown category.

[0279] The recognition module is based on the preset probability threshold and preset modulus threshold To identify the identity of the input face sample.

[0280] When the input is only one image, .if ,and , then the face recognition access control system determines the input face image is a registered user, the corresponding category is (Identity information of registered users); If the above conditions are not met, the face recognition access control system determines that the input face image If the user is not a registered user, the face recognition system will return a prompt and deny the unregistered user to pass through the access control system.

[0281] When multiple images are input, if ,and , then the face recognition access control system determines the input face image is a registered user, the corresponding category is ; If the above conditions are not met, the face recognition access control system determines that the input face image Is an unregistered user.

[0282] The face recognition access control system provided in the embodiment of the present application distinguishes unknown class samples from known class samples through preset probability thresholds and preset modulus thresholds during the model inference process, thereby improving the accuracy of the recognition results and the robustness of the face recognition access control system.

[0283] In some embodiments, the identification module is used to:

[0284] When there are multiple facial images to be identified corresponding to the user to be identified, determining the category label corresponding to each facial image to be identified;

[0285] When the proportion of the number of images belonging to any category label is greater than a preset ratio threshold, the user to be identified is determined to be a registered user, and the identity information of the registered user is determined based on any category label.

[0286] Specifically, the preset ratio threshold may be set as needed, for example, the preset ratio threshold may be 80%.

[0287] When 80% of the N categories corresponding to the N input face images are the same category in the known categories, then this category is the category of the input face sample, and the face recognition access control system determines that this group of images belongs to a registered user. In other cases, the face recognition access control system determines that this group of images belongs to an unregistered user, and the face recognition system returns a prompt word and refuses unregistered users to pass through the access control system.

[0288] The face recognition access control system provided in the embodiment of the present application can identify the user by whether the proportion of the number of images belonging to any category label is greater than a preset proportion threshold, thereby improving the accuracy of the recognition result.

[0289] In some embodiments, the access control module is used to:

[0290] Based on the identity information of the registered user, the access control permission of the registered user is determined.

[0291] Specifically, the access control permission may include permission or rejection. If the user is a registered user, the access control module outputs the category of the face sample and allows the user to pass through the access control system. If the user is an unregistered user, the access control module returns a prompt word and refuses the unregistered user to pass through the access control system.

[0292] In some embodiments, the system further comprises:

[0293] A model building module is used to obtain a network model description file; and build a face recognition model based on the network model description file;

[0294] Among them, the network model description file is used to store the weight parameters and structure parameters of the face recognition model.

[0295] Specifically, Figure 8 This is the second structural diagram of the face recognition access control system provided by this application, such as Figure 8 As shown, the face recognition access control system 400 also includes a model building module 440.

[0296] The network model description file is used to store the weight parameters and structure parameters of the face recognition model. The model construction module can read the input network model description file, and build the input neural network model according to the network model description file, and initialize the weight parameters of the built input neural network model. The initial weight parameters of the network model are parameters obtained by the model training method or randomly initialized parameters. The model construction module is connected to the recognition module to facilitate the recognition module to call the face recognition model.

[0297] The face recognition access control system provided in the embodiment of the present application builds a face recognition model according to a network model description file through a model building module, and can realize fast loading of the face recognition model.

[0298] In some embodiments, the system further comprises:

[0299] A sample construction module is used to obtain face images of registered users and unregistered users in a face recognition access control system;

[0300] Determine the facial image of the registered user as a known facial image sample, and determine the category label corresponding to the known facial image sample based on the registered user;

[0301] The face images of unregistered users are determined as unknown face image samples.

[0302] Specifically, Fig. 9 This is the third structural diagram of the face recognition access control system provided by this application, such as Fig. 9 As shown, the face recognition access control system 400 also includes a sample construction module 450.

[0303] The sample construction module can determine the face images of registered users in the face recognition access control system as known face image samples, and after determining the category label, construct a first sample set; it can also determine the face images generated by computer simulation or the face images of real unregistered users as unknown face image samples to construct a second sample set. The sample construction module is connected to the recognition module, and the samples can be used to train or incrementally learn the face recognition model.

[0304] The face recognition access control system provided in the embodiment of the present application constructs known face image samples and unknown face image samples for training the face recognition model, thereby improving the accuracy of the recognition results.

[0305] Fig.10 is a schematic diagram of an application scenario of the face recognition method provided in this application, such as Fig.10 As shown, the acquisition module in the above embodiment can be implemented by a camera; the recognition module, the model building module and the sample building module can be implemented by a server; the access control module can be implemented by the access control in the related technology. In addition, a database for storing image data, access control permissions and model parameters is also included.

[0306] In this scenario, the camera, server, and access control are interconnected. The camera is used to capture images of each user, obtain the user's face image, and transmit the face image to the server. The server can obtain a face recognition model based on sample training, and recognize the face image captured by the camera based on the face recognition model to determine the identity of each user. If the user is a registered user, the server controls the access control to open; if the user is an unregistered user, the server controls the access control to close.

[0307] Fig.11is a schematic diagram of the structure of the electronic device provided by this application, such as Fig.11 As shown, the electronic device may include: a processor (Processor) 1110, a communication interface (Communications Interface) 1120, a memory (Memory) 1130 and a communication bus (Communications Bus) 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 1140. The processor 1110 may call the logic command in the memory 1130 to execute the method described in the above embodiment, for example:

[0308] Obtain a face image to be identified; input the face image to be identified into a face recognition model to obtain a recognition result of the face image to be identified output by the face recognition model; wherein the face recognition model is trained based on known face image samples and unknown face image samples; the face recognition model is used to reduce the output probability of the unknown face image sample under the category label corresponding to the known face image sample, amplify the feature module value of the known face image sample, and reduce the feature module value of the unknown face image sample.

[0309] In addition, the logical commands in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several commands to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.

[0310] The processor in the electronic device provided in the embodiment of the present application can call the logic instructions in the memory to implement the above method. Its specific implementation method is consistent with the implementation method of the aforementioned method and can achieve the same beneficial effects, which will not be repeated here.

[0311] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the methods provided in the above embodiments are implemented.

[0312] Its specific implementation is consistent with the aforementioned method implementation and can achieve the same beneficial effects, so it will not be repeated here.

[0313] An embodiment of the present application provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0314] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0315] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0316] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A face recognition method, characterized in that: include: Obtain a face image to be recognized; Inputting the face image to be recognized into a face recognition model, and obtaining a recognition result of the face image to be recognized output by the face recognition model; The face recognition model is obtained by training an initial model by a model training device based on known face image samples and unknown face image samples; the computing unit in the model training device is used to reduce the output probability of the unknown face image sample under the category label corresponding to the known face image sample during the training process of the initial model, amplify the feature modulus value of the known face image sample, and reduce the feature modulus value of the unknown face image sample; The first computing subunit in the computing unit is used to determine the first classification loss function of each known face image sample, and to determine the second classification loss function of each unknown face image sample; the second computing subunit in the computing unit is used to determine the first constraint function of each known face image sample, and to determine the second constraint function of each unknown face image sample; the third computing subunit in the computing unit is used to determine the loss function based on the first classification loss function and the first constraint function of each known face image sample, and the second classification loss function and the second constraint function of each unknown face image sample, and to update the model parameters of the initial model based on the loss function; The first constraint function is used to amplify the characteristic modulus value of the known face image sample; the second constraint function is used to reduce the characteristic modulus value of the unknown face image sample; The step of determining the first constraint function for each known face image sample comprises: Determine the characteristic modulus value of each known face image sample; When the feature modulus value of any known face image sample is greater than or equal to the first feature modulus value constraint threshold, setting the first constraint function of any known face image sample to zero; In the case where the feature modulus value of any known face image sample is less than a first feature modulus value constraint threshold, determining a first constraint function of any known face image sample based on a ratio of the first feature modulus value constraint threshold to the feature modulus value of any known face image sample; The step of determining the second constraint function for each unknown face image sample comprises: Determine the characteristic modulus value of each unknown face image sample; When the feature modulus value of any unknown face image sample is less than or equal to the second feature modulus value constraint threshold, setting the second constraint function of any unknown face image sample to zero; When the characteristic modulus value of any unknown facial image sample is greater than the second characteristic modulus value constraint threshold, the second constraint function of any unknown facial image sample is determined based on the ratio of the second characteristic modulus value constraint threshold to the characteristic modulus value of any unknown facial image sample.

2. The face recognition method according to claim 1, characterized in that: The face recognition model is trained based on the following steps: Determine a training data set; the training data set includes a first sample set and a second sample set; the first sample set is determined based on the known face image samples; the second sample set is determined based on the unknown face image samples; The initial model is trained based on the training data set to obtain the face recognition model.

3. The face recognition method according to claim 2, characterized in that: The first classification loss function is used to determine the classification loss of the known face image sample; the second classification loss function is used to determine the classification loss of the unknown face image sample under the category label corresponding to the known face image sample.

4. The face recognition method according to claim 1, characterized in that: The determining of the first classification loss function for each known face image sample comprises: Determine the extraction features of each known face image sample and the output weight of each known face image sample under the corresponding category label; Determining a normalized exponential function of any known face image sample based on a dot product of an extracted feature and an output weight of any known face image sample and a dot product of an extracted feature and an output weight of each known face image sample; Based on the logarithm of the normalized exponential function of each known face image sample, a first classification loss function of each known face image sample is determined.

5. The face recognition method according to claim 1, characterized in that: The determining of the second classification loss function for each unknown face image sample comprises: Determining the extraction features of each unknown face image sample and the output weight of each unknown face image sample under the category label corresponding to the known face image sample; Determine the dot product of the extracted features and output weights for each unknown face image sample; sorting the dot products in descending order, selecting a preset number of dot products in order from large to small, and determining target category labels corresponding to the preset number of dot products; Determine a normalized exponential function of any unknown face image sample based on a dot product of an extracted feature of any unknown face image sample and an output weight under a target category label, and a dot product of an extracted feature of each unknown face image sample and an output weight under a target category label; Based on the logarithm of the normalized exponential function of each unknown face image sample and the number of target category labels, a second classification loss function of each unknown face image sample is determined.

6. The face recognition method according to claim 2, characterized in that: The training of the initial model based on the training data set includes: In a current training cycle, a first number of known face image samples are selected from the first sample set, and a second number of unknown face image samples are selected from the second sample set; the first number is equal to the second number; Determine the first number of known face image samples and the second number of unknown face image samples as training samples corresponding to a current batch in a current training cycle; Training the initial model based on the training samples corresponding to the current batch; Determining training samples corresponding to a next batch based on unselected facial image samples in the first sample set and the second sample set; When all known face image samples in the first sample set have been selected, the current training cycle ends.

7. The face recognition method according to claim 6, characterized in that: Before selecting a first number of known face image samples from the first sample set and selecting a second number of unknown face image samples from the second sample set, the method further includes: The order of samples in the first sample set and the second sample set is randomly arranged.

8. The face recognition method according to claim 2, characterized in that: The determining of the training data set comprises: Obtain known face image samples and unknown face image samples; Aligning the known face image samples and the face images in the unknown face image samples.

9. The face recognition method according to any one of claims 1 to 8, characterized in that: The face recognition model includes a feature extraction network, a second fully connected layer and a loss function layer connected in sequence; The feature extraction network includes a plurality of sequentially connected convolutional layers and a first fully connected layer.

10. A face recognition device, characterized in that: include: An acquisition unit, used for acquiring a face image to be recognized; A recognition unit, used for inputting the face image to be recognized into a face recognition model, and obtaining a recognition result of the face image to be recognized output by the face recognition model; The face recognition model is obtained by training an initial model by a model training device based on known face image samples and unknown face image samples; the computing unit in the model training device is used to reduce the output probability of the unknown face image sample under the category label corresponding to the known face image sample during the training process of the initial model, amplify the feature modulus value of the known face image sample, and reduce the feature modulus value of the unknown face image sample; The first computing subunit in the computing unit is used to determine the first classification loss function of each known face image sample, and to determine the second classification loss function of each unknown face image sample; the second computing subunit in the computing unit is used to determine the first constraint function of each known face image sample, and to determine the second constraint function of each unknown face image sample; the third computing subunit in the computing unit is used to determine the loss function based on the first classification loss function and the first constraint function of each known face image sample, and the second classification loss function and the second constraint function of each unknown face image sample, and to update the model parameters of the initial model based on the loss function; The first constraint function is used to amplify the characteristic modulus value of the known face image sample; the second constraint function is used to reduce the characteristic modulus value of the unknown face image sample; The second computing subunit is used for: Determine the characteristic modulus value of each known face image sample; When the feature modulus value of any known face image sample is greater than or equal to the first feature modulus value constraint threshold, setting the first constraint function of any known face image sample to zero; In the case where the feature modulus value of any known face image sample is less than a first feature modulus value constraint threshold, determining a first constraint function of any known face image sample based on a ratio of the first feature modulus value constraint threshold to the feature modulus value of any known face image sample; The second computing subunit is used for: Determine the characteristic modulus value of each unknown face image sample; When the feature modulus value of any unknown face image sample is less than or equal to the second feature modulus value constraint threshold, setting the second constraint function of any unknown face image sample to zero; When the characteristic modulus value of any unknown facial image sample is greater than the second characteristic modulus value constraint threshold, the second constraint function of any unknown facial image sample is determined based on the ratio of the second characteristic modulus value constraint threshold to the characteristic modulus value of any unknown facial image sample.

11. A face recognition access control system, characterized in that: include: The acquisition module is used to acquire images of the user to be identified and obtain the face image to be identified; A recognition module, used for inputting the face image to be recognized into a face recognition model, and obtaining a recognition result of the face image to be recognized output by the face recognition model; An access control module, used to determine the access control permission of the user to be identified based on the recognition result of the face image to be identified; Wherein, the face recognition model is determined based on the face recognition method described in any one of claims 1 to 9.

12. The face recognition access control system according to claim 11, characterized in that: The identification module is used for: Inputting the face image to be identified into a face recognition model, obtaining the maximum output probability of the face image to be identified output by the face recognition model, the category label corresponding to the maximum output probability, and the characteristic module value of the face image to be identified; In the case where the maximum output probability is greater than a preset probability threshold and the characteristic modulus is greater than a preset modulus threshold, determining that the user to be identified is a registered user; Based on the category label corresponding to the maximum output probability, the identity information of the registered user is determined.

13. The face recognition access control system according to claim 12, characterized in that: The identification module is used for: In the case where there are multiple facial images to be identified corresponding to the user to be identified, determining a category label corresponding to each facial image to be identified; When the proportion of the number of images belonging to any category label is greater than a preset proportion threshold, the user to be identified is determined to be a registered user, and the identity information of the registered user is determined based on the any category label.

14. The face recognition access control system according to claim 12, characterized in that: The access control module is used for: Based on the identity information of the registered user, the access permission of the registered user is determined.

15. The face recognition access control system according to claim 11, characterized in that: The system further comprises: A model building module, used to obtain a network model description file; and build the face recognition model based on the network model description file; The network model description file is used to store weight parameters and structural parameters of the face recognition model.

16. The face recognition access control system according to claim 11, characterized in that: The system further comprises: A sample construction module, used to obtain facial images of registered users and unregistered users in the facial recognition access control system; Determine the facial image of the registered user as a known facial image sample, and determine a category label corresponding to the known facial image sample based on the registered user; The facial image of the unregistered user is determined as an unknown facial image sample.

17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the face recognition method according to any one of claims 1 to 9 is implemented.

18. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the face recognition method according to any one of claims 1 to 9 is implemented.