Training method and device for face liveness detection network

By generating adversarial samples in the face liveness detection network and training it under a meta-learning framework, the problem of data acquisition difficulty is solved, the robustness and generalization ability of the model are improved, and the recognition ability of unknown scenes is enhanced.

CN114821691BActive Publication Date: 2025-10-03CHINA MOBILE COMM LTD RES INST +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110127746.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-29
Publication Date
2025-10-03
Estimated Expiration
2041-01-29

AI Technical Summary

Technical Problem

In the existing face liveness detection network model training methods, data acquisition is difficult, especially the lack of attack sample data, resulting in poor model robustness.

Method used

By obtaining face images from multiple domains, using the adversarial sample generation network to generate adversarial sample images, and training the face liveness detection network under the meta-learning framework, using the source domain images as training data and the generated adversarial samples as test data, we simulate attack scenarios in different scenarios and devices.

Benefits of technology

The generalization performance and stability of the face liveness detection network in different environments and devices are improved, and the recognition ability of unknown scenes is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114821691B_ABST
    Figure CN114821691B_ABST
Patent Text Reader

Abstract

The present invention provides a training method and device for a face liveness detection network. The training method comprises: obtaining face images from multiple domains, each domain including multiple face images, and the multiple face images in each domain are collected in the same environmental scene and / or using the same data acquisition device; selecting at least one domain from the multiple domains as a source domain; inputting the face images in the source domain into an adversarial sample generation network to generate adversarial sample images; using the face images in the source domain as training data and the adversarial sample images as test data to train the face liveness detection network to obtain a trained face liveness detection network. In the present invention, a large number of adversarial samples can be obtained from face images collected from multiple environmental scenes and / or multiple types of data acquisition devices, which are used to train the face liveness detection network, thereby improving the robustness of the trained face liveness detection network model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and in particular to a training method and device for a face liveness detection network. Background Art

[0002] In recent years, interest in facial liveness detection technology has grown. This is because the widespread application and adoption of facial recognition technology in everyday life has led to increasing security concerns. With advances in computer technology and the development of artificial intelligence, facial liveness detection technology is also continuously improving. Currently, facial liveness detection technology based on deep learning and big data techniques has become the mainstream method.

[0003] In order to improve the stability of face liveness detection technology and its ability to defend against new attacks, the existing training method of face liveness detection network model mentions collecting real face data and attack face data, and training the network based on the real face data and attack face data.

[0004] Existing training methods for face liveness detection network models have the following drawbacks: They require high data volumes, particularly large amounts of data. Training robust deep learning models requires large amounts of data, but acquiring sufficient and effective data is difficult. This is especially true for face liveness detection, where real-world attack scenarios are relatively rare and collecting sample data for all scenarios is difficult. This poses a drawback and challenge to data-based face liveness detection methods. Summary of the Invention

[0005] Embodiments of the present invention provide a method and apparatus for training a face liveness detection network, which are used to solve the problem that data acquisition for training a face liveness detection network model is difficult, resulting in poor robustness of the trained face liveness detection network model.

[0006] In order to solve the above-mentioned technical problems, the present invention is achieved as follows:

[0007] In a first aspect, an embodiment of the present invention provides a method for training a face liveness detection network, comprising:

[0008] Acquire facial images of multiple domains, each domain including multiple facial images, and the multiple facial images in each domain are acquired in the same environment scene and / or using the same data acquisition device;

[0009] selecting at least one domain from the plurality of domains as a source domain;

[0010] Inputting the face image in the source domain into the adversarial sample generation network to generate an adversarial sample image;

[0011] The face images in the source domain are used as training data, and the adversarial sample images are used as test data to train the face liveness detection network to be trained, thereby obtaining a trained face liveness detection network.

[0012] Optionally, the method further includes:

[0013] taking a domain other than the source domain among the multiple domains as a target domain;

[0014] The trained face liveness detection network is tested using the face images in the target domain, and the test results are output.

[0015] Optionally, inputting the face image in the source domain into the adversarial sample generation network, before generating the adversarial sample image, further includes:

[0016] Using the face images in the source domain to train the adversarial sample generation network to generate the adversarial sample generation network;

[0017] Among them, training the adversarial sample generation network to be trained includes:

[0018] Inputting the face image in the source domain into the adversarial sample generation network to be trained to obtain an output result, the output result including: a face depth image corresponding to the input face image, a classification result, face feature data and an adversarial sample image; wherein the adversarial sample generation network to be trained includes a feature extractor, a depth map estimation network and a classifier, the feature extractor performs feature extraction on the input face image to obtain face feature data, the depth map estimation network processes the face feature data to obtain a face depth image, and the classifier performs face liveness detection classification on the face feature data to obtain a face liveness detection classification result;

[0019] The total loss function of the adversarial sample generation network to be trained is calculated according to the output result, and the parameters of the adversarial sample generation network to be trained are updated according to the total loss function to obtain the trained adversarial sample generation network; the total loss function is calculated according to the loss function of the classifier, the loss function of the depth map estimation network and the feature difference loss function.

