Face recognition network training method, device, electronic device and storage medium

By calculating and optimizing the TAR and FAR loss values ​​of the face recognition neural network, the problem of poor training effect of face recognition neural network is solved, and the performance of face recognition network is significantly improved.

CN114550257BActive Publication Date: 2025-04-15SHANGHAI SENSETIME INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210168168.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-23
Publication Date
2025-04-15
Estimated Expiration
2042-02-23

AI Technical Summary

Technical Problem

During the training of facial recognition neural networks, the correct acceptance ratio (TAR) and wrong acceptance ratio (FAR) indicators are usually not optimized, resulting in poor performance of the facial recognition neural network after training.

Method used

By acquiring multiple sample images from the sample database, the loss values ​​of the face feature vector and the initial feature vector corresponding to each sample image, including the first loss value corresponding to the TAR and/or the second loss value corresponding to the FAR, and the training face recognition network is optimized for training based on these loss values.

Benefits of technology

By optimizing TAR and FAR indicators, the performance of the target face recognition network obtained by training is significantly improved, so that it can perform face recognition more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114550257B_ABST
    Figure CN114550257B_ABST
Patent Text Reader

Abstract

The present disclosure provides a face recognition network training method, device, electronic device and storage medium, the method comprising: obtaining a plurality of sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image; inputting the plurality of sample images into a face recognition network to be trained to obtain a face feature vector corresponding to each sample image; determining a loss value corresponding to the face recognition network to be trained based on the face feature vectors corresponding to each sample image and a plurality of initial feature vectors included in the sample database; wherein the loss value comprises at least one of a first loss value corresponding to a correct acceptance ratio and a second loss value corresponding to an incorrect acceptance ratio; based on the loss value, training the face recognition network to be trained until a training cutoff condition is met to obtain a target face recognition network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of deep learning technology, and in particular to a face recognition network training method, device, electronic device and storage medium. Background Art

[0002] Face recognition is one of the most widely used biometric technologies. Face recognition can be applied to a variety of scenarios, such as unlocking mobile phones, passing through gates, and punching in access control cards. Among them, the trained face recognition neural network can be used for face recognition.

[0003] After the face recognition neural network is trained, the trained face recognition neural network can be tested to determine the test indicators: True Accept Rate (TAR) and False Accept Rate (FAR), and the performance of the trained face comparison neural network can be evaluated using TAR and FAR. Generally, during the training process of the face recognition neural network, the TAR and FAR indicators of the face recognition neural network are not optimized and trained, so that the TAR and FAR indicators corresponding to the trained face recognition neural network cannot be guaranteed to meet the requirements during the test, resulting in poor training effect of the face recognition neural network. Summary of the invention

[0004] In view of this, the present disclosure at least provides a face recognition network training method, device, electronic device and storage medium to improve the performance of the trained face recognition network.

[0005] In a first aspect, the present disclosure provides a face recognition network training method, comprising:

[0006] Acquire multiple sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image;

[0007] Inputting the plurality of sample images into a face recognition network to be trained to obtain a face feature vector corresponding to each of the sample images;

[0008] Based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, determining the loss value corresponding to the face recognition network to be trained; wherein the loss value includes at least one of a first loss value corresponding to the correct acceptance ratio and a second loss value corresponding to the incorrect acceptance ratio;

[0009] Based on the loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network.

[0010] In the above method, the loss value corresponding to the face recognition network to be trained is determined based on the facial feature vectors corresponding to each sample image and the multiple initial feature vectors included in the sample database. The loss value includes a first loss value corresponding to TAR and / or a second loss value corresponding to FAR. During the training process of the face recognition network to be trained, FAR and / or TAR are used as supervision signals to directly optimize the FAR and / or TAR corresponding to the face recognition network to be trained, so that the FAR index and / or TAR index of the trained target face recognition network meets the test requirements, thereby improving the performance of the trained target face recognition network.

[0011] In a possible implementation manner, after determining the loss value corresponding to the face recognition network to be trained, the method further includes:

[0012] The initial feature vector of the sample user corresponding to the sample image is updated by using the facial feature vector corresponding to the sample image to obtain an updated initial feature vector corresponding to the sample user.

[0013] Considering that the face recognition network to be trained is optimized towards accurate recognition, generally, the accuracy of the face feature vector extracted by the face recognition network to be trained with more training times is greater than that of the face feature vector extracted by the face recognition network to be trained with fewer training times. Based on this, after determining the loss value, the face feature vector corresponding to the sample image can be used to update the initial feature vector of the sample user corresponding to the sample image in the sample database to obtain the updated initial feature vector corresponding to the sample user. This makes the sample database one that can be updated in real time with the training process, ensuring the real-time and effectiveness of the sample data stored in the sample database, and improving the accuracy of the initial feature vector stored in the sample database.

[0014] In a possible implementation manner, the sample database further stores a remaining valid step length corresponding to the initial feature vector; and the initial valid step length of the initial feature vector is a preset step length; after obtaining the facial feature vector corresponding to each of the sample images, the method further includes:

[0015] The remaining effective step length corresponding to each initial feature vector in the sample database is reduced by one, and the initial feature vector whose remaining effective step length is zero after the reduction operation is deleted to obtain an updated sample database.

[0016] Here, the remaining valid step length corresponding to each initial feature vector in the sample database can also be determined. Each time the face recognition network is trained, the remaining valid step length is reduced by one. When the remaining valid step length is 0, it is considered that the accuracy of the initial feature vector no longer meets the requirements, that is, the initial feature vector is determined to be invalid. The initial feature vector with a remaining valid step length of zero after the reduction operation can be deleted to ensure the accuracy of the initial feature vector stored in the sample database.

[0017] In a possible implementation manner, determining the loss value corresponding to the face recognition network to be trained based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database includes:

[0018] Based on the sample user matched by the sample image, a positive sample set and a negative sample set corresponding to the sample image are determined; wherein the positive sample set includes at least one positive sample feature pair, each positive sample feature pair includes a face feature vector corresponding to the sample image and a first initial feature vector of the sample user matched by the sample image; the negative sample set includes at least one negative sample feature pair, each negative sample feature pair includes a face feature vector corresponding to the sample image and a second initial feature vector in the sample database other than the first initial feature vector of the sample user matched by the sample image;

[0019] Determine at least one of a first similarity between the face feature vector included in each of the positive sample feature pairs and the first initial feature vector, and a second similarity between the face feature vector included in each of the negative sample feature pairs and the second initial feature vector;

[0020] Based on at least one of the first similarity and the second similarity obtained, a loss value corresponding to the face recognition network to be trained is determined.

[0021] In the disclosed embodiments, by determining the first similarity corresponding to the positive sample feature pairs in the positive sample set and at least one of the second similarities corresponding to the negative sample feature pairs in the negative sample set, the loss value of the face recognition network to be trained can be determined more accurately using the first similarity and / or the second similarity, so that the face recognition network to be trained can be trained more accurately using the loss value.

[0022] In a possible implementation manner, determining the loss value corresponding to the face recognition network to be trained based on at least one of the first similarity and the second similarity obtained includes:

[0023] In the case where the loss value includes a first loss value, determining a first difference between each of the first similarities and a similarity threshold; and determining a first loss value corresponding to the face recognition network to be trained based on each of the first differences and the total number of the first similarities;

[0024] In the case where the loss value includes a second loss value, a second difference between each of the second similarities and a similarity threshold is determined; and based on each of the second differences and the total number of the second similarities, a second loss value corresponding to the face recognition network to be trained is determined.

[0025] In a possible implementation, determining the similarity threshold includes:

[0026] Determining the number of false acceptances based on a set false acceptance ratio threshold and the total number of the second similarities;

[0027] According to the order of the second similarities from large to small, a target similarity whose sorting sequence number matches the number of false acceptances is determined from a plurality of the second similarities; and the target similarity is determined as the similarity threshold.

[0028] Here, firstly, the number of false acceptances is determined based on the set ratio threshold of the false acceptance ratio and the total number of second similarities; through the number of false acceptances, the target similarity that matches the ratio threshold of the false acceptance ratio can be determined; when the target similarity is determined as the similarity threshold, the similarity threshold can meet the requirements of the ratio threshold of the false acceptance ratio, and then based on the similarity threshold, the first loss value and the second loss value can be determined more accurately.

[0029] In a possible implementation, when the loss value includes the first loss value and the second loss value, the face recognition network to be trained is trained based on the loss value until a training cutoff condition is met to obtain a target face recognition network, including:

[0030] Determine a target loss value corresponding to the face recognition network to be trained based on a preset first weight corresponding to the correct acceptance ratio and a second weight corresponding to the incorrect acceptance ratio, as well as the first loss value and the second loss value;

[0031] Based on the target loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network.

[0032] In a possible implementation manner, after obtaining the target face recognition network, the method further includes:

[0033] Obtain an image to be recognized;

[0034] The target face recognition network is used to recognize the image to be recognized, and a recognition result corresponding to the image to be recognized is determined.

[0035] Here, since the performance of the trained target face recognition network is good, when the target face recognition network is used to recognize the image to be recognized, the recognition result corresponding to the image to be recognized can be determined more accurately.

[0036] In a possible implementation manner, after determining the recognition result corresponding to the image to be recognized, the method further includes:

[0037] When the recognition result indicates that the face match is successful, the access control device is controlled to be turned on, and / or the mobile device is controlled to be unlocked.

[0038] Here, after using the target face recognition network to obtain a relatively accurate recognition result corresponding to the image to be recognized, the access control device and / or mobile device can be controlled more accurately based on the recognition result, thereby improving the control effect of the access control device and / or mobile device.

[0039] The effects of the following devices, electronic devices, etc. are described in the description of the above method and will not be repeated here.

[0040] In a second aspect, the present disclosure provides a face recognition network training device, comprising:

[0041] An acquisition module, used to acquire a plurality of sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image;

[0042] A first determination module is used to input the plurality of sample images into a face recognition network to be trained to obtain a face feature vector corresponding to each of the sample images;

[0043] A second determination module is used to determine the loss value corresponding to the face recognition network to be trained based on the face feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database; wherein the loss value includes at least one of a first loss value corresponding to the correct acceptance ratio and a second loss value corresponding to the incorrect acceptance ratio;

[0044] A training module is used to train the face recognition network to be trained based on the loss value until a training cutoff condition is met to obtain a target face recognition network.

[0045] In a possible implementation manner, after determining the loss value corresponding to the face recognition network to be trained, the device further includes: a first updating module, configured to:

[0046] The initial feature vector of the sample user corresponding to the sample image is updated by using the facial feature vector corresponding to the sample image to obtain an updated initial feature vector corresponding to the sample user.

[0047] In a possible implementation manner, the sample database further stores a remaining valid step length corresponding to the initial feature vector; and the initial valid step length of the initial feature vector is a preset step length; after obtaining the facial feature vector corresponding to each of the sample images, the device further includes: a second updating module, which is used to:

[0048] The remaining effective step length corresponding to each initial feature vector in the sample database is reduced by one, and the initial feature vector whose remaining effective step length is zero after the reduction operation is deleted to obtain an updated sample database.

[0049] In a possible implementation manner, the second determination module, when determining the loss value corresponding to the face recognition network to be trained based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, is used to:

[0050] Based on the sample user matched by the sample image, a positive sample set and a negative sample set corresponding to the sample image are determined; wherein the positive sample set includes at least one positive sample feature pair, each positive sample feature pair includes a face feature vector corresponding to the sample image and a first initial feature vector of the sample user matched by the sample image; the negative sample set includes at least one negative sample feature pair, each negative sample feature pair includes a face feature vector corresponding to the sample image and a second initial feature vector in the sample database other than the first initial feature vector of the sample user matched by the sample image;

[0051] Determine at least one of a first similarity between the face feature vector included in each of the positive sample feature pairs and the first initial feature vector, and a second similarity between the face feature vector included in each of the negative sample feature pairs and the second initial feature vector;

[0052] Based on at least one of the first similarity and the second similarity obtained, a loss value corresponding to the face recognition network to be trained is determined.

[0053] In a possible implementation manner, the second determination module, when determining the loss value corresponding to the face recognition network to be trained based on at least one of the first similarity and the second similarity obtained, is used to:

[0054] In the case where the loss value includes a first loss value, determining a first difference between each of the first similarities and a similarity threshold; and determining a first loss value corresponding to the face recognition network to be trained based on each of the first differences and the total number of the first similarities;

[0055] In the case where the loss value includes a second loss value, a second difference between each of the second similarities and a similarity threshold is determined; and based on each of the second differences and the total number of the second similarities, a second loss value corresponding to the face recognition network to be trained is determined.

[0056] In a possible implementation manner, the second determination module, when determining the similarity threshold, is used to:

[0057] Determining the number of false acceptances based on a set false acceptance ratio threshold and the total number of the second similarities;

[0058] According to the order of the second similarities from large to small, a target similarity whose sorting sequence number matches the number of false acceptances is determined from a plurality of the second similarities; and the target similarity is determined as the similarity threshold.

[0059] In a possible implementation, when the loss value includes the first loss value and the second loss value, the training module, when training the face recognition network to be trained based on the loss value until a training cutoff condition is met and a target face recognition network is obtained, is used to:

[0060] Determine a target loss value corresponding to the face recognition network to be trained based on a preset first weight corresponding to the correct acceptance ratio and a second weight corresponding to the incorrect acceptance ratio, as well as the first loss value and the second loss value;

[0061] Based on the target loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network.

[0062] In a possible implementation manner, after obtaining the target face recognition network, the device further includes: a recognition module, configured to:

[0063] Obtain an image to be recognized;

[0064] The target face recognition network is used to recognize the image to be recognized, and a recognition result corresponding to the image to be recognized is determined.

[0065] In a possible implementation, the recognition module is further used to: when the recognition result indicates that the face match is successful, control the access control device to open, and / or control the mobile device to unlock.

[0066] In a third aspect, the present disclosure provides an electronic device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the face recognition network training method described in the first aspect or any one of the embodiments are performed.

[0067] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the face recognition network training method as described in the first aspect or any one of the embodiments above are executed.

[0068] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0070] Figure 1 A schematic diagram of a process of a face recognition network training method provided by an embodiment of the present disclosure is shown;

[0071] Figure 2 A schematic diagram of the architecture of a face recognition network training device provided by an embodiment of the present disclosure is shown;

[0072] Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0073] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0074] After the face recognition neural network is trained, the trained face recognition neural network can be tested to determine the test indicators: the correct acceptance ratio TAR and the false acceptance ratio FAR, and the performance of the trained face comparison neural network is evaluated using TAR and FAR. Generally, during the training process of the face recognition neural network, the TAR and FAR indicators of the face recognition neural network are not optimized and trained, so that it is impossible to ensure that the TAR and FAR indicators corresponding to the trained face recognition neural network can meet the requirements during the test, resulting in poor training effect of the face recognition neural network. Based on this, the embodiment of the present disclosure provides a face recognition network training method.

[0075] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0076] To facilitate understanding of the embodiments of the present disclosure, a face recognition network training method disclosed in the embodiments of the present disclosure is first introduced in detail. The executor of the face recognition network training method provided in the embodiments of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device. The server may be, for example, a cloud server, a local server, etc.; the terminal device may be, for example, a user equipment (UE), a mobile device, a user terminal, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the face recognition network training method can be implemented by a processor calling computer-readable instructions stored in a memory.

[0077] See also Figure 1FIG. 1 is a flow chart of a face recognition network training method provided by an embodiment of the present disclosure, wherein the method includes S101-S104, wherein:

[0078] S101, obtaining a plurality of sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matching the respective sample images;

[0079] S102, inputting the plurality of sample images into a face recognition network to be trained, and obtaining a face feature vector corresponding to each of the sample images;

[0080] S103, based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, determining the loss value corresponding to the face recognition network to be trained; wherein the loss value includes a first loss value corresponding to the correct acceptance ratio and / or a second loss value corresponding to the incorrect acceptance ratio;

[0081] S104, based on the loss value, training the face recognition network to be trained until a training cutoff condition is met, thereby obtaining a target face recognition network.

[0082] In the above method, the loss value corresponding to the face recognition network to be trained is determined based on the facial feature vectors corresponding to each sample image and the multiple initial feature vectors included in the sample database. The loss value includes a first loss value corresponding to TAR and / or a second loss value corresponding to FAR. During the training process of the face recognition network to be trained, FAR and / or TAR are used as supervision signals to directly optimize the FAR and / or TAR corresponding to the face recognition network to be trained, so that the FAR index and / or TAR index of the trained target face recognition network meets the test requirements, thereby improving the performance of the trained target face recognition network.

[0083] S101 to S104 are described in detail below.

[0084] For S101 and S102:

[0085] The sample database stores sample data required for the neural network training process. The sample data may include a large number of training images, wherein each training image may be a face image of a sample user. The sample data may also include at least one initial feature vector corresponding to each sample user, and the initial feature vector is used to characterize the face features of the sample user. The initial feature vector may include: a feature vector obtained by extracting features from the training image by the face recognition network to be trained, and / or a preset feature vector. For example, the preset feature vector may be {0, 0, ..., 0}.

