Testing method, device and storage medium for living body detection algorithm

By constructing a test material set and calculating the live body one-time pass rate and the accuracy of live body detection in a single frame image, the problem of long and poor test time and poor results in the existing technology is solved, and a faster and more effective test effect is achieved.

CN119380153BActive Publication Date: 2025-04-25JINAN BOGUAN INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411962341.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-25
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

In the prior art, large-scale live detection algorithms are used to conduct actual measurements, which leads to a long time and poor test results.

Method used

By constructing a test material set, the live detection algorithm is tested, and the one-time pass rate of living organisms and the accuracy of living organisms are calculated in order to comprehensively evaluate the test effect.

Benefits of technology

It realizes a faster and more efficient evaluation of the test effect of the live detection algorithm, reduces manpower and time consumption, and the test results more truly reflect the actual traffic situation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119380153B_ABST
    Figure CN119380153B_ABST
Patent Text Reader

Abstract

The present invention provides a test method, device and storage medium for a liveness detection algorithm, which is applied to the field of computer technology, including: obtaining a first test material set collected in advance for multiple real-person objects; the first test material set includes multiple groups of first test images, each group of first test images includes at least one test picture or at least one test video; each first test image is input into a liveness detection algorithm to determine the liveness detection result corresponding to each group of first test images; according to the liveness detection result of each first test image, the liveness one-time pass rate of the first test material set is calculated; the liveness one-time pass rate represents the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people; according to the liveness one-time pass rate of the first test material set, the test result of the liveness detection algorithm is determined. The technical solution of the present invention can improve the test effect of the liveness detection algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a testing method, device and storage medium for a living body detection algorithm. Background Art

[0002] Liveness detection means that when a face passes through a face recognition terminal, after the face recognition terminal recognizes the face, it can input the recognized face into the liveness detection algorithm of the face recognition terminal, and detect whether the face is live (i.e. real person) or non-live (i.e. fake person) through the liveness detection algorithm. In order to ensure a high liveness detection accuracy, it is generally necessary to test the liveness detection algorithm.

[0003] In the related art, when testing a liveness detection algorithm, a large number of real people are generally used to conduct actual tests on the liveness detection algorithm to obtain the test results.

[0004] However, the above technology has the problems of being time-consuming and having poor testing effect. Summary of the invention

[0005] The present invention provides a testing method, device and storage medium for a liveness detection algorithm, which are used to solve the defect of using a large number of real people to conduct actual tests on liveness detection algorithms in the prior art, which is time-consuming and labor-intensive. The liveness detection algorithm is tested by a constructed test material set, and the liveness one-time pass rate and the liveness detection accuracy of a single-frame image are calculated based on the test results, so as to determine the test effect of the liveness detection algorithm more comprehensively and effectively.

[0006] The present invention provides a method for testing a liveness detection algorithm, comprising:

[0007] Acquire a first test material set collected in advance for a plurality of real-person objects; the first test material set includes a plurality of groups of first test images, each group of first test images includes at least one test picture or at least one test video;

[0008] Input each first test image into a liveness detection algorithm for liveness detection, and determine a liveness detection result corresponding to each group of first test images; the liveness detection result includes a liveness state of an object included in the first test image, and the liveness state includes liveness or non-liveness;

[0009] According to the liveness detection results of each first test image, a liveness one-time pass rate corresponding to the first test material set is calculated; the liveness one-time pass rate is used to represent the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage of people without stopping to the total number of detected people;

[0010] The test result of the liveness detection algorithm is determined according to the liveness one-time pass rate of the first test material set.

[0011] According to a method for testing a liveness detection algorithm provided by the present invention, before inputting each first test image into the liveness detection algorithm for liveness detection and determining the liveness detection result corresponding to each group of first test images, the method further includes:

[0012] Acquire an initial identification of an object included in each first test image; the initial identification is a face identification determined after performing face detection and / or face tracking on the first test image;

[0013] Using a facial feature extraction model to extract facial features from a first test image of a current frame and an adjacent first test image of a previous frame, and determining facial features corresponding to the first test image of the current frame and facial features corresponding to the first test image of the previous frame;

[0014] Based on the similarity between the facial features of the first test image of the current frame and the facial features of the first test image of the previous frame, determine whether to correct the initial identification of the first test image of the current frame to the initial identification of the first test image of the previous frame; wherein the initial identification corresponding to the same facial feature after identification correction is the same.

[0015] According to a testing method for a living body detection algorithm provided by the present invention, if the first test material set is a first test material set collected by a multi-camera, the first test material set collected in advance for a plurality of real people is obtained, including:

[0016] Acquire a plurality of first test images captured by each camera for a plurality of real-person objects;

[0017] According to the preset information of each first test image, multiple first test images of each camera are synchronously matched to determine multiple groups of synchronized first test images; each group of synchronized first test images includes a synchronized first test image of each camera, and the preset information includes at least one of the acquisition time, frame number, image type and object identification of the first test image;

[0018] A plurality of groups of synchronized first test images are determined as a first test material set.

[0019] According to a testing method for a liveness detection algorithm provided by the present invention, the liveness detection result further includes an identification of an object in a first test image, where the identification of the object is a corrected initial identification. Before calculating the liveness one-time pass rate corresponding to the first test material set based on the liveness detection results of each first test image, the method further includes:

[0020] The corrected initial identifiers in each liveness detection result are renumbered in sequence to obtain target identifiers corresponding to the corrected initial identifiers in each liveness detection result; wherein target identifiers of different objects are not repeated.

[0021] According to a testing method for a liveness detection algorithm provided by the present invention, the liveness one-time pass rate corresponding to the first test material set is calculated based on the liveness detection results of each first test image, including:

[0022] Determine the number of occurrences of each target identifier in each liveness detection result according to the target identifier of the object included in each liveness detection result;

[0023] According to the preset judgment logic, the target identification and the liveness status of the object included in each liveness detection result, the target liveness status of the object corresponding to each target identification is determined; the preset judgment logic includes: judging the final target liveness status of the object corresponding to the target identification by the liveness status of the object corresponding to the target identification in a continuous set frame, and the set frame is determined according to the actual traffic situation of the person not stopping;

[0024] According to the number of occurrences of each target identifier and the target liveness state corresponding to each target identifier, determine, under each number of occurrences, a first number of target identifiers corresponding to a live target state and a second number of target identifiers corresponding to a non-live target state;

[0025] A one-time pass rate of a living being corresponding to the first test material set is determined according to the first quantity and the second quantity.

[0026] According to a method for testing a liveness detection algorithm provided by the present invention, the method further includes:

[0027] According to the liveness detection results of each first test image, the liveness detection accuracy of the single-frame image corresponding to the first test material set is calculated; the liveness detection accuracy of the single-frame image is used to characterize the accuracy of the liveness detection algorithm in successfully detecting liveness on the single-frame image;

[0028] Accordingly, the above-mentioned determination of the test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set includes:

[0029] The test result of the liveness detection algorithm is determined according to the liveness one-time pass rate and the liveness detection accuracy of the single-frame image of the first test material set.

[0030] According to a method for testing a liveness detection algorithm provided by the present invention, the method of calculating the liveness detection accuracy of a single-frame image corresponding to a first test material set according to the liveness detection results of each first test image includes:

[0031] Counting a third number of liveness detection results whose liveness status is liveness among the liveness detection results, and counting a fourth number of liveness detection results whose liveness status is non-liveness among the liveness detection results;

[0032] The single-frame image living body detection accuracy corresponding to the first test material set is determined according to the third quantity and the fourth quantity.

[0033] According to a method for testing a liveness detection algorithm provided by the present invention, the test result of the liveness detection algorithm is determined based on the liveness one-time pass rate and the liveness detection accuracy rate of a single-frame image of the first test material set, including:

[0034] Acquire a second test material set collected in advance for a plurality of dummy objects; the second test material set includes a plurality of groups of second test images, each group of second test images includes at least one test picture or at least one test video;

[0035] Determine a liveness detection result corresponding to each group of second test images according to each second test image, and calculate a liveness one-time pass rate and a single-frame image liveness detection accuracy rate corresponding to the second test material set according to the liveness detection result of each second test image;

[0036] The test result of the liveness detection algorithm is determined according to the liveness one-time pass rate and the liveness detection accuracy of the single-frame image of the first test material set, and the liveness one-time pass rate and the liveness detection accuracy of the single-frame image of the second test material set.

[0037] The present invention also provides a testing device for a living body detection algorithm, comprising the following modules:

[0038] A test material acquisition module, used to acquire a first test material set collected in advance for a plurality of real-person objects; the first test material set includes a plurality of groups of first test images, each group of first test images includes at least one test picture or at least one test video;