[0020] Optionally, the total loss function is calculated using the following formula:

[0021]

[0022] in, represents the total loss function, represents the loss function of the classifier, represents the feature difference loss function, represents the loss function of the depth map estimation network, θ represents the parameters of the classifier, represents the parameters of the depth map estimation network, x represents the face image input to the adversarial sample generation network to be trained, z represents the face feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and α and β represent weights.

[0023] Optionally, the loss function of the classifier is calculated using the following formula:

[0024]

[0025] Where y represents the true label of the face image input to the adversarial sample generation network to be trained, represents the face liveness detection classification result output by the adversarial sample generation network to be trained, y i and represents y and The i-th dimension of .

[0026] Optionally, the feature difference loss function is calculated using the following formula:

[0027]

[0028] Wherein, z represents the facial feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, z + represents the facial feature data extracted by the feature extractor from the adversarial sample image output by the adversarial sample generation network to be trained, 1{·} represents the indicator function, y represents the label of the face image, and y + Represents the label of the generated adversarial image.

[0029] Optionally, the loss function of the depth map estimation network is calculated using the following formula:

[0030]

[0031] Where d represents the depth image corresponding to the face image input to the adversarial sample generation network to be trained, d + represents the depth image generated by the depth map estimation network.

[0032] Optionally, the formula for the adversarial sample image output by the adversarial sample generation network is as follows:

[0033]

[0034] in, represents the adversarial sample image obtained by the t-th iteration, represents the adversarial sample image obtained by the t+1th iteration, θ and ψ are the parameters of the classifier and depth map estimation network respectively, Represents an adversarial sample image The features extracted by the feature extractor, Express of Perform derivatives, γ is a hyperparameter, which represents the learning rate of gradient ascent.

[0035] Optionally, using the face images in the source domain as training data and the adversarial sample images as test data to train the face liveness detection network to be trained, and obtaining the trained face liveness detection network includes:

[0036] Using the facial images in the source domain as training data, training the face liveness detection network to be trained, calculating a first classification loss function, and updating the parameters of the face liveness detection network to be trained according to the first classification loss function;

[0037] The adversarial sample image is used as test data and input into the face liveness detection network to be trained, and a second classification loss function is calculated. According to the first classification loss function and the second classification loss function, the parameters of the face liveness detection network to be trained are updated.

[0038] Optionally, the calculation formula for the parameters of the face liveness detection network to be trained, which is updated according to the first classification loss function, is as follows:

[0039]

[0040] in, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, θ represents the parameters of the face liveness detection network to be trained before the update, η is a hyperparameter, representing the learning rate, represents the face image in the source domain, represents the first classification loss function, It represents the derivative of θ.

[0041] Optionally, the calculation formula of the second classification loss function is as follows:

[0042]

[0043] in, represents the second classification loss function, y + Represents the label of the adversarial sample image input to the face liveness detection network to be trained, is the label of the adversarial sample image output by the face liveness detection network to be trained, y i + and Represents y + and The i-th dimension of .

[0044] Optionally, according to the first classification loss function and the second classification loss function, a calculation formula for the updated parameters of the face liveness detection network to be trained is as follows:

[0045]

[0046] in, represents the first classification loss function, represents the second classification loss function, K represents the number of target domains, represents the source domain, θ represents the parameters of the face liveness detection network to be trained before updating, represents the domain composed of the k-th adversarial sample image, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, η is a hyperparameter representing the learning rate, It represents the derivative of θ.

[0047] In a second aspect, an embodiment of the present invention provides a training device for a face liveness detection network, comprising:

[0048] An acquisition module is used to acquire facial images of multiple domains, each domain including multiple facial images, and the multiple facial images in each domain are acquired in the same environment scene and / or using the same data acquisition device;

[0049] A first selection module, configured to select at least one domain from the multiple domains as a source domain;

[0050] A generation module, configured to input the face image in the source domain into an adversarial sample generation network to generate an adversarial sample image;

[0051] The first training module is used to train the face liveness detection network to be trained by using the face images in the source domain as training data and the adversarial sample images as test data, so as to obtain a trained face liveness detection network.

[0052] Optionally, the device further includes:

[0053] a second selection module, configured to select a domain other than the source domain from the multiple domains as a target domain;

[0054] A testing module is used to test the trained face liveness detection network using face images in the target domain and output test results.

[0055] Optionally, the device further includes:

[0056] A second training module is configured to train a to-be-trained adversarial sample generation network using facial images in the source domain to generate the adversarial sample generation network;

[0057] Among them, training the adversarial sample generation network to be trained includes:

[0058] Inputting the face image in the source domain into the adversarial sample generation network to be trained to obtain an output result, the output result including: a face depth image corresponding to the input face image, a classification result, face feature data and an adversarial sample image; wherein the adversarial sample generation network to be trained includes a feature extractor, a depth map estimation network and a classifier, the feature extractor performs feature extraction on the input face image to obtain face feature data, the depth map estimation network processes the face feature data to obtain a face depth image, and the classifier performs face liveness detection classification on the face feature data to obtain a face liveness detection classification result;

