Live body detection network training and live body detection method and device, equipment and medium

By using a liveness detection network for feature extraction and a sphere center prediction network, and adjusting parameters to bring the liveness feature vector closer to the sphere center and the prosthesis feature vector further away from the sphere center, a spherical distribution is formed. This solves the problem of inaccurate prosthesis type identification in existing methods, enables the identification of infinite prosthesis features, and improves robustness.

CN115376213BActive Publication Date: 2026-04-17HEFEI DILUSENSE TECH CORP
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-14
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing neural network-based liveness detection methods heavily rely on the diversity of prosthetic face images in the training data, making it impossible to accurately classify prosthetic types not covered by the training data, resulting in poor robustness.

Method used

A liveness detection network, including a feature extraction network and a sphere center prediction network, is used. By acquiring live and spur feature vectors from the training data, a sphere center vector is generated. The network parameters are adjusted so that the live feature vector is closer to the sphere center and the spur feature vector is farther away from the sphere center, forming a spherical distribution, thereby achieving the recognition of infinite spur features.

Benefits of technology

This improves the robustness of the liveness detection model, enabling it to accurately identify prosthesis types not covered by the training data and enhancing the accuracy of liveness detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115376213B_ABST
    Figure CN115376213B_ABST
Patent Text Reader

Abstract

This invention relates to the field of artificial intelligence technology and discloses a training method, apparatus, device, and medium for a liveness detection network. The liveness detection network includes a feature extraction network and a center prediction network. The training method for the liveness detection network includes: acquiring training data, which includes at least one image group consisting of at least one live face image and one spoof face image; extracting features from the training data using the feature extraction network to obtain liveness feature vectors and spoof feature vectors; driving the center prediction network based on the training data to generate center vectors; determining a loss value based on the liveness feature vector, spoof feature vector, and center vector; and adjusting the parameters of the feature extraction network and the center prediction network according to the loss value, moving towards directions where the liveness feature vector is closer to the center vector and the spoof feature vector is farther from the center vector. This improves the robustness of the liveness detection network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, device, and medium for training a liveness detection network and for liveness detection. Background Technology

[0002] To address the issue of unauthorized licensing using photos, videos, headgear, and mannequins, various liveness detection technologies have been proposed. Among these, the application of deep learning technology to image liveness detection has garnered widespread attention due to its outstanding performance in image processing. Currently, a common approach to prosthetic detection based on neural networks involves collecting a large number of live and prosthetic face images as training data. The network is then trained to learn the imaging details of live / prosthetic faces, thereby obtaining a binary classification neural network capable of handling both live and prosthetic faces.

[0003] However, the accuracy of the binary classification neural network obtained by the above method for liveness detection depends heavily on the diversity of prosthetic face images in the training data. It cannot accurately classify prosthetic types not covered by the training data, resulting in poor robustness. Summary of the Invention

[0004] The purpose of this invention is to provide a training method, apparatus, device, and medium for a liveness detection network, which overcomes the dependence on spoofed face images in the training data and enables accurate liveness detection of spoofed types not covered by spoofed face images in the training data, thereby improving the robustness of the liveness detection network.

[0005] To achieve the above objectives, embodiments of the present invention provide a training method for a liveness detection network, the liveness detection network comprising a feature extraction network and a center prediction network, the method comprising: acquiring training data, the training data comprising at least one image group consisting of at least one live face image and one spoof face image; performing feature extraction on the training data based on the feature extraction network to obtain a feature vector group, the feature vector group comprising a liveness feature vector and a spoof feature vector; driving the center prediction network based on the training data to generate a center vector; determining a loss value based on the liveness feature vector, the spoof feature vector, and the center vector; and adjusting the parameters of the feature extraction network and the center prediction network in a direction that makes the liveness feature vector closer to the center vector and the spoof feature vector farther from the center vector, based on the loss value.

[0006] To achieve the above objectives, embodiments of the present invention also provide a liveness detection method, comprising: acquiring a face image to be tested; inputting the face image to be tested into a liveness detection network to obtain a feature vector to be tested and a predicted center vector; wherein the liveness detection network is trained according to the training method of the liveness detection network described above; detecting whether the distance between the feature vector to be tested and the predicted center vector is less than a reference value; if the distance is less than the reference value, determining that the face image to be tested is a live image; and if the distance is not less than the reference value, determining that the face image to be tested is a fake image.

[0007] To achieve the above objectives, embodiments of the present invention also provide a training apparatus for a liveness detection network, the liveness detection network including a feature extraction network and a center prediction network. The apparatus includes: a first acquisition module for acquiring training data, the training data including at least one image group consisting of at least one live face image and one spoof face image; a feature extraction module for extracting features from the training data based on the feature extraction network to obtain a feature vector group, the feature vector group including a liveness feature vector and a spoof feature vector; a prediction module for driving the center prediction network based on the training data to generate a center vector; a loss determination module for determining a loss value based on the liveness feature vector, the spoof feature vector, and the center vector; and an adjustment module for adjusting the parameters of the feature extraction network and the center prediction network according to the loss value in a direction where the liveness feature vector is closer to the center vector and the spoof feature vector is farther from the center vector.

[0008] To achieve the above objectives, embodiments of the present invention also provide a liveness detection device, comprising: a second acquisition module for acquiring a face image to be tested; an input module for inputting the face image to be tested into a liveness detection network to obtain a feature vector to be tested and a predicted center vector; the liveness detection network is trained according to the training method of the liveness detection network described above; a detection module for detecting whether the distance between the feature vector to be tested and the predicted center vector is less than a reference value; a first determination module for determining that the face image to be tested is a live image when the distance is detected to be less than the reference value; and a second determination module for determining that the face image to be tested is a spoof image when the distance is detected to be not less than the reference value.