[0039] A liveness detection module, used to input each first test image into a liveness detection algorithm for liveness detection, and determine a liveness detection result corresponding to each group of first test images; the liveness detection result includes a liveness state of an object included in the first test image, and the liveness state includes liveness or non-liveness;

[0040] a calculation module, configured to calculate a live one-time pass rate corresponding to the first test material set according to the liveness detection results of each first test image; the live one-time pass rate is used to characterize the proportion of the number of persons detected as live by the liveness detection algorithm in the actual passage situation where the persons do not stop to the total number of detected persons;

[0041] The testing module is used to determine the test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set.

[0042] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a test method for a liveness detection algorithm as described above is implemented.

[0043] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the test method of any of the above-mentioned living body detection algorithms is implemented.

[0044] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for testing a living body detection algorithm.

[0045] The testing method, device and storage medium of the liveness detection algorithm provided by the present invention obtain a first test material set collected in advance for multiple real objects, and input multiple groups of first test images included in the first test material set into the liveness detection algorithm for liveness detection, determine the liveness test result corresponding to each group of first test images, and then calculate the liveness one-time pass rate corresponding to the first test material set according to the liveness detection results of each first test image, and then determine the test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set; wherein each group of first test images includes at least one test picture or at least one test video, the liveness detection result includes the liveness state of the object included in the first test image to which it belongs, whether it is live or non-live, and the liveness one-time pass rate is used to characterize the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people. In this method, since the test result of the liveness detection algorithm can be determined by the indicator that the proportion of the number of people detected as living by the liveness detection algorithm in the actual passage situation without people stopping to the total number of detected people, this can truly reflect the actual experience of the passers-by in actual passage and the detection situation of the liveness detection algorithm itself, thereby improving the comprehensive test effect of the liveness detection algorithm in actual business; in addition, since the liveness detection algorithm can be tested by a pre-collected real person object test material set, which can be reused without the need for actual testing with real people, it can save manpower and time in testing the liveness detection algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 This is one of the flow charts of the testing method of the living body detection algorithm provided by the present invention.

[0048] Figure 2 It is a schematic diagram of a binocular synchronization test picture provided by the present invention.

[0049] Figure 3 This is the second flow chart of the testing method of the living body detection algorithm provided by the present invention.

[0050] Figure 4 It is a schematic diagram of the test image initial identification correction process provided by the present invention.

[0051] Figure 5 This is one of the schematic diagrams of the identification renumbering provided by the present invention.

[0052] Figure 6 This is the second schematic diagram of the logo renumbering provided by the present invention.

[0053] Figure 7 This is the third flow chart of the testing method of the living body detection algorithm provided by the present invention.

[0054] Figure 8 It is a schematic diagram of the time consumption comparison when the real person test provided by the present invention and the new method of the present invention respectively perform 12 liveness detection algorithm tests.

[0055] Fig. 9 It is a structural schematic diagram of a testing device for a living body detection algorithm provided by the present invention.

[0056] Fig.10 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] At present, in order to test the detection effect of the liveness detection algorithm in the face recognition terminal, it is often necessary to use a large number of real people and dummies for actual testing, which is time-consuming and labor-intensive, and if the number of test object IDs (Identify) is small, the test effect will be poor. If the iteration cycle of the liveness detection algorithm is accelerated, the difficulty of the liveness test will increase sharply, which will eventually affect the normal iteration of the liveness detection algorithm. Based on this, the embodiment of the present invention provides a test method, device and storage medium for a liveness detection algorithm, which can solve the above technical problems.

[0059] Combine the following Figure 1-Figure 6 A testing method for a living body detection algorithm according to an embodiment of the present invention is described.

[0060] It should be noted that the execution subject of the embodiments of the present invention may be a test device for a liveness detection algorithm, or an electronic device, or other devices or apparatuses. The following embodiments are described using an electronic device as the execution subject. It is understandable that the electronic device may be a face recognition device / face recognition terminal, or may be a backend server corresponding to a face recognition terminal, etc.

[0061] Figure 1 FIG. 1 is one of the flow charts of the testing method of the living body detection algorithm provided by the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0062] Step 102, obtaining a first test material set collected in advance for a plurality of real-person objects; the first test material set includes a plurality of groups of first test images, each group of first test images includes at least one test picture or at least one test video.

[0063] The real person object refers to a real human face. An electronic device with a camera (such as a face recognition terminal) can be used in advance to record or collect video streams of multiple real faces in the test scene, and then the collected video streams are saved to form a first test material set. The test scene here can include indoor, outdoor, front light, back light, normal light, night light conditions, etc.

[0064] When saving the first test material set, the captured video stream can be saved in a picture format, or the video stream can be saved in a video format. The specific setting can be based on the actual situation. Accordingly, the first test material set can include multiple groups of first test images, wherein the first test image can be a test image in the above-mentioned saved picture format, or a test video in the above-mentioned saved video format. In addition, each group of first test images will correspond to a test image saved in a format, or multiple groups of first test images saved in the first test material set all correspond to test images in the same format, for example, the test images included in the first test material set are all test images.

[0065] For each group of first test images, multiple test images may be included. For each test image, it may be a frame of test picture or a test video, and the test video may include one or more frames of test pictures. If the first test image is a test picture, then before saving the test picture, the test picture may be subjected to face detection or face recognition by an electronic device, and the identification of the real object / real face included in the test picture (i.e., target ID) may be output, and information such as the acquisition time (or acquisition timestamp) of the test picture, the frame number of the test picture, the detection frame position of the real face included in the test picture in the test picture, and the image type corresponding to the test picture may be obtained. Then, each test picture may be named and saved in the format of time_target ID_frame number_image type, or each test picture may be named and saved in the format of time_target ID_frame number_face frame position_image type. The format of the test picture saved here may be jpg or png format. The image type may include visible light images (represented by the number 1), infrared images (represented by the number 4), and of course other image types, such as depth images. In addition, the above supports the output of multiple face IDs when performing face detection or face recognition on the test image. Whether to support the output of multiple face IDs can be set by the user. Generally, by default, only the ID of the largest face in the test image is output as the target ID.

[0066] If the first test image is a test video, the collected multiple different test videos may be stored respectively according to the video names, and the video formats are not specifically limited.

[0067] In addition, when the video stream of the real face is collected in the test scenario, a monocular camera or a multi-camera can be used for collection. If a monocular camera is used for collection, the test picture or test video of the collected video stream can be directly saved to obtain multiple groups of first test images, and then the first test material set can be obtained.

[0068] If multi-eye cameras are used for acquisition, that is, if the first test material set is the first test material set acquired by multi-eye cameras, then as an optional embodiment, the process of acquiring the first test material set may include: acquiring multiple first test images acquired by each camera for multiple real-person objects; according to preset information of each first test image, synchronously matching the multiple first test images of each camera to determine multiple groups of synchronized first test images; each group of synchronized first test images includes a synchronized first test image of each camera, and the above preset information includes at least one of the acquisition time, frame number, image type and object identification of the first test image; and determining the multiple groups of synchronized first test images as the first test material set.

[0069] Taking the example of a binocular camera, the binocular camera can simultaneously capture video streams of multiple real faces in the test scene, and then save the captured video streams as test pictures or test videos. In the above-mentioned acquisition process, the acquisition time, frame number, image type, and object identification (i.e., the target ID of the face included in the picture) of each frame of the video stream can be obtained. Taking saving as a test picture as an example, the name of the test picture can be formed according to the acquisition time, frame number, image type, and object identification of each frame, and then the test pictures can be saved separately for the two video streams captured by the binocular camera.

[0070] After the test image is saved, it is necessary to synchronize the test image saved by the binocular camera. You can use the following steps to do this:

[0071] Step 1: Read the test images stored in each binocular camera, and then sort the test images saved by each camera according to the time stamp first priority, frame number second priority, and image type third priority, and store the sorting results in the visible light image information queue and infrared image information queue respectively.

[0072] Step 2: Select any one of the two image information queues, extract the target ID, frame number and other information included in the test image from the selected image information queue in order of arrangement, and then traverse the other image information sequence and extract the target ID, frame number and other information included in the test image, and then compare the information extracted from the two image information queues. If the target ID and frame number of the two are the same, it is considered that the two test images are synchronously captured by the binocular camera at the same time, then a matching relationship can be established between the two test images, that is, it is determined that the two test images are a synchronized set of test images / synchronous frames, and the matching relationship and related information of the two test images can be written into a txt file. In this way, all test images in the two image information queues can be synchronously matched. For example, see Figure 2 The figure shows a schematic diagram of binocular synchronization test images, where the left image is an infrared test image after synchronization, and the right image is a visible light test image after synchronization.