[0059] The total loss function of the adversarial sample generation network to be trained is calculated according to the output result, and the parameters of the adversarial sample generation network to be trained are updated according to the total loss function to obtain the trained adversarial sample generation network; the total loss function is calculated according to the loss function of the classifier, the loss function of the depth map estimation network and the feature difference loss function.

[0060] Optionally, the total loss function is calculated using the following formula:

[0061]

[0062] in, represents the total loss function, represents the loss function of the classifier, represents the feature difference loss function, represents the loss function of the depth map estimation network, θ represents the parameters of the classifier, represents the parameters of the depth map estimation network, x represents the face image input to the adversarial sample generation network to be trained, z represents the face feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and α and β represent weights.

[0063] Optionally, the loss function of the classifier is calculated using the following formula:

[0064]

[0065] Where y represents the true label of the face image input to the adversarial sample generation network to be trained, represents the face liveness detection classification result output by the adversarial sample generation network to be trained, y i and represents y and The i-th dimension of .

[0066] Optionally, the feature difference loss function is calculated using the following formula:

[0067]

[0068] Wherein, z represents the facial feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, z + represents the facial feature data extracted by the feature extractor from the adversarial sample image output by the adversarial sample generation network to be trained, 1{·} represents the indicator function, y represents the label of the face image, and y + Represents the label of the generated adversarial image.

[0069] Optionally, the loss function of the depth map estimation network is calculated using the following formula:

[0070]

[0071] Where d represents the depth image corresponding to the face image input to the adversarial sample generation network to be trained, d + represents the depth image generated by the depth map estimation network.

[0072] Optionally, the formula for the adversarial sample image output by the adversarial sample generation network is as follows:

[0073]

[0074] in, represents the adversarial sample image obtained by the t-th iteration, represents the adversarial sample image obtained by the t+1th iteration, θ and ψ are the parameters of the classifier and depth map estimation network respectively, Represents an adversarial sample image The features extracted by the feature extractor, Express of Perform derivatives, γ is a hyperparameter, which represents the learning rate of gradient ascent.

[0075] Optionally, the first training module includes:

[0076] a training submodule, configured to use the facial images in the source domain as training data to train the face liveness detection network to be trained, calculate a first classification loss function, and update the parameters of the face liveness detection network to be trained based on the first classification loss function;

[0077] A testing submodule is used to input the adversarial sample image as test data into the face liveness detection network to be trained, calculate the second classification loss function, and update the parameters of the face liveness detection network to be trained based on the first classification loss function and the second classification loss function.

[0078] Optionally, the calculation formula for the parameters of the face liveness detection network to be trained, which is updated according to the first classification loss function, is as follows:

[0079]

[0080] in, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, θ represents the parameters of the face liveness detection network to be trained before the update, η is a hyperparameter, representing the learning rate, represents the face image in the source domain, represents the first classification loss function, It represents the derivative of θ.

[0081] Optionally, the calculation formula of the second classification loss function is as follows:

[0082]

[0083] in, represents the second classification loss function, y + Represents the label of the adversarial sample image input to the face liveness detection network to be trained, is the label of the adversarial sample image output by the face liveness detection network to be trained, y i + and Represents y + and The i-th dimension of .

[0084] Optionally, according to the first classification loss function and the second classification loss function, a calculation formula for the updated parameters of the face liveness detection network to be trained is as follows:

[0085]

[0086] in, represents the first classification loss function, represents the second classification loss function, K represents the number of target domains, represents the source domain, θ represents the parameters of the face liveness detection network to be trained before updating, represents the domain composed of the k-th adversarial sample image, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, η is a hyperparameter representing the learning rate, It represents the derivative of θ.

[0087] In a third aspect, an embodiment of the present invention provides an electronic device comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the training method of the face liveness detection network described in the first aspect are implemented.

[0088] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the training method of the face liveness detection network described in the first aspect are implemented.

[0089] In an embodiment of the present invention, during each training session, a designed generative adversarial sample network is first used to generate adversarial samples of source domain facial images. Then, using facial images as training data and the generated adversarial samples as test data, a face liveness detection network is trained within a meta-learning framework. This not only yields more dispersed facial data, simulating and supplementing actual facial data collected by different devices in different scenarios, but also fully leverages the advantages of meta-learning, allowing the model to simulate unknown data attacks during each training session. This gradually makes the model more robust in identifying unknown scenarios, improving its generalization performance and stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0091] Figure 1 This is a flow chart of a training method for a face liveness detection network according to the first embodiment of the present invention;

[0092] Figure 2 This is a flowchart of a method for training a face liveness detection network according to a second embodiment of the present invention;

[0093] Figure 3 Schematic diagram of the process of training a network for generating adversarial samples according to the third embodiment of the present invention;

[0094] Figure 4 A schematic diagram of the structure of an adversarial sample generation network according to an embodiment of the present invention;