[0009] To achieve the above objectives, embodiments of the present invention also provide an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the training method for the liveness detection network as described above, or to perform the liveness detection method as described above.

[0010] To achieve the above objectives, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the training method for the liveness detection network as described above, or implements the liveness detection method as described above.

[0011] The liveness detection network training method provided in this invention involves acquiring training data including at least one image group consisting of a live face image and a spoof face image. Then, a feature extraction network is used to extract features from the training data, resulting in a feature vector group including liveness feature vectors and spoof feature vectors. Furthermore, the training data drives the sphere center prediction network to generate sphere center vectors. Based on the loss value determined by the liveness feature vector, spoof feature vector, and sphere center vector, the parameters of the feature extraction network and the sphere center prediction network are adjusted in directions where the liveness feature vector is closer to the sphere center vector and the spoof feature vector is farther from the sphere center vector. Thus, the feature extraction network learns to extract liveness feature vectors from live face images that are close to the sphere center vector generated by the trained sphere center prediction network, and to extract spoof feature vectors from spoof face images that are far from the sphere center vector generated by the trained sphere center prediction network. Subsequently, by judging whether the feature vectors extracted by the feature extraction network are close to the sphere center vector generated by the sphere center prediction network, it can be determined whether the face image with extracted features is a live face image or a spoof face image, thereby achieving liveness detection. Furthermore, since the live feature vector is close to the sphere's center vector, while the spoof feature vector is far from it, the distribution of live and spoof feature vectors around the center vector will form a sphere. This sphere, with the center vector as its center, contains live feature vectors inside and spoof feature vectors outside. Although the training data is finite, the space outside the sphere is infinite. Therefore, based on this sphere, an infinite number of spoof feature vectors can be represented within this infinite external space. In other words, an infinite number of spoof features can be learned, enabling the recognition of an infinite number of spoofed face images. Even with spoofed face images that the training data cannot cover, accurate liveness detection can still be performed, improving the robustness of the liveness detection model. Attached Figure Description

[0012] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0013] Figure 1 This is a flowchart of a training method for a liveness detection network provided in one embodiment of the present invention;

[0014] Figure 2 This is the present invention. Figure 1 The flowchart of step 102 in the illustrated embodiment is shown.

[0015] Figure 3 This is a flowchart of a training method for a liveness detection network in another embodiment of the present invention, where the liveness detection network includes a sphere radius prediction network.

[0016] Figure 4 This is a flowchart of a training method for a liveness detection network in another embodiment of the present invention, where the liveness detection network includes a sphere spacing prediction network.

[0017] Figure 5 This is a flowchart of a liveness detection method provided in another embodiment of the present invention;

[0018] Figure 6 This is a schematic diagram of the structure of a training device for a liveness detection network provided in another embodiment of the present invention;

[0019] Figure 7 This is a schematic diagram of the structure of a liveness detection device provided in another embodiment of the present invention;

[0020] Figure 8 This is a schematic diagram of the structure of an electronic device provided in another embodiment of the present invention. Detailed Implementation

[0021] As can be seen from the background technology, current prosthetic detection networks based on binary classification networks heavily rely on the diversity of prosthetic face images in the training data, and cannot accurately classify prosthetic types not covered by the training data, resulting in poor robustness.

[0022] Analysis revealed that one of the reasons for this is that binary classification networks need to learn the features of live face images and fake face images through training data. In order to achieve liveness detection, they need to determine whether the features of a face image belong to the features of a live face image or a fake face image. Once a fake face type is not covered by the training data, it is impossible to determine whether it belongs to the features of a live face image or a fake face image, thus failing to obtain an accurate liveness detection result.

[0023] To address the aforementioned problems, this invention provides a training method for a liveness detection network, comprising a feature extraction network and a center prediction network. The method includes: acquiring training data, the training data comprising at least one image group consisting of at least one live face image and one spoof face image; extracting features from the training data based on the feature extraction network to obtain a feature vector group, the feature vector group comprising a liveness feature vector and a spoof feature vector; driving the center prediction network based on the training data to generate a center vector; determining a loss value based on the liveness feature vector, the spoof feature vector, and the center vector; and adjusting the parameters of the feature extraction network and the center prediction network based on the loss value in a direction where the liveness feature vector is closer to the center vector and the spoof feature vector is farther from the center vector.

[0024] The liveness detection network training method provided in this invention involves acquiring training data including at least one image group consisting of a live face image and a spoof face image. Then, a feature extraction network is used to extract features from the training data, resulting in a feature vector group including liveness feature vectors and spoof feature vectors. Furthermore, the training data drives the sphere center prediction network to generate sphere center vectors. Based on the loss value determined by the liveness feature vector, spoof feature vector, and sphere center vector, the parameters of the feature extraction network and the sphere center prediction network are adjusted in directions where the liveness feature vector is closer to the sphere center vector and the spoof feature vector is farther from the sphere center vector. Thus, the feature extraction network learns to extract liveness feature vectors from live face images that are close to the sphere center vector generated by the trained sphere center prediction network, and to extract spoof feature vectors from spoof face images that are far from the sphere center vector generated by the trained sphere center prediction network. Subsequently, by judging whether the feature vectors extracted by the feature extraction network are close to the sphere center vector generated by the sphere center prediction network, it can be determined whether the face image with extracted features is a live face image or a spoof face image, thereby achieving liveness detection. Furthermore, since the live feature vector is close to the sphere's center vector, while the spoof feature vector is far from it, the distribution of live and spoof feature vectors around the center vector will form a sphere. This sphere, with the center vector as its center, contains live feature vectors inside and spoof feature vectors outside. Although the training data is finite, the space outside the sphere is infinite. Therefore, based on this sphere, an infinite number of spoof feature vectors can be represented within this infinite external space. In other words, an infinite number of spoof features can be learned, enabling the recognition of an infinite number of spoofed face images. Even with spoofed face images that the training data cannot cover, accurate liveness detection can still be performed, improving the robustness of the liveness detection model.