[0086] The sample data may also include the user ID of the sample user matched by the training image, the remaining valid step length of each initial feature vector, etc. When the remaining valid step length of the initial feature vector is 0, it is determined that the accuracy of the initial feature vector is low, that is, the initial feature vector is determined to be invalid, so the initial feature vector can be deleted from the sample database to ensure the accuracy of the data stored in the sample database.

[0087] Considering that the face recognition network to be trained is optimized in the direction of accurate recognition, for the same sample image, the accuracy of the feature vector extracted by the face recognition network to be trained with more training times is greater than the feature vector extracted by the face recognition network to be trained with fewer training times. In order to ensure the accuracy of the initial feature vectors of the sample users stored in the sample database, an initial effective step length can be set for the initial feature vectors. That is, each initial feature vector has an initial effective step length when stored in the sample database, and the initial effective step length can characterize the effective duration of the initial feature vector of the sample user. Among them, the initial effective step length is a preset step length. The preset step length can be set according to the speed of performance optimization of the face recognition network to be trained, that is, if the performance optimization of the face recognition network to be trained is faster, the preset step length can be set smaller, and if the performance optimization of the face recognition network to be trained is slower, the preset step length can be set larger.

[0088] During implementation, each time the face recognition network to be trained is trained, multiple training images can be obtained from the training images stored in the sample database as sample images; the obtained multiple sample images are input into the face recognition network to be trained to obtain the face feature vector corresponding to each sample image.

[0089] The sample database is a database that can be updated online as the neural network is trained, that is, the sample data stored in the sample database is updated in real time during the training process of the face recognition network to be trained. For example, the stored initial feature vectors can be updated, and the remaining effective step length of each initial feature vector can also be updated.

[0090] In an optional embodiment, after determining the loss value corresponding to the face recognition network to be trained, the method further includes: using the facial feature vector corresponding to the sample image to update the initial feature vector of the sample user corresponding to the sample image, to obtain an updated initial feature vector corresponding to the sample user.

[0091] During implementation, after determining the loss value, the facial feature vector corresponding to the sample image can be used to update the initial feature vector of the sample user corresponding to the sample image in the sample database to obtain the updated initial feature vector corresponding to the sample user, that is, to obtain the updated sample database.

[0092] Exemplarily, when there is only one initial feature vector corresponding to each sample user stored in the sample database, the sample user 1 included in the sample image 1 is determined, and then the initial feature vector corresponding to the sample user 1 in the sample database is determined; the initial feature vector corresponding to the sample user 1 is updated using the facial feature vector corresponding to the sample image 1 to obtain the updated initial feature vector corresponding to the sample user 1. That is, the initial feature vector corresponding to the sample user 1 in the sample database is replaced with the facial feature vector corresponding to the sample image 1. During implementation, the initial feature vector corresponding to the user identifier 1 of the sample user 1 included in the sample image 1 can be determined according to the user identifier 1 of the sample user 1.

[0093] When there are multiple initial feature vectors corresponding to each sample user stored in the sample database, first, determine the sample user 1 included in the sample image 1, and then determine the multiple initial feature vectors corresponding to the sample user 1 in the sample database. Second, determine the initial feature vector to be replaced among the multiple initial feature vectors based on the effective remaining step lengths corresponding to the multiple initial feature vectors. For example, select the initial feature vector with the smallest effective remaining step length as the initial feature vector to be replaced; if the effective remaining step lengths corresponding to the multiple initial feature vectors are the same, randomly select an initial feature vector as the initial feature vector to be replaced. Third, replace the initial feature vector to be replaced with the facial feature vector corresponding to the sample image 1, and obtain the updated initial feature vector corresponding to the sample user 1.

[0094] During implementation, after obtaining the updated initial feature vector corresponding to the sample user, the corresponding remaining effective step length can be determined for the updated initial feature vector, and in this case, the remaining effective step length can be the initial effective step length. The remaining effective step length corresponding to the updated initial feature vector is greater than the remaining effective step length of the replaced initial feature vector.

[0095] Considering that the face recognition network to be trained is optimized towards accurate recognition, generally, the accuracy of the face feature vector extracted by the face recognition network to be trained with more training times is greater than that of the face feature vector extracted by the face recognition network to be trained with fewer training times. Based on this, after determining the loss value, the face feature vector corresponding to the sample image can be used to update the initial feature vector of the sample user corresponding to the sample image in the sample database to obtain the updated initial feature vector corresponding to the sample user. This makes the sample database one that can be updated in real time with the training process, ensuring the real-time and effectiveness of the sample data stored in the sample database, and improving the accuracy of the initial feature vector stored in the sample database.

[0096] In an optional implementation, the sample database also stores the remaining valid step length corresponding to the initial feature vector; and the initial valid step length of the initial feature vector is a preset step length; after obtaining the facial feature vector corresponding to each of the sample images, the method further includes: subtracting the remaining valid step length corresponding to each initial feature vector in the sample database by one, and deleting the initial feature vector whose remaining valid step length is zero after the subtraction operation, to obtain an updated sample database.

[0097] During implementation, the sample database also stores the remaining effective step length corresponding to each initial feature vector. After each training of the neural network to be trained, the effective remaining step length of the initial feature vector in the sample database is reduced by one. That is, after obtaining the facial feature vector corresponding to each sample image, the remaining effective step length corresponding to each initial feature vector in the sample database can be reduced by one. For example, if the remaining effective step length corresponding to the initial feature vector 1 is 50, then after the remaining effective step length corresponding to the initial feature vector 1 is reduced by one, the remaining effective step length of the initial feature vector 1 after the reduction operation is 49. And among the multiple initial feature vectors stored in the sample database, the initial feature vectors with a remaining effective step length of zero after the reduction operation are deleted to obtain an updated sample database.