[0095] Figure 5 This is a flowchart of a method for training a face liveness detection network according to a fourth embodiment of the present invention;

[0096] Figure 6 Schematic diagram of the structure of a training device for a face liveness detection network according to an embodiment of the present invention;

[0097] Figure 7 Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0098] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0099] Please refer to Figure 1 The first embodiment of the present invention provides a method for training a face liveness detection network, comprising:

[0100] Step 11: Acquire facial images from multiple domains, where each domain includes multiple facial images, and the multiple facial images in each domain are acquired in the same environment and / or using the same data acquisition device; select at least one domain from the multiple domains as a source domain;

[0101] In embodiments of the present invention, different environmental scenes and / or different data acquisition devices can be used to collect images or videos of real people and attacker faces to form a dataset. The environmental scenes can include significantly different lighting and / or background environments. Data acquisition devices can use cameras of different brands and / or resolutions. Images collected in the same environmental scene and / or using the same data acquisition device can be considered images of a domain.

[0102] Then, the collected image can be preprocessed. If a face image (RGB image) is obtained, the face in the image can be detected by a face detection method first, and the face is cropped out, and the cropped face image is uniformly adjusted to a preset size, for example, 256*256. If a video is obtained, an image is extracted (for example, randomly extracted) from the video, and the face in the image is detected by a face detection method, and the face is cropped out, and the cropped face image is uniformly adjusted to a preset size. In an embodiment of the present invention, an MTCNN (Multi-task convolutional neural network) algorithm can be used to detect the face in the image.

[0103] Finally, the preprocessed images are separated into different domains, and at least one domain is selected from the multiple domains as a source domain for training the face liveness detection network. Preferably, multiple source domains are selected so that the trained face liveness detection network can adapt to images from various scenes and / or data acquisition devices.

[0104] Step 12: Input the face image in the source domain into the adversarial sample generation network to generate an adversarial sample image;

[0105] Step 13: Using the face images in the source domain as training data and the adversarial sample images as test data, the face liveness detection network to be trained is trained to obtain a trained face liveness detection network.

[0106] In an embodiment of the present invention, if multiple source domains are included, each source domain and the corresponding adversarial sample image can be input into the face liveness detection network to be trained for training to obtain the final trained face liveness detection network.

[0107] In an embodiment of the present invention, during each training session, the designed generative adversarial sample network is first used to generate adversarial samples of source domain facial images. Then, using the facial images as training data and the generated adversarial samples as test data, the face liveness detection network is trained under the framework of meta-learning. This not only yields more dispersed facial data and richer adversarial samples, improving the network's accuracy in different environmental scenarios, but also fully leveraging the advantages of meta-learning, allowing the model to simulate encounters with unknown data attacks during each training session. This gradually makes the model more robust in identifying unknown scenarios, improving its generalization performance and stability.

[0108] Please refer to Figure 2 A second embodiment of the present invention provides a method for training a face liveness detection network, comprising:

[0109] Step 21: Acquire facial images from multiple domains, each domain including multiple facial images, and the multiple facial images in each domain are acquired in the same environment and / or using the same data acquisition device; select at least one domain from the multiple domains as a source domain; and select domains from the multiple domains other than the source domain as target domains;

[0110] Step 22: Inputting the face image in the source domain into the adversarial sample generation network to generate an adversarial sample image;

[0111] Step 23: Using the face images in the source domain as training data and the adversarial sample images as test data, the face liveness detection network to be trained is trained to obtain a trained face liveness detection network.

[0112] Step 24: Testing the trained face liveness detection network using the face images in the target domain, and outputting the test results.

[0113] In the embodiments of the present invention, preferably, one of the multiple domains obtained is used as the target domain, and the remaining domains are used as source domains. In other words, data from as many domains as possible is used for training, and only data from one domain is required for verification. Of course, the use of multiple target domains to test the trained face liveness detection network is not excluded.

[0114] In the embodiment of the present invention, after the face liveness detection network is trained, the trained face liveness detection network is tested using the target domain to check the training effect.

[0115] In an embodiment of the present invention, optionally, the facial image in the source domain is input into the adversarial sample generation network, and before generating the adversarial sample image, it also includes: using the facial image in the source domain to train the adversarial sample generation network to generate the adversarial sample generation network.

[0116] The following describes the training process of the adversarial sample generation network.

[0117] Please refer to Figure 3 , Embodiment 3 of the present invention provides a training method for an adversarial sample generation network, including:

[0118] Step 31: Input the face image in the source domain into the adversarial sample generation network to be trained to obtain the output result, which includes: the face depth image corresponding to the input face image, the classification result, the face feature data and the adversarial sample image; wherein, please refer to Figure 4 The adversarial sample generation network to be trained includes a feature extractor, a depth map estimation network and a classifier. The feature extractor extracts features from the input face image to obtain face feature data. The classifier performs face liveness detection classification on the face feature data to obtain face liveness detection classification results. The depth map estimation network processes the face feature data to obtain a face depth image. The role of the depth map estimation network is, on the one hand, to supervise and restrict the process of adversarial sample generation, so that the domain migration between the generated adversarial sample and the depth map corresponding to the face image in the source domain is larger, thereby obtaining an adversarial sample image with a large difference from the source domain. On the other hand, it guides the adversarial sample generation network to extract features that are helpful for liveness detection and improve the liveness detection performance.

