A method and device for detecting living body

By adding noise data to the sample set and using negative samples generated by the adversarial network, the living body detection model is trained for multiple rounds, combined with feature extraction of different image dimensions, to solve the problem of insufficient model generalization ability and low robustness in the existing technology. problem, achieving a more efficient classification of living bodies and prostheses.

CN112818774BActive Publication Date: 2024-08-23CHINA UNIONPAY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110073901.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-20
Publication Date
2024-08-23
Estimated Expiration
2041-01-20

AI Technical Summary

Technical Problem

Existing living body detection methods have low model generalization capabilities and insufficient robustness, making it difficult to accurately distinguish living bodies and prosthetics in practical applications, and are vulnerable to adversarial sample attacks.

Method used

By adding noise data to the samples in the sample set for training, combined with the negative samples generated by the adversarial network, multiple rounds of training and feature extraction of different image dimensions are used to improve the robustness and generalization ability of the model and prevent malicious attacks.

Benefits of technology

It significantly improves the generalization ability and robustness of the living body detection model, enhances the accurate classification performance of living bodies and prosthetics, and effectively prevents adversarial sample attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112818774B
    Figure CN112818774B
Patent Text Reader

Abstract

The present application discloses a liveness detection method and device, which receives a face image to be detected; inputs the face image to be detected into a liveness detection network model to obtain a liveness detection result; the liveness detection network model is obtained by training after adding noise data to each sample in a sample set, and the sample set includes negative samples generated by an adversarial network. The liveness detection network model in this method is obtained by training after adding noise data to each sample data in a sample set, thereby improving the robustness of the liveness detection network model; and the sample set used to train the liveness detection network model also includes negative samples generated by an adversarial network, so that the sample set for training the liveness detection network model can be enriched, so that the trained liveness detection network model can have the characteristics of high generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a method and device for detecting a living body. Background Art

[0002] In recent years, with the widespread application of face recognition technology, the recognition accuracy has been greatly improved. However, with the promotion of applications, it is becoming increasingly important to more quickly and accurately determine whether the target to be recognized is a real face rather than an attacking behavior.

[0003] There are currently three main behaviors that are often used to attack facial recognition applications: printed color pictures, recorded video playback, and disguised by wearing a face mask.

[0004] Existing liveness detection methods are mainly divided into two types: interactive and silent. In the interactive method, the user is required to make movements such as shaking his head, opening his mouth, blinking his eyes, or reading certain voices according to instructions during the interaction. In the silent method, it can be divided into video streaming method or single picture method, including: the video streaming method can detect liveness by comparing the user's micro-expressions at different times in the video stream, or by comparing the changes in the user's face according to the light of different color sequences emitted by the screen; the single picture method mostly collects live and prosthetic pictures, conducts machine learning (including deep network learning) model training, and finally obtains a classification model for detection.

[0005] The existing interactive liveness detection method requires user cooperation during the entire process, resulting in a poor user experience and a long detection time. The video stream silent liveness detection method does not require user cooperation during the detection process, but due to the large amount of video stream data, it is not suitable for remote transmission through the network, and the detection time is also long. In contrast, the single image silent liveness detection method does not require user cooperation or the transmission of a large amount of video stream data, so the entire detection process is convenient and efficient.

[0006] However, the single-image silent liveness detection method has difficulty in collecting negative sample images (i.e., prosthetic images), and the trained model cannot cover various situations in actual use well, resulting in poor model generalization ability. In addition, since the final model is a model for classifying live and prosthetic objects, there is a possibility of being attacked by adversarial samples, resulting in poor robustness of the detection model.

[0007] In summary, there is an urgent need for a model with strong generalization ability and high robustness for accurately classifying living objects and prostheses. Summary of the invention

[0008] The present application provides a liveness detection method and device, which are used to solve the technical problems of low generalization ability and low robustness of liveness detection network models in the background technology.

[0009] In a first aspect, an embodiment of the present application provides a liveness detection method, the method comprising: receiving a face image to be detected; inputting the face image to be detected into a liveness detection network model to obtain a liveness detection result; the liveness detection network model is obtained by training after adding noise data to each sample in a sample set, and the sample set includes negative samples generated by an adversarial network.

[0010] Based on this solution, when detecting a face image to be detected, a liveness detection network model can be used for detection, and the liveness detection network model gives a detection result. The liveness detection network model in this method is obtained by training by adding noise data to each sample data in the sample set, thereby improving the robustness of the liveness detection network model; and the sample set used to train the liveness detection network model also includes negative samples generated by an adversarial network, so that the sample set for training the liveness detection network model can be enriched, so that the trained liveness detection network model can have the characteristics of high generalization ability.

[0011] In a possible implementation method, the liveness detection network model is obtained by training after adding noise data to each sample in a sample set, including: obtaining a preset number of samples required for each round of training from the sample set; determining a noise interval based on a gradient value of a previous round of training; selecting first noise data from the noise interval; determining second noise data to be added to the sample based on the gradient value and the first noise data; after any noise data in the noise interval is added to the sample, it does not affect the human eye's recognition of the sample; and training the sample to which the second noise data is added as a correction sample, thereby obtaining the liveness detection network model.

[0012] Based on this scheme, when training the liveness detection network model, multiple rounds of training are adopted, and the number of samples in each round of training is a fixed value; and after each round of training, the noise interval of the noise data used for the next round of training can be determined according to the gradient value of this round of training; further, after taking out the first noise data from the determined noise interval, the second noise data added to the sample of the next round of training is determined in combination with the gradient value, and finally the sample to which the second noise data has been added is used as a new round of training data for the liveness detection network model and trained, so as to obtain a liveness detection network model that meets the requirements. In this method, after any noise data in the noise interval is added to the sample, it will not affect the human eye's recognition of the sample, so this method can effectively prevent malicious attackers from adding some invisible noises to the face picture to be detected to attack the liveness detection network model.