[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been presented in the various embodiments of the present invention to enable the reader to better understand the present invention. However, the technical solutions claimed in the present invention can be implemented even without these technical details and various changes and modifications based on the following embodiments.

[0026] The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined with and referenced by each other without contradiction.

[0027] One embodiment of the present invention provides a training method for a liveness detection network, applicable to electronic devices such as computers and servers. The liveness detection network includes a feature extraction network and a center-of-sphere prediction network. The process is as follows: Figure 1 As shown, it includes at least the following steps:

[0028] Step 101: Obtain training data, which includes at least one image group consisting of at least one live human face image and one artificial face image.

[0029] In this embodiment, the live face image is a two-dimensional image obtained by capturing the face of a real user; the spoof face image is a two-dimensional image obtained by capturing a face with props, such as an image obtained by capturing a user's photo or a face captured while wearing a headgear. The training data may include one or more image groups, each image group including at least one live face image and one spoof face image.

[0030] It should be noted that the training data in this embodiment consists of two-dimensional images. Therefore, in the process of constructing the training set to train the liveness detection network and in the subsequent use of the trained liveness detection network, the input images are all static two-dimensional images. This makes the frame rate requirement of the camera module low when acquiring images, which is beneficial to expanding the application scope.

[0031] In some examples, each image set consists of one live face image and one spoof face image. Thus, based on a set of live and spoof face images, the feature distributions of the live and spoof face images in the face image are learned.

[0032] In other examples, each image group includes not only a human face image and a spoofed face image, but also a non-living image, where the non-living image is a two-dimensional image of a subject that is not a living human. This enhances the robustness of the liveness detection network through the non-living image. Specifically, the live face image can smoothly transition to the spoofed face image through the non-living image, resulting in a more coherent distribution of the learned feature vectors, reducing abrupt changes in the distribution, and improving the accuracy of the distribution.

[0033] It should also be noted that steps 101-105 mainly address the live face images and spoof face images included in the image group. When the image group involved in step 101 also includes non-live images, steps 102-105 will undergo adaptive adjustments. For example, step 102 is implemented as follows: feature extraction is performed on the training data based on the feature extraction network. While obtaining live and spoof feature vectors, non-live feature vectors are also obtained. The non-live feature vectors also participate in determining the loss value to assist in the training of the liveness detection network. It can be understood that since the image content of non-live images is not live, from the perspective of liveness detection, the non-live feature vectors are closer to spoof face images. Therefore, when adjusting the network parameters based on the loss value, the adjustment target should be to make the distance between the non-live feature vectors and the center of the sphere greater. That is, step 104 further includes: determining the loss value based on the live feature vector, the spur feature vector, the non-live feature vector, and the sphere center vector; step 105 further includes: adjusting the parameters of the feature extraction network and the sphere center prediction network based on the loss value in the direction where the live feature vector is closer to the sphere center vector and the spur feature vector and the non-live feature vector are both farther from the sphere center vector.

[0034] Step 102: Extract features from the training data based on the feature extraction network to obtain a feature vector group, which includes live feature vectors and prosthetic feature vectors.

[0035] This embodiment does not limit the feature extraction network; it can be a neural network with feature extraction function composed of several convolutional layers, standard normalization layers, and nonlinear activation layers.

[0036] To help those skilled in the art better understand feature extraction networks, the following will illustrate feature extraction networks through examples.

[0037] The feature extraction network consists of three feature subnetworks formed by conventional deep learning networks and one feature fusion subnetwork. The three feature subnetworks are connected in series. The output of the first feature subnetwork is the input of the second feature subnetwork, the output of the second feature subnetwork is the input of the third feature subnetwork, and the outputs of the three feature subnetworks are used together as the input of the feature fusion network.

[0038] Each feature subnetwork comprises several network units. Each network unit consists of a convolutional layer composed of a 1×1 resolution kernel, a convolutional layer composed of an R×R resolution kernel, a standardization layer, and a nonlinear activation layer connected in series. Here, R is an odd-numbered hyperparameter greater than 1. The convolutional layer composed of a 1×1 resolution kernel represents a convolution operation with a step parameter of 1 and a padding parameter of 0. The convolutional layer composed of an R×R resolution kernel represents a convolution operation with a step parameter of 2 and a padding parameter of R-1. Furthermore, the convolutional layer composed of an R×R resolution kernel is a parameter-unlearnable radially symmetric convolutional kernel, where all parameters are greater than 0 and the sum of all parameters is 1.

[0039] The feature fusion subnetwork consists of a pooling layer, a concatenation layer, and a fully connected layer connected in series. The outputs of the three feature subnetworks are pooled to obtain three feature outputs. These three feature outputs are then fed into the concatenation layer to be concatenated, resulting in a single feature vector. Finally, after processing by the fully connected layer, an N-dimensional vector is obtained, where N is a hyperparameter greater than 2.

[0040] Thus, the prosthesis detection network can adapt to changes in the input training data based on its own translational and rotational isovariability, which is beneficial to improving the acceptance rate of live face images and the rejection rate of prosthesis face images.

[0041] Of course, the above are just specific examples. In other examples, the feature extraction network can also be a pyramid-structured convolutional neural network, etc., which will not be elaborated here.

[0042] Furthermore, to enable the feature extraction network to focus more on facial features, the images in the training data can be processed to direct the network's attention to facial features. Therefore, in some embodiments, step 102 can be implemented as follows:

[0043] Step 1021: Select i feature points for each image in the training data, where i is a positive integer.

[0044] In this embodiment, neither i nor the facial features corresponding to the i feature points are limited. In some examples, the i feature points can be one or more of the following: the center of the left eye, the center of the right eye, the tip of the nose, the center of the mouth, etc.

[0045] Step 1022: Determine i target square regions centered on the feature points and with preset lengths as the sides.

[0046] In this embodiment, the side length of the target square region is described using a preset length. In other embodiments, the side length of the target square region can also be determined by the distance between the j-th feature point and the (j+1)-th feature point. For example, half of the Euclidean distance between the j-th feature point and the (j+1)-th feature point can be used as the side length of the target square region corresponding to the j-th feature point. This allows for flexible determination of the target square region, meaning that sufficient information can be obtained for feature extraction without excessive overlap between target square regions, which would lead to repeated extraction of the same features based on different target square regions. Furthermore, in other embodiments, the determined region may not be a square but a circle, etc., which will not be elaborated further here.

[0047] Step 1023: Replace the target square region with the same position in the preset image in sequence to obtain i reference images.

[0048] In this embodiment, the resolution of the preset image is the same as the resolution of the image within the target square region. The preset image can be a randomly selected image with the same resolution as the image within the target square region, or it can be custom-constructed, such as randomly generating pixel values ​​within the pixel value range of the images included in the training data and generating an image with the same number of channels as the images included in the training data based on the generated pixel values. Alternatively, the resolution can be changed to the preset resolution by resizing both the preset image and the images in the training data; in this case, the preset resolution is a hyperparameter.

[0049] Step 1024: The image in the training data and the corresponding i reference images are stitched together to obtain the first stitched image.

[0050] It should be noted that the first stitched image includes the original image from the training data to avoid losing information about the correlation between the reference images. That is, the image in the training data and its corresponding i reference images are stitched together to obtain the first stitched image.

[0051] Step 1025: Extract features from each of the first stitched images to obtain a feature vector group.

[0052] Step 103: Based on the training data, drive the sphere center prediction network to generate sphere center vectors.

[0053] In this embodiment, the center prediction network has no input. When the training data is input into the feature extraction network, it will also drive the center prediction network to perform center prediction.

[0054] It is important to emphasize that the sphere center vector, the living feature vector, and the prosthetic feature vector have the same dimension.

[0055] It should be noted that, Figure 1 This explanation uses the example of executing step 102 first and then step 103. In other cases, steps 102 and 103 can be performed simultaneously, which will not be elaborated here.

[0056] Step 104: Determine the loss value based on the live feature vector, the prosthesis feature vector, and the sphere center vector.

[0057] Step 105: Based on the loss value, adjust the parameters of the feature extraction network and the sphere center prediction network in the direction that the distance between the live feature vector and the sphere center vector is closer and the distance between the spur feature vector and the sphere center vector is farther.

[0058] In this embodiment, the distance between the live feature vector and the sphere center vector, and the distance between the spur feature vector and the sphere center vector, can be Euclidean distance, probability distribution distance, etc. When it is a probability distribution distance, a sufficient number of live feature vectors, spur feature vectors, and sphere center vectors are required; that is, several sets of images need to be input, and the finally learned sphere is a probabilistic sphere.

[0059] It is understandable that, since the parameter adjustment direction is towards a closer distance between the live feature vector and the sphere center vector, and a greater distance between the prosthetic feature vector and the sphere center vector, the loss function used to determine the loss value should include terms positively correlated with the distance from the live feature vector to the sphere center vector and terms negatively correlated with the distance from the prosthetic feature vector to the sphere center vector, in order to facilitate adjustment. Furthermore, to facilitate a better understanding of the relevant embodiments by those skilled in the art, the following description will use the distances between the live feature vector and the sphere center vector, and the distances between the prosthetic feature vector and the sphere center vector, as probability distribution distances, as examples, and does not imply that only probability distribution distances can be used.

[0060] In some examples, the loss function used to determine the loss value can be: ∑ b pdd (b,1) -∑ b pdd (b,2) ,in, When k=1, it corresponds to a live human face image; when k=2, it corresponds to a prosthetic face image. (b,k) Let represent the probability distribution distance between the live (pseudonym) feature vector and the sphere center vector of the live (pseudonym) face image in the b-th image group. Let represent the probability distribution of the liveness (prosthetic) feature vectors of the live face images in the b-th image group of the training data. This represents the probability distribution of the sphere center vectors generated by the sphere center prediction network driven by the live (pseudo) face image in the b-th image group of the training data. Let n represent the nth dimension of the liveness (prosthetic) face feature vector of the b-th image group in the training data. Let pddf(P, Q) represent the nth dimension feature of the sphere center vector of the prosthetic face image in the b-th image group of the training data, and let pddf(P, Q) represent the probability distribution distance between probability distributions P and Q, such as relative entropy.

[0061] In this embodiment, both the feature extraction network and the sphere center prediction network are adjusted in the direction of reducing the loss value. Thus, when the neural network learns and adjusts in the direction of reducing the loss value, the closer the live feature vector is to the sphere center vector, the farther the spur feature vector is from the sphere center vector. Since distance is independent of direction, this compresses the live feature vector into the sphere and distributes the spur feature vector outside the sphere. This allows the liveness detection network, composed of the feature extraction network and the sphere center prediction network, to learn the feature distribution of both live and spur face images. Furthermore, it learns the infinite possible positions of the spur face image outside the sphere based on limited training data; that is, it learns features representing various types of spurs distributed in the infinite space outside the sphere, thus covering all types of spurs.

[0062] It should be noted that the predicted feature distribution is based on a probability-based spherical shell, and the radius of the sphere containing the shell is a preset value.

[0063] Considering that different scenarios may correspond to different sphere radii, i.e., different probability-based spherical shell distributions, a sphere radius prediction network can be included in the liveness detection network to better learn the probability-based spherical shell distribution. This allows the liveness detection network to flexibly and accurately predict the sphere radius in the probability-based spherical shell distribution based on the sphere radius prediction network, improving the robustness and accuracy of the probability-based spherical shell distribution. Based on this, as... Figure 3 As shown, in some embodiments, the training method for the liveness detection network further includes at least the following steps:

[0064] Step 106: Drive the sphere radius prediction network based on the training data to generate the sphere radius value corresponding to the live feature vector.

[0065] In this embodiment, the sphere radius prediction network has no input. When the training data is input into the feature extraction network, it also drives the sphere radius prediction network to predict the sphere radius. The output of the sphere radius prediction network is a 1×1 dimensional vector.

[0066] Accordingly, step 104 can be implemented as follows: determine the loss value based on the live feature vector, the spur feature vector, the sphere center vector, and the sphere radius value. Step 105 can be implemented as follows: based on the loss value, adjust the parameters of the feature extraction network, the sphere center prediction network, and the sphere radius prediction network in the direction where the distance from the live feature vector to the sphere center vector does not exceed the sphere radius value, and the distance from the spur feature vector to the sphere center vector exceeds the sphere radius value but the sphere radius value is smaller.

[0067] In some examples, the loss function used to determine the loss value can be:

[0068] in, This represents the predicted sphere radius value driven by the sphere radius prediction network based on the b-th image group in the training data, where k=1. This represents the predicted sphere radius value driven by the sphere radius prediction network based on the live face image in the b-th image group of the training data, when k=2. This represents the predicted sphere radius value driven by the spoofed face image in the b-th image group of the training data.

[0069] To ensure that the minimum distance between the final live body distribution and the prosthetic body distribution is greater than zero, the live body detection network can also include a spherical interval prediction network for learning and predicting spherical intervals, improving the robustness and accuracy of the probability-based spherical shell distribution. Based on this, in some embodiments, such as... Figure 4 As shown, the training method for the liveness detection network includes at least the following steps:

[0070] Step 107: Drive the sphere interval prediction network based on the training data to generate sphere interval values ​​corresponding to the live feature vector.

[0071] In this embodiment, the sphere spacing prediction network has no input. When the training data is input into the feature extraction network, it also drives the sphere spacing prediction network to predict sphere spacing. The output of the sphere spacing prediction network is a 1×1 dimensional vector.

[0072] Accordingly, step 104 can be implemented as follows: determine the loss value based on the live feature vector, the spur feature vector, the sphere center vector, and the sphere spacing value; step 105 can be implemented as follows: based on the loss value, adjust the parameters of the feature extraction network, the sphere center prediction network, and the sphere spacing prediction network in the direction where the distance from the live feature vector to the sphere center vector does not exceed the difference between the sphere radius and the sphere spacing value, and the distance from the spur feature vector to the sphere center vector exceeds the sum of the sphere radius and the sphere spacing value, and the sphere spacing value is larger.

[0073] In some examples, the loss function used to determine the loss value can be: in, This represents the predicted sphere spacing value driven by the sphere spacing prediction network based on the b-th image group in the training data. When k=1, This represents the predicted sphere spacing value driven by the sphere spacing prediction network based on the live face image in the b-th image group of the training data. When k=2, This represents the predicted sphere spacing value driven by the sculpted face image in the b-th image group of the training data.

[0074] Specifically, in some embodiments where the liveness detection network includes both a sphere radius prediction network and a sphere spacing prediction network, step 104 is implemented as follows: A loss value is determined based on the liveness feature vector, the spurious feature vector, the sphere center vector, the sphere radius value, and the sphere spacing value. Step 105 is implemented as follows: Based on the loss value, the parameters of the feature extraction network, the sphere center prediction network, the sphere spacing prediction network, and the sphere radius prediction network are adjusted in the following directions: the distance from the liveness feature vector to the sphere center vector does not exceed the difference between the sphere radius value and the sphere spacing value; the distance from the spurious feature vector to the sphere center vector exceeds the sum of the sphere radius value and the sphere spacing value; and the sphere spacing value is larger while the sphere radius value is smaller. The sphere radius value is generated by the sphere radius prediction network based on training data.

[0075] In some cases, where the liveness detection network includes both a sphere radius prediction network and a sphere spacing prediction network, the loss value can be determined using the following loss function:

[0076] In some examples, constraints on the sphere spacing and sphere radius are also considered. For instance, step 105 is implemented as follows: Based on the loss value, the parameters of the feature extraction network, sphere center prediction network, sphere spacing prediction network, and sphere radius prediction network are adjusted in the following directions: the distance from the live feature vector to the sphere center vector does not exceed the difference between the sphere radius and the sphere spacing; the distance from the spurious feature vector to the sphere center vector exceeds the sum of the sphere radius and the sphere spacing; the sphere spacing is larger; the sphere radius is smaller; and the ratio of the sphere radius to the sphere spacing is closer to a preset ratio. The loss function used when determining the loss value may also include: in, This represents the predicted sphere spacing value driven by the sphere spacing prediction network based on the b-th image group in the training data. This represents the predicted sphere radius value driven by the sphere radius prediction network based on the b-th image in the training data. k=1 corresponds to a live face image, and k=2 corresponds to a fake face image.

[0077] In some embodiments, where the image group also includes a non-living image, since the non-living image is closer to the spoofed face image than the living face image, the non-living feature vector in the loss function involved in the above embodiments should have the same representation as the spoofed feature vector when determining the loss value. To facilitate a better understanding of the representation of non-living features in the loss function by those skilled in the art, the loss function will be described below with a specific expression, wherein the image group includes one living face image, one spoofed face image, and one non-living image.

[0078]

[0079]

[0080]

[0081]

[0082] Among them, w net Let be the loss value, α1, α2, α3, α4, and α5 be hyperparameters greater than 0, and B represent the number of image groups in the training data. pdd represents the sphere radius value obtained by the image-driven sphere radius prediction network. (b,k) This represents the probability distribution distance between the features extracted by the image feature extraction network and the sphere center vector obtained by the image-driven sphere center prediction network. This represents the sphere center vector obtained by the image-driven sphere center prediction network. The value represents the spherical spacing obtained by the image-driven spherical spacing network. k=1 indicates that the image is a live human face image, k=2 indicates that the image is a fake human face image, and k=3 indicates that the image is a non-live human face image.

[0083] It should be noted that the above expression takes the example of writing the distance terms of the first probability distribution, the second probability distribution, and the third probability distribution together with the radius loss term and the interval loss term in a single expression, and additionally introducing "0" to ensure that the loss value is always greater than 0. This does not mean that the loss value can only be achieved through the above expression. In other embodiments, the distance terms of the first probability distribution, the second probability distribution, and the third probability distribution, the radius loss term, and the interval loss term can be combined in other ways, which will not be elaborated here.

[0084] When the distances between the live feature vector and the center vector of the sphere, and the distances between the spur feature vector and the center vector of the sphere, are probability distribution distances, the training method for the liveness detection network is actually a probabilistic spherical shell-based training method. The output of the liveness detection network, composed of a feature extraction network and a center prediction network, forms a probabilistic spherical shell, and the probability distribution of the center of the sphere containing this shell is... When the liveness detection network also includes a sphere radius prediction network and a sphere spacing prediction network, the inner radius of the spherical shell is... The outer radius of the spherical shell is The features of a live human face image are distributed inside the spherical shell, while the features of a prosthetic face image and a non-live human face image are distributed in any region outside the spherical shell.

[0085] Another embodiment of the present invention provides a liveness detection method, applied to, the process of which is as follows: Figure 5 As shown, it includes at least the following steps:

[0086] Step 501: Obtain the face image of the person to be tested.

[0087] Step 502: Input the face image to be tested into the liveness detection network to obtain the feature vector to be tested and the predicted sphere center vector.

[0088] It should be emphasized that the liveness detection network involved in this embodiment is trained according to the training method of the liveness detection network provided in the foregoing embodiments.

[0089] Step 503: Detect whether the distance between the feature vector to be tested and the predicted sphere center vector is less than the reference value. If yes, proceed to step 504; otherwise, proceed to step 505.

[0090] In some cases, the reference value is a preset sphere radius.

[0091] In other examples, the liveness detection network includes a sphere radius prediction network, where the reference value can be the predicted sphere radius value output by the liveness detection network based on the face image to be tested.

[0092] It should be noted that the distance can be Euclidean distance, probability distribution distance, etc., and its meaning is the same as that of the distance between the live face image and the center vector of the sphere used when training the liveness detection network. It will not be elaborated on here.

[0093] Step 504: Determine that the face image to be tested is a live image.

[0094] Step 505: Determine that the face image to be tested is a fake image.

[0095] The liveness detection method provided in this embodiment has a small algorithm network size and low computational load, which can be deployed on hardware chips with limited computing power, thus expanding its application scope. Furthermore, it can also perform liveness detection on videos composed of individual frames.

[0096] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.

[0097] Another aspect of this invention provides a training apparatus for a liveness detection network, which includes a feature extraction network and a center-of-sphere prediction network, such as... Figure 6 As shown, the training device for the liveness detection network includes:

[0098] The first acquisition module 601 is used to acquire training data, which includes at least one image group consisting of a live human face image and a fake human face image.

[0099] The feature extraction module 602 is used to extract features from the training data based on the feature extraction network to obtain a feature vector group, which includes live feature vectors and spur feature vectors.

[0100] The prediction module 603 is used to drive the sphere center prediction network based on the training data to generate sphere center vectors.

[0101] The loss determination module 604 is used to determine the loss value based on the live feature vector, the spur feature vector, and the sphere center vector.

[0102] The adjustment module 605 is used to adjust the parameters of the feature extraction network and the sphere center prediction network according to the loss value, in the direction that the distance between the live feature vector and the sphere center vector is closer and the distance between the spur feature vector and the sphere center vector is farther.

[0103] Another aspect of the present invention provides a liveness detection device, such as... Figure 7 As shown, it includes:

[0104] The second acquisition module 701 is used to acquire the face image to be detected.

[0105] The input module 702 is used to input the face image to be detected into the liveness detection network to obtain the feature vector to be detected and the predicted sphere center vector; the liveness detection network is trained according to the training method of the liveness detection network provided in the above embodiment.

[0106] The detection module 703 is used to detect whether the distance between the feature vector to be tested and the predicted sphere center vector is less than a reference value.

[0107] The first determining module 704 is used to determine that the face image to be tested is a live image when it is detected to be less than a reference value.

[0108] The second determining module 705 is used to determine that the face image to be tested is a fake image when a value not less than a reference value is detected.

[0109] It is not difficult to see that the above-described apparatus embodiments correspond to the method embodiments, and the apparatus embodiments can be implemented in conjunction with the method embodiments. The relevant technical details mentioned in the method embodiments remain valid in the apparatus embodiments, and will not be repeated here to avoid repetition. Correspondingly, the relevant technical details mentioned in the apparatus embodiments can also be applied to the method embodiments.

[0110] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by this invention; however, this does not mean that other units are absent from this embodiment.

[0111] Another aspect of the present invention provides an electronic device, such as... Figure 8 As shown, it includes: at least one processor 801; and a memory 802 communicatively connected to at least one processor 801; wherein the memory 802 stores instructions executable by at least one processor 801, which are executed by at least one processor 801 to enable at least one processor 801 to perform the method described in any of the above method embodiments.

[0112] The memory 802 and processor 801 are connected via a bus, which can include any number of interconnecting buses and bridges. The bus connects various circuits of one or more processors 801 and memory 802. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 801 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 801.

[0113] Processor 801 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 802 can be used to store data used by processor 801 during operation.

[0114] Another aspect of the present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the above-described method embodiments.

[0115] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0116] Those skilled in the art will understand that the above embodiments are specific embodiments for implementing the present invention, and in practical applications, various changes in form and detail may be made without departing from the spirit and scope of the present invention.

