Face recognition model training methods, devices, storage media and computer equipment

CN116704584BActive Publication Date: 2026-09-01DONGGUAN ZKTECO ELECTRONICS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310764323.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-26
Publication Date
2026-09-01
Estimated Expiration
2043-06-26

AI Technical Summary

Technical Problem

[0004]本申请的目的旨在至少能解决上述的技术缺陷之一,特别是现有技术中由于戴口罩的影响,使得通过生物识别技术进行身份核验时,无法捕捉使用者完整的面部特征,进而影响身份核验的准确度的技术缺陷

Benefits of technology

[0039]本申请提供的人脸识别模型训练方法、装置、存储介质及计算机设备,可以先采集多张未戴口罩的人脸对应的第一人脸图像,并对各张第一人脸图像添加口罩后得到多张戴口罩的人脸对应的第二人脸图像,接着,本申请可以确定已训练的第一人脸识别模型和未训练的第二人脸识别模型,并利用第一人脸识别模型分别提取每张第一人脸图像中的第一人脸特征,利用第二人脸识别模型分别提取每张第二人脸图像中的第二人脸特征,由于本申请的第一人脸识别模型是已经训练好的神经网络模型,因此,本申请可以采用互信息损失函数来计算各张第二人脸特征与各张第一人脸特征之间的互信息损失值,并根据该互信息损失值来对第二人脸识别模型的参数进行更新,以使第二人脸识别模型学习到第一人脸识别模型的识别能力,这样训练后得到的第二人脸识别模型可以直接对戴口罩的人脸进行识别,无需获取使用者的完整面部特征,进而在提升身份核验的效率的同时提高准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116704584B_ABST
    Figure CN116704584B_ABST
Patent Text Reader

Abstract

The face recognition model training method, apparatus, storage medium, and computer equipment provided in this application can first acquire multiple first face images corresponding to faces without masks, and then add masks to each of the first face images to obtain multiple second face images corresponding to faces with masks. Next, this application can determine a trained first face recognition model and an untrained second face recognition model, and use the first face recognition model to extract first face features from each first face image, and use the second face recognition model to extract second face features from each second face image. A mutual information loss function is used to calculate the mutual information loss value between each second face feature and each first face feature, and the parameters of the second face recognition model are updated based on this mutual information loss value. This allows the second face recognition model to directly recognize faces wearing masks, thereby improving the efficiency and accuracy of identity verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of security technology, and in particular to a face recognition model training method, device, storage medium and computer equipment. Background Technology

[0002] Currently, in applications such as attendance systems and access control systems, facial features are generally used as the basis for biometric identification. This can ensure security and improve the security level of applications such as attendance systems and access control systems.

[0003] Current technologies for biometric identification using facial features require users to provide their complete facial features for identity verification. However, due to the impact of wearing masks, it is impossible to capture the user's complete facial features during biometric identification verification, thus affecting the accuracy of the verification. Summary of the Invention

[0004] The purpose of this application is to at least address one of the aforementioned technical deficiencies, particularly the technical deficiency in the prior art where wearing masks makes it impossible to capture the user's complete facial features during identity verification using biometric technology, thus affecting the accuracy of identity verification.

[0005] This application provides a method for training a face recognition model, the method comprising:

[0006] Collect multiple first face images corresponding to faces without masks, and add masks to each first face image to obtain multiple second face images corresponding to faces with masks.

[0007] A first face recognition model and a second face recognition model are determined, wherein the first face recognition model is a trained neural network model and the second face recognition model is an untrained neural network model;

[0008] The first face recognition model is used to extract the first face features from each first face image, and the second face recognition model is used to extract the second face features from each second face image.

[0009] The mutual information loss function is used to calculate the mutual information loss value between each second face feature and each first face feature, and the parameters of the second face recognition model are updated according to the mutual information loss value to obtain the trained second face recognition model.

[0010] Optionally, the step of adding masks to each of the first face images to obtain multiple second face images corresponding to faces wearing masks includes:

[0011] Obtain the pre-configured mask-wearing algorithm;

[0012] After adding masks to each first face image using the mask-wearing algorithm, multiple second face images corresponding to faces wearing masks are obtained.

[0013] Optionally, the step of extracting the first facial features from each first facial image using the first facial recognition model, and extracting the second facial features from each second facial image using the second facial recognition model, includes:

[0014] Determine the number of samples captured in a single feature recognition operation;