[0013] In a possible implementation method, determining the noise interval according to the gradient value of the previous round of training includes: if it is the first round of training or the gradient value is zero, determining the noise interval to be [-b, a], -b+a≈0; if the gradient value is not zero, determining the noise interval to be [-b, 0] or [0, a]; determining the second noise data to be added to the sample according to the gradient value and the first noise data includes: if the gradient value is zero, adding the first noise data to the sample; if the gradient value is non-zero, correcting the first noise data according to the gradient value, and adding the corrected first noise data to the sample.

[0014] Based on this scheme, in the process of training the liveness detection network model, after each round of training, the gradient value of this round of training can be obtained; further, the noise interval of the noise data used for the next round of training can be determined according to the gradient value. If the gradient value is different, the selected noise interval will also be different, so that the requirements for training the liveness detection network model can be better met, so that the obtained liveness detection network model can have a better classification effect; in addition, when adding noise data to the samples of the new round of training, it can be determined according to the gradient value of the previous round of training and the first noise data within the noise interval. For example, when the gradient value of the previous round is zero, the first noise data is directly added to the samples of the new round of training as the second noise data. For example, when the gradient value of the previous round is non-zero, the first noise data can be corrected by using the gradient value, and the corrected first noise data is added to the samples of the new round of training as the second noise data. This method determines the noise data that can be added to the samples of the new round of training by considering the factors of the gradient value of the previous round of training, and can also better meet the requirements for training the liveness detection network model, so that the obtained liveness detection network model can have a better classification effect.

[0015] In one possible implementation method, the sample to which the second noise data is added is used as a correction sample for training to obtain the liveness detection network model, including: determining a control sample of the correction sample under different image dimensions; and training the correction sample and the control sample to obtain the liveness detection network model.

[0016] Based on this scheme, since the single silent liveness detection method in the background technology determines the detection result by classifying a single color image; however, due to the differences in the ability of the live color image and the prosthetic color image to respond to light, as well as the differences in the local texture of the live color image and the prosthetic color image, the background technology only uses a single color image as a classification for live and prosthetic objects, which will not be accurate enough; for this reason, in this method of the present application, for the correction sample with added noise, its control sample in different image dimensions is determined, and then training is performed based on the correction sample and the control sample, so that the trained liveness detection network model can have better classification performance for distinguishing live and prosthetic objects.

[0017] In a possible implementation method, the different image dimensions include at least one of the following: an HSV color gamut map, an LBP feature map, and a normalized feature histogram.

[0018] Based on this scheme, the difference between the ability of living and prosthetic bodies to respond to light can be well described through the HSV color gamut map; and the difference between living and prosthetic bodies in local texture can be well described through the LBP feature map and the normalized feature histogram. By determining a control sample of a sample (the attribute of the sample is the color image property) in multiple image dimensions and training based on the sample and the control sample, the trained liveness detection network model can have better classification performance for distinguishing between live and prosthetic bodies.

[0019] In one possible implementation method, the sample set includes negative samples generated by an adversarial network, including: generating a first picture by generating a network model using selected random noise; determining a first loss value of the discriminative network model under the first picture based on a classification result of the discriminative network model for the first picture; determining a second loss value of the discriminative network model under the real negative sample based on a classification result of the discriminative network model for the real negative sample; adjusting the discriminative network model based on the first loss value and the second loss value; adjusting the generating network model based on the first loss value until the discriminative network model meets the set requirements; generating a simulated negative sample through the generating network model corresponding to the discriminative network model when the discriminative network model meets the set requirements and using it as a negative sample in the sample set.

[0020] Based on this scheme, since the liveness detection network model corresponding to the single-image silent liveness detection method in the background technology uses a small number of negative samples in the training process, and the reason for the small number of negative samples is that the negative samples that can be directly used for training are difficult to collect and the collection cost is high, the generalization ability of the liveness detection network model of the background technology is relatively low. For this reason, in this method of the present application, negative samples are constructed by adopting an adversarial network, wherein the constructed negative samples (generated by the generative network model in the adversarial network) can "cheat" the discriminative network model in the adversarial network, thereby adding the constructed negative samples to the original data set to form a sample set that can be used to train the liveness detection network model, so as to achieve the purpose of data enhancement; finally, by using the sample set obtained in this way to train the liveness detection network model, the liveness detection network model that is finally obtained and meets the requirements can have the characteristics of strong generalization ability.

[0021] In one possible implementation method, the generation network model corresponding to the discriminant network model when the discriminant network model meets the set requirements generates simulated negative samples and uses them as negative samples in the sample set, including: the discriminant network model meets the set requirements means that the loss values ​​of the discriminant network model in multiple iteration cycles all meet the set values; and the simulated negative samples are generated by the generation network model in the multiple iteration cycles.

[0022] Based on this solution, when using an adversarial network to increase negative samples in the original data set, if it is required to supplement a large number of negative samples generated by a generative network model, in order to avoid the problem of duplication of generated negative sample images, a generative network model with different iteration cycles can be used to generate multiple different images for supplementation.

[0023] In a second aspect, an embodiment of the present application provides a liveness detection device, which includes: a receiving unit for receiving a face image to be detected; a processing unit for inputting the face image to be detected into a liveness detection network model to obtain a liveness detection result; the liveness detection network model is obtained by training after adding noise data to each sample in a sample set, and the sample set includes negative samples generated by an adversarial network.

[0024] Based on this solution, when detecting a face image to be detected, a liveness detection network model can be used for detection, and the liveness detection network model gives a detection result. The liveness detection network model in this method is obtained by training by adding noise data to each sample data in the sample set, thereby improving the robustness of the liveness detection network model; and the sample set used to train the liveness detection network model also includes negative samples generated by an adversarial network, so that the sample set for training the liveness detection network model can be enriched, so that the trained liveness detection network model can have the characteristics of high generalization ability.

