Model training and living body detection method and device, electronic equipment and storage medium
By training a liveness detection model and using supervised learning combining encoding, perception, and classification networks with labels for face regions and spoofed bounding box regions, the problem of low accuracy in spoofing detection in existing technologies is solved, achieving more efficient spoofing prevention.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MASHANG CONSUMER FINANCE CO LTD
- Filing Date
- 2022-07-25
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies are unable to effectively identify spoofing attacks on facial images, resulting in a decrease in the accuracy of facial recognition systems when faced with spoofing media, and an inability to effectively prevent spoofing attacks by unauthorized users.
By training a liveness detection model, an encoding network is used to encode the face region and the fake object border region of the image samples of the fake attack. A perceptual network is used for feature fusion, and a classification network is used for real and fake object recognition. Supervised learning is carried out using face region labels, fake object border region labels and real and fake object labels to improve the model's ability to recognize face and fake object features.
This improves the accuracy of the liveness detection model, enabling more effective prevention of spoofing attacks by unauthorized users and ensuring the security and reliability of the facial recognition system.
Smart Images

Figure CN116129484B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing technology, and in particular relates to a method, apparatus, electronic device and storage medium for model training and liveness detection. Background Technology
[0002] With the continuous development of biometric and artificial intelligence technologies, facial recognition technology has been widely applied, greatly simplifying identity authentication processes such as payment, access control, and security checks. However, in practical applications, as an open biometric feature, the face is easily exploited by malicious actors who use spoofed media to present the facial image of legitimate users, thereby impersonating them to initiate facial recognition. This behavior of using spoofed media to impersonate other users for identification is called a spoofing attack.
[0003] Therefore, how to automatically and efficiently identify spoofing attacks on facial images through machines has become an urgent problem to be solved in the industry. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for model training and liveness detection, which can perform liveness detection on face images based on machines and can be used in face recognition systems to resist spoofing attacks.
[0005] To achieve the above objectives, the embodiments of this application are implemented as follows:
[0006] Firstly, a model training method is provided, including:
[0007] Obtain an image training sample set, which includes multiple spoofing attack image samples and corresponding training labels. The training labels include face region labels, spoofing bounding box region labels, and true / false labels. The face region labels are used to characterize the face region features of the corresponding spoofing attack image samples. The spoofing bounding box region labels are used to characterize the spoofing bounding box region features of the corresponding spoofing attack image samples. The true / false labels are used to characterize the true / false classification of the corresponding spoofing attack image samples.
[0008] The initial liveness detection model is trained using the image training sample set to obtain the liveness detection model;
[0009] The liveness detection model includes an encoding network, a perceptual network, and a classification network. The encoding network encodes the face region and the prosthetic border region of each of the multiple prosthetic attack image samples to obtain the face region features and prosthetic border region features corresponding to each prosthetic attack image sample. The perceptual network fuses the face region features and prosthetic border region features corresponding to each prosthetic attack image sample to obtain the fused features corresponding to each prosthetic attack image sample. The classification network performs authenticity identification on the fused features of each prosthetic attack image sample to obtain the authenticity identification result corresponding to each prosthetic attack image sample.
[0010] Secondly, a liveness detection method is provided, including:
[0011] In response to a liveness detection request initiated by the target user, a facial image of the target user is captured.
[0012] The facial image of the target user is input into a liveness detection model to obtain a real / fake identification result corresponding to the facial image of the target user; wherein, the liveness detection model is trained based on the method described in the first aspect; the liveness detection model is used to encode the facial image into corresponding facial region features and spoofing border region features, and then fuse the facial region features and the spoofing border region features into a fused feature, and perform real / fake identification on the facial image based on the fused feature.
[0013] Thirdly, a liveness detection device is provided, comprising:
[0014] The image acquisition module responds to the liveness detection request initiated by the target user and acquires a facial image of the target user.
[0015] The authenticity recognition module inputs the facial image of the target user into the liveness detection model to obtain the authenticity recognition result corresponding to the facial image of the target user; wherein, the liveness detection model is trained based on the method described in the first aspect; the liveness detection model is used to encode the facial image into corresponding facial region features and spoofing border region features, and then fuse the facial region features and the spoofing border region features into a fused feature, and perform authenticity recognition on the facial image based on the fused feature.
[0016] Fourthly, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being executed by the processor to perform the method described in the first or second aspect.
[0017] Fifthly, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that the computer program, when executed by a processor, implements the methods of the first or second aspect described above.
[0018] In this application, the spoofed attack image samples used to train the liveness detection model are labeled with three types of tags: a true / false tag to characterize the true / false classification of the spoofed attack image samples, a spoofed bounding box region tag to characterize the features of the spoofed bounding box region in the spoofed attack image samples, and a face region tag to characterize the features of the face region in the spoofed attack image samples. During training, the encoding network of the liveness detection model, under the supervision of the spoofed bounding box region tag and the face region tag, can purposefully learn the feature knowledge of both the face and the spoof, thereby possessing the ability to accurately extract the features of both the face and the spoof in the spoofed attack image. In addition, the perceptual network of the liveness detection model can fuse the features of both the face and the spoof in the spoofed attack image and submit them to the classification network of the liveness detection model. Under the supervision of the true / false tags, the classification network learns how to combine the features of both the face and the spoof to perform the true / false analysis of liveness detection. Since the solution proposed in this application enables the liveness detection model to learn the essential features of faces and fakes more purposefully and use them as elements for liveness detection analysis, the accuracy of the liveness detection model is greatly improved. It has good results in both the training and deployment stages and can help the face recognition system to more effectively prevent fake attacks by unauthorized users. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating the process of a payment system handling facial recognition transaction requests.
[0021] Figure 2 This is a schematic diagram of the first process of the model training method provided in the embodiments of this application.
[0022] Figure 3 This is a schematic diagram illustrating how the border region of a fake object in a face image exhibits features different from those of the face region.
[0023] Figure 4 The first schematic diagram of the model training method of this application, which encodes the prosthesis border region and the face region in the prosthesis attack face image sample respectively.
[0024] Figure 5 The second schematic diagram of the model training method in this application embodiment encodes the prosthesis border region and the face region in the prosthesis attack face image sample, respectively.
[0025] Figure 6 A schematic diagram of the structure of the liveness detection model in this application embodiment.
[0026] Figure 7 A schematic diagram of the first process of the liveness detection method according to an embodiment of this application.
[0027] Figure 8 A second flowchart illustrating the liveness detection method of this application embodiment.
[0028] Figure 9 A schematic diagram of the structure of the model training device in this application embodiment.
[0029] Figure 10 A schematic diagram of the structure of the liveness detection device according to an embodiment of this application.
[0030] Figure 11 This application presents a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Detailed Implementation
[0031] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0032] With the widespread application of facial recognition technology and its trend towards automation and unsupervised operation, how to automatically and effectively identify spoofing attacks on facial images has become an urgent problem to be solved in the industry.
[0033] in, Figure 1 The following is a flowchart illustrating the process of a sample payment system successfully completing a payment transaction based on facial recognition, which includes the following steps:
[0034] 1) The user initiates a transaction request to the payment system.
[0035] 2) In response to the user's transaction request, the payment system calls the user's terminal camera to attempt to capture the user's facial image.
[0036] 3) The payment system performs facial recognition on the collected facial images.
[0037] 4) After facial recognition is successful, the payment system executes the transaction operation corresponding to the transaction request.
[0038] 6) The payment system provides feedback on the transaction results to the user.
[0039] As can be seen from the above process, if an unauthorized user uses a fake face image, such as a head model, mask, photo, or electronic screen, to present the face image of a legitimate user during the face image acquisition stage, the payment system may misjudge and pass the face recognition, and ultimately accept the transaction request of the unauthorized user, causing losses to both the legitimate user and the payment system.
[0040] Therefore, before performing facial recognition, it is necessary to perform liveness detection on the facial images to defend against attacks that use fake faces to impersonate legitimate users for recognition.
[0041] Liveness detection is a method for determining the true physiological characteristics of an object in identity verification scenarios. Currently, the mainstream approach to liveness detection using artificial intelligence technology involves training a deep learning model using both real and fake face samples. This enables the model to distinguish between real and fake face images. However, this method only labels real and fake face samples. Fake face samples, designed for impersonation, are visually very similar to real faces. Without more precise labeling, the model doesn't know which features are unique to real faces and which are unique to fakes, leading to poor interpretability of the training. While the model may achieve good accuracy on the training set, it hasn't actually learned the essential features of both real and fake faces, thus failing to effectively perform liveness detection based on these features. Deep learning models trained in this way often experience a significant drop in accuracy after deployment, failing to meet business requirements—a problem commonly referred to in the industry as overfitting.
[0042] Therefore, this application aims to propose a model training scheme that can perform strongly supervised learning on the features of both faces and prosthetics, enabling the liveness detection model to purposefully learn the feature knowledge of faces and prosthetics, thereby improving the accuracy of liveness detection. In this application, the liveness detection model includes an encoding network, a perceptual network, and a classification network. Training is performed on spoofed attack image samples labeled with face region labels, spoofed border region labels, and true / false labels. The process includes: the encoding network based on the liveness detection model encodes the face region and spoofed border region of the spoofed attack image samples into corresponding face region features and spoofed border region features; the perceptual network based on the liveness detection model fuses the face region features and spoofed border region features of each spoofed attack image sample into fused features; the classification network based on the liveness detection model determines the true / false identification result of each spoofed attack image sample; finally, based on the differences between the face region features and face region labels, the differences between the spoofed border region features and spoofed border region labels, and the differences between the true / false identification result and the true / false labels, the encoding network, perceptual network, and classification network are trained.
[0043] As can be seen, in the scheme of this application, the spoofed attack image samples used to train the liveness detection model are labeled with three types of tags: a true / false tag to characterize the true / false classification of the spoofed attack image samples, a spoofed border region tag to characterize the features of the spoofed border region in the spoofed attack image samples, and a face region tag to characterize the features of the face region in the spoofed attack image samples. During training, the encoding network of the liveness detection model, under the supervision of the spoofed border region tag and the face region tag, can purposefully learn the feature knowledge of both the face and the spoof, thus possessing the ability to accurately extract the features of both the face and the spoof in the spoofed attack image. In addition, the perceptual network of the liveness detection model can fuse the features of both the face and the spoof in the spoofed attack image and submit them to the classification network of the liveness detection model. Under the supervision of the true / false tags, the classification network learns how to combine the features of both the face and the spoof to perform the true / false analysis of liveness detection. Since the solution proposed in this application enables the liveness detection model to learn the essential features of faces and fakes more purposefully and use them as elements for liveness detection analysis, the accuracy of the liveness detection model is greatly improved. It has good results in both the training and deployment stages and can help the face recognition system to more effectively prevent fake attacks by unauthorized users.
[0044] The model training scheme of this application can be executed by an electronic device, specifically by the processor of the electronic device. The so-called electronic device may include terminal devices, such as smartphones, tablets, laptops, desktop computers, intelligent voice interaction devices, smart home appliances, smartwatches, in-vehicle terminals, aircraft, etc.; or, the electronic device may also include servers, such as independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide cloud computing services.
[0045] Based on the foregoing, embodiments of this application provide a model training method. See also... Figure 2 , Figure 2 This is a flowchart illustrating the model training method provided in this application embodiment, which specifically includes the following steps:
[0046] S202, Obtain the image training sample set. The image training samples include multiple spoofing attack image samples and corresponding training labels. The training labels include face region labels, spoofing bounding box region labels, and true / false labels. The face region labels are used to represent the face region features of the corresponding spoofing attack image samples. The spoofing bounding box region labels are used to represent the spoofing bounding box region features of the corresponding spoofing attack image samples. The true / false labels are used to represent the true / false classification of the corresponding spoofing attack image samples.
[0047] A spoofing image can refer to a facial image presented using prosthetic media such as head models, masks, photographs, and electronic screens. During the preparation phase of this application, a facial image can be presented using any of the aforementioned types of prosthetics and then photographed to obtain a spoofing image. The photographed spoofing image can be used as a sample for training a model, i.e., the spoofing image sample described herein.
[0048] in, Figure 3 This illustration shows three types of prosthetic media—electronic screens, photographs, and masks—that impersonate human faces. It can be seen that these prosthetics exhibit unique border-like features in the outer contour region of the face image, a characteristic unique to and unavoidable in current prosthetic attacks. Therefore, this application aims to enable a liveness detection model to purposefully learn the feature knowledge of the prosthetic border region and the face region in prosthetic attack image samples, thereby combining this feature knowledge to perform liveness detection verification.
[0049] Here, in order to enable the liveness detection model to identify which features are unique to the face and which are unique to the prosthetic border from the prosthetic attack image samples during the training phase, this application uses face region labels and prosthetic border region labels to label the features of the face region and the prosthetic border region in the prosthetic attack image samples respectively.
[0050] Specifically, for the annotation of the face region, this application employs a first black-and-white binary rule to convert the spoofing attack image sample into a black-and-white binary image. Under the first black-and-white binary rule, pixels in the face region use a first grayscale value, while non-face regions use a second grayscale value. The first grayscale value differs from the second grayscale value; that is, in the black-and-white binary image generated based on the first black-and-white binary rule, pixels in the face region are represented by highlights, while pixels in other regions are represented by low brightness; or, pixels in the face region are represented by low brightness, while pixels in other regions are represented by highlights. Through this contrast in brightness, the black-and-white binary image can highlight the face region. Converting the black-and-white binary image highlighting the face region into a grayscale matrix representing the image brightness is equivalent to completing the annotation of face region features in a machine language manner, i.e., the face region label described in this paper.
[0051] For ease of understanding, a simple example is provided here: Assume that the first grayscale value of this application is the maximum grayscale value (maximum grayscale value is 255), and the second grayscale value is the minimum grayscale value (minimum grayscale value is 0). According to the first black-and-white binary rule, various types of spoofing attack image samples can be converted into... Figure 4 The image shown is a binary image with black borders representing the face region. From... Figure 4 As can be seen, the black-and-white binary image representing the face region highlights the outline of the face region with the maximum gray value. For the fake attack image sample, the face region label is the gray matrix of the black-and-white binary image generated by the fake attack image according to the first black-and-white binary rule.
[0052] Similarly, for the annotation of the prosthesis border region, this application uses a second black-and-white binary rule to convert the prosthesis attack image sample into a black-and-white binary image. Under this second black-and-white binary rule, pixels in the prosthesis border region use a third grayscale value, while pixels outside the prosthesis border use a fourth grayscale value. Here, the third grayscale value differs from the fourth grayscale value to distinguish them. As a preferred embodiment, the third grayscale value is the maximum grayscale value (grayscale value is 255), and the fourth grayscale value is the minimum grayscale value (grayscale value is 0). Based on the second black-and-white binary rule, various types of prosthesis attack image samples can be converted into... Figure 4 The image shown represents the black border of the prosthesis's outline region, in a binary image. From... Figure 4 As can be seen, the black-and-white binary image representing the prosthesis border region highlights the outline of the prosthesis with the maximum gray value. For the prosthesis attack image sample, the prosthesis border region label is the gray-scale matrix of the black-and-white binary image generated by the prosthesis attack image according to the second black-and-white binary rule.
[0053] It should be understood that, based on the above-mentioned black-and-white binary annotation method, this application is able to annotate the prosthesis border region features and face region features in the prosthesis attack image sample using machine language.
[0054] In practical applications, spoofed attack image samples are further subdivided into positive examples and negative examples. Positive examples refer to face images presented using spoofing media. These are used to train the model from a positive perspective to learn the features of the spoofing bounding box region and the face region in the spoofed attack image, thereby enabling the model to identify spoofed attack images based on these features. Negative examples refer to samples that use real, live face images to impersonate spoofed attack images. These are used to train the model from a negative perspective to learn the image features that are not unique to spoofed attack images, thereby avoiding the use of image features that are not unique to spoofed attack images for spoofed attack image identification.
[0055] It should be understood that training the model based on the aforementioned positive and negative samples enables the model to more accurately distinguish between spoofed attack images and non-spoofed attack images (real human face images). Correspondingly, this application labels the authenticity of positive samples as "spoofed" and the authenticity of negative samples as "true". Under the supervision of the authenticity labels, the model can determine the spoofed attack images in positive samples as "spoofed" and the spoofed attack images (i.e., real live human face images) in negative samples as true, thereby possessing the ability to determine the authenticity of liveness detection.
[0056] It should be noted that this application uses real, live human face images as counterexamples. Since these counterexample images do not contain any prosthetic media, they lack prosthetic bounding box features. Therefore, a grayscale matrix with all pixels having the same value can be used as the label for the prosthetic bounding box region of the counterexample. Here, we use an example where all pixels have a value of 0. (Refer to...) Figure 5 As shown, the label for the prosthetic bounding box region corresponding to the negative example is a grayscale matrix where all pixels have a value of 0, which visually appears as a completely black image. Since a completely black image does not convey any information, the label for the prosthetic bounding box region can be interpreted in machine language as indicating that the negative example does not contain a prosthetic medium. Therefore, during training, the model does not need to deliberately search for image features of the prosthetic bounding box region in the negative example for learning.
[0057] Furthermore, since the starting point of this application is to accurately combine the features of the prosthetic bounding box region and the face region to identify prosthetic attack images, for the counterexample sample, in the absence of prosthetic bounding box region features, there is no need to deliberately label the position of the face region. Correspondingly, the face region label of the counterexample sample can also be labeled using a grayscale matrix with all pixels having the same value. For example... Figure 5 As shown, the face region label corresponding to the counterexample sample is a grayscale matrix with all pixels having a value of 0, which visually presents a completely black image.
[0058] S204, the initial liveness detection model is trained using the image training sample set to obtain a liveness detection model. The liveness detection model includes an encoding network, a perceptual network, and a classification network. The encoding network encodes the face region and the fake border region of each fake attack image sample in multiple fake attack image samples, obtaining the face region features and fake border region features corresponding to each fake attack image sample. The perceptual network fuses the face region features and fake border region features corresponding to each fake attack image sample, obtaining the fused features corresponding to each fake attack image sample. The classification network performs authenticity identification on the fused features of each fake attack image sample, obtaining the authenticity identification result corresponding to each fake attack image sample.
[0059] In this application, the encoding network encodes the face region and the prosthetic border region of the spoofing image sample by means of: the encoding network encodes the pixels of the spoofing image sample based on the grayscale matrix according to the first black-and-white binary rule described above, to obtain the corresponding face region features; and, according to the second black-and-white binary rule described above, the encoding network encodes the pixels of the spoofing image sample based on the grayscale matrix, to obtain the corresponding prosthetic region features.
[0060] As an example, the encoding network of this application specifically includes an embedding layer and an encoder. The embedding layer is used to extract grayscale information vectors of the face region and the prosthesis border region in the image sample of the spoofing attack in a vector manner. The encoder is used to encode the grayscale information vectors of the face region and the prosthesis border region into a grayscale matrix according to the corresponding black-and-white binary rules, that is, the face region features and the prosthesis border region features.
[0061] In this application, the fusion of face region features and fake border region features corresponding to the fake attack image sample by the perceptual network refers to: performing a nonlinear combination of the face region features and fake border region features corresponding to the fake attack image sample through fully connected computation, thereby obtaining a new feature expression containing two feature dimensions, namely the fused feature.
[0062] As an example, the perceptual network of this application can be a convolutional neural network, specifically including convolutional layers, pooling layers, and fully connected layers. The convolutional layers are used to convert the facial region features and the prosthetic bounding box region features into the same space and represent them as vectors. The pooling layers are used to appropriately reduce the dimensionality of the face region features and the prosthetic bounding box region features expressed by the vectors, accelerating subsequent computation. The fully connected layers are used to non-linearly fuse the face region features and the prosthetic bounding box region features expressed by the dimensionality-reduced vectors to obtain the corresponding fused features.
[0063] In this application, the classification network's method of identifying the authenticity of spoofed attack image samples based on their fusion features means: calculating the probability that the spoofed attack image sample is a real live person and the probability that it is a fake, and selecting the one with the highest probability as the authenticity identification result. For example, if the probability of a spoofed attack image sample being a real live person calculated by the classification network is 10%, and the probability of it being a fake is 90%, then the final authenticity identification result is a fake face image.
[0064] As an example, the classification network in this application may be, but is not limited to, commonly used classifiers that support classification computation, such as logistic regression models, softmax function models, support vector machines (SVM), etc., but this article does not make specific limitations.
[0065] Based on the liveness detection model structure described above, the training principle of this application is to determine the training gradient of the liveness detection model based on the differences between the face region features and face region labels corresponding to each spoofing attack image sample, the differences between the spoofing bounding region features and spoofing bounding region labels, and the differences between the true and false recognition results and the true and false labels. The encoding network, perceptual network and classification network of the liveness detection model are trained according to the training gradient.
[0066] Specifically, this step can set different loss functions for the encoding network and the classification network. The loss function for the encoding network reflects the encoding error, which includes the difference between the face region features and the face region label for each spoofed image sample, and the difference between the spoofed bounding box region features and the spoofed bounding box region label for each spoofed image sample. The loss function for the classification network reflects the classification calculation error, which includes the difference between the true / false identification result and the true / false label for each spoofed image sample.
[0067] This application determines the total loss function of the liveness detection model based on the loss functions of the encoding network and the classification network. This total loss function comprehensively reflects the total error of the liveness detection model, which includes the encoding error of the encoding network and the error of the classifier network. The network parameters of the encoding network, the perceptual network and the classification network of the liveness detection model are adjusted with the reduction of the total error as the direction of the training gradient. This improves the encoding ability of the encoding network, the nonlinear feature fusion ability of the perceptual network and the classification computation ability of the classification network.
[0068] The training of the liveness detection model in this application will be described in detail below.
[0069] refer to Figure 6, Figure 6 This is a schematic diagram of the liveness detection model of this application, wherein the encoding network specifically includes a first encoding sub-network and a second encoding sub-network. After the spoofed attack image is input into the liveness detection model, on the one hand, the pixels of the spoofed attack image sample are encoded based on a grayscale matrix by the first encoding sub-network to obtain the corresponding face region features; on the other hand, the pixels of the spoofed attack image sample are encoded based on a grayscale matrix by the second encoding sub-network. Then, the face region features output by the first encoding sub-network and the spoofed bounding box region features output by the second encoding sub-network are input into a perceptual network, where they are fused into a fused feature. Finally, the fused feature output by the perceptual network is further input into a classification network, where the classification network performs the classification calculation to determine whether the image is genuine or fake, thus obtaining the genuine / fake identification result corresponding to the spoofed attack image sample.
[0070] In this application, the first encoding sub-network and the second encoding sub-network both employ the Mean Squared Error (MSE) loss function. The formula for the MSE loss function is as follows:
[0071]
[0072] In the above formula, n represents the number of spoofed attack image samples; y i This represents the actual output of the i-th spoofed attack image sample, which corresponds to the face region features in the first encoding sub-network and the spoofed bounding box region features in the second encoding network. Let represent the expected value corresponding to the i-th spoofed image sample. In the first encoding sub-network, this specifically corresponds to the face region label, and in the second encoding network, it specifically corresponds to the spoofed bounding box region label. It should be understood that the MSE loss function of the first encoding sub-network is equivalent to calculating the average difference between the face region features and the face region label in each spoofed image sample; the MSE loss function of the second encoding sub-network is equivalent to calculating the average difference between the spoofed bounding box region features and the spoofed bounding box region label in each spoofed image sample.
[0073] Correspondingly, the classification network uses the Cross Entropy Loss Function (CELF). The formula for the CELF loss function is as follows:
[0074]
[0075] In the above formula, n represents the number of spoofed attack image samples; y i This represents the actual output of the i-th spoofed attack image sample, which corresponds to the face region features in the first encoding sub-network and the spoofed bounding box region features in the second encoding network. Let represent the expected value corresponding to the i-th spoofed image sample. In the first encoding sub-network, this corresponds specifically to the face region label, and in the second encoding network, it corresponds specifically to the spoofed bounding box region label. For the CELF loss function of the classification network, it is equivalent to calculating the distance between the actual output probability and the expected output probability of the spoofed image sample. This distance is the cross-entropy. The smaller the value of the cross-entropy, the closer the distribution of the actual output probability is to the expected output probability.
[0076] For the liveness detection model as a whole, the total loss function is:
[0077] Loss = MSE1 + MSE2 + CELF
[0078] Where Loss represents the total loss function; MSE1 represents the MSE loss function of the first encoding sub-network; MSE2 represents the MSE loss function of the second encoding sub-network; and CELF represents the CELF loss function of the classification network.
[0079] Here, this application can adjust the network parameters of the first encoding subnetwork, the second encoding subnetwork, the perception network, and the classification network of the liveness detection model according to the training gradient direction where the total loss function Loss value is as small as possible.
[0080] Through multiple iterations of this gradient training adjustment method, the face region features encoded by the first encoding sub-network for the spoofed attack image samples can gradually converge to the corresponding face region labels. The spoofed bounding box region features encoded by the second encoding sub-network for the spoofed attack image samples can converge to the corresponding spoofed bounding box labels. The fused features obtained by the encoding network for the fusion of face region features and spoofed bounding box region features gradually converge to the direction suitable for classification network to perform classification calculations. The true / false recognition result obtained by the classification network based on the fused features provided by the encoding network converges to the corresponding true / false labels.
[0081] Based on the above convergence principle, after supervised training, the first encoding sub-network eventually has the ability to extract face region features from spoofed attack images; the second encoding sub-network eventually has the ability to extract spoofed bounding box region features from spoofed attack images; the perceptual network eventually has the ability to fuse face region features and spoofed bounding box region features into fused features suitable for classification calculation; and the classification network eventually has the ability to perform classification calculations to identify the authenticity of spoofed attack images based on the fused features (combining face region features and spoofed bounding box region features).
[0082] It should be understood that the liveness detection model trained in this application can effectively detect liveness in face images. That is, when the liveness detection model outputs a true / false recognition result indicating that the face image is a fake face image, the liveness detection fails; conversely, when the liveness detection model outputs a true / false recognition result indicating that the face image is a real live face image, the liveness detection passes.
[0083] Obviously, through this application Figure 1 The liveness detection model trained by the method shown can automatically perform liveness detection on face images.
[0084] Based on this, the application embodiment also provides a liveness detection method based on the above-described liveness detection model. Figure 7 This is a flowchart illustrating the liveness detection method, which includes the following steps:
[0085] S702, in response to a liveness detection request initiated by the target user, acquires a facial image of the target user.
[0086] In this application, when the target user initiates face verification through the terminal, a liveness detection request is also initiated. During the face verification phase, the terminal activates its camera to capture a picture of the target user; this step allows the acquisition of the target user's face image from the captured image.
[0087] S704, the target user's face image is input into the liveness detection model to obtain the authenticity recognition result of the target user's face image. The liveness detection model is used to encode the face image into corresponding face region features and fake body border region features, and then fuse the face region features and fake body border region features into fused features. Based on the fused features, the authenticity recognition of the face image is performed.
[0088] It should be understood that the liveness detection model described in this step is based on Figure 2 The model was trained using the method shown, and the principles of the liveness detection model will not be elaborated here.
[0089] In this application, if the authenticity recognition result indicates that the face image is a real face image, then the liveness detection is deemed to have passed; otherwise, the liveness detection is deemed to have failed.
[0090] Specifically, if the liveness detection is initiated by the user when requesting face verification, this step can further determine that the face verification has failed and end the face verification process after it is determined that the face image has failed the liveness detection; if the face image passes the liveness detection, this step can perform the face verification process on the face image based on existing face verification technology.
[0091] As can be seen, the liveness detection method in this application embodiment can selectively extract features of the face and the fake from the target user's face image, and combine the features of the face and the fake to perform a authenticity analysis of the face image, that is, to determine whether the face image is a real live face image or a face image impersonated by a fake, and thus determine whether the liveness detection passes based on the authenticity recognition result, thereby playing a preventive role against fake attacks.
[0092] The following example illustrates the application of the liveness detection method in the embodiments of this application, using the liveness detection model in an electronic payment system.
[0093] This application deploys an execution script for liveness detection based on a liveness detection model in the electronic payment system. When the payment system receives a payment transaction initiated by a user that requires facial verification, it calls the execution script for liveness detection to first perform liveness detection on the user. Then, based on the liveness detection result, it decides whether further facial verification is required.
[0094] This example assumes that an unauthorized user uses a fake face image to impersonate a legitimate user for face recognition. Correspondingly, the liveness detection method's process is as follows: Figure 8 As shown, the specific steps include the following:
[0095] Unauthorized users use mobile payment apps to initiate transaction requests to the payment system for payment purposes.
[0096] In response to a transaction request from an unauthorized user, the payment system attempts to capture the unauthorized user's facial image by accessing the mobile terminal's camera through the payment app on the unauthorized user's side.
[0097] During the facial image acquisition phase, unauthorized users use spoofs to present the facial images of legitimate users in order to impersonate them for facial recognition.
[0098] After obtaining a facial image uploaded by an unauthorized user terminal through the payment app, the payment system calls the liveness detection execution script and runs the code of the liveness detection model to perform the following liveness detection process on the facial image:
[0099] 1) Encode the face region and prosthesis border region of the face image to obtain the face region features and prosthesis border region features corresponding to the face image.
[0100] 2) The facial region features and the prosthesis border region features are fused to obtain the fused features corresponding to the facial image.
[0101] 3) Based on the fusion features corresponding to the face images, perform face image authenticity classification calculations to determine the authenticity recognition result of the face images.
[0102] 4) If the face image is identified as a fake face image, the liveness detection is deemed to have failed.
[0103] Subsequently, after the liveness detection result indicated that the electronic payment app failed, it directly rejected the transaction request from the unauthorized user, thus effectively preventing spoofing attacks by unauthorized users.
[0104] With the above Figure 2 Corresponding to the method shown, embodiments of the present invention also provide a model training device. Figure 9 This is a schematic diagram of the structure of the model training device 900, including:
[0105] The sample acquisition module 910 is used to acquire an image training sample set, which includes multiple spoofing attack image samples and corresponding training labels. The training labels include face region labels, spoofing border region labels, and true / false labels. The face region labels are used to characterize the face region features of the corresponding spoofing attack image sample. The spoofing border region labels are used to characterize the spoofing border region features of the corresponding spoofing attack image sample. The true / false labels are used to characterize the true / false classification of the corresponding spoofing attack image sample.
[0106] The training module 920 is used to train the initial liveness detection model using the image training sample set to obtain a liveness detection model. The liveness detection model includes an encoding network, a perceptual network, and a classification network. The encoding network encodes the face region and the prosthetic border region of each of the multiple prosthetic attack image samples, obtaining face region features and prosthetic border region features corresponding to each prosthetic attack image sample. The perceptual network fuses the face region features and prosthetic border region features corresponding to each prosthetic attack image sample, obtaining fused features corresponding to each prosthetic attack image sample. The classification network performs authenticity verification on the fused features of each prosthetic attack image sample, obtaining an authenticity verification result for each prosthetic attack image sample.
[0107] Optionally, the encoding network of the liveness detection model includes a first encoding sub-network and a second encoding sub-network. The first encoding sub-network is used to encode the face region of the spoofing attack image sample to obtain the corresponding face region features. The second encoding sub-network is used to encode the spoofing border region of the spoofing attack image sample to obtain the corresponding spoofing border region features.
[0108] The face region label is a grayscale matrix corresponding to the first black-and-white binary rule of the spoofing attack image sample. In the first black-and-white binary rule, the pixels of the face region adopt the first grayscale value, and the non-face region adopts the second grayscale value. The first encoding sub-network is specifically used to encode the grayscale matrix of the spoofing attack image sample according to the first black-and-white binary rule to obtain the corresponding face region features.
[0109] The label of the spoofed border region is the grayscale matrix of the second black-and-white binary rule corresponding to the spoofed attack image sample. In the second black-and-white binary rule, the pixels of the spoofed border region use the third grayscale value, and the non-spoofed border region uses the fourth grayscale value. The second encoding sub-network is specifically used to encode the grayscale matrix of the spoofed attack image sample according to the second black-and-white binary rule to obtain the corresponding spoofed border region features.
[0110] Optionally, the training module 920 is specifically configured to: determine the loss function of the first encoding sub-network based on the difference between the face region features and face region labels corresponding to each spoofed attack image sample; and determine the loss function of the second encoding sub-network based on the difference between the spoofed bounding box region features and spoofed bounding box region labels corresponding to each spoofed attack image sample and the difference between the real / spoofing recognition result and the real / spoofing label; and determine the loss function of the classification network based on the difference between the real / spoofing recognition result and the real / spoofing label corresponding to each spoofed attack image sample; determine the total loss function of the liveness detection model based on the loss functions of the first encoding sub-network, the second encoding sub-network, and the classification network; and determine the training gradient of the liveness detection model based on the total loss function of the liveness detection model.
[0111] Optionally, the loss function of the first encoding sub-network and the second encoding sub-network is the mean squared error loss function, and the loss function of the classification network is the cross-quotient loss function.
[0112] Optionally, the multiple prosthetic attack image samples include: prosthetic attack image samples based on at least one of the following prosthetics: head model, image, and mask.
[0113] According to another embodiment of this application, Figure 9The units in the model training device shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the data processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0114] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 2 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 9 The model training apparatus shown herein, and the model training method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer-readable storage medium, loaded onto a data processing device via the computer-readable storage medium, and run therein.
[0115] Based on the model training device described in this application, the spoofed attack image samples used to train the liveness detection model are labeled with three types of tags: a true / false tag to characterize the true / false classification of the spoofed attack image samples, a spoofed border region tag to characterize the features of the spoofed border region in the spoofed attack image samples, and a face region tag to characterize the features of the face region in the spoofed attack image samples. During training, the encoding network of the liveness detection model, under the supervision of the spoofed border region tag and the face region tag, can purposefully learn the feature knowledge of both the face and the spoof, thereby possessing the ability to accurately extract the features of both the face and the spoof in the spoofed attack image. Furthermore, the perceptual network of the liveness detection model can fuse the features of both the face and the spoof in the spoofed attack image and submit them to the classification network of the liveness detection model. Under the supervision of the true / false tags, the classification network learns how to combine the features of both the face and the spoof to perform a true / false analysis of liveness detection. Since the solution proposed in this application enables the liveness detection model to learn the essential features of faces and fakes more purposefully and use them as elements for liveness detection analysis, the accuracy of the liveness detection model is greatly improved. It has good results in both the training and deployment stages and can help the face recognition system to more effectively prevent fake attacks by unauthorized users.
[0116] With the above Figure 7Corresponding to the method shown, embodiments of the present invention also provide a liveness detection device. Figure 10 This is a schematic diagram of the structure of the liveness detection device 1000, including:
[0117] The image acquisition module 1010, in response to a liveness detection request initiated by the target user, acquires a facial image of the target user.
[0118] The authenticity recognition module 1020 inputs the facial image of the target user into a system based on... Figure 1 The liveness detection model trained by the method obtains the authenticity recognition result of the face image of the target user. The liveness detection model is used to encode the face image into corresponding face region features and spoof border region features, and then fuse the face region features and the spoof border region features into a fusion feature. Based on the fusion feature, the authenticity recognition of the face image is performed.
[0119] According to another embodiment of this application, Figure 10 The various units in the illustrated liveness detection device can be individually or entirely combined into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above-mentioned units are based on logical function division. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the data processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0120] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 7 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 10 The liveness detection device shown herein, and the model training method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer-readable storage medium, loaded onto a data processing device via the computer-readable storage medium, and run therein.
[0121] When performing liveness detection on a target user, the liveness detection device in this application embodiment can selectively extract features of both the face and the fake from the target user's face image. By combining the features of the face and the fake, it can perform a authenticity analysis of the face image, that is, determine whether the face image is a real live face image or a face image impersonated by a fake. Based on the authenticity identification result, it can determine whether the liveness detection passes, thereby achieving a preventive effect against fake attacks.
[0122] Figure 11 This is a schematic diagram of the structure of an electronic device according to one embodiment of this specification. Please refer to it. Figure 11 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.
[0123] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0124] Memory is used to store computer programs. Specifically, computer programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0125] Optionally, the processor reads the corresponding computer program from non-volatile memory into memory and then runs it, forming the above-mentioned logical structure. Figure 9 The model training device shown. Correspondingly, the processor executes the program stored in memory and specifically performs the following operations:
[0126] Obtain an image training sample set, which includes multiple spoofing attack image samples and corresponding training labels. The training labels include face region labels, spoofing border region labels, and true / false labels. The face region labels are used to characterize the face region features of the corresponding spoofing attack image samples. The spoofing border region labels are used to characterize the spoofing border region features of the corresponding spoofing attack image samples. The true / false labels are used to characterize the true / false classification of the corresponding spoofing attack image samples.
[0127] The initial liveness detection model is trained using the image training sample set to obtain the liveness detection model.
[0128] The liveness detection model includes an encoding network, a perceptual network, and a classification network. The encoding network encodes the face region and the prosthetic border region of each of the multiple prosthetic attack image samples to obtain the face region features and prosthetic border region features corresponding to each prosthetic attack image sample. The perceptual network fuses the face region features and prosthetic border region features corresponding to each prosthetic attack image sample to obtain the fused features corresponding to each prosthetic attack image sample. The classification network performs authenticity identification on the fused features of each prosthetic attack image sample to obtain the authenticity identification result corresponding to each prosthetic attack image sample.
[0129] Alternatively, the processor reads the corresponding computer program from non-volatile memory into memory and then runs it, forming the above at the logical level. Figure 10 The liveness detection device is shown. Correspondingly, the processor executes the program stored in the memory and is specifically used to perform the following operations:
[0130] In response to a liveness detection request initiated by the target user, a facial image of the target user is captured.
[0131] The facial image of the target user is input into a liveness detection model to obtain a authenticity verification result corresponding to the facial image of the target user; wherein, the liveness detection model is based on Figure 1 The liveness detection model, trained by the method shown, encodes the captured face image into corresponding face region features and prosthetic border region features. After fusing the face region features and the prosthetic border region features into a fused feature, the model performs authenticity recognition on the captured face image based on the fused feature.
[0132] The model training method or liveness detection method disclosed in the embodiments shown in this specification can be applied to a processor and implemented by the processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the processor or by instructions in the form of software. The processor mentioned above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0133] Of course, in addition to software implementation, the electronic device described in this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0134] Furthermore, embodiments of the present invention also provide a computer-readable storage medium that stores one or more programs, the one or more programs including instructions.
[0135] Optionally, when the above instructions are executed by a portable electronic device that includes multiple applications, the portable electronic device can perform... Figure 2 The steps of the method shown include:
[0136] Obtain an image training sample set, which includes multiple spoofing attack image samples and corresponding training labels. The training labels include face region labels, spoofing border region labels, and true / false labels. The face region labels are used to characterize the face region features of the corresponding spoofing attack image samples. The spoofing border region labels are used to characterize the spoofing border region features of the corresponding spoofing attack image samples. The true / false labels are used to characterize the true / false classification of the corresponding spoofing attack image samples.
[0137] The initial liveness detection model is trained using the image training sample set to obtain the liveness detection model.
[0138] The liveness detection model includes an encoding network, a perceptual network, and a classification network. The encoding network encodes the face region and the prosthetic border region of each of the multiple prosthetic attack image samples to obtain the face region features and prosthetic border region features corresponding to each prosthetic attack image sample. The perceptual network fuses the face region features and prosthetic border region features corresponding to each prosthetic attack image sample to obtain the fused features corresponding to each prosthetic attack image sample. The classification network performs authenticity identification on the fused features of each prosthetic attack image sample to obtain the authenticity identification result corresponding to each prosthetic attack image sample.
[0139] Alternatively, when the above instructions are executed by a portable electronic device that includes multiple applications, they can enable the portable electronic device to perform... Figure 7 The steps of the method shown include:
[0140] In response to a liveness detection request initiated by the target user, a facial image of the target user is captured.
[0141] The facial image of the target user is input into a liveness detection model to obtain a authenticity verification result corresponding to the facial image of the target user; wherein, the liveness detection model is based on Figure 1 The liveness detection model, trained by the method shown, encodes the captured face image into corresponding face region features and prosthetic border region features. After fusing the face region features and the prosthetic border region features into a fused feature, the model performs authenticity recognition on the captured face image based on the fused feature.
[0142] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0144] The above are merely embodiments of this specification and are not intended to limit the scope of this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification. Furthermore, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of this document.
Claims
1. A model training method, characterized in that, include: Obtain an image training sample set, which includes multiple spoofing attack image samples and corresponding training labels. The training labels include face region labels, spoofing bounding box region labels, and true / false labels. The face region labels are used to characterize the face region features of the corresponding spoofing attack image samples. The spoofing bounding box region labels are used to characterize the spoofing bounding box region features of the corresponding spoofing attack image samples. The true / false labels are used to characterize the true / false classification of the corresponding spoofing attack image samples. The initial liveness detection model is trained using the image training sample set to obtain the liveness detection model; The liveness detection model includes an encoding network, a perceptual network, and a classification network. The encoding network encodes the face region and the prosthetic border region of each of the multiple prosthetic attack image samples to obtain the face region features and prosthetic border region features corresponding to each prosthetic attack image sample. The perceptual network fuses the face region features and prosthetic border region features corresponding to each prosthetic attack image sample to obtain the fused features corresponding to each prosthetic attack image sample. The classification network performs authenticity identification on the fused features of each prosthetic attack image sample to obtain the authenticity identification result corresponding to each prosthetic attack image sample.
2. The method according to claim 1, characterized in that, The encoding network includes a first encoding sub-network and a second encoding sub-network. The first encoding sub-network is used to encode the face region of the spoofing attack image sample to obtain the corresponding face region features. The second encoding sub-network is used to encode the spoofing border region of the spoofing attack image sample to obtain the corresponding spoofing border region features.
3. The method according to claim 2, characterized in that, The face region label is a grayscale matrix corresponding to the first black-and-white binary rule of the spoofing attack image sample. In the first black-and-white binary rule, the pixels of the face region use the first grayscale value, and the non-face region uses the second grayscale value. The first encoding sub-network is specifically used to encode the grayscale matrix of the spoofing attack image sample according to the first black-and-white binary rule to obtain the corresponding face region features.
4. The method according to claim 2, characterized in that, The label of the spoofing border region is the grayscale matrix of the second black-and-white binary rule corresponding to the spoofing attack image sample. In the second black-and-white binary rule, the pixels of the spoofing border region use the third grayscale value, and the non-spoofing border region uses the fourth grayscale value. The second encoding sub-network is specifically used to encode the grayscale matrix of the spoofing attack image sample according to the second black-and-white binary rule to obtain the corresponding spoofing border region features.
5. The method according to claim 2, characterized in that, The step of training the initial liveness detection model using the image training sample set includes: Based on the difference between the facial region features and facial region labels corresponding to each spoofed attack image sample, the loss function of the first encoding sub-network is determined; and, Based on the differences between the prosthetic bounding box region features and the prosthetic bounding box region labels corresponding to each prosthetic attack image sample, and the differences between the authenticity recognition results and the authenticity labels, the loss function of the second encoding sub-network is determined; and, Based on the difference between the authenticity recognition result and the authenticity label corresponding to each fake attack image sample, the loss function of the classification network is determined; Based on the loss functions of the first coding sub-network, the second coding sub-network, and the classification network, the total loss function of the liveness detection model is determined; The training gradient of the liveness detection model is determined based on the total loss function of the liveness detection model.
6. The method according to claim 5, characterized in that, The loss function for the first and second encoding sub-networks is the mean squared error loss function, and the loss function for the classification network is the cross-quotient loss function.
7. A method for detecting liveness, characterized in that, include: In response to a liveness detection request initiated by the target user, a facial image of the target user is captured. The facial image of the target user is input into a liveness detection model to obtain a real / fake identification result corresponding to the facial image of the target user; wherein, the liveness detection model is trained based on the method described in any one of claims 1-6; the liveness detection model is used to encode the facial image into corresponding facial region features and prosthetic border region features, and after fusing the facial region features and the prosthetic border region features into a fused feature, the real / fake identification of the facial image is performed based on the fused feature.
8. A liveness detection device, characterized in that, include: The image acquisition module responds to the liveness detection request initiated by the target user and acquires a facial image of the target user. The authenticity recognition module inputs the facial image of the target user into a liveness detection model to obtain the authenticity recognition result corresponding to the facial image of the target user; wherein, the liveness detection model is trained based on the method described in any one of claims 1-6; the liveness detection model is used to encode the facial image into corresponding facial region features and spoofing border region features, and after fusing the facial region features and the spoofing border region features into a fused feature, the authenticity recognition of the facial image is performed based on the fused feature.
9. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the computer program is executed by the processor to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.