Claims

1. A training method for a liveness detection network, characterized in that, The liveness detection network includes a feature extraction network and a sphere center prediction network, and the method includes: Acquire training data, which includes at least one image group consisting of at least one live human face image and one spoof face image; Based on the feature extraction network, feature extraction is performed on the training data to obtain a feature vector group, which includes a live feature vector and a prosthesis feature vector. The ball center prediction network is driven by the training data to generate ball center vectors; The loss value is determined based on the live feature vector, the prosthesis feature vector, and the sphere center vector; Based on the loss value, the parameters of the feature extraction network and the sphere center prediction network are adjusted in the direction that the distance between the live feature vector and the sphere center vector is closer and the distance between the spur feature vector and the sphere center vector is farther. The loss function used to determine the loss value includes at least the following loss terms: and ,in, When k=1, it corresponds to a live human face image; when k=2, it corresponds to a fake human face image. This represents the probability distribution distance between the liveness feature vector of the live face image in the b-th image group and the center vector of the sphere, or the probability distribution distance between the spoof feature vector of the spoof face image in the b-th image group and the center vector of the sphere. , , This represents the probability distribution of the liveness feature vector of the live face image in the b-th image group of the training data, or the probability distribution of the spoof feature vector of the spoof face image in the b-th image group of the training data. This represents the probability distribution of the center vector generated by the center prediction network driven by the live face image in the b-th image group of the training data, or the probability distribution of the center vector generated by the center prediction network driven by the spoof face image in the b-th image group of the training data. This represents the nth dimension of the liveness feature vector of the live face image in the b-th image group of the training data, or the nth dimension of the spoof feature vector of the spoof face image in the b-th image group of the training data, pddf( ) represents the probability distribution and probability distribution The probability distribution distance.