[0025] In a possible implementation method, the device also includes a liveness detection network model determination unit; the liveness detection network model determination unit is used to: obtain a preset number of samples required for each round of training from the sample set; determine a noise interval based on a gradient value of a previous round of training; select first noise data from the noise interval; determine second noise data to be added to the sample based on the gradient value and the first noise data; after any noise data in the noise interval is added to the sample, it does not affect the human eye's recognition of the sample; and train the sample to which the second noise data is added as a correction sample, thereby obtaining the liveness detection network model.

[0026] Based on this scheme, when training the liveness detection network model, multiple rounds of training are adopted, and the number of samples in each round of training is a fixed value; and after each round of training, the noise interval of the noise data used for the next round of training can be determined according to the gradient value of this round of training; further, after taking out the first noise data from the determined noise interval, the second noise data added to the sample of the next round of training is determined in combination with the gradient value, and finally the sample to which the second noise data has been added is used as a new round of training data for the liveness detection network model and trained, so as to obtain a liveness detection network model that meets the requirements. In this method, after any noise data in the noise interval is added to the sample, it will not affect the human eye's recognition of the sample, so this method can effectively prevent malicious attackers from adding some invisible noises to the face picture to be detected to attack the liveness detection network model.

[0027] In one possible implementation method, the liveness detection network model determination unit is specifically used to: if it is the first round of training or the gradient value is zero, determine the noise interval to be [-b, a], -b+a≈0; if the gradient value is not zero, determine the noise interval to be [-b, 0] or [0, a]; if the gradient value is zero, add the first noise data to the sample; if the gradient value is non-zero, correct the first noise data according to the gradient value, and add the corrected first noise data to the sample.

[0028] Based on this scheme, in the process of training the liveness detection network model, after each round of training, the gradient value of this round of training can be obtained; further, the noise interval of the noise data used for the next round of training can be determined according to the gradient value. If the gradient value is different, the selected noise interval will also be different, so that the requirements for training the liveness detection network model can be better met, so that the obtained liveness detection network model can have a better classification effect; in addition, when adding noise data to the samples of the new round of training, it can be determined according to the gradient value of the previous round of training and the first noise data within the noise interval. For example, when the gradient value of the previous round is zero, the first noise data is directly added to the samples of the new round of training as the second noise data. For example, when the gradient value of the previous round is non-zero, the first noise data can be corrected by using the gradient value, and the corrected first noise data is added to the samples of the new round of training as the second noise data. This method determines the noise data that can be added to the samples of the new round of training by considering the factors of the gradient value of the previous round of training, and can also better meet the requirements for training the liveness detection network model, so that the obtained liveness detection network model can have a better classification effect.

[0029] In a possible implementation method, the liveness detection network model determination unit is specifically used to: determine a control sample of the correction sample under different image dimensions; and train the correction sample and the control sample to obtain the liveness detection network model.

[0030] Based on this scheme, since the single silent liveness detection method in the background technology determines the detection result by classifying a single color image; however, due to the differences in the ability of the live color image and the prosthetic color image to respond to light, as well as the differences in the local texture of the live color image and the prosthetic color image, the background technology only uses a single color image as a classification for live and prosthetic objects, which will not be accurate enough; for this reason, in this method of the present application, for the correction sample with added noise, its control sample in different image dimensions is determined, and then training is performed based on the correction sample and the control sample, so that the trained liveness detection network model can have better classification performance for distinguishing live and prosthetic objects.

[0031] In a possible implementation method, the different image dimensions include at least one of the following: an HSV color gamut map, an LBP feature map, and a normalized feature histogram.

[0032] Based on this scheme, the difference between the ability of living and prosthetic bodies to respond to light can be well described through the HSV color gamut map; and the difference between living and prosthetic bodies in local texture can be well described through the LBP feature map and the normalized feature histogram. By determining a control sample of a sample (the attribute of the sample is the color image property) in multiple image dimensions and training based on the sample and the control sample, the trained liveness detection network model can have better classification performance for distinguishing between live and prosthetic bodies.

[0033] In one possible implementation method, the device also includes a negative sample generation unit; the negative sample generation unit is used to: generate a first image through a generative network model using selected random noise; determine a first loss value of the discriminative network model under the first image based on the classification result of the discriminative network model for the first image; determine a second loss value of the discriminative network model under the real negative sample based on the classification result of the discriminative network model for the real negative sample; adjust the discriminative network model based on the first loss value and the second loss value; adjust the generative network model based on the first loss value until the discriminative network model meets the set requirements; generate a simulated negative sample through the corresponding generative network model when the discriminative network model meets the set requirements and use it as a negative sample in the sample set.

[0034] Based on this scheme, since the liveness detection network model corresponding to the single-image silent liveness detection method in the background technology uses a small number of negative samples in the training process, and the reason for the small number of negative samples is that the negative samples that can be directly used for training are difficult to collect and the collection cost is high, the generalization ability of the liveness detection network model of the background technology is relatively low. For this reason, in this method of the present application, negative samples are constructed by adopting an adversarial network, wherein the constructed negative samples (generated by the generative network model in the adversarial network) can "cheat" the discriminative network model in the adversarial network, thereby adding the constructed negative samples to the original data set to form a sample set that can be used to train the liveness detection network model, so as to achieve the purpose of data enhancement; finally, by using the sample set obtained in this way to train the liveness detection network model, the liveness detection network model that is finally obtained and meets the requirements can have the characteristics of strong generalization ability.

[0035] In one possible implementation method, the negative sample generation unit is specifically used to: the discriminant network model meets the set requirements means that the loss values ​​of the discriminant network model in multiple iteration cycles all meet the set values; and the simulated negative samples are generated by the generation network model in the multiple iteration cycles.

[0036] Based on this solution, when using an adversarial network to increase negative samples in the original data set, if it is required to supplement a large number of negative samples generated by a generative network model, in order to avoid the problem of duplication of generated negative sample images, a generative network model with different iteration cycles can be used to generate multiple different images for supplementation.

[0037] In a third aspect, an embodiment of the present application provides a computing device, including:

[0038] Memory for storing computer programs;

[0039] The processor is used to call the computer program stored in the memory and execute any method as described in the first aspect according to the obtained program.

[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute any method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0042] Figure 1 A method for detecting a living body provided in an embodiment of the present application;

[0043] Figure 2 A living body detection device provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0046] At present, the single-image silent liveness detection method in the silent liveness detection method is a simpler and more convenient liveness detection method compared to the interactive liveness detection method and the video stream silent liveness detection method in the silent liveness detection method. However, the liveness detection network model used in this method has the disadvantage of difficulty in collecting negative sample images required for training during the construction process. Therefore, the number of negative sample images used for model training is not large enough, which leads to the disadvantage of low generalization ability of the liveness detection network model corresponding to this method; in addition, the liveness detection network model used in this method has the possibility of being attacked by adversarial samples, which will lead to the disadvantage of poor robustness of the liveness detection network model corresponding to this method.

[0047] Based on the above technical problems, the present application embodiment provides a living body detection method, such as Figure 1 As shown, the method comprises the following steps:

[0048] Step 101, receiving a face image to be detected.

[0049] Step 102, input the face image to be detected into a liveness detection network model to obtain a liveness detection result; the liveness detection network model is obtained by training after adding noise data to each sample in a sample set, and the sample set includes negative samples generated by an adversarial network.

[0050] Based on this solution, when detecting a face image to be detected, a liveness detection network model can be used for detection, and the liveness detection network model gives a detection result. The liveness detection network model in this method is obtained by training by adding noise data to each sample data in the sample set, thereby improving the robustness of the liveness detection network model; and the sample set used to train the liveness detection network model also includes negative samples generated by an adversarial network, so that the sample set for training the liveness detection network model can be enriched, so that the trained liveness detection network model can have the characteristics of high generalization ability.

[0051] The following will explain the above steps in detail with examples.

[0052] In one implementation of the above step 102, the sample set includes negative samples generated by an adversarial network, including: generating a first picture by passing the selected random noise through a generative network model; determining a first loss value of the discriminative network model under the first picture based on the classification result of the discriminative network model for the first picture; determining a second loss value of the discriminative network model under the real negative sample based on the classification result of the discriminative network model for the real negative sample; adjusting the discriminative network model based on the first loss value and the second loss value; adjusting the generative network model based on the first loss value until the discriminative network model meets the set requirements; generating a simulated negative sample through the corresponding generative network model when the discriminative network model meets the set requirements and using it as a negative sample in the sample set.

[0053] For example, the adversarial network in the embodiment of the present application can be implemented based on a deep convolutional network model and includes two parts: a generative network model and a discriminative network model. The two network models compete with each other, and the generative network model learns the feature information of the negative sample images (i.e., prostheses) in the original data set, and finally generates images that are similar to the negative sample images in the original data set and cannot be correctly classified by the discriminative network model, and adds these negative sample images generated by the generative network model to the original data set to achieve sample enhancement.

[0054] Specifically, the generative network model can adopt a 7-layer network architecture, and is composed of modules such as transposed convolution layer (upsampling), BatchNormalization, and LeakRuLU.

[0055] The generative network model receives a random noise, whose specific data can be a feature vector of length 300 extracted from the average distributed noise, and generates a 3*3*1024 tensor from the noise vector through a fully connected layer; then passes through 5 layers of transposed convolutional layers (each layer is followed by a BatchNormalization layer and a LeakReLU activation function, which can accelerate model training and avoid the appearance of dead neurons), and generates a 96*96*16 tensor; the last layer is a transposed convolutional layer, which generates a color image of a set size and channel (W*H*C, W=192, H=192, C=3). The picture generated by the generative network model in this embodiment of the application is referred to as a generated picture.

[0056] The discriminant network model can also adopt a 7-layer network architecture, consisting of modules such as convolutional layer (downsampling), Dropout, and LeakRuLU.

[0057] First, the negative sample images in the original data set are extracted. In the embodiment of the present application, the extracted negative sample images in the original data set are referred to as collected negative sample images. The collected negative sample images are then preprocessed and converted into the format specified by the discriminant network model (W*H*C, W=192, H=192, C=3).

[0058] Then, the discriminant network model performs classification prediction on the collected negative sample images and the generated images. The collected negative sample images are true, and the generated images are false. The steps of the discriminant network model performing classification prediction on the collected negative sample images and the generated images may include:

[0059] The discriminant network model performs convolution (downsampling) operations on the collected negative sample images (each layer is followed by the BatchNormalization layer and the LeakReLU activation function, which can accelerate model training and avoid the appearance of dead neurons). A total of 6 convolution operations are performed to generate a 3*3*1024 tensor. Finally, the Flatten and fully connected layers give the classification results, and the cross entropy determination unit is called to calculate the cross entropy loss of the discriminant network model under the collected negative sample images.

[0060] The discriminant network model performs convolution (downsampling) operations on the generated image (each layer is followed by the BatchNormalization layer and the LeakReLU activation function, which can accelerate model training and avoid the appearance of dead neurons). A total of 6 convolution operations are performed to generate a 3*3*1024 tensor. Finally, the Flatten and fully connected layers give the classification results, and the cross entropy determination unit is called to calculate the cross entropy loss of the discriminant network model under the generated image.

[0061] Finally, the sum of the above two cross entropy losses is taken as the total loss of the discriminant network model, and the parameters of the discriminant network model are adjusted according to the total loss.

[0062] At the same time, according to the classification result of the generated image by the discriminant network model, the cross entropy determination unit is called to calculate the cross entropy loss of the generated network model, and the parameters of the generated network model are adjusted according to the cross entropy loss of the generated network model.

