Liveness detection methods and systems
By diffusing the original image toward the target liveness category to generate a diffused image and determine the differences, the problem that existing liveness detection methods cannot cover all attack types is solved, and more efficient liveness detection performance is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2023-08-18
- Publication Date
- 2026-05-26
AI Technical Summary
Existing liveness detection methods cannot effectively cover all types of attacks, resulting in weak liveness detection performance.
By acquiring the original image and spreading it in the direction of the target liveness category, a diffused image is generated. The liveness detection result is determined based on the difference between the diffused image and the original image. The detection performance is improved by using a diffusion model and image patch selection rules.
It can cover all types of attacks, improve liveness detection performance, adapt to new attack types, and maintain high efficiency by retraining the model.
Smart Images

Figure CN117037293B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of image processing technology, and in particular to a liveness detection method and system. Background Technology
[0002] In recent years, with the increasingly widespread application of facial recognition, new security issues have emerged. Among them, liveness detection attacks are one of the more common and threatening security risks. Attackers can use facial materials of the "victim" (such as mobile phone photos, printed photos, or masks, etc.) to compromise facial recognition systems. Therefore, liveness detection methods for detecting liveness attacks have been proposed. Currently, liveness detection methods include classification-based supervised liveness detection methods and depth map estimation-based liveness detection methods. Their liveness detection performance is relatively weak; a single liveness detection method only covers some attack types and cannot cover all attack types.
[0003] In summary, there is a need to provide a liveness detection method and system that can improve liveness detection performance.
[0004] The information in the background section is merely information known only to the inventor and does not imply that such information had entered the public domain before the date of this application, nor does it imply that it can be considered prior art in this disclosure. Summary of the Invention
[0005] This specification provides a liveness detection method and system that can improve liveness detection performance.
[0006] In a first aspect, this specification provides a liveness detection method, comprising: acquiring an original image; diffusing the original image toward a target liveness category to obtain a diffused image corresponding to the original image; determining a liveness detection result based on the original image and the diffused image; and outputting the liveness detection result.
[0007] In some embodiments, the target living organism category includes the living organism category.
[0008] In some embodiments, the step of diffusing the original image toward the direction of the target live organism category to obtain a diffused image corresponding to the original image includes: determining at least one key image block in the original image; and diffusing each key image block in the at least one key image block toward the direction of the target live organism category to obtain at least one diffused image block corresponding to the at least one key image block, wherein the diffused image includes the at least one diffused image block.
[0009] In some embodiments, determining at least one key image patch in the original image includes: determining the at least one key image patch from the original image through at least one iteration, including in each of the at least one iteration: selecting the key image patch corresponding to the current iteration from a plurality of image patches in the original image based on a preset image patch selection rule; determining the iteration probability of the original image based on the key image patch selected from the original image and its corresponding diffusion image patch, the iteration probability representing the probability of performing a new round of key image patch selection on the original image; and determining that the iteration probability is greater than a preset iteration probability threshold and proceeding to the next iteration; or determining that the iteration probability is less than the preset iteration probability threshold, ending the iteration, and taking the selected key image patch as the at least one key image patch.
[0010] In some embodiments, the preset image block selection rule includes a random selection rule or an adaptive selection rule.
[0011] In some embodiments, the step of diffusing each key image block in the at least one key image block toward the direction of the target liveness category to obtain at least one diffused image block corresponding to the at least one key image block includes: diffusing each key image block in the at least one key image block toward the direction of the target liveness category based on a diffusion model to obtain at least one diffused image block corresponding to the at least one key image block; the training objective of the diffusion model includes constraining the difference between the first predicted diffused image block output by the diffusion model based on the original sample image block and its corresponding true label to be less than a first preset difference threshold, wherein the first predicted diffused image block is an image block consistent with the target liveness category, and the true label includes an image block consistent with the target liveness category corresponding to the original sample image block.
[0012] In some embodiments, the training objective of the diffusion model further includes constraining the difference between the predicted liveness classification result obtained based on the first predicted diffusion image patch and the actual liveness classification result to be less than a second preset difference threshold.
[0013] In some embodiments, the predicted liveness classification result is obtained based on the image difference between the original sample image patch and the first predicted diffusion image patch.
[0014] In some embodiments, determining at least one key image patch in the original image includes: determining at least one key image patch in the original image patch based on an image patch selection model; wherein the training objective of the image patch selection model includes constraining the difference between the predicted iteration probability of the original sample image patch and its corresponding iteration probability label to be less than a third preset difference threshold, the predicted iteration probability of the original sample image patch is determined based on the original sample image patch and its corresponding second predicted diffusion image patch, wherein the second predicted diffusion image patch is an image patch obtained by diffusion of the original sample image patch toward the target liveness category based on a diffusion model, and the iteration probability label is determined based on the ratio of the number of image patches in the selected original sample image patch that are not labeled to the number of pre-labeled labeled image patches.
[0015] In some embodiments, the training objective of the image patch selection model further includes constraining the difference between the second predicted diffuse image patch and its corresponding true label to be less than a fourth preset difference threshold, wherein the true label includes an image patch that corresponds to the original sample image patch and is consistent with the target liveness category.
[0016] In some embodiments, determining the liveness detection result based on the original image and the diffused image includes: determining the liveness detection result based on the at least one key image block and its corresponding at least one diffused image block, including: determining the image difference between each key image block and its corresponding diffused image block, thereby determining at least one image difference corresponding to the at least one key image; and determining the liveness detection result based on the at least one image difference.
[0017] In some embodiments, determining the image difference between each key image block and its corresponding diffuse image block for each key image block in the at least one key image block includes: determining the image difference based on the difference image between each key image block and its corresponding diffuse image block.
[0018] In some embodiments, determining the liveness detection result based on the image differences corresponding to the at least one key image block includes: determining the weighted sum of the image differences between each key image block and its corresponding diffuse image block in the at least one key image block as the comprehensive image difference corresponding to the original image; and determining that the comprehensive image difference is greater than a preset difference threshold, and thus determining that the liveness detection result is a category inconsistent with the target liveness category; or determining that the comprehensive image difference is less than the preset difference threshold, and thus determining that the liveness detection result is a category consistent with the target liveness category.
[0019] In some embodiments, determining the liveness detection result based on the original image and the diffused image includes: determining the liveness detection result based on the image difference between the original image and the diffused image, including: determining that the image difference is greater than a preset difference threshold, and determining that the liveness detection result is a category inconsistent with the target liveness category; or determining that the image difference is less than the preset difference threshold, and determining that the liveness detection result is a category consistent with the target liveness category.
[0020] In some embodiments, the method further includes: when determining that the liveness detection result is an attack category, obtaining an attribution result based on the difference between the original image and the diffused image, wherein the attribution result characterizes the reason for the interception of the original image.
[0021] In some embodiments, the attribution result is obtained through the attribution model, which is trained based on the original sample images identified as attack categories.
[0022] Secondly, this specification also provides a liveness detection system, comprising: at least one storage medium storing at least one instruction set for performing liveness detection; and at least one processor communicatively connected to the at least one storage medium, wherein, when the liveness detection system is running, the at least one processor reads the at least one instruction set and executes the method described in any one of the first aspects according to the instructions of the at least one instruction set.
[0023] As can be seen from the above technical solutions, the liveness detection method and system provided in this specification, after acquiring the original image, diffuses the original image into an image of the target liveness category with the target liveness category as the diffusion direction, and determines the liveness detection result based on the difference between the target liveness category image and the original image. In this solution, since the diffusion direction is constrained to the target liveness category, the diffused image of the target liveness category can be used as a reference image to identify the liveness classification result of the original image, thus improving the liveness detection performance. Because there are numerous types of existing attack categories, existing liveness detection technologies cannot cover all attack types. However, the liveness detection method and system provided in this specification can diffuse towards the target liveness category regardless of the attack type of the attack image, thereby covering all types of attacks. Even if a new attack type emerges, the diffusion model can be retrained by collecting samples of the new attack type, enabling the liveness detection method and system of this specification to be effective against the new attack type. Therefore, the liveness detection method and system provided in this specification can significantly improve liveness detection performance and has high performance for all attack types.
[0024] Other functions of the liveness detection methods and systems provided in this specification will be partially listed in the following description. The figures and examples described below will be readily apparent to those skilled in the art. The inventive aspects of the liveness detection methods and systems provided in this specification can be fully understood through practice or use of the methods, apparatus, and combinations described in the detailed examples below. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A schematic diagram illustrating an application scenario of a liveness detection system provided according to an embodiment of this specification is shown.
[0027] Figure 2 A hardware structure diagram of a computing device provided according to an embodiment of this specification is shown;
[0028] Figure 3 A flowchart of a liveness detection method provided according to an embodiment of this specification is shown;
[0029] Figure 4 A schematic diagram of the network structure used when training the diffusion model according to the embodiments provided in this specification; and
[0030] Figure 5 This is a schematic diagram of the network structure when selecting a training image patch model according to an embodiment of this specification. Detailed Implementation
[0031] The following description provides specific application scenarios and requirements for this specification, intended to enable those skilled in the art to make and use the contents of this specification. Various partial modifications to the disclosed embodiments will be apparent to those skilled in the art, and the general principles defined herein can be applied to other embodiments and applications without departing from the spirit and scope of this specification. Therefore, this specification is not limited to the embodiments shown, but rather to the widest scope consistent with the claims.
[0032] The terminology used herein is for the purpose of describing particular exemplary embodiments only and is not restrictive. For example, unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “the” used herein may also include the plural forms. When used in this specification, the terms “comprising,” “including,” and / or “containing” mean that the associated integers, steps, operations, elements, and / or components are present, but do not exclude the presence of one or more other features, integers, steps, operations, elements, components, and / or groups, or that other features, integers, steps, operations, elements, components, and / or groups may be added to the system / method.
[0033] Considering the following description, these and other features of this specification, as well as the operation and function of the related components of the structure, and the economy of assembly and manufacture of the parts, can be significantly improved. All of these form part of this specification with reference to the accompanying drawings. However, it should be clearly understood that the drawings are for illustrative and descriptive purposes only and are not intended to limit the scope of this specification. It should also be understood that the drawings are not drawn to scale.
[0034] The flowcharts used in this specification illustrate operations implemented according to some embodiments of this specification. It should be clearly understood that the operations in the flowcharts may not be implemented in a sequential order. Instead, the operations may be implemented in reverse order or simultaneously. Furthermore, one or more additional operations may be added to the flowcharts. One or more operations may be removed from the flowcharts.
[0035] For ease of description, the terms used in this specification are explained as follows:
[0036] Liveness detection: also known as liveness protection, refers to the technology that uses artificial intelligence models to detect and block liveness attacks, such as those on mobile phone screens, printed paper, etc.
[0037] Diffusion model: refers to a model that uses diffusion theory to generate images.
[0038] Adaptive image patch diffusion: refers to selecting patches for diffusion.
[0039] Before describing the specific embodiments in this specification, the application scenarios of this specification will be introduced as follows:
[0040] The liveness detection method provided in this specification can be applied to any liveness detection scenario in biometric processes. For example, in scenarios such as face payment or face recognition, the liveness detection method can be used to perform liveness detection on the original image of the biometric features of the user to be paid or identified; in identity verification scenarios, the liveness detection method can be used to perform liveness detection on the original image of the user's biometric features; and it can also be applied to any other liveness detection scenario, which will not be elaborated here. The biometric features may include, but are not limited to, one or more of the following: facial image, iris, sclera, fingerprint, palm print, voiceprint, and skeletal projection. For ease of description, this application will use the application of the liveness detection method in a face recognition scenario to perform liveness detection on a face as an example.
[0041] Those skilled in the art should understand that the liveness detection methods and systems described in this specification are also within the scope of protection of this specification when applied to other application scenarios.
[0042] Figure 1 This diagram illustrates an application scenario of a liveness detection system 001 provided according to an embodiment of this specification. The liveness detection system 001 (hereinafter referred to as System 001) can be applied to liveness detection in any scenario, such as liveness detection in face payment scenarios, liveness detection in identity verification scenarios, liveness detection in other face recognition scenarios, etc. Figure 1 As shown, system 001 may include terminal device 200 and server 300. The application scenarios of system 001 may include target user 100, system 001, and network 400.
[0043] Target user 100 can be a user who needs to undergo biometric identification, or a user who is currently undergoing biometric identification. Target user 100 can be the object detected by system 001.
[0044] Terminal device 200 can be a device that initiates liveness detection for target user 100. Target user 100 can initiate liveness detection through terminal device 200. In some embodiments, the liveness detection method can be executed on terminal device 200. In this case, terminal device 200 may store data or instructions for executing the liveness detection method described herein, and can execute or be used to execute the data or instructions. In some embodiments, terminal device 200 may include hardware devices with data information processing capabilities and necessary programs for driving the hardware devices to operate. In some embodiments, terminal device 200 may include mobile devices, tablet computers, laptop computers, built-in devices in motor vehicles, or similar content, or any combination thereof. In some embodiments, the mobile device may include smart home devices, smart mobile devices, virtual reality devices, augmented reality devices, or similar devices, or any combination thereof. In some embodiments, the smart home device may include smart TVs, desktop computers, etc., or any combination thereof. In some embodiments, the smart mobile device may include smartphones, personal digital assistants, gaming devices, navigation devices, etc., or any combination thereof. In some embodiments, the virtual reality device or augmented reality device may include virtual reality headsets, virtual reality glasses, virtual reality patches, augmented reality headsets, augmented reality glasses, augmented reality patches, or similar content, or any combination thereof. For example, the virtual reality device or the augmented reality device may include Google Glass, a head-mounted display, VR, etc. In some embodiments, the built-in device in the motor vehicle may include an in-vehicle computer, an in-vehicle television, etc. In some embodiments, the terminal device 200 may include an image acquisition device for acquiring raw images of the target user 100. In some embodiments, the image acquisition device may be a two-dimensional image acquisition device (e.g., an RGB camera), or a combination of a two-dimensional image acquisition device (e.g., an RGB camera) and a depth image acquisition device (e.g., a 3D structured light camera, a laser detector, etc.). In some embodiments, the terminal device 200 may be a device with positioning technology for locating the position of the terminal device 200.
[0045] In some embodiments, the terminal device 200 may have one or more applications (APPs) installed. The APPs provide the target user 100 with the ability and interface to interact with the outside world via the network 400. The APPs include, but are not limited to: web browser APPs, search APPs, chat APPs, shopping APPs, video APPs, financial management APPs, instant messaging tools, email terminals, social media platform software, etc. In some embodiments, a target APP may be installed on the terminal device 200. The target APP can capture the original image of the target user 100 for the terminal device 200. In some embodiments, the target user 100 can also trigger a liveness detection request through the target APP. The target APP can respond to the liveness detection request by executing the liveness detection method described in this specification. The liveness detection method will be described in detail later.
[0046] like Figure 1 As shown, terminal device 200 can communicate with server 300. In some embodiments, server 300 can communicate with multiple terminal devices 200 and receive data sent by terminal devices 200. In some embodiments, terminal devices 200 can interact with server 300 through network 400 to receive or send messages, etc. Server 300 can be a server that provides various services, such as a backend server that supports a liveness detection method deployed on multiple terminal devices 200. In some embodiments, the liveness detection method can be executed on server 300. In this case, server 300 can store data or instructions for executing the liveness detection method described in this specification, and can execute or be used to execute the data or instructions. In some embodiments, server 300 may include hardware devices with data information processing capabilities and the necessary programs required to drive the hardware devices.
[0047] Network 400 serves as a medium to provide a communication connection between terminal device 200 and server 300. Network 400 facilitates the exchange of information or data. For example... Figure 1 As shown, terminal device 200 and server 300 can connect to network 400 and transmit information or data to each other through network 400. In some embodiments, network 400 can be any type of wired or wireless network, or a combination thereof. For example, network 400 may include cable network, wired network, fiber optic network, telecommunications network, intranet, Internet, local area network (LAN), wide area network (WAN), wireless local area network (WLAN), metropolitan area network (MAN), public switched telephone network (PSTN), Bluetooth network. TM ZigBee TMA network, a near-field communication (NFC) network, or a similar network. In some embodiments, network 400 may include one or more network access points. For example, network 400 may include wired or wireless network access points, such as base stations or internet exchange points, through which one or more components of terminal device 200 and server 300 can connect to network 400 to exchange data or information.
[0048] It should be understood that Figure 1 The number of terminal devices 200, servers 300, and networks 400 shown is merely illustrative. Depending on implementation needs, any number of terminal devices 200, servers 300, and networks 400 can be included.
[0049] It should be noted that the liveness detection method can be executed entirely on the terminal device 200, entirely on the server 300, or partially on the terminal device 200 and partially on the server 300.
[0050] Figure 2 A hardware structure diagram of a computing device 600 provided according to an embodiment of this specification is shown. The computing device 600 can execute the liveness detection method described in this specification. The liveness detection method is described in other parts of this specification. When the liveness detection method is executed on a terminal device 200, the computing device 600 can be the terminal device 200. When the liveness detection method is executed on a server 300, the computing device 600 can be the server 300. When the liveness detection method can be executed partly on the terminal device 200 and partly on the server 300, the computing device 600 can be either the terminal device 200 or the server 300.
[0051] like Figure 2 As shown, the computing device 600 may include at least one storage medium 630 and at least one processor 620. In some embodiments, the computing device 600 may also include a communication port 650 and an internal communication bus 610. Additionally, the computing device 600 may include I / O components 660.
[0052] The internal communication bus 610 can connect different system components, including storage medium 630, processor 620 and communication port 650.
[0053] I / O component 660 supports input / output between computing device 600 and other components.
[0054] Communication port 650 is used for data communication between computing device 600 and external sources. For example, communication port 650 can be used for data communication between computing device 600 and network 400. Communication port 650 can be a wired communication port or a wireless communication port.
[0055] Storage medium 630 may include a data storage device. The data storage device may be a non-transitory storage medium or a temporary storage medium. For example, the data storage device may include one or more of a disk 632, a read-only storage medium (ROM) 634, or a random access storage medium (RAM) 636. Storage medium 630 also includes at least one instruction set stored in the data storage device. The instructions are computer program code, which may include programs, routines, objects, components, data structures, procedures, modules, etc., that execute the liveness detection method provided in this specification.
[0056] At least one processor 620 can be communicatively connected to at least one storage medium 630 and a communication port 650 via an internal communication bus 610. At least one processor 620 is used to execute the at least one instruction set described above. When the computing device 600 is running, at least one processor 620 reads the at least one instruction set and, according to the instructions of the at least one instruction set, executes the liveness detection method provided in this specification. Processor 620 can execute all the steps included in the liveness detection method. Processor 620 can be in the form of one or more processors. In some embodiments, processor 620 may include one or more hardware processors, such as a microcontroller, microprocessor, reduced instruction set computer (RISC), application-specific integrated circuit (ASIC), application-specific instruction set processor (ASIP), central processing unit (CPU), graphics processing unit (GPU), physical processing unit (PPU), microcontroller unit, digital signal processor (DSP), field-programmable gate array (FPGA), advanced RISC machine (ARM), programmable logic device (PLD), any circuit or processor capable of performing one or more functions, or any combination thereof. For illustrative purposes only, only one processor 620 is described in this specification for the computing device 600. However, it should be noted that the computing device 600 may also include multiple processors. Therefore, the operation and / or method steps disclosed in this specification may be executed by one processor as described herein, or they may be executed jointly by multiple processors. For example, if processor 620 of the computing device 600 in this specification executes steps A and B, it should be understood that steps A and B may also be executed jointly or separately by two different processors 620 (e.g., a first processor executes step A, a second processor executes step B, or the first and second processors jointly execute steps A and B).
[0057] Figure 3A flowchart of a liveness detection method P100 according to an embodiment of this specification is shown. As previously described, the computing device 600 can execute the liveness detection method P100 of this specification. Specifically, the computing device 600 can read an instruction set stored in its local storage medium and then execute the liveness detection method P100 of this specification according to the instructions in the instruction set. Figure 3 As shown, method P100 may include:
[0058] S120: Obtain the original image.
[0059] The original image is an image obtained by capturing images of the target user 100. The original image includes the biometric features of the target user 100. Biometric features are inherent physiological characteristics of the human body, which may include at least one of the following: face, iris, sclera, fingerprint, palm print, and skeletal projection, or other inherent physiological characteristics of the human body capable of facial recognition. For ease of description, this specification will use the face as an example of biometric features. Those skilled in the art should understand that other biometric features are also within the scope of protection of this specification.
[0060] The original image can be acquired by the terminal device 200. The terminal device 200 can be a device for performing liveness verification or face verification. In some embodiments, the target user 100 can complete the verification on the terminal device 200 by performing liveness verification or face verification on the terminal device 200. In some embodiments, the original image can be an image directly acquired by the terminal device 200. In some embodiments, the original image can also be an image obtained after preprocessing the image directly acquired by the terminal device 200. The preprocessing can be operations such as cropping, enlarging, reducing, rotating, and image enhancement.
[0061] S140: Diffusion of the original image toward the target live organism category to obtain a diffusion image corresponding to the original image.
[0062] The target liveness category can be any of the liveness detection categories. In some embodiments, the target liveness category can be a liveness category. In some embodiments, the target liveness category can be an attack category. In some embodiments, the target liveness category can also be a fusion of any one or more different attack types within the attack category. In step S140, the computing device 600 generates a diffused image by adding and removing noise from the original image, with the target liveness category as the diffusion direction. The noise can be understood as an offset from the original image; by adding this offset to the original image, the original image can be diffused into an image of the target liveness category. The liveness classification result of the diffused image is the target liveness category. The liveness classification results of the original image and the diffused image can be the same or different. For example, the liveness classification result of the original image is "live" and the liveness classification result of the diffused image is "live"; or the liveness classification result of the original image is "attack" and the liveness classification result of the diffused image is "live"; or the liveness classification result of the original image is "live" and the liveness classification result of the diffused image is "attack"; or the liveness classification result of the original image is "attack" and the liveness classification result of the diffused image is "attack". Since there are many types of attack categories, the following description will focus on using the example of the target liveness category being "live".
[0063] The implementation of step S140 can be varied, as follows: In some embodiments, the computing device 600 can generate a diffusion image based on the entire original image. For example, the computing device 600 generates a diffusion image by adding and removing noise from the entire original image. In some embodiments, the computing device 600 can also generate a diffusion image based on image patches in the original image. For example, the computing device 600 determines at least one key image patch in the original image and diffuses each key image patch in the direction of the target liveness category to obtain at least one diffusion image patch corresponding to the at least one key image patch, thereby generating a diffusion image. In this case, the diffusion image consists of at least one diffusion image patch. When the computing device 600 generates a diffusion image based on the entire original image, the entire original image can be considered as a single key image patch. Therefore, the following description will use the generation of a diffusion image based on image patches in the original image as an example. Those skilled in the art will understand that when the computing device 600 generates a diffused image based on the entire original image, the entire original image can be used as a key image block for diffusion. The way the diffusion is achieved is the same as the way the diffused image is generated based on the image blocks in the original image, and will not be described again in this specification.
[0064] When the computing device 600 generates a diffused image based on image patches in the original image, the computing device 600 can determine the at least one key image patch from the original image through at least one iteration. Specifically, in each iteration of the at least one iteration, the computing device 600 can select the key image patch corresponding to the current iteration from multiple image patches in the original image based on a preset image patch selection rule; and determine the iteration probability of the original image based on the key image patch selected from the original image and its corresponding diffused image patch; and if the iteration probability is greater than a preset iteration probability threshold, proceed to the next iteration; or if the iteration probability is less than the preset iteration probability threshold, end the iteration, and take the selected key image patch as at least one key image patch. The iteration probability can characterize the probability of performing a new round of key image patch selection on the original image.
[0065] In other words, the computing device 600 needs to perform at least one round of selection in the original image to obtain at least one key image patch. This "at least one round of selection" corresponds one-to-one with the aforementioned "at least one iteration." The process of at least one round of selection is described below. For ease of understanding, we denote the current round in the at least one round of selection as round i, where i can be a positive integer. For the i-th round of selection, the computing device 600 can select an image patch in the original image as the key image patch for the i-th round based on a preset image patch selection rule. At this time, the computing device 600 can determine the iteration probability of the original image in the i-th round based on the key image patch selected in the previous i-1 rounds and its corresponding diffusion image patch, and the key image patch selected in the i-th round and its corresponding diffusion image patch. The iteration probability determines whether it is necessary to continue selecting key image patches in the original image. When the iteration probability is less than a preset iteration probability threshold, it indicates that it is necessary to continue selecting key image patches in the original image. When the iteration probability is greater than the preset iteration probability threshold, it indicates that it is not necessary to continue selecting key image patches in the original image. Therefore, when the computing device 600 determines that the iteration probability is less than a preset iteration probability threshold, the iteration ends. At this point, the computing device does not need to select key image blocks in the next round. The computing device 600 can then use the already selected key image blocks (the i key image blocks selected in round i) as at least one key image block. When the computing device 600 determines that the iteration probability is greater than the preset iteration probability threshold, it can proceed to the next round (round i+1) of selection until the iteration probability is less than the preset iteration probability threshold, at which point the iteration stops, i.e., the new round of selection is stopped.
[0066] The preset image patch selection rules can include random selection rules or adaptive selection rules. That is, the computing device 600 can select the i-th key image patch from the original image using random selection or by using an adaptive selection rule. An adaptive selection rule refers to adaptively determining the position and number of key image patches to be selected in the original image based on the characteristics of the image. For example, attack images and liveness images may have differences in some key image patch areas, such as reflective areas. Therefore, the adaptive selection rule can be used to filter out key image patch areas in the original image that can distinguish between liveness and attack categories. In some embodiments, the computing device 600 can pre-store adaptive selection rules. For example, the computing device 600 can pre-store image features of key image patch areas that can distinguish between liveness and attack categories, and select image patches that conform to these image features as key image patches based on these image features.
[0067] In some embodiments, the iteration probability can be obtained based on the proportion of selected key image patches. For example, the proportion of selected key image patches can be the proportion of the number of selected key image patches to the total number of key image patches. In this case, all key image patches can be selected from the original image using the adaptive selection rules described above. Alternatively, the proportion of selected key image patches can be the proportion of the area of selected key image patches to the area of all key image patches. In some embodiments, the iteration probability can be inversely proportional to the proportion of selected key image patches. That is, the higher the proportion of selected key image patches, the lower the iteration probability, and the lower the probability of needing to perform a new round of key image patch selection; conversely, the lower the proportion of selected key image patches, the higher the iteration probability, and the higher the probability of needing to perform a new round of key image patch selection.
[0068] In some embodiments, the iteration probability can be obtained based on the difference between a selected key image patch and its corresponding diffuse image patch. For example, the iteration probability can be obtained based on the distribution of the differences between different selected key image patches and their corresponding diffuse image patches. The distribution of the differences between different selected key image patches and their corresponding diffuse image patches can also be used to characterize the proportion of selected key image patches. The distribution can be the degree of dispersion of the differences between different selected key image patches and their corresponding diffuse image patches, such as variance. For example, the higher the dispersion of these differences, the lower the proportion of selected key image patches, the higher the iteration probability, and the higher the probability of needing to select a new round of key image patches. The lower the dispersion of these differences, the higher the proportion of selected key image patches, the lower the iteration probability, and the lower the probability of needing to select a new round of key image patches. Furthermore, the distribution can be the deviation between the differences between different selected key image patches and their corresponding diffuse image patches. For example, the greater the deviation between these differences, the lower the proportion of selected key image patches, the higher the iteration probability, and the higher the probability of needing to select a new round of key image patches. The smaller the deviation between these differences, the higher the proportion of key image patches that have been selected, and the lower the iteration probability. In this case, the probability of needing to select a new round of key image patches is also lower.
[0069] In some embodiments, the computing device 600 can also calculate the iteration probability using a machine learning model. The training method for the machine learning model will be described in detail later.
[0070] It should be noted that the shapes and sizes of different key image patches can be the same or different. The shape of each key image patch can be a regular shape or an irregular shape. In some embodiments, the shape of the key image patch can be a square, rectangle, circle, etc.
[0071] After determining at least one key image block, the computing device 600 can diffuse the at least one key image block in the direction of the target living organism category to obtain a diffused image block corresponding to each key image block in the at least one key image block. There is a one-to-one correspondence between key image blocks and diffused image blocks; that is, one key image block can be diffused into one diffused image block. In some embodiments, the selection and diffusion processes of key image blocks can be performed alternately. For example, after selecting a key image block in the i-th round, the key image block selected in the i-th round can be diffused to obtain the diffused image block corresponding to the key image block in the i-th round, and then the selection and diffusion of key image blocks in the next round can be performed. In some embodiments, the computing device 600 can first select all key image blocks in the at least one key image block before diffusing the at least one key image block.
[0072] In some embodiments, the computing device 600 can perform diffusion on at least one key image patch based on a diffusion model. For example, the computing device 600 can input at least one key image patch into a trained diffusion model, so that the diffusion model diffuses in the direction of the target liveness category based on each key image patch in the at least one key image patch, thereby obtaining at least one diffused image patch corresponding to the at least one key image patch. The diffusion process can be as follows: for example, the computing device 600 sequentially records each key image patch in the at least one key image patch as a target key image patch, and generates a corresponding diffused image patch based on the target key image patch by adding noise and removing noise.
[0073] Before applying the diffusion model to diffuse key image patches toward the target liveness category, the computing device 600 needs to train the diffusion model. Below, we will describe the training process of the diffusion model using the liveness category as the target liveness category as an example. Those skilled in the art should understand that the training process of the diffusion model when the target liveness category is the attack category is also within the scope of this specification.
[0074] When training the diffusion model, the computing device 600 can train a preset diffusion network based on the acquired sample image pairs and the first comprehensive loss until the preset diffusion network converges, thus obtaining a trained diffusion model. The preset diffusion network is also called the diffusion model during training.
[0075] A sample image pair can include an original sample image and its corresponding target sample image. The original sample image and its corresponding target sample image correspond to the same object. When the target liveness category is "liveness," the original sample image can be either a liveness image sample or an attack image sample, and the target sample image can be a liveness image sample corresponding to the original sample image. That is, when the original sample image is a liveness image sample, the target sample image can be the same liveness image sample as the original sample image. Conversely, when the original sample image is an attack image sample, the target sample image can be a liveness image sample corresponding to the attack image sample. Taking a user as an example, the liveness image sample can be images of different types of users, and different types can include different makeup styles. For example, terminal device 200 or other image acquisition devices can acquire images of different users under different acquisition conditions to obtain liveness image samples. Different acquisition conditions can include different lighting, different backgrounds, and different environments, etc. After obtaining the liveness image sample, computing device 600 can also create attack materials such as printed photos and masks based on the liveness image sample, and acquire images of these attack materials under different acquisition conditions to obtain attack image samples corresponding to the liveness image sample. In this specification, one liveness image sample can correspond to one or more attack image samples. Therefore, one liveness image sample can correspond to one or more sample image pairs. Alternatively, a liveness sample of an object can be copied into two liveness samples and used as a sample image pair. When the target liveness category is an attack category, the original sample image can be either a liveness image sample or an attack image sample, and the target sample image can be the attack image sample corresponding to the original sample image; this will not be elaborated further here.
[0076] After acquiring sample image pairs, the computing device 600 can train the preset diffusion network based on the sample image pairs and the first comprehensive loss, thereby obtaining a trained diffusion model. The training process of the diffusion model is described in detail below with reference to the accompanying drawings: Figure 4 This is a schematic diagram of the network structure used when training the diffusion model according to the embodiments provided in this specification. Figure 4 As shown, the network structure used in training the diffusion model may include a preset diffusion network. In some embodiments, the network structure used in training the diffusion model may further include a preset image patch selection and preprocessing network. In some embodiments, the network structure used in training the diffusion model may further include a preset diffusion direction constraint network.
[0077] The preset image patch selection and preprocessing network can be a transformer network. The computing device 600 inputs sample image pairs (denoted as the original sample image and the target sample image, respectively) into the preset image patch selection and preprocessing network, causing the network to randomly select a pair of sample image patches (denoted as the original sample image patch and the target sample image patch, respectively) from the sample image pairs. Here, the target sample image patch serves as a label for the original sample image patch, used for supervised training of the preset diffusion network. The original sample image patch can be a square region, for example, an image patch whose area proportion in the original image is between 10% and 20%. Similarly, the target sample image patch can also be a square region, for example, whose area proportion in the target sample image is between 10% and 20%. The positions of the original sample image patch and the target sample image patch correspond to each other.
[0078] After obtaining the original sample image patch and the target sample image patch, the computing device 600 can also perform cropping and enhancement operations on the original and target sample image patches, such as adding Gaussian noise of the same intensity to the original and target sample image patches. In some embodiments, the above-mentioned cropping process and image enhancement operation can also be performed by a preset image patch selection and preprocessing network. The cropping operation and image enhancement operation can increase the number of sample images.
[0079] The preset diffusion network can be a UET network. The computing device 600 inputs the original sample image patch into the preset diffusion network, so that the preset diffusion network diffuses in the direction of the target liveness category based on the original sample image patch, thereby obtaining a first predicted diffusion image patch and diffusion noise. The diffusion noise can be the offset between the original sample image patch and the first predicted diffusion image patch. By adding diffusion noise to the original sample image patch, the corresponding first predicted diffusion image patch can be obtained.
[0080] The preset diffusion direction constraint network can be a multilayer perceptron (MLP). The computing device 600 inputs diffusion noise into the preset diffusion direction constraint network so that the preset diffusion direction constraint network predicts the liveness classification result of the original sample image based on the diffusion noise, and then outputs the predicted liveness classification result of the original sample image.
[0081] In some embodiments, the training objective of the diffusion model may include constraining the difference between the first predicted diffused image patch output by the diffusion model based on the original sample image patch and its corresponding ground truth label to be less than a first preset difference threshold. Here, the first predicted diffused image patch is an image patch consistent with the target liveness category, and the ground truth label includes image patches corresponding to the original sample image patch that are consistent with the target liveness category.
[0082] In some embodiments, the training objective of the diffusion model may further include constraining the difference between the predicted liveness classification result obtained based on the predicted diffusion image patch and the true liveness classification result to be less than a second preset difference threshold. Here, the first predicted diffusion image patch is an image patch consistent with the target liveness category, and the true label includes the image patch corresponding to the original sample image patch that is consistent with the target liveness category. As mentioned above, the true label of the original sample image patch can be the corresponding target sample image patch. For example, when the target liveness category is a liveness category, the first predicted diffusion image patch is also a liveness category, and its corresponding true label is also the liveness category corresponding to the original sample image patch. For example, when the target liveness category is an attack category, the first predicted diffusion image patch is also an attack category, and its corresponding true label is also the attack category corresponding to the original sample image patch. The predicted liveness classification result can be obtained based on the image difference between the original sample image patch and the predicted diffusion image.
[0083] After obtaining the first predicted diffused image patch and the predicted liveness classification result, the computing device 600 can determine the first comprehensive loss. In some embodiments, the first comprehensive loss may include a first diffusion loss. In some embodiments, the first comprehensive loss may also include a diffusion direction constraint loss. The computing device 600 can determine the first diffusion loss based on the difference between the first predicted diffused image patch and the target sample image patch. The computing device 600 can determine the diffusion direction constraint loss based on the difference between the predicted liveness classification result and the actual liveness classification result. The first comprehensive loss may be a weighted sum of the diffusion loss and the diffusion direction constraint loss. The computing device 600 can converge the preset diffusion network and the preset image patch selection network based on the first comprehensive loss to obtain the trained diffusion model and the image patch selection model.
[0084] The computing device 600 can achieve convergence of the preset diffusion network by constraining the first diffusion loss to be less than a first preset difference threshold and constraining the diffusion direction constraint loss to be less than a second preset difference threshold. When the preset diffusion network converges, a trained diffusion model can be obtained. The convergence condition can be that the first comprehensive loss is less than the first loss value, or the number of training iterations reaches a preset number of training iterations, or the accuracy of the preset diffusion network reaches a preset accuracy, etc.
[0085] Specifically, the diffusion loss constrains the first predicted diffusion image patch output by the preset diffusion network to be as consistent as possible with the target sample image patch, thereby ensuring that the preset diffusion network diffuses towards the target liveness category, thus improving the accuracy of the output diffusion result (first predicted diffusion image patch). The diffusion direction constraint loss constrains the accuracy of the classification result obtained based on the diffusion noise output by the diffusion model, thereby ensuring the classification accuracy of the predicted liveness classification result obtained based on the diffusion result.
[0086] After obtaining the trained image patch selection model and diffusion model, the computing device 600 can apply the image patch selection model to select at least one key image patch in the original image, and use the diffusion model to diffuse the at least one key image patch in the direction of the target live object category, thereby obtaining at least one diffused image patch corresponding to the at least one key image patch.
[0087] The trained diffusion model performs diffusion based on image patches, selecting a portion of the original image for diffusion each time. This utilizes fine-grained local information in the original image, improving the quality of the diffused image. However, for the entire original image, it requires repeatedly filtering key image patches before the diffusion process can be completed. This results in excessive computation and time consumption. To improve liveness detection efficiency, this specification also employs an image patch selection model to select at least one key image patch from the original image. The image patch selection model needs to be trained before being applied to select key image patches. The training of the image patch selection model can be achieved using the pre-trained diffusion model described above.
[0088] The training process of the image patch selection model will be described in detail below with reference to the accompanying diagram: Figure 5 This is a schematic diagram of the network structure during training of an image patch selection model according to an embodiment of this specification. Figure 5 As shown, the network structure for training the image patch selection model can include a preset image patch selection network, a trained diffusion model, and a preset iterative network.
[0089] The preset image patch selection network can be a transformer network. The computing device 600 inputs the original sample image into the preset image patch selection network so that the preset image patch selection network filters original sample image patches from the original sample image.
[0090] Then, the computing device 600 can input the original sample image patch into the trained diffusion model, so that the trained diffusion model diffuses in the direction of the target live class based on the original sample image patch, thereby obtaining the second predicted diffusion image patch corresponding to the original sample image patch.
[0091] The preset iterative network can be a ResNet network. The computing device 600 inputs the second predicted diffused image patch and the original sample image patch into the preset iterative network, so that the preset iterative network determines the predicted iteration probability of the original sample image based on the second predicted diffused image patch and the original sample image patch. This predicted iteration probability characterizes the likelihood that the computing device 600 will perform the next round of image patch selection and diffusion on the original sample image.
[0092] The true label (also called the iterative probability label) corresponding to the predicted iteration probability can be determined based on the ratio of the number of image blocks that are labeled sample image blocks in the currently selected original sample image blocks to the number of pre-labeled labeled sample image blocks. For example, the computing device 600 can perform a difference operation between the target sample image and its corresponding attack sample image to obtain a difference image, and divide the difference image into different image block regions, and use the image block regions with a difference greater than a preset difference as labeled sample image blocks.
[0093] The training objective of the image patch selection model may include constraining the difference between the predicted iteration probability of the original sample image patch and its corresponding iteration probability label to be less than a third preset difference threshold. The predicted iteration probability of the original sample image patch can be determined based on the original sample image patch and its corresponding second predicted diffusion image patch. The second predicted diffusion image patch is an image patch obtained by diffusion of the original sample image patch towards the target liveness category using a diffusion model. The iteration probability label is determined based on the ratio of the number of unlabeled sample image patches in the selected original sample image patch to the number of pre-labeled sample image patches.
[0094] In some embodiments, the training objective of the image patch selection model may further include constraining the difference between the second predicted diffused image patch and its corresponding ground truth label to be less than a fourth preset difference threshold. The ground truth label includes an image patch corresponding to the original sample image patch that matches the target liveness category. As mentioned above, the ground truth label of the original sample image patch can be the corresponding target sample image patch. For example, when the target liveness category is a liveness category, the second predicted diffused image patch is also a liveness category, and its corresponding ground truth label is also the liveness category corresponding to the original sample image patch. For example, when the target liveness category is an attack category, the second predicted diffused image patch is also an attack category, and its corresponding ground truth label is also the attack category corresponding to the original sample image patch.
[0095] After obtaining the second predicted diffused image patch and the predicted iteration probability, the computing device 600 can determine the second comprehensive loss. The second comprehensive loss may include an iterative classification loss determined based on the predicted iteration probability. In some embodiments, the second comprehensive loss may also include a second diffusion loss determined based on the difference between the second predicted diffused image patch and the target sample image patch. The second comprehensive loss may be a weighted sum of the second diffusion loss and the iterative classification loss. Then, the computing device 600 can converge the preset image patch selection network and the preset iterative network based on the second comprehensive loss, thereby obtaining the trained image patch selection model and iterative model. The computing device 600 achieves convergence of the preset image patch selection network and the preset iterative network by constraining the second diffusion loss to be less than a fourth preset difference threshold and constraining the iterative classification loss to be less than a third preset difference threshold. It should be noted that the trained diffusion model does not update its own parameters during the training of the preset image patch network and the preset iterative network; it only participates in the determination process of the second comprehensive loss. This ensures the stability of the diffusion model performance, guarantees the quality of the generated diffused image, and thus ensures the performance of liveness detection. Furthermore, while ensuring the quality of the diffused image, the efficiency of liveness detection can also be improved.
[0096] Convergence can be achieved when the second comprehensive loss is less than the second loss value, when the number of training iterations reaches a preset number, or when the accuracy of the preset image patch selection network reaches a preset accuracy, etc. When the preset image patch selection network converges, the trained image patch selection model can be obtained.
[0097] After obtaining the trained image patch selection model, the computing device 600 can input the original image into the image patch selection model and make the image patch selection model filter key image patches based on the original image to obtain at least one key image patch.
[0098] In some embodiments, for the original image, after obtaining at least one diffuse image block, the computing device 600 may also replace the corresponding key image block in the original image with the at least one diffuse image block to obtain a diffuse image.
[0099] Continue reading Figure 3 After step S140, step S160 may also be included.
[0100] S160: Determine the liveness detection result based on the original image and the diffused image.
[0101] When the computing device 600 performs diffusion based on the entire original image, it can directly determine the liveness detection result based on the image differences between the original image and the diffused image. Specifically, the computing device 600 can determine that if the image difference is greater than a preset difference threshold, the liveness detection result is a category inconsistent with the target liveness category; or it can determine that if the image difference is less than the preset difference threshold, the liveness detection result is a category consistent with the target liveness category.
[0102] For example, if the target liveness category is live, and the image difference between the original image and the diffused image is less than a preset difference threshold, it indicates that the type of the liveness classification result of the original image is consistent with the direction of the liveness category, and the computing device 600 can determine that the liveness detection result is a liveness category. If the target liveness category is live, and the difference between the original image and the diffused image is greater than a preset difference threshold, it indicates that the type of the liveness classification result of the original image is inconsistent with the direction of the liveness category, and the computing device 600 can determine that the liveness detection result is an attack category. As another example, if the target liveness category is an attack category, and the image difference between the original image and the diffused image is less than a preset difference threshold, it indicates that the type of the liveness classification result of the original image is consistent with the direction of the attack category, and the computing device 600 determines that the liveness detection result is an attack category. If the target liveness category is an attack category, and the difference between the original image and the diffused image is greater than a preset difference threshold, it indicates that the type of the liveness classification result of the original image is inconsistent with the direction of the attack category, and the computing device 600 can determine that the liveness detection result is a liveness category.
[0103] When the computing device 600 performs diffusion based on image patches, it can determine the liveness detection result based on at least one key image patch and at least one corresponding diffused image patch. Specifically, determining the liveness detection result based on at least one key image patch and at least one corresponding diffused image patch includes: determining the image difference between each key image patch and its corresponding diffused image patch, thereby determining at least one image difference corresponding to at least one key image; and determining the liveness detection result based on at least one image difference.
[0104] The image difference between each key image block and its corresponding diffuse image block can be determined as follows: the computing device 600 determines the image difference based on the difference image between each key image block and its corresponding diffuse image block. For example, the computing device 600 can calculate the difference between each key image block and its corresponding diffuse image block to obtain the difference image between each key image block and its corresponding diffuse image block, and use the difference image as the image difference.
[0105] Subsequently, the computing device 600 can determine the liveness detection result based on the image differences between each key image block and its corresponding diffuse image block. Specifically, the computing device 600 determines the comprehensive image difference corresponding to the original image by weighting the sum of at least one image difference between at least one key image block and its corresponding diffuse image block, and determines the liveness detection result based on the comprehensive image difference. Specifically, the computing device 600's determination of the liveness detection result based on the comprehensive image difference can include: determining that the comprehensive image difference is greater than a preset difference threshold, thus determining the liveness detection result as a category inconsistent with the target liveness category; or determining that the comprehensive image difference is less than the preset difference threshold, thus determining the liveness detection result as a category consistent with the target liveness category.
[0106] In some embodiments, when the computing device 600 determines that the target liveness category is a liveness category and the overall image difference is greater than a preset difference threshold, the liveness detection result is determined to be an attack category.
[0107] In some embodiments, when the computing device 600 determines that the target liveness category is a liveness category and the overall image difference is less than a preset difference threshold, the liveness detection result is determined to be a liveness category.
[0108] In some embodiments, when the computing device 600 determines that the target category is an attack category and the overall image difference is less than a preset difference threshold, the liveness detection result is determined to be an attack category.
[0109] In some embodiments, when the computing device 600 determines that the target category is an attack category and the overall image difference is greater than a preset difference threshold, it determines the liveness detection result as a liveness category.
[0110] This specification generates a diffused image by diffusing the original image towards the target liveness category. The liveness detection result is determined based on the difference between the generated diffused image and the original image. A large difference between the diffused image and the original image indicates that the liveness classification type of the original image is inconsistent with the target liveness category. A small difference between the diffused image and the original image indicates that the liveness classification type of the original image is consistent with the target liveness category. For example, if the diffused image represents the liveness category and the difference between the two is large, the original image represents the attack category. Similarly, if the diffused image represents the attack category and the difference between the two is small, the original image represents the liveness category.
[0111] It should be noted that the above embodiments describe the cases of greater than or less than in many places. For the case of equal to, the corresponding result can be identified as the result corresponding to the case of greater than or less than.
[0112] Continue reading Figure 3 After step S160, step S180 may also be included.
[0113] S180: Output liveness detection results.
[0114] There are several ways to output the liveness detection results. For example, the computing device 600 can directly return the liveness detection results to the terminal device, or it can return the liveness detection results to the verification device that needs to perform facial recognition or verification, so that the verification device can perform facial recognition based on the liveness detection results, or it can also visualize the liveness detection results.
[0115] There are several ways to visualize the liveness detection result. For example, the computing device 600 can display the liveness detection result on a display, or it can issue a prompt message about the liveness detection result through sound and light, etc.
[0116] Based on the above embodiments, to improve the interpretability of liveness detection, the method P100 may further include: when the computing device 600 determines that the liveness detection result is an attack category, it obtains an attribution result based on the difference between the original image and the diffused image. The attribution result characterizes the reason for the interception of the original image. The attribution result is obtained through an attribution model, which is trained based on the original sample image identified as an attack category.
[0117] The computing device 600 can determine the reason for the incorrectly blocked original image based on an attribution model. The attribution model can be trained on the original image incorrectly blocked as an attack. Each incorrectly blocked original image has a corresponding true category label, which represents the true reason for the incorrect blocking. The true reason for blocking can be obtained by manually labeling the original image incorrectly blocked as an attack. For example, when the true liveness classification result of the original image is live, but the liveness detection result is attack, the computing device 600 can obtain the true reason for blocking the original image, such as manually labeled reasons like poor lighting or large pose. Then, the computing device 600 can train a pre-defined classification network based on the incorrectly blocked original image, its corresponding diffusion image, and the true reason for blocking to obtain the attribution model.
[0118] The preset classification network can be a ResNet18 network. The computing device 600 inputs the original image patch that was mistakenly intercepted as an attack category and its corresponding diffuse image patch into the preset classification network. The preset classification network then classifies the interception reason based on the original image patch that was mistakenly intercepted as an attack category and its corresponding diffuse image patch, thereby outputting a predicted interception reason. The preset classification network is then converged based on the difference between the predicted interception reason and the true interception reason to obtain the attribution model. The convergence condition can be that the difference between the predicted interception reason and the true interception reason is less than a fifth preset difference threshold, or the number of training iterations reaches a preset number of training iterations, or the accuracy of the preset classification network reaches a preset accuracy, etc.
[0119] In summary, the liveness detection method P100 and system 001 provided in this specification diffuse the acquired original image with the target liveness category as the diffusion direction, obtaining a diffused image under the target liveness category. Based on the difference between the original image and the diffused image, liveness detection is performed on the original image to be detected, yielding the liveness detection result. This scheme generates a diffused image with a definite liveness classification result by constraining the diffusion direction to the target liveness category. The diffused image is then used as a reference image to perform liveness detection on the original image where the liveness detection result is unknown, thus obtaining the liveness detection result and improving liveness detection performance. Since there are numerous types of existing attack categories, current liveness detection technologies cannot cover all attack types. However, the liveness detection method P100 and system 001 provided in this specification can diffuse in the direction of the target liveness category (liveness category direction) regardless of the attack image type, thereby covering all types of attacks. Even if a new attack type emerges, the diffusion model can be retrained by collecting samples of the new attack type, making the method applicable to the new attack type. Therefore, the liveness detection method P100 and system 001 provided in this specification can significantly improve liveness detection performance and have high performance against all types of attacks.
[0120] This specification, in another aspect, provides a non-transitory storage medium storing at least one set of executable instructions for performing liveness detection. When the executable instructions are executed by a processor, they instruct the processor to implement the steps of the liveness detection method P100 described herein. In some possible embodiments, various aspects of this specification can also be implemented as a program product comprising program code. When the program product is run on a computing device 600, the program code causes the computing device 600 to perform the steps of the liveness detection method P100 described herein. The program product for implementing the above method may employ a portable compact disk read-only memory (CD-ROM) containing program code and may run on the computing device 600. However, the program product of this specification is not limited thereto. In this specification, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system. The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. The computer-readable storage medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can send, propagate, or transmit programs for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof. Program code for performing the operations described herein can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on computing device 600, partially on computing device 600, as a standalone software package, partially on computing device 600 and partially on a remote computing device, or entirely on a remote computing device.
[0121] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0122] In summary, after reading this detailed disclosure, those skilled in the art will understand that the foregoing detailed disclosure is presented by way of example only and is not restrictive. Although not explicitly stated herein, those skilled in the art will understand that this specification requires various reasonable changes, improvements, and modifications to the embodiments. These changes, improvements, and modifications are intended to be made by this specification and are within the spirit and scope of the exemplary embodiments described herein.
[0123] Furthermore, certain terms in this specification have been used to describe embodiments of this specification. For example, "an embodiment," "an embodiment," and / or "some embodiments" mean that a particular feature, structure, or characteristic described in connection with that embodiment may be included in at least one embodiment of this specification. Therefore, it is to be emphasized and understood that two or more references to "an embodiment" or "an embodiment" or "alternative embodiment" in various parts of this specification do not necessarily refer to the same embodiment. Moreover, specific features, structures, or characteristics may be suitably combined in one or more embodiments of this specification.
[0124] It should be understood that in the foregoing description of the embodiments in this specification, various features are combined in a single embodiment, drawing, or description for the purpose of simplifying the description and aiding in the understanding of a feature. However, this does not mean that the combination of these features is necessary, and those skilled in the art may readily identify some of the devices as separate embodiments when reading this specification. That is, the embodiments in this specification can also be understood as an integration of multiple secondary embodiments. It is also valid when each secondary embodiment contains fewer than all the features of a single foregoing disclosed embodiment.
[0125] Each patent, patent application, publication of the patent application, and other materials such as articles, books, specifications, publications, documents, articles, etc., cited herein may be incorporated by reference. All contents used for all purposes, except for any history of prosecution documents relating to it, that may be inconsistent with or conflict with this document, or any such history of prosecution documents that may have a limiting effect on the widest extent of the claims, are now or hereafter associated with this document. For example, in the event of any inconsistency or conflict between the description, definition, and / or use of terms associated with any of the included materials and the terms, description, definition, and / or used in connection with this document, the terms used herein shall prevail.
[0126] Finally, it should be understood that the embodiments disclosed herein are illustrative of the principles of the embodiments described in this specification. Other modified embodiments are also within the scope of this specification. Therefore, the embodiments disclosed in this specification are merely examples and not limitations. Those skilled in the art can implement the applications described in this specification using alternative configurations based on the embodiments in this specification. Therefore, the embodiments in this specification are not limited to the embodiments precisely described in the applications.
Claims
1. A method for detecting liveness, comprising: Obtain the original image; At least one key image patch is determined from the original image through at least one iteration; The at least one key image patch is diffused in the direction of the target live organism category to obtain at least one diffused image patch corresponding to the at least one key image patch; Based on the image differences between the at least one key image patch and the at least one diffuse image patch, the consistency between the liveness classification result of the original image and the target liveness category is determined; as well as Based on the consistency determination result, a liveness detection result representing the liveness classification result of the original image is determined; Wherein, in each of the at least one iteration: Based on a preset image patch selection rule, the key image patch corresponding to the current iteration is selected from multiple image patches of the original image. Based on the difference between the selected key image patches and their corresponding diffuse image patches in the original image, and / or the proportion of the selected key image patches among all key image patches, an iteration probability of the original image is determined. This iteration probability characterizes the probability of performing a new round of key image patch selection on the original image. If the iteration probability is determined to be greater than a preset iteration probability threshold, proceed to the next iteration; or if the iteration probability is determined to be less than the preset iteration probability threshold, end the iteration, and use the selected key image block as the at least one key image block.
2. The method according to claim 1, wherein, The target liveness category includes either the liveness category or the attack category.
3. The method according to claim 1, wherein, The key image block includes the original image, and the diffused image block includes a diffused image, which is obtained by diffusing the original image toward the target living class.
4. The method according to claim 1, wherein, The preset image block selection rules include random selection rules or adaptive selection rules.
5. The method according to claim 1, wherein, The step of diffusing each key image block in the at least one key image block toward the direction of the target live organism category to obtain at least one diffused image block corresponding to the at least one key image block includes: Based on the diffusion model, each key image patch is diffused in the direction of the target liveness category to obtain at least one diffused image patch; The training objective of the diffusion model includes constraining the difference between the first predicted diffusion image patch output by the diffusion model based on the original sample image patch and its corresponding true label to be less than a first preset difference threshold, wherein the first predicted diffusion image patch is an image patch consistent with the target liveness category, and the true label includes an image patch consistent with the target liveness category corresponding to the original sample image patch.
6. The method according to claim 5, wherein, The training objectives of the diffusion model also include: The constraint is that the difference between the predicted liveness classification result obtained based on the first predicted diffused image block and the actual liveness classification result is less than a second preset difference threshold.
7. The method according to claim 6, wherein, The predicted liveness classification result is obtained based on the image difference between the original sample image block and the first predicted diffusion image block.
8. The method according to claim 1, wherein, The step of determining at least one key image patch from the original image through at least one iteration further includes: The process of determining at least one key image patch from the original image through at least one iteration is performed based on an image patch selection model. The training objective of the image patch selection model includes constraining the difference between the predicted iteration probability of the original sample image patch and its corresponding iteration probability label to be less than a third preset difference threshold. The predicted iteration probability of the original sample image patch is determined based on the original sample image patch and its corresponding second predicted diffusion image patch. The second predicted diffusion image patch is an image patch obtained by diffusing the original sample image patch towards the target liveness category based on the diffusion model. The iteration probability label is determined based on the ratio of the number of unlabeled sample image patches in the selected original sample image patch to the number of pre-labeled labeled sample image patches.
9. The method according to claim 8, wherein, The training objective of the image patch selection model also includes constraining the difference between the second predicted diffused image patch and its corresponding real label to be less than a fourth preset difference threshold, wherein the real label includes an image patch that corresponds to the original sample image patch and is consistent with the target liveness category.
10. The method according to claim 1, wherein, The step of determining the consistency between the liveness classification result of the original image and the target liveness category based on the image differences between the at least one key image patch and the at least one diffuse image patch, further includes: The image differences are determined based on the difference image between each key image patch and its corresponding diffuse image patch.
11. The method according to claim 1, wherein, The step of determining the consistency between the liveness classification result of the original image and the target liveness category based on the image differences between the at least one key image patch and the at least one diffuse image patch includes: If the image difference exceeds a preset difference threshold, the liveness classification result of the original image is inconsistent with the target liveness category; or If the image difference is less than the preset difference threshold, the liveness classification result of the original image is consistent with the target liveness category.
12. The method according to claim 1, wherein, The method further includes: If the liveness detection result indicates that the liveness classification result of the original image is an attack category, an attribution result is obtained based on the image difference between the at least one key image patch and the at least one diffuse image patch. The attribution result indicates the reason why the original image is determined to be an attack category.
13. The method according to claim 12, wherein, The attribution results are obtained through an attribution model, which is trained based on the original sample images identified as attack categories.
14. A liveness detection system, comprising: At least one storage medium storing at least one instruction set for performing liveness detection; as well as At least one processor is communicatively connected to the at least one storage medium. When the liveness detection system is running, the at least one processor reads the at least one instruction set and executes the method according to any one of claims 1-13 according to the instructions of the at least one instruction set.