2. The training method for the liveness detection network according to claim 1, characterized in that, The image group also includes non-living images, and the feature vector group also includes non-living feature vectors; The loss value is determined based on the live feature vector, the prosthesis feature vector, and the sphere center vector, including: The loss value is determined based on the live feature vector, the spur feature vector, the non-live feature vector, and the sphere center vector; The step of adjusting the parameters of the feature extraction network and the sphere center prediction network according to the loss value in a direction that makes the distance between the live feature vector and the sphere center vector closer and the distance between the spur feature vector and the sphere center vector farther, includes: Based on the loss value, the parameters of the feature extraction network and the center prediction network are adjusted in the direction that the living feature vector is closer to the center vector and the spur feature vector and the non-living feature vector are farther from the center vector.

3. The training method for the liveness detection network according to claim 1 or 2, characterized in that, The liveness detection network further includes a sphere radius prediction network. Before determining the loss value based on the liveness feature vector, the spurious feature vector, and the sphere center vector, the method further includes: The training data drives the sphere radius prediction network to generate a sphere radius value corresponding to the living feature vector; The step of determining the loss value based on the living feature vector, the prosthesis feature vector, and the sphere center vector includes: The loss value is determined based on the live feature vector, the prosthesis feature vector, the sphere center vector, and the sphere radius value; The step of adjusting the parameters of the feature extraction network and the sphere center prediction network according to the loss value in a direction that makes the distance between the live feature vector and the sphere center vector closer and the distance between the spur feature vector and the sphere center vector farther, includes: Based on the loss value, the parameters of the feature extraction network, the center prediction network, and the radius prediction network are adjusted in the direction where the distance from the living feature vector to the center vector does not exceed the radius value of the sphere, and the distance from the spurious feature vector to the center vector exceeds the radius value of the sphere but the radius value is smaller.