[0073] It can be understood that the naming method of the test images here can ensure that the collected test images are continuous and double-frame synchronized, and the number of valid faces that can be used for testing can also be determined according to the frame number. For example, 20240918104956_2_256_1 and 20240918104956_2_256_4 represent a set of test image pairs at the same time, that is, an image pair consisting of a visible light image and an infrared image.

[0074] Step 104: Input each first test image into a liveness detection algorithm for liveness detection, and determine a liveness detection result corresponding to each group of first test images; the liveness detection result includes the liveness state of the object included in the first test image, and the liveness state includes liveness or non-liveness.

[0075] The liveness detection algorithm may be a pre-trained algorithm, and the liveness detection algorithm may be implemented using a deep learning model, a neural network model, etc. Specifically, it may be a binary classification model, and its input may be one channel or multiple channels, that is, the input of the liveness detection algorithm supports image input from a monocular camera, and also supports multi-channel synchronous image input from multiple cameras. The output of the liveness detection algorithm is a liveness detection result of whether the object (i.e., a face) included in the input image is live or non-live, and of course, other information related to the face, such as the face identifier, may also be output.

[0076] The training process of the model corresponding to the liveness detection algorithm is not limited here. This embodiment mainly tests the detection effect of the trained model corresponding to the liveness detection algorithm. It can be understood that the liveness detection algorithm here is the algorithm of the trained model corresponding to the liveness detection algorithm.

[0077] Specifically, after obtaining the first test material set and the multiple groups of first test images therein, each group of first test images can be input into the corresponding model of the liveness detection algorithm for liveness detection, and the liveness detection result of the object included in the input first test image can be obtained. The liveness detection result may include the liveness state of the object included in the group of first test images, and the liveness state may be liveness or non-liveness, wherein liveness means that the face in the group of first test images is a real face, and non-liveness means that the face in the first test image is a fake face. Of course, the liveness detection result may also include other information, such as the identification of the object included in the first test image (i.e., the target ID of the face). The identification of the object may be the ID identified when the test image is saved, or it may be the ID after the identified ID is further corrected, or it may be the ID after the corrected ID is further renumbered, which is not specifically limited here.

[0078] It should be noted that, regardless of whether the first test image is captured by a monocular or multi-camera, the liveness detection result finally output by the liveness detection algorithm only includes one liveness state, which represents the liveness state corresponding to a certain frame (monocular) or a certain group (multi-camera) of images.

[0079] Step 106, based on the liveness detection results of each first test image, calculate the liveness one-time pass rate corresponding to the first test material set; the liveness one-time pass rate is used to represent the ratio of the number of people detected as live by the liveness detection algorithm to the total number of detected people in the actual passage situation where people do not stop.

[0080] In this step, after each group of first test images is input into the liveness detection algorithm, the corresponding liveness detection result can be obtained, that is, each group of first test images can obtain a liveness detection result, that is, each group of first test images can obtain the liveness status of the objects included therein.

[0081] In order to characterize the detection effect of the liveness detection algorithm in the embodiment of the present invention, it can be measured separately by the indicator of liveness one-time pass rate. Among them, the calculation process of liveness one-time pass rate includes: combining the actual passage of people in front of the face recognition terminal, calculating the liveness one-time pass rate of the liveness detection algorithm when the people do not stop through each liveness state, and the liveness one-time pass rate represents the proportion of the number of people detected as liveness by the liveness detection algorithm in the actual passage of people without stopping to the total number of detected people. Specifically, the number of valid frames in which the objects in the test image participate in the liveness detection under the conditions of reporting liveness can be counted first and the corresponding liveness state can be determined, and then the number of IDs of each liveness state under the same valid frame (i.e. the total number of detected people) can be counted. For real-person testing, when the liveness one-time pass focuses on the valid frame greater than or equal to T (T greater than 1), the number of people judged as liveness accounts for the total number of detections under the corresponding valid frame (i.e. the total number of detected people). For dummy testing, the live one-time pass rate is the ratio of the number of people judged to be live in the valid frames from 1 to T frames to the total number of people detected in the corresponding 1 to T frames.

[0082] Step 108: Determine the test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set.

[0083] In this step, after obtaining the live one-time pass rate of the first test material set, the test result of the liveness detection algorithm can be directly determined by this indicator, or the test result of the liveness detection algorithm can be obtained by comprehensively measuring the detection effect of the liveness detection algorithm from multiple dimensions.

[0084] As an optional embodiment, in order to comprehensively measure the detection effect of the liveness detection algorithm from multiple dimensions, in addition to using the liveness one-time pass rate as an indicator, it can also be measured in combination with the liveness detection accuracy of a single-frame image. For example, in this embodiment, the liveness detection accuracy of a single-frame image corresponding to the first test material set can also be calculated based on the liveness detection results of each first test image; the above-mentioned single-frame image liveness detection accuracy is used to characterize the accuracy of the liveness detection algorithm in successfully detecting liveness on a single-frame image; then, the test result of the liveness detection algorithm is determined based on the liveness one-time pass rate and the single-frame image liveness detection accuracy of the first test material set.

[0085] Among them, the single-frame image liveness detection accuracy represents the accuracy of the liveness detection algorithm in successfully detecting liveness on a single-frame image. The calculation process includes: after obtaining the liveness status of each group of first test images, the single-frame image liveness detection accuracy can be calculated through the liveness detected and the non-liveness detected in the single-frame test image. For example, the single-frame image liveness detection accuracy can be obtained by ratioing the number of liveness detected in a single frame to the total number of detections.

[0086] After obtaining the live one-time pass rate and the live detection accuracy of a single-frame image of the first test material set, if more attention is paid to the single-frame image detection scene, the test result can be measured by the live detection accuracy of the single-frame image. For example, the higher the live detection accuracy of the single-frame image, the better the detection effect of the live detection algorithm itself. For example, if a real person test set with 100 frames is tested, and 99 frames are judged as live, the accuracy of the single-frame live is 99%. If more attention is paid to the actual passage experience of the personnel, the test result can be measured by the live one-time pass rate. For example, the higher the live one-time pass rate, the higher the test result can be. The live detection algorithm has a higher accuracy rate and passage efficiency. If both single-frame image detection scenes and actual passage experience of personnel are paid attention to at the same time, the test result of the live detection algorithm can be determined by the live one-time pass rate and the live detection accuracy of the single-frame image of the first test material set. For example, the higher the live detection accuracy rate and passage efficiency of the live detection algorithm are, the higher the test result is.

[0087] In addition, when actually testing the detection effect of the liveness detection algorithm, not only real human faces can be detected, but also dummy faces can be detected, so that the interception effect of the liveness detection algorithm on the dummy can be tested. For the process of detecting dummy faces, as an optional embodiment, a second test material set collected in advance for multiple dummy objects can be first obtained; the above-mentioned second test material set includes multiple groups of second test images, each group of second test images includes at least one test picture or at least one test video; the liveness detection result corresponding to each group of second test images is determined according to each second test image, and the liveness one-time pass rate and single-frame image liveness detection accuracy corresponding to the second test material set are calculated according to the liveness detection result of each second test image; the test result of the liveness detection algorithm is determined according to the liveness one-time pass rate and single-frame image liveness detection accuracy of the first test material set, and the liveness one-time pass rate and single-frame image liveness detection accuracy of the second test material set.

[0088] Among them, the collection, storage, synchronization and other processes of the second test material set of the dummy face can be carried out by the collection, storage and synchronization process of the first test material set of the real face. After obtaining the second test material set of the dummy face, it can also be input into the liveness detection algorithm to obtain the liveness detection result corresponding to each second test image, and then the liveness one-time pass rate and the single-frame image liveness detection accuracy of the second test material set are calculated accordingly. Here, for real faces, the higher the liveness one-time pass rate, the higher the accuracy and pass efficiency of real liveness detection, the higher the single-frame image liveness detection accuracy, and the higher the accuracy of single-frame recognition of real faces. For dummy faces, the lower the liveness one-time pass rate, the higher the accuracy of interception of dummy faces, and the lower the single-frame image liveness detection accuracy, the higher the accuracy of single-frame recognition of dummy faces.

[0089] After obtaining the live one-time pass rate and single-frame liveness detection accuracy of real faces, as well as the live one-time pass rate and single-frame liveness detection accuracy of dummy faces, the two indicators of real faces and dummy faces can be combined to determine the test results of the liveness detection algorithm. For example, the higher the two indicators of real faces and the lower the two indicators of dummy faces, the better the test results show that the detection effect of the liveness detection algorithm and the actual experience of people passing through are.

[0090] From the above description, it can be seen that in this embodiment, the live one-time pass rate can truly reflect the actual experience of passers-by during actual passage and the interception effect of the prosthesis (that is, simulating the liveness detection in the actual face recognition business). At the same time, combined with the liveness detection accuracy of the single-frame image, it can effectively verify the comprehensive effect of the liveness detection algorithm. At the same time, the test process can save a lot of manpower and time, thereby significantly improving the test efficiency, which is conducive to the rapid iteration of the liveness detection algorithm.