[0015] Multiple first face images are captured based on the sample size and input into the first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image;

[0016] Furthermore, based on the sample size, multiple second face images are captured and input into the second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image.

[0017] Optionally, the formula for calculating the mutual information loss value between each second face feature and each first face feature using the mutual information loss function is as follows:

[0018]

[0019] in, The mutual information loss value, , , E is an N-dimensional identity matrix, N is the batch size (the number of samples captured in a single feature recognition operation), mean is the average value, exp represents the exponential function with base e, and M is the matrix product of two face feature vectors. The two face features are of the same dimension and are denoted as [N, d], where d is the dimension of one face feature. It is the first facial feature. It is a second facial feature The transpose of .

[0020] This application also provides a face recognition model training device, including:

[0021] The image acquisition module is used to acquire multiple first face images corresponding to faces without masks, and after adding masks to each first face image, obtain multiple second face images corresponding to faces with masks.

[0022] The model determination module is used to determine a first face recognition model and a second face recognition model, wherein the first face recognition model is a trained neural network model and the second face recognition model is an untrained neural network model.

[0023] The feature recognition module is used to extract first facial features from each first facial image using the first facial recognition model, and to extract second facial features from each second facial image using the second facial recognition model.

[0024] The model training module is used to calculate the mutual information loss value between each second face feature and each first face feature using the mutual information loss function, and to update the parameters of the second face recognition model according to the mutual information loss value to obtain the trained second face recognition model.

[0025] Optionally, the image acquisition module includes:

[0026] The algorithm acquisition module is used to acquire pre-configured mask-wearing algorithms;

[0027] The mask-adding module is used to add masks to each first face image using the mask-wearing algorithm, thereby obtaining multiple second face images corresponding to faces wearing masks.

[0028] Optionally, the feature recognition module includes:

[0029] The sample size determination module is used to determine the sample size captured in a single feature recognition operation.

[0030] The first face feature acquisition module is used to capture multiple first face images according to the sample size and input them into the first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image.

[0031] The second face feature acquisition module is used to capture multiple second face images based on the sample size and input them into the second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image.

[0032] Optionally, the calculation formula for the model training module is as follows:

[0033]

[0034] in, The mutual information loss value, , , E is an N-dimensional identity matrix, N is the batch size (the number of samples captured in a single feature recognition operation), mean is the average value, exp represents the exponential function with base e, and M is the matrix product of two face feature vectors. The two face features are of the same dimension and are denoted as [N, d], where d is the dimension of one face feature. It is the first facial feature. It is a second facial feature The transpose of .

[0035] This application also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the face recognition model training method as described in any of the above embodiments.

[0036] This application also provides a computer device, including: one or more processors, and memory;

[0037] The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the face recognition model training method as described in any of the above embodiments.

[0038] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0039] The face recognition model training method, apparatus, storage medium, and computer equipment provided in this application can first acquire multiple first face images corresponding to faces without masks, and then add masks to each of the first face images to obtain multiple second face images corresponding to faces with masks. Next, this application can determine a trained first face recognition model and an untrained second face recognition model, and use the first face recognition model to extract first face features from each first face image, and use the second face recognition model to extract second face features from each second face image. Since the first face recognition model in this application is a pre-trained neural network model, this application can use a mutual information loss function to calculate the mutual information loss value between each second face feature and each first face feature, and update the parameters of the second face recognition model based on this mutual information loss value, so that the second face recognition model learns the recognition ability of the first face recognition model. Thus, the trained second face recognition model can directly recognize faces with masks without obtaining the user's complete facial features, thereby improving both the efficiency and accuracy of identity verification. Attached Figure Description

[0040] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 A flowchart illustrating a face recognition model training method provided in an embodiment of this application;

[0042] Figure 2 A schematic diagram illustrating the training process of the second face recognition model provided in this application embodiment;

[0043] Figure 3 This is a schematic diagram of the structure of a face recognition model training device provided in an embodiment of this application;

[0044] Figure 4 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0045] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0046] Existing technologies for biometric identification using facial features require users to provide their complete facial features for identity verification. However, due to the impact of wearing masks, it is impossible to capture the user's complete facial features during biometric identification verification, thus affecting the accuracy of the verification. Based on this, this application proposes the following technical solution, as detailed below:

[0047] In one embodiment, such as Figure 1 As shown, Figure 1 This is a flowchart illustrating a face recognition model training method provided in an embodiment of this application; this application provides a face recognition model training method, which may include:

[0048] S110: Collect multiple first face images corresponding to faces without masks, and add masks to each first face image to obtain multiple second face images corresponding to faces with masks.

[0049] In this step, before training the face recognition model, a certain number of face images may be collected as a training sample set to train the face recognition model.

[0050] Specifically, directly collecting and training on face images corresponding to faces wearing masks will cause the model to learn fewer features during the training process, resulting in low generalization ability of the trained model. Therefore, when collecting face images in the present application, a plurality of first face images corresponding to faces not wearing masks are collected first, and after masks are added to each first face image, a plurality of second face images corresponding to faces wearing masks are obtained. In this way, the model can be trained through the first face images and also trained through the second face images, thereby improving the generalization ability of the model.

[0051] It should be noted that the number of the first face images and the second face images in the present application and the faces in each face image are in one-to-one correspondence, so as to ensure that the second face images corresponding to the first face images all come from the same image with the same id.

[0052] In addition, the face images collected in the present application are collected with the prior consent of the collected subjects. For example, for the face recognition link set in the access control system of a building, property management or other relevant personnel can collect face images of relevant personnel entering and exiting the building with their prior consent, and after training the face recognition model using these face images, obtain the final face recognition model that can be used for the access control system.

[0053] S120: Determine a first face recognition model and a second face recognition model.

[0054] In this step, when collecting a plurality of first face images corresponding to faces not wearing masks, and obtaining a plurality of second face images corresponding to faces wearing masks after adding masks to the first face images, the present application may further determine a first face recognition model and a second face recognition model, wherein the first face recognition model is a trained neural network model, and the second face recognition model is an untrained neural network model. In this way, the present application can train the second face recognition model through the first face recognition model, so that the second face recognition model can learn more facial features based on the first face recognition model, thereby further improving the accuracy of the second face recognition model.

[0055] It is understood that the internal architecture of the first face recognition model and the second face recognition model in this application can be the same or different. That is, this application can use the same type of neural network model as the first face recognition model and the second face recognition model respectively, or it can use different types of neural network models as the first face recognition model and the second face recognition model respectively. The specific choice can be made according to the actual situation, and no restrictions are imposed here.

[0056] S130: Extract the first face features from each first face image using the first face recognition model, and extract the second face features from each second face image using the second face recognition model.

[0057] In this step, multiple first face images are acquired through S110, and multiple second face images are obtained. After determining the first face recognition model and the second face recognition model through S120, this application can use the first face recognition model to extract the first face features from each first face image, and use the second face recognition model to extract the second face features from each second face image, thereby obtaining a batch of two types of face features.

[0058] Specifically, since the second face recognition model of this application is an untrained neural network model, and the second face image is a face image corresponding to a face wearing a mask, when this application uses the second face image to train the second face recognition model, the second face recognition model can be trained to recognize the face image corresponding to a face wearing a mask. In this way, when using the second face recognition model for face recognition, the user does not need to remove the mask, thereby effectively reducing the spread of disease.

[0059] S140: The mutual information loss function is used to calculate the mutual information loss value between each second face feature and each first face feature, and the parameters of the second face recognition model are updated according to the mutual information loss value to obtain the trained second face recognition model.

[0060] In this step, after extracting the first face features from each first face image using the first face recognition model in S130, and extracting the second face features from each second face image using the second face recognition model, this application can use a mutual information loss function to calculate the mutual information loss value between each second face feature and each first face feature, and update the parameters of the second face recognition model according to the mutual information loss value, so as to obtain the trained second face recognition model.

[0061] Understandably, mutual information is a method for measuring the relationship between two random variables, and it can be used to measure the similarity between the model output and the true label. The greater the mutual information between the model output and the true label, the better the model's performance. Based on this, this application can use a mutual information loss function to calculate the similarity between the output of the second face recognition model and the true label.

[0062] Specifically, when calculating the similarity between the output of the second face recognition model and the real label, this application can use the first face feature output by the first face recognition model as the real label, and calculate the mutual information loss value between each second face feature and each first face feature using the mutual information loss function. The calculated mutual information loss value can be used to update the parameters of the second face recognition model. Then, in the next training, this application can continue to use the first face recognition model to extract the first face feature from each first face image, and use the second face recognition model to extract the second face feature from each second face image, and use the mutual information loss function to calculate the mutual information loss value between each second face feature and each first face feature. The parameters of the second face recognition model are updated according to the mutual information loss value until the preset training conditions are met, thus obtaining the trained second face recognition model.

