A face living body detection model generation method and device, and an electronic device
By dividing the training samples into domains and iterating multiple times, and optimizing the parameters using adversarial networks and feature aggregation networks, a face liveness detection model is generated. This solves the problems of poor generalization ability and low recognition accuracy of existing methods, and achieves higher recognition accuracy and generalization.
Patent Information
- Application Number
- CN202310266301.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-20
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-03-20
AI Technical Summary
Existing face liveness detection methods have poor generalization ability, low accuracy of recognition results, and limited application.
By dividing the training samples into domains, the pre-constructed first adversarial network, second adversarial network, and feature aggregation network are trained iteratively multiple times using multi-domain training samples to generate a face liveness detection model. The network parameters are then optimized through the feature aggregation network and adaptive normalization layer to select the target model.
It improves the accuracy and generalization ability of the face liveness detection model, effectively distinguishing between real and fraudulent faces, and reducing the impact of different lighting and scene conditions.
Smart Images

Figure CN116206354B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of face recognition, and particularly relates to a face living body detection model generation method and device and electronic equipment. BACKGROUND
[0002] With the progress of digital information technology, biometric recognition technology has been widely applied to various permission control systems. Face unlocking is widely used in electronic payment, device unlocking, account login and access control systems due to its security and non-contact nature. However, various attack methods against face recognition currently available greatly limit its application, such as print attack, replay attack and 3D mask. Therefore, it is of great significance to study face living body detection methods for face recognition technology.
[0003] Accurate distinction between fraudulent face attacks and real faces can effectively improve the security of face recognition systems. The commonly used face anti-fraud methods currently available are as follows.
[0004] Method 1: Manually made face features such as local binary pattern, scale invariant feature transform, histogram of oriented gradients, Gaussian function difference and speeded up robust features are used to perform binary classification on face images by using support vector machine algorithm or linear discriminant dimension reduction algorithm. However, this method has poor generalization ability and low recognition result accuracy.
[0005] Method 2: Multiple frames of images are used to identify eye blinking or measure heart rate of the face to determine whether the input image is a real face. This method has high efficiency and can guarantee the accuracy of the recognition result. However, it requires the cooperation of the user and cannot be used for face recognition for some users who do not cooperate, and its use is very limited. SUMMARY
[0006] The embodiments of the present application provide a face living body detection model generation method and device and electronic equipment, which can solve the problems of poor generalization ability, low recognition result accuracy and limited use of the existing face living body detection method.
[0007] To solve the above technical problems, the present application provides the following technical solutions:
[0008] The embodiments of the present application provide a face living body detection model generation method, which comprises: performing domain division on training samples to obtain multi-domain training samples;
[0009] Based on the multi-domain training samples, the first adversarial network, the second adversarial network and the feature aggregation network are iteratively trained multiple times to obtain a face living body detection model after each iteration; wherein the first adversarial network comprises a first generator and a first discriminator, and the second adversarial network comprises a second generator and a second discriminator.
[0010] Test the prediction accuracy of each of the face liveness detection models by using face images from unknown domains, and select a target face liveness detection model from the plurality of face liveness detection models based on the test results;
[0011] The process of single training of the first and second generative adversarial networks and the feature aggregation network based on the multi-domain training samples includes:
[0012] The multi-domain training samples are input into the first and second generative adversarial networks respectively to obtain the first liveness-related features and the first domain-related features of each of the training samples;
[0013] The first liveness-related features and the first domain-related features of different domains are combined by the feature aggregation network to obtain a plurality of combined features;
[0014] The parameters of the first generative adversarial network and the first discriminator are optimized based on the plurality of combined features;
[0015] The parameters of the second discriminator are optimized based on the plurality of combined features;
[0016] The multi-domain training samples are input into the optimized first and second generative adversarial networks to obtain the second liveness-related features and the second domain-related features of each of the training samples;
[0017] The total loss of the generative adversarial network and the feature aggregation network is calculated according to the second liveness-related features and the second domain-related features;
[0018] The parameters of the first and second generative adversarial networks and the feature aggregation network are optimized according to the total loss by using the stochastic gradient descent method to generate a face liveness detection model obtained by this iteration training.
[0019] Optionally, the step of optimizing the parameters of the first generative adversarial network and the first discriminator based on the plurality of combined features includes:
[0020] The intra-domain distribution loss, the inter-domain distribution loss, and the semi-error rate loss of the model are determined based on the plurality of combined features;
[0021] The sum of the intra-domain distribution loss, the inter-domain distribution loss, and the semi-error rate loss of the model is determined as the first loss;
[0022] The parameters of the first generative adversarial network and the first discriminator are optimized according to the first loss by using the stochastic gradient descent method.
[0023] Optionally, the step of optimizing the parameters of the second discriminator based on the plurality of combined features includes:
[0024] inputting the plurality of the synthetic features into the second discriminator, and performing parameter optimization on the second discriminator based on the calculated second loss.
[0025] Optionally, the step of calculating the total loss of the generator and the feature aggregation network according to the second living body related features and the second domain related features comprises:
[0026] calculating, according to the second living body related features and the second domain related features, an inter-discriminator orthogonal loss, a classification loss of the second discriminator, and a semi-error rate loss;
[0027] determining the sum of the inter-discriminator orthogonal loss, the classification loss of the second discriminator, and the semi-error rate loss as the total loss of the generator and the feature aggregation network.
[0028] Optionally, the feature aggregation network comprises: the feature aggregation network comprises an input layer, a global average pooling layer, a multi-layer perception, an AdaIN layer I, an AdaIN layer II, a ReLu activation layer, a first convolutional layer, and a second convolutional layer.
[0029] Optionally, the step of synthesizing the first living body related features and the first domain related features of different domains two by two through the feature aggregation network to obtain a plurality of synthetic features comprises:
[0030] inputting the first living body related features into the global average pooling layer for processing and then into the multi-layer perception to generate affine parameters;
[0031] inputting the first domain related features into the first convolutional layer, inputting the output of the first convolutional layer and the affine parameters into the AdaIN layer I, inputting the output of the AdaIN layer I into the second convolutional layer via the ReLu activation layer;
[0032] inputting the output of the second convolutional layer and the affine parameters into the AdaIN layer II to generate a synthetic feature residual;
[0033] adding the synthetic feature residual and the first domain related features to obtain a synthetic feature.
[0034] Optionally, after the step of selecting a target face living body detection model from the plurality of face living body detection models based on the test results, the method further comprises:
[0035] inputting a face image to be recognized into the first generator of the face living body detection model to obtain living body related features;
[0036] inputting the living body related features into the first discriminator to obtain a face living body detection result, wherein the face living body detection result is used to indicate whether the to-be-identified face image is a real face image.
[0037] The embodiment of the present application further provides a face living body detection model generation device, comprising:
[0038] a division module configured to divide the training samples into domains to obtain multi-domain training samples;
[0039] a training module configured to perform multi-time iterative training on a first adversarial network, a second adversarial network and a feature aggregation network pre-constructed based on the multi-domain training samples to obtain a face living body detection model after each time of iterative training; the first adversarial network comprises a first generator and a first discriminator, and the second adversarial network comprises a second generator and a second discriminator;
[0040] a screening module configured to test the prediction accuracy of each of the face living body detection models by using face images of an unknown domain, and screen a target face living body detection model from the plurality of face living body detection models based on a test result;
[0041] The training module comprises:
[0042] a first sub-module configured to input the multi-domain training samples into the first generator and the second generator respectively to obtain first living body related features and first domain related features of each of the training samples;
[0043] a second sub-module configured to perform feature synthesis on the first living body related features and the first domain related features of different domains two by two by using the feature aggregation network to obtain a plurality of synthesized features;
[0044] a third sub-module configured to perform parameter optimization on the first generator and the first discriminator based on the plurality of synthesized features;
[0045] a fourth sub-module configured to perform parameter optimization on the second discriminator based on the plurality of synthesized features;
[0046] a fifth sub-module configured to input the multi-domain training samples into the first generator and the second generator after optimization to obtain second living body related features and second domain related features of each of the training samples;
[0047] a sixth sub-module configured to calculate a total loss of the generator and the feature aggregation network according to the second living body related features and the second domain related features;
[0048] The seventh submodule is configured to optimize the first generator, the second generator, and the feature aggregation network parameter based on the total loss by using a stochastic gradient descent method, and generate a face liveness detection model obtained through this iteration of training.
[0049] Optionally, the third submodule is specifically configured to:
[0050] determine an intra-domain distribution loss, an inter-domain distribution loss, and a semi-error rate loss of the model based on the plurality of synthetic features;
[0051] determine a sum of the intra-domain distribution loss, the inter-domain distribution loss, and the semi-error rate loss of the model as a first loss;
[0052] optimize the first generator and the first discriminator parameter based on the first loss by using a stochastic gradient descent method.
[0053] Optionally, the fourth submodule is specifically configured to:
[0054] input the plurality of synthetic features into the second discriminator, and optimize the parameter of the second discriminator based on a calculated second loss.
[0055] Optionally, the fourth submodule is specifically configured to:
[0056] calculate an inter-discriminator orthogonal loss, a classification loss of the second discriminator, and a semi-error rate loss based on the second liveness-related feature and the second domain-related feature;
[0057] determine a sum of the inter-discriminator orthogonal loss, the classification loss of the second discriminator, and the semi-error rate loss as a total loss of the generator and the feature aggregation network.
[0058] Optionally, the feature aggregation network comprises an input layer, a global average pooling layer, a multi-layer perception, an AdaIN layer I, an AdaIN layer II, a ReLu activation layer, a first convolutional layer, and a second convolutional layer.
[0059] Optionally, the second submodule is specifically configured to:
[0060] input the first liveness-related feature into the global average pooling layer for processing, and then input the processed first liveness-related feature into the multi-layer perception to generate affine parameters;
[0061] input the first domain-related feature into the first convolutional layer, input the output of the first convolutional layer and the affine parameters into the AdaIN layer I, and then input the output of the AdaIN layer I into the second convolutional layer via the ReLu activation layer;
[0062] The output of the second convolutional layer and the affine parameter are input into the AdaIN layer II to generate a synthetic feature residual;
[0063] The synthetic feature residual is added to the first domain-related feature to obtain a synthetic feature.
[0064] Optionally, the device further comprises:
[0065] The prediction module is configured to input the to-be-identified face image into the first generator of the face liveness detection model to obtain a liveness-related feature after the screening module screens the target face liveness detection model from the plurality of face liveness detection models based on the test result.
[0066] The liveness-related feature is input into the first discriminator to obtain a face liveness detection result, wherein the face liveness detection result is used to indicate whether the to-be-identified face image is a real face image.
[0067] The electronic device provided by the embodiment of the present application comprises a processor, a memory, and a program or instructions stored on the memory and executable on the processor, and the program or instructions are executed by the processor to implement the steps of any one of the face liveness detection model generation methods.
[0068] The readable storage medium provided by the embodiment of the present application stores a program or instructions, and the program or instructions are executed by a processor to implement the steps of any one of the face liveness detection model generation methods.
[0069] The face liveness detection model generation scheme provided by the embodiment of the present application performs domain division on training samples to obtain multi-domain training samples; based on the multi-domain training samples, the first adversarial network, the second adversarial network, and the feature aggregation network are iteratively trained multiple times to obtain a face liveness detection model after each iteration; the prediction accuracy of each face liveness detection model is tested by using face images of unknown domains, and a target face liveness detection model is screened from the plurality of face liveness detection models based on the test result. In the embodiment of the present application, through domain adversarial learning, the network model is trained by using the designed feature aggregation network and adaptive normalization layer, the influence of face images under different illuminations and scenes is effectively avoided, and the face liveness detection model trained has high recognition result accuracy and strong generalization. BRIEF DESCRIPTION OF DRAWINGS
[0070] Figure 1 is a step flowchart of a face liveness detection model generation method according to an embodiment of the present application;
[0071] Figure 2is a structural schematic diagram of a network as a whole of an embodiment of the present application;
[0072] Figure 3 is a structural schematic diagram of a first generator and a second generator of an embodiment of the present application;
[0073] Figure 4 is a structural schematic diagram of a first discriminator of an embodiment of the present application;
[0074] Figure 5 is a structural schematic diagram of a second discriminator of an embodiment of the present application;
[0075] Figure 6 is a structural schematic diagram of a feature aggregation network of an embodiment of the present application;
[0076] Figure 7 is a structural schematic diagram of an adaptive normalization layer of an embodiment of the present application;
[0077] Figure 8 is a structural block diagram of a face living body detection model generation device of an embodiment of the present application. DETAILED DESCRIPTION
[0078] In order to make the technical problems, technical solutions and advantages of the present application clearer, specific embodiments will be described in detail below with reference to the drawings.
[0079] The pre-trained face living body detection model provided in the embodiment of the application comprises two generative adversarial networks, i.e., a first generative adversarial network and a second generative adversarial network, and a feature aggregation network. The first generative adversarial network is composed of a first generator and a first discriminator, and the second generative adversarial network is composed of a second generator and a second discriminator. When training the face living body detection model, first, the collected face images are divided into domains, and then face images in multiple domains are used to train the neural network model, and a face image set in an unknown domain is reserved to evaluate the model. Second, the first generative adversarial network, the second generative adversarial network and the feature aggregation network are built, the training images are input into the generators of the two generative adversarial networks to obtain the features extracted by the respective generators, the first generator and the first discriminator are updated through the cross-domain loss and the binary cross-entropy loss, the features extracted by the two generators are input into the feature aggregation network to obtain the synthesized features, and the second discriminator is updated using the adversarial loss. The parameters of the first discriminator and the second discriminator are frozen, the data is input into the two generators again to obtain two generated features, the orthogonal loss and the min-max loss are calculated through the two obtained features to update the first generator, the second generator and the feature aggregation network, and the final model is obtained through training and evaluation of the unknown domain images. Finally, the to-be-detected is input into the first generator and the first discriminator to obtain the face living body detection result. The application can weaken the influence of domain information on face living body detection in the algorithm by mining the domain information of different faces through adversarial learning, and further improve the accuracy of face living body detection through the proposed adaptive normalization module.
[0080] The face living body detection model generation scheme provided in the embodiment of the application will be described in detail in combination with the drawings, specific embodiments and application scenarios.
[0081] As shown in the accompanying Figure 1 The face living body detection model generation method provided in the embodiment of the application comprises the following steps:
[0082] Step 101: Domain division is performed on the training samples to obtain multi-domain training samples.
[0083] In the application, the first adversarial network, the second adversarial network, the feature aggregation network and the multi-domain training samples are pre-prepared, the first adversarial network, the second adversarial network and the feature combination network are iteratively trained based on the multi-domain training samples, and then a target face living body detection model is selected from the multiple face living body detection models generated through the iterative training.
[0084] The training samples include real face images and fraudulent face images. The collected face images can be divided into 3 domains, 4 domains or more domains. The number of divided domains is not limited in the embodiment of the application. The training samples are divided into three domains in the embodiment of the application. In the actual implementation process, the whole multi-domain training data can be recorded as M X (X={A, B, C,...}), which represents face images from domains (A, B, C,...).
[0085] Before the domain division of the training samples, the size of the training samples can be scaled to a preset size, for example, 256*256 pixels, and the pixels can be normalized to 0-1, x Norm = x / 255.
[0086] Wherein, x is the original face image, x Norm is the normalized face image, and a plurality of normalized face images form a training sample set.
[0087] Step 102: based on the multi-domain training samples, the first adversarial network, the second adversarial network and the feature aggregation network are iteratively trained for multiple times to obtain a face liveness detection model after each iteration.
[0088] Figure 2 is a structural schematic diagram of the whole network of the embodiment of the application, as Figure 2 shown, the whole network includes the first adversarial network, the second adversarial network and the feature aggregation network. The first adversarial network includes a first generator and a first discriminator, and the second adversarial network includes a second generator and a second discriminator. The input of the first generator is a face image, which is responsible for generating liveness-related features. The input of the second generator is also a face image, which is responsible for generating domain-related features. The input of the feature aggregation network is the output of the first generator and the second generator, which is responsible for aggregating the two features to generate a synthetic feature. The input of the first discriminator is the output of the feature aggregation network, which is responsible for discriminating whether the input feature is a real face feature. The input of the second discriminator is also the output of the feature aggregation network, which is responsible for determining which domain the input feature comes from.
[0089] Figure 3 is a structural schematic diagram of the first generator and the second generator of the embodiment of the application; as Figure 3 shown, the first generator and the second generator each include an input layer, a first residual unit, a second residual unit, a third residual unit, a fourth residual unit and an output layer. The input layer is connected to the first residual unit, the first residual unit is connected to the second residual unit, the second residual unit is connected to the third residual unit, the third residual unit is connected to the fourth residual unit, and the fourth residual unit is connected to the output layer.
[0090] The first residual unit, the second residual unit, the third residual unit and the fourth residual unit each comprise a convolutional layer I, a convolutional layer II, a convolutional layer III, a ReLU layer I, a ReLU layer II, the convolutional layer I is connected with the convolutional layer II, the convolutional layer II is connected with the ReLU layer I, the ReLU layer I is connected with the convolutional layer III, the convolutional layer III is added with the convolutional layer I and then connected with the ReLU layer II.
[0091] Figure 4 is a structural schematic diagram of a first discriminator of an embodiment of the present application. As shown in Figure 4 , the first discriminator comprises an input layer, a residual unit, an adaptive normalization unit, a global average pooling layer, a full connection layer I, a full connection layer II, a ReLU activation layer I, a ReLU activation layer II, a SoftMax activation layer and an output layer, the input layer is connected with the residual unit, the residual unit is connected with the adaptive normalization unit, the adaptive normalization unit is connected with the global average pooling layer, the global average pooling layer is connected with the ReLU activation layer I, the ReLU activation layer I is connected with the full connection layer I, the full connection layer I is connected with the ReLU activation layer II, the ReLU activation layer II is connected with the full connection layer II, the full connection layer II is connected with the SoftMax activation layer, and the SoftMax activation layer is connected with the output layer. The output of the first discriminator is two probability values activated by SoftMax, which respectively represent the probability that the input feature is a real face and the probability that the input feature is a fake face.
[0092] Figure 5 is a structural schematic diagram of a second discriminator of an embodiment of the present application. As shown in Figure 5 , the second discriminator comprises an input layer, a residual unit, an adaptive normalization unit, a global average pooling layer, a full connection layer I, a full connection layer II, a ReLU activation layer I, a ReLU activation layer II, a SoftMax activation layer and an output layer, the input layer is connected with the residual unit, the residual unit is connected with the adaptive normalization unit, the adaptive normalization unit is connected with the global average pooling layer, the global average pooling layer is connected with the ReLU activation layer I, the ReLU activation layer I is connected with the full connection layer I, the full connection layer I is connected with the ReLU activation layer II, the ReLU activation layer II is connected with the full connection layer II, the full connection layer II is connected with the SoftMax activation layer, and the SoftMax activation layer is connected with the output layer. The output of the first discriminator is two probability values activated by SoftMax, which respectively represent the probability that the input feature is a real face and the probability that the input feature is a fake face.
[0093] Figure 6 is a structural schematic diagram of a feature aggregation network of an embodiment of the present application. As shown in Figure 6As shown, the feature aggregation network includes an input layer, a global average pooling layer, a multilayer perceptron, AdaIN layer I, AdaIN layer II, a ReLU activation layer, convolutional layer I, and convolutional layer II. The features generated by the first generator are used as F... f The features generated by the second generator are used as F. d The processing method of feature aggregation network is as follows:
[0094] γ,β=MLP[GAP(F f )]
[0095]
[0096]
[0097] Among them, F f The liveness-related features generated by the first generator are: GAP (global average pooling layer), MLP (multilayer perceptron), AdaIN (AdaIN layer), ReLU (ReLU activation layer), and K1 and K2 (convolutional kernels). Represents convolution, where γ and β are features F. f The generated affine parameters, z is an intermediate variable, and SAL represents the feature aggregation network.
[0098] Figure 7 This is a schematic diagram illustrating the structure of the adaptive normalization layer in an embodiment of this application. For example... Figure 7 As shown, the adaptive normalization layer includes an IN (Instance Normalization) layer, a BN (Batch Normalization) layer, a convolutional layer, a global average pooling layer, a fully connected layer I, a fully connected layer II, a fully connected layer III, a ReLU activation layer, a Sigmoid activation layer I, and a Sigmoid activation layer II. The processing method of the adaptive normalization layer can be described as follows: assuming the input feature is X with dimensions C×H×W, this input feature is processed by the upper IN layer and the lower BN layer to generate feature X. IN With X BN The input features are processed through a convolutional layer and a global average pooling layer in the middle to obtain feature S, with size C. Then, a compact feature Z, with size d, is obtained through a fully connected layer I and a ReLU activation layer. Next, cross-channel soft attention is used to adaptively select appropriate features, B = σ1(W B Z), I = σ2(W) I Z), where σ1 and σ2 are Sigmoid activation layer I and Sigmoid activation layer II, respectively, W B With W I These are the weights of fully connected layer II and fully connected layer III, respectively. Next, a normalization balancing factor α can be defined, with size C, which can be obtained through the feature calculation described above: where c e C is the channel of the feature, and represent multiplication and addition, respectively, then the output of the final adaptive normalization layer can be represented as:
[0099] It should be noted that the above only exemplarily introduces the structure of each module in the first adversarial network, the second adversarial network and the feature aggregation network, and in the actual implementation process, the structure of each module can be flexibly set by the person skilled in the art according to the actual needs, and the embodiments of the present application do not make specific limitations thereto.
[0100] In this step, the pre-constructed first adversarial network, second adversarial network and feature aggregation network need to be iteratively trained based on the multi-domain training samples to obtain a face liveness detection model after each iteration training, and the face liveness detection model obtained after each iteration training is used as the basis model for training. The number of iterations of the iterative training can be flexibly set by the person skilled in the art, and the embodiments of the present application do not make specific limitations thereto. The more the number of iterations, the more the calculation resources consumed, and the greater the probability of obtaining a face liveness detection model with high recognition accuracy.
[0101] The process of single training of the pre-constructed first adversarial network, second adversarial network and feature aggregation network based on the multi-domain training samples will be described below. The single training of the overall model includes the following sub-steps:
[0102] Sub-step 1021: input the multi-domain training samples into the first generator and the second generator respectively to obtain the first liveness-related features and the first domain-related features of each training sample.
[0103] The multi-domain face image is input into the network constructed above for training; wherein the training data contains real face images and fraudulent face images, and the overall multi-domain training data is denoted as M X (X = {A, B, C}), representing face images from domains (A, B, C), the data is input into the first generator and the second generator to generate liveness-related features and domain-related features, and the processing method can be described as:
[0104] F f = G1(M X )
[0105] F d = G2(M X )
[0106] Where G1 and G2 represent the first generator and the second generator, respectively, F f and F drespectively represent the living body related features and the domain related features.
[0107] Sub-step 1022: The first living body related features and the first domain related features of different domains are synthesized by the feature aggregation network to obtain a plurality of synthesized features.
[0108] As shown in the feature aggregation network, the feature aggregation network includes an input layer, a global average pooling layer, a multi-layer perception, an AdaIN layer I, an AdaIN layer II, a ReLu activation layer, a first convolutional layer, and a second convolutional layer. Figure 6 When the first living body related features and the first domain related features of different domains are synthesized by the feature aggregation network to obtain a plurality of synthesized features, the following methods can be used:
[0109] The first living body related features are input into the global average pooling layer for processing and then input into the multi-layer perception to generate affine parameters γ and β; the first domain related features are input into the first convolutional layer, i.e., convolutional layer I, the output of the first convolutional layer and the affine parameters γ and β are input into the AdaIN layer I, and then input into the second convolutional layer, i.e., convolutional layer II, via the ReLu activation layer; the output of the second convolutional layer and the affine parameters γ and β are input into the AdaIN layer II to generate a synthesized feature residual; the synthesized feature residual and the first domain related features are added to obtain a synthesized feature.
[0110] (x i ,y f ,y d )(i∈{A,B,C}) are source domain images with living body labels and domain labels, which can generate features (F i f ,y f ) and (F i d ,y d ) via the generator, and the living body features of the domain i and the domain features of the domain j are randomly selected to obtain a synthesized feature The processing method is as follows:
[0111]
[0112] Sub-step 1023: Based on the plurality of synthesized features, the parameters of the first generator and the first discriminator are optimized.
[0113] In this step, the parameters of G1 and D1 are optimized, and in order to improve the feature extraction capability of the network, the cross-domain loss and the smoothed error rate loss are used to optimize the parameters.
[0114] Optionally, the way of optimizing the parameters of the first generator and the first discriminator based on the plurality of synthesized features includes the following flow:
[0115] Based on the plurality of synthetic features, determine the intra-domain distribution loss, the inter-domain distribution loss and the semi-error rate loss of the model; the sum of the intra-domain distribution loss, the inter-domain distribution loss and the semi-error rate loss of the model is determined as the first loss; the first generator and the first discriminator parameters are optimized according to the first loss by using the stochastic gradient descent method.
[0116] In actual implementation process, the features from the same class and the same domain should be as close as possible:
[0117]
[0118]
[0119] Wherein, a m is the anchor sample feature from the domain m, and is the positive sample and the negative sample from the domain m.
[0120] L Intra = L Intra-1 + L Intra-2
[0121] The loss restricts that the features of the same class samples from one domain should be as close as possible, and the features of different class samples should be as far away as possible.
[0122] In addition to considering the intra-domain distribution difference, the inter-domain distribution difference is also considered:
[0123]
[0124] Wherein, a m is the feature of the anchor sample from the domain m, p i and n j are the positive sample and the negative sample from any domain (except the domain m), and α is the interval control parameter.
[0125] The face anti-fraud model is often evaluated by half error rate (HTER), but it is not derivable and cannot be used as a loss function to directly update network parameters. The first discriminator D1 is a binary classifier for predicting whether it is a real face, and its output is [z0, z1]. I i is a one-hot vector with the i-th position being 1, is the opposite one-hot vector. If the category is i, it can be represented as a vector I i According to the inner product of the label one-hot vector and the predicted one-hot vector, a function for predicting accuracy can be defined:
[0126]
[0127] According to the inner product of the label opposite d one-hot vector and the predicted one-hot vector, a function for predicting error can be defined:
[0128]
[0129] According to the above, the TN, TP, FN, and FP indicators can be calculated. At present, these indicators are still discrete. In order to ensure that they are derivable, a SoftMax activation is applied to the output of the classifier, and the output of the classifier is:
[0130]
[0131] Using the predicted probability instead of the one-hot vector, the FAR and FRR can be obtained:
[0132]
[0133]
[0134] The smooth HTER can be defined as:
[0135]
[0136] where · is the inner product of two vectors, and |B0| and |B1| are the number of fraudulent face images and the number of real face images in a batch of data, respectively.
[0137] In order to ensure the monotonicity of the loss and the gradient, the above HTER loss is further deformed:
[0138]
[0139] The loss of G1 and D1 can be defined as:
[0140] L1=L Intra +L Inter +L HTER
[0141] The network parameters of G1 and D1 are updated using the SGD random gradient descent method.
[0142] Substep 1024: Based on the plurality of synthesized features, the parameters of the second discriminator are optimized.
[0143] In this step, the parameters of D2 are optimized.
[0144] An optional way to optimize the parameters of the second discriminator based on the plurality of synthesized features can be: inputting the plurality of synthesized features into the second discriminator, and optimizing the parameters of the second discriminator based on the calculated second loss.
[0145] Suppose that only face images in the domains (A, B, C) are used to train the network, (x A ,y f ,y d), (x B ,y f ,y d ), (x C ,y f ,y d ) represent the source domain images with living body labels and domain labels, the target of D2 is to confirm the domain information of the input source domain feature F i,i and the synthesized feature F i,j (i≠j), therefore, the distribution of and represent the source domain feature and the synthesized feature and their domain labels, where Therefore, the processing method for optimizing D2 is:
[0146]
[0147] Where p s and p a are the distributions of the original feature and the synthesized feature respectively.
[0148] Based on the calculated second loss L2, the network parameters of D2 are updated using the SGD random gradient descent method.
[0149] Substep 1025: input the multi-domain training sample into the optimized first generator and the second generator to obtain the second living body related feature and the second domain related feature of each training sample.
[0150] M X is input into the network again, first, the living body related feature F f is generated by the generator G1, and the domain related feature F d is generated by the generator G2, in order to ensure that the two features are independent of each other, the orthogonal loss is used to ensure the independence of the two feature vectors:
[0151] L DLI = <F i f ,F i d >
[0152] Where <·> represents the inner product operation.
[0153] Substeps 1025-1027 are the process of optimizing the generator and the feature network parameters. In this step, the parameters of the first discriminator D1 and the second discriminator D2 are fixed.
[0154] Substep 1026: calculate the total loss of the generator and the feature aggregation network according to the second living body related feature and the second domain related feature.
[0155] An optional manner of calculating the total loss of the generator and the feature aggregation network according to the second living body related feature and the second domain related feature can be as follows:
[0156] According to the second living body related feature and the second domain related feature, the inter-discriminator orthogonal loss, the classification loss of the second discriminator, and the semi-error rate loss are calculated; and the sum of the inter-discriminator orthogonal loss, the classification loss of the second discriminator, and the semi-error rate loss is determined as the total loss of the generator and the feature aggregation network.
[0157] The target of the generator is to make D2 unable to distinguish whether the input feature is a synthetic feature, which is contrary to optimizing the parameters of D2 in S1.3, and the synthetic feature F i,j The domain label of (i≠j) is defined as Therefore, the synthetic feature with the label can be represented as The classification loss of the discriminator D2 can be represented as:
[0158]
[0159] The total loss of the generator and the feature aggregation network can be represented as:
[0160] L3=L HTER +L D2-cls +L DLI
[0161] Wherein, L3 is the total loss of the generator and the feature aggregation network, L HTER is the semi-error rate loss, L D2-cls is the classification loss of the second discriminator, and L DLI is the inter-discriminator orthogonal loss.
[0162] It should be noted that steps 1021 to 1027 are the process of single parameter tuning training of the model core based on the multi-domain training sample. In the actual implementation process, after each parameter tuning is completed, it is used as the basis of the model for the next iteration of parameter tuning training. The training process is repeated until the number of iterations of parameter tuning training reaches the preset upper limit number of times.
[0163] Sub-step 1027: using the stochastic gradient descent method, optimizing the parameters of the first generator, the second generator, and the feature aggregation network according to the total loss, and generating a face living body detection model obtained by this iteration training.
[0164] Step 103: test the prediction accuracy of each face living body detection model using face images of unknown domains, and select a target face living body detection model from the plurality of face living body detection models based on the test results.
[0165] In this step, G1 and D1 can be used, the loss rate and accuracy rate of the trained output are output, and the model parameters of each iteration training are saved, and the model parameters with the highest accuracy rate on the test set are selected.
[0166] The face living body detection model generation method provided in the embodiment of the application divides the training samples into domains to obtain multi-domain training samples; based on the multi-domain training samples, the first adversarial network, the second adversarial network and the feature aggregation network that are constructed in advance are iteratively trained multiple times to obtain a face living body detection model after each iteration training; the prediction accuracy of each face living body detection model is tested by using a face image of an unknown domain, and a target face living body detection model is selected from the multiple face living body detection models based on the test result. In the embodiment of the application, through domain adversarial learning, the network model is trained by using the designed feature aggregation network and adaptive normalization layer, the influence of face images under different illuminations and scenes is effectively avoided, and the face living body detection model obtained by training has high recognition result accuracy and strong generalization.
[0167] In an optional embodiment, after the target face living body detection model is selected from the multiple face living body detection models based on the test result, the method can further include the following face image prediction step:
[0168] First, the face image to be identified is input into the first generator of the face living body detection model to obtain living body related features; second, the living body related features are input into the first discriminator to obtain a face living body detection result.
[0169] The face living body detection result is used to indicate whether the face image to be identified is a real face image.
[0170] This optional face image recognition method can be completed by only using the first adversarial network of the face living body detection model, and has small calculation amount and high processing efficiency.
[0171] The face living body detection model generation method provided in the application will be described below in combination with a specific embodiment.
[0172] The face living body detection model generation method in the application mainly includes the following steps:
[0173] As shown in Figure 1 The embodiment of the application provides a face living body detection method, and the specific steps are as follows:
[0174] Step one: divide the collected face images by domain.
[0175] Here, it is assumed that the training images belong to domains {A, B, C}, and a test set is additionally divided to evaluate the trained network model.
[0176] Before the image is input to the network training, the image needs to be preprocessed, which can include the following operations:
[0177] 1) Scale the size of the image to 224x224 pixels for the input of the convolutional layer;
[0178] 2) Perform random flipping, rotation, inversion, etc. enhancement processing on the image processed in the previous step;
[0179] 3) Normalize the pixels of the image, which can be described as:
[0180]
[0181] Wherein, Min and Max are the minimum and maximum values of the pixels in the image.
[0182] Step two: build the first generator, the second generator, the feature aggregation network, the first discriminator, the second discriminator network, and use the multi-domain face image to train the network to obtain a face liveness detection model.
[0183] The specific process of using the multi-domain face image to train the network can be as follows:
[0184] S2.1: input the multi-domain face image into the network constructed above for training; wherein the training data contains real face images and fraudulent face images, and the whole multi-domain training data is denoted as M X (X={A,B,C}) represents the face image from the domain (A, B, C), and the data is input into two generators to generate liveness-related features and domain-related features, which can be described as:
[0185] F f =G1(M X )
[0186] F d =G2(M X )
[0187] Wherein, G1 and G2 represent the first generator and the second generator respectively, F f and F d represent liveness-related features and domain-related features respectively.
[0188] (x i ,y f ,y d )(i∈{A,B,C}) is the source domain image with liveness label and domain label, which can generate features (F i f ,y f ) and (F id y d ), randomly select the living features of domain i and the domain features of domain j to obtain synthetic features The processing method can be:
[0189]
[0190] Wherein, the SAL is a feature aggregation network.
[0191] S2.2: Optimize the parameters of G1 and D1.
[0192] In order to improve the feature extraction ability of the network, the cross-domain loss and the smooth version of the error rate loss are used to optimize the parameters. The features from the same class and the same domain should be as close as possible:
[0193]
[0194]
[0195] Wherein, a m is the anchor sample feature from domain m, and is the positive sample and negative sample from domain m. Then the total intra-domain loss is:
[0196] L Intra = L Intra-1 + L Intra-2
[0197] Calculate the inter-domain loss:
[0198]
[0199] Wherein, a m is the feature of the anchor sample from domain m, p i and n j are the positive sample and negative sample from any domain (except domain m), and α is the distance control parameter.
[0200] Calculate the classification half-error rate loss of the discriminator:
[0201]
[0202] Wherein, p(x) and q(x) are the outputs of the first discriminator, |B0| and |B1| are the number of fraudulent face images and the number of real face images in a batch of data, respectively.
[0203] In order to ensure the monotonicity of the loss and the gradient, the above HTER loss is further deformed:
[0204]
[0205] The loss of G1 and D1 can be defined as:
[0206] L1 = L Intra + L Inter + L HTER
[0207] The network parameters of G1 and D1 are updated based on L1 using the SGD stochastic gradient descent method.
[0208] S2.3: Optimize D2 parameters.
[0209] The network is trained using face images in domain (A, B, C), (x A , y f , y d ), (x B , y f , y d ), (x C , y f , y d ) represent source domain images with living body labels and domain labels, and the goal of D2 is to confirm the domain information of the input source domain feature F i,i and the synthesized feature F i,j (i≠j), therefore, use and represent the source domain feature and the synthesized feature and their domain labels, where Therefore, the processing method for optimizing D2 is:
[0210]
[0211] Where p s and p a are the distributions of the original feature and the synthesized feature respectively.
[0212] The network parameters of D2 are updated based on L2 using the SGD stochastic gradient descent method.
[0213] S2.4: Optimize generator and feature diagnosis aggregation network parameters.
[0214] The parameters of D1 and D2 are fixed, and M X is input into the network again, first, the living body related feature F f is generated by the generator G1, and the domain related feature F d is generated by the generator G2, in order to ensure that the two features are independent of each other, the orthogonal loss is used to ensure the independence of the two feature vectors:
[0215] L DLI = <F i f , F id
[0216] where <·> denotes the inner product operation.
[0217] The goal of the generator is to make D2 unable to distinguish whether the input feature is a synthetic feature, which is contrary to optimizing the parameters of D2 in S1.3, and the synthetic feature F i,j The domain label of (i≠j) is defined as Therefore, the synthetic feature with the label can be expressed as The classification loss of the discriminator D2 can be expressed as:
[0218]
[0219] The total loss of the generator and the feature aggregation network can be expressed as:
[0220]
[0221] Update the parameters of G1, G2, and the feature aggregation network using the SGD random gradient descent method based on L3.
[0222] S2.5: Use G1 and D1 to output the loss rate and accuracy of its training, save the model parameters of each iteration training, select the model parameters with the highest accuracy on the test set, and use the G1 and D1 of the model parameters to perform face liveness detection.
[0223] The face liveness detection model generation method provided in the embodiment separates the liveness-related features and the domain-related features of the face image through adversarial learning to improve the accuracy and generalization ability of the face liveness detection model. Meanwhile, a feature aggregation network is designed to effectively synthesize features to improve the discrimination ability of the discriminator, and an adaptive normalization method and a smooth half-error rate loss are designed to improve the extraction ability of the network for liveness-related features and domain-related features.
[0224] Figure 8 To achieve the face liveness detection model generation device provided in the embodiment of the application, a structural block diagram of the device is provided.
[0225] The face liveness detection model generation device provided in the embodiment of the application includes the following functional modules.
[0226] The division module 801 is configured to divide the training samples into domains to obtain multi-domain training samples.
[0227] The training module 802 is configured to perform multiple iteration training on the pre-constructed first and second generative discriminators and the feature aggregation network based on the multi-domain training samples, and obtain a face liveness detection model after each iteration training.
[0228] The screening module 803 is configured to test the prediction accuracy of each face liveness detection model by using face images in an unknown domain, and screen a target face liveness detection model from the plurality of face liveness detection models based on a test result.
[0229] The training module 802 includes the following sub-function modules.
[0230] The first sub-module is configured to input the multi-domain training samples into the first and second generators respectively, and obtain first liveness-related features and first domain-related features of each training sample.
[0231] The second sub-module is configured to perform feature synthesis on the first liveness-related features and the first domain-related features of different domains by using the feature aggregation network, and obtain a plurality of synthesized features.
[0232] The third sub-module is configured to perform parameter optimization on the first generator and the first discriminator based on the plurality of synthesized features.
[0233] The fourth sub-module is configured to perform parameter optimization on the second discriminator based on the plurality of synthesized features.
[0234] The fifth sub-module is configured to input the multi-domain training samples into the first and second generators after optimization, and obtain second liveness-related features and second domain-related features of each training sample.
[0235] The sixth sub-module is configured to calculate a total loss of the generator and the feature aggregation network according to the second liveness-related features and the second domain-related features.
[0236] The seventh sub-module is configured to optimize the parameters of the first generator, the second generator and the feature aggregation network according to the total loss by using a stochastic gradient descent method, and generate a face liveness detection model obtained after this iteration training.
[0237] Optionally, the third sub-module is specifically configured to:
[0238] determine an intra-domain distribution loss, an inter-domain distribution loss and a semi-error rate loss of the model based on the plurality of synthesized features.
[0239] The sum of the intra-domain distribution loss, the inter-domain distribution loss, and a semi-error rate loss of the model is determined as a first loss.
[0240] The first generator and the first discriminator parameters are optimized according to the first loss by using a stochastic gradient descent method.
[0241] Optionally, the fourth submodule is specifically configured to:
[0242] The second discriminator is input with the plurality of the synthetic features, and the second discriminator is parameter-optimized based on a calculated second loss.
[0243] Optionally, the fourth submodule is specifically configured to:
[0244] An inter-discriminator orthogonal loss, a classification loss of the second discriminator, and a semi-error rate loss are calculated according to the second living body-related feature and the second domain-related feature.
[0245] The sum of the inter-discriminator orthogonal loss, the classification loss of the second discriminator, and the semi-error rate loss is determined as a total loss of the generator and the feature aggregation network.
[0246] Optionally, the feature aggregation network comprises an input layer, a global average pooling layer, a multi-layer perception, an AdaIN layer I, an AdaIN layer II, a ReLu activation layer, a first convolutional layer, and a second convolutional layer.
[0247] Optionally, the second submodule is specifically configured to:
[0248] The first living body-related feature is input into the global average pooling layer for processing and then input into the multi-layer perception to generate affine parameters.
[0249] The first domain-related feature is input into the first convolutional layer, and the output of the first convolutional layer and the affine parameters are input into the AdaIN layer I, and then input into the second convolutional layer via the ReLu activation layer.
[0250] The output of the second convolutional layer and the affine parameters are input into the AdaIN layer II to generate a synthetic feature residual.
[0251] The synthetic feature residual and the first domain-related feature are added to obtain a synthetic feature.
[0252] Optionally, the device further comprises:
[0253] The prediction module is configured to input the to-be-identified face image into the first generator of the face liveness detection model to obtain liveness-related features after the screening module screens the target face liveness detection model from the plurality of face liveness detection models based on the test result.
[0254] The liveness-related features are input into the first discriminator to obtain a face liveness detection result, where the face liveness detection result is used to indicate whether the to-be-identified face image is a real face image.
[0255] The face liveness detection model generation apparatus provided in the embodiments of the present application divides the training samples into domains to obtain multi-domain training samples; iteratively trains the first adversarial network, the second adversarial network, and the feature aggregation network based on the multi-domain training samples to obtain the face liveness detection model after each iteration; tests the prediction accuracy of each face liveness detection model using face images in an unknown domain; and screens a target face liveness detection model from the plurality of face liveness detection models based on the test result. In the embodiments of the present application, the network model is trained using the designed feature aggregation network and self-adaptive normalization layer through domain adversarial learning, which effectively avoids the influence of face images under different illuminations and scenes, and the trained face liveness detection model has a high recognition result accuracy and strong generalization.
[0256] In the embodiments of the present application Figure 8 The face liveness detection model generation apparatus shown in the embodiments of the present application can be an apparatus, or a component, an integrated circuit, or a chip in a three-dimensional scanner. The apparatus shown in the embodiments of the present application can be an apparatus having an operating system. Figure 8 The apparatus shown in the embodiments of the present application can be an apparatus having an operating system.
[0257] The face liveness detection model generation apparatus provided in the embodiments of the present application Figure 8 The face liveness detection model generation apparatus shown in the embodiments of the present application can implement each process of the method embodiments, and thus repeated descriptions are omitted here. Figure 1 The face liveness detection model generation apparatus shown in the embodiments of the present application can implement each process of the method embodiments, and thus repeated descriptions are omitted here.
[0258] Optionally, the embodiments of the present application further provide an electronic device including a processor, a memory, a program or instructions stored on the memory and executable on the processor, which, when executed by the processor, implements each process of the face liveness detection model generation method embodiments and achieves the same technical effects. Repeated descriptions are omitted here. It should be noted that the electronic device in the embodiments of the present application includes the server described above.
[0259] The embodiment of the present application further provides a readable storage medium, which stores programs or instructions, and the programs or instructions are executed by a processor to realize each process of the face living body detection model generation method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein.
[0260] The processor is the processor in the electronic device in the above embodiments. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, etc.
[0261] The embodiment of the present application further provides a chip, which includes a processor and a communication interface. The communication interface is coupled with the processor. The processor is used to run programs or instructions to realize each process of the object surface defect method embodiment and achieve the same technical effects. To avoid repetition, details are not described herein.
[0262] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0263] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0264] The above is the preferred embodiment of the present application. It should be noted that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.
Claims
1. A method for generating a face liveness detection model, characterized in that, include: The training samples are divided into domains to obtain multi-domain training samples; Based on the multi-domain training samples, the pre-constructed first adversarial network, second adversarial network, and feature aggregation network are trained iteratively multiple times to obtain a face liveness detection model after each iteration of training; wherein, the first adversarial network includes a first generator and a first discriminator, and the second adversarial network includes a second generator and a second discriminator. The prediction accuracy of each face liveness detection model is tested using face images from unknown domains, and the target face liveness detection model is selected from the multiple face liveness detection models based on the test results. The process of performing a single training iteration on the pre-constructed first adversarial network, second adversarial network, and feature aggregation network based on the multi-domain training samples includes: The multi-domain training samples are respectively input into the first generator and the second generator to obtain the first liveness-related features and the first domain-related features of each training sample; Through the feature aggregation network, the first liveness-related features and the first domain-related features from different domains are combined in pairs to obtain multiple composite features; Based on multiple synthetic features, the parameters of the first generator and the first discriminator are optimized. Based on multiple synthesized features, the parameters of the second discriminator are optimized. The multi-domain training samples are input into the optimized first and second generators to obtain the second liveness-related features and the second domain-related features of each training sample. The total loss of the generator and the feature aggregation network is calculated based on the second liveness-related features and the second domain-related features; The stochastic gradient descent method is used to optimize the parameters of the first generator, the second generator, and the feature aggregation network based on the total loss, thereby generating the face liveness detection model trained in this iteration.
2. The method according to claim 1, characterized in that, The step of optimizing the parameters of the first generator and the first discriminator based on multiple synthesized features includes: Based on the multiple synthetic features, the intra-domain distribution loss, inter-domain distribution loss, and model half-error rate loss are determined. The sum of the intra-domain distribution loss, inter-domain distribution loss, and the model's half-error rate loss is determined as the first loss; The parameters of the first generator and the first discriminator are optimized using the stochastic gradient descent method based on the first loss.
3. The method according to claim 1, characterized in that, The step of optimizing the parameters of the second discriminator based on multiple synthesized features includes: The plurality of synthesized features are input into the second discriminator, and the parameters of the second discriminator are optimized based on the calculated second loss.
4. The method according to claim 1, characterized in that, The steps for calculating the total loss of the generator and the feature aggregation network based on the second liveness correlation feature and the second domain correlation feature include: Based on the second liveness correlation feature and the second domain correlation feature, calculate the inter-discriminator orthogonality loss, the classification loss of the second discriminator, and the half-error rate loss; The sum of the orthogonal loss between discriminators, the classification loss of the second discriminator, and the half-error rate loss is determined as the total loss of the generator and the feature aggregation network.
5. The method according to claim 1, characterized in that, The feature aggregation network includes an input layer, a global average pooling layer, a multilayer perceptron, an AdaIN layer I, an AdaIN layer II, a ReLU activation layer, a first convolutional layer, and a second convolutional layer.
6. The method according to claim 5, characterized in that, The step of synthesizing multiple synthesized features by pairwise combining first liveness-related features from different domains and first domain-related features through the feature aggregation network includes: The first liveness-related features are input into the global average pooling layer for processing and then input into the multilayer perceptron to generate affine parameters. The first domain-related features are input into the first convolutional layer, and the output of the first convolutional layer and the affine parameters are input into the AdaIN layer I, and then input into the second convolutional layer after passing through the ReLU activation layer. The output of the second convolutional layer, along with the affine parameters, is input into the AdaIN layer II to generate synthetic feature residuals; The synthetic feature residual is added to the first domain-related feature to obtain the synthetic feature.
7. The method according to claim 1, characterized in that, After the step of selecting the target face liveness detection model from the plurality of face liveness detection models based on the test results, the method further includes: The face image to be identified is input into the first generator of the face liveness detection model to obtain liveness-related features; The liveness-related features are input into the first discriminator to obtain the face liveness detection result, wherein the face liveness detection result is used to indicate whether the face image to be identified is a real face image.
8. A face liveness detection model generation device, characterized in that, include: The partitioning module is used to partition the training samples into domains to obtain multi-domain training samples. The training module is used to perform multiple iterations of training on the pre-constructed first adversarial network, second adversarial network, and feature aggregation network based on the multi-domain training samples, to obtain a face liveness detection model after each iteration of training; wherein, the first adversarial network includes a first generator and a first discriminator, and the second adversarial network includes a second generator and a second discriminator. The filtering module is used to test the prediction accuracy of each face liveness detection model using face images from unknown domains, and to filter out the target face liveness detection model from the multiple face liveness detection models based on the test results. The training module includes: The first submodule is used to input the multi-domain training samples into the first generator and the second generator respectively to obtain the first liveness-related features and the first domain-related features of each training sample; The second submodule is used to synthesize the first liveness-related features and the first domain-related features in pairs through the feature aggregation network to obtain multiple synthesized features; The third submodule is used to optimize the parameters of the first generator and the first discriminator based on multiple of the synthesized features; The fourth submodule is used to optimize the parameters of the second discriminator based on multiple of the synthesized features; The fifth submodule is used to input the multi-domain training samples into the optimized first generator and second generator to obtain the second liveness-related features and the second domain-related features of each training sample. The sixth submodule is used to calculate the total loss of the generator and the feature aggregation network based on the second liveness-related features and the second domain-related features; The seventh submodule is used to optimize the parameters of the first generator, the second generator, and the feature aggregation network based on the total loss using the stochastic gradient descent method, to generate the face liveness detection model trained in this iteration.
9. The apparatus according to claim 8, characterized in that, The third submodule is specifically used for: Based on the multiple synthetic features, the intra-domain distribution loss, inter-domain distribution loss, and model half-error rate loss are determined. The sum of the intra-domain distribution loss, inter-domain distribution loss, and the model's half-error rate loss is determined as the first loss; The parameters of the first generator and the first discriminator are optimized using the stochastic gradient descent method based on the first loss.
10. An electronic device, comprising a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of a face liveness detection model generation method as described in any one of claims 1-7.
Citation Information
Patent Citations
Face in-vivo detection method based on conditional adversarial domain generalization and network model architecture
CN114078276A
Living body detection method and apparatus, electronic device, and storage medium
WO2022126914A1