Living body detection method and device, electronic equipment and storage medium
By combining the analysis of panoramic images and face images and mean filtering processing, the problems of insufficient accuracy of live detection and prosthetic attack in the prior art are solved, and higher detection accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202411387919.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-07
AI Technical Summary
When the existing live detection technology faces the challenges of the development of facial information acquisition technology and facial forgery technology, the accuracy of judgment is insufficient, and the prosthetic attacker continuously attacks by adjusting the distance and posture, resulting in the prosthetic breach, which affects the phenomenon of prosthetic breach. Detection accuracy.
Using a method of combining the panoramic image live body judgment model and the face image live body judgment model, the panoramic image live body score and face live body score are obtained through the simultaneous analysis of the panoramic image and the face image, and the scores are filtered to comprehensively evaluate the live body. Test results.
It improves the comprehensiveness and accuracy of live detection, enhances noise resistance and robustness, reduces the accidental breach caused by prosthetic attacks, and improves the ability to defend against prosthetic attacks.
Smart Images

Figure CN119274240A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a living body detection method, device, electronic device and storage medium. Background Art
[0002] Liveness detection technology is often used in identity authentication scenarios. It is a technology used to determine the true physiological characteristics of an object. It can effectively resist common attack methods such as photos, videos, face swapping, masks, occlusions, and screen reshoots, thereby helping users identify fraud and protect their interests.
[0003] At present, with the development of face information acquisition technology and face forgery technology, liveness detection technology faces more challenges. On the one hand, the information obtained from the detection image in the existing liveness detection scheme is relatively limited. On the other hand, the prosthesis attacker will adopt a variety of strategies such as constantly adjusting the distance and posture for continuous attack. In this process, the prosthesis may be broken, resulting in errors in liveness detection judgment.
[0004] In summary, how to improve the accuracy of liveness detection to enhance the ability to prevent prosthesis attacks has become a technical problem that urgently needs to be solved in this field. Summary of the invention
[0005] The main purpose of this application is to provide a liveness detection method, device, electronic device and storage medium, aiming to improve the judgment accuracy of liveness detection and enhance the ability to prevent prosthesis attacks.
[0006] To achieve the above objectives, the present application proposes a liveness detection method, which includes:
[0007] Input the test image into a preset panoramic image liveness judgment model to obtain a panoramic liveness score;
[0008] Inputting the face image of the face area in the test image into a preset face image liveness judgment model to obtain a face liveness score;
[0009] Performing mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score;
[0010] The liveness detection result of the test image is determined according to the target panoramic liveness score and the target face liveness score.
[0011] In one embodiment, before the step of inputting the test image into a preset panoramic image living body judgment model to obtain a panoramic living body score, the step further includes:
[0012] Acquire a first panoramic training sample, wherein the first panoramic training sample includes a first panoramic image marked with a living body label and a second panoramic image marked with a prosthesis label;
[0013] Acquire a first face training sample from the first panoramic training sample, wherein the first face training sample includes a first face image marked with a living body label and a second face image marked with a prosthesis label;
[0014] Performing face detection and face key point detection on the first panoramic training sample to obtain a second panoramic training sample labeled with face frame position labels, face key point labels and / or body key point labels;
[0015] Performing face detection and face key point detection on the first face training sample to obtain a second face training sample labeled with face key point labels;
[0016] Training the first neural network model based on the second panoramic training sample to obtain a trained panoramic image living body judgment model;
[0017] The second neural network model is trained based on the second face training sample to obtain a trained face image liveness determination model.
[0018] In one embodiment, before the step of inputting the face image of the face area in the test image into a preset face image liveness determination model to obtain a face liveness score, the step further includes:
[0019] Performing face detection and face key point detection on the test image to obtain a face detection result and a face key point detection result;
[0020] A face image is acquired from the test image according to the face detection result and the face key point detection result.
[0021] In one embodiment, before the step of inputting the test image into a preset panoramic image living body judgment model to obtain a panoramic living body score, the step further includes:
[0022] Performing face detection, brightness detection, occlusion detection, facial expression detection and face posture detection on the image to be tested in sequence to determine whether the image to be tested meets the preset living body detection conditions;
[0023] When the image to be tested meets the living body detection condition, the image to be tested is determined as a test image.
[0024] In one embodiment, the step of performing mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score comprises:
[0025] For the panoramic living body score, adding the panoramic living body score to the first score queue;
[0026] If the first score queue includes a historical panoramic liveness score, the panoramic liveness score and the historical panoramic liveness score are subjected to mean filtering to obtain a target panoramic liveness score;
[0027] If the first score queue does not include the historical panoramic living body score, the panoramic living body score is used as the target panoramic living body score.
[0028] In one embodiment, the step of performing mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score comprises:
[0029] For the face liveness score, adding the face liveness score to a second score queue;
[0030] If the second score queue contains a historical face liveness score, the face liveness score and the historical face liveness score are subjected to mean filtering to obtain a target face liveness score;
[0031] If the second score queue does not include the historical face liveness score, the face liveness score is used as the target face liveness score.
[0032] In one embodiment, the step of determining the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score includes:
[0033] Compare the target panoramic liveness score with a preset first threshold, and compare the target face liveness score with a preset second threshold;
[0034] When the target panoramic liveness score exceeds the first threshold and the target face liveness score exceeds the second threshold, it is determined that the liveness detection result of the test image is liveness.
[0035] In one embodiment, the step of determining the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score further includes:
[0036] When the target panoramic liveness score does not exceed the first threshold, and / or the target face liveness score does not exceed the second threshold, obtaining the queue lengths of the first score queue and the second score queue;
[0037] If the queue length of the first scoring queue and the queue length of the second scoring queue do not exceed a preset length threshold, acquiring the next frame of test image for liveness detection;
[0038] If the queue length of the first scoring queue and / or the queue length of the second scoring queue exceeds the length threshold, it is determined that the living body detection result of the test image is a prosthesis.
[0039] In one embodiment, the step of determining the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score further includes:
[0040] When the target panoramic liveness score does not exceed the first threshold, and / or the target face liveness score does not exceed the second threshold, obtaining the current detection duration;
[0041] If the current detection duration does not exceed the preset duration threshold, the next frame of test image is obtained for liveness detection;
[0042] If the current detection duration exceeds the duration threshold, it is determined that the living body detection result of the test image is a prosthesis.
[0043] In addition, to achieve the above-mentioned purpose, the present application also proposes a liveness detection device, which includes:
[0044] A panoramic judgment module is used to input the test image into a preset panoramic image liveness judgment model to obtain a panoramic liveness score;
[0045] A face judgment module, used for inputting a face image of a face area in the test image into a preset face image liveness judgment model to obtain a face liveness score;
[0046] A filtering module, used to perform mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score;
[0047] A liveness detection module is used to determine a liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score.
[0048] In addition, to achieve the above objectives, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the liveness detection method as described above.
[0049] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the liveness detection method as described above are implemented.
[0050] The present application proposes a liveness detection method. The present application first inputs a test image into a preset panoramic image liveness judgment model, and calculates the panoramic liveness score of the test image through the model, so as to preliminarily judge whether the image comes from a live body in a real scene. At the same time, a face image is extracted from the same test image and sent to the face image liveness judgment model, and the face liveness score of the face image is calculated through the model to further verify the authenticity of the face; then, in order to enhance the robustness and noise resistance of the judgment, the panoramic liveness score and the face liveness score are respectively subjected to mean filtering processing, and the interference of random noise is reduced by smoothing processing, so as to obtain a more stable target panoramic liveness score and target face liveness score; finally, based on these two optimized scores, a comprehensive evaluation is performed to determine the liveness detection result of the test image, so as to achieve accurate distinction between real users and fake attacks (such as photos, video playback, 3D printed masks, etc.).
[0051] In summary, the present application simultaneously analyzes panoramic images and facial images, comprehensively utilizes the global and local information of the image, realizes a comprehensive consideration from the environment to the individual, effectively makes up for the blind spots that may exist in single modality detection, and improves the comprehensiveness and accuracy of liveness detection; at the same time, the score is mean filtered to ensure the stability and reliability of the score, while reducing the accidental breach phenomenon that may be caused by continuous prosthetic attacks, further improving the accuracy and robustness of liveness detection, thereby improving the ability to defend against prosthetic attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0054] Figure 1 A schematic diagram of a flow chart provided for the first embodiment of the liveness detection method of the present application;
[0055] Figure 2 A schematic diagram of the model training process provided in Example 2 of the liveness detection method of this application;
[0056] Figure 3 A schematic diagram of the prosthetic image test results provided in Example 3 of the living body detection method of the present application;
[0057] Figure 4 A schematic diagram of the liveness image test results provided in Example 3 of the liveness detection method of the present application;
[0058] Figure 5 A brief flowchart of the third embodiment of the liveness detection method of the present application is provided;
[0059] Figure 6 This is a schematic diagram of the module structure of the living body detection device according to an embodiment of the present application;
[0060] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the liveness detection method in the embodiment of the present application.
[0061] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0062] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0063] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0064] The main solution of the embodiment of the present application is: input the test image into a preset panoramic image liveness judgment model to obtain a panoramic liveness score; input the face image in the face area of the test image into a preset face image liveness judgment model to obtain a face liveness score; perform mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score; determine the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score.
[0065] With the development of face information acquisition technology and face forgery technology, liveness detection technology faces more challenges. On the one hand, the information obtained from the detection image in the existing liveness detection scheme is relatively limited. On the other hand, the prosthesis attacker will adopt a variety of strategies such as constantly adjusting the distance and posture for continuous attack. In this process, the prosthesis may be broken, resulting in errors in liveness detection judgment.
[0066] The embodiment of the present application provides a solution, which comprehensively utilizes the global and local information of the image by simultaneously analyzing the panoramic image and the face image, realizes a comprehensive consideration from the environment to the individual, effectively makes up for the blind spots that may exist in single modality detection, and improves the comprehensiveness and accuracy of liveness detection; at the same time, the score is mean filtered to ensure the stability and reliability of the score, while reducing the accidental breach phenomenon that may be caused by continuous prosthesis attacks, further improving the accuracy and robustness of liveness detection, thereby improving the ability to defend against prosthesis attacks.
[0067] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a computer, a server, etc., or an electronic device capable of realizing the above functions, etc. The following takes the liveness detection terminal as an example to illustrate this embodiment and the following embodiments.
[0068] Based on this, the present application embodiment provides a method for detecting a living body, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the living body detection method of the present application.
[0069] In this embodiment, the living body detection method includes steps S10 to S40:
[0070] Step S10, inputting the test image into a preset panoramic image living body judgment model to obtain a panoramic living body score;
[0071] The test image to be detected is taken as input and sent to a pre-trained panoramic image liveness judgment model. The model can capture and analyze the global features in the test image, such as scene background, lighting conditions, object motion trajectory, etc., to preliminarily evaluate whether the test image has the characteristics of a real scene, and then output a panoramic liveness score. The score reflects the liveness possibility of the test image under a panoramic perspective. The score can be set to 0-100, 0-10, 0-1, etc. based on the actual application scenario. The score range of the panoramic liveness score is not specifically limited in this embodiment.
[0072] Exemplarily, the global features of the panoramic image liveness judgment model include the scene background, lighting conditions and object motion trajectory represented by the test image. The panoramic image liveness judgment model distinguishes between real scenes and fake scenes by learning the scene background features in real scenes. When the background of the test image does not match the real scene, the model reduces its panoramic liveness score according to the preset background weight; the model analyzes the lighting conditions in the test image, especially the light and shadow changes in the face area. When an unnatural lighting pattern is identified, the model can further reduce the liveness score of the image; in real scenes, the movement of the face (such as blinking, turning the head, etc.) will be accompanied by the relative movement of surrounding objects, such as the swinging of hair, the fluttering of clothes, etc. The panoramic image liveness judgment model can capture and analyze the motion trajectory of objects (including the face itself) in the test image. When an unnatural motion pattern or an area lacking motion changes is detected, the model can further reduce the liveness score of the image. In this way, by incorporating the scene background, lighting conditions and object motion trajectory as global features into the liveness detection process, the accuracy of detection can be improved.
[0073] Step S20, inputting the face image of the face area in the test image into a preset face image liveness determination model to obtain a face liveness score;
[0074] An image of the face area, i.e., the face image, is extracted from the test image, and the face image is sent as input to the face image liveness judgment model. The model focuses on analyzing facial details, such as skin texture, facial expression, eye movement and other biological features. By comparing these features with the known live face features, a face liveness score is output. The score reflects the liveness possibility of the face image from the face perspective. The score can be set to 0-100, 0-10, 0-1 and other areas based on the actual application scenario. In this embodiment, the score range of the face liveness score is not specifically limited.
[0075] In addition, in a feasible implementation, before the test image and the facial image of the facial area in the test image are respectively input into the model for liveness judgment, image preprocessing operations can be performed on the test image and the facial image, such as geometric scaling, padding to the neural network input size, subtracting the mean, removing the variance, normalizing the image pixel values to between 0 and 1, etc., and then the preprocessed test image and facial image are input into the model for liveness detection.
[0076] Step S30, performing mean filtering processing on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score;
[0077] In order to further improve the stability and accuracy of the detection results, the panoramic liveness score and face liveness score obtained in steps S10 and S20 are respectively subjected to mean filtering to reduce the impact of random noise on the detection results. After filtering, smoother and more reliable target panoramic liveness score and target face liveness score are obtained.
[0078] Step S40: determining a liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score.
[0079] The final liveness detection result of the test image is determined by combining the target panoramic liveness score and the target face liveness score. The determination process can adopt certain fusion strategies (such as weighted summation, logical judgment, etc.) for comprehensive evaluation to make a comprehensive liveness judgment based on the global information of the test image and the local information of the face, so as to ensure the comprehensiveness and accuracy of liveness detection.
[0080] Exemplarily, a first parameter obtained by multiplying the target panoramic liveness score by a first preset weight and a second parameter obtained by multiplying the target face liveness score by a second preset weight are summed to obtain a liveness detection result of the test image, wherein the sum of the first preset weight and the second preset weight is one.
[0081] Based on the evaluation results, the terminal can output corresponding judgment information, such as "liveness detection passed" or "liveness detection failed", to assist subsequent authentication or security control processes.
[0082] In this way, the embodiment of the present application simultaneously analyzes panoramic images and facial images, comprehensively utilizes the global and local information of the image, realizes a comprehensive consideration from the environment to the individual, effectively makes up for the blind spots that may exist in single modality detection, and improves the comprehensiveness and accuracy of liveness detection; at the same time, the score is mean filtered to ensure the stability and reliability of the score, while reducing the accidental breach phenomenon that may be caused by continuous prosthesis attacks, further improving the accuracy and robustness of liveness detection, thereby improving the ability to defend against prosthesis attacks.
[0083] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 As shown, before step S10, steps A10 to A60 may also be included:
[0084] Step A10, obtaining a first panoramic training sample, wherein the first panoramic training sample includes a first panoramic image marked with a living body label and a second panoramic image marked with a prosthesis label;
[0085] The first panoramic training samples are collected, which include two categories of images: one is the first panoramic images that have been clearly marked as living body labels, which are panoramic view images of living bodies; the other is the second panoramic images that have been clearly marked as prosthetic body labels, which are fake scene panoramas simulated by various prostheses (such as photos, video playbacks, etc.). These images are specifically used to train a model that can recognize panoramic features of living bodies.
[0086] Step A20, obtaining a first face training sample from the first panoramic training sample, wherein the first face training sample includes a first face image marked with a living body label and a second face image marked with a prosthesis label;
[0087] From the first panoramic training sample, an image containing a face area is further extracted to form a first face training sample, which includes a first face image marked with a live label and a second face image marked with a prosthesis label. These images are specifically used to train a model that can recognize live face features.
[0088] Step A30, performing face detection and face key point detection on the first panoramic training sample to obtain a second panoramic training sample with face frame position labels, face key point labels and / or body key point labels;
[0089] Face detection and facial key point detection are performed on each panoramic image in the first panoramic training sample (including the first panoramic image and the second panoramic image), and the position of the face frame, facial key points (such as eyes, nose, mouth, etc.) and possible human body key points (such as shoulders, head contour, etc.) are annotated automatically or manually. The second panoramic training sample with labeled face frame position labels, facial key point labels and / or human body key point labels is obtained through detection. Of course, the second panoramic training sample also includes live labels and prosthesis labels. In this way, the second panoramic training sample not only contains the original image data, but also adds rich semantic information, which helps to improve the training model's ability to understand complex scenes.
[0090] Step A40, performing face detection and face key point detection on the first face training sample to obtain a second face training sample with face key point labels;
[0091] Face detection and facial key point detection are also performed on each face image in the first face training sample (including the first face image and the second face image), and a second face training sample with facial key point labels is obtained through detection. Of course, the second face training sample also includes live labels and prosthesis labels, so that the training model can focus more on facial details.
[0092] In addition, before the model training is performed based on the second panoramic training sample and the second face training sample, the sample images may be preprocessed, such as geometric scaling, padding, mean subtraction, variance removal, and normalization of image pixel values to between 0 and 1.
[0093] In this embodiment, the panoramic image network input and the face area network input are 192x192 pixels.
[0094] Step A50, training the first neural network model based on the second panoramic training sample to obtain a trained panoramic image living body judgment model;
[0095] It should be noted that the specific algorithm network structure of the first neural network model and the second neural network model is not limited in this embodiment, and may be a MobileNet (lightweight) convolutional neural network structure, a residual convolutional neural network structure, a central difference convolutional neural network structure, or a network structure that may include an attention module, etc.
[0096] The first neural network model is trained using the second panoramic training samples. By continuously optimizing the parameters and structure of the model, it can accurately distinguish between real living bodies and fake body attacks in panoramic images, and finally a trained panoramic image living body judgment model is obtained.
[0097] Step A60: training the second neural network model based on the second face training sample to obtain a trained face image liveness determination model.
[0098] The second face training sample is used to train the second neural network model, which focuses on liveness detection in the face area and improves the recognition ability of live faces by learning the dynamic changes of key points of the face, skin texture and other subtle features. After sufficient training, a trained face image liveness judgment model is obtained.
[0099] In a feasible implementation, the panoramic image liveness judgment model adopts the MobileNetV1 (a lightweight network name) network structure. This is because panoramic images usually contain a wider field of view and more background information, and require higher computing resources. The lightweight characteristics of MobileNetV1 are very suitable for this demand. The MobileNetV1 network structure can significantly reduce the number of parameters and the amount of calculation of the model through depthwise separable convolution, so that the model can process panoramic images faster while maintaining a high accuracy rate. The face image liveness judgment model adopts a central difference convolution network structure. This is because face liveness detection requires accurate identification of subtle differences such as facial micro-expressions and skin texture to distinguish real faces from forged images or videos. The central difference convolution can better extract these key features through its special convolution kernel design, thereby improving the accuracy and robustness of face liveness detection. The two models can output two classification results respectively, 0 represents a prosthesis and 1 represents a real person.
[0100] In a feasible implementation, the loss functions in the model training process may include BCELoss (BinaryCross-EntropyLoss, binary cross entropy loss function), FocalLoss (focal loss function) and SmoothL1Loss (smoothed mean absolute error loss function), etc.
[0101] In this way, by training two independent liveness judgment models to optimize the different features of panoramic images and facial images respectively, it is possible to more accurately capture and analyze the subtle differences between real living bodies and prostheses, thereby further improving the accuracy of liveness detection.
[0102] Based on the first embodiment and / or the second embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those of the first embodiment and the second embodiment can be referred to the above introduction, and will not be described in detail later. On this basis, steps B10 to B20 may be included before step S20:
[0103] Step B10, performing face detection and face key point detection on the test image to obtain a face detection result and a face key point detection result;
[0104] Before performing liveness judgment on a face image, it is first necessary to perform face detection and face key point detection on the test image. Specifically, face detection technology is used to automatically identify the face area in the test image, and further detect the positions of key points on the face (such as eyes, nose, mouth, etc.). The face detection result includes the coordinates and size information of the face frame, while the face key point detection result records the specific positions of the key points in detail. This information provides the necessary basis for the subsequent accurate extraction of face images from the test image.
[0105] Step B20: acquiring a face image from the test image according to the face detection result and the face key point detection result.
[0106] Based on the face detection results and the face key point detection results, an image containing the complete face area is cropped from the test image, thereby ensuring that the subsequent face image liveness judgment model processes high-quality, interference-free face images, thereby improving the accuracy and reliability of face image liveness judgment.
[0107] In a feasible embodiment, before step S10, steps C10 to C20 may be further included:
[0108] Step C10, performing face detection, brightness detection, occlusion detection, facial expression detection and face posture detection on the image to be tested in sequence to determine whether the image to be tested meets a preset living body detection condition;
[0109] Before the image to be tested is formally included in the liveness detection process, a series of pre-condition tests are first performed on it. These tests include but are not limited to face detection (confirming whether there is a face in the image and that the face size meets the preset conditions), brightness detection (checking whether the image brightness is appropriate to avoid too dark or too bright affecting the detection effect), occlusion detection (determining whether the face is blocked, such as wearing a mask, sunglasses, etc.), facial expression detection (preliminary judgment of whether the expression is natural to prevent the use of static images or video frames) and face posture detection (evaluating whether the face is at a suitable angle and position). Through these multi-dimensional tests, images to be tested that meet the basic conditions for liveness detection can be preliminarily screened out.
[0110] Step C20: when the image to be tested meets the living body detection condition, determine the image to be tested as a test image.
[0111] After acquiring the image to be detected, perform face detection on the image to be detected; if a face is detected and the face size meets the preset conditions, perform subsequent judgment, otherwise re-acquire the next frame image and repeat the above steps; after detecting the face and the face size meets the preset conditions, perform brightness judgment and occlusion detection, facial expression detection and face posture detection. When the image to be tested successfully passes all detections, that is, the face image to be detected meets the brightness threshold, the facial expression has no exaggerated or stiff expressions, the face angle is less than the preset threshold and there is no occlusion, perform subsequent judgment, otherwise re-acquire the next frame image and repeat the above steps.
[0112] In this way, when the image to be tested successfully passes all tests, that is, it meets the preset liveness detection conditions, the image is officially determined as a test image, and the subsequent liveness detection process continues, that is, the image to be tested is determined as a test image, and the step of "inputting the test image into the preset panoramic image liveness judgment model to obtain a panoramic liveness score" and subsequent steps are executed, ensuring that only images of qualified quality and meeting the requirements will be used for liveness detection, thereby improving the efficiency and accuracy of the entire detection process.
[0113] In a feasible embodiment, step S30 may include steps S301 to S303:
[0114] Step S301, with respect to the panoramic living body score, adding the panoramic living body score to a first score queue;
[0115] The calculated panoramic living body score is added to a preset first score queue, which is used to store the most recent panoramic living body detection results.
[0116] Step S302: If the first score queue includes a historical panoramic liveness score, the panoramic liveness score and the historical panoramic liveness score are subjected to mean filtering to obtain a target panoramic liveness score;
[0117] Check whether the first score queue contains historical panoramic liveness scores. If there is historical data in the queue, the latest panoramic liveness score and the historical scores in the queue are averaged and filtered. The random error is reduced by averaging multiple scores to obtain a more stable and reliable target panoramic liveness score.
[0118] Step S303: If the first score queue does not include the historical panoramic liveness score, the panoramic liveness score is used as the target panoramic liveness score.
[0119] If the first score queue does not contain any historical panoramic liveness score, that is, the queue is empty, the current panoramic liveness score is directly used as the target panoramic liveness score without additional filtering processing.
[0120] In a feasible embodiment, step S30 may further include steps S304 to S306:
[0121] Step S304, with respect to the face liveness score, adding the face liveness score to a second score queue;
[0122] The calculated face liveness score is added to a preset second score queue, which is used to store the most recent face liveness detection results.
[0123] Step S305: If the second score queue contains a historical face liveness score, the face liveness score and the historical face liveness score are subjected to mean filtering to obtain a target face liveness score;
[0124] Check whether the second score queue contains historical face liveness scores. If there is historical data in the queue, the latest face liveness score and the historical scores in the queue are averaged and filtered. The random error is reduced by averaging multiple scores to obtain a more stable and reliable target face liveness score.
[0125] Step S306: If the second score queue does not include the historical face liveness score, use the face liveness score as the target face liveness score.
[0126] If the second score queue does not contain any historical face liveness score, that is, the queue is empty, the current face liveness score is directly used as the target face liveness score without additional filtering processing.
[0127] For example, the following experimental diagram illustrates the advantage of performing mean filtering on the liveness score to prevent the prosthesis from being broken. In the experiment, a prosthesis image is taken as an example. Figure 3 As shown in the figure, the horizontal axis represents the queue length (which can be regarded as the length of the first scoring queue or the length of the second scoring queue), and the vertical axis represents the liveness score (which can be regarded as the panoramic liveness score or the face liveness score). Among them, the broken line 1 represents multiple liveness scores without mean filtering processing, and the broken line 2 represents multiple liveness scores after mean filtering processing. It can be seen that a part of the liveness scores that have not been processed by mean filtering will exceed the preset threshold (the threshold is 0.5 in the figure), that is, this situation represents that the prosthesis is broken. At some moments, the terminal did not recognize the prosthesis, and the liveness scores after mean filtering processing did not exceed the threshold, indicating that the prosthesis was not broken.
[0128] In another experiment, taking living body images as an example, Figure 4As shown in the figure, the horizontal axis represents the queue length (which can be regarded as the length of the first scoring queue or the length of the second scoring queue), and the vertical axis represents the liveness score (which can be regarded as the panoramic liveness score or the face liveness score). Among them, the broken line 3 represents multiple liveness scores without mean filtering, and the broken line 4 represents multiple liveness scores after mean filtering. It can be seen that a part of the liveness scores that have not been processed by mean filtering will be lower than the preset threshold (the threshold is 0.5 in the figure), that is, this situation represents that the terminal has not recognized the liveness, and the liveness scores after mean filtering are all above the threshold, which means that the terminal can accurately recognize the liveness every time.
[0129] In this way, whether it is a panoramic liveness score or a face liveness score, a more stable and reliable target score can be obtained through mean filtering technology based on historical data, thereby improving the accuracy and generalization ability of liveness detection.
[0130] In a feasible embodiment, step S40 may include S401-S402:
[0131] Step S401, comparing the target panoramic liveness score with a preset first threshold, and comparing the target face liveness score with a preset second threshold;
[0132] The calculated target panoramic liveness score is compared with a preset first threshold, and the target face liveness score is compared with a preset second threshold. These two thresholds represent the minimum scores that can be judged as liveness by panoramic and face liveness detection, respectively. For example, when the score range is 0-100, the threshold can be set to 50 points, when the score range is 0-10, the threshold can be set to 5 points, and when the score range is 0-1, the threshold can be set to 0.5 points. When setting, the first threshold and the second threshold can be the same or different, and this is not specifically limited in this embodiment.
[0133] Step S402: When the target panoramic liveness score exceeds the first threshold and the target face liveness score exceeds the second threshold, determine that the liveness detection result of the test image is liveness.
[0134] If the target panoramic liveness score exceeds the first threshold and the target face liveness score also exceeds the second threshold, it is considered that the test image meets the liveness detection requirement and its liveness detection result is determined to be liveness.
[0135] In a feasible embodiment, step S40 may include S403 to S405:
[0136] Step S403, when the target panoramic liveness score does not exceed the first threshold and / or the target face liveness score does not exceed the second threshold, obtaining the queue lengths of the first score queue and the second score queue respectively;
[0137] When the target panoramic liveness score and / or face liveness score does not exceed the respective thresholds, the queue lengths of the first score queue (the queue storing the panoramic liveness scores) and the second score queue (the queue storing the face liveness scores) are obtained.
[0138] Step S404: if the queue length of the first scoring queue and the queue length of the second scoring queue do not exceed a preset length threshold, obtaining the next frame of test image for liveness detection;
[0139] Step S405: If the queue length of the first scoring queue and / or the queue length of the second scoring queue exceeds the length threshold, it is determined that the liveness detection result of the test image is a prosthesis.
[0140] If the lengths of both queues do not exceed the preset length threshold, it means that further detection can be performed, so the next frame of test image is obtained for liveness detection. If the length of any queue exceeds the length threshold, it is considered that after multiple tests, the score still does not meet the requirement, so the liveness detection result of the test image is determined to be a fake. The size of the length threshold is not specifically limited.
[0141] In a feasible embodiment, step S40 may include S406 to S408:
[0142] Step S406, when the target panoramic liveness score does not exceed the first threshold and / or the target face liveness score does not exceed the second threshold, obtaining the current detection duration;
[0143] When the target panoramic liveness score and / or face liveness score does not exceed their respective thresholds, the current detection duration is recorded and obtained. The detection duration is the time after the detection process starts, which can also be regarded as the time from the moment when the recorded score appears in the score queue to the current moment.
[0144] Step S407, if the current detection duration does not exceed the preset duration threshold, obtaining the next frame of test image for living body detection;
[0145] Step S408: If the current detection duration exceeds the duration threshold, it is determined that the liveness detection result of the test image is a prosthesis.
[0146] If the current detection duration does not exceed the preset duration threshold, it indicates that the detection process is still within the acceptable time range, so continue to obtain the next frame of test image for liveness detection. If the detection duration exceeds the duration threshold, it is considered that the test image has not passed the liveness detection for a long time, so the liveness detection result of the test image is determined to be a fake.
[0147] In this way, in this embodiment, the liveness detection result of the test image can be comprehensively judged based on the panoramic liveness score and the face liveness score, as well as the queue length and / or duration during the detection process, so as to improve the accuracy and efficiency of liveness detection.
[0148] For example, to help understand the implementation process of the liveness detection method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 5 , Figure 5 A brief schematic diagram of a liveness detection method is provided, specifically:
[0149] After obtaining the test image, the following two threads can be performed simultaneously: one is to obtain a face image from the test image, and then input the face image into the face image liveness judgment model to obtain a face liveness score, and then perform mean filtering on the face liveness score to obtain a target face liveness score; the other is to input the test image into the panoramic image liveness judgment model to obtain a panoramic liveness score, and then perform mean filtering on the panoramic liveness score to obtain a target panoramic liveness score. Then, it is determined whether the target face liveness score and the target panoramic liveness score exceed the preset threshold, if both scores exceed the threshold, the liveness detection result of the test image is determined to be live, and if the target face liveness score and / or the target panoramic liveness score do not exceed the preset threshold, the liveness detection result of the test image is determined to be a fake.
[0150] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the liveness detection method of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.
[0151] The present application also provides a living body detection device, please refer to Figure 6 , the living body detection device comprises:
[0152] A panoramic judgment module 10 is used to input the test image into a preset panoramic image living body judgment model to obtain a panoramic living body score;
[0153] A face judgment module 20 is used to input the face image of the face area in the test image into a preset face image liveness judgment model to obtain a face liveness score;
[0154] A filtering module 30, configured to perform mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score;
[0155] The liveness detection module 40 is used to determine the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score.
[0156] Optionally, the liveness detection device further includes a model training module (not shown), and the model training module is used to:
[0157] Acquire a first panoramic training sample, wherein the first panoramic training sample includes a first panoramic image marked with a living body label and a second panoramic image marked with a prosthesis label;
[0158] Acquire a first face training sample from the first panoramic training sample, wherein the first face training sample includes a first face image marked with a living body label and a second face image marked with a prosthesis label;
[0159] Performing face detection and face key point detection on the first panoramic training sample to obtain a second panoramic training sample labeled with face frame position labels, face key point labels and / or body key point labels;
[0160] Performing face detection and face key point detection on the first face training sample to obtain a second face training sample labeled with face key point labels;
[0161] Training the first neural network model based on the second panoramic training sample to obtain a trained panoramic image living body judgment model;
[0162] The second neural network model is trained based on the second face training sample to obtain a trained face image liveness determination model.
[0163] Optionally, the living body detection device further includes an image acquisition module (not shown), and the image acquisition module is used to:
[0164] Performing face detection and face key point detection on the test image to obtain a face detection result and a face key point detection result;
[0165] A face image is acquired from the test image according to the face detection result and the face key point detection result.
[0166] Optionally, the liveness detection device further includes a detection condition judgment module (not shown), which is used to:
[0167] Performing face detection, brightness detection, occlusion detection, facial expression detection and face posture detection on the image to be tested in sequence to determine whether the image to be tested meets the preset living body detection conditions;
[0168] When the image to be tested meets the living body detection condition, the image to be tested is determined as a test image.
[0169] Optionally, the filtering module 30 is further configured to:
[0170] For the panoramic living body score, adding the panoramic living body score to the first score queue;
[0171] If the first score queue includes a historical panoramic liveness score, the panoramic liveness score and the historical panoramic liveness score are subjected to mean filtering to obtain a target panoramic liveness score;
[0172] If the first score queue does not include the historical panoramic living body score, the panoramic living body score is used as the target panoramic living body score.
[0173] Optionally, the filtering module 30 is further configured to:
[0174] For the face liveness score, adding the face liveness score to a second score queue;
[0175] If the second score queue contains a historical face liveness score, the face liveness score and the historical face liveness score are subjected to mean filtering to obtain a target face liveness score;
[0176] If the second score queue does not include the historical face liveness score, the face liveness score is used as the target face liveness score.
[0177] Optionally, the living body detection module 40 is further used for:
[0178] Compare the target panoramic liveness score with a preset first threshold, and compare the target face liveness score with a preset second threshold;
[0179] When the target panoramic liveness score exceeds the first threshold and the target face liveness score exceeds the second threshold, it is determined that the liveness detection result of the test image is liveness.
[0180] Optionally, the living body detection module 40 is further used for:
[0181] When the target panoramic liveness score does not exceed the first threshold, and / or the target face liveness score does not exceed the second threshold, obtaining the queue lengths of the first score queue and the second score queue;
[0182] If the queue length of the first scoring queue and the queue length of the second scoring queue do not exceed a preset length threshold, acquiring the next frame of test image for liveness detection;
[0183] If the queue length of the first scoring queue and / or the queue length of the second scoring queue exceeds the length threshold, it is determined that the living body detection result of the test image is a prosthesis.
[0184] Optionally, the living body detection module 40 is further used for:
[0185] When the target panoramic liveness score does not exceed the first threshold, and / or the target face liveness score does not exceed the second threshold, obtaining the current detection duration;
[0186] If the current detection duration does not exceed the preset duration threshold, the next frame of test image is obtained for liveness detection;
[0187] If the current detection duration exceeds the duration threshold, it is determined that the living body detection result of the test image is a prosthesis.
[0188] The liveness detection device provided in the embodiment of the present application adopts the liveness detection method in the above embodiment, which can improve the judgment accuracy of liveness detection to enhance the anti-fake attack capability. Compared with the prior art, the beneficial effects of the liveness detection device provided in the embodiment of the present application are the same as the beneficial effects of the liveness detection method provided in the above embodiment, and other technical features in the liveness detection device are the same as the features disclosed in the liveness detection method in the above embodiment, which will not be described in detail here.
[0189] An embodiment of the present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the liveness detection method in the above-mentioned embodiment 1.
[0190] Reference below Figure 7 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic device in the embodiments of the present application may include but is not limited to mobile terminals such as laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0191] like Figure 7As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0192] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0193] The electronic device provided in the embodiment of the present application adopts the liveness detection method in the above embodiment, which can improve the judgment accuracy of liveness detection to enhance the anti-fake attack capability. Compared with the prior art, the beneficial effects of the electronic device provided in the embodiment of the present application are the same as the beneficial effects of the liveness detection method provided in the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the liveness detection method in the previous embodiment, which will not be described in detail here.
[0194] It should be understood that the various parts disclosed in the embodiments of the present application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0195] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0196] An embodiment of the present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the living body detection method in the above embodiment.
[0197] The computer-readable storage medium provided in the embodiment of the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0198] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0199] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the electronic device: inputs a test image into a preset panoramic image liveness judgment model to obtain a panoramic liveness score; inputs a face image in a face area of the test image into a preset face image liveness judgment model to obtain a face liveness score; performs mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score; and determines a liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score.
[0200] The computer program code for performing the operation of the embodiment of the present application can be written in one or more programming languages or a combination thereof, and the above-mentioned programming languages include object-oriented programming languages, such as Java, Smalltalk, C++, and also include conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN: Local Area Network) or a wide area network (WAN: Wide Area Network), or it can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0201] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0202] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0203] The readable storage medium provided in the embodiment of the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned liveness detection method, and can improve the judgment accuracy of liveness detection to enhance the anti-prosthesis attack capability. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the embodiment of the present application are the same as the beneficial effects of the liveness detection method provided in the above-mentioned embodiment, and will not be repeated here.
[0204] The above are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for detecting a living body, characterized in that: The living body detection method comprises: Input the test image into a preset panoramic image liveness judgment model to obtain a panoramic liveness score; Inputting the face image of the face area in the test image into a preset face image liveness judgment model to obtain a face liveness score; Performing mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score; The liveness detection result of the test image is determined according to the target panoramic liveness score and the target face liveness score.
2. The method for detecting a living body according to claim 1, wherein: Before the step of inputting the test image into a preset panoramic image living body judgment model to obtain a panoramic living body score, the method further includes: Acquire a first panoramic training sample, wherein the first panoramic training sample includes a first panoramic image marked with a living body label and a second panoramic image marked with a prosthesis label; Acquire a first face training sample from the first panoramic training sample, wherein the first face training sample includes a first face image marked with a living body label and a second face image marked with a prosthesis label; Performing face detection and face key point detection on the first panoramic training sample to obtain a second panoramic training sample labeled with face frame position labels, face key point labels and / or body key point labels; Performing face detection and face key point detection on the first face training sample to obtain a second face training sample labeled with face key point labels; Training the first neural network model based on the second panoramic training sample to obtain a trained panoramic image living body judgment model; The second neural network model is trained based on the second face training sample to obtain a trained face image liveness determination model.
3. The method for detecting a living body according to claim 1, wherein: Before the step of inputting the face image of the face area in the test image into a preset face image liveness determination model to obtain a face liveness score, the step further includes: Performing face detection and face key point detection on the test image to obtain a face detection result and a face key point detection result; A face image is acquired from the test image according to the face detection result and the face key point detection result.
4. The method for detecting a living body according to claim 1, wherein: Before the step of inputting the test image into a preset panoramic image living body judgment model to obtain a panoramic living body score, the method further includes: Performing face detection, brightness detection, occlusion detection, facial expression detection and face posture detection on the image to be tested in sequence to determine whether the image to be tested meets the preset living body detection conditions; When the image to be tested meets the living body detection condition, the image to be tested is determined as a test image.
5. The method for detecting a living body according to claim 1, wherein: The step of performing mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score comprises: For the panoramic living body score, adding the panoramic living body score to the first score queue; If the first score queue includes a historical panoramic liveness score, the panoramic liveness score and the historical panoramic liveness score are subjected to mean filtering to obtain a target panoramic liveness score; If the first score queue does not include the historical panoramic living body score, the panoramic living body score is used as the target panoramic living body score.
6. The method for detecting living body according to claim 5, characterized in that: The step of performing mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score comprises: For the face liveness score, adding the face liveness score to a second score queue; If the second score queue contains a historical face liveness score, the face liveness score and the historical face liveness score are subjected to mean filtering to obtain a target face liveness score; If the second score queue does not include the historical face liveness score, the face liveness score is used as the target face liveness score.
7. The method for detecting a living body according to claim 6, wherein: The step of determining the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score comprises: Compare the target panoramic liveness score with a preset first threshold, and compare the target face liveness score with a preset second threshold; When the target panoramic liveness score exceeds the first threshold and the target face liveness score exceeds the second threshold, it is determined that the liveness detection result of the test image is liveness.
8. The method for detecting living body according to claim 7, characterized in that: The step of determining the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score further includes: When the target panoramic liveness score does not exceed the first threshold, and / or the target face liveness score does not exceed the second threshold, obtaining the queue lengths of the first score queue and the second score queue; If the queue length of the first scoring queue and the queue length of the second scoring queue do not exceed a preset length threshold, acquiring the next frame of test image for liveness detection; If the queue length of the first scoring queue and / or the queue length of the second scoring queue exceeds the length threshold, it is determined that the living body detection result of the test image is a prosthesis.
9. The method for detecting a living body according to claim 7, wherein: The step of determining the liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score further includes: When the target panoramic liveness score does not exceed the first threshold, and / or the target face liveness score does not exceed the second threshold, obtaining the current detection duration; If the current detection duration does not exceed the preset duration threshold, the next frame of test image is obtained for liveness detection; If the current detection duration exceeds the duration threshold, it is determined that the living body detection result of the test image is a prosthesis.
10. A living body detection device, characterized in that: The device comprises: A panoramic judgment module, used to input the test image into a preset panoramic image liveness judgment model to obtain a panoramic liveness score; A face judgment module, used for inputting a face image of a face area in the test image into a preset face image liveness judgment model to obtain a face liveness score; A filtering module, used to perform mean filtering on the panoramic liveness score and the face liveness score respectively to obtain a target panoramic liveness score and a target face liveness score; A liveness detection module is used to determine a liveness detection result of the test image according to the target panoramic liveness score and the target face liveness score.
11. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the living body detection method according to any one of claims 1 to 9.
12. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the living body detection method according to any one of claims 1 to 9 are implemented.