[0091] In this embodiment, a first test material set collected in advance for multiple real objects is obtained, and multiple groups of first test images included in the first test material set are input into the liveness detection algorithm for liveness detection, and the liveness test result corresponding to each group of first test images is determined, and then the liveness one-time pass rate corresponding to the first test material set is calculated according to the liveness detection results of each first test image, and then the test result of the liveness detection algorithm is determined according to the liveness one-time pass rate of the first test material set; wherein each group of first test images includes at least one test picture or at least one test video, and the liveness detection result includes the liveness state of the object included in the first test image to which the liveness is alive or non-live, and the liveness one-time pass rate is used to characterize the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people. In this method, since the test result of the liveness detection algorithm can be determined by the indicator that the proportion of the number of people detected as living by the liveness detection algorithm in the actual passage situation without people stopping to the total number of detected people, this can truly reflect the actual experience of the passers-by in actual passage and the detection situation of the liveness detection algorithm itself, thereby improving the comprehensive test effect of the liveness detection algorithm in actual business; in addition, since the liveness detection algorithm can be tested by a pre-collected real person object test material set, which can be reused without the need for actual testing with real people, it can save manpower and time in testing the liveness detection algorithm.

[0092] The following embodiment describes the process of correcting the identification of the human face in the first test material set before liveness detection.

[0093] Figure 3 FIG. 2 is a flow chart of the test method of the living body detection algorithm provided by the present invention. Figure 3 As shown, before obtaining the liveness detection result in step 104, the method further includes the following steps:

[0094] Step 202, obtaining an initial identification of an object included in each first test image; the initial identification is a face identification determined after performing face detection and / or face tracking on the first test image.

[0095] If the first test image included in the first test material set is a test picture, each test picture can be read from the above-mentioned saved txt file, and the ID of the face included in the test picture can be obtained through the target ID in the name of each test picture, which is recorded as the initial identification. It can be understood that before saving the test picture, the face in the test picture can be detected or recognized, so that the ID of the face included therein and the detection frame where the face is located can be obtained.

[0096] If the first test image included in the first test material set is a test video, a multiple object tracking algorithm (MOT) can be used to perform target detection and target tracking processing on each video frame in the test video, determine the ID of the face included in each video frame in the test video, and record it as the initial identifier. At the same time, the video frames containing the face are cached.

[0097] Step 204, using a facial feature extraction model to extract facial features from the current frame first test image and the adjacent previous frame first test image, to determine facial features corresponding to the current frame first test image and facial features corresponding to the previous frame first test image.

[0098] In this step, a trained face feature extraction model (large face feature extraction model) can be pre-set, which is mainly used to extract the features of the face in the image. For the face feature extraction model, priority is given to the face feature extraction model having a good ability to express face features, without considering the performance issues involved in the actual business, as long as it can be loaded and run normally on the face recognition device (such as a face recognition terminal).

[0099] If the first test image included in the first test material set is a test picture, the above txt file stores the test pictures sorted according to the frame number and target ID of the test pictures. For any two adjacent test pictures, assuming that one frame is recorded as the current frame test image and the other adjacent frame is the previous frame of the current frame, it can be recorded as the previous frame test image. Then, the face feature extraction model can be used to extract face features of the two adjacent test images respectively to obtain the face features of the two test images.

[0100] If the first test image included in the first test material set is a test video, the video frames with faces in the above cache can be used. For any two adjacent video frames, assuming that one frame is recorded as the current frame test image and the other adjacent frame is the previous frame of the current frame, it can be recorded as the previous frame test image. Then, the face feature extraction model can be used to extract face features from the two adjacent test images respectively to obtain the face features of the two test images.

[0101] Step 206, based on the similarity between the facial features of the first test image of the current frame and the facial features of the first test image of the previous frame, determine whether to correct the initial identifier of the first test image of the current frame to the initial identifier of the first test image of the previous frame; wherein the initial identifier corresponding to the same facial feature after the identifier correction is the same.

[0102] In this step, for the facial features of any two adjacent test images, the similarity between the two facial features can be calculated. If the similarity is greater than the set threshold, it is considered that the objects included in the two adjacent test images are the same person, that is, the two adjacent test images include the same face, and the initial identification of the face of the current test image can be corrected to be consistent with the initial identification of the face of the previous test image and output or reported to the alarm module; if the similarity is not greater than the set threshold, it is considered that the two adjacent test images do not include the same face, and the initial identification of the face included in the current test image may not be corrected, or the initial identification of the face included in the current test image may be used as the corrected initial identification. This way of correcting the facial identification can ensure that the identification of the same face is unique when performing live detection later, thereby improving the accuracy of the live one-time pass rate calculated later.

[0103] In addition, in the actual correction process, it is also necessary to maintain the variable m_lostnum (m_lostnum refers to the number of times / frames that no face is detected in the face image during the face identification correction process) according to whether there is face information in two adjacent frames. If there is no face in N consecutive frames (N is an integer greater than 1), m_lostnum is accumulated to N. When it is judged to the N+1 frame, even if the similarity of the facial features in the two adjacent test frames is greater than the set threshold, it should not be regarded as the same face ID, but as a new face ID. This is because the same face may appear in front of a face recognition device (such as a face recognition terminal), disappear, and then reappear. At this time, it should be considered a new face ID instead of the same face ID.

[0104] The following is an explanation of the entire correction process, see Figure 4The schematic diagram of the test image initial identification correction process shown in the figure shows that after obtaining the first test material set, the tracking initialization can be performed first through the ID acquisition module, mainly loading the face feature extraction model and initializing the tracking parameters. If the first test material set includes picture materials, that is, test pictures, the test pictures that do not meet the preset distance in the test pictures are filtered out by the preset distance (specifically, it can be determined whether the distance from the camera (or face recognition device) when the test picture is collected exceeds the preset distance. If it exceeds, the test picture is filtered out, otherwise it is retained for the next step. This is mainly because the subsequent tracking and liveness detection are all performed in the picture determined at the preset distance), and then the initial identification of the face corresponding to the retained test picture (that is, the offline tracking ID) is obtained; similarly, if the first test material set includes video materials, that is, test videos, the video frames that do not meet the preset distance in the test video can also be filtered out by the preset distance, and then the initial ID of the face included in the remaining video frames is obtained by the MOT tracking algorithm. Afterwards, the initial IDs of these faces are continued to be used / maintained in the test picture detection and recognition process and in the MOT tracking algorithm (that is, the tracking information is maintained), which is not affected by the ID corrected by the face feature extraction model.

[0105] Afterwards, the initial identification of the face in the first test material set can be corrected by the ID correction module, specifically by comparing the facial features in two adjacent test images, and when both represent the same face, in the subsequent result reporting stage, the initial identification of the face in the current test image is modified / corrected to be consistent with the initial identification of the face in the previous test image. The result report here can be reported to the relevant module of the subsequent liveness detection algorithm processing, or it can be reported to the alarm module, etc. In short, the initial identification of the same face can be corrected to be consistent.

[0106] In this embodiment, the facial features of two adjacent test frames are used to further determine whether the two adjacent test frames include the same face, so that when the same face is included, the facial identification of the two frames of images is corrected to be consistent. This can effectively correct the erroneous ID in the MOT tracking algorithm, ensure the uniqueness and accuracy of the same facial identification during subsequent liveness detection, and thus improve the accuracy of the subsequently calculated liveness one-time pass rate.

[0107] After correcting the initial identification of the object in each first test image in the first test material set, the corrected initial identification corresponding to each first test image can be obtained. After performing liveness detection on each first test image through a liveness detection algorithm, the liveness detection result obtained for each first test image may include a liveness state and may also include an identification of the object in the first test image, where the identification of the object is the corrected initial identification. The following embodiment illustrates the process of renumbering the corrected initial identification before calculating the liveness one-time pass rate corresponding to the first test material set to ensure the uniqueness of the identification of different faces.

[0108] In some embodiments, before the above step 106 calculates the one-time pass rate of the living body corresponding to the first test material set, the above method may further include the following steps:

[0109] The corrected initial identifiers in each liveness detection result are renumbered in sequence to obtain target identifiers corresponding to the corrected initial identifiers in each liveness detection result; wherein target identifiers of different objects are not repeated.

[0110] After obtaining the liveness detection result of each first test image in the first test material set, the liveness status of the object in each first test image and the corrected initial identification of the object can be obtained. However, since the initial identification of each first test image may be rewritten due to a device restart when saving, or since each first test image may include first test images collected by other devices, these situations will cause the corrected initial identification of the same object to be non-unique, that is, the corrected initial identifications of different objects may be repeated.