[0098] Here, the remaining valid step length corresponding to each initial feature vector in the sample database can also be determined. Each time the face recognition network is trained, the remaining valid step length is reduced by one. When the remaining valid step length is 0, it is considered that the accuracy of the initial feature vector no longer meets the requirements, that is, the initial feature vector is determined to be invalid. The initial feature vector with a remaining valid step length of zero after the reduction operation can be deleted to ensure the accuracy of the initial feature vector stored in the sample database.

[0099] For S103:

[0100] After obtaining the facial feature vectors corresponding to the sample images, the loss value corresponding to the face recognition network to be trained can be determined based on the facial feature vectors corresponding to the sample images and the multiple initial feature vectors included in the sample database. The loss value may include the second loss value corresponding to FAR and / or the first loss value corresponding to TAR.

[0101] In an optional implementation, in S103, determining the loss value corresponding to the face recognition network to be trained based on the face feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database may include:

[0102] S1031, based on the sample user matched by the sample image, determine a positive sample set and a negative sample set corresponding to the sample image; wherein the positive sample set includes at least one positive sample feature pair, each positive sample feature pair includes a face feature vector corresponding to the sample image and a first initial feature vector of the sample user matched by the sample image; the negative sample set includes at least one negative sample feature pair, each negative sample feature pair includes a face feature vector corresponding to the sample image and a second initial feature vector in the sample database other than the first initial feature vector of the sample user matched by the sample image;

[0103] S1032, determining at least one of a first similarity between the face feature vector included in each of the positive sample feature pairs and the first initial feature vector, and a second similarity between the face feature vector included in each of the negative sample feature pairs and the second initial feature vector;

[0104] S1033: Determine a loss value corresponding to the face recognition network to be trained based on at least one of the first similarity and the second similarity obtained.

[0105] S1031 is exemplarily described. During implementation, the positive sample set and the negative sample set corresponding to the sample image are determined according to the sample user matched by the sample image. Assume that the sample database stores initial feature vectors corresponding to 100 sample users, and each sample user corresponds to 5 initial feature vectors, that is, the sample database stores 500 initial feature vectors.

[0106] For each sample image, determine the five first initial feature vectors corresponding to the sample user matched by the sample image; each first initial feature vector and the facial feature vector corresponding to the sample image form a positive sample feature pair, and obtain five positive sample feature pairs. And determine the second initial feature vector in the sample database except the first initial feature vector of the sample user matched by the sample image; each second initial feature vector and the facial feature vector corresponding to the sample image form a negative sample feature pair, and obtain 495 negative sample feature pairs. Then, the positive sample feature pairs and negative sample feature pairs corresponding to each sample image can be obtained. The positive sample feature pairs corresponding to each sample image constitute a positive sample set; and the negative sample feature pairs corresponding to each sample image constitute a negative sample set.

[0107] In S1032, the cosine similarity between the face feature vector and the first initial feature vector included in each positive sample feature pair may be calculated, and the cosine similarity may be determined as the first similarity of the positive sample feature pair. And / or the cosine similarity between the face feature vector and the second initial feature vector included in each negative sample feature pair may be calculated, and the cosine similarity may be determined as the second similarity of the negative sample feature pair.

[0108] In S1033, a loss value of the face recognition network to be trained may be determined according to the first similarity and / or the second similarity.

[0109] In the case where the loss value includes a first loss value, determining the first loss value corresponding to the face recognition network to be trained based on obtaining at least one of the first similarities and the second similarities may include: determining a first difference between each of the first similarities and a determined similarity threshold; and determining the first loss value corresponding to the face recognition network to be trained based on each of the first differences and the total number of the first similarities.

[0110] During implementation, the first loss value can be determined according to the following formula (1):

[0111]

[0112] Among them, L t is the first loss value, S j is the first similarity corresponding to the jth positive sample feature pair; N p is the total number of positive sample feature pairs in the positive sample set (ie, the total number of first similarities), τ is a preset hyperparameter, and t is a determined similarity threshold.

[0113] In the case where the loss value includes a second loss value, determining the second loss value corresponding to the face recognition network to be trained based on at least one of the obtained first similarities and the second similarities includes: determining a second difference between each of the second similarities and a determined similarity threshold; and determining the second loss value corresponding to the face recognition network to be trained based on each of the second differences and the total number of the second similarities.

[0114] During implementation, the second loss value can be determined according to the following formula (2):

[0115]

[0116] Among them, L f is the second loss value, S i is the second similarity corresponding to the i-th negative sample feature pair; N nis the total number of negative sample feature pairs in the negative sample set (ie, the total number of the second similarity), τ is a preset hyperparameter, and t is a determined similarity threshold.

[0117] In the disclosed embodiments, by determining the first similarity corresponding to the positive sample feature pairs in the positive sample set, and the second similarity corresponding to the negative sample feature pairs in the negative sample set, the loss value of the face recognition network to be trained can be determined more accurately using the first similarity and / or the second similarity, so that the face recognition network to be trained can be trained more accurately using the loss value.

[0118] In an optional implementation, the similarity threshold can be determined according to the following steps: determining the number of false acceptances based on a set ratio threshold of the false acceptance ratio and the total number of the second similarities; determining a target similarity whose sorting number matches the number of false acceptances from multiple second similarities in order of the second similarities from large to small; and determining the target similarity as the similarity threshold.

[0119] The ratio threshold of the false acceptance ratio can be set as needed, for example, the ratio threshold can be 0.01. According to the set ratio threshold and the total number of second similarities, the number of false acceptances is determined. For example, if the total number of second similarities is 5000, the number of false acceptances is determined to be 50000×0.01=500. Then, in the order of the second similarities from large to small, the target similarity with a sorting number of 500 is determined from multiple second similarities; the target similarity is determined as the similarity threshold.