[0063] In this way, by continuously adjusting the parameters of the generative network model and the discriminative network model in each round, until in a certain round of training, the pictures generated by the generative network model can "cheat" the discriminative network model (for example, the loss value index of the discriminative network model is set to 0.7 in advance, then the meaning of the pictures generated by the generative network model in the embodiment of the present application can "cheat" the discriminative network model is: the total loss of the discriminative network model is close to 0.7), that is, the generated pictures have achieved an effect that can be mistaken for the real ones. At this time, the generative network model in this round of adversarial network can be used to generate negative sample pictures that can be added to the original data set, thereby achieving the purpose of data enhancement. In the embodiment of the present application, the data set formed by adding negative sample pictures generated by the generative network model to the original data set is called an enhanced data set.

[0064] In certain implementations of the present application, the generation network model corresponding to the discriminant network model that meets the set requirements is used to generate simulated negative samples and use them as negative samples in the sample set, including: the discriminant network model meeting the set requirements means that the loss values ​​of the discriminant network model in multiple iteration cycles all meet the set values; and the simulated negative samples are generated by the generation network model in the multiple iteration cycles.

[0065] In the above example, if a large number of negative sample images need to be supplemented in the original data set, in order to avoid duplication of generated images, multiple different images can be generated by using generative network models with different iteration cycles for supplementation. It is worth noting that the generative network models with different iteration cycles here refer to: the loss value of the discriminative network model adapted to the generative network model of any iteration cycle in the different iteration cycles meets the set value, which is 0.7 set in the previous text.

[0066] In one implementation of the above step 102, the liveness detection network model is obtained by training after adding noise data to each sample in the sample set, including: obtaining a preset number of samples required for each round of training from the sample set; determining a noise interval based on a gradient value of a previous round of training; selecting first noise data from the noise interval; determining second noise data to be added to the sample based on the gradient value and the first noise data; after any noise data in the noise interval is added to the sample, it does not affect the human eye's recognition of the sample; and training the sample to which the second noise data is added as a correction sample, thereby obtaining the liveness detection network model.

[0067] In certain implementations of the present application, determining the noise interval based on the gradient value of the previous round of training includes: if it is the first round of training or the gradient value is zero, determining the noise interval to be [-b, a], -b+a≈0; if the gradient value is not zero, determining the noise interval to be [-b, 0] or [0, a]; determining the second noise data to be added to the sample based on the gradient value and the first noise data includes: if the gradient value is zero, adding the first noise data to the sample; if the gradient value is non-zero, correcting the first noise data according to the gradient value, and adding the corrected first noise data to the sample.

[0068] For example, the liveness detection network model of the embodiment of the present application is based on the DenseNet classification network model. Among them, since the DenseNet classification network model is a deep convolutional neural classification network model based on gradient descent, it uses a back propagation and gradient descent algorithm to converge the loss to a minimum. Therefore, if the DenseNet classification network model is used to classify the input image to be detected, if the malicious attacker adds certain interference information (along the gradient direction) to the input image to be detected, the model loss can be increased, so that the DenseNet classification network model produces an erroneous recognition result for the input image to be detected. In other words, for the input image to be detected that is not a real face and has certain interference information (along the gradient direction), the currently used DenseNet classification network model will largely identify it as a photo of a real face, which shows that the liveness detection network model in this way has been attacked by malicious attackers.

[0069] In order to protect the liveness detection network model, the DenseNet classification network model, from attacks initiated by malicious elements, in the embodiment of the present application, in the process of training the DenseNet classification network model, interference information, i.e., noise data, can be actively added, so that the trained DenseNet classification network model can have an anti-attack effect, i.e., strong robustness. The following is a specific example to illustrate how to train a liveness detection network model with an anti-attack effect:

[0070] The first step is to extract sample data of batch training size (such as 64) from the enhanced data set samples, and convert the image size and format (such as W*H*C, where W=112, H=112, C=3) according to the training needs of the network model;

[0071] The second step is to extract batch-sized scalar noise data from the average distributed random noise; wherein, if there is no gradient sign at the beginning of training (the gradient sign can be considered to be 0), or the gradient sign calculated during the training process is 0, then the scalar noise value range is determined to be [-b, a], and -b+a≈0; when the value of the gradient sign is a non-zero value, the scalar noise value range is determined to be [-b, 0] or [0, a]; for example, in the embodiment of the present application, the value of -b can be -0.2, and the value of a can be 0.2;

[0072] In the third step, the gradient sign obtained from the previous batch of training is multiplied by the noise data selected in the second step, and the result is superimposed on the training sample data in the first step; if the gradient sign is 0, the noise data in the second step is directly superimposed on the training sample data in the first step;

[0073] Step 4: Data sample preprocessing and training module;

[0074] Step 5: Calculate the cross entropy loss of model training;

[0075] Step 6: Calculate the batch gradient descent value for model training;

[0076] Step 7: Calculate the gradient sign;

[0077] The above seven steps are repeated in a cycle during the training process to train a liveness detection grid model that can prevent adversarial sample attacks.

[0078] Regarding the overall steps of the above-mentioned training of a liveness detection network model to prevent adversarial sample attacks, the embodiment of the present application can be illustrated with another more specific example.

[0079] Assume that the training of the liveness detection network model to prevent adversarial sample attacks has just begun, that is, the first round of training has started, so:

[0080] Step 1: Extract 64 images from the enhanced dataset and set each image to a 112*112*3 format.

[0081] Step 2: Obtain 64 noise data from the average distribution random noise. Since the training of the liveness detection network model has just begun, the value range of the 64 noise data is [-0.2, 0.2];

[0082] Step 3: Since this round of training is the first round of training for the liveness detection network model, the gradient sign at this time can be considered to be 0. In this way, the 64 noise data in step 2 can be added to the 64 formatted pictures in step 1. In this process, noise data is randomly added to the 64 pictures.

[0083] Step 4: perform data preprocessing on the 64 images with added noise data;

[0084] Step 5: Calculate the cross entropy loss for this round of training;

[0085] Step 6: Calculate the batch gradient descent value for this round of training;

[0086] Step 7: Calculate the sign of the gradient for this round of training, and assume that the sign of the gradient obtained for this round of training is 0.1.