[0063] It should be noted that this application uses a pre-trained first face recognition model to extract first face features, and uses these first face features to train a second face recognition model, so that the second face recognition model can learn the relevant information of the first face features, thereby effectively improving the generalization ability of the second face recognition model, and enabling the trained second face recognition model to directly recognize faces wearing masks.

[0064] In the above embodiments, multiple first face images corresponding to faces without masks can be collected firstly, and masks can be added to each first face image to obtain multiple second face images corresponding to faces with masks. Then, this application can determine a trained first face recognition model and an untrained second face recognition model, and use the first face recognition model to extract the first face features from each first face image, and use the second face recognition model to extract the second face features from each second face image. Since the first face recognition model of this application is a pre-trained neural network model, this application can use a mutual information loss function to calculate the mutual information loss value between each second face feature and each first face feature, and update the parameters of the second face recognition model according to the mutual information loss value, so that the second face recognition model learns the recognition ability of the first face recognition model. In this way, the second face recognition model obtained after training can directly recognize faces with masks without obtaining the user's complete facial features, thereby improving the efficiency and accuracy of identity verification.

[0065] In one embodiment, after adding masks to each of the first face images in S110, multiple second face images corresponding to faces wearing masks are obtained, which may include:

[0066] S111: Obtain the pre-configured mask-wearing algorithm.

[0067] S112: After adding masks to each first face image using the mask-wearing algorithm, multiple second face images corresponding to faces wearing masks are obtained.

[0068] In this embodiment, when adding masks to each first face image, a pre-configured mask-wearing algorithm can be obtained first, and then the mask-wearing algorithm can be used to add masks to each first face image so that the second face image after adding masks and the first face image are images from the same ID. In this way, when training the second face recognition model, it can be better ensured that the second face recognition model can learn useful information.

[0069] Understandably, the mask-wearing algorithm here can be a standalone code segment or a pre-trained mask-adding model. After processing each first face image using this code segment or mask-adding model, a mask can be added to the face region of each first face image.

[0070] In one embodiment, step S130, which involves using the first face recognition model to extract first face features from each first face image and using the second face recognition model to extract second face features from each second face image, may include:

[0071] S131: Determine the number of samples captured in a single feature recognition operation.

[0072] S132: Capture multiple first face images based on the sample size and input them into the first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image.

[0073] S133: Capture multiple second face images based on the sample size and input them into the second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image.

[0074] In this embodiment, when using the mutual information loss function to calculate the mutual information loss value of the second face recognition model, the number of samples captured in a feature recognition can be predetermined. In this way, during each training process, the mutual information loss value of the two face features of a batch size can be calculated to guide the model training and update the model parameters until the optimal value is reached. This can improve the training speed of the model and make the gradient descent direction more accurate, thereby further improving the accuracy of the model.

[0075] Specifically, this application can first determine the sample size for a single feature recognition operation, then capture multiple first face images based on this sample size, and sequentially input the captured first face images into a first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image. Furthermore, this application can also capture multiple second face images based on this sample size, and sequentially input the captured second face images into a second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image. It is understood that since the sample size captured during each training iteration in this application is the same, and the dimensions of the first and second face features are also the same, an N-dimensional identity matrix can be constructed using multiple first and second face features, and the mutual information loss value can be calculated using this identity matrix and the first and second face features.

[0076] In one embodiment, the formula for calculating the mutual information loss value between each second face feature and each first face feature using the mutual information loss function is as follows:

[0077]

[0078] in, The mutual information loss value, , , E is an N-dimensional identity matrix, N is the batch size (the number of samples captured in a single feature recognition operation), mean is the average value, exp represents the exponential function with base e, and M is the matrix product of two face feature vectors. The two face features are of the same dimension and are denoted as [N, d], where d is the dimension of one face feature. It is the first facial feature. It is a second facial feature The transpose of .

[0079] In this embodiment, as Figure 2 As shown, Figure 2 A schematic diagram illustrating the training process of the second face recognition model provided in this application embodiment; Figure 2 In this application, a first face recognition model can output a first face feature, and a second face recognition model can output a second face feature. Once the calculation formula for the mutual information loss function is determined, the mutual information loss value of the second face recognition model can be calculated using this formula, and the parameters of the second face recognition model can be updated based on this mutual information loss value. This can be illustrated with the following example:

[0080] ROC results without using this method:

[0081] EER FAR=1e-3 FAR=1e-4 FAR=1e-5 FAR=1e-6 FAR=0

[0082] ----------------------------------------------------------------

[0083] FRR 0.2831% 0.5350% 1.7731% 4.2272% 7.9931% 9.7942%

[0084] ROC results using this method:

[0085] EER FAR=1e-3 FAR=1e-4 FAR=1e-5 FAR=1e-6 FAR=0

[0086] ----------------------------------------------------------------

[0087] FRR 0.1898% 0.3007% 1.0288% 2.7047% 4.7225% 6.6739%

[0088] Conclusion: Based on the FAR=1e-5 result, the FRR decreased from 4.2272% to 2.7047%. Therefore, this method can improve the face recognition effect of people wearing masks.

[0089] The face recognition model training device provided in the embodiments of this application will be described below. The face recognition model training device described below can be referred to in correspondence with the face recognition model training method described above.

[0090] In one embodiment, such as Figure 3 As shown, Figure 3 This application provides a schematic diagram of the structure of a face recognition model training device according to an embodiment of the present application; the present application also provides a face recognition model training device, including an image acquisition module 210, a model determination module 220, a feature recognition module 230, and a model training module 240, specifically including the following:

[0091] The image acquisition module 210 is used to acquire multiple first face images corresponding to faces without masks, and to add masks to each first face image to obtain multiple second face images corresponding to faces with masks.

[0092] The model determination module 220 is used to determine a first face recognition model and a second face recognition model, wherein the first face recognition model is a trained neural network model and the second face recognition model is an untrained neural network model.

[0093] The feature recognition module 230 is used to extract first facial features from each first facial image using the first facial recognition model, and to extract second facial features from each second facial image using the second facial recognition model.

[0094] The model training module 240 is used to calculate the mutual information loss value between each second face feature and each first face feature using the mutual information loss function, and update the parameters of the second face recognition model according to the mutual information loss value to obtain the trained second face recognition model.

[0095] In the above embodiments, multiple first face images corresponding to faces without masks can be collected firstly, and masks can be added to each first face image to obtain multiple second face images corresponding to faces with masks. Then, this application can determine a trained first face recognition model and an untrained second face recognition model, and use the first face recognition model to extract the first face features from each first face image, and use the second face recognition model to extract the second face features from each second face image. Since the first face recognition model of this application is a pre-trained neural network model, this application can use a mutual information loss function to calculate the mutual information loss value between each second face feature and each first face feature, and update the parameters of the second face recognition model according to the mutual information loss value, so that the second face recognition model learns the recognition ability of the first face recognition model. In this way, the second face recognition model obtained after training can directly recognize faces with masks without obtaining the user's complete facial features, thereby improving the efficiency and accuracy of identity verification.

[0096] In one embodiment, the image acquisition module includes:

[0097] The algorithm acquisition module is used to acquire pre-configured mask-wearing algorithms;

[0098] The mask-adding module is used to add masks to each first face image using the mask-wearing algorithm, thereby obtaining multiple second face images corresponding to faces wearing masks.

[0099] In one embodiment, the feature recognition module includes:

[0100] The sample size determination module is used to determine the sample size captured in a single feature recognition operation.

[0101] The first face feature acquisition module is used to capture multiple first face images according to the sample size and input them into the first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image.

[0102] The second face feature acquisition module is used to capture multiple second face images based on the sample size and input them into the second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image.

[0103] In one embodiment, the calculation formula for the model training module is as follows:

[0104]

[0105] in, The mutual information loss value, , , E is an N-dimensional identity matrix, N is the batch size (the number of samples captured in a single feature recognition operation), mean is the average value, exp represents the exponential function with base e, and M is the matrix product of two face feature vectors. The two face features are of the same dimension and are denoted as [N, d], where d is the dimension of one face feature. It is the first facial feature. It is a second facial feature The transpose of .

[0106] In one embodiment, this application also provides a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the face recognition model training method as described in any of the above embodiments.

[0107] In one embodiment, this application also provides a computer device, including: one or more processors, and memory.

[0108] The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the face recognition model training method as described in any of the above embodiments.

[0109] Indicatively, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the internal structure of a computer device 300 provided in an embodiment of this application. The computer device 300 can be provided as a server. (Refer to...) Figure 4 The computer device 300 includes a processing component 302, which further includes one or more processors, and memory resources represented by memory 301 for storing instructions, such as application programs, that can be executed by the processing component 302. The application programs stored in memory 301 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 302 is configured to execute instructions to perform the face recognition model training method of any of the above embodiments.