[0119] Step 32: Calculate the total loss function of the adversarial sample generation network to be trained based on the output result, update the parameters of the adversarial sample generation network to be trained based on the total loss function, and obtain the trained adversarial sample generation network; the total loss function is calculated based on the loss function of the classifier, the loss function of the depth map estimation network, and the feature difference loss function.

[0120] In an embodiment of the present invention, the face image in the source domain may be processed into a depth image in advance, so as to calculate the loss function of the depth image estimation network, for example, in the above-mentioned image preprocessing step.

[0121] In the embodiment of the present invention, optionally, the total loss function is calculated using the following formula:

[0122]

[0123] in, represents the total loss function, represents the loss function of the classifier, represents the feature difference loss function, represents the loss function of the depth map estimation network, θ represents the parameters of the classifier, represents the parameters of the depth map estimation network, x represents the face image input to the adversarial sample generation network to be trained, z represents the face feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and α and β represent weights.

[0124] In the embodiment of the present invention, optionally, the loss function of the classifier is calculated using the following formula:

[0125]

[0126] Where y represents the true label of the face image input to the adversarial sample generation network to be trained, represents the face liveness detection classification result output by the adversarial sample generation network to be trained, y i and represents y and The i-th dimension of .

[0127] In the embodiment of the present invention, optionally, the feature difference loss function is calculated using the following formula:

[0128]

[0129] Wherein, z represents the facial feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and z +represents the facial feature data extracted by the feature extractor from the adversarial sample image output by the adversarial sample generation network to be trained, 1{·} represents the indicator function, y represents the label of the face image, and y + Represents the label of the generated adversarial sample image. Where y=y + When 1{y≠y +} takes 0, y≠y + When 1{y≠y +}Take 1.

[0130] In the embodiment of the present invention, optionally, the loss function of the depth map estimation network is calculated using the following formula:

[0131]

[0132] Where d represents the depth image corresponding to the face image input to the adversarial sample generation network to be trained, d + represents the depth image generated by the depth map estimation network.

[0133] In an embodiment of the present invention, optionally, the formula for the adversarial sample image output by the adversarial sample generation network is as follows:

[0134]

[0135] in, represents the adversarial sample image obtained by the t-th iteration, represents the adversarial sample image obtained by the t+1th iteration, θ and ψ are the parameters of the classifier and depth map estimation network respectively, Represents an adversarial sample image The features extracted by the feature extractor, Express of Perform derivatives, γ is a hyperparameter, which represents the learning rate of gradient ascent.

[0136] In the embodiments of the present invention, adversarial examples are generated using an online iterative approach, unlike existing methods such as altering image color balance. As the neural network iterates, the adversarial examples continuously evolve. Specifically, the image is altered by adding perturbations to the original data. These perturbations are designed using a neural network loss. The resulting data not only improves image richness but also continuously evolves towards improvements in liveness detection tasks.

[0137] In addition, the loss used in training the adversarial sample generation network utilizes depth map information as supervision, and uses depth map information to improve the performance of liveness detection, so that the new samples generated by the network contribute more to the improvement of liveness detection performance.

[0138] The following describes the training process of the face liveness detection network. In the embodiment of the present invention, the adversarial sample generation network is trained based on the original learning idea.

[0139] Please refer to Figure 5 , Embodiment 4 of the present invention provides a training method for an adversarial sample generation network, including:

[0140] Step 51: Using the face images in the source domain as training data, training the face liveness detection network to be trained, and calculating a first classification loss function. Based on the first classification loss function, updating the parameters of the face liveness detection network to be trained;

[0141] Step 52: Input the adversarial sample image as test data into the face liveness detection network to be trained, and calculate the second classification loss function. According to the first classification loss function and the second classification loss function, update the parameters of the face liveness detection network to be trained.

[0142] Optionally, the calculation formula for the parameters of the face liveness detection network to be trained, which is updated according to the first classification loss function, is as follows:

[0143]

[0144] in, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, θ represents the parameters of the face liveness detection network to be trained before the update, η is a hyperparameter, representing the learning rate, represents the face image in the source domain, represents the first classification loss function, It represents the derivative of θ.

[0145] Optionally, the calculation formula of the second classification loss function is as follows:

[0146]

[0147] in, represents the second classification loss function, y + Represents the label of the adversarial sample image input to the face liveness detection network to be trained, is the label of the adversarial sample image output by the face liveness detection network to be trained, y i + and Represents y + and The i-th dimension of .

[0148] Optionally, according to the first classification loss function and the second classification loss function, a calculation formula for the updated parameters of the face liveness detection network to be trained is as follows:

[0149]