[0087] Then, the second round of training began:

[0088] Step 1: Extract 64 images from the enhanced dataset and set each image to a 112*112*3 format.

[0089] Step 2: Since the gradient sign obtained in the first round of training is 0.1, not 0, 64 noise data can be obtained from the average distribution random noise, and the value range of the 64 noise data is [0, 0.2];

[0090] Step 3: Since this round of training is the second round of training for the liveness detection network model, and the gradient sign at this time is 0.1, 0.1 can be multiplied by the 64 noise data in step 2 of this round of training, and 64 corrected noise data can be obtained; then these 64 corrected noise data can be added to the 64 formatted images in step 1 of this round of training;

[0091] Step 4: perform data preprocessing on the 64 images with the corrected noise data;

[0092] Step 5: Calculate the cross entropy loss for this round of training;

[0093] Step 6: Calculate the batch gradient descent value for this round of training;

[0094] Step 7: Calculate the sign of the gradient for this round of training and assume that the sign of the gradient obtained for this round of training is 0.

[0095] Then, the third round of training began:

[0096] Step 1: Extract 64 images from the enhanced dataset and set each image to a 112*112*3 format.

[0097] Step 2: Since the gradient sign obtained in the second round of training is 0, 64 noise data can be obtained from the average distribution random noise, and the value range of the 64 noise data is [-0.2, 0.2];

[0098] Step 3: Although this round of training is the third round of training for the liveness detection network model, the gradient sign is 0 at this time. So, just like the first round of training, the 64 noise data in step 2 of this round of training can be added to the 64 formatted images in step 1 of this round of training.

[0099] Step 4: perform data preprocessing on the 64 images with added noise data;

[0100] Step 5: Calculate the cross entropy loss for this round of training;

[0101] Step 6: Calculate the batch gradient descent value for this round of training;

[0102] Step 7: Calculate the sign of the gradient for this round of training, and assume that the sign of the gradient obtained for this round of training is 0.2.

[0103] In this way, in the subsequent fourth round of training, fifth round of training, ..., the training processes of the first round of training, second round of training, and third round of training mentioned above can all be referred to. During the training process, the value interval of the noise data can be selected according to the gradient sign obtained in the previous round of training, and it can be determined whether to correct the noise data that needs to be added to the training samples in the current round of training according to the gradient sign obtained in the previous round of training.

[0104] It should be noted that the samples in the batch training in the above example can adopt the strategy of replacing the augmented data set or not replacing the augmented data set, and this application does not make specific limitations; in addition to using the type of noise of average distribution random noise in the above example, other types of noise, such as Gaussian noise, can also be used, and this application does not make specific limitations; the gradient sign in the above example is the gradient value.

[0105] In certain implementations of the present application, the sample to which the second noise data is added is used as a correction sample for training to obtain the liveness detection network model, including: determining a control sample of the correction sample under different image dimensions; training the correction sample and the control sample to obtain the liveness detection network model.

[0106] In some implementations of the present application, the different image dimensions include at least one of the following: an HSV color gamut map, an LBP feature map, and a normalized feature histogram.

[0107] In the above example, when using an enhanced data set to train a liveness detection network model that prevents adversarial sample attacks, after converting the image format of the batch training samples and adding noise data to the converted images (the noise data may be corrected), the data preprocessing operation of extracting feature information can be continued on the converted images to which the noise data has been added. The reasons for performing the data preprocessing operation of extracting feature information can be analyzed as follows:

[0108] On the one hand, since the skin of the living image and the various materials of the prosthetic image have differences in reflection, absorption, refraction, etc. of light, HSV (Hue, Saturation, Value) color domain space information that better reflects color and lighting can be extracted from the image (referring to the image that has been added with noise data and has been converted in format); on the other hand, since the skin of the living image and the various materials of the prosthetic image also have subtle differences in texture level, the local texture feature information of the image (referring to the image that has been added with noise data and has been converted in format) can be extracted through the LBP (Local Binary Pattern) method, and a local texture feature information map can be generated; further, the generated local texture feature information map can be segmented into local areas, and the LBP feature histograms of the sub-areas formed after the segmentation are respectively counted, and then the feature histograms of each area are spliced ​​together and normalized.

[0109] Based on the above two reasons (light and texture), finally, the BGR information, HSV color space information, LBP feature information, and histogram information of the original image (referring to the image that has been added with noise data and converted into a format) can be merged into an 8-channel input data, so as to train the liveness detection network model that prevents adversarial sample attacks. The liveness detection network model trained in this way has the characteristics of high accuracy.

[0110] The following is a specific example to illustrate how to perform data preprocessing on a picture that has been added with noise data and has been converted to a new format (this picture is called the original picture):

[0111] The first step is to convert the original image in BGR format into a grayscale image with 256 gray levels and a bit depth of 8.

[0112] The second step is to extract LBP features from the grayscale image and generate an LBP feature information map with a size of 112*112;

[0113] The third step is to divide the LBP feature information map (112*112) into 7*7=49 sub-regions, each sub-region is 16*16 in size, and the histogram information of each sub-region is counted separately, the range is [0, 255], and the bin size is 256;

[0114] The fourth step is to convert the histogram data (256) of each sub-region into a 16*16 matrix, merge 49 matrices into a large histogram information matrix (112*112) according to the original segmentation position; and perform data normalization processing according to the Min-Max method;

[0115] Step 5: Convert the original image from BGR format to HSV color gamut, where the hue range is [0, 180], the saturation range is [0, 255], and the brightness range is [0, 255].

[0116] The sixth step is to superimpose the BGR original image, HSV color gamut map, LBP feature information map, and normalized histogram into a new training sample data (112*112*8), with a total of 8 channels of data feature information.

[0117] The sample data information processed through the above six steps includes original image information (3 channels), HSV color space information (3 channels), LBP feature information (1 channel), and histogram statistical information (1 channel), which can well reflect the color, lighting and local texture characteristics of the sample image, and can improve the accuracy of the trained liveness detection network model.