[0110] The computer device 300 may also include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate on an operating system stored in memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.

[0111] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0112] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0113] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0114] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for training a face recognition model, characterized in that, The method includes: Collect multiple first face images corresponding to faces without masks, and add masks to each first face image to obtain multiple second face images corresponding to faces with masks. A first face recognition model and a second face recognition model are determined, wherein the first face recognition model is a trained neural network model and the second face recognition model is an untrained neural network model; The first face recognition model is used to extract the first face features from each first face image, and the second face recognition model is used to extract the second face features from each second face image. The mutual information loss function is used to calculate the mutual information loss value between each second face feature and each first face feature, and the parameters of the second face recognition model are updated according to the mutual information loss value to obtain the trained second face recognition model. The formula for calculating the mutual information loss value between each second face feature and each first face feature using the mutual information loss function is as follows: in, The mutual information loss value, , , E is an N-dimensional identity matrix, N is the batch size (the number of samples captured in a single feature recognition operation), mean is the average value, exp represents the exponential function with base e, and M is the matrix product of two face feature vectors. The two face features are of the same dimension and are denoted as [N, d], where d is the dimension of one face feature. It is the first facial feature. It is a second facial feature The transpose of .

2. The face recognition model training method according to claim 1, characterized in that, After adding masks to each of the first face images, multiple second face images corresponding to faces wearing masks are obtained, including: Obtain the pre-configured mask-wearing algorithm; After adding masks to each first face image using the mask-wearing algorithm, multiple second face images corresponding to faces wearing masks are obtained.

3. The face recognition model training method according to claim 1, characterized in that, The step of extracting first facial features from each first facial image using the first facial recognition model and extracting second facial features from each second facial image using the second facial recognition model includes: Determine the number of samples captured in a single feature recognition operation; Multiple first face images are captured based on the sample size and input into the first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image; Furthermore, based on the sample size, multiple second face images are captured and input into the second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image.

4. A face recognition model training device, characterized in that, include: The image acquisition module is used to acquire multiple first face images corresponding to faces without masks, and after adding masks to each first face image, obtain multiple second face images corresponding to faces with masks. The model determination module is used to determine a first face recognition model and a second face recognition model, wherein the first face recognition model is a trained neural network model and the second face recognition model is an untrained neural network model. The feature recognition module is used to extract first facial features from each first facial image using the first facial recognition model, and to extract second facial features from each second facial image using the second facial recognition model. The model training module is used to calculate the mutual information loss value between each second face feature and each first face feature using the mutual information loss function, and to update the parameters of the second face recognition model according to the mutual information loss value to obtain the trained second face recognition model. The calculation formula for the model training module is as follows: in, The mutual information loss value, , , E is an N-dimensional identity matrix, N is the batch size (the number of samples captured in a single feature recognition operation), mean is the average value, exp represents the exponential function with base e, and M is the matrix product of two face feature vectors. The two face features are of the same dimension and are denoted as [N, d], where d is the dimension of one face feature. It is the first facial feature. It is a second facial feature The transpose of .

5. The face recognition model training device according to claim 4, characterized in that, The image acquisition module includes: The algorithm acquisition module is used to acquire pre-configured mask-wearing algorithms; The mask-adding module is used to add masks to each first face image using the mask-wearing algorithm, thereby obtaining multiple second face images corresponding to faces wearing masks.

6. The face recognition model training device according to claim 4, characterized in that, The feature recognition module includes: The sample size determination module is used to determine the sample size captured in a single feature recognition operation. The first face feature acquisition module is used to capture multiple first face images according to the sample size and input them into the first face recognition model to obtain the first face features output by the first face recognition model corresponding to each first face image. The second face feature acquisition module is used to capture multiple second face images based on the sample size and input them into the second face recognition model to obtain the second face features output by the second face recognition model corresponding to each second face image.

7. A storage medium, characterized in that: The storage medium stores computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the face recognition model training method as described in any one of claims 1 to 3.

8. A computer device, characterized in that, include: One or more processors, and memory; The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the face recognition model training method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Face recognition method, device and equipment and computer readable storage medium

    CN114627533A

  • Image processing model training method and device, image processing method and device, equipment and storage medium

    CN115170919A