A living body detection method, device and computer equipment
By acquiring facial images and reference feature sets, performing feature extraction and distribution fitting, the accuracy problem of existing liveness detection models under unknown attack types is solved, achieving higher detection accuracy and reliability.
Patent Information
- Application Number
- CN202111538820.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2041-12-15
AI Technical Summary
Existing liveness detection models have uncertain prediction accuracy when facing unknown attack types, affecting the accuracy and reliability of detection.
By acquiring facial images and reference feature sets of the object to be detected, feature extraction and liveness feature mapping are performed. Combined with distribution fitting techniques, liveness detection results are generated, improving the accuracy and reliability of detection.
It improves the accuracy and reliability of liveness detection, effectively identifies known and unknown attack types, and enhances the system's generalization ability.
Smart Images

Figure CN116266419B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, and computer device for detecting liveness. Background Technology
[0002] With the development of artificial intelligence technology, facial recognition technology has been widely applied in fields such as security and finance. In the facial recognition process, in addition to identity verification, liveness detection is also required. Liveness detection determines whether the person being verified is a real, living individual, rather than relying on attacks using photos, videos, or masks. Liveness detection effectively resists attacks using photos, videos, and masks, thus helping users identify fraudulent activities and protecting their interests.
[0003] In the process of researching and practicing existing technologies, the inventors of this application discovered that when using artificial intelligence (AI) technology for liveness detection, the AI model is often trained using samples of known attack types to obtain a liveness detection model. Then, the trained liveness detection model is used to detect the target object. However, since current AI technology is a data-driven learning method, the prediction accuracy of the liveness detection model is relatively high against known attack types. But when the attack type is unknown to the liveness detection model, the prediction accuracy becomes highly uncertain, which affects the accuracy and reliability of liveness detection. Summary of the Invention
[0004] This application provides a liveness detection method, apparatus, and computer device that can improve the accuracy and reliability of liveness detection.
[0005] This application provides a liveness detection method, including:
[0006] Obtain a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature;
[0007] Feature extraction is performed on the facial image to obtain the image feature information of the facial image;
[0008] Perform liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information;
[0009] Based on the at least one reference liveness feature information, liveness discrimination processing is performed on the image feature information to obtain the discrimination result of the image feature information;
[0010] Based on the image feature information, a distribution fitting process is performed on the at least one reference feature to obtain a distribution fitting result for the image feature information;
[0011] Based on the discrimination result and the distribution fitting result, liveness detection is performed on the object to be detected.
[0012] Accordingly, embodiments of this application also provide a liveness detection device, including:
[0013] An acquisition unit is used to acquire a facial image of the object to be detected and a reference feature set, wherein the feature distribution in the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature;
[0014] A feature extraction unit is used to extract features from the facial image to obtain image feature information of the facial image;
[0015] A feature mapping unit is used to perform live feature mapping processing on the at least one reference feature to obtain at least one reference live feature information;
[0016] The discrimination unit is used to perform liveness discrimination processing on the image feature information based on the at least one reference liveness feature information to obtain the discrimination result of the image feature information;
[0017] The distribution fitting unit is used to perform distribution fitting processing on the at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information.
[0018] A liveness detection unit is used to perform liveness detection on the object to be detected based on the discrimination result and the distribution fitting result.
[0019] In one embodiment, the distribution fitting unit may include:
[0020] The gradient operation subunit is used to perform gradient operation on the at least one reference feature to obtain the gradient information of each reference feature.
[0021] The convergence subunit is used to perform convergence processing on the gradient information of each reference feature based on the image feature information to obtain the converged information of each reference feature.
[0022] The result determination subunit is used to determine the distribution fitting result based on the convergence information of each reference feature.
[0023] In one embodiment, the result determining subunit may include:
[0024] The distribution analysis module is used to perform distribution analysis on the image feature information based on the converged information of each reference feature, so as to obtain the image feature distribution of the image feature information;
[0025] The similarity calculation module is used to calculate the distribution similarity between the image feature distribution and the target feature distribution;
[0026] The comparison module is used to compare the distribution similarity with the preset distribution discrimination conditions to obtain the distribution fitting result.
[0027] In one embodiment, the discrimination unit may include:
[0028] A similarity calculation subunit is used to perform similarity calculation processing on the at least one reference live feature information and the image feature information to obtain the feature similarity between each reference live feature information and the image feature information;
[0029] The index conversion subunit is used to perform index conversion processing on the feature similarity based on a preset liveness detection standard to obtain the target index corresponding to the feature similarity.
[0030] The comparison subunit is used to compare the target index with the preset discrimination index to obtain the discrimination result.
[0031] In one embodiment, the feature extraction unit may include:
[0032] A pixel extraction subunit is used to extract pixels from the facial image to obtain the pixel information of the facial image;
[0033] The convolution operation subunit is used to perform convolution operation on the pixel information to obtain the convolution information of the facial image;
[0034] A normalization subunit is used to normalize the convolutional information to obtain the normalized information of the facial image;
[0035] The nonlinear transformation subunit is used to perform nonlinear transformation on the normalized information to obtain the feature information of the facial image.
[0036] In one embodiment, the feature mapping unit may include:
[0037] A fully connected subunit is used to perform fully connected processing on the reference feature to obtain fully connected information corresponding to the reference feature;
[0038] The classification subunit is used to classify the reference feature based on the fully connected information to obtain the classification result corresponding to the reference feature;
[0039] The mapping subunit is used to map the reference features to a preset live feature space based on the classification result, so as to obtain the reference live feature information.
[0040] In one embodiment, the liveness detection device further includes:
[0041] The model acquisition unit is used for the feature extraction model and the feature generation model to be trained.
[0042] The acquisition unit is used to acquire multiple facial image training samples and a reference feature sample set whose feature distribution conforms to the target feature distribution. The reference feature sample set includes multiple reference feature training samples.
[0043] The training unit is used to train the feature extraction model and the feature generation model to be trained using the multiple facial image training samples and the multiple reference feature training samples, so as to obtain the preset feature extraction model and the preset feature generation model.
[0044] In one embodiment, the training unit may include:
[0045] The feature extraction subunit is used to extract features from the facial image training samples using the feature extraction model to be trained, so as to obtain the image sample feature information of the facial image training samples.
[0046] The liveness feature mapping subunit is used to perform liveness feature mapping processing on the reference feature training sample using the feature generation model to be trained, so as to obtain the liveness feature information of the sample.
[0047] The loss calculation subunit is used to calculate the feature loss information and distribution loss information corresponding to the image sample feature information based on the sample liveness feature information and the reference feature training sample.
[0048] The parameter adjustment subunit is used to adjust the parameters of the feature extraction model to be trained based on the feature loss information to obtain the preset feature extraction model, and to adjust the parameters of the feature generation model to be trained based on the distribution loss information to obtain the preset feature generation model.
[0049] In one embodiment, the loss calculation subunit may include:
[0050] The first loss calculation module is used to calculate the feature loss information between the image sample feature information and the sample liveness feature information using a preset discrimination module;
[0051] The second loss calculation module is used to calculate the distribution loss information between the image sample feature information and the reference feature training sample using a preset distribution fitting module.
[0052] In one embodiment, the liveness detection device further includes:
[0053] The instruction receiving unit is used to receive liveness detection trigger instructions;
[0054] The video acquisition unit is used to acquire a video of the subject's face based on the liveness detection trigger command.
[0055] An image conversion unit is used to convert the video to be detected into at least one image to be detected;
[0056] A face detection unit is used to perform face detection processing on the at least one image to be detected to obtain a detection result;
[0057] An image determination unit is used to determine the facial image in the at least one image to be detected based on the detection result.
[0058] In one embodiment, the image determination unit may include:
[0059] A face discrimination subunit is used to perform face discrimination processing on the at least one image to be detected based on the detection result, and obtain a discrimination result;
[0060] A facial image filtering subunit is used to filter out an initial facial image from the at least one image to be detected based on the discrimination result;
[0061] A face registration subunit is used to perform face registration on the initial face image to obtain the position information of at least one facial key point in the initial face image.
[0062] A filtering subunit is used to filter out target facial key points from the at least one facial key point based on the location information of the facial key points.
[0063] A generation subunit is used to generate the facial image based on the location information of the target facial key points.
[0064] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative embodiments described above.
[0065] Accordingly, this application also provides a storage medium storing instructions that, when executed by a processor, implement any of the liveness detection methods provided in this application.
[0066] This application embodiment can acquire a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature; feature extraction is performed on the facial image to obtain image feature information of the facial image; liveness feature mapping processing is performed on at least one reference feature to obtain at least one reference liveness feature information; based on at least one reference liveness feature information, liveness discrimination processing is performed on the image feature information to obtain a discrimination result of the image feature information; based on the image feature information, distribution fitting processing is performed on at least one reference feature to obtain a distribution fitting result for the image feature information; based on the discrimination result and the distribution fitting result, liveness detection is performed on the object to be detected, thereby improving the accuracy and reliability of liveness detection. Attached Figure Description
[0067] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0068] Figure 1 This is a schematic diagram of a scenario for the liveness detection method provided in the embodiments of this application;
[0069] Figure 2 This is a schematic flowchart of the liveness detection method provided in the embodiments of this application;
[0070] Figure 3 This is a scene illustration of the facial image provided in the embodiments of this application;
[0071] Figure 4 This is a scene diagram of facial key points provided in an embodiment of this application;
[0072] Figure 5 This is a schematic diagram of a face detection scenario provided in an embodiment of this application;
[0073] Figure 6 This is another scenario illustration of the liveness detection method provided in the embodiments of this application;
[0074] Figure 7 This is another schematic flowchart of the liveness detection method provided in the embodiments of this application;
[0075] Figure 8 This is a schematic diagram of a scenario for the terminal provided in an embodiment of this application;
[0076] Figure 9 This is a schematic diagram of the structure of the liveness detection device provided in the embodiments of this application;
[0077] Figure 10 It is a structural diagram of the computer device provided in an embodiment of the present application. Detailed Implementation
[0078] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. However, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0079] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0080] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0081] Machine Learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instruction-based learning. Reinforcement learning, a subfield of machine learning, emphasizes how to act based on the environment to maximize expected benefits. Deep reinforcement learning combines deep learning and reinforcement learning, using deep learning techniques to solve reinforcement learning problems.
[0082] With the rapid development of artificial intelligence (AI) technology, it is being applied to an increasing number of scenarios. For example, AI can be used for liveness detection. Deep learning or reinforcement learning can be applied to liveness detection, and so on. For instance, a specific scenario could be when a user logs into a service requiring identity authentication in an instant messaging application; the liveness detection function can be used to verify the user's identity. Another scenario is when a user logs into a game; because the user's identity is identified as a minor, a timer is started from the beginning of the game, and the game automatically exits when a certain threshold is reached to prevent user addiction. Please note that the user's facial data and other data mentioned in this application are all data authorized by the user or from a legal source.
[0083] In one embodiment, when using artificial intelligence technology for liveness detection, the entire process can be divided into three stages: a training stage, a testing stage, and a prediction stage.
[0084] The training phase refers to using a training set to train an artificial intelligence model, so that the trained artificial intelligence model can achieve the function of liveness detection.
[0085] The testing phase refers to using a test set to test the trained AI model, thereby determining whether the model's performance meets the requirements based on the test results. If the trained AI model's performance meets the requirements, it can be put into use, i.e., the prediction phase. If the trained AI model's performance does not meet the requirements, the model is trained again until its performance meets the requirements.
[0086] In one embodiment, existing liveness detection algorithms typically consist of a framework of feature extraction and feature classification. Traditional liveness detection methods extract features such as manually designed Local Binary Patterns (LBPs) and then feed these features into a Support Vector Machine (SMV) to classify real people from attackers.
[0087] However, existing liveness detection algorithms use manually designed features such as local binary patterns. Therefore, limited by human design experience, liveness detection methods based on these features often fail when encountering samples that cannot be distinguished by these patterns. Secondly, machine learning algorithms, represented by deep learning, are data-driven learning methods. For test sets that are homologous and similarly distributed to the training set, deep learning methods typically achieve high classification accuracy due to their powerful feature extraction capabilities. However, for test sets that are significantly different from the training set and not homologous or similarly distributed, the predictions of deep learning methods are highly uncertain. Liveness detection involves a variety of attack samples of unknown types, leading to uncertainty in the prediction stage, which greatly limits the scalability of existing liveness detection algorithms.
[0088] Therefore, this application proposes a liveness detection method to address the problems existing in current liveness detection algorithms.
[0089] Specifically, this application proposes a liveness detection method, which can be executed by a liveness detection device integrated into a computer device. The computer device may include at least one of a terminal and a server. That is, the liveness detection method proposed in this application can be executed by a terminal, a server, or jointly by a terminal and a server capable of communicating with each other.
[0090] The terminals can be smartphones, tablets, laptops, personal computers (PCs), smart home devices, wearable electronic devices, VR / AR devices, in-vehicle computers, etc. The servers can be interconnecting servers between multiple heterogeneous systems or backend servers, or they can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms, etc.
[0091] In one embodiment, such as Figure 1 The diagram illustrates the implementation environment of the liveness detection method proposed in this application. This implementation environment may include a terminal 11 and a server 12.
[0092] The terminal 11 can receive a liveness detection trigger command, acquire a facial image of the object to be detected based on the liveness detection trigger command, and then send the facial image to be detected to the server 12 for liveness detection.
[0093] The server 12 may integrate the liveness detection device proposed in the embodiments of this application to implement the liveness detection method proposed in the embodiments of this application.
[0094] In one embodiment, server 12 can acquire a facial image sent by terminal 11 and acquire a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature; perform feature extraction on the facial image to obtain image feature information of the facial image; perform liveness feature mapping processing on at least one reference feature to obtain at least one reference liveness feature information; perform liveness discrimination processing on the image feature information based on at least one reference liveness feature information to obtain a discrimination result of the image feature information; perform distribution fitting processing on at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information; and perform liveness detection on the object to be detected based on the discrimination result and the distribution fitting result to obtain a liveness detection result. Then, server 12 can send the liveness detection result to terminal 11.
[0095] The following will provide a detailed description of each example. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0096] This application will describe the embodiments from the perspective of a liveness detection device, which can be integrated into a computer device, such as a server or a terminal.
[0097] like Figure 2 The present invention provides a liveness detection method, which can be executed by a computer device, and the specific process includes:
[0098] 201. Obtain the facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is the target feature distribution, and the reference feature set includes at least one reference feature.
[0099] The object to be detected can include any object requiring liveness detection. For example, the object to be detected could include a user who needs to be authenticated using an application on a computer device, and so on.
[0100] The facial image can include an image showing an accurate and clear face of the object to be detected. For example, a facial image can refer to an image where the face of the object to be detected occupies most of the image area, and the face of the object to be detected is in the correct orientation without any facial distortion. For example, such as... Figure 3 As shown, Figure 3 The 001 in the image can be a schematic diagram of a face.
[0101] In one embodiment, existing liveness detection algorithms often determine whether an object is alive by using features such as local binary patterns. However, features such as local binary patterns are generally manually designed and rely on human experience. Therefore, liveness detection methods based on such features usually fail when encountering attack types that cannot be distinguished by these patterns. To better prevent both known and unknown types of attacks, embodiments of this application can learn liveness feature information from a liveness feature distribution. Since this liveness feature information is learned from the liveness feature distribution rather than relying on human experience, it has better generalization and reliability when used to determine whether an object is alive.
[0102] The reference feature set can be a collection of data that conforms to the target feature distribution. For example, the parameter feature set can be a collection of vectors that conform to the target feature distribution. Or, for example, the parameter feature set can be a collection of numerical values that conform to the target feature distribution, and so on.
[0103] In one embodiment, to better represent the data in the reference feature set, the data in the reference feature set can be referred to as reference features. That is, reference features in the reference feature set can refer to data whose feature distributions all conform to the target feature distribution.
[0104] In this context, the feature distribution can refer to the probabilistic patterns exhibited by the reference features in a set of reference features. For example, this feature distribution can be a probability distribution. For instance, the feature distribution can include the normal distribution, standard normal distribution, chi-square distribution, binomial distribution, or Poisson distribution, and so on.
[0105] The target feature distribution can be a certain feature distribution that the reference features in the reference feature set conform to. For example, the target feature distribution can be a standard normal distribution. Another example is a chi-square distribution, and so on.
[0106] For example, when the target feature distribution is a standard normal distribution, the reference feature set can be a set of vectors that conform to a standard normal distribution.
[0107] In one embodiment, the reference features in the reference feature set can be obtained through sampling. For example, several vectors can be sampled from multidimensional vectors conforming to a standard normal distribution, and these sampled vectors can be used as reference features. For example, if there are 100 Gaussian vectors conforming to a standard normal distribution, 50 vectors can be sampled from these 100 Gaussian vectors as reference features. Various methods can be used. For example, reference features can be obtained through random sampling.
[0108] In one embodiment, there are multiple ways to acquire the facial image of the object to be detected. For example, the facial image of the object to be detected can be acquired directly or indirectly.
[0109] In one embodiment, when obtaining the facial image of the object to be detected indirectly, it can be done as follows:
[0110] For example, when the computer device is a server, meaning the liveness detection device is integrated into the server, the server can acquire facial images of the object to be detected through a terminal. The terminal can then send the acquired facial images to the server, allowing the server to obtain the facial image of the object to be detected.
[0111] In one embodiment, when acquiring the facial image of the object to be detected directly, it can be done as follows:
[0112] For example, when a computer device is a terminal with a camera, that is, when a liveness detection device is integrated into the terminal, the terminal can receive a liveness detection trigger command and directly acquire the facial image of the object to be detected based on the liveness detection trigger command.
[0113] For example, when the computer device is a server with a camera, the server can receive a liveness detection trigger command and directly acquire the facial image of the object to be detected based on the liveness detection trigger command.
[0114] In one embodiment, when acquiring the facial image of the object to be detected directly, the computer may capture video data of the object through a camera and then detect the facial image from the video data. Specifically, before the step "acquiring the facial image of the object to be detected," the following may be included:
[0115] Receive liveness detection trigger command;
[0116] Based on the liveness detection trigger command, the video of the subject's face is acquired.
[0117] Convert the video to be detected into at least one image to be detected;
[0118] Perform face detection processing on at least one image to be detected to obtain the detection result;
[0119] A facial image is determined from at least one image to be detected based on the detection results.
[0120] The liveness detection trigger instruction includes instructions that trigger the liveness detection device to perform liveness detection on the object to be detected. For example, the liveness detection device may have a liveness detection trigger control. When the object to be detected triggers the liveness detection trigger control, the liveness detection device will receive the liveness detection trigger instruction.
[0121] In one embodiment, after receiving a liveness detection trigger command, the liveness detection device can acquire a video of the subject's face based on the liveness detection command. To obtain a facial image, the liveness detection device can convert the video into at least one image to be detected. Then, the liveness detection device can perform facial detection processing on the at least one image to be detected, obtain a detection result, and determine the facial image from the at least one image to be detected based on the detection result.
[0122] This involves converting the video to be detected into an image to be detected, which means splitting the video into individual video frames, each of which can be an image to be detected.
[0123] In one embodiment, there are multiple ways to convert a video to be detected into an image to be detected. For example, video editing software can be invoked to split the video into individual video frames, thereby obtaining the image to be detected. Alternatively, a video conversion function can be used to convert the video into at least one image to be detected.
[0124] In one embodiment, after obtaining the image to be detected, face detection processing can be performed on the image. Face detection on the image to be detected refers to determining whether the video to be detected captures a face. If the face detection shows that the image to be detected includes the face of the subject, it means that the video to be detected captured a face, and subsequent steps will continue. However, if the face detection shows that the image to be detected does not include the face of the subject, it means that the video to be detected did not capture a face. In this case, subsequent steps will not continue, and the liveness detection device will output a result indicating that liveness detection failed.
[0125] In one embodiment, when the detection result indicates that the image to be detected includes the face of the object to be detected, the facial image can be determined from the image to be detected.
[0126] In one embodiment, when an image to be detected includes the face of an object to be detected, face discrimination processing can be performed on at least one image to be detected first. By performing face discrimination processing on at least one image to be detected, an initial face image can be selected from the at least one image to be detected. The initial face image can refer to the image where the face of the object to be detected is clearest among multiple images to be detected. Furthermore, to improve the accuracy of liveness detection, after selecting the initial face image, it can be further processed. For example, a region containing only the face can be segmented from the initial face image, and this region is used as the face image. Specifically, the step "determining the face image in at least one image to be detected based on the detection result" can include:
[0127] Based on the detection results, face discrimination processing is performed on at least one image to be detected to obtain the discrimination result;
[0128] Based on the discrimination results, an initial facial image is selected from at least one image to be detected;
[0129] Perform facial registration on the initial facial image to obtain the location information of at least one facial key point in the initial facial image;
[0130] Based on the location information of facial key points, target facial key points are selected from at least one facial key point.
[0131] A facial image is generated based on the location information of key facial points.
[0132] In one embodiment, there are several methods for performing facial discrimination processing on the facial images to be detected. For example, a deep learning network can be trained using image samples with faces of varying resolutions to obtain a facial discrimination model capable of judging image clarity. Then, this facial discrimination model can be used to perform facial discrimination processing on at least one image to be detected, obtaining a discrimination result. Alternatively, parameters such as variance and entropy in the grayscale of the images to be detected can be analyzed, and the discrimination result for each image can be obtained through the analysis of these parameters.
[0133] Then, based on the discrimination results, an initial facial image can be selected from at least one image to be detected. For example, the image with the highest clarity can be selected as the initial facial image.
[0134] In one embodiment, after selecting the facial images, the initial facial images can be processed. For example, regions containing only the face can be segmented from the initial facial images, and these regions can be used as the facial images. Specifically, facial registration can be performed on the initial facial images to obtain at least one facial key point. Then, target facial key points are selected from the at least one facial key point, and a facial image is generated based on the target facial key points.
[0135] Facial registration of the initial facial image allows for the localization of faces within the image, thus revealing their specific locations. These locations can be represented by the positional information of facial key points.
[0136] In one embodiment, there are several methods to perform facial registration on an initial facial image to obtain the location information of facial key points in the initial facial image. For example, algorithms such as the Practical Facial Landmark Detector (PFLD), Active Shape Model (ASM), or Cascaded Pose Regression (CPR) can be used to perform facial registration on the initial facial image to obtain the location information of facial key points in the initial facial image.
[0137] Facial key points can include key points that describe facial contours and facial features. For example, such as... Figure 4 As shown, Figure 4 The 002 in the diagram can be a facial key point.
[0138] The target key points can include key points needed to determine facial features. For example, target key points can include key points corresponding to the left pupil, right pupil, tip of the nose, left corner of the mouth, and right corner of the mouth, etc.
[0139] In one embodiment, a target facial key point can be selected from at least one facial key point based on the positional relationship of the facial key points. For example, the positional information of the facial key point can be matched with preset positional information, and when a match is found, the facial key point is selected as the target facial key point.
[0140] Next, a facial image can be generated based on the location information of the target facial key points. For example, when the target facial key points are the key points corresponding to the left pupil, right pupil, tip of the nose, left corner of the mouth, and right corner of the mouth, a minimum bounding square can be determined based on these five facial key points, and then enlarged by a factor of 2.1 to obtain the facial image required for liveness detection. For example, as shown... Figure 5 As shown, in the image, key points corresponding to the left pupil, right pupil, tip of the nose, left corner of the mouth, and right corner of the mouth are selected as target facial key points from 003. Then, as... Figure 5 As shown in 004, a minimum bounding square can be generated based on these target facial key points 005, and then enlarged by a factor of 2.1 to serve as the facial image required for liveness detection 006. Furthermore, the facial image can be scaled to improve the ease of liveness detection. For example, the facial image can be scaled to 112 pixels (px) * 112 pixels.
[0141] 202. Extract features from the facial image to obtain the image feature information of the facial image.
[0142] In one embodiment, after acquiring a facial image, the liveness detection device can extract features from the facial image to obtain image feature information of the facial image.
[0143] Image feature information includes information that describes the features of a facial image. For example, image feature information can describe the reflection and refraction of light on the face in a facial image, and so on. Furthermore, image feature information can describe the color features and grayscale features of the face in a facial image, and so on.
[0144] In one embodiment, there are multiple methods to extract features from facial images to obtain image feature information of the facial images.
[0145] For example, algorithms such as Super-Resolution Test Sequence (Visual Geometry Group, VGG), Residual Network (ResNet), or GoogLeNet can be used to extract features from facial images and obtain image feature information.
[0146] For example, pixel information can be extracted from a facial image, and then processed using this pixel information to obtain image feature information. Specifically, the step "extracting features from the facial image to obtain image feature information of the facial image" can include:
[0147] Pixel extraction is performed on the facial image to obtain the pixel information of the facial image;
[0148] The pixel information is processed by convolution to obtain the convolution information of the facial image;
[0149] Normalize the convolutional information to obtain normalized information of the facial image;
[0150] The normalized information is subjected to a nonlinear transformation to obtain the image feature information of the facial image.
[0151] In one embodiment, there are multiple ways to extract pixels from a facial image to obtain its pixel information. For example, pixel information can be extracted from a facial image using an open-source computer vision library (OpenCV). Another example is the use of canvas technology to extract pixel information from a facial image. For instance, after obtaining the facial image, it can be drawn on a canvas, and its pixel information can be extracted using the canvas's interface. For example, the pixel information of the facial image can be obtained through the canvas's getImageData() interface.
[0152] In one embodiment, after obtaining the pixel information of a facial image, convolution operations can be performed on the pixel information to obtain the convolutional information of the facial image. For example, a convolution kernel of a preset size can be used to perform convolution operations on the pixel information to obtain the convolutional information of the facial image. Alternatively, convolution kernels of different sizes can be used to perform convolution operations on the pixel information. By using convolution kernels of different sizes to perform convolution operations on the pixel information, information about the facial image in different dimensions can be obtained, thereby improving the accuracy of image feature information.
[0153] In one embodiment, after performing convolution operations on pixel information, since different dimensions of convolutional information may be obtained, the convolutional information can be normalized to obtain normalized information of the facial image. There are several normalization methods. For example, the convolutional information can be simply scaled to obtain normalized information. Another example is mean reduction of the convolutional information to obtain normalized information. Yet another example is feature annotation of the convolutional information, ensuring that all convolutional information has zero mean and unit variance. Normalizing the data also improves the speed and accuracy of feature extraction from facial images.
[0154] In one embodiment, to improve the accuracy of feature extraction from facial images, a nonlinear transformation can be performed on the normalized information to obtain the image feature information of the facial image. For example, nonlinear functions such as the Sigmoid function, Tanh function, and ReLU function can be used to perform a nonlinear transformation on the normalized information to obtain the image feature information of the facial image.
[0155] In one embodiment, the artificial intelligence model can be trained as needed to obtain a preset feature extraction model capable of performing feature extraction. Then, the preset feature extraction model can be used to extract features from the facial image to obtain image feature information of the facial image. Specifically, the step "extracting features from the facial image to obtain image feature information of the facial image" may include:
[0156] By using a pre-defined feature extraction model, features are extracted from facial images to obtain the image feature information of the facial images.
[0157] The preset feature extraction model can be a deep learning network. For example, it could be a Convolutional Neural Network (CNN) or a Deep Residual Network (ResNet). Furthermore, the preset feature extraction model can be automatically adjusted and modified according to actual spatial and temporal requirements, and so on.
[0158] In one embodiment, in order to accelerate network convergence and improve network performance, the structure of the preset feature extraction model proposed in this application embodiment can be a series of residual blocks, each residual block including two sets of basic computing units, and each computing unit is composed of a convolutional layer, a normalization layer and a nonlinear activation function.
[0159] Convolutional layers perform convolution operations, which extract different features from facial images. For example, a convolutional layer could be conv2d, conv2d 1×1, or conv, etc.
[0160] The normalization layer normalizes the convolutional information generated by the convolutional layer, ensuring a consistent distribution of the input data. For example, this normalization layer can be batch normalization (BN), layer normalization (LN), instance normalization (IN), or group normalization (GN), etc.
[0161] Nonlinear activation functions can nonlinearly map the normalized information output by the normalization layer, thereby improving the ability of the preset feature extraction model to fit the patterns in the training data. For example, the nonlinear activation function can include the Sigmoid function, the Tanh function, or the ReLU function, etc.
[0162] 203. Perform liveness feature mapping on at least one reference feature to obtain at least one reference liveness feature information.
[0163] In one embodiment, existing liveness detection methods often utilize training sets to generate liveness feature information. However, since training sets are limited by the data itself, liveness feature information generated based on training sets cannot address all attack types. Therefore, in this embodiment, reference liveness feature information is generated from the perspective of feature distribution by performing liveness mapping processing on reference features, rather than relying on training data to generate reference liveness feature information.
[0164] The reference liveness feature information serves as a reference for determining whether the object to be detected corresponding to the image feature information is a live object. In other words, liveness detection processing can be performed on the image feature information based on the reference liveness feature information, thereby determining whether the object to be detected corresponding to the image feature information is a live object.
[0165] In one embodiment, a pre-trained feature generation model can be used to convert reference features into reference liveness feature information. Then, this pre-trained feature generation model is used to perform liveness feature mapping processing on the reference features to obtain reference liveness feature information. Specifically, the step "performing liveness feature mapping processing on at least one reference feature to obtain at least one reference liveness feature information" may include:
[0166] Using a pre-defined feature generation model, at least one reference feature is subjected to liveness feature mapping to obtain at least one reference liveness feature information.
[0167] The preset feature generation model can be a deep learning network. For example, it can be composed of a multi-layer perceptron (MLP). When the preset feature generation network is composed of an MLP, the MLP can include two fully connected layers. These fully connected layers can perform classification. By using two fully connected layers, the computational efficiency of the preset feature generation model can be guaranteed.
[0168] In one embodiment, a preset liveness feature space can be generated in advance, and then reference features can be mapped onto the preset liveness feature space to obtain reference liveness feature information. Specifically, the step "perform liveness feature mapping processing on at least one reference feature to obtain at least one reference liveness feature information" may include:
[0169] The reference features are processed by a fully connected layer to obtain the fully connected information corresponding to the reference features.
[0170] Based on fully connected information, the reference features are classified to obtain the classification results corresponding to the reference features.
[0171] Based on the classification results, the reference features are mapped to the preset live feature space to obtain the reference live feature information.
[0172] Fully connected processing can refer to forward processing of reference features without directional feedback. For example, fully connected processing includes multiple mathematical operations, each with a corresponding order. When a liveness detection device performs fully connected processing on reference features, it does so according to the order of these mathematical operations, thus obtaining fully connected information.
[0173] For example, fully connected processing includes multiple linear and nonlinear operations. Specifically, fully connected processing specifies that linear operations are performed before nonlinear operations. Therefore, when a liveness detection device performs fully connected processing on a reference feature, it first performs linear operations on the reference feature and then performs nonlinear operations.
[0174] In one embodiment, reference features can be classified based on fully connected information to obtain a classification result corresponding to the reference features. Classifying the reference features refers to the processing performed on them to better approximate the characteristics of a living organism. Specifically, the reference features can be classified using a preset classification function based on fully connected information to obtain a classification result corresponding to the reference function. The classification function can be a function generated during the analysis of living organism features.
[0175] In one embodiment, after obtaining the classification result, reference features can be mapped to a preset liveness feature space based on the classification result, and the values corresponding to the reference features in the preset liveness feature space are determined as reference liveness feature information. The preset liveness feature space can be a liveness feature space generated through training. This space specifies which reference features correspond to which reference liveness feature space.
[0176] It should be noted that steps 202 and 203 are not subject to any timing restrictions. Step 202 can be executed first, followed by step 203, or vice versa. Furthermore, steps 202 and 203 can be executed in parallel.
[0177] 204. Based on at least one reference liveness feature information, perform liveness detection processing on the image feature information to obtain the detection result of the image feature information.
[0178] In one embodiment, after obtaining reference liveness feature information, liveness detection processing can be performed on the image feature information based on at least one reference liveness feature information to obtain a detection result for the image feature information. Specifically, the step "performing liveness detection processing on the image feature information based on at least one reference liveness feature information to obtain a detection result for the image feature information" may include:
[0179] At least one reference liveness feature and image feature are processed to calculate the similarity between each reference liveness feature and image feature.
[0180] Based on the preset liveness detection criteria, the feature similarity is transformed into an index to obtain the target index corresponding to the feature similarity.
[0181] The target indicator is compared with the preset discrimination indicator to obtain the discrimination result.
[0182] In one embodiment, the reference liveness feature information serves as a reference for the features of a facial image that is actually alive; that is, the facial image features of a real live person should be very similar to the reference liveness feature information. Therefore, at least one reference liveness feature information and image feature information can be processed to calculate the feature similarity between each reference liveness feature information and image feature information.
[0183] There are several ways to calculate the feature similarity between reference liveness features and image features. For example, cosine distance, Euclidean distance, or Hamming distance can be calculated between image features and reference liveness features, etc. The calculated distance is then used as the feature similarity.
[0184] In one embodiment, since the feature similarity between multiple reference liveness feature information and image feature information is calculated, the feature similarity can be transformed based on a preset liveness detection standard to obtain the target index corresponding to the feature similarity. The index transformation process refers to converting the feature similarity between multiple reference liveness feature information and image feature information to the same standard dimension, thereby enabling the determination of whether the object to be detected is live on the same standard dimension.
[0185] The preset liveness detection criterion can be a pre-defined standard for determining whether a target object is alive. For example, the preset liveness detection criterion can specify how to perform index transformation on feature similarity and how to determine whether the target object is alive, etc. For instance, the preset liveness detection criterion can specify that the index transformation of feature similarity is performed by calculating the mean and variance of multiple feature similarities. Another example is that the preset liveness detection criterion can specify that the index transformation of feature similarity is performed by normalizing the feature similarity, etc.
[0186] For example, a pre-defined liveness detection criterion could specify that the method for converting feature similarity into an index is to calculate the mean and variance of multiple feature similarities. Assume there are N reference liveness feature pieces. Then, the cosine distance between the image feature and these N reference liveness feature pieces can be calculated, resulting in cosine distance 1, cosine distance 2, ..., cosine distance N. Then, the mean and variance of these cosine distances can be calculated, and the resulting mean and variance can be used as the target index.
[0187] In one embodiment, after obtaining the target index corresponding to the feature similarity, the target index can be compared with a preset discrimination index to obtain the discrimination result.
[0188] The preset discrimination index can be a condition predefined in the preset liveness detection criteria for judging the target index. For example, when the target index is the mean and variance of feature pixel values, the preset discrimination index can be a preset discrimination mean and a preset discrimination variance. For example, the preset discrimination mean can be 'a', and the preset discrimination variance can be 'b'. If the mean of feature similarity is greater than 'a' and the variance of feature similarity is less than 'b', then the object to be detected is judged to be a live subject; otherwise, the object to be detected is judged to be an attack.
[0189] In one embodiment, a preset discrimination module can be generated, and then this preset discrimination module can be used to perform discrimination processing on the image feature information to obtain the discrimination result of the image feature information. Specifically, the step "based on at least one reference liveness feature information, perform liveness discrimination processing on the image feature information to obtain the discrimination result of the image feature information" may include:
[0190] Based on at least one reference liveness feature information, a preset discrimination module is used to perform liveness discrimination processing on the image feature information to obtain the discrimination result of the image feature information.
[0191] The preset discrimination module can perform liveness detection processing on image feature information. For example, reference liveness feature information and image feature information can be input into the preset discrimination module, and then the preset discrimination module can output the discrimination result of liveness detection processing on the image feature information.
[0192] The preset discrimination module can perform the above steps. Specifically, the preset discrimination module can perform the steps of "calculating the similarity between at least one reference liveness feature information and image feature information to obtain the feature similarity between each reference liveness feature information and image feature information; performing index conversion processing on the feature similarity based on the preset liveness discrimination standard to obtain the target index corresponding to the feature similarity; comparing the target index with the preset discrimination index to obtain the discrimination result".
[0193] 205. Based on image feature information, perform distribution fitting processing on at least one reference feature to obtain the distribution fitting result for the image feature information.
[0194] In one embodiment, this application embodiment can verify whether the object to be detected is a living body from two perspectives. One perspective is from the perspective of feature similarity, that is, based on at least one reference living body feature information, performing living body discrimination processing on the image feature information to obtain the discrimination result of the image feature information. The other perspective is from the perspective of distribution similarity, that is, based on the image feature information, performing distribution fitting processing on at least one reference feature to obtain the distribution fitting result for the image feature information.
[0195] In one embodiment, since the reference features conform to the target feature distribution, in this embodiment, the image feature information can be used as the target for mapping the liveness feature of the reference features. That is, the reference features can be processed to find the optimal "pre-mapping features" of the image feature information, and then it is determined whether the "pre-mapping features" also conform to the target feature distribution. If the "pre-mapping features" also conform to the target feature distribution, it indicates that the object to be detected corresponding to the image feature information is a live object; otherwise, it is an attack. In summary, performing distribution fitting processing on the reference features, i.e., processing the reference features, makes the distribution of the reference features similar to the distribution of the "pre-mapping features" of the image feature information.
[0196] In one embodiment, gradient operations can be performed on the reference features, allowing the reference features to be continuously fitted to the "pre-mapping features" of the image feature information. Specifically, the step of "performing distribution fitting processing on at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information" may include:
[0197] Gradient calculation is performed on at least one reference feature to obtain the gradient information of each reference feature;
[0198] Based on image feature information, the gradient information of each reference feature is converged to obtain the converged information of each reference feature.
[0199] The distribution fitting result is determined based on the convergence information of each reference feature.
[0200] There are several ways to perform gradient operations on at least one reference feature to obtain the gradient information of each reference feature. For example, gradient algorithms such as Stochastic Gradient Descent (SGD), Batch Gradient Descent (BGD), or Mini-batch Gradient Descent (MGD) can be used to perform gradient operations on the reference feature to obtain the gradient information of each gradient.
[0201] In one embodiment, to make the reference features fit the "pre-mapping features" of the image feature information, the gradient information of each reference feature can be converged based on the image feature information to obtain the converged information of each reference feature. Specifically, the convergence processing of the gradient information of each reference feature based on the image feature information can refer to continuously performing gradient processing on the reference features with the image feature information as the target, thereby causing the gradient information of the reference feature information to converge.
[0202] For example, after performing gradient calculations on the reference features to obtain their gradient information, a liveness mapping process can be performed on this gradient information to obtain the corresponding liveness feature information. Then, the loss information between the liveness feature information and the image feature information can be calculated. Next, based on this loss information, a second gradient calculation can be performed on the reference features to obtain their second gradient information. This second gradient information can then be used for liveness mapping to obtain the corresponding liveness feature information. The loss information between the second gradient information and the image feature information can then be calculated. This process can be repeated until the loss information between the liveness feature information and the image feature information converges. When the loss information between the liveness feature information and the image feature information converges, the gradient information of the parameter features also converges, at which point the converged information of the reference features can be obtained. This converged information of the reference features can be considered equivalent to the "pre-mapping features" of the image feature information.
[0203] Next, the distribution fitting result can be determined based on the converged information of each reference feature. Specifically, the step "determine the distribution fitting result based on the converged information of each reference feature" can include:
[0204] Based on the converged information of each reference feature, the distribution of image feature information is analyzed to obtain the image feature distribution of image feature information;
[0205] Calculate the distribution similarity between the image feature distribution and the target feature distribution;
[0206] The distribution similarity is compared with the preset distribution discrimination conditions to obtain the distribution fitting results.
[0207] The image feature distribution can include information indicating which probability distribution the image feature information conforms to. For example, if the image feature distribution is a standard normal distribution, it means the image feature information conforms to a standard normal distribution. As another example, if the image feature distribution is a binomial distribution, it means the image feature information conforms to a binomial distribution.
[0208] In one embodiment, the image feature information is subjected to distribution analysis, that is, the probability distribution that the image feature information conforms to is analyzed. For example, the converged information of each reference feature can be converted into a histogram, and then the histogram is analyzed to obtain the image feature distribution of the image feature information.
[0209] In one embodiment, after obtaining the image feature distribution, the distribution similarity between the image feature distribution and the target feature distribution can be calculated. If the distribution similarity between the image feature distribution and the target feature distribution is high, it indicates that the object to be detected is a live object; otherwise, it indicates that the object to be detected is an attack.
[0210] One method to determine the similarity between image feature distributions and target feature distributions is through image analysis. Generally, if the image feature distribution and the target feature distribution are the same type of distribution, their feature distribution images will be very similar, resulting in a high distribution similarity. Conversely, if the image feature distribution and the target feature distribution are not the same type of distribution, their feature distribution images will differ significantly, leading to a low distribution similarity.
[0211] In one embodiment, after obtaining the converged information, the Kullback-Leibler (KL) divergence between the converged information and the reference features can be calculated, and the KL divergence can be used to determine whether the object to be detected is a live object. For example, if the KL divergence is less than a threshold c, the object to be detected can be determined to be a real person; otherwise, the object to be detected can be determined to be an attack.
[0212] In one embodiment, a preset distribution fitting module can be generated, and then this preset distribution fitting module can be used to perform distribution fitting processing on at least one reference feature based on image feature information to obtain a distribution fitting result for the image feature information. Specifically, the step "performing distribution fitting processing on at least one reference feature based on image feature information to obtain a distribution fitting result for the image feature information" can include:
[0213] Based on image feature information, a preset distribution fitting module is used to perform distribution fitting processing on at least one reference feature to obtain a distribution fitting result for the image feature information.
[0214] The preset distribution fitting module can perform distribution fitting on reference feature information based on image feature information. For example, image feature information and reference feature information can be input into the preset distribution fitting module, and then the preset distribution fitting module can output the distribution fitting result of the image feature information.
[0215] The preset distribution fitting module can execute the above steps. For example, it can execute the steps "based on the converged information of each reference feature, perform distribution analysis on the image feature information to obtain the image feature distribution; calculate the distribution similarity between the image feature distribution and the target feature distribution; compare the distribution similarity with the preset distribution discrimination conditions to obtain the distribution fitting result." Furthermore, the preset distribution fitting module can also execute the process "calculate the Kullback-Leibler (KL) divergence between the converged information and the reference features, and use the KL divergence to determine whether the object to be detected is a live object. For example, if the KL divergence is less than the threshold c, the object to be detected can be determined to be a real person; otherwise, the object to be detected can be determined to be an attack."
[0216] 206. Based on the discrimination results and distribution fitting results, perform liveness detection on the target object.
[0217] In one embodiment, after obtaining the discrimination result and the distribution fitting result, the liveness detection of the object to be detected can be performed based on the discrimination result and the distribution fitting result, that is, the object to be detected is determined to be a live body by combining the discrimination result and the distribution fitting result.
[0218] For example, when both the preset discrimination module and the preset distribution fitting module determine that the object to be detected is not a live object but an attack, the terminal can consider the object to be detected to be an attack and output a liveness detection result indicating that the liveness detection failed.
[0219] For example, if the preset discrimination module or preset distribution fitting module determines that the object to be detected is not a live subject but an attack, for security reasons, the terminal can re-acquire the facial image of the object to be detected and re-detect it. If the preset discrimination module or preset distribution fitting module still determines that the object to be detected is not a live subject, the terminal can consider the object to be detected to be an attack and output the liveness detection result of the liveness detection video.
[0220] For example, when both the preset discrimination module and the preset distribution fitting module determine that the object to be detected is a live body, the terminal can consider the object to be detected to be a live body and output the live body detection result indicating that the live body detection has passed.
[0221] In one embodiment, to better represent the liveness detection method proposed in this application, this application provides an algorithmic model structure for the liveness detection method, for example, as follows: Figure 6 As shown. Figure 6As shown, in order to avoid the problem of uncertain prediction results on non-same-origin datasets, this application proposes a liveness detection method based on feature generation and hypothesis testing. The algorithm framework of this method mainly includes a preset feature extraction model, a preset feature generation model, a preset discrimination module, and a preset distribution fitting module.
[0222] The preset feature extraction model is used to extract features from the facial image to obtain image feature information. The preset feature generation model is used to perform liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information. Then, hypothesis testing of the image feature information is performed from two dimensions.
[0223] On one hand, a pre-defined discrimination module is used to perform liveness detection processing on image feature information based on at least one reference liveness feature information, obtaining the discrimination result of the image feature information. The pre-defined discrimination module is mainly used to detect the uncertainty in the liveness detection process. From the perspective of uncertainty estimation, when the input data has a different distribution from the training set, the feature vectors obtained by traditional feature extraction networks have strong uncertainty, and their prediction results are often uncertain as well. Conversely, the reference liveness feature information generated using the parametric features of the same target feature distribution has strong determinism. Using this reference liveness feature information as a hypothesis to test whether the image feature information belongs to the same distribution has higher accuracy and certainty.
[0224] On the other hand, a preset distribution fitting module is used to perform distribution fitting processing on at least one reference feature based on image feature information to obtain a distribution fitting result for the image feature information. In this embodiment, the purpose of using reference features that conform to the target feature distribution is to fit the distribution of the liveness detection body, rather than fitting the distribution of the liveness detection body using data. Therefore, the preset distribution fitting module is mainly used to compare the "pre-mapping features" of the image feature information with the target feature distribution. Then, the object to be detected whose image feature information does not belong to the target feature distribution can be considered an attack. Compared with the prior art, the method proposed in this embodiment has better defense capabilities against unknown attack types, thereby improving the accuracy and reliability of liveness detection.
[0225] In one embodiment, before using a preset feature extraction model to extract features from a facial image and using a preset feature generation model to perform liveness feature mapping on at least one reference feature, the model must be trained to obtain the preset feature extraction model.
[0226] Specifically, the method proposed in the embodiments of this application may further include:
[0227] Obtain the feature extraction model and the feature generation model to be trained;
[0228] Collect multiple facial image training samples and a reference feature sample set whose feature distribution conforms to the target feature distribution. The reference feature sample set includes multiple reference feature training samples.
[0229] Using multiple facial image training samples and multiple reference feature training samples, the feature extraction model and the feature generation model to be trained are trained to obtain the preset feature extraction model and the preset feature generation model.
[0230] The feature extraction model to be trained can include models that still require training and whose performance has not yet met the requirements. Similarly, the feature generation model to be trained can also include models that still require training and whose performance has not yet met the requirements.
[0231] The feature generation model and the feature extraction model to be trained can be deep learning models. For example, the feature generation model to be trained can be a model composed of MLPs. For example, the feature extraction model to be trained can have a structure of several residual blocks connected in series, each residual block including two sets of basic computational units, and each computational unit is composed of a convolutional layer, a normalization layer and a nonlinear activation function.
[0232] In one embodiment, before training the feature extraction model and the feature generation model to be trained, multiple facial image training samples and a reference feature sample set whose feature distribution conforms to the target feature distribution can be collected. The reference feature sample set includes multiple reference feature training samples.
[0233] The facial image training samples refer to the data used to train the model. These training samples can include both positive and negative samples. Positive samples can include facial images of living individuals, while negative samples can include facial images of attackers. For example, N1 real-life images, N2 paper-printed attack images, N3 screen-retrieved attack images, and N4 3D masks can be collected. The real-life images can be positive samples, while the paper-printed attack images, screen-retrieved attack images, and 3D masks can be negative samples.
[0234] The reference feature training samples can also include the data used when training the model. For example, M data points can be randomly sampled from data that conforms to the target feature distribution as reference feature training samples.
[0235] Next, multiple facial image training samples and multiple reference feature training samples can be used to train the feature extraction model and the feature generation model to be trained, so as to obtain the preset feature extraction model and the preset feature generation model.
[0236] In one embodiment, the step "training the feature extraction model and the feature generation model to be trained using multiple facial image training samples and multiple reference feature training samples to obtain a preset feature extraction model and a preset feature generation model" may include:
[0237] The feature extraction model to be trained is used to extract features from the training samples of facial images to obtain the image sample feature information of the training samples of facial images;
[0238] The liveness feature information of the sample is obtained by using the feature generation model to generate the reference feature training sample;
[0239] Based on the liveness feature information of the sample and the reference feature training sample, the feature loss information and distribution loss information corresponding to the image sample feature information are calculated;
[0240] Based on the feature loss information, the parameters of the feature extraction model to be trained are adjusted to obtain the preset feature extraction model, and based on the distribution loss information, the parameters of the feature generation model to be trained are adjusted to obtain the preset feature generation model.
[0241] In one embodiment, the step "using the feature extraction model to be trained to extract features from the facial image training samples to obtain the image sample feature information of the facial image training samples" can refer to step 202, and will not be repeated here.
[0242] In one embodiment, the step "using the feature generation model to be trained to perform live feature mapping processing on the reference feature training samples to obtain sample live feature information" can refer to step 203, and will not be repeated here.
[0243] In one embodiment, when training the feature generation model and the feature extraction model, a preset discrimination module and a preset distribution fitting module can be used to assist in training. For example, in the step "calculating the feature loss information and distribution loss information corresponding to the image sample feature information based on the sample liveness feature information and reference feature training samples", a preset discrimination module and a preset distribution fitting module can be introduced to calculate the loss information. Specifically, the step "calculating the feature loss information and distribution loss information corresponding to the image sample feature information based on the sample liveness feature information and reference feature training samples" may include:
[0244] Using a pre-defined discrimination module, the feature loss information between image sample feature information and sample liveness feature information is calculated;
[0245] Using a pre-defined distribution fitting module, the distribution loss information between image sample feature information and reference feature training samples is calculated.
[0246] For example, a preset discrimination module can be used to calculate the feature similarity between image sample feature information and sample liveness feature information, and this feature similarity can be used as feature loss information. For example, the cosine distance between image sample feature information and M sample liveness feature information can be calculated. Then, the mean and variance of these M cosine distances are calculated, and the mean and variance are used as feature loss information.
[0247] For example, a pre-defined distribution fitting module can be used to calculate the gradient information of image sample feature information with respect to the reference feature training samples, and this gradient information can be used as the distribution loss information. Alternatively, the derivative of image sample feature information with respect to the reference feature training samples can be calculated, and this derivative can be used as the distribution loss information.
[0248] In one embodiment, after obtaining feature loss information and distribution loss information, the parameters of the feature extraction model to be trained can be adjusted based on the feature loss information to obtain a preset feature extraction model, and the parameters of the feature generation model to be trained can be adjusted based on the distribution loss information to obtain a preset feature generation model.
[0249] For example, when the feature loss information is the feature similarity between image sample feature information and sample liveness feature information, the parameters of the feature extraction model to be trained can be adjusted based on the principle of maximizing the feature similarity between positive sample image sample information and sample liveness feature information, and minimizing the feature similarity between negative sample image sample information and sample liveness feature information, to obtain the preset feature extraction model. For example, when the loss information is the variance and mean of M cosine distances, the direction of adjustment for the parameters of the feature extraction model to be trained can be: for positive samples, constrain the mean of the M cosine distances to be as large as possible, and the variance to be as small as possible; while for negative samples, constrain the mean of the M cosine distances to be as small as possible, and the variance to be as large as possible.
[0250] For example, when the distribution loss information is the derivative of the image sample feature information with respect to the reference feature training samples, the parameters of the feature generation model to be trained can be adjusted based on the principle that the norm of the derivative of positive samples should be as small as possible, while the norm of the derivative of negative samples should be as large as possible. This norm can include various types of norms, such as L1 norm, L2 norm, or L-infinity norm, etc.
[0251] The method proposed in this application can be applied to multiple application scenarios. For example, it can be applied to payment scenarios, access control scenarios, and information query scenarios, etc. In particular, since real-time performance is emphasized in payment or access control applications, model distillation or pruning methods can be used to reduce the number of model parameters, reduce model runtime, and improve liveness detection efficiency.
[0252] This application proposes a liveness detection method, which includes: acquiring a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature; extracting features from the facial image to obtain image feature information of the facial image; performing liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information; performing liveness discrimination processing on the image feature information based on the at least one reference liveness feature information to obtain a discrimination result of the image feature information; performing distribution fitting processing on the at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information; and performing liveness detection on the object to be detected based on the discrimination result and the distribution fitting result. This application verifies the image feature information of the facial image from two aspects to determine whether the object to be detected is a live person. First, the first aspect is performing liveness discrimination processing on the image feature information based on at least one reference liveness feature information to obtain a discrimination result of the image feature information. This mainly addresses the uncertainty in the liveness detection process. Since the reference liveness feature information is generated from reference features that conform to the target feature distribution, using this reference liveness feature information as a hypothesis to test whether the image feature information is of the same distribution has higher accuracy and certainty. Therefore, the accuracy and reliability of the liveness detection process will be higher.
[0253] Secondly, the second aspect involves performing distribution fitting processing on the at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information. The purpose of using reference features that conform to the target feature distribution is to fit the distribution of the liveness detection body, rather than fitting the liveness detection body distribution using data. Therefore, the preset distribution fitting module is mainly used to compare the "pre-mapping features" of the image feature information with the target feature distribution. Objects whose image feature information does not belong to the target feature distribution can be considered as attacks. Compared to existing technologies, the method proposed in this application embodiment has better defense capabilities against unknown attack types, thereby improving the accuracy and reliability of liveness detection.
[0254] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.
[0255] This application will use the integration of a liveness detection method into a terminal as an example to illustrate the method of this application.
[0256] In one embodiment, such as Figure 7 As shown, a liveness detection method has the following specific process:
[0257] 401. The terminal acquires a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is the target feature distribution, and the reference feature set includes at least one reference feature.
[0258] In one embodiment, to address the problems in the prior art, this application proposes a liveness detection algorithm based on feature generation and hypothesis testing. The structural framework of this algorithm is shown in the figure. The steps in this algorithm are mainly executed by a preset feature extraction model, a preset feature generation model, a preset discrimination module, and a preset distribution fitting module.
[0259] For example, when the terminal receives a liveness detection trigger command from the object to be detected, the terminal can start the camera to capture the video to be detected. Then, the terminal can convert the video to be detected into an image to be detected and perform face detection on the image. If a face is detected in the image, the subsequent recognition process is started; otherwise, it is directly judged as a failure of face liveness detection.
[0260] For example, such as Figure 8 The diagram shows a schematic of a tri-lens camera smart terminal. The tri-lens camera includes a color camera, an infrared camera, and a depth camera. The color camera captures images in the visible light band, the infrared camera captures images in a specific infrared band, and the depth camera captures depth information of the scene in front.
[0261] It should be noted that the method framework proposed in this application does not depend on a specific camera type, but is applicable to any camera.
[0262] In one embodiment, when the terminal detects a face in an image to be detected, the terminal can determine a face image in at least one image to be detected.
[0263] In one embodiment, the terminal can randomly sample Gaussian vectors that conform to a standard normal distribution (also known as a Gaussian distribution) to obtain several Gaussian vectors, and the sampled Gaussian vectors are called parametric features. Then, the sampled parametric features can be combined into a set, called a reference feature set.
[0264] For example, several vectors can be sampled from a multidimensional vector conforming to a standard normal distribution, and these sampled vectors can be used as reference features. For instance, given 100 Gaussian vectors conforming to a standard normal distribution, 50 vectors can be sampled from these 100 Gaussian vectors as reference features. This can be done in various ways. For example, reference features can be obtained through random sampling.
[0265] 402. The terminal extracts features from the facial image to obtain the image feature information of the facial image.
[0266] For example, the terminal can input a facial image into a pre-trained preset feature extraction model to obtain the image feature information of the facial image.
[0267] The preset feature extraction model can be a deep convolutional network, such as a super-resolution test sequence (Visual Geometry Group, VGG), a residual network (ResNet), or GoogLeNet, etc. Furthermore, the preset feature extraction model can be automatically adjusted and modified according to actual spatial and temporal requirements, etc.
[0268] In one embodiment, in order to accelerate network convergence and improve network performance, the structure of the preset feature extraction model proposed in this application embodiment can be a series of residual blocks, each residual block including two sets of basic computing units, and each computing unit is composed of a convolutional layer, a normalization layer and a nonlinear activation function.
[0269] Convolutional layers perform convolution operations, which extract different features from facial images. For example, a convolutional layer could be conv2d, conv2d 1×1, or conv, etc.
[0270] The normalization layer normalizes the convolutional information generated by the convolutional layer, ensuring a consistent distribution of the input data. For example, this normalization layer can be batch normalization (BN), layer normalization (LN), instance normalization (IN), or group normalization (GN), etc.
[0271] Nonlinear activation functions can nonlinearly map the normalized information output by the normalization layer, thereby improving the ability of the preset feature extraction model to fit the patterns in the training data. For example, the nonlinear activation function can include the Sigmoid function, the Tanh function, or the ReLU function, etc.
[0272] 403. The terminal performs liveness feature mapping processing on at least one reference feature to obtain at least one reference liveness feature information.
[0273] For example, the terminal can use a preset feature generation model to perform liveness feature mapping processing on at least one reference feature to obtain at least one reference liveness feature information.
[0274] In one embodiment, the preset feature generation model can be a deep learning network. For example, the preset feature generation model can be composed of a multi-layer perceptron (MLP). When the preset feature generation network is composed of an MLP, the MLP can include two fully connected layers. The fully connected layers can perform classification. By using two fully connected layers, the computational efficiency of the preset feature generation model can be guaranteed.
[0275] 404. The terminal performs liveness detection processing on the image feature information based on at least one reference liveness feature information to obtain the detection result of the image feature information.
[0276] For example, the terminal can perform liveness detection processing on the image feature information based on at least one reference liveness feature information and using a preset discrimination module to obtain the discrimination result of the image feature information.
[0277] The preset discrimination module is used to compare the differences between the reference liveness feature information and the image feature information to determine whether the object to be detected is a live body.
[0278] In one embodiment, there are multiple ways to compare the differences between reference liveness feature information and image feature information.
[0279] For example, the cosine distance, Euclidean distance, or Hamming distance between reference liveness feature information and image feature information can be calculated, etc.
[0280] For example, consider N reference liveness feature information points. Then, calculate the cosine distance between the image feature information and these N reference liveness feature information points, obtaining cosine distance 1, cosine distance 2, ..., cosine distance N. Next, calculate the mean of these cosine distances. If the mean of these cosine distances all approach 1, it indicates that the target object corresponding to the image feature information is more likely to be a real person. Conversely, if the mean of these cosine distances all approach -1, it indicates that the target object corresponding to the image feature information is more likely not a live person, but rather an attacker.
[0281] Furthermore, the inaccuracy of image feature information can be measured by calculating the variance of these cosine distances. If the variance of these cosine distances is small, it means that the preset discrimination module's prediction of the image feature information is more certain; conversely, it means that the preset discrimination module's prediction of the image feature information varies greatly and has high uncertainty, and the target object corresponding to the image feature information is more likely not a living object, but an unknown type of attack.
[0282] In one embodiment, at least one reference liveness feature and image feature can be input into a preset discrimination module to obtain the mean and variance of the difference (cosine distance or Euclidean distance, etc.) between the image feature and the reference liveness feature. If the mean is greater than threshold a and the variance is less than threshold b, the object to be detected is determined to be live; otherwise, the object to be detected is determined to be an attack.
[0283] 405. Based on image feature information, the terminal performs distribution fitting processing on at least one reference feature to obtain a distribution fitting result for the image feature information.
[0284] For example, the terminal can use a preset distribution fitting module to perform distribution fitting processing on at least one reference feature based on image feature information to obtain a distribution fitting result for the image feature information.
[0285] The input to the preset distribution fitting model can be image feature information and at least one sampled reference feature. Then, with the network parameters of the preset feature generation model unchanged, the preset feature generation model is set to output the image feature information as the target.
[0286] For example, a pre-defined distribution fitting model can perform gradient descent optimization on at least one input reference feature to find the "optimal input vector" of the image feature information. That is, the reference feature can be differentiated to obtain the differentiated reference feature. Then, the differentiated reference feature can be input into a pre-defined feature generation model to obtain liveness feature information generated based on the differentiated reference feature. Next, the loss information between the liveness feature information generated based on the differentiated reference feature and the image feature information can be calculated, and the reference feature can be differentiated again based on this loss information. By continuously repeating the above process, at least one reference feature eventually converges to the "optimal input vector" of the image feature information.
[0287] After obtaining at least one "optimal input vector" of image feature information, the KL divergence between this at least one optimal input vector and the standard normal distribution can be calculated. If the KL divergence is less than a threshold c, the object to be detected can be determined to be a live subject; otherwise, the object to be detected is determined to be an attack rather than a live subject.
[0288] 406. The terminal performs liveness detection on the target object based on the discrimination results and distribution fitting results.
[0289] For example, when both the preset discrimination module and the preset distribution fitting module determine that the object to be detected is not a live object but an attack, the terminal can consider the object to be detected to be an attack and output a liveness detection result indicating that the liveness detection failed.
[0290] For example, if the preset discrimination module or preset distribution fitting module determines that the object to be detected is not a live subject but an attack, for security reasons, the terminal can re-acquire the facial image of the object to be detected and re-detect it. If the preset discrimination module or preset distribution fitting module still determines that the object to be detected is not a live subject, the terminal can consider the object to be detected to be an attack and output the liveness detection result of the liveness detection video.
[0291] For example, when both the preset discrimination module and the preset distribution fitting module determine that the object to be detected is a live body, the terminal can consider the object to be detected to be a live body and output the live body detection result indicating that the live body detection has passed.
[0292] In this embodiment, the terminal can acquire a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature. The terminal can extract features from the facial image to obtain image feature information of the facial image. The terminal can perform liveness feature mapping processing on at least one reference feature to obtain at least one reference liveness feature information. The terminal can perform liveness discrimination processing on the image feature information based on at least one reference liveness feature information to obtain a discrimination result of the image feature information. The terminal can perform distribution fitting processing on at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information. The terminal can perform liveness detection on the object to be detected based on the discrimination result and the distribution fitting result. Through this embodiment, the accuracy and reliability of liveness detection can be improved.
[0293] To better implement the liveness detection method provided in the embodiments of this application, a liveness detection device is also provided in one embodiment, which can be integrated into a computer device. The meanings of the terms used are the same as in the liveness detection method described above, and specific implementation details can be found in the description of the method embodiments.
[0294] In one embodiment, a liveness detection device is provided, which can be specifically integrated into a computer device, such as... Figure 9 As shown, the liveness detection device includes: an acquisition unit 601, a feature extraction unit 602, a feature mapping unit 603, a discrimination unit 604, a distribution fitting unit 605, and a liveness detection unit 606, as detailed below:
[0295] The acquisition unit 601 is used to acquire a facial image of the object to be detected and a reference feature set, wherein the feature distribution in the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature;
[0296] Feature extraction unit 602 is used to extract features from the facial image to obtain image feature information of the facial image;
[0297] The feature mapping unit 603 is used to perform live feature mapping processing on the at least one reference feature to obtain at least one reference live feature information.
[0298] The discrimination unit 604 is used to perform liveness discrimination processing on the image feature information based on the at least one reference liveness feature information to obtain the discrimination result of the image feature information;
[0299] The distribution fitting unit 605 is used to perform distribution fitting processing on the at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information.
[0300] The liveness detection unit 606 is used to perform liveness detection on the object to be detected based on the discrimination result and the distribution fitting result.
[0301] In one embodiment, the distribution fitting unit 605 may include:
[0302] The gradient operation subunit is used to perform gradient operation on the at least one reference feature to obtain the gradient information of each reference feature.
[0303] The convergence subunit is used to perform convergence processing on the gradient information of each reference feature based on the image feature information to obtain the converged information of each reference feature.
[0304] The result determination subunit is used to determine the distribution fitting result based on the convergence information of each reference feature.
[0305] In one embodiment, the result determining subunit may include:
[0306] The distribution analysis module is used to perform distribution analysis on the image feature information based on the converged information of each reference feature, so as to obtain the image feature distribution of the image feature information;
[0307] The similarity calculation module is used to calculate the distribution similarity between the image feature distribution and the target feature distribution;
[0308] The comparison module is used to compare the distribution similarity with the preset distribution discrimination conditions to obtain the distribution fitting result.
[0309] In one embodiment, the discrimination unit 604 may include:
[0310] A similarity calculation subunit is used to perform similarity calculation processing on the at least one reference live feature information and the image feature information to obtain the feature similarity between each reference live feature information and the image feature information;
[0311] The index conversion subunit is used to perform index conversion processing on the feature similarity based on a preset liveness detection standard to obtain the target index corresponding to the feature similarity.
[0312] The comparison subunit is used to compare the target index with the preset discrimination index to obtain the discrimination result.
[0313] In one embodiment, the feature extraction unit 602 may include:
[0314] A pixel extraction subunit is used to extract pixels from the facial image to obtain the pixel information of the facial image;
[0315] The convolution operation subunit is used to perform convolution operation on the pixel information to obtain the convolution information of the facial image;
[0316] A normalization subunit is used to normalize the convolutional information to obtain the normalized information of the facial image;
[0317] The nonlinear transformation subunit is used to perform nonlinear transformation on the normalized information to obtain the feature information of the facial image.
[0318] In one embodiment, the feature mapping unit 603 may include:
[0319] A fully connected subunit is used to perform fully connected processing on the reference feature to obtain fully connected information corresponding to the reference feature;
[0320] The classification subunit is used to classify the reference feature based on the fully connected information to obtain the classification result corresponding to the reference feature;
[0321] The mapping subunit is used to map the reference features to a preset live feature space based on the classification result, so as to obtain the reference live feature information.
[0322] In one embodiment, the liveness detection device further includes:
[0323] The model acquisition unit is used for the feature extraction model and the feature generation model to be trained.
[0324] The acquisition unit is used to acquire multiple facial image training samples and a reference feature sample set whose feature distribution conforms to the target feature distribution. The reference feature sample set includes multiple reference feature training samples.
[0325] The training unit is used to train the feature extraction model and the feature generation model to be trained using the multiple facial image training samples and the multiple reference feature training samples, so as to obtain the preset feature extraction model and the preset feature generation model.
[0326] In one embodiment, the training unit may include:
[0327] The feature extraction subunit is used to extract features from the facial image training samples using the feature extraction model to be trained, so as to obtain the image sample feature information of the facial image training samples.
[0328] The liveness feature mapping subunit is used to perform liveness feature mapping processing on the reference feature training sample using the feature generation model to be trained, so as to obtain the liveness feature information of the sample.
[0329] The loss calculation subunit is used to calculate the feature loss information and distribution loss information corresponding to the image sample feature information based on the sample liveness feature information and the reference feature training sample.
[0330] The parameter adjustment subunit is used to adjust the parameters of the feature extraction model to be trained based on the feature loss information to obtain the preset feature extraction model, and to adjust the parameters of the feature generation model to be trained based on the distribution loss information to obtain the preset feature generation model.
[0331] In one embodiment, the loss calculation subunit may include:
[0332] The first loss calculation module is used to calculate the feature loss information between the image sample feature information and the sample liveness feature information using a preset discrimination module;
[0333] The second loss calculation module is used to calculate the distribution loss information between the image sample feature information and the reference feature training sample using a preset distribution fitting module.
[0334] In one embodiment, the liveness detection device further includes:
[0335] The instruction receiving unit is used to receive liveness detection trigger instructions;
[0336] The video acquisition unit is used to acquire a video of the subject's face based on the liveness detection trigger command.
[0337] An image conversion unit is used to convert the video to be detected into at least one image to be detected;
[0338] A face detection unit is used to perform face detection processing on the at least one image to be detected to obtain a detection result;
[0339] An image determination unit is used to determine the facial image in the at least one image to be detected based on the detection result.
[0340] In one embodiment, the image determination unit may include:
[0341] A face discrimination subunit is used to perform face discrimination processing on the at least one image to be detected based on the detection result, and obtain a discrimination result;
[0342] A facial image filtering subunit is used to filter out an initial facial image from the at least one image to be detected based on the discrimination result;
[0343] A face registration subunit is used to perform face registration on the initial face image to obtain the position information of at least one facial key point in the initial face image.
[0344] A filtering subunit is used to filter out target facial key points from the at least one facial key point based on the location information of the facial key points.
[0345] A generation subunit is used to generate the facial image based on the location information of the target facial key points.
[0346] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can be found in the previous method embodiments and will not be repeated here.
[0347] The aforementioned liveness detection device can improve the accuracy and reliability of liveness detection.
[0348] This application also provides a computer device, which may include a terminal or a server. For example, the computer device may serve as a liveness detection terminal, such as a mobile phone, tablet computer, etc.; or it may serve as a server, such as a liveness detection server. Figure 10 As shown, it illustrates a structural schematic diagram of the terminal involved in an embodiment of this application. Specifically:
[0349] The computer device may include components such as a processor 801 with one or more processing cores, a memory 802 with one or more computer-readable storage media, a power supply 803, and an input unit 804. Those skilled in the art will understand that... Figure 10The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0350] The processor 801 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 802, and by calling data stored in the memory 802, thereby providing overall monitoring of the computer device. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user page, and application programs, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 801.
[0351] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.
[0352] The computer device also includes a power supply 803 that supplies power to the various components. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 803 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0353] The computer device may also include an input unit 804, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0354] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 801 in the computer device loads the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 runs the application programs stored in the memory 802 to realize various functions, as follows:
[0355] Obtain a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature;
[0356] Feature extraction is performed on the facial image to obtain the image feature information of the facial image;
[0357] Perform liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information;
[0358] Based on the at least one reference liveness feature information, liveness discrimination processing is performed on the image feature information to obtain the discrimination result of the image feature information;
[0359] Based on the image feature information, a distribution fitting process is performed on the at least one reference feature to obtain a distribution fitting result for the image feature information;
[0360] Based on the discrimination result and the distribution fitting result, liveness detection is performed on the object to be detected.
[0361] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0362] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.
[0363] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a computer program, or by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0364] Therefore, embodiments of this application also provide a storage medium storing a computer program that can be loaded by a processor to execute the steps of any of the liveness detection methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0365] Obtain a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature;
[0366] Feature extraction is performed on the facial image to obtain the image feature information of the facial image;
[0367] Perform liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information;
[0368] Based on the at least one reference liveness feature information, liveness discrimination processing is performed on the image feature information to obtain the discrimination result of the image feature information;
[0369] Based on the image feature information, a distribution fitting process is performed on the at least one reference feature to obtain a distribution fitting result for the image feature information;
[0370] Based on the discrimination result and the distribution fitting result, liveness detection is performed on the object to be detected.
[0371] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0372] Since the computer program stored in the storage medium can execute the steps of any of the liveness detection methods provided in the embodiments of this application, the beneficial effects that any of the liveness detection methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0373] The present application provides a detailed description of a liveness detection method, apparatus, computer device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present application. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present application. Therefore, the content of this specification should not be construed as a limitation of the present application.
Claims
1. A method for detecting liveness, characterized in that, include: Obtain a facial image of the object to be detected and a reference feature set, wherein the feature distribution of the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature; Feature extraction is performed on the facial image to obtain the image feature information of the facial image; Perform liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information; Based on the at least one reference liveness feature information, liveness discrimination processing is performed on the image feature information to obtain the discrimination result of the image feature information; Based on the image feature information, a distribution fitting process is performed on the at least one reference feature to obtain a distribution fitting result for the image feature information; Based on the discrimination result and the distribution fitting result, liveness detection is performed on the object to be detected.
2. The method according to claim 1, characterized in that, The step of performing distribution fitting processing on the at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information includes: Gradient calculation is performed on the at least one reference feature to obtain the gradient information of each reference feature; Based on the image feature information, the gradient information of each reference feature is converged to obtain the converged information of each reference feature. The distribution fitting result is determined based on the convergence information of each reference feature.
3. The method according to claim 2, characterized in that, Determining the distribution fitting result based on the converged information of each reference feature includes: Based on the converged information of each reference feature, the image feature information is analyzed for distribution to obtain the image feature distribution of the image feature information; Calculate the distribution similarity between the image feature distribution and the target feature distribution; The distribution similarity is compared with the preset distribution discrimination conditions to obtain the distribution fitting result.
4. The method according to claim 1, characterized in that, The step of performing liveness detection processing on the image feature information based on the at least one reference liveness feature information to obtain the detection result of the image feature information includes: The similarity calculation is performed on the at least one reference liveness feature information and the image feature information to obtain the feature similarity between each reference liveness feature information and the image feature information; Based on a preset liveness detection standard, the feature similarity is processed by index conversion to obtain the target index corresponding to the feature similarity; The target indicator is compared with the preset discrimination indicator to obtain the discrimination result.
5. The method according to claim 1, characterized in that, The step of extracting features from the facial image to obtain image feature information of the facial image includes: Pixel extraction is performed on the facial image to obtain the pixel information of the facial image; The pixel information is processed by convolution to obtain the convolution information of the facial image; The convolutional information is normalized to obtain the normalized information of the facial image; The normalized information is subjected to a nonlinear transformation to obtain the image feature information of the facial image.
6. The method according to claim 1, characterized in that, The step of performing liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information includes: Perform fully connected processing on the reference feature to obtain the fully connected information corresponding to the reference feature; Based on the fully connected information, the reference features are classified to obtain the classification results corresponding to the reference features; Based on the classification results, the reference features are mapped to a preset live feature space to obtain the reference live feature information.
7. The method according to claim 1, characterized in that, The step of extracting features from the facial image to obtain image feature information of the facial image includes: The facial image is subjected to feature extraction using a preset feature extraction model to obtain the image feature information of the facial image; The step of performing liveness feature mapping processing on the at least one reference feature to obtain at least one reference liveness feature information includes: Using a preset feature generation model, liveness feature mapping is performed on the at least one reference feature to obtain at least one reference liveness feature information. Based on the at least one reference liveness feature information, liveness detection processing is performed on the image feature information to obtain the detection result of the image feature information, including: Based on the at least one reference liveness feature information, a preset discrimination module is used to perform liveness discrimination processing on the image feature information to obtain the discrimination result of the image feature information; Based on the image feature information, a distribution fitting process is performed on the at least one reference feature to obtain a distribution fitting result for the image feature information, including: Based on the image feature information, a preset distribution fitting module is used to perform distribution fitting processing on the at least one reference feature to obtain a distribution fitting result for the image feature information.
8. The method according to claim 7, characterized in that, The method further includes: Obtain the feature extraction model and the feature generation model to be trained; Multiple facial image training samples and a reference feature sample set whose feature distribution conforms to the target feature distribution are collected. The reference feature sample set includes multiple reference feature training samples. The training models for feature extraction and feature generation are trained using the multiple facial image training samples and the multiple reference feature training samples to obtain the preset feature extraction model and the preset feature generation model.
9. The method according to claim 8, characterized in that, The step of training the feature extraction model and the feature generation model to obtain the preset feature extraction model and the preset feature generation model using the multiple facial image training samples and the multiple reference feature training samples includes: The feature extraction model to be trained is used to extract features from the facial image training samples to obtain the image sample feature information of the facial image training samples. The liveness feature information of the sample is obtained by using the feature generation model to generate the reference feature training sample. Based on the liveness feature information of the sample and the reference feature training sample, calculate the feature loss information and distribution loss information corresponding to the feature information of the image sample; The parameters of the feature extraction model to be trained are adjusted based on the feature loss information to obtain the preset feature extraction model, and the parameters of the feature generation model to be trained are adjusted based on the distribution loss information to obtain the preset feature generation model.
10. The method according to claim 9, characterized in that, The step of calculating the feature loss information and distribution loss information corresponding to the image sample feature information based on the liveness feature information of the sample and the reference feature training sample includes: Using a preset discrimination module, the feature loss information between the image sample feature information and the sample liveness feature information is calculated; Using a preset distribution fitting module, the distribution loss information between the image sample feature information and the reference feature training sample is calculated.
11. The method according to claim 1, characterized in that, Before acquiring the facial image of the object to be detected, the following steps are included: Receive liveness detection trigger command; Based on the liveness detection trigger command, a video of the subject's face is acquired. Convert the video to be detected into at least one image to be detected; Face detection processing is performed on the at least one image to be detected to obtain the detection result; The facial image is determined from the at least one image to be detected based on the detection results.
12. The method according to claim 11, characterized in that, Determining the facial image from the at least one image to be detected based on the detection result includes: Based on the detection results, facial discrimination processing is performed on the at least one image to be detected to obtain a discrimination result; Based on the discrimination result, an initial facial image is selected from the at least one image to be detected; Perform facial registration on the initial facial image to obtain the location information of at least one facial key point in the initial facial image; Based on the location information of the facial key points, target facial key points are selected from the at least one facial key points; The facial image is generated based on the location information of the target facial key points.
13. A liveness detection device, characterized in that, include: An acquisition unit is used to acquire a facial image of the object to be detected and a reference feature set, wherein the feature distribution in the reference feature set is a target feature distribution, and the reference feature set includes at least one reference feature; A feature extraction unit is used to extract features from the facial image to obtain image feature information of the facial image; A feature mapping unit is used to perform live feature mapping processing on the at least one reference feature to obtain at least one reference live feature information; The discrimination unit is used to perform liveness discrimination processing on the image feature information based on the at least one reference liveness feature information to obtain the discrimination result of the image feature information; The distribution fitting unit is used to perform distribution fitting processing on the at least one reference feature based on the image feature information to obtain a distribution fitting result for the image feature information. A liveness detection unit is used to perform liveness detection on the object to be detected based on the discrimination result and the distribution fitting result.
14. A computer device, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to perform the operations in the liveness detection method according to any one of claims 1 to 12.
15. A storage medium, characterized in that, The storage medium stores a plurality of instructions adapted for loading by a processor to execute the steps of the liveness detection method according to any one of claims 1 to 12.
16. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the liveness detection method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Feature selection method, device and equipment based on machine learning and storage medium
CN110276369A
Living body detection method, device and equipment and storage medium
CN111368811A