[0111] Based on this, the corrected initial identifiers in each liveness detection result can be renumbered in order. Specifically, the liveness detection results of each test image can be sorted from front to back according to the acquisition time, frame number, etc. in the image name, and then the corrected initial identifiers in the liveness detection results of each test image can be re-numbered recursively starting from 1 (or starting from 0 or other values ​​set according to actual conditions). The final numbered identifier is the target identifier corresponding to the object in each liveness detection result. It can be understood that in the renumbering process, if the liveness detection results are for the same object, then the target identifiers corresponding to these liveness detection results are also the same, that is, the liveness detection results for the same face.

[0112] The representation form of the above liveness detection results can be expressed as: picture name-face ID-liveness status, where the liveness status can be recorded as L1 for liveness and L0 for non-liveness. For example, "240703103333_1_68_9210_1.jpg-1-L0" means that the face ID in the picture name 240703103333_1_68_9210_1.jpg is 1 and the liveness status is non-liveness. Another example is "Frm_71656-17331-L1" means that the face ID at the 71656th frame of the video frame is 17331, and the liveness status is liveness at this time. The liveness detection results can be saved in a txt file to facilitate the subsequent calculation of the liveness one-time pass rate and the liveness detection accuracy of a single frame image.

[0113] For example, see Figure 5 One of the schematic diagrams showing the renumbering of the logo is shown and Figure 6 The second schematic diagram of the renumbering of the identification shown in FIG. 1 shows the liveness detection results before renumbering on the left, and on the right after renumbering on the right. It can be seen that in the liveness detection results before renumbering, different objects use the same corrected initial identification, such as Figure 5 For example, the initial identifiers of the liveness detection results in the box are repeated as 1 and 2. After the corrected initial identifiers in each liveness detection result are renumbered, there is no duplication of target identifiers in the liveness detection results of different objects. For example, the initial identifiers in the box in the left figure are renumbered as 8 and 9 in the right figure, which can ensure the uniqueness of the target identifier of each object.

[0114] In this embodiment, the initial identifiers in each liveness detection result are renumbered so that identifiers of different objects are not repeated, thereby ensuring that the identifier of each object is unique, so that the subsequent liveness one-time pass rate can be calculated more accurately.

[0115] The following embodiment describes the process of specifically calculating the live body one-time pass rate and the live body detection accuracy rate of a single-frame image corresponding to the first test material set.

[0116] Figure 7 FIG. 3 is a flow chart of the test method of the living body detection algorithm provided by the present invention. Figure 7 As shown, in the above step 106, according to the liveness detection results of each first test image, calculating the liveness one-time pass rate corresponding to the first test material set may include the following steps:

[0117] Step 302: Determine the number of occurrences of each target identifier in each liveness detection result according to the target identifier of the object included in each liveness detection result.

[0118] Among them, after renumbering the initial identifiers in each liveness detection result, the target identifier corresponding to the same object / face in each liveness detection result is unique. At this time, the total number of times each face / each target identifier (recorded as each ID) appears in each detection result can be counted.

[0119] For example, you can use id_counts to store the total number of times a single ID appears. For example, id_counts is {'7': 5,'9': 6, '5': 7, '2': 5, '3': 8, '8': 2, '1': 1}, where the total number of times ID 2 appears is 5 times, the total number of times ID 5 appears is 7 times, and so on, that is, 'ID number': total number of times it appears. For example, continue to refer to the above Figure 6 It can be seen that the total number of occurrences of a single ID in each liveness detection result can be greater than 5 times, for example, the total number of occurrences of ID 9 is 6 times, the total number of occurrences of ID 5 is 7 times, and so on.

[0120] Step 304, determining the target liveness state of the object corresponding to each target identifier according to the preset judgment logic, the target identifier and liveness state of the object included in each liveness detection result; the above-mentioned preset judgment logic includes: a judgment logic for determining the final target liveness state of the object corresponding to the target identifier by the liveness state of the object corresponding to the target identifier in a continuous set frame, and the above-mentioned set frame is determined according to the actual passage situation when the person does not stop.

[0121] In this step, the actual traffic conditions of the face recognition device / face recognition terminal personnel can be used to determine the number of frames (recorded as the set frame T) that the liveness detection algorithm can continuously detect the liveness of the same person within a preset distance without stopping. The preset judgment logic means that only when a single ID (i.e., a target identifier) ​​satisfies the continuous set frame as non-liveness, the face recognition device will output / broadcast the final liveness status as non-liveness and block the passage of personnel. If at least one frame of the continuous set frame is detected as liveness at the preset distance, the final liveness status will be output / broadcast as liveness and personnel will be allowed to pass.

[0122] Specifically, the liveness detection results of multiple first test images corresponding to the same target identifier can be obtained from the above-mentioned liveness detection results. For a target identifier, in the process of performing frame-by-frame liveness detection on the first test image corresponding to the target identifier, if the liveness detection result of the first frame is liveness, then the target liveness state corresponding to the target identifier is determined to be liveness. If the liveness detection result of the first frame is non-liveness, the liveness detection results of the continuous preset frames are counted. If at least one frame of the liveness detection result in the continuous preset frames is liveness, then the target liveness state corresponding to the target identifier is liveness. If the liveness detection results of each frame in the continuous preset frames are non-liveness, then the target liveness state corresponding to the target identifier is non-liveness. In specific applications, if a certain ID person passes through the gate for the first time, as long as there is a liveness state of liveness in the first T frames, it is considered that the ID person has successfully passed through once. Otherwise, the one-time passage fails and needs to pass twice or even three times, which will affect its passage efficiency. For example, a first test material set of real people with 100 IDs is tested. A single ID in the first test material set has at least T frames of valid faces. The test result shows that 98 IDs meet the one-time pass condition and no stopping and waiting occurs. The live one-time pass rate of the first test material set is 98%, indicating that the liveness detection algorithm has good detection effect and high pass efficiency.

[0123] For example, id_status can be used to store the final target liveness status of a single ID, for example, id_status is {'7': false, '9': true, '5': false, '2': true, '3': true, '8': true, '1': true}, where true means liveness and false means non-liveness. The target liveness status of ID 8 is liveness, and the target liveness status of ID 7 is non-liveness, and so on, that is, 'ID number': target liveness status. It should be noted that the status of id_status is determined according to the set threshold. When the test type is real face, starting from the first frame of the new ID, if T consecutive frames are L0 (non-liveness), it is false. On the contrary, if one frame is L1, it is true. If more than T frames, the liveness status of the previous T frames shall prevail (assuming T=5, the liveness status of the 6th frame shall prevail over the liveness status of the previous 5 frames. Here, the size of T can be set according to the actual situation, which can be greater than 5 or less than 5).

[0124] In summary, the target liveness state of the object corresponding to each target identifier in each liveness detection result can be obtained through the above method.

[0125] Step 306, according to the number of occurrences of each target identifier and the target liveness state corresponding to each target identifier, determine, under each number of occurrences, a first number of target identifiers corresponding to the liveness state and a second number of target identifiers corresponding to the non-liveness state.

[0126] In this step, the total number of times each target identifier appears in each liveness detection result can be obtained through the above id_counts, and then the target identifiers with the same total number of appearances can be grouped together to obtain a set of target identifiers with different numbers of appearances. For each set of target identifiers with different numbers of appearances, the number of target identifiers whose target liveness status is live can be counted, recorded as the first number, and the number of target identifiers whose target liveness status is non-live can be counted, recorded as the second number. A first number and a second number can be counted for each set of target identifiers with different numbers of appearances. Here, different numbers of appearances can represent different valid frame numbers during passage, such as 1 frame, 2 frames, 3 frames, 4 frames, 5 frames, 6 frames, etc.

[0127] For example, when counting the first number and the second number under different occurrence times (that is, when counting the number of IDs with the target liveness status as true / false in multiple IDs corresponding to the same valid frame number under a single ID), use count_summary to record the number of IDs corresponding to the valid frame number under a single ID and the corresponding liveness status. For example, count_summary is {1: {'false': 0, 'true': 1}, 2: {'false': 0, 'true': 1}, 5: {'false': 1, 'true': 1}, 6: {'false': 0, 'true': 1}, 7: {'false': 1, 'true': 0}, 8: {'false': 0, 'true':1}}, when a single ID has only one frame, there are 1 real person and 0 fake person; when a single ID has 5 frames, there are 1 real person and 1 fake person; when a single ID has 7 frames, there are 0 real people and 1 fake person.

[0128] Step 308: Determine a one-time pass rate of a living being corresponding to the first test material set according to the first quantity and the second quantity.