[0118] This solution first uses a generative adversarial network to generate negative sample images to enhance the original data set samples (denoted as module 1), and then trains the DenseNet silent liveness detection model. The training process includes a generative adversarial sample algorithm module (denoted as module 2) and a data set sample preprocessing module (denoted as module 3). Through multiple cycles of iterative training, a liveness detection network model is finally generated.

[0119] In the following example, a set of training data is used to illustrate the technical effect of the embodiment of the present application:

[0120] In order to verify the effect of the above modules 1, 2, and 3 on training the liveness detection network model, the following tests were performed based on the same network architecture (i.e., DenseNet silent liveness detection model) and configuration parameters:

[0121] A. Based on the original sample data set (a total of 14,882 positive and negative samples), without using the adversarial sample algorithm and the data set sample preprocessing module, the liveness detection model training was performed for 100 iterations, and the training models of all iterations in the intermediate process were saved;

[0122] B. Based on A, add negative sample images generated by the generative adversarial network to form an enhanced sample data set (a total of 25,373 positive and negative samples), and perform the same training operation as A;

[0123] C. Based on B, enable the adversarial sample algorithm module and perform the same training operation as B.

[0124] D. Based on C, enable the data set sample preprocessing module and perform the same training operation as C.

[0125] The above operations generated four liveness detection network models, and each liveness detection network model saved 100 iterative training cycles. Then the four models were evaluated and tested, with a test data set of about 5,000 face images (including live images and prosthetic images). The model with the best test results was selected from the 100 models of each model (the higher the f1score, the better), and then the four best models were compared. The results are as follows:

[0126] Model A:

[0127] valid epoch=26 accuracy=0.9434 precision=0.8757763975155279 recall=0.9444072337575352

[0128] f1score=0.9087979374798582 positive=1493 negative=3507 tp=1410 tn=3307 fp=200 fn=83

[0129] Model B:

[0130] valid epoch=96 accuracy=0.9692 precision=0.9261616804583068 recall=0.9725478901540523

[0131] f1score=0.9497389033942559 positive=1493 negative=3507 tp=1455 tn=3391 fp=116 fn=38

[0132] Model C:

[0133] valid epoch=14 accuracy=0.9856 precision=0.9727212242182302 recall=0.9792364367046216

[0134] f1score=0.9759679572763684 positive=1493 negative=3507 tp=1462 tn=3466 fp=41 fn=31

[0135] Model D:

[0136] valid epoch=9 accuracy=0.9884 precision=0.9656067488643738 recall=0.9966510381781648

[0137] f1score=0.980883322346737 positive=1493 negative=3507 tp=1488 tn=3454 fp=53 fn=5

[0138] Compared with the above f1score results, the optimal f1score of model A trained with the original dataset is about 0.9088; the optimal f1score of model B trained with the enhanced dataset is about 0.9497; the optimal f1score of model C trained with the adversarial sample algorithm module enabled is about 0.9760; the optimal f1score of model D trained with the dataset sample preprocessing module enabled is about 0.9809. From the test results, we can conclude that the methods used in the above modules 1, 2, and 3 have improved the trained liveness detection network models to varying degrees.

[0139] Based on the same concept, the present application also provides a living body detection device, such as Figure 2 As shown, the device comprises:

[0140] The receiving unit 201 is used to receive a face image to be detected.

[0141] The processing unit 202 is used to input the face image to be detected into the liveness detection network model to obtain the liveness detection result; the liveness detection network model is obtained by training after adding noise data to each sample in the sample set, and the sample set includes negative samples generated by the adversarial network.

[0142] Furthermore, the device also includes a liveness detection network model determination unit 203; the liveness detection network model determination unit 203 is used to: obtain a preset number of samples required for each round of training from the sample set; determine the noise interval according to the gradient value of the previous round of training; select the first noise data from the noise interval; determine the second noise data to be added to the sample according to the gradient value and the first noise data; after any noise data in the noise interval is added to the sample, it does not affect the human eye's recognition of the sample; and train the sample to which the second noise data is added as a correction sample, thereby obtaining the liveness detection network model.

[0143] Further, for the device, the liveness detection network model determination unit 203 is specifically used to: if it is the first round of training or the gradient value is zero, determine the noise interval as [-b, a], -b+a≈0; if the gradient value is not zero, determine the noise interval as [-b, 0] or [0, a]; if the gradient value is zero, add the first noise data to the sample; if the gradient value is non-zero, correct the first noise data according to the gradient value, and add the corrected first noise data to the sample.

[0144] Furthermore, for the device, the liveness detection network model determination unit 203 is specifically used to: determine the control samples of the correction samples in different image dimensions; and train the correction samples and the control samples to obtain the liveness detection network model.

[0145] Further, for the device, the different image dimensions include at least one of the following: an HSV color gamut map, an LBP feature map, and a normalized feature histogram.

[0146] Furthermore, the device also includes a negative sample generation unit 204; the negative sample generation unit 204 is used to: generate a first picture by using the selected random noise through a generative network model; determine a first loss value of the discriminative network model under the first picture based on the classification result of the discriminative network model for the first picture; determine a second loss value of the discriminative network model under the real negative sample based on the classification result of the discriminative network model for the real negative sample; adjust the discriminative network model based on the first loss value and the second loss value; adjust the generative network model based on the first loss value until the discriminative network model meets the set requirements; generate a simulated negative sample through the corresponding generative network model when the discriminative network model meets the set requirements and use it as a negative sample in the sample set.

[0147] Furthermore, for the device, the negative sample generation unit 204 is specifically used for: the discriminant network model meets the set requirements, which means that the loss values ​​of the discriminant network model in multiple iteration cycles all meet the set values; and the simulated negative samples are generated by generating network models in the multiple iteration cycles.

[0148] The embodiment of the present application provides a computing device, which may be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. The computing device may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.

[0149] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In an embodiment of the present application, the memory may be used to store program instructions of a liveness detection method;