[0150] in, represents the first classification loss function, represents the second classification loss function, K represents the number of target domains, represents the source domain, θ represents the parameters of the face liveness detection network to be trained before updating, represents the domain composed of the k-th adversarial sample image, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, η is a hyperparameter representing the learning rate, It represents the derivative of θ.

[0151] For the case where there are multiple source domains and one target domain, assuming there are N-1 source domains, repeat the above steps to generate adversarial samples corresponding to the face images of the source domains, and use meta-learning to train the face liveness detection network to be trained N-1 times to obtain the final trained face liveness detection network, and use 1 target domain to test the trained face liveness detection network. Of course, other test data can also be used to test the trained face liveness detection network.

[0152] In an embodiment of the present invention, a meta-learning framework is used to train a face liveness detection network. Here, for the training phase of meta-learning, the original collected face data is used, but in the testing phase of meta-learning, generated adversarial sample data is used. Such a clever meta-learning training method is used, rather than randomly dividing the training set and test set in meta-learning according to the original collected data set. It can simulate the situation in which the face liveness detection network encounters new unknown data during learning, so that the face liveness detection network can have better performance for new and never-before-seen scene data, and has a certain resistance to unknown scenes.

[0153] Please refer to Figure 6 The embodiment of the present invention provides a training device 60 for a face liveness detection network, comprising:

[0154] An acquisition module 61 is configured to acquire facial images of multiple domains, where each domain includes multiple facial images, and the multiple facial images in each domain are acquired in the same environment and / or using the same data acquisition device;

[0155] A first selection module 62 is configured to select at least one domain from the plurality of domains as a source domain;

[0156] A generation module 63 is configured to input the face image in the source domain into an adversarial sample generation network to generate an adversarial sample image;

[0157] The first training module 64 is configured to train the face liveness detection network to be trained by using the face images in the source domain as training data and the adversarial sample images as test data, thereby obtaining a trained face liveness detection network.

[0158] Optionally, the training device 60 for the face liveness detection network further includes:

[0159] a second selection module, configured to select a domain other than the source domain from the multiple domains as a target domain;

[0160] A testing module is used to test the trained face liveness detection network using face images in the target domain and output test results.

[0161] Optionally, the training device 60 for the face liveness detection network further includes:

[0162] A second training module is configured to train a to-be-trained adversarial sample generation network using facial images in the source domain to generate the adversarial sample generation network;

[0163] Among them, training the adversarial sample generation network to be trained includes:

[0164] Inputting the face image in the source domain into the adversarial sample generation network to be trained to obtain an output result, the output result including: a face depth image corresponding to the input face image, a classification result, face feature data and an adversarial sample image; wherein the adversarial sample generation network to be trained includes a feature extractor, a depth map estimation network and a classifier, the feature extractor performs feature extraction on the input face image to obtain face feature data, the depth map estimation network processes the face feature data to obtain a face depth image, and the classifier performs face liveness detection classification on the face feature data to obtain a face liveness detection classification result;

[0165] The total loss function of the adversarial sample generation network to be trained is calculated according to the output result, and the parameters of the adversarial sample generation network to be trained are updated according to the total loss function to obtain the trained adversarial sample generation network; the total loss function is calculated according to the loss function of the classifier, the loss function of the depth map estimation network and the feature difference loss function.

[0166] Optionally, the total loss function is calculated using the following formula:

[0167]

[0168] in, represents the total loss function, represents the loss function of the classifier, represents the feature difference loss function, represents the loss function of the depth map estimation network, θ represents the parameters of the classifier, represents the parameters of the depth map estimation network, x represents the face image input to the adversarial sample generation network to be trained, z represents the face feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and α and β represent weights.

[0169] Optionally, the loss function of the classifier is calculated using the following formula:

[0170]

[0171] Where y represents the true label of the face image input to the adversarial sample generation network to be trained, represents the face liveness detection classification result output by the adversarial sample generation network to be trained, y i and represents y and The i-th dimension of .

[0172] Optionally, the feature difference loss function is calculated using the following formula:

[0173]

[0174] Wherein, z represents the facial feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and z + represents the facial feature data extracted by the feature extractor from the adversarial sample image output by the adversarial sample generation network to be trained, 1{·} represents the indicator function, y represents the label of the face image, and y + Denotes the label of the generated adversarial image.

[0175] Optionally, the loss function of the depth map estimation network is calculated using the following formula:

[0176]

[0177] Where d represents the depth image corresponding to the face image input to the adversarial sample generation network to be trained, d + represents the depth image generated by the depth map estimation network.

[0178] Optionally, the formula for the adversarial sample image output by the adversarial sample generation network is as follows:

[0179]

[0180] in, represents the adversarial sample image obtained by the t-th iteration, represents the adversarial sample image obtained by the t+1th iteration, θ and ψ are the parameters of the classifier and depth map estimation network respectively, Represents an adversarial sample image The features extracted by the feature extractor, Express of Perform derivatives, γ is a hyperparameter, which represents the learning rate of gradient ascent.

[0181] Optionally, the first training module includes:

[0182] a training submodule, configured to use the facial images in the source domain as training data to train the face liveness detection network to be trained, calculate a first classification loss function, and update the parameters of the face liveness detection network to be trained based on the first classification loss function;

[0183] A testing submodule is used to input the adversarial sample image as test data into the face liveness detection network to be trained, calculate the second classification loss function, and update the parameters of the face liveness detection network to be trained based on the first classification loss function and the second classification loss function.

[0184] Optionally, the calculation formula for the parameters of the face liveness detection network to be trained, which is updated according to the first classification loss function, is as follows:

[0185]

[0186] in, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, θ represents the parameters of the face liveness detection network to be trained before the update, η is a hyperparameter, representing the learning rate, represents the face image in the source domain, represents the first classification loss function, It represents the derivative of θ.

[0187] Optionally, the calculation formula of the second classification loss function is as follows:

[0188]

[0189] in, represents the second classification loss function, y + Represents the label of the adversarial sample image input to the face liveness detection network to be trained, is the label of the adversarial sample image output by the face liveness detection network to be trained, y i + and Represents y + and The i-th dimension of .

[0190] Optionally, according to the first classification loss function and the second classification loss function, a calculation formula for the updated parameters of the face liveness detection network to be trained is as follows:

[0191]

[0192] in, represents the first classification loss function, represents the second classification loss function, K represents the number of target domains, represents the source domain, θ represents the parameters of the face liveness detection network to be trained before updating, represents the domain composed of the k-th adversarial sample image, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, η is a hyperparameter representing the learning rate, It represents the derivative of θ.

[0193] Please refer to Figure 7 An embodiment of the present invention further provides an electronic device 70, including a processor 71, a memory 72, and a computer program stored in the memory 72 and executable on the processor 71. When the computer program is executed by the processor 71, each process of the training method embodiment of the above-mentioned face liveness detection network is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0194] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the computer program implements the various processes of the above-mentioned embodiment of the training method for face liveness detection network and can achieve the same technical effect. To avoid repetition, the details are not described here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0195] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0196] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0197] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.

Claims

1. A training method for a face liveness detection network, characterized in that: include: Acquire facial images of multiple domains, each domain including multiple facial images, and the multiple facial images in each domain are acquired in the same environment scene and / or using the same data acquisition device; selecting at least one domain from the plurality of domains as a source domain; Inputting the face image in the source domain into the adversarial sample generation network to generate an adversarial sample image; Using the face images in the source domain as training data and the adversarial sample images as test data in the training process, training the face liveness detection network to be trained, and obtaining a trained face liveness detection network; The method includes: using the face images in the source domain as training data, training the face liveness detection network to be trained, and calculating the first classification loss function; Using the adversarial sample image as test data in the training process, inputting it into the face liveness detection network to be trained, and calculating the second classification loss function; updating parameters of a face liveness detection network to be trained according to the first classification loss function and the second classification loss function; Inputting the face image in the source domain into the adversarial sample generation network, before generating the adversarial sample image, further comprising: Using the face images in the source domain to train the adversarial sample generation network to generate the adversarial sample generation network; Among them, training the adversarial sample generation network to be trained includes: Inputting the face image in the source domain into the adversarial sample generation network to be trained to obtain an output result, the output result including: a face depth image corresponding to the input face image, a classification result, face feature data and an adversarial sample image; wherein the adversarial sample generation network to be trained includes a feature extractor, a depth map estimation network and a classifier, the feature extractor performs feature extraction on the input face image to obtain face feature data, the depth map estimation network processes the face feature data to obtain a face depth image, and the classifier performs face liveness detection classification on the face feature data to obtain a face liveness detection classification result; Calculating a total loss function of the adversarial sample generation network to be trained based on the output result, and updating the parameters of the adversarial sample generation network to be trained based on the total loss function to obtain a trained adversarial sample generation network; the total loss function is calculated based on the loss function of the classifier, the loss function of the depth map estimation network, and the feature difference loss function; The total loss function is calculated using the following formula: in, represents the total loss function, represents the loss function of the classifier, represents the feature difference loss function, represents the loss function of the depth map estimation network, θ represents the parameters of the classifier, represents the parameters of the depth map estimation network, x represents the face image input to the adversarial sample generation network to be trained, z represents the face feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and α and β represent weights; The feature difference loss function is calculated using the following formula: Wherein, z represents the facial feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, z + represents the facial feature data extracted by the feature extractor from the adversarial sample image output by the adversarial sample generation network to be trained, 1{·} represents the indicator function, y represents the label of the face image, and y + represents the label of the generated adversarial sample image; where y = y + When 1{y≠y + } takes 0, y≠y + When 1{y≠y + }Take 1.

2. The method according to claim 1, characterized in that Also includes: taking a domain other than the source domain among the multiple domains as a target domain; The trained face liveness detection network is tested using the face images in the target domain, and the test results are output.

3. The method according to claim 1, characterized in that The loss function of the classifier is calculated using the following formula: Where y represents the true label of the face image input to the adversarial sample generation network to be trained, represents the face liveness detection classification result output by the adversarial sample generation network to be trained, y i and represents y and The i-th dimension of .

