Liveness detection method and system
By employing feature extraction and compression techniques, the problems of storage space and accuracy in liveness detection have been solved, enabling efficient liveness detection with limited storage.
Patent Information
- Application Number
- CN202211686213.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2042-12-27
AI Technical Summary
Existing liveness detection methods require a large number of labeled samples when training models, and the attack sample library occupies a large amount of storage space, resulting in low detection accuracy, which is difficult to improve, especially under limited storage space.
By extracting and compressing features, the target compressed features of the target user are obtained and retrieved from the sample compressed feature library of the attack sample, reducing storage requirements and improving detection accuracy.
No need to label live samples, reducing the size of the feature library, improving the accuracy of liveness detection and enhancing the performance of attack retrieval.
Smart Images

Figure CN116110132B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of image recognition, and in particular to a liveness detection method and system. Background Technology
[0002] Existing liveness detection methods often involve either directly training a liveness detection model for detection or constructing an attack sample library for attack retrieval.
[0003] In the process of researching and practicing existing technologies, the inventors of this application found that training a liveness detection model often requires labeling a large number of liveness samples and attack samples. Moreover, when adapting to new scenarios, the rate of disturbance to normal users is relatively high. Furthermore, when performing attack retrieval through an attack sample library, additional storage space is required to store the attack sample library. If the attack sample library is too large, the storage space occupied will also be very large. In addition, the larger the attack sample library, the higher the accuracy of liveness detection. Therefore, within the limited storage space, the size of the attack sample library is severely constrained, which in turn leads to a low accuracy of liveness detection. Summary of the Invention
[0004] This manual provides a more accurate method and system for liveness detection.
[0005] In a first aspect, this specification provides a liveness detection method, comprising: acquiring a target biological image of a target user, and extracting features from the target biological image to obtain the original features of the target user; compressing the original features to obtain the target compressed features of the target user, wherein the target compressed features and the original features are locally correlated; and performing an attack retrieval in a sample compressed feature library corresponding to an attack sample based on the target compressed features to obtain a liveness detection result of the target user, and outputting the liveness detection result.
[0006] In some embodiments, the target bio-image includes at least one of a facial image, a body image, an iris image, a fingerprint image, or a palm print image.
[0007] In some embodiments, the step of extracting features from the target biological image to obtain the original features of the target user includes: obtaining a target liveness classification model corresponding to the target biological image; and extracting local features from the target biological image based on the target liveness classification model to obtain multiple local feature maps, and using the multiple local feature maps as the original features.
[0008] In some embodiments, obtaining the target liveness classification model corresponding to the target biological image includes: obtaining the liveness classification model set corresponding to the sample compressed feature library; and determining the target detection scene corresponding to the target user, and selecting the liveness classification model corresponding to the target detection scene from the liveness classification model set to obtain the target liveness classification model.
[0009] In some embodiments, the training process of the target liveness classification model includes the following steps: acquiring open-source training data, and training a preset liveness classification model based on the open-source training data to obtain a trained original liveness classification model; and acquiring target training data corresponding to the target detection scenario, and updating the original liveness classification model based on the target training data to obtain the target liveness classification model.
[0010] In some embodiments, the preset liveness classification model includes a local feature extraction network, a local feature comparison network, and a liveness classification network; and the step of training the preset liveness classification model based on the open-source training data to obtain the trained original liveness classification model includes: using the local feature extraction network to extract local features from open-source image samples in the open-source training data to obtain multiple sample local feature maps; using the local feature comparison network to compare the multiple sample feature maps to obtain the local comparison relationship features of the open-source image samples; inputting the multiple sample local feature maps and the local comparison relationship features into the liveness classification network to obtain the predicted liveness category of the open-source image samples; and converging the preset liveness classification model based on the predicted liveness category and the local comparison relationship features to obtain the original liveness classification model.
[0011] In some embodiments, the step of converging the preset liveness classification model to obtain the original liveness classification model includes: obtaining the labeled liveness categories of the open-source image samples, and comparing the predicted liveness categories with the labeled liveness categories to obtain classification loss information; based on the labeled liveness categories, comparing the local alignment relationship features between the open-source image samples in the open-source training data to obtain local alignment loss information; and fusing the classification loss information and the local alignment loss information to obtain target loss information, and converging the preset liveness classification model based on the target loss information to obtain the original liveness classification model.
[0012] In some embodiments, the step of comparing local alignment relationship features between open-source image samples in the open-source training data based on the labeled liveness category to obtain local alignment loss information includes: comparing local alignment relationship features between open-source image samples of the same labeled liveness category in the open-source training data to obtain first feature alignment information; comparing local alignment relationship features between open-source image samples of different labeled liveness categories in the open-source training data to obtain second feature alignment information; and determining the local alignment loss information based on the first feature alignment information and the second feature alignment information, wherein the constraint condition of the local alignment loss information is that the difference between the local alignment relationship features corresponding to the same labeled liveness category is less than a first preset difference threshold and the difference between the local alignment relationship features corresponding to different labeled liveness categories is greater than a second preset difference threshold.
[0013] In some embodiments, updating the original liveness classification model based on the target training data to obtain the target liveness classification model includes: training the local feature matching network and the liveness classification network in the original liveness classification model based on the target training data to obtain the target liveness classification model.
[0014] In some embodiments, the step of compressing the original features to obtain the target compressed features of the target user includes: obtaining the target feature compression model corresponding to the sample compressed feature library; and using the target feature compression model to compress the original features to obtain the target compressed features of the target user.
[0015] In some embodiments, the training process of the target feature compression model includes the following steps: acquiring original sample features, and compressing the original sample features using a preset feature compression model to obtain compressed sample features, wherein the original sample features include M local features of the sample in a first dimension, where M is an integer greater than or equal to 1, and the compressed sample features include the M local compressed features in a second dimension, where the second dimension is less than the first dimension; reconstructing the sample compressed features, and backtracking the local compressed features based on the reconstructed original features to obtain the target sample local features corresponding to the local compressed features; and converging the preset feature compression model based on the original sample features, the reconstructed original features, and the target sample local features to obtain the target feature compression model.
[0016] In some embodiments, the reconstructed original features include the M reconstructed local features of the first dimension; and the feature backtracking of the local compressed features to obtain the target sample local features corresponding to the local compressed features includes: backtracking the reconstructed local features corresponding to each local compressed feature in the reconstructed original features to obtain the target reconstructed local features, and determining the sample local features corresponding to the local compressed features in the sample original features based on the target reconstructed local features to obtain the target sample local features.
[0017] In some embodiments, the convergence of the preset feature compression model to obtain the target feature compression model includes: comparing the reconstructed original features and the original features of the sample to obtain global reconstruction loss information; comparing the local features of each target sample with the corresponding reconstructed local features to obtain local reconstruction loss information; and fusing the global reconstruction loss information and the local reconstruction loss information to obtain backtracking loss information, and converging the preset feature compression model based on the backtracking loss information to obtain the target feature compression model.
[0018] In some embodiments, the compressed features in the sample compressed feature library are compressed in the same way as the target compressed features.
[0019] In some embodiments, the step of performing attack retrieval in the sample compressed feature library corresponding to the attack sample to obtain the liveness detection result of the target user includes: obtaining the sample compressed feature library corresponding to the attack sample; determining the feature similarity between each compressed feature in the sample compressed feature library and the target compressed feature, and sorting the feature similarities to obtain the target feature similarity; and determining the liveness detection result of the target user as the attack user when the target feature similarity is greater than a preset similarity threshold.
[0020] In some embodiments, after sorting the feature similarities to obtain the target feature similarity, the method further includes: when the target feature similarity is less than the preset similarity threshold, determining that the liveness detection result of the target user is a live user.
[0021] In some embodiments, obtaining the sample compressed feature library corresponding to the attack sample includes: obtaining a set of attack images corresponding to the attack sample, and using a target liveness classification model to extract features from the attack images in the attack image set to obtain multiple local attack feature maps of the attack images; and using a target feature compression model to compress the multiple local attack feature maps to obtain the sample compressed feature library.
[0022] In some embodiments, obtaining the attack image set corresponding to the attack sample includes: obtaining a full set of biological images, and selecting multiple biological images from the full set of biological images to obtain an original biological image set; sending the original biological image set to an annotation server for live organism category annotation, and receiving a first annotation result corresponding to the original biological image set returned by the annotation server; and based on the first annotation result, selecting at least one attack image from the original biological image set to obtain the attack image set corresponding to the attack sample.
[0023] In some embodiments, obtaining the attack image set corresponding to the attack sample includes: obtaining an initial biological image set, and using the target liveness classification model to perform liveness classification on each biological image in the initial biological image set to obtain the attack probability of each biological image; and selecting at least one biological image in the initial biological image set whose attack probability is greater than a preset attack probability threshold to obtain the attack image set corresponding to the attack sample.
[0024] In some embodiments, after obtaining the set of attack images corresponding to the attack sample, the method further includes: periodically updating the set of attack images based on a preset time interval to obtain an updated set of attack images; and using the updated set of attack images as the set of attack images corresponding to the attack sample.
[0025] In some embodiments, periodically updating the attack image set to obtain an updated attack image set includes: performing liveness labeling on each attack image in the attack image set based on a preset time interval to obtain a second labeling result; based on the second labeling result, removing attack images corresponding to live samples from the attack image set to obtain a candidate attack image set; obtaining the sampling time of each attack image in the candidate attack image set, and removing attack images from the candidate attack image set whose sampling time exceeds a preset time threshold to obtain an updated attack image set.
[0026] In some embodiments, determining the feature similarity between each compressed feature in the sample compressed feature library and the target compressed feature includes: matching the current local compressed feature of each compressed feature with the target local compressed feature of the target compressed feature; determining the initial feature similarity between the current local compressed feature and the corresponding target local compressed feature based on the matching result; and fusing the initial feature similarity to obtain the feature similarity between each compressed feature and the target compressed feature.
[0027] 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 liveness detection method described in the first aspect of this specification according to the instructions of the at least one instruction set.
[0028] As can be seen from the above technical solutions, the liveness detection method and system provided in this specification acquire the target biological image of the target user, extract features from the target biological image to obtain the original features of the target user, compress the original features to obtain the target compressed features of the target user, there is a local correspondence between the target compressed features and the original features, and attack retrieval is performed in the sample compressed feature library corresponding to the attack sample based on the target compressed features to obtain the liveness detection result of the target user and output the liveness detection result. Since this solution can use the sample compressed feature library for attack retrieval, there is no need to label live samples. In addition, the feature library is constructed using compressed features, which greatly reduces the size of the feature library. More compressed features of attack samples can be stored in the effective storage space. Moreover, the use of locally traceable compression in the feature compression process of the original features increases the interpretability of the compressed features (target compressed features and compressed features in the sample compressed feature library) and improves the retrieval performance of attack retrieval. Therefore, the accuracy of liveness detection can be improved.
[0029] 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
[0030] 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.
[0031] Figure 1 A schematic diagram illustrating an application scenario of a liveness detection system provided according to an embodiment of this specification is shown.
[0032] Figure 2 A hardware structure diagram of a computing device provided according to an embodiment of this specification is shown;
[0033] Figure 3 A flowchart of a liveness detection method according to an embodiment of this specification is shown;
[0034] Figure 4 A schematic diagram of the overall process of liveness detection in a face recognition scenario provided by an embodiment of this specification is shown.
[0035] Figure 5 A schematic diagram of a process for constructing a sample compressed feature library according to an embodiment of this specification is shown; and
[0036] Figure 6 A schematic diagram of a liveness attack retrieval process in a face recognition scenario is shown according to an embodiment of this specification. Detailed Implementation
[0037] 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.
[0038] 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.
[0039] 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.
[0040] 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.
[0041] For ease of description, the terms that will appear in the following descriptions will be explained as follows:
[0042] Feature compression: A technique for compressing the size (dimension) of features. Compressed features occupy a smaller size without affecting the performance of related retrieval (or with minimal impact). For example, a feature vector with a long dimension can be compressed into a shorter feature vector, such as compressing a feature from 512 dimensions to 64 dimensions, and so on.
[0043] Attack retrieval: This refers to using compressed features to search and match in an attack feature database. When a match is found, the user can be identified as an attacker.
[0044] Locally traceable: This means that there is a local correspondence between the features before and after compression, thus providing stronger interpretability and retrieval performance.
[0045] Liveness attack: A presentation attack method targeting facial recognition systems or other biometric systems, which may include mobile phone screens, printed photos, high-precision masks, etc.
[0046] Liveness detection and protection: refers to algorithms and technologies used in facial recognition or other biometric systems to prevent attacks such as mobile phone screen recording attacks, paper photo attacks, and mask attacks.
[0047] Before describing the specific embodiments in this specification, the application scenarios of this specification will be introduced as follows:
[0048] The liveness detection method provided in this manual can be applied to any liveness detection scenario. For example, in a face payment scenario, the liveness detection method in this manual can be used to perform liveness detection on the collected face image of the user to be paid; in an identity verification scenario, the liveness detection method in this manual can be used to perform liveness detection on the collected identity image of the user; it can also be applied to any face recognition scenario, which will not be elaborated here.
[0049] 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.
[0050] Figure 1This 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 user 100, client 200, server 300, and network 400.
[0051] User 100 can be the user who triggers the liveness detection of the target biological image. User 100 can perform the liveness detection operation on client 200.
[0052] Client 200 can be a device for identifying target biological images in response to a liveness detection operation by user 100. In some embodiments, the liveness detection method can be executed on client 200. In this case, client 200 may store data or instructions for executing the liveness detection method described herein, and may execute or be used to execute said data or instructions. In some embodiments, client 200 may include hardware devices with data processing capabilities and the necessary programs required to drive the hardware devices. Figure 1As shown, client 200 can communicate with server 300. In some embodiments, server 300 can communicate with multiple clients 200. In some embodiments, client 200 can interact with server 300 through network 400 to receive or send messages, such as receiving or sending target biological images or raw features. The types of raw features can be various, for example, they can include two-dimensional features and / or three-dimensional features. In some embodiments, client 200 can include mobile devices, tablets, laptops, built-in devices in motor vehicles, or similar content, or any combination thereof. In some embodiments, the mobile device can 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 can include smart TVs, desktop computers, etc., or any combination thereof. In some embodiments, the smart mobile device can 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 controllers, augmented reality headsets, augmented reality glasses, augmented reality controllers, or similar content, or any combination thereof. For example, the virtual reality device or the augmented reality device may include Google Glass, head-mounted displays, VR, etc. In some embodiments, the built-in device in the motor vehicle may include an onboard computer, an onboard television, etc. In some embodiments, the client 200 may include an image acquisition device for acquiring biological images of the target user, thereby obtaining a target biological image. 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 client 200 may be a device with positioning technology for locating the position of the client 200.
[0053] In some embodiments, the client 200 may have one or more applications (APPs) installed. The APPs provide the target user 110 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 clients, social media platform software, etc. In some embodiments, the client 200 may have a target APP installed. The target APP can collect biological images of the target user for the client 200, thereby obtaining a target biological image. In some embodiments, the target object 100 can also trigger a liveness detection request through the target APP. The target APP can respond to the liveness detection request and execute the liveness detection method described in this specification. The liveness detection method will be described in detail later.
[0054] Server 300 may be a server providing various services, such as a backend server supporting the acquisition and / or detection of target biological images on client 200. In some embodiments, the liveness detection method may be executed on server 300. In this case, server 300 may store data or instructions for executing the liveness detection method described herein, and may execute or be used to execute said data or instructions. In some embodiments, server 300 may include hardware devices with data processing capabilities and the necessary programs required to drive the hardware devices. Server 300 may communicate with multiple clients 200 and receive data sent by clients 200.
[0055] Network 400 serves as a medium to provide a communication connection between client 200 and server 300. Network 400 facilitates the exchange of information or data. For example... Figure 1 As shown, client 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 networks, wired networks, fiber optic networks, telecommunications networks, intranets, the Internet, local area networks (LANs), wide area networks (WANs), wireless local area networks (WLANs), metropolitan area networks (MANs), public switched telephone networks (PSTNs), and Bluetooth. TM Network, 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 client 200 and server 300 can connect to network 400 to exchange data or information.
[0056] It should be understood that Figure 1 The number of clients 200, servers 300, and networks 400 shown is merely illustrative. Depending on implementation needs, there can be any number of clients 200, servers 300, and networks 400.
[0057] It should be noted that the liveness detection method can be executed entirely on the client 200, entirely on the server 300, or partially on the client 200 and partially on the server 300.
[0058] 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 client 200, the computing device 600 can be the client 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 client 200 and partly on the server 300, the computing device 600 can be both the client 200 and the server 300.
[0059] 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.
[0060] The internal communication bus 610 can connect different system components, including storage medium 630, processor 620 and communication port 650.
[0061] I / O component 660 supports input / output between computing device 600 and other components.
[0062] 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.
[0063] 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.
[0064] 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).
[0065] Figure 3A flowchart of a liveness detection method P100 according to an embodiment of this specification is shown. As previously described, computing device 600 can execute the liveness detection method P100 of this specification. Specifically, processor 620 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:
[0066] S110: Obtain the target biological image of the target user and extract features from the target biological image to obtain the original features of the target user.
[0067] The target biometric image may include at least one of a facial image, a body image, an iris image, a fingerprint image, or a palm print image. The body image may be an image of all or part of the target user's area excluding the face; for example, it may include a full-body image, a half-body image, or a back image, etc.
[0068] The original features can be large-size or multi-dimensional image features or pixel feature maps extracted from the target biological image, etc. The original features can also include local feature maps corresponding to multiple local regions in the target biological image. These local regions can be regions of a preset size, or randomly divided image regions, etc.
[0069] There are several ways to acquire the target biological image of the target user and extract features from the target biological image, as follows:
[0070] S111: Obtain the target biological image of the target user.
[0071] For example, the processor 620 can directly acquire the target biological image of the target user uploaded by the user 100 through the client 200 or the terminal, or it can acquire the target biological image of the target user through an image acquisition device (such as various types of cameras or other devices that can acquire images), or it can acquire the target biological image of the target user through a network or image database, or when there are many target users or a large number of target biological images, it can also receive a liveness detection request sent by the client 200 or the terminal, which may carry the storage address of the target biological image of the target user, and acquire the target biological image of the target user based on the storage address, and so on.
[0072] S112: Extract features from the target biological image to obtain the original features of the target user.
[0073] For example, the processor 620 can acquire the target live organism classification model corresponding to the target biological image, and extract local features from the target biological image based on the target live organism classification model to obtain multiple local feature maps, and use the multiple local feature maps as the original features.
[0074] There are several ways to obtain the target liveness classification model corresponding to the target biological image. For example, the processor 620 can obtain the set of liveness classification models corresponding to the sample compressed feature library, determine the target detection scene corresponding to the target user, and select the liveness classification model corresponding to the target detection scene from the set of liveness classification models to obtain the target liveness classification model.
[0075] The sample compressed feature library can be a feature library that stores compressed features of attack samples. This sample compressed feature library is used for attack retrieval. At least one liveness classification model that performs feature extraction and liveness classification on the attack samples in the sample compressed feature library constitutes the liveness classification model set corresponding to the sample compressed feature library. The liveness classification model set can include liveness detection models corresponding to multiple detection scenarios.
[0076] The target detection scenario can be the detection scenario where the target user is currently located. This scenario can be a liveness detection or facial recognition scenario, such as facial payment, access control unlocking, or user verification. There are several ways to determine the target detection scenario corresponding to the target user. For example, when the processor 620 receives a liveness detection request, it can identify the target detection scenario corresponding to the target user within the liveness detection request. Alternatively, it can obtain the target user's current location and determine the target detection scenario based on that location. Or, it can obtain the device identifier or device location of the terminal or client sending the target biometric image and determine the target detection scenario corresponding to the target user based on that identifier or location, and so on.
[0077] After determining the target detection scene corresponding to the target user, the processor 620 can select the liveness classification model corresponding to the target detection scene from the liveness classification model set, thereby obtaining the target liveness classification model.
[0078] After acquiring the target liveness classification model, the processor 620 can extract local features from the target biological image based on the target liveness classification model, thereby obtaining multiple local feature maps. There are several ways to extract local features from the target biological image based on the target liveness classification model. For example, the processor 620 can input the target biological image into the target liveness classification model, which divides the target biological image into multiple image regions. Features are then extracted from each image region to obtain a local feature map corresponding to each image region. For instance, for an input 256*256 image, the output features are 8*8 local feature maps, with each pixel in the local feature map corresponding to a 32*32 image region. Alternatively, the target biological image can be directly divided into a preset number of local image blocks, and the target liveness classification model can be used to extract features from each local image block to obtain a local feature map corresponding to each local image block.
[0079] After the processor 620 extracts local features from the target biological image using the target liveness classification model, it can use the extracted multiple local feature maps as the original features.
[0080] The training process of the target liveness classification model may include the following steps: the processor 620 can acquire open-source training data and train the preset liveness classification model based on the open-source training data to obtain the trained original liveness classification model, and acquire target training data corresponding to the target detection scenario and update the original liveness classification model based on the target training data to obtain the target liveness classification model.
[0081] The open-source training data can be training data obtained from open sources, and this open-source training data can include at least one open-source image sample. The preset liveness classification model can include a local feature extraction network, a local feature comparison network, and a liveness classification network. The local feature extraction network can be a network that extracts local features from the open-source image sample, the local feature comparison network can be a network that compares the extracted local features, and the liveness classification network can be a network that classifies the open-source image sample for liveness. There are various ways to train the preset liveness classification model based on the open-source training data. For example, the processor 620 can use the local feature extraction network to extract local features from the open-source image sample in the open-source training data to obtain multiple sample local feature maps, use the local feature comparison network to compare the multiple sample feature maps to obtain the local comparison relationship features of the open-source image sample, input the multiple local feature maps and the local comparison relationship features into the liveness classification network to obtain the predicted liveness category of the open-source image sample, and converge the preset liveness classification model based on the predicted liveness classification and the local comparison relationship features to obtain the original liveness classification model.
[0082] The local alignment relationship feature can be a relation matrix representing the relationship between local features. Each element of this relation matrix can be the inner product between two pixels in the local feature map of the sample. For example, if the local feature map of the sample is 8*8, then the relation matrix can be 64*64.
[0083] The predicted liveness category can be the classification result of a liveness classification network based on local feature maps and local alignment features of multiple samples. The predicted liveness category can include either a liveness category or an attack category.
[0084] After obtaining the local alignment features and predicted liveness categories of the open-source image samples, the processor 620 can converge the preset liveness classification model based on these features. There are several convergence methods. For example, the processor 620 can obtain the labeled liveness categories of the open-source image samples and compare the predicted liveness categories with the labeled liveness categories to obtain classification loss information. Based on the labeled liveness categories, it can compare the local alignment features between the open-source image samples in the open-source training data to obtain local alignment loss information. Finally, it can fuse the classification loss information and the local alignment loss information to obtain target loss information, and then converge the preset liveness classification model based on the target loss information to obtain the original liveness classification model.
[0085] The classification loss information can be the loss information generated when performing liveness classification on open-source image samples. There are various ways to compare the predicted liveness category with the labeled liveness category. For example, the processor 620 can use the cross-entropy loss function to compare the predicted liveness category with the labeled liveness category to obtain the classification loss information. Alternatively, other types of loss functions can be used to compare the predicted liveness category with the labeled liveness category to obtain the classification loss information, and so on.
[0086] The local alignment loss information can be the loss information generated by the difference between the local alignment relationship features of different open-source image samples in the open-source training data. The constraints on the local alignment loss information are: the difference between local alignment relationship features corresponding to the same labeled liveness category is less than a first preset difference threshold, and the difference between local alignment relationship features corresponding to different labeled liveness categories is greater than a preset difference threshold. Taking the local alignment relationship feature as a relation matrix as an example, during training, the local alignment loss information mainly constrains the relation matrix between live samples and attack samples to be as different as possible, while the relation matrix of samples of the same type is as consistent as possible. Based on the labeled liveness category, there are multiple ways to compare the local alignment relationship features between open-source image samples in the open-source training data. For example, the processor 620 can compare the local alignment relationship features between open-source image samples with the same labeled liveness category in the open-source training data to obtain the first feature alignment information, compare the local alignment relationship features between open-source image samples with different labeled liveness categories in the open-source training data to obtain the second feature alignment information, and determine the local alignment loss information based on the first and second feature alignment information.
[0087] There are multiple ways to compare the local alignment features between open-source image samples labeled with the same liveness category in the open-source training data. For example, the processor 620 can compare the local alignment features of open-source image samples labeled with the liveness category in the open-source training data, and it can also compare the local alignment features of open-source image samples labeled with the attack category in the open-source training data, thereby obtaining the first feature alignment information.
[0088] There are several ways to compare the local alignment features between open-source image samples labeled with different liveness categories in the open-source training data. For example, the processor 620 can compare the local alignment features of open-source image samples labeled with liveness categories with the local alignment features of open-source image samples labeled with attack categories in the open-source training data to obtain the second feature alignment information.
[0089] After obtaining the first feature comparison information and the second feature comparison information, the processor 620 can determine the local comparison loss information based on the first feature comparison information and the second feature comparison information. There are several ways to determine the local comparison loss information. For example, the processor 620 can obtain the difference between the comparison difference in the first feature comparison information and a preset first difference threshold to obtain a first difference value, obtain the difference between the comparison difference in the second feature comparison information and a preset second difference threshold to obtain a second difference value, and determine the local comparison loss information based on the first difference value and the second difference value. Alternatively, a preset loss function can be used to determine the local comparison loss information based on the first feature comparison information and the second feature comparison information, and so on.
[0090] After determining the local alignment loss information, the processor 620 can fuse the classification loss information and the local alignment loss information. There are several ways to fuse them. For example, the processor 620 can directly add the classification loss information and the local alignment loss information to obtain the target loss information, as shown in formula (1).
[0091] Loss total1 =Loss cls +Loss relation (1)
[0092] Among them, Loss total1 Loss information for the target cls To classify loss information, Loss relation This is for local comparison loss information.
[0093] In some embodiments, the method of fusing classification loss information and local comparison loss information may further include: the processor 620 obtaining loss weights, weighting the classification loss information and local comparison loss information based on the loss weights respectively, and adding the weighted classification loss information and the weighted local comparison loss information together to obtain target loss information, etc.
[0094] After fusing the classification loss information and the local alignment loss information, the processor 620 can converge the preset liveness classification model based on the fused target loss information. There are several convergence methods. For example, the processor 620 can use a gradient descent algorithm to update the network parameters of each network in the preset liveness classification model based on the target loss information, update the preset liveness classification model to the updated version, and then return to execute the step of training the preset liveness classification model based on the open-source training data until the preset liveness classification model converges, thus obtaining the original liveness classification model. Alternatively, other network parameter update algorithms can be used to update the network parameters of each network in the preset liveness classification model based on the target loss information, update the preset liveness classification model to the updated version, and then return to execute the step of training the preset liveness classification model based on the open-source training data until the preset liveness classification model converges, thus obtaining the original liveness classification model, and so on.
[0095] After training an initial liveness classification model based on open-source training data, the processor 620 can update the initial liveness classification model for object detection scenarios, thereby obtaining a target liveness detection model adapted to the object detection scenario. There are several ways to update the initial liveness classification model. For example, the processor 620 can acquire target training data corresponding to the object detection scenario and train the local feature comparison network and liveness classification network in the initial liveness classification model based on the target training data to obtain the target liveness classification model.
[0096] The target training data consists of training data collected in target detection scenarios, and the number of samples in the target training data is smaller than that in the open-source training data. The method for training the local feature comparison network and the liveness classification network in the original liveness classification model based on the target training data is the same as the training method for the original liveness classification model. However, there is one difference: during the update of the original liveness classification model, the local feature extraction network remains unchanged, and only the layout feature comparison network and the liveness classification network are trained, thus obtaining the target liveness classification model.
[0097] In training the target liveness classification model, compared to training traditional feature extraction models, using open-source training data to train the original liveness classification model and then iteratively optimizing it in small-scale scenarios reduces the amount of data labeling and lowers labeling costs while ensuring feature separability. Furthermore, unlike traditional feature extraction models that often extract overall features while neglecting local features, the target liveness detection model extracts local features and then uses region comparison to constrain the feature relationships between these local features, thereby improving the accuracy of the extracted original features.
[0098] S120: Perform feature compression on the original features to obtain the target compressed features for the target user.
[0099] The target compressed feature can be the compressed feature obtained by compressing the original feature. There is a local correspondence between the target compressed feature and the original feature. For example, if the original feature includes M local features (M parts), and the compressed feature includes M compressed local features (M parts), then the Kth local feature can correspond to the Kth compressed local feature, where K is any integer in [1, M]. Therefore, the target compressed feature possesses local traceability (traceability), thereby increasing its interpretability. In traditional feature compression, the correspondence between local features or feature elements within local features before and after compression is unclear. During feature retrieval, feature matching is poor because there are complex relationships between feature elements and other feature elements within local features. After compression, the strength of these relationships varies, leading to poor correspondence between feature elements. In subsequent feature matching during attack retrieval, the matching of feature elements will exhibit shifts and fluctuations, increasing randomness in the matching process. Compared to traditional feature compression, this scheme offers several advantages. The interpretability of the compressed target features and their local traceability allow for near-identical correspondence between feature elements before and after compression. This traceability enhances the constraint on feature elements during matching with compressed features in the sample compressed feature library, ensuring that the Kth feature element in the target compressed feature matches the Kth feature element in the sample compressed feature library. This significantly improves the efficiency and accuracy of feature retrieval, thereby enhancing attack detection performance and ultimately improving the accuracy of liveness detection.
[0100] There are several ways to compress the original features, including the following:
[0101] For example, the processor 620 can obtain the target feature compression model corresponding to the sample compressed feature library, and use the target feature compression model to compress the original features, thereby obtaining the target compressed features of the target user.
[0102] The target feature compression model can be a feature compression model that generates compressed features from a sample compressed feature library, or it can be understood as a feature compression model that converts the original features extracted from the biological image of the attack sample by the target liveness classification model into compressed features. There are various ways to use the target feature compression model to compress the original features. For example, the processor 620 can use the feature compression network of the target feature compression model to compress the original features, obtaining multiple target compressed local features, and using these target compressed local features as the target compressed features. It should be noted that there is a one-to-one correspondence between the multiple target compressed local features and the local feature maps in the original features.
[0103] The training process of the target feature compression model may include the following steps: the processor 620 can acquire the original features of the sample and compress the original features of the sample using a preset feature compression model to obtain the compressed features of the sample; the compressed features of the sample are reconstructed; based on the reconstructed original features, the local compressed features are backtracked to obtain the local features of the target sample corresponding to the local compressed features; and based on the original features of the sample, the reconstructed original features and the local features of the target sample, the preset feature compression model is converged to obtain the target feature compression model.
[0104] The original sample features include M local features of the first dimension, where M is an integer greater than or equal to 1. The compressed sample features include M local compressed features of the second dimension, where the second dimension is smaller than the first dimension. There are multiple ways to obtain the original sample features. For example, the processor 620 can acquire the original image sample and use the target liveness classification model trained above to extract features from the original image sample to obtain the original sample features. Alternatively, it can directly acquire the original sample features uploaded by the user 100 through the client 200 or terminal, and so on.
[0105] After acquiring the original features of the sample, the processor 620 can use a preset feature compression model to compress the original features, thereby obtaining compressed features. The preset feature compression model can include a feature compression network, a feature decoding network, and a local backtracking network. The feature compression network can be a network that compresses the original features of the sample; the feature decoding network can be a network that reconstructs or restores the original features of the sample from the compressed features; and the local backtracking network can be a network that traces the correspondence between the compressed features and the local features of the sample. There are various ways to use the preset feature compression model to compress the original features of the sample. For example, the processor 620 can input the original features of the sample into the feature compression network to obtain compressed features, which can include M second-dimensional local compressed features.
[0106] The reconstructed original features can include M reconstructed local features in the first dimension. There are various ways to reconstruct features from compressed sample features. For example, the processor 620 can directly use a feature decoding network to reconstruct the compressed sample features as a whole, obtaining the reconstructed original features, which can include M reconstructed local features in the first dimension. Alternatively, the local compressed features in the compressed sample features can be reconstructed separately to obtain M reconstructed local features in the first dimension, and so on.
[0107] After reconstructing the compressed features of the samples, the processor 620 can perform feature backtracking on the local compressed features based on the reconstructed original features to obtain the target sample local features corresponding to the local compressed features. There are several ways to perform feature backtracking on the local compressed features. For example, the processor 620 can use a local backtracking network to backtrack the reconstructed local features corresponding to each local compressed feature in the reconstructed original features to obtain the target reconstructed local features, or, based on the target reconstructed local features, determine the sample local features corresponding to the local compressed features in the sample original features to obtain the target sample local features.
[0108] There are several ways to determine the local features corresponding to the local compressed features in the original features of the sample based on the target reconstruction local features. For example, the processor 620 can select the local features corresponding to the target reconstruction local features from the local features of the original features of the sample to obtain the target sample local features. Alternatively, it can obtain the feature similarity between the target reconstruction local features and each local feature of the original features of the sample, and select the target sample local features from the local features of the sample based on the feature similarity, and so on.
[0109] After performing feature backtracking on the local compressed features, the processor 620 can converge the preset feature compression model based on the original features of the samples, the reconstructed original features, and the backtracked local features of the target samples, thereby obtaining the target feature compression model. There are several ways to converge the preset feature compression model. For example, the processor 620 can compare the reconstructed original features with the original features of the samples to obtain global reconstruction loss information, compare the local features of each target sample with the corresponding reconstructed local features to obtain local reconstruction loss information, and fuse the global reconstruction loss information and local reconstruction loss information to obtain backtracking loss information. Based on the backtracking loss information, the processor 620 can then converge the preset feature compression model to obtain the target feature compression model.
[0110] The global reconstruction loss information can be the loss information corresponding to the overall difference between the reconstructed original features and the original features of the sample. There are several ways to compare the reconstructed original features with the original features of the sample. For example, the processor 620 can obtain the feature similarity between the reconstructed original features and the original features of the sample, and determine the global reconstruction loss information based on the feature similarity. Alternatively, it can obtain the feature distance between the reconstructed original features and the original features of the sample, and determine the global reconstruction loss information based on the feature distance, and so on.
[0111] The local reconstruction loss information can be defined as the loss information corresponding to the difference between the reconstructed local features and the corresponding sample local features. The method of comparing each target sample local feature with its corresponding reconstructed local feature is similar to the method of comparing the reconstructed original features with the original sample features, thus obtaining the initial local reconstruction loss information corresponding to each target sample local feature. By fusing the initial local reconstruction loss information, the final local reconstruction loss information can be obtained.
[0112] After determining the global loss information and the local loss information, the processor 620 can fuse the global loss information and the local loss information. There are several ways to fuse them. For example, the processor 620 can directly add the global loss information and the local loss information to obtain the backtracking loss information, as shown in formula (2):
[0113] Loss total2 =Loss global +Loss local (2)
[0114] Among them, Loss total2 To recover information about the loss, Loss global For global loss information, Loss local This is information about local loss.
[0115] In some embodiments, the processor 620 may also obtain the backtracking loss weights, and weight the global loss information and the local loss information based on the backtracking loss weights respectively, and add the weighted global loss information and the weighted local loss information together to obtain the backtracking loss information.
[0116] After determining the backtracking loss information, the processor 620 can converge the preset feature compression model based on the backtracking loss information to obtain the target feature compression model. The convergence method of the preset feature compression model is similar to that of the preset liveness classification model, as detailed above, and will not be repeated here.
[0117] S130: Based on the target compression features, perform attack retrieval in the sample compression feature library corresponding to the attack sample to obtain the liveness detection results of the target user and output the liveness detection results.
[0118] Among them, the liveness detection result can characterize the liveness category of the target user, and the liveness result can include either a live user or an attacking user.
[0119] Among them, the target compressed features are used to perform attack detection in the sample feature compression library corresponding to the attack sample to obtain the liveness detection results of the target user. There are several ways to output the liveness detection results, which can be as follows:
[0120] S131: Based on the target compression features, perform attack retrieval in the sample compression feature library corresponding to the attack sample to obtain the liveness detection results of the target user.
[0121] The compressed features in the sample compressed feature library and the target compressed features are compressed in the same way. In other words, the compressed features in the sample compressed feature library and the target compressed features can be obtained by the same target feature compression model. Alternatively, it can be understood that the feature compression model corresponding to the sample compressed feature library and the target feature compression model corresponding to the target compressed features can be trained in the same way, but the training samples can be the same or different.
[0122] Among them, there are several ways to perform attack retrieval in the sample compression feature library corresponding to the attack sample based on the target compression features, as follows:
[0123] For example, the processor 620 can obtain the sample compressed feature library corresponding to the attack sample, determine the feature similarity between each compressed feature in the sample compressed feature library and the target compressed feature, sort the feature similarity to obtain the target feature similarity, and determine the liveness detection result of the target user as the attack user when the target feature similarity is greater than a preset similarity threshold.
[0124] In particular, after sorting the feature similarity to obtain the target feature similarity, the processor 620 can also determine the liveness detection result of the target user as a live user when the target feature similarity is less than a preset similarity threshold.
[0125] There are several ways to obtain the sample feature compressed feature library corresponding to the attack sample. For example, the processor 620 can generate the sample feature compressed feature library corresponding to the attack sample, or it can receive or obtain the sample feature compressed feature library corresponding to the attack sample from a third party.
[0126] The processor 620 can generate a compressed sample feature library before performing liveness detection on the target biological image of the target user. There are several ways to generate the compressed sample feature library. For example, the processor 620 can acquire a set of attack images corresponding to the attack sample, and use a target liveness classification model to extract features from the attack images in the attack image set to obtain multiple local attack feature maps of the attack images. Furthermore, it can use a target feature compression model to compress the features of these multiple local attack feature maps to obtain the compressed sample feature library.
[0127] The attack image set can include at least one attack image of at least one attack sample. The attack sample can be a sample corresponding to the attacking user, and the attack image can be a biological image corresponding to the attack sample. There are multiple ways to obtain the attack image set corresponding to the attack sample. For example, the processor 620 can accumulate attack samples based on annotation by an annotation server, thereby obtaining the attack image set. Alternatively, it can accumulate attack samples based on model-predicted sample accumulation, thereby obtaining the attack image set. Specifically, it can be as follows:
[0128] (1) Accumulation method based on annotation server
[0129] For example, the processor 620 can acquire the full biological image set, select multiple biological images from the full biological image set to obtain the original biological image set, send the original biological image set to the annotation server for liveness category annotation, receive the first annotation result corresponding to the original biological image set returned by the annotation server, and select at least one attack image from the original biological image set based on the first annotation result to obtain the attack image set corresponding to the attack sample.
[0130] The full biological image set can include full biological images from one or more scenes. There are several ways to select multiple biological images from the full biological image set. For example, the processor 620 can randomly select multiple biological images from the full biological image set to obtain the original biological image set. Alternatively, it can select a preset number of biological images from the full biological image set according to preset selection conditions to obtain the original biological image set.
[0131] The processor 620 sends the original biological image set to the annotation server, and performs liveness annotation on the biological images in the original biological image set through machine or manual annotation, thereby obtaining the first annotation result corresponding to the original biological image set. Taking manual annotation as an example, this method can accumulate attack samples based on manual annotation. For scene data, a portion is randomly selected for manual annotation, and attack samples are selected from it, thereby obtaining a set of attack images of attack samples.
[0132] (2) Sample accumulation method based on model prediction
[0133] For example, the processor 620 can acquire an initial biological image set, and use a target liveness classification model to perform liveness classification on each biological image in the initial biological image set to obtain the attack probability of each biological image, and select at least one biological image in the initial biological image set whose attack probability is greater than a preset attack probability threshold to obtain the attack image set corresponding to the attack sample.
[0134] In some embodiments, after obtaining the set of attack images corresponding to the attack sample, the set of attack images can be periodically updated. There are various ways to periodically update the set of attack images. For example, the processor 620 can periodically update the set of attack images based on a preset time interval to obtain an updated set of attack images, and use the updated set of attack images as the set of attack images corresponding to the attack sample.
[0135] There are several ways to periodically update the attack image set based on a preset time interval. For example, the processor 620 can perform liveness labeling on each attack image in the attack image set based on the time interval to obtain a second labeling result. Based on the second labeling result, the attack images corresponding to live samples are removed from the attack image set to obtain a candidate attack image set. The sampling time of each attack image in the candidate attack image set is obtained, and the attack images whose sampling time exceeds a preset time threshold are removed from the candidate attack image set to obtain an updated attack image set.
[0136] In this context, "live samples" can refer to samples whose liveness labeling results indicate they belong to the liveness category. Sampling time can be understood as the time it takes for an attack image to be added to the attack image set corresponding to the attack sample, or it can be the time it takes to acquire the attack image. There are several ways to remove attack images from the candidate attack image set whose sampling time exceeds a preset time threshold. For example, taking a preset time threshold of one year, the processor 620 can remove attack images from the candidate attack image set whose sampling time is more than one year ago, thus obtaining an updated attack image set. The preset time threshold can be set according to the actual application, such as one week, one month, six months, one year, or many years, etc. Furthermore, it should be noted that periodically updating the attack image set can mean periodically removing attack images corresponding to live samples and outdated attack images from the attack image set, thus periodically obtaining an updated attack image set. Besides removing attack images from the attack image set, newly added attack images can also be periodically acquired and added to the attack image set, also periodically obtaining an updated attack image set. It should also be noted that updating the attack image set can involve both removal and addition operations simultaneously, or it can involve updating the set by one or more removal operations.
[0137] The target liveness classification model can be the trained target liveness model described above, or any trained liveness classification model. The attack probability can be the probability that the biological image is an attack sample biological image.
[0138] The processor 620 acquires a set of attack images and can use the target liveness classification model described above to extract features from the attack images in the set, obtaining multiple local attack feature maps of the attack images. The methods for feature extraction from the attack images are described above and will not be repeated here.
[0139] After extracting multiple local attack feature maps from the attack image, the processor 620 can use a target feature compression model to compress these local attack feature maps. The feature compression methods are described above and will not be repeated here. The target feature compression model can be either the target feature compression model corresponding to the target compressed feature, or a feature compression model trained using the same training method as the target compressed feature model. The compressed features obtained after feature compression constitute a sample compressed feature library. All compressed features in this sample compressed feature library correspond to the attack samples. When constructing the sample compressed feature library based on the compressed features, compressed feature retrieval information can also be constructed. This information is used to match the compressed features in the sample compressed feature library with the target compressed features, thereby improving retrieval efficiency.
[0140] It should be noted that during the update of the attack sample set, the compressed features in the sample compressed feature library can also be updated simultaneously. There are several ways to update it. For example, the processor 620 can extract and compress features from newly added attack images in the attack image set to obtain an updated sample compressed feature library. Alternatively, it can delete the compressed features corresponding to previously removed attack images from the sample compressed feature library to obtain an updated sample compressed feature library. Therefore, the update method of the sample compressed feature library is similar to that of the attack image set of the attack samples; it is also updated periodically. After updating the sample compressed feature library, the updated sample compressed feature library is used as the sample compressed feature library corresponding to the attack samples.
[0141] After acquiring the sample compressed feature library corresponding to the attack sample, the processor 620 can determine the feature similarity between each compressed feature in the sample compressed feature library and the target compressed feature. There are several ways to determine the feature similarity. For example, the processor 620 can acquire the overall similarity between each compressed feature and the target compressed feature to obtain the feature similarity, or it can acquire the local similarity between each compressed feature and the target compressed feature to obtain the feature similarity, and so on.
[0142] There are several ways to obtain the overall similarity between each compressed feature and the target compressed feature. For example, the processor 620 can obtain the cosine similarity between each compressed feature in the sample compressed feature library and the target compressed feature as a whole, thereby obtaining the feature similarity. Alternatively, it can obtain the feature distance between each compressed feature in the sample compressed feature library and the target compressed feature, and use the feature distance as the feature similarity, and so on.
[0143] There are multiple ways to obtain the local similarity between each compressed feature and the target compressed feature. For example, the processor 620 can match the current local feature of each compressed feature with the target local compressed feature of the target compressed feature. Based on the matching result, it can determine the initial feature similarity between the current local compressed feature and the corresponding target local compressed feature, and fuse the initial feature similarity to obtain the feature similarity between each compressed feature and the target compressed feature.
[0144] There are multiple ways to match the current local features of each compressed feature with the target local compressed features of the target compressed feature. For example, the processor 620 can match the Kth target local compressed feature with the Kth current local compressed feature based on the backtrackability of the target local compressed features. Taking the number of current local compressed features and target local compressed features as M as an example, the value of K can be any integer between [1, K].
[0145] After matching the current local compressed feature of each compressed feature with the target local compressed feature of the target compressed feature, the processor 620 can determine the initial feature similarity between the current local compressed feature and the corresponding target local compressed feature based on the matching result. There are several ways to determine the initial feature similarity. For example, the processor 620 can determine the similarity between the Kth current local compressed feature and the matched Kth target local compressed feature based on the matching result, thus obtaining the Kth initial feature similarity, and so on, thereby obtaining the initial feature similarity between each current local compressed feature and the corresponding target local compressed feature.
[0146] After determining the initial feature similarity, the processor 620 can fuse the initial feature similarities. There are several ways to fuse them. For example, the processor 620 can accumulate the initial feature similarities to obtain the feature similarity between each compressed feature and the target compressed feature. Alternatively, it can obtain similarity weights and, based on these weights, weight the initial feature similarities separately, then accumulate the weighted initial feature similarities to obtain the feature similarity between each compressed feature and the target compressed feature.
[0147] It should be noted that, due to the interpretability of the compressed target features in this scheme, they possess local traceability. The correspondence between feature elements before and after compression remains nearly identical. This allows the target compressed features to be matched with compressed features in the sample compressed feature library, whether for overall matching or local matching. The traceability increases the constraints on feature elements, ensuring that the Kth feature element in the target compressed features matches the Kth feature element in the sample compressed feature library. This significantly improves the retrieval efficiency and accuracy of feature retrieval, thereby enhancing the retrieval performance of attack detection and ultimately improving the accuracy of liveness detection.
[0148] After determining the feature similarity between each compressed feature and the target compressed feature, the processor 620 can sort the feature similarities to obtain the target feature similarity. There are several ways to sort the feature similarities. For example, the processor 620 can sort the feature similarities by magnitude, and based on the sorting result, select the feature with the highest feature similarity to obtain the target feature similarity. Alternatively, it can sort the feature similarities by magnitude, and based on the sorting result, select the top K feature similarities to obtain a candidate feature similarity set. The mean of the feature similarities in the candidate feature similarity set is then determined to obtain the target feature similarity, and so on.
[0149] After determining the target feature similarity, the processor 620 can determine the liveness detection result of the target user based on the target feature similarity. There are several ways to determine the liveness detection result of the target user. For example, when the target feature similarity is greater than a preset similarity threshold, the processor 620 determines that the target user's liveness detection result is an attacking user, or when the target feature similarity is less than the preset similarity threshold, the processor 620 determines that the target user's liveness detection result is a live user.
[0150] S132: Output the liveness detection results.
[0151] For example, the processor 620 can directly send the liveness detection result to the client 200, terminal, or server corresponding to user 100, so that the client 200, terminal, or server can respond to the target user or the business request corresponding to the target user based on the liveness detection result. Alternatively, the liveness detection result can be directly visualized, and so on.
[0152] There are several ways to visualize the liveness detection results. For example, the processor 620 can directly display the liveness detection result, or it can display the liveness detection result through sound and light (for example, by broadcasting the liveness detection result by voice, or by displaying different types of liveness detection results by displaying different colored lights, or by displaying the liveness detection result through sound and light linkage), or it can display the liveness detection result for specific types of liveness detection results (for example, only displaying the liveness detection result for the attacking user type, or only displaying the liveness detection result for the live user type, etc.), and so on.
[0153] In some embodiments, after determining or outputting the liveness detection result of the target user, the processor 620 may respond to the target user or the corresponding business request based on the liveness detection result. There may be various ways to respond. For example, the processor 620 may directly intercept the target user or the corresponding business request, or the processor 620 may directly perform secondary verification on the target user and, based on the secondary verification result, provide a final response to the target user or the corresponding business request, and so on.
[0154] In the context of face recognition, this solution can employ a locally traceable compression method for liveness attack detection. The overall liveness attack detection process can be described as follows: Figure 4 As shown, it can include four parts: basic model training, locally traceable feature compression model training, feature library construction and feature compression, and attack detection. Specifically, it can be as follows:
[0155] (1) Basic Model Training: Traditional feature extraction models are trained on a large number of labeled liveness detection samples, requiring additional data annotation. To reduce the amount of data annotation, this approach first performs model pre-training based on an open-source dataset to obtain an original liveness classification model. Then, iterative optimization is performed on small-scale scene data to obtain a target liveness classification model. This target liveness classification model is used to extract the original features of the target biological image; therefore, it can be used as the basic model. The training of the basic model can be found above and will not be repeated here. By training the basic model, the cost of annotation is reduced while ensuring feature separability, and the accuracy of feature extraction is also improved.
[0156] (2) Training of a Locally Backtrackable Feature Compression Model: Traditional feature compression models only impose global constraints on compressed features, neglecting the local traceability of these features. The trained feature compression model in this scheme possesses local traceability, which increases the interpretability of compressed features and improves the retrieval performance for attack detection, thereby enhancing the accuracy of liveness detection. The training process of the feature compression model with local traceability can be found above and will not be repeated here.
[0157] (3) Feature library construction and feature compression: An attack image set (library) is obtained through the accumulation of manually labeled attack samples or model-predicted samples. A target liveness classification model trained on the base model is used to extract features from the attack images in the attack image set, and a feature compression model is used to compress the extracted features, thus obtaining a compressed feature library. Specifically, it can be done as follows: Figure 5 As shown, the constructed sample compressed feature library can be manually annotated at regular intervals (e.g., once a week or other periods) to remove non-attack data and outdated data (e.g., data from a year ago or other times), thereby achieving periodic simplification and updating of the sample compressed feature library.
[0158] (4) Attack Retrieval: After the target user begins face recognition, their face image is used and input into the trained liveness classification model to extract features, resulting in multiple local facial features. These local features are then input into a feature compression model to obtain compressed facial features of the target user. These compressed facial features are then matched one-to-one with each compressed feature in the sample compressed feature library to obtain cosine similarity. The cosine similarities are ranked to obtain the top-ranked feature similarity S. If S is greater than a pre-set threshold T, the user can be identified as an attacker; otherwise, they are identified as a live user. Specifically, this can be done as follows: Figure 6 As shown.
[0159] In this scheme, a basic liveness classification model is first trained to extract features from samples. Then, a locally traceable feature compression model is trained based on the sample features to significantly reduce the feature size. Finally, the features of the compressed attack samples are used to construct an attack library (sample compressed feature library) and liveness attack retrieval is performed. This achieves an increase in the storage capacity of compressed features within a limited storage space. Moreover, the compressed features are traceable, thereby increasing the interpretability of the compressed features and improving the retrieval performance of subsequent attack retrieval, thus improving the accuracy of liveness detection.
[0160] In summary, the liveness detection method P100 and system 001 provided in this specification acquire the target biological image of the target user, extract features from the target biological image to obtain the original features of the target user, compress the original features to obtain the target compressed features of the target user, and establish a local correspondence between the target compressed features and the original features. Based on the target compressed features, an attack retrieval is performed in the sample compressed feature library corresponding to the attack sample to obtain the liveness detection result of the target user and output the liveness detection result. Since this scheme can use the sample compressed feature library for attack retrieval, there is no need to label live samples. In addition, the use of compressed features to construct the feature library greatly reduces the size of the feature library. With effective storage space, more compressed features of attack samples can be stored. Moreover, the use of locally traceable compression in the feature compression process of the original features increases the interpretability of the compressed features (target compressed features and compressed features in the sample compressed feature library) and improves the retrieval performance of the attack retrieval. Therefore, the accuracy of liveness detection can be improved.
[0161] 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.
[0162] 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.
[0163] 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.
[0164] 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.
[0165] 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.
[0166] 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.
[0167] 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 live detection method, comprising: obtaining a target biological image of a target user, and performing local feature extraction on the target biological image to obtain a plurality of local feature maps, and taking the plurality of local feature maps as original features of the target user; performing feature compression on the original features to obtain target compressed features of the target user, the local features between the target compressed features and the original features corresponding to each other; and based on the target compressed features, performing attack retrieval in a sample compressed feature library corresponding to an attack sample to obtain a live detection result of the target user, and outputting the live detection result.
2. The living body detection method according to claim 1, wherein The target biological image includes at least one of a face image, a body image, an iris image, a fingerprint image, or a palmprint image.
3. The living body detection method according to claim 1, wherein The original features of the target user are obtained by performing feature extraction on the target biological image, comprising: obtaining a target live classification model corresponding to the target biological image; and based on the target live classification model, performing the local feature extraction on the target biological image to obtain the plurality of local feature maps, and taking the plurality of local feature maps as the original features.
4. The living body detection method according to claim 3, wherein The target live classification model corresponding to the target biological image is obtained, comprising: obtaining a set of live classification models corresponding to the sample compressed feature library; and determining a target detection scene corresponding to the target user, and selecting a live classification model corresponding to the target detection scene from the set of live classification models to obtain a target live classification model.
5. The living body detecting method according to claim 4, wherein The training process of the target live classification model comprises the following steps: obtaining open source training data, and training a preset live classification model based on the open source training data to obtain a trained original live classification model; and obtaining target training data corresponding to the target detection scene, and updating the original live classification model based on the target training data to obtain the target live classification model.
6. The living body detecting method according to claim 5, wherein The preset live classification model includes a local feature extraction network, a local feature comparison network, and a live classification network; and The preset live classification model is trained based on the open source training data to obtain a trained original live classification model, comprising: performing local feature extraction on open source image samples in the open source training data using the local feature extraction network to obtain a plurality of sample local feature maps, comparing the plurality of sample local feature maps using the local feature comparison network to obtain local comparison relationship features of the open source image samples, inputting the plurality of sample local feature maps and the local comparison relationship features into the live classification network to obtain a predicted live class of the open source image samples, and based on the predicted live class and the local comparison relationship features, converging the preset live classification model to obtain the original live classification model.
7. The living body detecting method according to claim 6, wherein The preset live classification model is converged to obtain the original live classification model, comprising: obtaining a labeled live class of the open source image samples, and comparing the predicted live class and the labeled live class to obtain classification loss information; comparing local alignment relationship features between the open source image samples in the open source training data based on the labeled living body categories to obtain local alignment loss information; and fusing the classification loss information and the local alignment loss information to obtain target loss information, and converging the preset living body classification model based on the target loss information to obtain the original living body classification model.
8. The living body detection method according to claim 7, wherein The comparing local alignment relationship features between the open source image samples in the open source training data based on the labeled living body categories to obtain local alignment loss information comprises: comparing local alignment relationship features between open source image samples of the same labeled living body category in the open source training data to obtain first feature comparison information; comparing local alignment relationship features between open source image samples of different labeled living body categories in the open source training data to obtain second feature comparison information; and determining the local alignment loss information based on the first feature comparison information and the second feature comparison information, wherein a constraint condition of the local alignment loss information is that a difference between the local alignment relationship features corresponding to the same labeled living body category is less than a first preset difference threshold, and a difference between the local alignment relationship features corresponding to different labeled living body categories is greater than a second preset difference threshold.
9. The living body detecting method according to claim 5, wherein The updating the original living body classification model based on the target training data to obtain the target living body classification model comprises: training a local feature alignment network and a living body classification network in the original living body classification model based on the target training data to obtain the target living body classification model.
10. The living body detecting method according to claim 1, wherein The feature compression of the original feature to obtain target compressed features of the target user comprises: obtaining a target feature compression model corresponding to the sample compressed feature library; and performing feature compression on the original feature by using the target feature compression model to obtain target compressed features of the target user.
11. The living body detecting method according to claim 10, wherein The training process of the target feature compression model comprises the following steps: obtaining sample original features, and performing feature compression on the sample original features by using a preset feature compression model to obtain sample compressed features, wherein the sample original features comprise M first-dimension sample local features, M is an integer greater than or equal to 1, and the sample compressed features comprise M second-dimension local compressed features, wherein the second dimension is less than the first dimension; performing feature reconstruction on the sample compressed features, and performing feature backtracking on the local compressed features based on reconstructed original features to obtain target sample local features corresponding to the local compressed features; and converging the preset feature compression model based on the sample original features, the reconstructed original features, and the target sample local features to obtain the target feature compression model.
12. The living body detecting method according to claim 11, wherein The reconstructed original features comprise M first-dimension reconstructed local features; and The feature backtracking on the local compressed features to obtain target sample local features corresponding to the local compressed features comprises: obtaining a target reconstructed local feature corresponding to each of the partial compressed features, by backtracking in the reconstructed original features, and determining a target sample local feature corresponding to the partial compressed feature in the sample original features, based on the target reconstructed local feature, to obtain the target sample local feature.
13. The living detection method according to claim 12, wherein, The convergence of the preset feature compression model to obtain the target feature compression model comprises: comparing the reconstructed original features and the sample original features to obtain global reconstruction loss information; comparing each target sample local feature and the corresponding reconstructed local feature to obtain local reconstruction loss information; and fusing the global reconstruction loss information and the local reconstruction loss information to obtain backtracking loss information, and converging the preset feature compression model based on the backtracking loss information to obtain the target feature compression model.
14. The living body detecting method according to claim 1, wherein The compressed features in the sample compressed feature library have the same compression mode as the target compressed feature.
15. The living body detecting method according to claim 1, wherein The attack retrieval in the sample compressed feature library corresponding to the attack sample to obtain the live detection result of the target user comprises: obtaining a sample compressed feature library corresponding to an attack sample; determining a feature similarity between each compressed feature in the sample compressed feature library and the target compressed feature, and sorting the feature similarity to obtain a target feature similarity; and when the target feature similarity is greater than a preset similarity threshold, determining that the live detection result of the target user is an attack user.
16. The living detection method according to claim 15, wherein, After sorting the feature similarity to obtain the target feature similarity, it further comprises: when the target feature similarity is less than the preset similarity threshold, determining that the live detection result of the target user is a live user.
17. The living detection method according to claim 15, wherein, The obtaining of the sample compressed feature library corresponding to the attack sample comprises: obtaining an attack image set corresponding to an attack sample, and extracting features of attack images in the attack image set using a target live classification model to obtain a plurality of local attack feature maps of the attack images; and compressing features of the plurality of local attack feature maps using a target feature compression model to obtain a sample compressed feature library.
18. The living detection method according to claim 17, wherein, The obtaining of the attack image set corresponding to the attack sample comprises: obtaining a full-batch biological image set, and selecting a plurality of biological images from the full-batch biological image set to obtain an original biological image set; sending the original biological image set to a labeling server for live category labeling, and receiving a first labeling result corresponding to the original biological image set returned by the labeling server; and based on the first labeling result, selecting at least one attack image from the original biological image set to obtain an attack image set corresponding to the attack sample.
19. The living detection method according to claim 17, wherein, The obtaining of the attack image set corresponding to the attack sample comprises: obtaining an initial biological image set, and classifying each biological image in the initial biological image set using the target live classification model to obtain an attack probability of each biological image; and select at least one biometric image with the attack probability greater than a preset attack probability threshold from the initial biometric image set, to obtain an attack image set corresponding to the attack sample.
20. The living detection method according to claim 17, wherein, After obtaining the attack image set corresponding to the attack sample, the method further includes: periodically updating the attack image set based on a preset time interval, to obtain an updated attack image set; and taking the updated attack image set as the attack image set corresponding to the attack sample.
21. The living detection method according to claim 20, wherein, The periodically updating the attack image set, to obtain the updated attack image set, includes: based on a preset time interval, performing a live body annotation on each attack image in the attack image set, to obtain a second annotation result; based on the second annotation result, removing an attack image corresponding to a live body sample from the attack image set, to obtain a candidate attack image set; obtaining a sampling time of each attack image in the candidate attack image set, and removing an attack image with a sampling time exceeding a preset time threshold from the candidate attack image set, to obtain the updated attack image set.
22. The living detection method according to claim 15, wherein, The determining the feature similarity between each compression feature in the sample compression feature library and the target compression feature includes: matching a current local compression feature of the each compression feature with a target local compression feature of the target compression feature; based on a matching result, determining an initial feature similarity between the current local compression feature and the corresponding target local compression feature; and fusing the initial feature similarity, to obtain the feature similarity between the each compression feature and the target compression feature.
23. A live body detection system, comprising: at least one storage medium storing at least one instruction set for live body detection; and at least one processor in communication connection with the at least one storage medium, wherein, when the live body detection system is running, the at least one processor reads the at least one instruction set, and performs the live body detection method according to the instruction set of any one of claims 1-22.
Citation Information
Patent Citations
Living body detection method and device
CN110633647A
Retrieval method and device and electronic equipment
CN112989093A