[0150] The processor is used to call the program instructions stored in the memory and execute the living body detection method according to the obtained program.

[0151] like Figure 3 FIG. 1 is a schematic diagram of a computing device provided in an embodiment of the present application, wherein the computing device includes:

[0152] Processor 301, memory 302, transceiver 303, bus interface 304; wherein the processor 301, memory 302 and transceiver 303 are connected via bus 305;

[0153] The processor 301 is used to read the program in the memory 302 and execute the above-mentioned living body detection method;

[0154] The processor 301 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP. It may also be a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0155] The memory 302 is used to store one or more executable programs and can store data used by the processor 301 when performing operations.

[0156] Specifically, the program may include program code, and the program code includes computer operation instructions. The memory 302 may include volatile memory, such as random-access memory (RAM); the memory 302 may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 302 may also include a combination of the above-mentioned types of memory.

[0157] The memory 302 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:

[0158] Operation instructions: include various operation instructions, used to implement various operations.

[0159] Operating system: includes various system programs used to implement various basic businesses and handle hardware-based tasks.

[0160] The bus 305 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0161] The bus interface 304 may be a wired communication access port, a wireless bus interface or a combination thereof, wherein the wired bus interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface or a combination thereof. The wireless bus interface may be a WLAN interface.

[0162] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute a living body detection method.

[0163] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0164] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0165] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0167] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0168] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for detecting a living body, characterized in that: include: Receive the face image to be detected; Inputting the face image to be detected into a liveness detection network model to obtain a liveness detection result; the liveness detection network model is obtained by training by adding noise data to each sample in a sample set, and the sample set includes negative samples generated by an adversarial network; The liveness detection network model is obtained by adding noise data to each sample in the sample set and then training, and includes: Acquire a preset number of samples required for each round of training from the sample set; Determine a noise interval according to the gradient value of the previous round of training; select first noise data from the noise interval; determine second noise data to be added to the sample according to the gradient value and the first noise data; after any noise data in the noise interval is added to the sample, it does not affect the recognition of the sample by human eyes; Using the sample to which the second noise data is added as a correction sample for training, thereby obtaining the living body detection network model; The step of determining second noise data to be added to the sample according to the gradient value and the first noise data comprises: If the gradient value is zero, adding the first noise data to the sample; If the gradient value is non-zero, correcting the first noise data according to the gradient value, and adding the corrected first noise data to the sample; The step of training the sample to which the second noise data is added as a correction sample to obtain the living body detection network model comprises: Determine a reference sample of the calibration sample at different image dimensions; Training the calibration sample and the control sample to obtain the living body detection network model; The different image dimensions include at least one of an HSV color gamut map, an LBP feature map, and a normalized feature histogram; the training of the correction sample and the control sample to obtain the living body detection network model includes: The BGR information of the calibration sample and the characteristic information of the control sample are combined into a multi-channel input data, and the living body detection network model is obtained by training according to the input data.

2. The method according to claim 1, characterized in that The step of determining the noise interval according to the gradient value of the previous round of training includes: If it is the first round of training or the gradient value is zero, the noise interval is determined to be [-b, a], -b+a≈0; if the gradient value is not zero, the noise interval is determined to be [-b, 0] or [0, a].

3. The method according to any one of claims 1 to 2, characterized in that: The sample set includes negative samples generated by the adversarial network, including: Generate a first image using the selected random noise through a generative network model; Determine a first loss value of the discriminant network model for the first image based on a classification result of the discriminant network model on the first image; Based on the classification result of the discriminant network model on the real negative sample, determining a second loss value of the discriminant network model under the real negative sample; Based on the first loss value and the second loss value, adjusting the discriminant network model; based on the first loss value, adjusting the generative network model until the discriminant network model meets the set requirements; When the discriminant network model meets the set requirements, a corresponding generative network model is used to generate simulated negative samples and serve as negative samples in the sample set.

4. The method according to claim 3, characterized in that The generating network model corresponding to the discriminant network model when the discriminant network model meets the set requirements, generating simulated negative samples as negative samples in the sample set, comprises: The discriminant network model meets the set requirements means that the loss values ​​of the discriminant network model in multiple iteration cycles all meet the set values; The simulated negative samples are generated by generating the network model in the multiple iteration cycles.

5. A living body detection device, characterized in that: include: A receiving unit, used for receiving a face image to be detected; A processing unit, configured to input the face image to be detected into a liveness detection network model to obtain a liveness detection result; the liveness detection network model is obtained by training after adding noise data to each sample in a sample set, and the sample set includes negative samples generated by an adversarial network; A liveness detection network model determination unit is used to obtain a preset number of samples required for each round of training from the sample set; and determine the noise interval according to the gradient value of the previous round of training; Selecting first noise data from the noise interval; determining second noise data to be added to the sample according to the gradient value and the first noise data; after any noise data in the noise interval is added to the sample, it does not affect the recognition of the sample by human eyes; training the sample to which the second noise data is added as a correction sample, thereby obtaining the living body detection network model; The living body detection network model determination unit is specifically configured to add the first noise data to the sample if the gradient value is zero; If the gradient value is non-zero, correcting the first noise data according to the gradient value, and adding the corrected first noise data to the sample; The living body detection network model determination unit is specifically used to determine the control samples of the correction samples in different image dimensions; train the correction samples and the control samples to obtain the living body detection network model; The different image dimensions include at least one of an HSV color gamut map, an LBP feature map, and a normalized feature histogram; the living body detection network model determination unit is specifically used to merge the BGR information of the correction sample and the feature information of the control sample into a multi-channel input data, and obtain the living body detection network model through training based on the input data.

6. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to call a computer program stored in the memory, and execute the method according to any one of claims 1 to 4 according to the obtained program.

7. A computer-readable storage medium, characterized in that: The storage medium stores a program, and when the program is run on a computer, the computer is enabled to implement the method according to any one of claims 1 to 4.