4. The training method for the liveness detection network according to claim 1 or 2, characterized in that, The liveness detection network further includes a spherical spacing prediction network. Before determining the loss value based on the liveness feature vector, the spurious feature vector, and the spherical center vector, the method further includes: The training data drives the sphere spacing prediction network to generate sphere spacing values ​​corresponding to the live feature vector; The step of determining the loss value based on the living feature vector, the prosthesis feature vector, and the sphere center vector includes: The loss value is determined based on the live feature vector, the prosthesis feature vector, the sphere center vector, and the sphere spacing value; The step of adjusting the parameters of the feature extraction network and the sphere center prediction network according to the loss value in a direction that makes the distance between the live feature vector and the sphere center vector closer and the distance between the spur feature vector and the sphere center vector farther, includes: Based on the loss value, the parameters of the feature extraction network, the center prediction network, and the sphere spacing prediction network are adjusted in the direction where the distance from the live feature vector to the center vector does not exceed the difference between the sphere radius and the sphere spacing value, the distance from the spurious feature vector to the center vector exceeds the sum of the sphere radius and the sphere spacing value, and the sphere spacing value is larger.

5. The training method for the liveness detection network according to claim 4, characterized in that, When the liveness detection network further includes a sphere radius prediction network, adjusting the parameters of the feature extraction network, the sphere center prediction network, and the sphere interval prediction network according to the loss value in the direction where the distance from the liveness feature vector to the sphere center vector does not exceed the difference between the sphere radius and the sphere interval value, and the distance from the spurious feature vector to the sphere center vector exceeds the sum of the sphere radius and the sphere interval value, and the sphere interval value is larger, includes: Based on the loss value, the parameters of the feature extraction network, the center prediction network, the sphere spacing prediction network, and the sphere radius prediction network are adjusted in the following directions: the distance from the live feature vector to the center vector does not exceed the difference between the sphere radius value and the sphere spacing value; the distance from the spurious feature vector to the center vector exceeds the sum of the sphere radius value and the sphere spacing value; and the sphere spacing value is larger and the sphere radius value is smaller. The sphere radius value is generated by the sphere radius prediction network based on the training data.