[0129] In this step, after obtaining the first number and the second number with different numbers of occurrences, all the first numbers can be summed to obtain a first sum value, and all the first numbers and all the second numbers can be summed to obtain a second sum value, and then the first sum value and the second sum value are ratioed, and the obtained ratio is the live one-time pass rate accuracy corresponding to the first test material set.

[0130] For example, the following formula is used to calculate the accuracy of the live one-time pass rate:

[0131] .

[0132] Among them, true_count represents the number of 'true' in count_summary, that is, the total number of IDs of all living bodies (that is, the first sum value), false_count represents the number of 'false' in count_summary, and true_count+false_count represents the total number of all IDs, that is, the second sum value.

[0133] As an optional embodiment, the single-frame image living body detection accuracy corresponding to the first test material set can be calculated by the following steps:

[0134] A third number corresponding to the liveness detection results whose liveness status is liveness in each liveness detection result is counted, and a fourth number corresponding to the liveness detection results whose liveness status is non-liveness in each liveness detection result is counted; and a liveness detection accuracy rate of a single-frame image corresponding to the first test material set is determined according to the third number and the fourth number.

[0135] Among them, the above-mentioned liveness detection results are all liveness detection results obtained for a frame test image of a monocular / binocular camera. The liveness detection result may include a liveness state, and the liveness state includes liveness or non-liveness. Then, the number of first test images with a liveness state of liveness (also the number of liveness detection results with a liveness state of liveness) can be counted, recorded as a third number, and the number of first test images with a liveness state of non-liveness (also the number of liveness detection results with a liveness state of non-liveness) can be counted, recorded as a fourth number, and then the third number and the fourth number can be ratioed, and the obtained ratio is the single-frame image liveness detection accuracy corresponding to the first test material set.

[0136] For example, true_false_total_count can be used to store how many true (i.e., living) and false (i.e., non-living) results are in each living body detection result of the traversed first test material set. For example, {'false': 16, 'true':18} means that 18 single-frame first test images in the first test material set are judged to be real people, and 16 are judged to be fake people.

[0137] Assuming that the third number of the first test images judged to be real people (i.e., living bodies) is true_pic_count, and the fourth number of the first test images judged to be fake people (i.e., non-living bodies) is false_pic_count, the following formula can be used to calculate the single-frame image living body detection accuracy pic_total_accuracy of the first test material set:

[0138] .

[0139] Furthermore, the one-time liveness pass rate and the liveness detection accuracy of a single-frame image corresponding to the first test material set are illustrated by example:

[0140] Example 1: 1 frame is passed at a time: 1 is correct, 0 is wrong, and the accuracy rate is 100.0%;

[0141] 2 frames in one pass: 1 correct, 0 wrong, 100.0% correct rate;

[0142] Pass 5 frames at a time (including 5 frames and above): 3 correct, 2 wrong, correct rate 60.0%;

[0143] Total number of IDs in one pass: 7, 5 correct, 2 wrong, correct rate is 71.42%;

[0144] For the real person test set, if the indicator of the live one-time pass rate is "one-time pass of 5 frames", it means that the number of valid frames of the face in front of the face recognition device / terminal is above the set T value. Data with less than T frames will not be counted and considered invalid data (i.e., the duration is short and it is an abnormal face scan). When T is set to 5, the total number of real people's one-time passes is 2+3=5, and the live one-time pass rate is 3 / 5=60%.

[0145] Example 2:

[0146] }}} id_counts is used to store the total number of occurrences of a single ID. Assume that the value of id_counts record is: {'2': 5, '5': 7, '1': 1, '8': 2, '7': 5, '9': 6, '3': 8}, the value stored in id_status is: {'2':True, '5': False, '1': True, '8': True, '7': False, '9': True, '3': True}, the value stored in true_false_total_count is: {'false': 16, 'true': 18}, and the value recorded in count_summary is: {1: {'false': 0, 'true': 1}, 2: {'false': 0, 'true': 1}, 5: {'false':1, 'true': 1}, 6: {'false': 0, 'true': 1}, 7: {'false': 1, 'true': 0}, 8: {'false': 0, 'true': 1}}, the value of true_false_count record is: {'false': 2, 'true': 5};

[0147] The final calculation result is:

[0148] One pass of 1 frame: 1 correct, 0 wrong, 100.0% accuracy;

[0149] 2 frames in one pass: 1 correct, 0 wrong, 100.0% correct rate;

[0150] 5 frames in one pass: 1 correct, 1 wrong, 50.0% correct rate;

[0151] Pass 6 frames at a time (including 6 frames and above): 2 correct, 1 wrong, correct rate 66.66%;

[0152] Total number of IDs in one pass: 7, 5 correct, 2 wrong, correct rate 71.42%;

[0153] Total number of pictures: 34, 18 correct, 16 wrong, correct rate 52.94%.

[0154] When T is set to 6, the total number of real people's one-time passes is 2+1=3, and the one-time pass rate of living people is 2 / 3=66%.

[0155] For the above-mentioned indicator of the total number of IDs for one-time pass, if the ID is taken as the basis, no matter how many valid frames the ID has, one ID will be calculated to determine the live one-time pass rate. This indicator takes into account both the number of IDs and the single-frame efficiency. The higher the value, the higher the live one-time pass rate, the faster the response speed of the face recognition device, and the better the user experience.

[0156] For the above-mentioned indicator of T frames per pass (taking 5 frames as an example), a single ID is used as the standard, and the live one-time pass rate is judged based on its live state of 5 consecutive frames. It should be noted that T is based on the number of valid frames that meet the preset distance conditions and are sent to the liveness detection algorithm for detection and processing after the target face enters the recognition area and approaches the face recognition device. It can be set according to the empirical value or calculated based on the pedestrian's movement speed and recognition distance. The T value can be used to simulate the actual scene. The situation where pedestrians do not need to stop to complete liveness detection. If the T value is set to 5 frames, the live one-time pass rate is the proportion of the number of IDs whose final target live state is judged to be live when T>5 frames are calculated. When the real person test is performed, the live one-time pass rate is not calculated when the valid frame is less than T, and the liveness detection accuracy of a single frame image is calculated.

[0157] For the above-mentioned total number of images and single-frame image liveness detection accuracy, this indicator only reflects the detection effect of the liveness detection algorithm itself, and can provide a reference for the iterative optimization of the liveness detection algorithm itself. Ideally, the higher the single-frame image liveness detection accuracy, the better the detection effect of the liveness detection algorithm.

[0158] The above embodiment is a calculation process for the live one-time pass rate and the live detection accuracy of a single-frame image for a real face. It should be noted that the live one-time pass rate is also applicable to the fake face attack. At this time, the lower the calculated live one-time pass rate, the higher the accuracy of the live detection algorithm for the fake face. In specific applications, when a fake face of a certain ID passes through the gate for the first time, as long as there is one live state in the T frame, it proves that the attack is successful. Using a fake face to carry out a live attack generally requires that within a specified time, a long-term attack is carried out by adjusting the distance between the fake face and the face recognition device and the angle of the fake face. In order to better measure the time of the fake face live attack, the embodiment of the present invention calculates the above-mentioned set frame T frame as follows: T=60×M×N, where N represents the frame rate, in fps; M represents the specified duration, in min.

[0159] The above method can be used to calculate the live one-time pass rate of the dummy face in the set frame. However, it should be noted that the live one-time pass rate calculation of the dummy cannot exclude data less than T frames, but should calculate the one-time pass rate when the valid frame is less than T.

[0160] In this embodiment, the set frame is determined by the actual passage situation of people without stopping, and the final liveness status of each real face detected by the liveness detection algorithm is calculated based on this, and the liveness one-time passage rate of the real face is calculated based on this. At the same time, the liveness detection accuracy of the real face can be calculated through the liveness status of the single-frame image. In this way, the actual experience of people passing through is used as a reference, and the accuracy of single-frame image liveness detection is comprehensively utilized to truly reflect the actual experience of passers-by when actually passing through and the interception effect of the prosthesis, thereby reflecting the comprehensive test effect of the liveness detection algorithm.

[0161] The following describes a comparison between the testing method of the living body detection algorithm according to the embodiment of the present invention and the related testing method in the prior art in terms of time consumption and testing effect.

[0162] 1. Explanation of time consumption.

[0163] 1. Please refer to the following Table 1, which shows the time comparison of the real person test (i.e. the current test method) and the test method of the liveness detection algorithm of the present invention (hereinafter referred to as the new method) when the test samples are the same as 100 people.

[0164]

[0165] It can be seen from Table 1 above that the time consumption of real-person testing is mainly reflected in sample collection and actual testing, while the new method of the present invention can ignore the single sample collection time (especially in the second test and subsequent live algorithm tests, that is, there is no need to collect samples again, and the previously collected samples can be reused for algorithm testing), and can also reduce the test time of a single sample (that is, no manpower is required for manual statistics), and the efficiency is improved by about 94.6%.