4. The method according to claim 1, wherein The loss function of the depth map estimation network is calculated using the following formula: Where d represents the depth image corresponding to the face image input to the adversarial sample generation network to be trained, d + represents the depth image generated by the depth map estimation network.

5. The method according to claim 1, wherein The formula for the adversarial sample image output by the adversarial sample generation network is as follows: in, represents the adversarial sample image obtained by the t-th iteration, represents the adversarial sample image obtained by the t+1th iteration, θ and ψ are the parameters of the classifier and depth map estimation network respectively, Represents an adversarial sample image The features extracted by the feature extractor, Express of Perform derivatives, γ is a hyperparameter, which represents the learning rate of gradient ascent.

6. The method according to claim 1, wherein The calculation formula for the parameters of the face liveness detection network to be trained, which is updated according to the first classification loss function, is as follows: in, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, θ represents the parameters of the face liveness detection network to be trained before the update, η is a hyperparameter, representing the learning rate, represents the face image in the source domain, represents the first classification loss function, It represents the derivative of θ.

7. The method according to claim 1, characterized in that The calculation formula of the second classification loss function is as follows: in, represents the second classification loss function, y + Represents the label of the adversarial sample image input to the face liveness detection network to be trained, is the label of the adversarial sample image output by the face liveness detection network to be trained, y i + and Represents y + and The i-th dimension of .

8. The method according to claim 1, characterized in that According to the first classification loss function and the second classification loss function, the calculation formula of the updated parameters of the face liveness detection network to be trained is as follows: in, represents the first classification loss function, represents the second classification loss function, K represents the number of target domains, represents the source domain, θ represents the parameters of the face liveness detection network to be trained before updating, represents the domain composed of the k-th adversarial sample image, represents the parameters of the face liveness detection network to be trained updated according to the first classification loss function, η is a hyperparameter representing the learning rate, It represents the derivative of θ.

9. A training device for a face liveness detection network, characterized in that: include: An acquisition module is used to acquire facial images of multiple domains, each domain including multiple facial images, and the multiple facial images in each domain are acquired in the same environment scene and / or using the same data acquisition device; A first selection module, configured to select at least one domain from the multiple domains as a source domain; A generation module, configured to input the face image in the source domain into an adversarial sample generation network to generate an adversarial sample image; A first training module is configured to use the face images in the source domain as training data and the adversarial sample images as test data in the training process to train the face liveness detection network to obtain a trained face liveness detection network; Using the face images in the source domain as training data and the adversarial sample images as test data in the training process, the face liveness detection network to be trained is trained, and the trained face liveness detection network is obtained, comprising: Using the face images in the source domain as training data, training the face liveness detection network to be trained, and calculating the first classification loss function; Inputting the adversarial sample image as test data in the training process into the face liveness detection network to be trained, calculating a second classification loss function, and updating parameters of the face liveness detection network to be trained based on the first classification loss function and the second classification loss function; The face image in the source domain is input into the adversarial sample generation network, and before generating the adversarial sample image, the method further includes: Using the face images in the source domain to train the adversarial sample generation network to generate the adversarial sample generation network; Among them, training the adversarial sample generation network to be trained includes: Inputting the face image in the source domain into the adversarial sample generation network to be trained to obtain an output result, the output result including: a face depth image corresponding to the input face image, a classification result, face feature data and an adversarial sample image; wherein the adversarial sample generation network to be trained includes a feature extractor, a depth map estimation network and a classifier, the feature extractor performs feature extraction on the input face image to obtain face feature data, the depth map estimation network processes the face feature data to obtain a face depth image, and the classifier performs face liveness detection classification on the face feature data to obtain a face liveness detection classification result; Calculating a total loss function of the adversarial sample generation network to be trained based on the output result, and updating the parameters of the adversarial sample generation network to be trained based on the total loss function to obtain a trained adversarial sample generation network; the total loss function is calculated based on the loss function of the classifier, the loss function of the depth map estimation network, and the feature difference loss function; The total loss function is calculated using the following formula: in, represents the total loss function, represents the loss function of the classifier, represents the feature difference loss function, represents the loss function of the depth map estimation network, θ represents the parameters of the classifier, represents the parameters of the depth map estimation network, x represents the face image input to the adversarial sample generation network to be trained, z represents the face feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, and α and β represent weights; The feature difference loss function is calculated using the following formula: Wherein, z represents the facial feature data extracted by the feature extractor from the face image input to the adversarial sample generation network to be trained, z + represents the facial feature data extracted by the feature extractor from the adversarial sample image output by the adversarial sample generation network to be trained, 1{·} represents the indicator function, y represents the label of the face image, and y + represents the label of the generated adversarial sample image; where y = y + When 1{y≠y + } takes 0, y≠y + When 1{y≠y + }Take 1.

10. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the training method for a face liveness detection network as claimed in any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the training method of the face liveness detection network according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Face living body detection method and device for confrontation sample attacks

    CN111783629A