6. The training method for the liveness detection network according to claim 5, characterized in that, The step of adjusting the parameters of the feature extraction network, the center-of-sphere prediction network, the sphere spacing prediction network, and the sphere radius prediction network according to the loss value includes: the distance from the live feature vector to the center-of-sphere vector does not exceed the difference between the sphere radius value generated by the sphere radius prediction network based on the training data and the sphere spacing value; the distance from the prosthetic feature vector to the center-of-sphere vector exceeds the sum of the sphere radius value generated by the sphere radius prediction network based on the training data and the sphere spacing value; and the sphere spacing value is larger and the sphere radius value generated by the sphere radius prediction network based on the training data is smaller. Based on the loss value, the parameters of the feature extraction network, the sphere center prediction network, the sphere interval prediction network, and the sphere radius prediction network are adjusted in the following directions: the distance from the live feature vector to the sphere center vector does not exceed the difference between the sphere radius value and the sphere spacing value; the distance from the spurious feature vector to the sphere center vector exceeds the sum of the sphere radius value and the sphere spacing value; the sphere spacing value is larger; the sphere radius value is smaller; and the ratio of the sphere radius value to the sphere spacing value is closer to a preset ratio. The sphere radius value is generated by the sphere radius prediction network based on the training data.

7. The training method for the liveness detection network according to claim 1 or 2, characterized in that, The step of extracting features from the training data based on the feature extraction network to obtain a set of feature vectors includes: For each image in the training data, select i feature points, where i is a positive integer; i target square regions are determined with the feature points as centers and a preset length as the side length; The target square region is sequentially replaced with the same position in a preset image to obtain i reference images; The images in the training data are stitched together with the corresponding i reference images to obtain the first stitched image; Feature extraction is performed on each of the first stitched images to obtain the feature vector group.