[0166] 2. Please see Figure 8 Table 2 further shows the time consumption comparison of the liveness detection algorithm test performed 12 times by the real person test and the new method of the present invention when the test samples are both 100 people.

[0167] from Figure 8 It can be seen from Table 2 that, except for the time consumption of single sample collection in the first test, the subsequent tests (the 2nd to 12th tests took about 0.16 minutes) took much less time than the real person test. For the real person test, when the sample collection was sufficient for 100 people, the subsequent versions took a long time and the overall time consumption fluctuated significantly due to objective factors.

[0168] In summary, it can be seen from Table 1 and Table 2 that the time consumption of the testing method of the liveness detection algorithm of the present invention is shorter than that of the real person testing in the prior art, and thus the problem of long time consumption in the prior art can be solved.

[0169] 2. Explain the test results.

[0170] 1. Please refer to Tables 3 and 4 below, which show the difference between the live one-time pass rate obtained by the new method of the present invention (the live one-time pass rate obtained by image or video simulation test) and the live accuracy rate and the pass rate actually measured by the device using a single-frame image simulation test in the prior art.

[0171]

[0172]

[0173] The measured pass rate of the device refers to the pass rate of people actually tested by the face recognition device, in which a liveness detection algorithm is provided, i.e., the pass rate of people actually tested by the liveness detection algorithm. The first column in Table 3 is the accuracy index when the liveness detection algorithm is tested using the new method of the present invention (i.e., the liveness one-time pass rate), and the first column in Table 4 is the accuracy index when the liveness detection algorithm is tested using the prior art (i.e., the single-frame liveness accuracy rate).

[0174] It can be seen from Tables 3 and 4 above that the deviation between the accuracy index tested by the new method of the present invention and the actual measured traffic rate of the equipment is small, and the deviation is basically within 1%. However, the single-frame liveness accuracy obtained by the single-frame image test in the prior art and the actual measured traffic rate of the equipment are quite different, and the deviation is basically more than 5%, which cannot effectively reflect the actual traffic effect. Therefore, the new test method of the present invention can effectively improve the test effect and accurately reflect the actual traffic situation.

[0175] In summary, it can be seen from Tables 3 and 4 that the deviation between the accuracy index of the test method of the liveness detection algorithm of the present invention and the actual pass rate of the device (that is, the actual pass rate of the liveness detection algorithm) is compared with the deviation between the single-frame liveness accuracy index tested by a single-frame picture in the prior art and the actual pass rate of the device. The deviation between the test method of the present invention and the actual pass rate of the device is smaller, that is, it is closer to the actual pass rate of the device. Therefore, the test effect of the liveness detection algorithm of the present invention is better, so the problem of poor test effect in the prior art can be solved.

[0176] The following is a description of a testing device for a liveness detection algorithm provided by the present invention. The testing device for a liveness detection algorithm described below and the testing method for a liveness detection algorithm described above can be referred to each other.

[0177] Fig. 9 is a schematic diagram of the structure of the test device of the living body detection algorithm provided by the present invention, see Fig. 9 As shown, the device may include:

[0178] The test material acquisition module 410 is used to acquire a first test material set collected in advance for a plurality of real-person objects; the first test material set includes a plurality of groups of first test images, each group of first test images includes at least one test picture or at least one test video;

[0179] A liveness detection module 420 is used to input each first test image into a liveness detection algorithm for liveness detection, and determine a liveness detection result corresponding to each group of first test images; the liveness detection result includes a liveness state of an object included in the first test image, and the liveness state includes liveness or non-liveness;

[0180] The calculation module 430 is used to calculate the live one-time pass rate corresponding to the first test material set according to the liveness detection results of each first test image; the live one-time pass rate is used to represent the ratio of the number of people detected as live by the liveness detection algorithm to the total number of detected people in the actual passage situation where people do not stop;

[0181] The testing module 440 is used to determine the test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set.

[0182] Optionally, the calculation module 430 is further used to calculate the single-frame image liveness detection accuracy corresponding to the first test material set according to the liveness detection results of each first test image; the single-frame image liveness detection accuracy is used to characterize the accuracy of the liveness detection algorithm in successfully detecting liveness on a single-frame image;

[0183] Correspondingly, the above-mentioned test module 440 is specifically used to determine the test result of the liveness detection algorithm according to the liveness one-time pass rate and the liveness detection accuracy of the single-frame image of the first test material set.

[0184] In some embodiments, the liveness detection module 420 inputs each first test image into a liveness detection algorithm for liveness detection, and before determining the liveness detection result corresponding to each group of first test images, the apparatus further includes:

[0185] An ID correction module is used to obtain an initial identification of an object included in each first test image; the above-mentioned initial identification is a face identification determined after face detection and / or face tracking is performed on the first test image; a face feature extraction model is used to extract face features of the current frame first test image and the adjacent previous frame first test image to determine the face features corresponding to the current frame first test image and the face features corresponding to the previous frame first test image; based on the similarity between the face features of the current frame first test image and the face features of the previous frame first test image, it is determined whether to correct the initial identification of the current frame first test image to the initial identification of the previous frame first test image; wherein, the initial identification corresponding to the same face feature after identification correction is the same.

[0186] In some embodiments, if the above-mentioned first test material set is a first test material set collected by multiple cameras, the above-mentioned test material acquisition module 410 is specifically used to obtain multiple first test images collected by each camera for multiple real objects; according to the preset information of each first test image, the multiple first test images of each camera are synchronously matched to determine multiple groups of synchronized first test images; each group of synchronized first test images includes a synchronized first test image of each camera, and the above-mentioned preset information includes at least one of the acquisition time, frame number, image type and object identification of the first test image; and the multiple groups of synchronized first test images are determined as the first test material set.

[0187] In some embodiments, the liveness detection result further includes an identification of an object in the first test image, where the identification of the object is a corrected initial identification. Before the calculation module 430 calculates the liveness one-time pass rate corresponding to the first test material set according to the liveness detection results of each first test image, the apparatus further includes:

[0188] The renumbering module is used to renumber the corrected initial identifiers in each liveness detection result in sequence to obtain the target identifier corresponding to the corrected initial identifier in each liveness detection result; wherein the target identifiers of different objects are not repeated.

[0189] In some embodiments, the above-mentioned calculation module 430 is specifically used to determine the number of occurrences of each target identifier in each liveness detection result according to the target identifier of the object included in each liveness detection result; determine the target liveness state of the object corresponding to each target identifier according to the preset judgment logic, the target identifier and the liveness state of the object included in each liveness detection result; the above-mentioned preset judgment logic includes: a judgment logic for determining the final target liveness state of the object corresponding to the target identifier by the liveness state of the object corresponding to the target identifier in a continuous set frame, and the above-mentioned set frame is determined according to the actual passage situation of people without stopping; according to the number of occurrences of each target identifier and the target liveness state corresponding to each target identifier, determine the first number corresponding to the target identifier with the target liveness state as live and the second number corresponding to the target identifier with the target liveness state as non-liveness under each number of occurrences; according to the first number and the second number, determine the liveness one-time passage rate corresponding to the first test material set.

[0190] Optionally, the above-mentioned calculation module 430 is specifically used to count the third number corresponding to the liveness detection results whose liveness status is liveness in each liveness detection result, and count the fourth number corresponding to the liveness detection results whose liveness status is non-liveness in each liveness detection result; based on the third number and the fourth number, determine the liveness detection accuracy of the single-frame image corresponding to the first test material set.

[0191] In some embodiments, the test module 440 is specifically used to obtain a second test material set collected in advance for multiple dummy objects; the second test material set includes multiple groups of second test images, each group of second test images includes at least one test picture or at least one test video; the liveness detection result corresponding to each group of second test images is determined according to each second test image, and the liveness one-time pass rate and single-frame image liveness detection accuracy corresponding to the second test material set are calculated according to the liveness detection result of each second test image; the test result of the liveness detection algorithm is determined according to the liveness one-time pass rate and single-frame image liveness detection accuracy of the first test material set, and the liveness one-time pass rate and single-frame image liveness detection accuracy of the second test material set.

[0192] It should be noted here that the above-mentioned device provided in the embodiment of the present invention can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.