[0120] Here, firstly, the number of false acceptances is determined based on the set ratio threshold of the false acceptance ratio and the total number of second similarities; through the number of false acceptances, the target similarity that matches the ratio threshold of the false acceptance ratio can be determined; when the target similarity is determined as the similarity threshold, the similarity threshold can meet the requirements of the ratio threshold of the false acceptance ratio, and then based on the similarity threshold, the first loss value and the second loss value can be determined more accurately.

[0121] For S104:

[0122] According to the determined loss value, the network parameters of the face recognition network to be trained are adjusted until the face recognition network to be trained after the parameter adjustment meets the training cutoff condition, and the target face recognition network is obtained. The training cutoff condition can be set as needed. For example, the training cutoff condition may include at least one of the following: the face recognition accuracy is greater than the set accuracy threshold, the neural network converges, the error acceptance ratio is less than the set first threshold, the correct acceptance ratio is less than the set second threshold, etc.

[0123] In an optional implementation, when the loss value includes the first loss value and the second loss value, the face recognition network to be trained is trained based on the loss value until a training cutoff condition is met to obtain a target face recognition network, including: determining a target loss value corresponding to the face recognition network to be trained based on a first weight corresponding to a preset correct acceptance ratio and a second weight corresponding to an incorrect acceptance ratio, as well as the first loss value and the second loss value; and training the face recognition network to be trained based on the target loss value until a training cutoff condition is met to obtain a target face recognition network.

[0124] In one implementation, a first product between a first weight and a first loss value can be calculated, and a second product between a second weight and a second loss value can be calculated; the sum of the first product and the second product is used as a target loss value, and the target loss value is used to adjust the network parameters of the face recognition network to be trained until the face recognition neural network after the parameter adjustment meets the training cutoff condition, thereby obtaining a target face recognition network.

[0125] In another implementation, the facial feature vector corresponding to the sample image may also be used to determine a third loss value used to characterize the accuracy of face classification. For example, the prediction information corresponding to the sample image may be determined based on the facial feature vector, and the third loss value may be determined based on the prediction information and the information of the sample user corresponding to the sample image; for another example, the facial feature vectors corresponding to each sample image may be divided, and the facial feature vectors belonging to the same user may be divided into a set to obtain at least one set; and the third loss value may be determined based on the facial feature vectors included in each set.

[0126] Then, the first product between the first weight and the first loss value, the second product between the second weight and the second loss value, and the third product between the third loss value and the preset third weight can be calculated, and the sum of the first product, the second product and the third product is used as the target loss value. The target loss value is used to train the face recognition network to be trained.

[0127] The loss function corresponding to the third loss value can be selected as needed. For example, the third loss value can be determined using a softmax-loss loss function; or the third loss value can be determined using an ArcFace-loss loss function.

[0128] In an optional implementation, after obtaining the target face recognition network, the method further includes: acquiring an image to be recognized; and using the target face recognition network to recognize the image to be recognized, and determining a recognition result corresponding to the image to be recognized.

[0129] After obtaining the target face recognition network, the image to be recognized can be obtained, which can be any face image captured by the image acquisition device. For example, in the access control clock-in scenario, the image acquisition device can be a clock-in device, and the camera on the clock-in device collects the employee's face image in real time as the image to be recognized. In the mobile device unlocking scenario, the image acquisition device can be a mobile device, and the camera on the mobile device collects the user's face image in real time as the image to be recognized.

[0130] The acquired image to be recognized is input into the target face recognition network, and the target face recognition network is used to recognize the image to be recognized, and the recognition result corresponding to the image to be recognized is determined. For example, the recognition result may include a successful face match or a failed face match. When the face match is successful, the recognition result may also include the basic information of the user included in the image to be recognized, such as name, gender, age, work number, department, etc.

[0131] Here, since the performance of the trained target face recognition network is good, when the target face recognition network is used to recognize the image to be recognized, the recognition result corresponding to the image to be recognized can be determined more accurately.

[0132] In an optional implementation, after determining the recognition result corresponding to the image to be recognized, the method further includes: when the recognition result indicates that the face match is successful, controlling the access control device to turn on, and / or controlling the mobile device to unlock.

[0133] When the recognition result indicates that the face match is successful, the access control device can be controlled to open, the mobile device can be controlled to unlock, etc. For example, in the access control punch-in scenario, when the recognition result indicates that the face match is successful, the access control device is controlled to open so that the user corresponding to the image to be recognized can pass through the access control device.

[0134] Here, after using the target face recognition network to obtain a relatively accurate recognition result corresponding to the image to be recognized, the access control device and / or mobile device can be controlled more accurately based on the recognition result, thereby improving the control effect of the access control device and / or mobile device.

[0135] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0136] Based on the same concept, the present disclosure also provides a face recognition network training device, see Figure 2As shown, it is a schematic diagram of the architecture of the face recognition network training device provided by the embodiment of the present disclosure, including an acquisition module 201, a first determination module 202, a second determination module 203, and a training module 204. Specifically:

[0137] The acquisition module 201 is used to acquire a plurality of sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image;

[0138] A first determination module 202 is used to input the plurality of sample images into a face recognition network to be trained, and obtain a face feature vector corresponding to each of the sample images;

[0139] A second determination module 203 is used to determine the loss value corresponding to the face recognition network to be trained based on the face feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database; wherein the loss value includes at least one of a first loss value corresponding to the correct acceptance ratio and a second loss value corresponding to the incorrect acceptance ratio;

[0140] The training module 204 is used to train the face recognition network to be trained based on the loss value until a training cutoff condition is met to obtain a target face recognition network.

[0141] In a possible implementation manner, after determining the loss value corresponding to the face recognition network to be trained, the device further includes: a first updating module 205, configured to:

[0142] The initial feature vector of the sample user corresponding to the sample image is updated by using the facial feature vector corresponding to the sample image to obtain an updated initial feature vector corresponding to the sample user.