8. A method for detecting liveness, characterized in that, include: Acquire the face image of the person to be tested; The face image to be tested is input into the liveness detection network to obtain the feature vector to be tested and the predicted sphere center vector. The liveness detection network is trained using the training method for a liveness detection network according to any one of claims 1 to 7; Detect whether the distance between the feature vector to be tested and the predicted sphere center vector is less than a reference value; If the detected value is less than the reference value, the face image to be tested is determined to be a live image; If the detected value is not less than the reference value, the face image to be tested is determined to be a fake image.

9. The liveness detection method according to claim 8, characterized in that, The reference value is the preset sphere radius used when training the liveness detection network.

10. The liveness detection method according to claim 8, characterized in that, When the liveness detection network includes a sphere radius prediction network, the reference value is the predicted sphere radius value generated by the liveness detection network based on the face image to be tested.

11. A training device for a liveness detection network, characterized in that, The liveness detection network includes a feature extraction network and a sphere center prediction network, and the device includes: The first acquisition module is used to acquire training data, which includes at least one image group consisting of at least one live human face image and one spoof face image. The feature extraction module is used to extract features from the training data based on the feature extraction network to obtain a feature vector group, wherein the feature vector group includes a live feature vector and a prosthesis feature vector. The prediction module is used to drive the sphere center prediction network based on the training data to generate sphere center vectors; The loss determination module is used to determine the loss value based on the living feature vector, the prosthesis feature vector, and the sphere center vector; An adjustment module is used to adjust the parameters of the feature extraction network and the sphere center prediction network according to the loss value, in the direction where the distance between the live feature vector and the sphere center vector is closer and the distance between the spur feature vector and the sphere center vector is farther. The loss function used to determine the loss value includes at least the following loss terms: and ,in, When k=1, it corresponds to a live human face image; when k=2, it corresponds to a fake human face image. This represents the probability distribution distance between the liveness feature vector of the live face image in the b-th image group and the center vector of the sphere, or the probability distribution distance between the spoof feature vector of the spoof face image in the b-th image group and the center vector of the sphere. , , This represents the probability distribution of the liveness feature vector of the live face image in the b-th image group of the training data, or the probability distribution of the spoof feature vector of the spoof face image in the b-th image group of the training data. This represents the probability distribution of the sphere center vector generated by the sphere center prediction network driven by the prosthetic face image in the b-th image group of the training data, or the probability distribution of the sphere center vector generated by the sphere center prediction network driven by the live face image in the b-th image group of the training data. This represents the nth dimension of the liveness feature vector of the live face image in the b-th image group of the training data, or the nth dimension of the spoof feature vector of the spoof face image in the b-th image group of the training data, pddf( ) represents the probability distribution and probability distribution The probability distribution distance.

12. A liveness detection device, characterized in that, include: The second acquisition module is used to acquire the face image of the person to be tested; The input module is used to input the face image to be tested into the liveness detection network to obtain the feature vector to be tested and the predicted sphere center vector; the liveness detection network is trained by the training method of the liveness detection network according to any one of claims 1 to 7; The detection module is used to detect whether the distance between the feature vector to be tested and the predicted sphere center vector is less than a reference value; The first determining module is used to determine that the face image to be tested is a live image when it is detected to be less than the reference value; The second determining module is used to determine that the face image to be tested is a fake image if it is detected to be not less than the reference value.

13. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform a training method for a liveness detection network as described in any one of claims 1 to 7, or to perform a liveness detection method as described in any one of claims 8 to 10.

14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the training method for the liveness detection network as described in any one of claims 1 to 7, or implements the liveness detection method as described in any one of claims 8 to 10.

Citation Information

Patent Citations

  • Human face living body detection method and device, computer equipment and storage medium

    CN111767900A