[0193] Fig.10 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.10As shown, the electronic device may include: a processor (processor) 510, a communication interface (Communications Interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call the logic instructions in the memory 530 to execute the testing method of the liveness detection algorithm, which includes: obtaining a first test material set collected in advance for multiple real people; the above-mentioned first test material set includes multiple groups of first test images, each group of first test images includes at least one test picture or at least one test video; each first test image is input into the liveness detection algorithm for liveness detection, and the liveness detection result corresponding to each group of first test images is determined; the above-mentioned liveness detection result includes the liveness state of the object included in the first test image, and the above-mentioned liveness state includes liveness or non-liveness; according to the liveness detection results of each first test image, the liveness one-time pass rate corresponding to the first test material set is calculated; the above-mentioned liveness one-time pass rate is used to characterize the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people; according to the liveness one-time pass rate of the first test material set, the test result of the liveness detection algorithm is determined.

[0194] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0195] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test method of the liveness detection algorithm provided by the above methods, the method including: obtaining a first test material set collected in advance for multiple real objects; the first test material set includes multiple groups of first test images, each group of first test images includes at least one test picture or at least one test video; inputting each first test image into the liveness detection algorithm for liveness detection, and determining the liveness detection result corresponding to each group of first test images; the liveness detection result includes the liveness state of the object included in the first test image, and the liveness state includes liveness or non-liveness; according to the liveness detection results of each first test image, calculating the liveness one-time pass rate corresponding to the first test material set; the liveness one-time pass rate is used to characterize the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people; according to the liveness one-time pass rate of the first test material set, determining the test result of the liveness detection algorithm.

[0196] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a test method for executing the liveness detection algorithm provided by the above-mentioned methods, the method comprising: obtaining a first test material set collected in advance for multiple real-person objects; the first test material set comprises multiple groups of first test images, each group of first test images comprises at least one test picture or at least one test video; each first test image is input into the liveness detection algorithm for liveness detection, and a liveness detection result corresponding to each group of first test images is determined; the liveness detection result comprises the liveness state of the object included in the first test image, and the liveness state comprises liveness or non-liveness; according to the liveness detection results of each first test image, a liveness one-time pass rate corresponding to the first test material set is calculated; the liveness one-time pass rate is used to characterize the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people; according to the liveness one-time pass rate of the first test material set, the test result of the liveness detection algorithm is determined.

[0197] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0198] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for testing a liveness detection algorithm, characterized in that: include: Acquire a first test material set collected in advance for a plurality of real-person subjects; The first test material set includes multiple groups of first test images, each group of the first test images includes at least one test picture or at least one test video; Input each of the first test images into a liveness detection algorithm for liveness detection, and determine a liveness detection result corresponding to each group of the first test images; the liveness detection result includes a liveness state of an object included in the first test image, and the liveness state includes liveness or non-liveness; According to the liveness detection results of each of the first test images, a liveness one-time pass rate corresponding to the first test material set is calculated; the liveness one-time pass rate is used to represent the proportion of the number of people detected as live by the liveness detection algorithm in the actual passage situation where people do not stop to the total number of detected people; Determining a test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set; Also includes: According to the liveness detection results of each of the first test images, calculating the liveness detection accuracy of the single-frame image corresponding to the first test material set; the liveness detection accuracy of the single-frame image is used to characterize the accuracy of the liveness detection algorithm in successfully detecting liveness on the single-frame image; Correspondingly, determining the test result of the liveness detection algorithm according to the liveness one-time pass rate of the first test material set includes: The test result of the liveness detection algorithm is determined according to the liveness one-time pass rate and the liveness detection accuracy of the single-frame image of the first test material set.

2. The method for testing a liveness detection algorithm according to claim 1, characterized in that: Before inputting each of the first test images into a liveness detection algorithm for liveness detection and determining a liveness detection result corresponding to each group of the first test images, the method further includes: Acquire an initial identification of an object included in each first test image; the initial identification is a face identification determined after performing face detection and / or face tracking on the first test image; Using a facial feature extraction model to extract facial features from a first test image of a current frame and an adjacent first test image of a previous frame, and determining facial features corresponding to the first test image of the current frame and facial features corresponding to the first test image of the previous frame; Based on the similarity between the facial features of the first test image of the current frame and the facial features of the first test image of the previous frame, determine whether to correct the initial identifier of the first test image of the current frame to the initial identifier of the first test image of the previous frame; wherein, the initial identifier corresponding to the same facial feature after the identifier correction is the same.

3. The method for testing a liveness detection algorithm according to claim 1, characterized in that: If the first test material set is a first test material set collected by a multi-camera, the step of obtaining the first test material set collected in advance for a plurality of real people includes: Acquire a plurality of first test images captured by each camera for a plurality of real-person objects; According to the preset information of each of the first test images, synchronously match the multiple first test images of each of the cameras to determine multiple groups of synchronized first test images; each group of synchronized first test images includes a synchronized first test image of each of the cameras, and the preset information includes at least one of the acquisition time, frame number, image type and object identification of the first test image; The multiple groups of synchronized first test images are determined as the first test material set.

4. The method for testing a liveness detection algorithm according to any one of claims 1 to 3, characterized in that: The liveness detection result also includes an identifier of an object in the first test image, where the identifier of the object is a corrected initial identifier. Before calculating the liveness one-time pass rate corresponding to the first test material set according to the liveness detection results of each of the first test images, the method further includes: The corrected initial identifiers in each of the liveness detection results are renumbered in sequence to obtain target identifiers corresponding to the corrected initial identifiers in each of the liveness detection results; wherein target identifiers of different objects are not repeated.

5. The method for testing a liveness detection algorithm according to any one of claims 1 to 3, characterized in that: The calculating, according to the liveness detection results of each of the first test images, a liveness one-time pass rate corresponding to the first test material set includes: Determining the number of occurrences of each target identifier in each of the liveness detection results according to the target identifier of the object included in each of the liveness detection results; According to the preset judgment logic, the target identification and the liveness status of the object included in each of the liveness detection results, the target liveness status of the object corresponding to each of the target identifications is determined; the preset judgment logic includes: judging the final target liveness status of the object corresponding to the target identification by the liveness status of the object corresponding to the target identification in a continuous set frame, and the set frame is determined according to the actual traffic conditions of the person not stopping; According to the number of occurrences of each target identifier and the target liveness state corresponding to each target identifier, determining, under each number of occurrences, a first number of target identifiers corresponding to a live target state and a second number of target identifiers corresponding to a non-live target state; A one-time pass rate of a living being corresponding to the first test material set is determined according to the first number and the second number.

6. The method for testing a liveness detection algorithm according to claim 1, characterized in that: The calculating, according to the liveness detection results of each of the first test images, the liveness detection accuracy of a single-frame image corresponding to the first test material set includes: counting a third number of liveness detection results whose liveness status is liveness among the liveness detection results, and counting a fourth number of liveness detection results whose liveness status is non-liveness among the liveness detection results; The single-frame image living body detection accuracy corresponding to the first test material set is determined according to the third number and the fourth number.

7. The method for testing a liveness detection algorithm according to claim 1, characterized in that: Determining the test result of the liveness detection algorithm according to the liveness one-time pass rate and the liveness detection accuracy rate of the single-frame image of the first test material set includes: Acquire a second test material set collected in advance for a plurality of dummy objects; the second test material set includes a plurality of groups of second test images, each group of the second test images includes at least one test picture or at least one test video; Determine a liveness detection result corresponding to each group of the second test images according to each of the second test images, and calculate a liveness one-time pass rate corresponding to the second test material set according to the liveness detection result of each of the second test images; The test result of the liveness detection algorithm is determined according to the liveness one-time pass rate and the single-frame image liveness detection accuracy of the first test material set, and the liveness one-time pass rate and the single-frame image liveness detection accuracy of the second test material set.

8. A testing device for a living body detection algorithm, characterized in that: include: A test material acquisition module, used to acquire a first test material set collected in advance for a plurality of real-person objects; The first test material set includes multiple groups of first test images, each group of the first test images includes at least one test picture or at least one test video; a liveness detection module, configured to input each of the first test images into a liveness detection algorithm for liveness detection, and determine a liveness detection result corresponding to each group of the first test images; the liveness detection result includes a liveness state of an object included in the first test image, and the liveness state includes liveness or non-liveness; a calculation module, configured to calculate a live one-time pass rate corresponding to the first test material set according to the liveness detection results of each of the first test images; the live one-time pass rate is used to represent the proportion of the number of persons detected as live by the liveness detection algorithm in the actual passage situation where the persons do not stop to the total number of detected persons; A testing module, configured to determine a test result of the liveness detection algorithm according to a liveness one-time pass rate of the first test material set; The calculation module is further used to calculate the single-frame image liveness detection accuracy corresponding to the first test material set according to the liveness detection results of each of the first test images; the single-frame image liveness detection accuracy is used to represent the accuracy of the liveness detection algorithm in successfully detecting liveness on a single-frame image; Correspondingly, the test module is specifically configured to determine the test result of the liveness detection algorithm according to the liveness one-time pass rate and the liveness detection accuracy of the single-frame image of the first test material set.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the testing method of the living body detection algorithm according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Living body algorithm performance evaluation method and device, equipment and storage medium

    CN114238047A