[0143] In a possible implementation manner, the sample database further stores a remaining valid step length corresponding to the initial feature vector; and the initial valid step length of the initial feature vector is a preset step length; after obtaining the facial feature vector corresponding to each of the sample images, the device further includes: a second updating module 206, which is used to:

[0144] The remaining effective step length corresponding to each initial feature vector in the sample database is reduced by one, and the initial feature vector whose remaining effective step length is zero after the reduction operation is deleted to obtain an updated sample database.

[0145] In a possible implementation manner, the second determination module 203, when determining the loss value corresponding to the face recognition network to be trained based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, is used to:

[0146] Based on the sample user matched by the sample image, a positive sample set and a negative sample set corresponding to the sample image are determined; wherein the positive sample set includes at least one positive sample feature pair, each positive sample feature pair includes a face feature vector corresponding to the sample image and a first initial feature vector of the sample user matched by the sample image; the negative sample set includes at least one negative sample feature pair, each negative sample feature pair includes a face feature vector corresponding to the sample image and a second initial feature vector in the sample database other than the first initial feature vector of the sample user matched by the sample image;

[0147] Determine at least one of a first similarity between the face feature vector included in each of the positive sample feature pairs and the first initial feature vector, and a second similarity between the face feature vector included in each of the negative sample feature pairs and the second initial feature vector;

[0148] Based on at least one of the first similarity and the second similarity obtained, a loss value corresponding to the face recognition network to be trained is determined.

[0149] In a possible implementation manner, the second determination module 203, when determining the loss value corresponding to the face recognition network to be trained based on at least one of the first similarity and the second similarity obtained, is used to:

[0150] In the case where the loss value includes a first loss value, determining a first difference between each of the first similarities and a similarity threshold; and determining a first loss value corresponding to the face recognition network to be trained based on each of the first differences and the total number of the first similarities;

[0151] In the case where the loss value includes a second loss value, a second difference between each of the second similarities and a similarity threshold is determined; and based on each of the second differences and the total number of the second similarities, a second loss value corresponding to the face recognition network to be trained is determined.

[0152] In a possible implementation manner, the second determination module 203, when determining the similarity threshold, is used to:

[0153] Determining the number of false acceptances based on a set false acceptance ratio threshold and the total number of the second similarities;

[0154] According to the order of the second similarities from large to small, a target similarity whose sorting sequence number matches the number of false acceptances is determined from a plurality of the second similarities; and the target similarity is determined as the similarity threshold.

[0155] In a possible implementation manner, when the loss value includes the first loss value and the second loss value, the training module 204, when training the face recognition network to be trained based on the loss value until a training cutoff condition is met and a target face recognition network is obtained, is used to:

[0156] Determine a target loss value corresponding to the face recognition network to be trained based on a preset first weight corresponding to the correct acceptance ratio and a second weight corresponding to the incorrect acceptance ratio, as well as the first loss value and the second loss value;

[0157] Based on the target loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network.

[0158] In a possible implementation, after obtaining the target face recognition network, the device further includes: a recognition module 207, which is used to:

[0159] Obtain an image to be recognized;

[0160] The target face recognition network is used to recognize the image to be recognized, and a recognition result corresponding to the image to be recognized is determined.

[0161] In a possible implementation, the recognition module 207 is further configured to: when the recognition result indicates that the face match is successful, control the access control device to be turned on, and / or control the mobile device to be unlocked.

[0162] In some embodiments, the functions or templates contained in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0163] Based on the same technical concept, the embodiment of the present disclosure also provides an electronic device. Figure 3 As shown, it is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, including a processor 301, a memory 302, and a bus 303. Among them, the memory 302 is used to store execution instructions, including a memory 3021 and an external memory 3022; the memory 3021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 301, and the data exchanged with the external memory 3022 such as a hard disk. The processor 301 exchanges data with the external memory 3022 through the memory 3021. When the electronic device 300 is running, the processor 301 communicates with the memory 302 through the bus 303, so that the processor 301 executes the following instructions:

[0164] Acquire multiple sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image;

[0165] Inputting the plurality of sample images into a face recognition network to be trained to obtain a face feature vector corresponding to each of the sample images;

[0166] Based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, determining the loss value corresponding to the face recognition network to be trained; wherein the loss value includes at least one of a first loss value corresponding to the correct acceptance ratio and a second loss value corresponding to the incorrect acceptance ratio;

[0167] Based on the loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network.

[0168] The specific processing flow of the processor 301 may refer to the description of the above method embodiment, which will not be repeated here.

[0169] In addition, the embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the face recognition network training method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0170] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the face recognition network training method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0171] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0172] The present disclosure relates to the field of augmented reality. By acquiring the image information of the target object in the real environment, the relevant features, states and attributes of the target object are detected or identified by various visual related algorithms, so as to obtain an augmented reality (AR) effect that combines virtuality and reality and matches the specific application. Exemplarily, the target object may involve the face, limbs, gestures, actions, etc. related to the human body, or markers and markers related to objects, or sand tables, display areas or display items related to venues or places. Visual related algorithms may involve visual positioning, SLAM, three-dimensional reconstruction, image registration, background segmentation, key point extraction and tracking of objects, and position or depth detection of objects. Specific applications may not only involve interactive scenes such as guided tours, navigation, explanations, reconstruction, virtual effect superposition and display related to real scenes or objects, but also special effects processing related to people, such as makeup beautification, limb beautification, special effects display, virtual model display and other interactive scenes. The relevant features, states and attributes of the target object can be detected or identified by a convolutional neural network. The above-mentioned convolutional neural network is a network model obtained by model training based on a deep learning framework.

