Living body detection method, device, computer readable storage medium and electronic device
By performing image quality detection before the in vivo detection model, determining whether the image area meets the preset conditions, the problem of low accuracy of in vivo detection in the prior art is solved, and higher accuracy and reliability of in vivo detection are achieved.
Patent Information
- Application Number
- CN202210325883.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2042-03-30
AI Technical Summary
The existing live detection algorithms are difficult to accurately judge the living condition in each frame of the image in actual systems, resulting in low detection accuracy.
By performing image quality detection before the live detection model, it is determined whether the image area meets the preset conditions. If it is satisfied, the pre-trained live detection model will be used for detection. If it is not satisfied, the live detection result will be directly determined based on the image quality detection result.
It improves the accuracy of live detection, avoids jumping of live detection results, and enhances the reliability of live detection of video frames.
Smart Images

Figure CN114677628B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a living body detection method, device, computer-readable storage medium, and electronic device. Background Art
[0002] Current liveness detection algorithms usually use the algorithm model + engineering strategy model in actual systems to improve the algorithm performance in actual products. In order to improve detection efficiency, a relatively simple model structure is usually used to perform liveness detection using a binary classification method, that is, to predict whether the face in the current image is live or fake. Such a model cannot correctly judge every frame, so corresponding engineering strategies are needed to help improve the liveness detection performance of the entire product in order to improve the detection accuracy.
[0003] The existing engineering strategy methods mainly adopt the "smoothing method" or "window smoothing method". The smoothing method is to smooth all historical prediction information, that is, the probability value predicted by the liveness detection model of the current frame and the average of the probability values predicted by all historical liveness detection models as the final prediction value of the liveness detection of the current frame.
[0004] The window smoothing method sets a window within the smoothing range. A window is set based on the smoothing method. The probability value predicted by the liveness detection model of the current frame is averaged with the historical liveness detection model prediction value corresponding to the frames included in the window as the liveness detection prediction value of the current frame. Summary of the invention
[0005] Embodiments of the present disclosure provide a living body detection method, device, computer-readable storage medium, and electronic device.
[0006] An embodiment of the present disclosure provides a liveness detection method, which includes: determining an image area where a target object is located from a current video frame; performing image quality detection on the image area based on at least one preset image quality detection method to obtain at least one first liveness detection result; determining whether the image area meets a preset condition based on the at least one first liveness detection result; if so, determining a prediction value for characterizing whether the target object is a live object through a pre-trained liveness detection model, and determining a second liveness detection result of the current video frame regarding the target object based on the prediction value; if not, determining a second liveness detection result of the current video frame regarding the target object based on the at least one first liveness detection result.
[0007] According to another aspect of an embodiment of the present disclosure, a liveness detection device is provided, which includes: a first determination module, used to determine an image area where a target object is located from a current video frame; a first detection module, used to perform image quality detection on the image area based on at least one preset image quality detection method, and obtain at least one first liveness detection result; a second determination module, used to determine whether the image area meets a preset condition based on the at least one first liveness detection result; the second detection module, used to determine a prediction value for characterizing whether the target object is a live object through a pre-trained liveness detection model if the condition is met, and determine a second liveness detection result of the current video frame about the target object based on the prediction value; and a third determination module, used to determine a second liveness detection result of the current video frame about the target object based on the at least one first liveness detection result if the condition is not met.
[0008] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is used to execute the above-mentioned living body detection method.
[0009] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; and a processor for reading executable instructions from the memory and executing the instructions to implement the above-mentioned living body detection method.
[0010] Based on the liveness detection method, device, computer-readable storage medium and electronic device provided by the above embodiments of the present disclosure, image quality detection is performed on the image area where the target object is located in the current video frame based on at least one image quality detection method to obtain at least one first liveness detection result, and then based on the at least one first liveness detection result, it is determined whether the image area meets the preset conditions. If it meets the conditions, the second liveness detection result of the current video frame about the target object is determined through the liveness detection model. If it does not meet the conditions, the second liveness detection result of the current video frame about the target object is determined based on the at least one first liveness detection result. It is achieved that before using the liveness detection model to perform liveness detection, the image quality detection is first performed on the image to assist the liveness detection model in performing liveness detection, which helps to improve the accuracy of liveness detection on video frames.
[0011] The technical solution of the present disclosure is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the drawings, the same reference numerals generally represent the same components or steps.
[0013] Figure 1 is a system diagram to which the present disclosure is applicable.
[0014] Figure 2 It is a flowchart of a living body detection method provided by an exemplary embodiment of the present disclosure.
[0015] Figure 3 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0016] Figure 4 is an exemplary schematic diagram of a sliding window provided by another exemplary embodiment of the present disclosure.
[0017] Figure 5 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0018] Figure 6 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0019] Figure 7 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0020] Figure 8 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0021] Fig. 9 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0022] Fig.10 It is a flowchart of a living body detection method provided by another exemplary embodiment of the present disclosure.
[0023] Fig.11 It is a schematic diagram of the structure of a living body detection device provided by an exemplary embodiment of the present disclosure.
[0024] Fig.12 It is a structural schematic diagram of a living body detection device provided by another exemplary embodiment of the present disclosure.
[0025] Fig.13 is a structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] Below, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.
[0027] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
[0028] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present disclosure are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.
[0029] It should also be understood that in the embodiments of the present disclosure, “plurality” may refer to two or more than two, and “at least one” may refer to one, two, or more than two.
[0030] It should also be understood that any component, data or structure mentioned in the embodiments of the present disclosure can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0031] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present disclosure generally indicates that the associated objects before and after are in an "or" relationship.
[0032] It should also be understood that the description of the various embodiments in the present disclosure focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0033] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0034] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.
[0035] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0036] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0037] The disclosed embodiments can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.
[0038] Electronic devices such as terminal devices, computer systems, and servers can be described in the general context of computer system executable instructions executed by a computer system. In general, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0039] Application Overview
[0040] When the current smoothing method and window smoothing method are used for liveness detection, it is assumed that the current frame is a prosthesis, and the model has always predicted it as a prosthesis, but suddenly a certain frame is predicted to be live with a high score, then the calculated average value will be instantly raised, even exceeding the liveness threshold, and the prosthesis will be judged as live. As time goes by, the smoothing method will be greatly burdened by historical information. If the tracking target of the system changes, but the tracked face identifier does not change, the liveness information of different face identifiers will be confused, resulting in wrong judgments. The window smoothing method is overly dependent on the scoring range of the model. When the scoring range of different liveness detection models changes, the threshold of the window smoothing method needs to be re-selected, which makes the system complex.
[0041] Exemplary Systems
[0042] Figure 1 An exemplary system architecture 100 is shown to which a liveness detection method or a liveness detection apparatus according to an embodiment of the present disclosure can be applied.
[0043] like Figure 1As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0044] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various applications can be installed on the terminal device 101, such as image recognition applications, video monitoring applications, web browser applications, instant messaging tools, etc.
[0045] The terminal device 101 can be various electronic devices, including but not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc.
[0046] The server 103 may be a server that provides various services, such as a background image processing server that performs liveness detection using images uploaded by the terminal device 101. The background image processing server may perform image quality detection, model prediction, and other processing on the received images to obtain processing results (such as a second liveness detection result).
[0047] It should be noted that the liveness detection method provided in the embodiments of the present disclosure may be executed by the server 103 or by the terminal device 101 . Accordingly, the liveness detection apparatus may be disposed in the server 103 or in the terminal device 101 .
[0048] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the above are merely illustrative. Any number of terminal devices, networks, and servers may be provided as required. For example, when images for liveness detection do not need to be acquired remotely, the above system architecture may not include a network, but only terminal devices or servers.
[0049] Exemplary Methods
[0050] Figure 2 FIG. 1 is a flow chart of a liveness detection method provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices (such as Figure 1 On the terminal device 101 or server 103 as shown, Figure 2 As shown, the method comprises the following steps:
[0051] Step 201: determine the image area where the target object is located from the current video frame.
[0052] In this embodiment, the current video frame is a video frame to be detected in the video for liveness detection. The current video frame can be a frame captured at the current moment when the video is captured in real time, or it can be a video frame to be detected when the video frames included in the pre-captured video are detected in the playback order.
[0053] The target object may be various types of objects, such as a human face, a human body, an animal, etc. The image region where the target object is located may be a region in the current video frame, and the image region may be marked in the video frame by a frame diagram of a preset shape (such as a rectangular frame). For example, when the target object is a human face, the image region may be an image region within a rectangular frame containing the human face.
[0054] The electronic device can use existing target detection methods to determine the image area where the target object is located. For example, a target detection model established by an existing target detection network (such as SSD (Single Shot MultiBox Detector), DPM (Deformable Part Model), RPN (Region Proposal Networks), etc.) can be used. The target detection model can determine the position of the target object from the image input therein. The target detection model can output coordinate information, which can characterize the area in the current video frame. For example, the coordinate information may include two diagonal coordinates of a rectangular box. Through the two diagonal coordinates, a rectangular box can be determined in the current video frame, thereby determining the image area where the target object is located.
[0055] Step 202: Perform image quality detection on the image area based on at least one preset image quality detection method to obtain at least one first living body detection result.
[0056] In this embodiment, at least one image quality detection method is used to detect the image quality of the above-mentioned image area, that is, the first liveness detection result can characterize whether the characteristics of the above-mentioned image area meet the basic requirements of liveness detection. The at least one image quality detection method can be arbitrarily set as needed, and the specifics can refer to the at least one image quality detection method provided in the following optional embodiment.
[0057] Step 203: Determine whether the image area meets a preset condition based on at least one first living body detection result.
[0058] As an example, the preset condition may include: any one of the at least one first liveness detection result indicates that the image quality is qualified, or the at least one first liveness detection result indicates that the image quality is qualified.
[0059] If the preset condition is met, execute step 204 , otherwise execute step 205 .
[0060] Step 204: determine a prediction value for characterizing whether the target object is alive by using a pre-trained liveness detection model, and determine a second liveness detection result of the current video frame with respect to the target object based on the prediction value.
[0061] In this embodiment, the liveness detection model is used to perform liveness detection on the above-mentioned image area and generate a prediction value. The prediction value can represent the probability that the target object is alive. The range of the prediction value can be set arbitrarily, such as a probability value in the interval [0,1], or a score between [0,100].
[0062] Generally, the liveness detection model can be obtained by training a pre-built initial model such as a neural network based on a preset training sample using a machine learning method. The training method and use method of the liveness detection model are currently known technologies and will not be described in detail here.
[0063] The second liveness detection result is used to characterize the accuracy of determining the target object as a live object. For example, the predicted value can be the second liveness detection result, or the interval of the predicted value can be pre-divided into a preset number of sub-intervals (for example, three sub-intervals), and each sub-interval corresponds to a detection result (for example, the three sub-intervals correspond to the three detection results of "non-liveness", "uncertainty", and "liveness" respectively). Among them, "liveness" means that the target object is a real object of the corresponding type, such as a real face, a real human body, etc. "Non-liveness" means that the target object is a virtual object, such as a face picture, a face model, a human body model, etc.
[0064] Step 205: Determine a second liveness detection result of the current video frame with respect to the target object based on the at least one first liveness detection result.
[0065] In this embodiment, generally, if the image area does not meet the preset conditions, it means that the image area does not meet the basic characteristics of a living body, and the target object cannot be determined to be a living body at this time, and it is necessary to generate a corresponding second liveness detection result based on at least one first liveness detection result. For example, if at least one first liveness detection result indicates that the image quality is unqualified, a second liveness detection result indicating that the target object is not a living body is generated; or, if at least one first liveness detection result includes at least one first detection result indicating that the image area is qualified, a second liveness detection result indicating that it is uncertain whether the target object is a living body is generated.
[0066] The method provided by the above-mentioned embodiment of the present disclosure performs image quality detection on the image area where the target object is located in the current video frame based on at least one image quality detection method to obtain at least one first liveness detection result, and then determines whether the image area meets the preset conditions based on the at least one first liveness detection result. If it meets the preset conditions, the second liveness detection result of the current video frame about the target object is determined by a pre-trained liveness detection model. If it does not meet the preset conditions, the second liveness detection result of the current video frame about the target object is determined based on the at least one first liveness detection result. This implements image quality detection on the image before using the liveness detection model to perform liveness detection, and assists the liveness detection model in performing liveness detection, which helps to improve the accuracy of liveness detection on video frames.
[0067] In some optional implementations, such as Figure 3 As shown, after step 205, the method further includes the following steps:
[0068] Step 206: Generate a third liveness detection result corresponding to the sliding window by using the second liveness detection result corresponding to each video frame in the sliding window where the current video frame is located.
[0069] The sliding window refers to a set of video frames including the current video frame and several video frames before the current video frame. The sliding window includes a target number of video frames, which is less than or equal to a preset number. The target number is the window length. For example, in the initial stage of video playback, the number of video frames included in the sliding window is less than the preset number. As time goes by, the number of video frames included in the sliding window is fixed to the preset number. Figure 4 As shown, it shows an exemplary schematic diagram of a sliding window, the sliding window includes 15 video frames, wherein the frame marked as 0 is the current video frame, and the frames marked as -1, -2, ..., -14 are the video frames before the current video frame. The arrows in the figure indicate the direction of the time axis.
[0070] As an example, the electronic device may determine the number of identical second liveness detection results among the second liveness detection results corresponding to the target number of video frames by voting, and determine the second liveness detection result corresponding to the largest number as the third liveness detection result. Figure 4 As shown in the figure, the second liveness detection result marked with "√" indicates a live body, the second liveness detection result marked with "×" indicates a non-live body, and the second liveness detection result marked with "○" indicates that it is uncertain whether it is a live body. As can be seen from the figure, the number of video frames marked with "√" is the largest, so the third liveness detection result corresponding to the sliding window indicates a live body.
[0071] Step 207: Determine the liveness detection result of the current video frame based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window.
[0072] In this step, the judgment rule for the liveness detection result of the current video frame can be flexibly set according to the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window. Figure 5 Corresponding optional embodiments.
[0073] This embodiment constructs a sliding window, determines the third liveness detection result corresponding to the sliding window based on voting, and determines the liveness detection result of the current video frame according to the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window. On the basis of image quality detection-assisted liveness detection, it further refers to historical detection results and does not completely rely on the prediction of the model, thereby improving the accuracy of liveness detection for the current video frame and avoiding the jump of liveness detection results.
[0074] In some optional implementations, such as Figure 5 As shown, step 207 includes the following sub-steps:
[0075] Step 2071: If the second liveness detection result and the third liveness detection result both indicate that the target object is alive, output the liveness detection result indicating that the target object is alive.
[0076] Step 2072: If the third liveness detection result indicates that the target object is not a live body, output a liveness detection result indicating that the target object is not a live body.
[0077] That is, when the third liveness detection result determined based on the sliding window voting indicates non-liveness, the third liveness detection result shall prevail regardless of the second liveness detection result.
[0078] Step 2073: if the third liveness detection result indicates that the target object is live, and the second liveness detection result indicates that the target object is not live or is uncertain whether it is live, output a liveness detection result that is uncertain whether the target object is live.
[0079] In the scenario provided by this step, since the second liveness detection result is inconsistent with the third liveness detection result, it means that the detection of the current video frame may have undergone a mutation. At this time, the third liveness detection result may not be accurate, and the output indicates a liveness detection result that is uncertain whether the target object is alive.
[0080] Step 2074: if the third liveness detection result indicates that it is uncertain whether the target object is alive, output a liveness detection result indicating that it is uncertain whether the target object is alive.
[0081] That is, when the third liveness detection result determined based on the sliding window voting indicates that it is uncertain whether the target object is alive, the third liveness detection result shall prevail regardless of the second liveness detection result.
[0082] Step 2075: If the length of the sliding window is less than the preset length, a liveness detection result indicating whether the target object is alive is output.
[0083] The preset length may be the maximum length of the sliding window (i.e., the maximum number of video frames in the sliding window) or any length. Usually, at the beginning of video shooting, since the window length does not reach the preset length, in order to avoid detection errors, a liveness detection result that is uncertain whether the target object is a live object is output.
[0084] It should be understood that the various methods for determining liveness detection results provided in this embodiment do not include all methods. According to actual needs, the rules for determining the liveness detection result of the current video frame can be arbitrarily set based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window.
[0085] This embodiment provides multiple methods for determining the liveness detection result of the current video frame based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window, thereby combining the liveness detection of the current video frame with the third liveness detection result obtained by voting in the sliding window, and further improving the accuracy and flexibility of determining the liveness detection result of the current video frame.
[0086] In some optional implementations, step 2074 may be performed as follows:
[0087] If the third liveness detection result indicates that it is uncertain whether the target object is a live body, a liveness detection result corresponding to the category is generated based on the category of the second liveness detection result.
[0088] The category of the second liveness detection result may include "liveness", "non-liveness", and "uncertainty". In addition, since the second liveness detection result is determined based on at least one first liveness detection result, and the at least one first liveness detection result is obtained by at least one image quality detection method described in step 202 above, when the category of the second liveness detection result is "uncertainty", it may include at least one subcategory.
[0089] Example 1: When the category of the second liveness detection result is “liveness” or “non-liveness”, the liveness detection result corresponding to the category may be “uncertain (-1)”.
[0090] Example 2: An image quality detection method is to determine whether the image area of the target object is within the current video frame after being magnified by a preset multiple. If the corresponding first detection result indicates that the magnified image area is not within the current video frame, the category of the second liveness detection result is "uncertain (-2)", and the liveness detection result corresponding to this category is "-2". For a detailed description of this example, please refer to the following Figure 7 The image area over-boundary detection method described in step 2022 of the corresponding embodiment.
[0091] Example 3: An image quality detection method is to determine whether the image area of the target object meets the quality optimization condition. If the corresponding first detection result indicates that the image area does not meet the quality optimization condition, the category of the second liveness detection result is "uncertain (-3)", and the liveness detection result corresponding to this category is "-3". For a detailed description of this example, please refer to the following Figure 7 The target object attribute detection method described in step 2023 of the corresponding embodiment.
[0092] It should be noted that the above examples are only part of the implementation methods of the method provided in this embodiment. Since the second detection result indicates that it is uncertain whether the target object is alive, the second detection result is determined based on different methods. Therefore, the category of the second liveness detection result in this embodiment can be set arbitrarily according to actual needs.
[0093] In this embodiment, when it is uncertain whether the target object is alive through the third liveness detection result, a corresponding liveness detection result is generated based on the category of the second liveness detection result, so that when it is uncertain whether the target object is alive after voting based on the sliding window, the output liveness detection result can reflect the basis for judging whether the uncertain target object is alive, thereby helping to improve the pertinence of the liveness detection result.
[0094] In some optional implementations, such as Figure 6 As shown, the above step 206 may include:
[0095] Step 2061: Count the number of identical second liveness detection results in the second liveness detection results corresponding to each video frame in the sliding window.
[0096] like Figure 4 As shown, the second liveness detection results include three types: "√", "×", and "○". This step can determine the quantity of each of the three second liveness detection results.
[0097] Step 2062: Generate a third liveness detection result corresponding to the sliding window according to the second liveness detection results corresponding to the number of the counted numbers that is greater than or equal to the preset number threshold.
[0098] Generally, if the number of a certain second liveness detection result is the largest and is greater than or equal to a preset number threshold, the second liveness detection result is determined to be the third liveness detection result corresponding to the sliding window.
[0099] like Figure 4 As shown, if the preset number threshold is 8, the number of video frames marked as “√” is the largest and equal to 8. Therefore, the third living body detection result corresponding to the sliding window indicates that the target object is alive.
[0100] Optionally, if the largest number of second liveness detection results is less than a preset number threshold, a third liveness detection result indicating whether the target object is alive can be generated. If there are at least two second liveness detection results with the same number and the largest number, the method for generating the third liveness detection result can be set arbitrarily as needed. For example, if the number of "live" and "non-live" is equal and greater than the number of "uncertain", the third liveness detection result is set to "uncertain".
[0101] By setting a quantity threshold, this embodiment can make it possible for the second liveness detection result with the largest number to more accurately reflect the liveness detection situation of the sliding window when determining the third liveness detection result based on voting, thereby further improving the accuracy of liveness detection.
[0102] In some optional implementations, such as Figure 7 As shown, the above step 202 may include the following sub-steps:
[0103] Step 2021, determining the aspect ratio of the image area, comparing the aspect ratio with a preset aspect ratio range, and determining a first living body detection result corresponding to the aspect ratio detection method based on the comparison result.
[0104] The preset aspect ratio interval may be set by pre-statisticing the object type to which the target object belongs, and the aspect ratio within the interval is the normal aspect ratio of the target object, for example, the preset aspect ratio interval is [0.5, 1.1]. If the above image area does not belong to the preset aspect ratio interval, the probability that the target object is non-living is extremely high, and a first liveness detection result indicating that the image area is unqualified may be generated.
[0105] Step 2022: magnify the image area by a preset multiple, determine whether the enlarged image area as a whole is within the current video frame, and generate a first living body detection result corresponding to the image area out-of-bounds detection method.
[0106] As an example, the preset multiple can be 1.5, that is, the length and width are enlarged 1.5 times respectively. Generally, if the enlarged image area exceeds the boundary range of the current video frame, it means that the position of the target object in the current video frame is near the boundary of the current video frame. Since sufficient background information is required when using the liveness detection model to detect the image area where the target object is located, and at this time the target object is too close to the edge in the current video frame, resulting in insufficient background information after the image area is enlarged, the image area at this time lacks sufficient background information, resulting in reduced recognition accuracy of the liveness detection model. Therefore, when the enlarged image area exceeds the boundary range of the current video frame, a first liveness detection result indicating that the image area is unqualified is generated.
[0107] Step 2023: Perform at least one target object attribute detection on the image area, and generate a first liveness detection result corresponding to the target object attribute detection method based on the detection result of the at least one target object attribute detection.
[0108] The type of the target object attribute can be set arbitrarily, for example, the target object attribute can include the key point of the target object, the posture angle of the target object, the size of the target object, etc. Each target object attribute can be determined by a corresponding detection method. As an example, if the type of the target object attribute is greater than or equal to two, then when at least two target object attributes among the target object attributes meet the corresponding judgment conditions, a first liveness detection result indicating that the image area is qualified can be generated.
[0109] At least one image quality detection method provided in this embodiment can comprehensively detect whether the quality of the image area is qualified based on various aspects, which helps to pre-screen the images required for the living body detection model, thereby improving the accuracy of living body detection.
[0110] In some optional implementations, in step 2023, detecting at least one target object attribute may include at least one of the following:
[0111] Detection method 1: Detect target object key points in the image area to obtain the number of target object key points.
[0112] The key point detection method is set based on the type of the target object. For example, if the target object is a face, the key point detection method of the face can be used to detect the key points of the face to obtain the number of key points of the face.
[0113] The second detection method is to detect the target object's posture angle in the image area to obtain the target object's posture angle.
[0114] The method for detecting the attitude angle of the target object is set based on the type of the target object. For example, if the target object is a face, the attitude angle of the face can be detected according to the existing face attitude angle detection method to obtain the face attitude angle. The face attitude angle can include yaw (yaw angle), pitch (pitch angle), and roll (roll angle).
[0115] Detection method three, performing target object size detection on the image area to obtain the target object size.
[0116] The target object size detection method is set based on the type of the target object. For example, if the target object is a face, the size of the smallest rectangle including the face can be determined as the target object size based on the recognized facial features.
[0117] The various target object attribute detections provided in this embodiment can detect the target object attributes more comprehensively, thereby helping to more accurately determine the quality of the image area of the target object based on each detection result, and further improve the accuracy of living body detection.
[0118] In some optional implementations, based on the detection results of the three target object attribute detection methods provided in the above optional embodiments, a first liveness detection result corresponding to the target object attribute detection method may be generated according to the following steps:
[0119] If a first preset number of conditions among the following conditions are met, a first liveness detection result corresponding to the target object attribute detection method is generated, indicating that the image quality is qualified:
[0120] Condition 1: The number of detected target object key points is greater than or equal to a second preset number.
[0121] For example, when the target object is a human face, the second preset number is three, which means that three of the five key points of the human face are detected, and the target object meets the basic requirements of liveness detection.
[0122] Condition 2: The detected target object posture angle is within a preset posture angle range.
[0123] For example, when the target object is a human face, if yaw<40°, pitch<30°, and roll<30°, the target object meets the basic requirements for liveness detection.
[0124] Condition three: the size of the detected target object is greater than or equal to the preset size.
[0125] For example, when the target object is a human face, the preset size is 90×90, that is, when the length of the face area is greater than 90 and the width is greater than 90, the target object meets the basic requirements for liveness detection.
[0126] The above-mentioned first preset number can be set arbitrarily, for example, it can be 3, that is, when all conditions are met, a first liveness detection result indicating that the image quality is qualified corresponding to the target object attribute detection method is generated; it can also be 2, that is, when at least two of the three conditions are met, a first liveness detection result indicating that the image quality is qualified corresponding to the target object attribute detection method is generated.
[0127] This embodiment provides judgment conditions corresponding to the above three target object attribute detection methods, which can more accurately determine whether each target object attribute meets the basic requirements of liveness detection, help to accurately screen the image area of the target object, and thus improve the accuracy of liveness detection.
[0128] In some optional implementations, such as Figure 8 As shown, step 205 may include:
[0129] Step 2051 , in response to determining that the first liveness detection result corresponding to the aspect ratio detection method indicates that the image quality is unqualified, determining that the second liveness detection result of the current video frame indicates that the target object is not live.
[0130] Step 2052, in response to determining that the detection result of the aspect ratio detection method indicates that the image quality is qualified, and the detection result of the image area over-boundary detection method indicates that the image quality is unqualified, determine that the second living body detection result of the current video frame is to represent whether the uncertain target object is alive.
[0131] Step 2053, in response to determining that the first liveness detection results corresponding to the aspect ratio detection method and the image area over-boundary detection method both indicate that the image quality is qualified, and the first liveness detection result corresponding to the target object attribute detection method indicates that the image quality is unqualified, determine that the second liveness detection result of the current video frame is a characterization of whether the uncertain target object is alive.
[0132] As shown in the following table, it shows the corresponding relationship between the first living body detection result generated by the above-mentioned various image detection methods and the second living body detection result generated.
[0133]
[0134] Among them, method 1 is the aspect ratio detection method, method 2 is the image area boundary detection method, and method 3 is the target object attribute detection method. The symbols "×" and "√" are the first liveness detection results, "×" indicates that the image quality is unqualified, "√" indicates that the image quality is qualified, and "--" indicates any result. It can be seen from the above table that when the aspect ratio of the image area is determined by method 1 to be not within the preset aspect ratio range, the aspect ratio of the image area is significantly different from the normal aspect ratio, and the probability that the target object is a non-living object is extremely high. At this time, the second liveness detection result indicating that the target object is a non-living object can be generated. For example, the number "-5" in the table indicates the second liveness detection result that the target object is a non-living object.
[0135] If the enlarged image area is determined to exceed the boundary of the current video frame through the second or third method, or at least one target object attribute does not meet the conditions, it means that the quality of the image taken of the target object is poor. At this time, even if the liveness detection model is used for liveness detection, the accuracy of the detection result is also low. Therefore, the corresponding second detection result indicating whether the target object is alive is output. In order to distinguish the judgment basis of the "uncertain" second liveness detection result, the "uncertain" second liveness detection result is classified, namely "-2" and "-3" in the table.
[0136] The strategy for determining the second liveness detection result based on at least one first liveness detection result provided in this embodiment can determine the corresponding second liveness detection result based on the actual first liveness detection result when the image area does not meet the preset conditions, thereby quickly and accurately performing liveness detection on the target object without using a liveness detection model.
[0137] In some optional implementations, based on the above-mentioned image region boundary detection method, the above-mentioned step 204 may include:
[0138] The enlarged image area is input into the living body detection model to obtain a prediction value used to characterize whether the target object is alive.
[0139] This step is performed when the image area meets the preset conditions. Therefore, the enlarged image area will not exceed the boundary of the current video frame. The enlarged image area includes the target object and sufficient background information. The liveness detection model can more accurately perform liveness detection on the target object based on the background information. That is, this embodiment further improves the accuracy of liveness detection.
[0140] In some optional implementations, such as Fig. 9 As shown, the above step 203 may include:
[0141] Step 2031: Based on at least one first living body detection result indicating that the image quality is qualified, it is determined that the image area meets a preset condition.
[0142] When each first liveness detection result indicates that the image quality is qualified, it means that the image quality meets the image quality requirement of the liveness detection model, and the liveness detection model can be used for liveness detection subsequently.
[0143] Step 2032: Determine that the image area does not meet a preset condition based on at least one first liveness detection result in which the at least one first liveness detection result indicates that the image quality is unqualified.
[0144] If the image area does not meet the preset conditions, it means that the image quality is unqualified. At this time, the accuracy of liveness detection using the liveness detection model is reduced. Therefore, the second liveness detection result of the target object in the current video frame is determined directly based on at least one first liveness detection result. The second liveness detection result at this time is usually "uncertain" or "non-live" as shown in the above table.
[0145] In this embodiment, when at least one first liveness detection result indicates that the image quality is qualified, the liveness detection model is used to perform liveness detection. If there is at least one first liveness detection result indicating that the image quality is unqualified, the liveness detection model is not used to perform liveness detection, thereby realizing the use of high-quality images for liveness detection, improving the detection accuracy of the liveness detection model, and at the same time, when the image quality does not meet the conditions, the second liveness detection result is directly obtained based on the first liveness detection result, without the need to use the liveness detection model for prediction, thereby improving the efficiency of liveness detection.
[0146] In some optional implementations, such as Fig.10 As shown, step 202 may also include:
[0147] Step 2024: perform black-and-white image detection on the image area to generate a first living body detection result indicating whether the image area is a black-and-white image.
[0148] Based on this, step 205 may include:
[0149] Step 2054: in response to determining that the first liveness detection result corresponding to the black-and-white image detection method indicates that the image area is a black-and-white image, determining that the second liveness detection result of the current video frame indicates that the target object is non-live.
[0150] Generally, if the image area is detected as a black and white image, it means that the currently captured video frame may have been attacked by a black and white image prosthesis. At this time, it can be determined that the target object in the current video frame is non-living.
[0151] Based on this, step 207 may include:
[0152] Step 2076: if the third liveness detection result indicates that the target object is not live, and the first liveness detection result corresponding to the black-and-white image detection method indicates that the image area is a black-and-white image, determine that the current video frame is invalid or output a liveness detection result indicating that the target object is not live.
[0153] If it is determined that the current video frame is invalid, the current video frame is discarded, the liveness detection result of the current video frame is not output, or a prompt message indicating that the current video frame is invalid is output, and then the next frame is obtained for detection.
[0154] This embodiment can quickly and effectively prevent black-and-white image pseudo attacks during liveness detection by performing black-and-white image detection on the image area, thereby performing liveness detection on the target object more comprehensively and accurately.
[0155] Exemplary Devices
[0156] Fig.11 is a schematic diagram of the structure of a liveness detection device provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices, such as Fig.11 As shown, the liveness detection device includes: a first determination module 1101, which is used to determine the image area where the target object is located from the current video frame; a first detection module 1102, which is used to perform image quality detection on the image area based on at least one preset image quality detection method to obtain at least one first liveness detection result; a second determination module 1103, which is used to determine whether the image area meets the preset condition based on at least one first liveness detection result; a second detection module 1104, which is used to determine, if the condition is met, a prediction value for characterizing whether the target object is a live object through a pre-trained liveness detection model, and determine the second liveness detection result of the current video frame about the target object based on the prediction value; a third determination module 1105, which is used to determine, if the condition is not met, the second liveness detection result of the current video frame about the target object based on at least one first liveness detection result.
[0157] In this embodiment, the first determination module 1101 can determine the image area where the target object is located from the current video frame. The current video frame is a video frame to be detected in the video for liveness detection. The current video frame can be a frame shot at the current moment when the video is shot in real time, or it can be a video frame to be detected when the video frames included in the pre-shot video are detected in the playback order.
[0158] The target object may be any type of object, such as a face, a human body, an animal, etc. The image region where the target object is located may be a region in the current video frame, and the image region may be marked in the video frame by a frame diagram of a preset shape (such as a rectangular frame).
[0159] The first determination module 1101 may use an existing target detection method to determine the image region where the target object is located. For example, a target detection model established by an existing target detection network (such as SSD (Single Shot MultiBox Detector), DPM (Deformable Part Model), RPN (Region Proposal Networks), etc.) may be used.
[0160] In this embodiment, the first detection module 1102 can perform image quality detection on the image area based on at least one preset image quality detection method to obtain at least one first liveness detection result. Among them, at least one image quality detection method is used to detect the image quality of the above image area, that is, the first liveness detection result can characterize whether the characteristics of the above image area meet the basic requirements of liveness detection. At least one image quality detection method can be arbitrarily set as needed, and specific reference can be made to at least one image quality detection method provided in the following optional embodiment.
[0161] In this embodiment, the second determination module 1103 can determine whether the image area meets a preset condition based on at least one first liveness detection result. As an example, the preset condition may include: any one of the at least one first liveness detection result indicates that the image quality is qualified, or at least one first liveness detection result indicates that the image quality is qualified.
[0162] In this embodiment, if the image area meets the preset conditions, the second detection module 1104 can determine the prediction value used to characterize whether the target object is alive through a pre-trained liveness detection model, and based on the prediction value, determine the second liveness detection result of the current video frame regarding the target object.
[0163] The liveness detection model is used to perform liveness detection on the above-mentioned image area and generate a prediction value. The prediction value can represent the probability that the target object is alive. The range of the prediction value can be set arbitrarily, such as a probability value in the interval [0,1], or a score between [0,100].
[0164] Generally, the liveness detection model can be obtained by training a pre-built initial model such as a neural network based on a preset training sample using a machine learning method. The training method and use method of the liveness detection model are currently known technologies and will not be described in detail here.
[0165] The second liveness detection result is used to indicate the accuracy of determining the target object as a live object.
[0166] In this embodiment, if the image area does not meet the preset condition, the third determination module 1105 may determine a second liveness detection result of the current video frame with respect to the target object based on at least one first liveness detection result.
[0167] Generally, if an image area does not meet the preset conditions, it means that the image area does not meet the basic characteristics of a living body. At this time, it is impossible to determine whether the target object is a living body, and it is necessary to generate a corresponding second liveness detection result based on at least one first liveness detection result. For example, if at least one first liveness detection result indicates that the image quality is unqualified, a second liveness detection result indicating that the target object is not a living body is generated; or, if at least one first liveness detection result includes at least one first detection result indicating that the image area is qualified, a second liveness detection result indicating that it is uncertain whether the target object is a living body is generated.
[0168] Reference Fig.12 , Fig.12 It is a structural schematic diagram of a living body detection device provided by another exemplary embodiment of the present disclosure.
[0169] In some optional implementations, the device also includes: a generation module 1106, which is used to generate a third liveness detection result corresponding to the sliding window through the second liveness detection result corresponding to each video frame in the sliding window where the current video frame is located; and a fourth determination module 1107, which is used to determine the liveness detection result of the current video frame based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window.
[0170] In some optional implementations, the fourth determination module 1107 includes: a first output unit 11071, which is used to output a liveness detection result indicating that the target object is alive if the second liveness detection result and the third liveness detection result both indicate that the target object is alive; a second output unit 11072, which is used to output a liveness detection result indicating that the target object is non-live if the third liveness detection result indicates that the target object is non-live; a third output unit 11073, which is used to output a liveness detection result indicating that the target object is not alive if the third liveness detection result indicates that the target object is alive and the second liveness detection result indicates that the target object is non-live or is uncertain whether it is alive; a fourth output unit 11074, which is used to output a liveness detection result indicating that the target object is not alive if the third liveness detection result indicates that the target object is not alive; and a fifth output unit 11075, which is used to output a liveness detection result indicating that the target object is not alive if the length of the sliding window is less than a preset length.
[0171] In some optional implementations, the fourth output unit 11074 is further used to: if the third liveness detection result indicates that it is uncertain whether the target object is alive, based on the category of the second liveness detection result, generate a liveness detection result corresponding to the category.
[0172] In some optional implementations, the generation module 1106 includes: a statistical unit 11061, which is used to count the number of identical second liveness detection results in the second liveness detection results corresponding to each video frame in the sliding window; a first generation unit 11062, which is used to generate a third liveness detection result corresponding to the sliding window based on the second liveness detection results corresponding to a number greater than or equal to a preset number threshold in the counted number.
[0173] In some optional implementations, the first detection module 1102 includes: a second generation unit 11021, used to determine the aspect ratio of the image area, compare the aspect ratio with a preset aspect ratio range, and determine a first liveness detection result corresponding to the aspect ratio detection method based on the comparison result; a third generation unit 11022, used to magnify the image area by a preset multiple, determine whether the enlarged image area as a whole is within the current video frame, and generate a first liveness detection result corresponding to the image area over-boundary detection method; a fourth generation unit 11023, used to perform at least one target object attribute detection on the image area, and generate a first liveness detection result corresponding to the target object attribute detection method based on the detection result of at least one target object attribute detection.
[0174] In some optional implementations, the fourth generation unit 11023 includes at least one of the following: a first detection subunit 110231, used to perform target object key point detection on the image area to obtain the number of target object key points; a second detection subunit 110232, used to perform target object posture angle detection on the image area to obtain the target object posture angle; a third detection subunit 110233, used to perform target object size detection on the image area to obtain the target object size.
[0175] In some optional implementations, the fourth generation unit 11022 is further used to generate a first liveness detection result indicating that the image quality is qualified if a first preset number of the following conditions are met: the number of detected key points of the target object is greater than or equal to a second preset number; the detected target object posture angle is within a preset posture angle range; the detected target object size is greater than or equal to a preset size.
[0176] In some optional implementations, the third determination module 1105 includes: a second determination unit 11051, which is used to determine, in response to determining that the first liveness detection result corresponding to the aspect ratio detection method indicates that the image quality is unqualified, that the second liveness detection result of the current video frame is a characterization of the target object as non-living; a third determination unit 11052, which is used to determine, in response to determining that the detection result of the aspect ratio detection method indicates that the image quality is qualified, and the detection result of the image area over-boundary detection method indicates that the image quality is unqualified, that the second liveness detection result of the current video frame is a characterization of whether the uncertain target object is alive; a fourth determination unit 11053, which is used to determine, in response to determining that the first liveness detection results corresponding to the aspect ratio detection method and the image area over-boundary detection method both indicate that the image quality is qualified, and the first liveness detection result corresponding to the image area over-boundary detection method indicates that the image quality is unqualified, that the second liveness detection result of the current video frame is a characterization of whether the uncertain target object is alive.
[0177] In some optional implementations, the second detection module 1104 is further used to: input the enlarged image area into a living body detection model to obtain a prediction value for characterizing whether the target object is a living body.
[0178] In some optional implementations, the second determination module 1103 includes: a fifth determination unit 11031, used to determine that the image area meets the preset conditions based on that at least one first liveness detection result indicates that the image quality is qualified; a sixth determination unit 11032, used to determine that the image area does not meet the preset conditions based on that there is at least one first liveness detection result indicating that the image quality is unqualified in at least one first liveness detection result.
[0179] In some optional implementations, the first detection module 1102 is further used to: perform black and white image detection on the image area to generate a first liveness detection result indicating whether the image area is a black and white image; the third determination module 1105 is further used to: in response to determining that the first liveness detection result corresponding to the black and white image detection method indicates that the image area is a black and white image, determine that the second liveness detection result of the current video frame is a characterization that the target object is non-living; the fourth determination module 1107 is further used to: if the third liveness detection result indicates that the target object is non-living, and the first liveness detection result corresponding to the black and white image detection method indicates that the image area is a black and white image, determine that the current video frame is invalid or output a liveness detection result indicating that the target object is non-living.
[0180] The liveness detection device provided by the above-mentioned embodiment of the present disclosure performs image quality detection on the image area where the target object is located in the current video frame based on at least one image quality detection method to obtain at least one first liveness detection result, and then determines whether the image area meets the preset conditions based on the at least one first liveness detection result. If it meets the conditions, the second liveness detection result of the current video frame about the target object is determined by a pre-trained liveness detection model. If it does not meet the conditions, the second liveness detection result of the current video frame about the target object is determined based on the at least one first liveness detection result. This implements image quality detection on the image before using the liveness detection model to assist the liveness detection model in performing liveness detection, which helps to improve the accuracy of liveness detection on video frames.
[0181] Exemplary Electronic Devices
[0182] Below, reference Fig.13 To describe an electronic device according to an embodiment of the present disclosure. The electronic device may be as follows Figure 1 Any one or both of the terminal device 101 and the server 103 shown, or a stand-alone device independent of them, the stand-alone device can communicate with the terminal device 101 and the server 103 to receive the collected input signals from them.
[0183] Fig.13 A block diagram of an electronic device according to an embodiment of the present disclosure is illustrated.
[0184] like Fig.13 As shown, the electronic device 1300 includes one or more processors 1301 and a memory 1302 .
[0185] The processor 1301 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 1300 to perform desired functions.
[0186] The memory 1302 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on a computer-readable storage medium, and the processor 1301 may run the program instructions to implement the above-mentioned living body detection method of each embodiment of the present disclosure and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.
[0187] In one example, the electronic device 1300 may further include: an input device 1303 and an output device 1304 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0188] For example, when the electronic device is the terminal device 101 or the server 103, the input device 1303 may be a camera, a mouse, a keyboard, or other devices, for inputting images, commands, etc. When the electronic device is a stand-alone device, the input device 1303 may be a communication network connector, for receiving input images, commands, etc. from the terminal device 101 and the server 103.
[0189] The output device 1304 can output various information to the outside, including the determined second liveness detection result, the third liveness detection result, etc. The output device 1304 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0190] Of course, to simplify, Fig.13 Only some of the components related to the present disclosure in the electronic device 1300 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 1300 may also include any other appropriate components.
[0191] Exemplary computer program products and computer-readable storage media
[0192] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the liveness detection method according to various embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section of this specification.
[0193] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0194] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the liveness detection method according to various embodiments of the present disclosure described in the above "Exemplary Method" section of this specification.
[0195] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0196] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0197] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0198] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0199] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
[0200] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0201] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0202] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A liveness detection method, applied to an electronic device, comprising: Determine the image region where the target object is located from the current video frame; Based on at least one preset image quality detection method, perform image quality detection on the image area to obtain at least one first living body detection result; Based on the at least one first living body detection result, determining whether the image area meets a preset condition; If the conditions are met, determining a prediction value for characterizing whether the target object is alive through a pre-trained liveness detection model, and determining a second liveness detection result of the current video frame with respect to the target object based on the prediction value; If not satisfied, determining a second liveness detection result of the current video frame with respect to the target object based on the at least one first liveness detection result; Determine, based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window where the current video frame is located, the liveness detection result of the current video frame being determined, wherein the third liveness detection result corresponding to the sliding window is obtained based on the second liveness detection result corresponding to each video frame in the sliding window, wherein the sliding window refers to a set of video frames including the current video frame and a video frame located before the current video frame, and the sliding window includes a target number of video frames; The determining, based on the at least one first living body detection result, whether the image area meets a preset condition comprises: Based on the at least one first living body detection result indicating that the image quality is qualified, determining that the image area meets a preset condition; Determining that the image area does not meet a preset condition based on at least one first liveness detection result indicating that the image quality is unqualified among the at least one first liveness detection result; The determining the liveness detection result of the current video frame based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window where the current video frame is located includes: If the third liveness detection result indicates that the target object is live, and the second liveness detection result indicates that the target object is not live or is uncertain whether it is live, outputting a liveness detection result that is uncertain whether the target object is live; If the length of the sliding window is less than a preset length, outputting a liveness detection result in which it is uncertain whether the target object is a live body; If the third liveness detection result indicates that it is uncertain whether the target object is alive, based on the category of the second liveness detection result, a liveness detection result corresponding to the category that is uncertain whether the target object is alive is generated, and the categories of the second liveness detection result include alive, non-living, and uncertain whether it is alive.
2. The method according to claim 1, wherein: The determining the liveness detection result of the current video frame based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window where the current video frame is located includes: If the second liveness detection result and the third liveness detection result both indicate that the target object is alive, outputting a liveness detection result indicating that the target object is alive; If the third liveness detection result indicates that the target object is not a live body, a liveness detection result indicating that the target object is not a live body is output.
3. The method according to claim 1, wherein: The method further comprises: Counting the number of identical second liveness detection results in the second liveness detection results corresponding to each video frame in the sliding window; A third liveness detection result corresponding to the sliding window is generated according to the second liveness detection results corresponding to the number of counted numbers that is greater than or equal to the preset number threshold.
4. The method according to claim 1, wherein: The performing image quality detection on the image area based on at least one preset image quality detection method to obtain at least one first living body detection result includes: Determine the aspect ratio of the image area, judge whether the aspect ratio belongs to a preset aspect ratio range, and determine a first living body detection result corresponding to the aspect ratio detection method based on the judgment result; Enlarging the image area by a preset multiple, determining whether the enlarged image area as a whole is within the current video frame, and generating a first living body detection result corresponding to the image area over-boundary detection method; At least one target object attribute detection is performed on the image area, and based on the detection result of the at least one target object attribute detection, a first living body detection result corresponding to the target object attribute detection method is generated.
5. The method according to claim 4, wherein: The detecting of at least one target object attribute on the image area includes at least one of the following: Performing target object key point detection on the image area to obtain the number of target object key points; Performing target object posture angle detection on the image area to obtain the target object posture angle; Perform target object size detection on the image area to obtain the target object size.
6. The method according to claim 5, wherein: The generating a first liveness detection result corresponding to the target object attribute detection method based on the detection result of the at least one target object attribute detection includes: If a first preset number of conditions are met, a first liveness detection result indicating that the image quality is qualified is generated; the first preset number of conditions include that the number of detected key points of the target object is greater than or equal to a second preset number, the detected target object posture angle is within a preset posture angle range, and the detected target object size is greater than or equal to a preset size.
7. The method according to claim 4, wherein: If the condition is not satisfied, determining a second liveness detection result of the current video frame with respect to the target object based on the at least one first liveness detection result comprises: In response to determining that the first liveness detection result corresponding to the aspect ratio detection method indicates that the image quality is unqualified, determining that the second liveness detection result of the current video frame indicates that the target object is non-live; In response to determining that the detection result of the aspect ratio detection method indicates that the image quality is qualified, and the detection result of the image area over-boundary detection method indicates that the image quality is unqualified, determining that the second living body detection result of the current video frame is a representation that it is uncertain whether the target object is a living body; In response to determining that the first liveness detection results corresponding to the aspect ratio detection method and the image area beyond-boundary detection method both indicate that the image quality is qualified, and the first liveness detection result corresponding to the target object attribute detection method indicates that the image quality is unqualified, it is determined that the second liveness detection result of the current video frame represents uncertainty as to whether the target object is alive.
8. The method according to claim 4, wherein: The method of determining a prediction value for characterizing whether the target object is alive by using a pre-trained liveness detection model includes: The enlarged image area is input into the living body detection model to obtain a prediction value for characterizing whether the target object is a living body.
9. The method according to claim 1, wherein: The performing image quality detection on the image area based on at least one preset image quality detection method to obtain at least one first living body detection result includes: Performing black-and-white image detection on the image area to generate a first living body detection result indicating whether the image area is a black-and-white image; If the condition is not satisfied, determining a second liveness detection result of the current video frame with respect to the target object based on the at least one first liveness detection result comprises: In response to determining that the first liveness detection result corresponding to the black-and-white image detection mode indicates that the image area is a black-and-white image, determining that the second liveness detection result of the current video frame indicates that the target object is non-live; The determining the liveness detection result of the current video frame based on the second liveness detection result of the current video frame and the third liveness detection result corresponding to the sliding window where the current video frame is located includes: If the third liveness detection result indicates that the target object is non-living, and the first liveness detection result corresponding to the black-and-white image detection method indicates that the image area is a black-and-white image, determine that the current video frame is invalid or output a liveness detection result indicating that the target object is non-living.
10. A living body detection device, comprising: A first determination module is used to determine the image area where the target object is located from the current video frame; A first detection module, configured to perform image quality detection on the image area based on at least one preset image quality detection method, and obtain at least one first living body detection result; A second determination module, configured to determine whether the image area meets a preset condition based on the at least one first living body detection result; The second determination module includes: a fifth determination unit, configured to determine that the image area meets the preset condition based on at least one first liveness detection result indicating that the image quality is qualified; a sixth determination unit, configured to determine that the image area does not meet the preset condition based on at least one first liveness detection result indicating that the image quality is unqualified among the at least one first liveness detection result; A second detection module is used to determine, if the conditions are met, a prediction value for characterizing whether the target object is alive through a pre-trained liveness detection model, and determine a second liveness detection result of the current video frame with respect to the target object based on the prediction value; A third determination module is used to determine, if not satisfied, a second liveness detection result of the current video frame with respect to the target object based on the at least one first liveness detection result; a fourth determination module, configured to determine a liveness detection result of the current video frame based on the second liveness detection result of the current video frame and a third liveness detection result corresponding to a sliding window in which the current video frame is located, wherein the third liveness detection result corresponding to the sliding window is obtained based on the second liveness detection result corresponding to each video frame in the sliding window, wherein the sliding window refers to a video frame set including the current video frame and a video frame located before the current video frame, and wherein the sliding window includes a target number of video frames; The fourth determination module includes: a third output unit, which is used to output a liveness detection result of uncertain whether the target object is alive if the third liveness detection result indicates that the target object is alive and the second liveness detection result indicates that the target object is non-live or uncertain whether it is alive; a fourth output unit, which is used to generate a liveness detection result of uncertain whether the target object is alive corresponding to the category based on the category of the second liveness detection result if the third liveness detection result indicates that it is uncertain whether the target object is alive, and the categories of the second liveness detection result include liveness, non-liveness and uncertain whether it is alive; and a fifth output unit, which is used to output a liveness detection result of uncertain whether the target object is alive if the length of the sliding window is less than a preset length.
11. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the method according to any one of claims 1 to 9.
12. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1 to 9.
Citation Information
Patent Citations
Face silence living body detection method and device, computer equipment and storage medium
CN113011385A