[0173] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0175] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0176] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0177] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A face recognition network training method, characterized in that: include: Acquire multiple sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image; Inputting the plurality of sample images into a face recognition network to be trained to obtain a face feature vector corresponding to each of the sample images; Based on the facial feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, determining the loss value corresponding to the face recognition network to be trained; wherein the loss value includes at least one of a first loss value corresponding to the correct acceptance ratio and a second loss value corresponding to the incorrect acceptance ratio; Based on the loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network; The determining, based on the facial feature vectors corresponding to the sample images and the multiple initial feature vectors included in the sample database, the loss value corresponding to the face recognition network to be trained comprises: Based on the sample user matched by the sample image, a positive sample set and a negative sample set corresponding to the sample image are determined; wherein the positive sample set includes at least one positive sample feature pair, each positive sample feature pair includes a face feature vector corresponding to the sample image and a first initial feature vector of the sample user matched by the sample image; the negative sample set includes at least one negative sample feature pair, each negative sample feature pair includes a face feature vector corresponding to the sample image and a second initial feature vector in the sample database other than the first initial feature vector of the sample user matched by the sample image; Determine at least one of a first similarity between the face feature vector included in each of the positive sample feature pairs and the first initial feature vector, and a second similarity between the face feature vector included in each of the negative sample feature pairs and the second initial feature vector; Based on at least one of the first similarity and the second similarity obtained, a loss value corresponding to the face recognition network to be trained is determined.

2. The method according to claim 1, characterized in that After determining the loss value corresponding to the face recognition network to be trained, the method further includes: The initial feature vector of the sample user corresponding to the sample image is updated by using the facial feature vector corresponding to the sample image to obtain an updated initial feature vector corresponding to the sample user.

3. The method according to claim 1, characterized in that The sample database also stores the remaining valid step length corresponding to the initial feature vector; and the initial valid step length of the initial feature vector is a preset step length; after obtaining the facial feature vector corresponding to each of the sample images, the method further includes: The remaining effective step length corresponding to each initial feature vector in the sample database is reduced by one, and the initial feature vector whose remaining effective step length is zero after the reduction operation is deleted to obtain an updated sample database.

4. The method according to claim 1, characterized in that: The determining, based on at least one of the first similarity and the second similarity obtained, a loss value corresponding to the face recognition network to be trained, comprises: In the case where the loss value includes a first loss value, determining a first difference between each of the first similarities and a similarity threshold; and determining a first loss value corresponding to the face recognition network to be trained based on each of the first differences and the total number of the first similarities; In the case where the loss value includes a second loss value, a second difference between each of the second similarities and a similarity threshold is determined; and based on each of the second differences and the total number of the second similarities, a second loss value corresponding to the face recognition network to be trained is determined.

5. The method according to claim 4, characterized in that Determining the similarity threshold includes: Determining the number of false acceptances based on a set false acceptance ratio threshold and the total number of the second similarities; According to the order of the second similarities from large to small, a target similarity whose sorting sequence number matches the number of false acceptances is determined from a plurality of the second similarities; and the target similarity is determined as the similarity threshold.

6. The method according to any one of claims 1 to 5, characterized in that: In a case where the loss value includes the first loss value and the second loss value, based on the loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network, including: Determine a target loss value corresponding to the face recognition network to be trained based on a preset first weight corresponding to the correct acceptance ratio and a second weight corresponding to the incorrect acceptance ratio, as well as the first loss value and the second loss value; Based on the target loss value, the face recognition network to be trained is trained until a training cutoff condition is met to obtain a target face recognition network.

7. The method according to any one of claims 1 to 5, characterized in that: After obtaining the target face recognition network, the method further includes: Obtain an image to be recognized; The target face recognition network is used to recognize the image to be recognized, and a recognition result corresponding to the image to be recognized is determined.

8. The method according to claim 7, characterized in that After determining the recognition result corresponding to the image to be recognized, the method further includes: When the recognition result indicates that the face match is successful, the access control device is controlled to be turned on, and / or the mobile device is controlled to be unlocked.

9. A face recognition network training device, characterized in that: include: An acquisition module, used to acquire a plurality of sample images from a sample database; wherein the sample database stores initial feature vectors of sample users matched with each sample image; A first determination module is used to input the plurality of sample images into a face recognition network to be trained to obtain a face feature vector corresponding to each of the sample images; A second determination module is used to determine the loss value corresponding to the face recognition network to be trained based on the face feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database; wherein the loss value includes at least one of a first loss value corresponding to the correct acceptance ratio and a second loss value corresponding to the incorrect acceptance ratio; A training module, used for training the face recognition network to be trained based on the loss value until a training cutoff condition is met to obtain a target face recognition network; The second determination module, when determining the loss value corresponding to the face recognition network to be trained based on the face feature vectors corresponding to each of the sample images and the multiple initial feature vectors included in the sample database, is used to: Based on the sample user matched by the sample image, determine the positive sample set and the negative sample set corresponding to the sample image; wherein the positive sample set includes at least one positive sample feature pair, each positive sample feature pair includes a facial feature vector corresponding to the sample image and a first initial feature vector of the sample user matched by the sample image; the negative sample set includes at least one negative sample feature pair, each negative sample feature pair includes a facial feature vector corresponding to the sample image, and a second initial feature vector in the sample database except the first initial feature vector of the sample user matched by the sample image; determine at least one of a first similarity between the facial feature vector included in each of the positive sample feature pairs and the first initial feature vector, and a second similarity between the facial feature vector included in each of the negative sample feature pairs and the second initial feature vector; and determine the loss value corresponding to the face recognition network to be trained based on at least one of the first similarity and the second similarity obtained.

10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the face recognition network training method as described in any one of claims 1 to 8 are performed.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the face recognition network training method as described in any one of claims 1 to 8 are executed.

Citation Information

Patent Citations

  • Method and device for generating feature vector, electronic equipment and medium

    CN110956127A

  • Face recognition method and device and storage medium

    CN112232117A