A method and system for detecting living entities

By performing grouping aggregation and fully connected processing of the liveness detection model on the terminal device, the problem of balancing accuracy and efficiency in liveness detection in face recognition systems is solved, achieving efficient and accurate liveness detection.

CN116168454BActive Publication Date: 2026-03-31ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-17
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing facial recognition systems suffer from a tradeoff between accuracy and efficiency in liveness detection, and are particularly vulnerable to security threats from liveness attacks.

Method used

A liveness detection method is adopted, which obtains the initial feature vector map of the target image, performs N-fold grouping and aggregation and M-fold grouping and full connection using a liveness detection model, and combines attention submodule and feature reshaping to output liveness classification results.

Benefits of technology

It achieves efficient and accurate liveness detection on terminal devices, balancing recognition accuracy and efficiency, and is suitable for environments without network or with poor network conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116168454B_ABST
    Figure CN116168454B_ABST
Patent Text Reader

Abstract

The present disclosure provides a living body detection method and system, and relates to the technical field of data processing. The living body detection method provided by the present disclosure comprises: obtaining an initial feature vector graph of a target image; performing N times of vector grouping and aggregation on the L vectors based on a living body detection model to obtain N vector grouping results, and inputting the N vector grouping results into an attention submodule of the living body detection model to output a first feature vector graph; performing M times of grouped full connection on the first feature vector graph based on the living body detection model and a feature dimension D to obtain a grouped full connection result; and determining a living body classification result of the target image based on the living body detection model and the grouped full connection result. The living body detection method provided by the present disclosure can balance the recognition accuracy and recognition efficiency of living body detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of data processing technology, and in particular to a method and system for detecting liveness. Background Technology

[0002] Facial recognition has become one of the main methods of identity authentication besides passwords in recent years, and has been widely used in areas such as facial recognition attendance, facial recognition payment, and facial verification. While facial recognition technology has brought convenience to people, various facial recognition systems also face new security threats. For example, liveness detection is the most significant security risk facing facial recognition, making it an essential component of facial recognition systems. How to balance the accuracy and efficiency of liveness detection is a crucial issue currently facing liveness detection. Summary of the Invention

[0003] In order to solve the problems existing in the prior art, the main objective of this disclosure is to provide a liveness detection method and system.

[0004] This disclosure provides a method for detecting liveness, including:

[0005] Obtain an initial feature vector map of the target image, wherein the initial feature vector map includes L vectors, where L is a natural number greater than 0;

[0006] The liveness detection model performs N grouping and aggregation on the L vectors to obtain N vector grouping results, and inputs the N vector grouping results into the attention submodule of the liveness detection model to output a first feature vector map, wherein the feature dimension of the first feature vector map is D, and N and D are natural numbers greater than 0.

[0007] Based on the liveness detection model and the feature dimension D, the first feature vector map is subjected to M grouped fully connected operations to obtain the grouped fully connected results, where M is a natural number greater than 0; and

[0008] The liveness classification result of the target image is determined based on the liveness detection model and the grouped fully connected result.

[0009] In some embodiments, obtaining the initial feature vector map of the target image includes:

[0010] Obtain a target image, which includes the user's biometric features;

[0011] Feature extraction is performed on the target image based on an image preprocessing model to determine the feature map of the target image. The feature map contains information about whether the biometric features originate from a living organism or an attack.

[0012] The initial feature vector map is determined based on the feature map spectrum.

[0013] In some embodiments, determining the initial feature vector map based on the feature map spectrum includes:

[0014] The feature map is reshaped to obtain the initial feature vector map.

[0015] In some embodiments, the step of performing N grouping and aggregation operations on the L vectors based on a preset liveness detection model to obtain N vector grouping results includes:

[0016] For each of the N group aggregations:

[0017] The L vectors are grouped based on a grouping interval to obtain K groups of vectors, where the grouping interval and K are natural numbers greater than 0; and

[0018] Aggregate the vectors contained in each of the K groups of vectors to obtain K grouped vectors, and use the K grouped vectors as one vector grouping result.

[0019] In some embodiments, the number of group aggregations is 2 to 4, and the grouping intervals corresponding to each of the N aggregations are different.

[0020] In some embodiments, inputting the grouping results of the N vectors into the attention submodule of the liveness detection model to output a first feature vector map includes:

[0021] For each of the N vector grouping results:

[0022] The vector grouping results are input into the attention submodule of the liveness detection model to output grouped attention results; and

[0023] The first feature vector map is obtained by summing the N grouped attention results.

[0024] In some embodiments, performing M-fold grouped full connections on the first feature vector map based on the liveness detection model and the feature dimension D includes:

[0025] For the first group full connection in the M-fold group full connection:

[0026] Based on the liveness detection model, the first feature vector map is divided into F1 groups according to the feature dimension D to obtain the first feature sub-vector map of group F1, where F1 is a natural number greater than 0.

[0027] Based on the liveness detection model, the first feature vector map of the F1 group is grouped and fully connected to obtain the second feature vector map; and

[0028] Based on the liveness detection model, the second feature vector map is grouped and rearranged to obtain the third feature vector map.

[0029] In some embodiments, performing M-fold grouped full connections on the first feature vector map based on the liveness detection model and the feature dimension D includes:

[0030] For the second group full connection in the M-order group full connection:

[0031] Based on the liveness detection model, the third feature vector map is divided into F2 groups according to the feature dimension D, and the third feature sub-vector map of group F2 is obtained, where F2 is a natural number greater than 0;

[0032] Based on the liveness detection model, the third feature vector map of group F2 is grouped and fully connected to obtain the fourth feature vector map; and

[0033] Based on the liveness detection model, the fourth feature vector map is grouped and rearranged to obtain the fifth feature vector map.

[0034] In some embodiments, the M-times grouped full connection is 2-3 times; and / or

[0035] The number of times the grouped full connection is determined is 2, and the fifth feature vector map is determined to be the result of the grouped full connection.

[0036] In some embodiments, determining the liveness classification result of the target image based on the liveness detection model and the grouped fully connected component includes:

[0037] Based on the liveness detection model, the attack probability of the target image is obtained by predicting the grouped fully connected results; and

[0038] The liveness classification result of the target image is determined based on the attack probability, and the liveness classification result includes live samples and attack samples.

[0039] In some embodiments, determining the liveness classification result of the target image based on the attack probability includes:

[0040] Obtain the preset probability threshold;

[0041] The attack probability is compared with the probability threshold to obtain a comparison result; and

[0042] The liveness classification result of the target image is determined based on the comparison results.

[0043] In some embodiments, the training process of the liveness detection model includes:

[0044] Obtain an initial feature vector map of the target image, wherein the initial feature vector map includes L vectors, where L is a natural number greater than 0;

[0045] Based on a preset liveness detection model, the L vectors are grouped and aggregated N times to obtain a first feature vector map. The preset liveness detection model is then trained based on this first feature vector map to obtain a transitional liveness detection model. The first feature vector map has a feature dimension of D, where N and D are natural numbers greater than 0.

[0046] Based on the transitional liveness detection model and the feature dimension D, the first feature vector map is subjected to M grouped fully connected operations to obtain the grouped fully connected results. The transitional liveness detection model is then trained based on the grouped fully connected results to obtain the trained liveness detection model.

[0047] In some embodiments, the step of performing N grouping and aggregation operations on the L vectors based on a preset liveness detection model to obtain a first feature vector map, and then training the preset liveness detection model based on the first feature vector map to obtain an interim liveness detection model, includes:

[0048] Based on the preset liveness detection model, the L vectors are grouped and aggregated N times to obtain N vector grouping results;

[0049] The grouping results of the N vectors are input into the attention submodule of the liveness detection model to output a first feature vector map, wherein the feature dimension of the first feature vector map is D, and N is a natural number greater than 0.

[0050] Based on the first feature vector map, determine the first liveness classification prediction result of the target image; and

[0051] The preset liveness detection model is converged based on the first liveness prediction result to obtain the transitional liveness detection model.

[0052] In some embodiments, the step of converging the preset liveness detection model based on the first liveness prediction result to obtain the transitional liveness detection model includes:

[0053] Obtain the original labeled image category of the target image;

[0054] The original labeled image category is compared with the first liveness classification prediction result to obtain the first liveness classification loss information; and

[0055] The preset liveness detection model is converged based on the first liveness classification loss information to obtain the transitional liveness detection model.

[0056] In some embodiments, training the transitional liveness detection model based on the grouped fully connected results to obtain the trained liveness detection model includes:

[0057] Based on the transitional liveness detection model, the grouped fully connected results are predicted to determine the second liveness classification prediction result of the target image; and

[0058] The transitional liveness detection model is converged based on the second liveness prediction result to obtain the trained liveness detection model.

[0059] In some embodiments, the step of converging the transitional liveness detection model based on the second liveness prediction result to obtain a trained liveness detection model includes:

[0060] Obtain the original labeled image category of the target image;

[0061] The original labeled image category is compared with the second liveness classification prediction result to obtain the second liveness classification loss information; and

[0062] The transitional liveness detection model is converged based on the second liveness classification loss information to obtain the trained liveness detection model.

[0063] In some embodiments, the training process of the image preprocessing model includes:

[0064] Obtain the target image;

[0065] Based on a preset image preprocessing model, feature extraction is performed on the target image to obtain a feature map of the target image; and

[0066] The preset image preprocessing model is trained based on the feature map to obtain the trained image preprocessing model.

[0067] In some embodiments, training the preset image preprocessing model based on the feature map to obtain the trained image preprocessing model includes:

[0068] Based on the preset image preprocessing model and the feature map, the target image is classified and predicted to obtain a third liveness classification prediction result; and

[0069] The preset image preprocessing model is converged based on the third liveness classification prediction result to obtain the trained image preprocessing model.

[0070] In some embodiments, the step of converging the preset image preprocessing model based on the third liveness classification prediction result to obtain the trained image preprocessing model includes:

[0071] Obtain the original labeled image category of the target image;

[0072] The original labeled image category is compared with the third liveness classification prediction result to obtain the third liveness classification loss information; and

[0073] The preset image preprocessing model is converged based on the third liveness classification loss information to obtain the trained preset image preprocessing model.

[0074] This disclosure also provides a liveness detection system, comprising: at least one storage medium including at least one instruction set for implementing and analyzing a liveness detection method; and at least one processor communicatively connected to the at least one storage medium, wherein, when the system is running, the at least one processor reads the at least one instruction set and executes the liveness detection method according to the instructions of the at least one instruction set.

[0075] As can be seen from the above technical solutions, the liveness detection method and the system executing this method provided in this disclosure are as follows: The method and system obtain an initial feature vector map of the target image; perform N grouping and aggregation on the L vectors based on the liveness detection model to obtain N vector grouping results, and input the N vector grouping results into the attention submodule of the liveness detection model to output a first feature vector map; perform M grouping fully connected operations on the first feature vector map based on the liveness detection model and the feature dimension D to obtain grouping fully connected results; and determine the liveness classification result of the target image based on the liveness detection model and the grouping fully connected results. Compared with traditional server-side liveness detection methods based on complex models (such as Transformer, ResNet50, etc.), the liveness detection method provided in this disclosure can directly deploy the computational model on the terminal device without deploying it on a cloud server, and therefore can run stably in environments without network or with varying network conditions. Compared to traditional client-side liveness detection methods based on lightweight models (such as ShuffleNet and MobileNet), the liveness detection method provided in this disclosure is based on a large-scale network model, which has strong computational power and high accuracy in liveness detection. Therefore, the liveness detection method provided in this disclosure can balance the accuracy and efficiency of liveness detection.

[0076] Other functions of the liveness detection methods and systems provided in this disclosure will be partially set forth 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 disclosure can be fully understood through practice or use of the methods, apparatus, and combinations described in the detailed examples below. Attached Figure Description

[0077] To more clearly illustrate the technical solutions in the embodiments of this disclosure, 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 disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0078] Figure 1 A schematic diagram of the terminal structure of the hardware operating environment involved in the embodiments of this disclosure is shown;

[0079] Figure 2 A server schematic diagram of a liveness detection method according to some embodiments of the present disclosure is shown;

[0080] Figure 3 A flowchart of a liveness detection method according to some embodiments of the present disclosure is shown;

[0081] Figure 4 A schematic diagram of the basic structure of a liveness detection model provided according to some embodiments of the present disclosure is shown;

[0082] Figure 5 A schematic diagram of a grouping aggregation provided according to some embodiments of the present disclosure is shown;

[0083] Figure 6 A schematic diagram of the first group full connection process is shown according to some embodiments of the present disclosure;

[0084] Figure 7 A schematic diagram of the second group full connection process is shown in some embodiments of this disclosure;

[0085] Figure 8 A flowchart illustrating a training method for a liveness detection model according to some embodiments of the present disclosure is shown;

[0086] Figure 9 A flowchart illustrating a training method for an image preprocessing model according to some embodiments of the present disclosure is shown; and

[0087] Figure 10 A schematic diagram of the basic structure of an image preprocessing model provided according to some embodiments of the present disclosure is shown. Detailed Implementation

[0088] The following description provides specific application scenarios and requirements for this disclosure, intended to enable those skilled in the art to make and use the content of this disclosure. 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 disclosure. Therefore, this disclosure is not limited to the embodiments shown, but rather to the widest scope consistent with the claims.

[0089] 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” as used herein may also include the plural forms. When used in this disclosure, the terms “comprising,” “including,” and / or “containing” mean the presence of the associated natural number, step, operation, element, and / or component, but do not exclude the presence of one or more other features, natural numbers, steps, operations, elements, components, and / or groups, or the possibility of adding other features, natural numbers, steps, operations, elements, components, and / or groups to the system / method.

[0090] In view of the following description, these and other features of this disclosure, as well as the operation and function of the related elements of the structure, and the economy of assembly and manufacture of the components, can be significantly improved. All of these form part of this disclosure 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 disclosure. It should also be understood that the drawings are not drawn to scale.

[0091] The flowcharts used in this disclosure illustrate operations implemented according to some embodiments of this disclosure. It should be clearly understood that the operations in the flowcharts may not be implemented sequentially. 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.

[0092] For ease of description, the terms that will appear in the following descriptions will be explained as follows.

[0093] Liveness detection: In biometric systems, to prevent malicious forgery and theft of others' biometric features for identity authentication, the system needs to have liveness detection capabilities. This means determining whether the submitted biometric features originate from a living individual. Here, "living individual" refers to a natural person (not using a prosthetic mask) using the device for detection, not a person in a photograph or video. Generally, biometric liveness detection technologies utilize human physiological features such as fingerprints, faces, and irises.

[0094] Feature reshaping, the reshape function is a MATLAB function that transforms a specified matrix into a matrix of a specific dimension, while keeping the number of elements in the matrix unchanged. The function can readjust the number of rows, columns, and dimensions of the matrix.

[0095] The TransFormer model uses an attention mechanism to globally aggregate information from a sequence, and then uses a multilayer perceptron (MLP) to transform the semantic space.

[0096] Attention mechanisms are resource allocation schemes that address information overload by allocating computational resources to more important tasks when computing power is limited. In neural network learning, generally speaking, the more parameters a model has, the stronger its expressive power and the more information it can store, but this can lead to information overload. By introducing attention mechanisms, the system focuses on information more critical to the current task from a large amount of input information, reducing attention to other information and even filtering out irrelevant information. This solves the information overload problem and improves the efficiency and accuracy of task processing.

[0097] Multilayer perceptron: also known as artificial neural network (ANN), it is a relatively simple artificial neural network. It is a type of feedforward neural network. In addition to the input and output layers, it can have multiple hidden layers.

[0098] Model lightweighting: A technique for simplifying computationally intensive and complex models to reduce their computational cost and complexity.

[0099] Figure 1 A schematic diagram of a system 100 for a liveness detection method according to some embodiments of the present disclosure is shown. System 100 may include a client 110, an integrated development platform 120, an integrated development platform server 130, and a database 140.

[0100] The integrated development platform 120, also known as an integrated development environment (IDE), is an application that provides a program development environment, generally including tools such as a code editor, compiler, debugger, and graphical user interface. Developers can write program code (i.e., program development) on the integrated development platform 120 through client 110. The integrated development platform server 130 (hereinafter referred to as server 130) can be a computing device on the integrated development platform 120 specifically used to handle the liveness detection method in the program. In this application, multiple developers 110A, 110B, and 110C (collectively referred to as client 110) can perform program development on the integrated development platform 120.

[0101] Server 130 may store data or instructions for performing the liveness detection method described herein, and may execute or be used to execute said data and / or instructions. Server 130 may include hardware devices with data processing capabilities and the necessary programs required to drive the hardware devices. Of course, server 130 may also be merely a hardware device with data processing capabilities, or merely a program running on the hardware device. In some embodiments, server 130 may also be a plug-in deployed on client 110.

[0102] Database 140 may store data and / or instructions. In some embodiments, database 140 may store data and / or instructions executed by server 130 or used to execute a liveness detection method in a program described in this disclosure. Client 110 and server 130 may have access to database 140, and client 110 and server 130 may access data or instructions stored in database 140 via a network. In some embodiments, database 140 may be directly connected to client 110 and server 130. In some embodiments, database 110 may be part of server 130. In some embodiments, database 140 may include mass storage, removable storage, volatile read-write memory, read-only memory (ROM), or similar content, or any combination thereof. Exemplary mass storage may include non-transitory storage media such as disks, optical discs, and solid-state drives. Exemplary removable storage may include flash drives, floppy disks, optical discs, memory cards, zip disks, magnetic tapes, etc. Typical volatile read-write memory may include random access memory (RAM). Example RAMs may include dynamic RAM (DRAM), dual date rate synchronous dynamic RAM (DDRSDRAM), static RAM (SRAM), thyristor RAM (T-RAM), and zero-capacitance RAM (Z-RAM), etc. Exemplary ROMs may include mask ROM (MROM), programmable ROM (PROM), virtual programmable ROM (PEROM), electronically programmable ROM (EEPROM), optical disc (CD-ROM), and digital multifunction disk ROM, etc.

[0103] It should be understood that Figure 1 The number of clients 110 and servers 130 shown is merely illustrative. Depending on implementation needs, there can be any number of clients 110 and servers 130.

[0104] It should be noted that the liveness detection method can be executed entirely on the client 110, entirely on the server 130, or partially on the client 110 and partially on the server 130.

[0105] For ease of description, the following descriptions of this disclosure will use the execution of the liveness detection method on server 130 as an example to describe the technical solutions involved in this disclosure.

[0106] Figure 2This is a schematic diagram of the structure of a computing device 200 provided according to some embodiments of the present disclosure. The computing device 200 can be a general-purpose computer or a special-purpose computer. For example, the computing device 200 can be a server, a personal computer, a portable computer (such as a laptop computer, tablet computer, etc.), or other electronic devices with computing capabilities. Of course, the computing device can be... Figure 1 The server 130 can also be a terminal device used by multiple developers 110A, 110B, 110C (client 110) to develop programs on the integrated development platform.

[0107] like Figure 2 As shown, the computing device 200 may include a COM port 250, which can be connected to or from a network to facilitate data communication. The computing device 200 may also include a processor 220, such as a central processing unit (CPU), in the form of one or more processors for executing program instructions. The computing device 200 may also include an internal communication bus 210 and various forms of program storage media and data storage media, such as a disk 270 (non-transitory memory) and read-only memory (ROM) 230 or random access memory (RAM) 240, etc., for storing various data files to be processed and / or transmitted. The storage media may be local to the computing device 200 or shared by the computing device 200 (e.g.,...). Figure 1 The computing device 200 may also include program instructions stored in ROM 230, RAM 240, and / or other types of non-transitory storage media to be executed by processor 220. The computing device 200 may also include I / O components 260 to support data communication with other computing devices in the distributed computing system 100. The computing device 200 may also receive programming and data via network communication.

[0108] For illustrative purposes only, only one processor 220 is described in the computing device 200. However, those skilled in the art will understand that the computing device 200 in this application may also include multiple processors. Therefore, the methods / steps / operations performed by one processor as described in this application may also be performed jointly or separately by multiple processors. For example, in this application, the processor of the computing device 200 may simultaneously execute step A and step B. It should be understood that step A and step B may also be performed jointly by two different processors. For example, a first processor executes step A, a second processor executes step B, or a first processor and a second processor jointly execute steps A and B.

[0109] Figure 3A flowchart 300 of a liveness detection method according to some embodiments of the present disclosure is shown;

[0110] The following will combine Figure 3 This disclosure describes the technical solution. The subject implementing the technical solution may be... Figure 1 The client 110, integrated development platform 120, and server 130 are selected from the above. Specifically, the client 110, integrated development platform 120, and / or server 130 may have the following characteristics: Figure 2 The aforementioned structure, namely, the client 110, the integrated development platform 120, and / or the server 130, can be a device for liveness detection, comprising: at least one storage medium and at least one processor. The at least one storage medium includes at least one instruction set for a liveness detection method within a program. The at least one processor is communicatively connected to the at least one storage medium. When the system is running, the at least one processor can read the at least one instruction set and execute instructions according to the at least one instruction set. Figure 3 The method 300. For illustrative purposes only, this application will describe the method 300 as being performed by server 130. The method 300 may include:

[0111] S310, Obtain the initial feature vector map of the target image, wherein the initial feature vector map includes L vectors, where L is a natural number greater than 0.

[0112] In this disclosure, the target image can be understood as the initial image directly acquired by the server 130, or as the initial image obtained by the server 130 from an image acquisition device (such as a camera, a webcam, or other machine with image acquisition capabilities).

[0113] In this disclosure, server 130 can process the target image, such as performing feature extraction and feature vectorization, to obtain an initial feature vector map of the target image. In the initial feature vector map obtained by server 130, the number of vectors is L, which can also be understood as the sequence number, and L is a natural number greater than 0; the dimension of each vector is D, and D is also a natural number greater than 0.

[0114] In some embodiments, S310 may include:

[0115] S311, Obtain the target image, which includes the user's biometric features.

[0116] S312, Based on an image preprocessing model, feature extraction is performed on the target image to determine the feature map of the target image. The feature map contains information about whether the biometric features originate from a live person or an attack. In this disclosure, the target image includes the user's biometric features, which may include facial features. Facial features can be categorized into geometric features, representational features, etc. Geometric features can be understood as representing the geometric relationships between facial features such as eyes, nose, and mouth; representational features can be understood as global or local features extracted using grayscale information of a face image through various algorithms. The user's biometric features can serve as the basis for server 130 to determine whether the user is a live person or an attack.

[0117] In this disclosure, server 130 can use an image preprocessing model to extract features from a target image to obtain a feature map containing the user's biometric features. The image preprocessing model may contain one or more convolutional layers, and the size or number of convolutional kernels in the convolutional layers can be adjusted according to actual needs. Server 130 uses the convolutional layers in the image preprocessing model to perform convolution processing on the target image samples to obtain the feature map of the target image.

[0118] S313, Determine the initial feature vector map based on the feature map spectrum.

[0119] In this disclosure, server 130 extracts features from the target image to obtain a feature map. Different target images have different sizes, pixel counts, and other information, resulting in variations in the size and other information of the feature maps. Furthermore, in this disclosure, the server also needs to use a liveness detection model to predict the liveness classification result of the target image, i.e., to determine whether the target image is a live sample or an attack sample. The liveness detection model has requirements on the data structure of the input information (such as the number of rows, columns, and dimensions of the features). Therefore, to ensure that the feature map can be used as input to the liveness detection model, server 130 needs to process the feature map to obtain an initial feature vector map that meets the input information requirements of the liveness detection model.

[0120] In some embodiments, S313 may include:

[0121] The feature map is reshaped to obtain the initial feature vector map.

[0122] In this disclosure, server 130 can reshape the feature map by adjusting the number of rows, columns, dimensions, etc., of the features contained in the feature map to obtain an initial feature vector map, so as to adapt to the requirements of the image preprocessing model for the input data structure. For example, if each encoder in the image preprocessing model receives a 512-dimensional vector list as input, server 130 can reshape the feature map so that the feature dimension D of the initial feature vector map is 512.

[0123] It should be understood that the image preprocessing model can also accept vector lists of other dimensions, such as 32-dimensional, 64-dimensional, 128-dimensional, 768-dimensional, etc., which is related to the structure of the image preprocessing model itself. In this disclosure, the server 130 controls the initial feature vector map to match the requirements of the image preprocessing model for the input data structure.

[0124] S320, based on the liveness detection model, the L vectors are grouped and aggregated N times to obtain N vector grouping results, and the N vector grouping results are input into the attention submodule of the liveness detection model to output a first feature vector map, wherein the feature dimension of the first feature vector map is D, and N and D are natural numbers greater than 0.

[0125] In this disclosure, the liveness detection model can be a large-scale model such as the Transformer model or ResNet50. For ease of description, the following explanation uses the Transformer model as an example. The Transformer model is an Encoder-Decoder architecture, which can be divided into two parts: an encoding component and a decoding component. Each encoding and decoding component mainly includes two sub-layers: a Self-Attention layer and a Position-wise Feed Forward Network (FFN), such as... Figure 4 As shown. In the liveness detection model of this disclosure, the attention submodule can be understood as a self-attention layer, such as... Figure 4 As shown, when data is input into the encoding or decoding component, it first passes through the self-attention layer to obtain the output result. The output result can be used as the input of the feedforward network, and after processing by the feedforward network, it becomes the output result of the encoding or decoding component.

[0126] In this disclosure, server 130 inputs the initial feature vector map into the liveness detection model (i.e., server 130 can input L vectors from the initial feature vector map sequentially into the liveness detection model). The initial feature vector map is then processed sequentially through the attention module and feedforward network of the liveness detection model. Specifically, before inputting the initial feature vector map into the attention submodule of the liveness detection model, server 130 first performs N grouping and aggregation processes on the L vectors contained in the initial feature vector map (N is a natural number greater than 0). Each grouping and aggregation process yields one vector grouping result, and N grouping and aggregation processes yield N vector grouping results. In this disclosure, performing N grouping and aggregation processes on the L vectors reduces the computational load of the subsequent attention submodule, improving the efficiency of data processing.

[0127] As mentioned earlier, since the liveness detection model has requirements on the data structure of the input information (such as the number of rows, columns, and dimensions of features), the initial feature vector map should conform to the requirements of the liveness detection model for input information. In the initial feature vector map obtained by server 130, the number of vectors is L, and the dimension of each vector is D (D is a natural number greater than 0). Therefore, the server inputs the grouped results of N vectors into the attention submodule of the liveness detection model, and the feature dimension of the first feature vector map output is also D. It should be noted that the feature dimension of the first feature vector map is determined by the model structure of the liveness detection model. Therefore, the initial feature vector map and the first feature vector map have the same feature dimension, that is, the feature dimension of the initial feature vector map is also determined by the model structure of the liveness detection model.

[0128] In some embodiments, performing N grouping and aggregation operations on the L vectors based on a liveness detection model to obtain N vector grouping results may include:

[0129] S321, for each of the N group aggregations:

[0130] The L vectors are grouped based on a grouping interval to obtain K groups of vectors, where the grouping interval and K are natural numbers greater than 0; and

[0131] Aggregate the vectors contained in each of the K groups of vectors to obtain K grouped vectors, and use the K grouped vectors as one vector grouping result.

[0132] In this disclosure, the processing procedure of server 130 for each group aggregation in N group aggregations is used as an example for illustration. For ease of description, it is assumed that L equals 20, and the L vectors are expanded into L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, L13, L14, L15, L16, L17, L18, L19, and L20. The processing procedure of server 130 for group aggregation of the L vectors is as follows: Figure 5 As shown.

[0133] When the grouping interval is 1, L1, L3, L5, L7, L9, L11, L13, L15, L17, and L19 form one group; L2, L4, L6, L8, L10, L12, L14, L16, L18, and L20 form another group. In this case, server 130 divides the L vectors into 2 groups based on an interval of 1, i.e., K=2. Server 130 then aggregates the vectors within each group into one vector (i.e., one grouped vector). This aggregation can be achieved by concatenating the vectors within each group. Therefore, when the grouping interval is 1, K=2, resulting in K (2) grouped vectors, thus obtaining a K (2) vector grouping result.

[0134] When the grouping interval is 2, L1, L4, L7, L10, L13, L16, and L19 form one group; L2, L5, L8, L11, L14, L17, and L20 form another group; and L3, L6, L9, L12, L15, and L18 form yet another group. In this case, server 130 divides the L vectors into 3 groups based on an interval of 2, i.e., K=3. Server 130 then aggregates the vectors within each group into a single vector (i.e., one grouped vector). This aggregation can be achieved by concatenating the vectors within each group. Therefore, when the grouping interval is 2, K=3, resulting in K (3) grouped vectors, thus obtaining a K (3) vector grouping result.

[0135] When the grouping interval is 3, L1, L5, L9, L13, and L17 form one group; L2, L6, L10, L14, and L18 form another; L3, L7, L11, L15, and L19 form yet another; and L4, L8, L12, L16, and L20 form the third group. In this case, server 130 divides the L vectors into 4 groups based on an interval of 3, i.e., K=4. Server 130 then aggregates the vectors within each group into a single vector (i.e., one grouped vector). This aggregation can be achieved by concatenating the vectors within each group. Therefore, when the grouping interval is 3, K=4, resulting in K (4) grouped vectors, thus obtaining a K (4) vector grouping result.

[0136] When the grouping interval is 4, L1, L6, L11, and L16 form one group; L2, L7, L12, and L17 form another; L3, L8, L13, and L18 form a third; L4, L9, L14, and L19 form a fourth; and L5, L10, L15, and L20 form a fifth. In this case, server 130 divides the L vectors into 5 groups based on an interval of 4, i.e., K=5. Server 130 then aggregates the vectors within each group into a single vector (i.e., one grouped vector). This aggregation can be achieved by concatenating the vectors within each group. Therefore, when the grouping interval is 4, K=5, resulting in K (5) grouped vectors, thus obtaining a K (5) vector grouping result.

[0137] It should be understood that when L is a value other than 20, or when the grouping interval is another value, the server 130 can use the same method as the above grouping aggregation to group and aggregate the L vectors, which will not be listed here.

[0138] In this disclosure, when grouping based on a grouping interval, the number of vectors in each group may vary. For example, when L equals 20 and the interval is 2, two groups may each contain 7 vectors, while one group may contain only 6 vectors.

[0139] As mentioned earlier, server 130 inputs the initial feature vector map into the liveness detection model (i.e., server 130 can input L vectors from the initial feature vector map sequentially into the liveness detection model), and the initial feature vector map is processed sequentially through the attention module and feedforward network of the liveness detection model. For an initial feature vector map of length L and vector dimension D, the computational complexity of the traditional attention module is L. 2 D; This disclosure reduces the computational complexity of the attention module to L by grouping and aggregating L vectors to obtain K grouped vectors (i.e., K grouped vector results). 2 D / K reduces computational complexity by 1 / K.

[0140] In some embodiments, the number of group aggregations is 2 to 4, and the grouping intervals corresponding to each of the N aggregations are different.

[0141] Because some feature vectors are inevitably ignored during the grouping and aggregation of L vectors, affecting the accuracy of data processing, this disclosure proposes multiple grouping and aggregation operations on the L vectors (N > 1) to balance data processing efficiency and accuracy. Furthermore, to avoid obtaining the same vector grouping results during multiple aggregation operations, the server 130 can control the grouping interval for each of the N aggregation operations to be different. In this way, each aggregation operation yields a different vector grouping result. Since the grouping interval is different for each aggregation operation, when the server 130 groups the L vectors, each vector is reassigned to a new group and re-aggregated with other vectors. This rearrangement and combination ensures that the N vector grouping results have overlapping information, improving the accuracy of data processing.

[0142] Excessive grouping and aggregation can also reduce data processing efficiency, as the number of grouping and aggregation operations in this disclosure can be 2 to 4. For example, if server 130 performs two grouping and aggregation operations on the initial feature vector map, the interval for the first grouping and aggregation can be 1, 2, 3, 4, 5, or other intervals. The interval for the second grouping and aggregation can also be chosen independently, provided that it is different from the interval for the first grouping and aggregation. If server 130 performs three grouping and aggregation operations on the initial feature vector map, then the interval for each grouping and aggregation operation will be different, and the interval for grouping and aggregation can also be chosen from 1, 2, 3, 4, 5, or other intervals.

[0143] In some embodiments, inputting the grouping results of the N vectors into the attention submodule of the liveness detection model to output a first feature vector map may include:

[0144] S322, for each of the N vector grouping results:

[0145] The vector grouping results are input into the attention submodule of the liveness detection model to output grouped attention results; and

[0146] S323, sum the N group attention results to obtain the first feature vector map.

[0147] In this disclosure, server 130 inputs the N grouped vector results into the attention submodule of the liveness detection model to obtain N grouped attention results. Server 130 can sum the N grouped attention results (i.e., perform a linear transformation on the N grouped attention results) to integrate the feature information of each grouped attention result, thereby obtaining a first feature vector map.

[0148] In this disclosure, the server 130 groups and aggregates the initial feature vector map, and the feature dimension of the feature vector is not changed during the data processing using the attention submodule of the liveness detection model. The resulting first feature vector map can be used as the input of the feedforward network.

[0149] S330, based on the liveness detection model and the feature dimension D, perform M grouped full connections on the first feature vector map to obtain the grouped full connection result, where M is a natural number greater than 0.

[0150] In this disclosure, server 130 can input the first feature vector map into a feedforward network. Traditional feedforward networks perform fully connected layers on each vector in the first feature vector map according to the feature dimension D, with the structure parameters of the fully connected layer being D*D. However, in this disclosure, server 130 performs M (M is a natural number greater than 0) grouped fully connected layers on each vector in the first feature vector map according to the feature dimension D. In this case, the parameters of the fully connected layers in the feedforward network will change, depending on the grouping. For example, if D is divided into F groups, the parameters of each group's fully connected layer become (D / F)*(D / F). The input and output of each group are only compared within the D / F elements of each group, thus reducing the computational complexity of each group's fully connected layer from D... 2 Reduced to (D / F) 2 Reduced to 1 / F of the original 2 This significantly reduces the computational load, achieving the goal of lightweighting traditional feedforward networks.

[0151] In this disclosure, the number of packet full connections can be set according to specific circumstances, and the result of the previous packet full connection serves as the basis for the next packet full connection.

[0152] In some embodiments, S330 may include:

[0153] S331, for the first packet full connection in the M packet full connections, it includes:

[0154] S331-a, Based on the liveness detection model, the first feature vector map is divided into F1 groups according to the feature dimension D to obtain the first feature sub-vector map of group F1. The feature dimension of each group is D / F1, and F1 is a natural number greater than 0.

[0155] For ease of description, assume that the feature dimension D of each feature vector in the first feature vector map is 12, namely D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, and D12. The process of the server 130 performing grouped full connection is as follows: When F1=2, D1, D2, D3, D4, D5, and D6 form one group; D7, D8, D9, D10, D11, and D12 form another group. At this time, the server 130 divides the feature dimension D into two groups of first feature sub-vector maps, i.e., F1=2.

[0156] When F1=3, D1, D2, D3, and D4 form one group; D5, D6, D7, and D8 form another group; and D9, D10, D11, and D12 form yet another group. In this case, server 130 divides the feature dimension D into three groups of first feature sub-vector maps, i.e., F1=3.

[0157] When F1=4, D1, D2, and D3 form one group; D4, D5, and D6 form another group; D7, D8, and D9 form another group; and D10, D11, and D12 form yet another group. In this case, server 130 divides the feature dimension D into 4 groups of first feature sub-vector maps, i.e., F1=4.

[0158] It should be understood that F1 can also have other values, which will not be listed here.

[0159] S331-b, Based on the liveness detection model, the first feature vector map of group F1 is grouped and fully connected to obtain the second feature vector map.

[0160] In this disclosure, the server 130 divides the feature dimension D into two groups of first feature sub-vector maps when F1=2, and performs a grouped full connection on the two groups of first feature sub-vector maps as an example. The process of the first grouped full connection is as follows: Figure 6 As shown. Figure 6 As shown, the grouped full connection is performed within a group. After the grouped full connection is performed, the vector weights of each dimension in the output second feature vector map of server 130 change. The second feature vector map contains two groups of elements: one group is x1D1, x2D2, x3D3, x4D4, x5D5, x6D6; the other group is x7D7, x8D8, x9D9, x10D10, x11D11, x12D12.

[0161] S331-c, Based on the liveness detection model, the second feature vector map is grouped and shuffled to obtain the third feature vector map.

[0162] In this disclosure, after performing a grouped full connection, server 130 can shuffle the D / F1 elements of each group, causing changes to the elements of each group in the second feature vector map. This is equivalent to performing one group rearrangement to obtain a third feature vector map, where the feature dimension of the third feature vector map is D. For example... Figure 6 As shown, when F1=2, server 130 can swap the elements in odd-numbered positions within each group of the second feature vector map to obtain the third feature vector map. The third feature vector map contains two groups of elements: one group is x1D1, x8D8, x3D3, x10D10, x5D5, x12D12; the other group is x7D7, x2D2, x9D9, x4D4, x11D11, x6D6.

[0163] It should be understood that, in addition to the group rearrangement methods mentioned above, for Figure 6 The server 130 can also swap the even-numbered elements in each group of the second feature vector map shown to obtain the third feature vector map; or, the server 130 can also swap the elements in other positions in each group of the second feature vector map to obtain the third feature vector map.

[0164] In this disclosure, the third feature vector map obtained by the server 130 performing the first grouped full connection on the first feature vector map can be used as the final grouped full connection result. The server 130 can predict the target image based on the liveness detection model and the grouped full connection result to determine the liveness classification result of the target image.

[0165] Since the grouped fully connected result obtained after a single grouped fully connected layer may not accurately represent the biological features contained in the target image, it may affect the subsequent prediction results. Therefore, in order to improve prediction accuracy, in some embodiments, S330 may further include:

[0166] S332, for the second group full connection in the M-fold group full connection:

[0167] S332-a, Based on the liveness detection model, the third feature vector map is divided into F2 groups according to the feature dimension D, and the third feature sub-vector map of group F2 is obtained. The feature dimension of each group is D / F2, and F2 is a natural number greater than 0.

[0168] In this disclosure, server 130 can use the result of the first grouped full connection (i.e., the third feature vector map) as the basis for the second grouped full connection. During the second grouped full connection process, server 130 can divide the third feature vector map into F2 groups according to the feature dimension D, thereby obtaining the third feature sub-vector map of group F2, and F1 and F2 can be the same or different.

[0169] To facilitate understanding, let's take the case where F2=3, server 130 divides the feature dimension D into 3 groups of third feature sub-vector maps, and performs a grouped full connection on these 3 groups of third feature sub-vector maps as an example. The process of the second grouped full connection is as follows: Figure 7 As shown. Figure 7 As shown, in the three groups of third feature sub-vectors, each group contains elements in four dimensions: x7D7, x2D2, x9D9, and x4D4 form one group; x11D11, x6D6, x1D1, and x8D8 form another group; and x3D3, x10D10, x5D5, and x12D12 form yet another group.

[0170] S332-b, based on the liveness detection model, group the third feature vector map of group F2 into a fully connected layer to obtain the fourth feature vector map.

[0171] In this disclosure, after performing a grouped full connection, the vector weights of each dimension in the output fourth feature vector map of server 130 change. The fourth feature vector map contains three sets of elements: one set is y7D7, y2D2, y9D9, y4D4; another set is y11D11, y6D6, y1D1, y8D8; and the third set is y3D3, y10D10, y5D5, y12D12.

[0172] S332-c, Based on the liveness detection model, the fourth feature vector map is grouped and rearranged to obtain the fifth feature vector map.

[0173] In this disclosure, after performing a grouped full connection, server 130 can shuffle the D / F2 elements of each group, causing changes in the elements of each group in the fourth feature vector map. This is equivalent to performing one group rearrangement to obtain the fifth feature vector map, where the feature dimension of the fifth feature vector map is D. For example... Figure 7 As shown, server 130 can arrange all 12 elements contained in the fifth feature vector map in sequence (i.e., y7D7, y2D2, y9D9, y4D4, y11D11, y6D6, y1D1, y8D8, y3D3, y10D10, y5D5, y12D12) and then rearrange the 12 elements in groups according to the interval. Figure 7Server 130 rearranges the 12 elements into 3 groups with an interval of 2. Each group contains 4 elements: one group is y7D7, y4D4, y1D1, y10D10; another group is y2D2, y11D11, y8D8, y5D5; and the third group is y9D9, y6D6, y3D3, y12D12.

[0174] It should be understood that server 130 can also rearrange the D elements at intervals of 1, 3, 4 or other values.

[0175] It is important to note that Figure 6 The second feature vector map contains two sets of elements. Figure 7 The fourth feature vector map contains three groups of elements, but the server 130 uses different strategies to group and rearrange the second and fourth feature vector maps. This is because, for the two groups of elements in the second feature vector map, swapping odd-numbered or even-numbered elements in the same sequence position results in a one-to-one correspondence: x1D1 corresponds to x7D7, x2D2 to x8D8, x3D3 to x9D9, and so on. However, for the three groups of elements in the fourth feature vector map, swapping odd-numbered or even-numbered elements in the same sequence position does not result in a one-to-one correspondence. For example, y7D7, y11D11, and y3D3 correspond, y2D2, y6D6, and y10D10 correspond, and so on. Taking y7D7, y11D11, and y3D3 as an example, the server 130 can swap them in multiple ways. For example, server 130 can swap y7D7 with y11D11, leaving y3D3 unchanged; server 130 can also swap y11D11 with y3D3, leaving y7D7 unchanged; server 130 can also swap y7D7 with y3D3, leaving y11D11 unchanged; server 130 can also swap y11D11 with y7D7, and then swap y3D3 with y7D7 again, and so on. Similarly, the above situation will also occur when the fourth feature vector map contains 4 or more groups of elements. To address this, this disclosure uses an interval extraction of elements and regrouping to perform group rearrangement, which can reduce the complexity of group rearrangement.

[0176] In some embodiments, the M-times of group full connection is 2-3 times.

[0177] In this disclosure, since the feature information of some dimensions will inevitably be ignored during the process of grouping and fully connecting the first feature vector map, the accuracy of data processing will be affected; and performing multiple grouping and fully connecting operations will increase the amount of computation. Therefore, in order to balance data processing efficiency and accuracy, the server 130 can perform 2-3 grouping and fully connecting operations on the first feature vector map.

[0178] In some embodiments, when the server 130 performs a grouped full connection on the first feature vector map once, the result of the first grouped full connection (i.e., the third feature vector map) is the grouped full connection result.

[0179] In some embodiments, the number of times the packet full connection is determined is 2, and the fifth feature vector map is determined as the result of the packet full connection. That is, when the server 130 performs two packet full connections on the first feature vector map, the result of the second packet full connection (i.e., the fifth feature vector map) is the result of the packet full connection.

[0180] In some embodiments, when the server 130 performs three grouped full connections on the first feature vector map, the server 130 continues to use the result of the second grouped full connection (i.e., the fifth feature vector map) as the basis for the third grouped full connection. After grouping and grouped full connections, the sixth feature vector map is obtained. After the sixth feature vector map is rearranged by grouping, the seventh feature vector map is obtained. The seventh feature vector map is the result of the third grouped full connection and is also the result of the grouped full connection.

[0181] S340, determine the liveness classification result of the target image based on the liveness detection model and the grouped fully connected result.

[0182] In this disclosure, after obtaining the grouped fully connected results, the server 130 can determine the liveness classification result of the target image based on the liveness detection model and the grouped fully connected results.

[0183] In some embodiments, S340 may include:

[0184] S341, Based on the liveness detection model, predict the grouped fully connected results to obtain the attack probability of the target image; and

[0185] S342, determine the liveness classification result of the target image based on the attack probability, wherein the liveness classification result includes live samples and attack samples.

[0186] In this disclosure, the process by which server 130 predicts the grouped fully connected network results based on a liveness detection model can be as follows: Server 130 maps the grouped fully connected network results to two different neurons (one neuron corresponds to the liveness label and can be called the liveness neuron; the other neuron corresponds to the attack label and can be called the attack neuron) for calculation, obtaining the weight ratio of each of the two neurons. The weight ratio of each of the two neurons corresponds to the attack probability of the target image. Based on the attack probability, server 130 can determine the liveness classification result of the target image, that is, determine whether the target image is a live sample or an attack sample.

[0187] In some embodiments, S342 may include:

[0188] S342-a, obtain the preset probability threshold;

[0189] S342-b, compare the attack probability with the probability threshold to obtain a comparison result; and

[0190] S342-c, Based on the comparison results, determine the liveness classification result of the target image.

[0191] In this disclosure, server 130 can preset probability thresholds for live neurons and attack neurons, namely, a live probability threshold and an attack probability threshold. Accordingly, after mapping the grouped fully connected result to live neurons and attack neurons, server 130 can obtain the weight ratios of the two neurons, namely, the live weight and the attack weight, wherein the sum of the live weight and the attack weight is 100%.

[0192] Server 130 can compare the liveness weight with the liveness probability threshold and determine whether the target image is a live sample based on the comparison result. When the liveness weight is greater than the liveness probability threshold, server 130 can determine that the target image is a live sample.

[0193] Server 130 can also compare the attack weight with the attack probability threshold and determine whether the target image is a live sample based on the comparison result. When the attack weight is less than the attack probability threshold, server 130 can determine that the target image is a live sample.

[0194] In summary, this disclosure preprocesses the input target image to obtain an initial feature vector map based on the characteristics of the Transformer model input; then, it performs N grouping and aggregation on the initial feature vector map to improve the data processing efficiency of the attention mechanism in the Transformer model; and further reduces the computational load and improves the data processing efficiency by using grouped full connection and group shuffle in the feedforward network of the Transformer model.

[0195] Compared to traditional server-side liveness detection methods based on complex models (such as Transformer, ResNet50, etc.), the liveness detection method provided in this disclosure can directly deploy the computational model on the terminal device, eliminating the need for deployment on a cloud server. Therefore, it can operate stably in environments with no network or varying network conditions. Compared to traditional client-side liveness detection methods based on lightweight models (such as ShuffleNet, MobileNet, etc.), the liveness detection method provided in this disclosure is based on a large-scale network model, offering strong computational power and high accuracy in liveness detection. Therefore, the liveness detection method provided in this disclosure can balance both accuracy and efficiency in liveness detection.

[0196] In some embodiments, the liveness detection method 300 provided in this disclosure further includes a training process 400 for a liveness detection model, such as... Figure 8 As shown, the training process 400 for the liveness detection model may include:

[0197] S410: Obtain an initial feature vector map of the target image, wherein the initial feature vector map includes L vectors, where L is a natural number greater than 0. In this disclosure, the processing method of S410 is the same as that of S310.

[0198] S420, based on the preset liveness detection model, the L vectors are grouped and aggregated N times to obtain a first feature vector map, and the preset liveness detection model is trained based on the first feature vector map to obtain a transitional liveness detection model, wherein the feature dimension of the first feature vector map is D, and N and D are natural numbers greater than 0.

[0199] In this disclosure, the training process of the liveness detection model includes two parts: training of the attention submodule based on group aggregation and training of the feedforward network based on group full connectivity. Server 130 first trains the attention submodule based on group aggregation to obtain an intermediate liveness detection model; then, based on the intermediate liveness detection model, it trains the feedforward network based on group full connectivity to obtain the trained liveness detection model. That is, during the training of the attention submodule based on group aggregation, the structure of the feedforward network remains unchanged, following the normal parameter structure and performing full connectivity without modification; that is, M rounds of group full connectivity are not executed. After server 130 completes the training of the attention submodule based on group aggregation to obtain the intermediate liveness detection model, it then trains the feedforward network based on group full connectivity.

[0200] In some embodiments, S420 may include:

[0201] S421, Based on the preset liveness detection model, the L vectors are grouped and aggregated N times to obtain N vector grouping results.

[0202] S422, the grouping results of the N vectors are input into the attention submodule of the liveness detection model to output a first feature vector map, wherein the feature dimension of the first feature vector map is D, and N is a natural number greater than 0. In this disclosure, the processing methods of S421 and S422 are the same as those of S320.

[0203] S423, determine the first liveness classification prediction result of the target image based on the first feature vector map. In this disclosure, after obtaining the first feature vector map, the server 130 can classify the target image based on the first feature vector map to obtain the first liveness classification prediction result. The first liveness prediction classification result may include either a live sample or an attack sample. There are various ways to classify the target image based on the first feature vector map. For example, the server 130 can input the first feature vector map into a feedforward network to obtain a fully connected result, and then map the fully connected result to two different neurons (a live neuron and an attack neuron) for binary classification calculation to determine the first liveness classification prediction result of the target image. There are various ways to map the fully connected result, such as using a softmax (a classification function) classifier or other types of classifiers for classification mapping, etc.

[0204] S424, based on the first liveness prediction result, the preset liveness detection model is converged to obtain the transitional liveness detection model.

[0205] In some embodiments, S424 may include:

[0206] S424-a, Obtain the original labeled image category of the target image. In this disclosure, the original labeled image category can be understood as the image category pre-labeled on the target image, or as the original label of the target image. The original labeled image category may include either a live sample or an attack sample.

[0207] In this disclosure, the server 130 can obtain the original labeled image category in several ways. For example, the server 130 can obtain the original label corresponding to the target image and use the original label as the original labeled image category; or the server 130 can send the target image to the labeling server and receive the original labeled image category of the target image returned by the labeling server.

[0208] S424-b, the original labeled image category is compared with the first liveness classification prediction result to obtain first liveness classification loss information. In this disclosure, after obtaining the original labeled image category of the target image, the server 130 can compare the original labeled image category with the first liveness classification prediction result to obtain first liveness classification loss information. The first liveness classification loss information can be understood as the loss information formed by the difference between the original labeled image category and the predicted first liveness classification result. The server 130 can compare the original labeled image category with the first liveness classification prediction result in various ways. For example, the server 130 can use a classification loss function to determine the classification difference between the original labeled image category and the first liveness classification prediction result to obtain the first liveness classification loss information. The type of the first liveness classification loss function can be various, such as the cross-entropy loss function or other loss functions that can be used to determine the first liveness classification loss information, etc.

[0209] S424-c, the preset liveness detection model is converged based on the first liveness classification loss information to obtain the transitional liveness detection model. In this disclosure, server 130 can converge the attention submodule based on group aggregation in the preset liveness detection model based on the first liveness classification loss information to obtain the transitional liveness detection model. Server 130 can converge the attention submodule based on group aggregation in the preset liveness detection model using various methods based on the first liveness classification loss information. For example, server 130 can use a gradient descent algorithm to update the network parameters of the attention submodule based on group aggregation based on the first liveness classification loss information, and then return to execute S421, S422, and S423 until the attention submodule based on group aggregation in the preset liveness detection model converges, thereby obtaining the transitional liveness detection model. Alternatively, server 130 can use other parameter update algorithms to update the network parameters of the attention submodule based on group aggregation based on the first liveness classification loss information. Then, it returns to execute S421, S422 and S423 until the attention submodule based on group aggregation in the preset liveness detection model converges, thereby obtaining the transitional liveness detection model, and so on.

[0210] S430, based on the transitional liveness detection model and the feature dimension D, perform M grouped fully connected operations on the first feature vector map to obtain the grouped fully connected results, and train the transitional liveness detection model based on the grouped fully connected results to obtain the trained liveness detection model.

[0211] In some embodiments, the transitional liveness detection model is trained based on the grouped fully connected results to obtain a trained liveness detection model, including:

[0212] S431, based on the transitional liveness detection model, the grouped fully connected network result is predicted to determine the second liveness classification prediction result of the target image. In this disclosure, after obtaining the grouped fully connected network result, the server 130 can classify the target image based on the grouped fully connected network result to obtain the second liveness classification prediction result. The second liveness prediction classification result may include either a live sample or an attack sample. There are various ways to classify the target image based on the grouped fully connected network result. For example, the server 130 can map the grouped fully connected network result to two different neurons (live neuron and attack neuron) for binary classification calculation to determine the second liveness classification prediction result of the target image. There are various ways to map the grouped fully connected network result. For example, a softmax (a classification function) classifier or other types of classifiers can be used for classification mapping, etc.

[0213] S432, based on the second liveness prediction result, the transitional liveness detection model is converged to obtain the trained liveness detection model.

[0214] In some embodiments, S432 may include:

[0215] S432-a, obtain the original labeled image category of the target image.

[0216] S432-b, the original labeled image category is compared with the second liveness classification prediction result to obtain the second liveness classification loss information. In this disclosure, the server 130 can converge the pre-set liveness detection model based on the grouped fully connected feedforward network based on the second liveness classification loss information to obtain the trained liveness detection model. Specifically, after obtaining the original labeled image category of the target image, the server 130 can compare the original labeled image category with the second liveness classification prediction result to obtain the second liveness classification loss information. The second liveness classification loss information can be understood as the loss information formed by the difference between the original labeled image category and the predicted second liveness classification prediction result. The server 130 can compare the original labeled image category with the second liveness classification prediction result in various ways. For example, the server 130 can use a classification loss function to determine the classification difference between the original labeled image category and the second liveness classification prediction result to obtain the first liveness classification loss information. The type of the second liveness classification loss function can be various, such as the cross-entropy loss function or other loss functions that can be used to determine the second liveness classification loss information, etc.

[0217] S432-c, the transitional liveness detection model is converged based on the second liveness classification loss information to obtain the trained liveness detection model. In this disclosure, the server 130 can use various methods to converge the feedforward network based on grouped full connectivity in the preset liveness detection model based on the second liveness classification loss information. For example, the server 130 can use a gradient descent algorithm to update the parameters of the feedforward network based on grouped full connectivity based on the second liveness classification loss information, and then return to execute S421, S422, and S423 until the attention submodule based on grouped aggregation in the preset liveness detection model converges, thereby obtaining the transitional liveness detection model. Alternatively, the server 130 can also use other parameter update algorithms to update the network parameters of the attention submodule based on grouped aggregation based on the first liveness classification loss information, and then return to execute S431 until the feedforward network based on grouped full connectivity in the preset liveness detection model converges, thereby obtaining the trained liveness detection model, and so on.

[0218] In some embodiments, the liveness detection method 300 provided in this disclosure further includes a training process 500 for an image preprocessing model, such as... Figure 9 As shown, the training process 500 of the image preprocessing model may include:

[0219] S510, Obtain the target image. In this disclosure, the processing method of S510 is the same as that of S311.

[0220] S520: Based on a preset image preprocessing model, feature extraction is performed on the target image to obtain a feature map of the target image. In this disclosure, the processing method of S520 is the same as that of S312.

[0221] S530, the preset image preprocessing model is trained based on the feature map to obtain the trained image preprocessing model.

[0222] In some embodiments, S530 may include:

[0223] S531, Based on the preset image preprocessing model and the feature map, the target image is classified and predicted to obtain a third liveness classification prediction result.

[0224] In this disclosure, the model structure of the image preprocessing model is as follows: Figure 10 As shown, the image preprocessing model consists of two parts: a feature extraction module and a prediction module. After the server 130 inputs the target image into the image preprocessing model, it first uses the feature extraction module to extract features from the target image and outputs a feature map; then, it uses the prediction module to perform classification prediction on the feature map to obtain a third liveness classification prediction result. The third liveness prediction classification result can include either a live sample or an attack sample.

[0225] In this disclosure, there are various ways to classify and predict target images based on feature maps. For example, server 130 can input the feature map into the prediction module for binary classification calculation to determine the third liveness classification prediction result of the target image. The aforementioned method of inputting the feature map into the prediction module for binary classification calculation can be varied. For example, a softmax classifier (a classification function) or other types of classifiers can be used for classification mapping, etc.

[0226] S532, based on the third liveness classification prediction result, the preset image preprocessing model is converged to obtain the trained image preprocessing model.

[0227] In some embodiments, S532 may include:

[0228] S532-a: Obtain the original labeled image category of the target image. In this disclosure, the processing method of S532-a is the same as that of S424-a and S432-a.

[0229] S532-b, compare the original labeled image category with the third liveness classification prediction result to obtain the third liveness classification loss information.

[0230] In this disclosure, server 130 can converge a pre-defined image preprocessing model based on third-party liveness classification loss information to obtain a trained image preprocessing model. Specifically, after obtaining the original labeled image category of the target image, server 130 compares the original labeled image category with the third-party liveness classification prediction result to obtain the third-party liveness classification loss information. The third-party liveness classification loss information can be understood as the loss information formed by the difference between the original labeled image category and the predicted third-party liveness classification result. The third-party liveness classification loss information is used to constrain the third-party liveness classification prediction result predicted by the image preprocessing model to maintain consistency with the original labeled image category.

[0231] In this disclosure, the server 130 can compare the original labeled image category with the third liveness classification prediction result in various ways. For example, the server 130 can use a classification loss function to determine the classification difference between the original labeled image category and the third liveness classification prediction result, thereby obtaining the third liveness classification loss information. The third liveness classification loss function can be of various types, such as the cross-entropy loss function or other loss functions that can be used to determine the third liveness classification loss information, etc.

[0232] S532-c, based on the third liveness classification loss information, the preset image preprocessing model is converged to obtain the trained preset image preprocessing model.

[0233] In this disclosure, the server 130 can converge the preset image preprocessing model based on the third liveness classification loss information in several ways. For example, the server 130 can use a gradient descent algorithm to update the network parameters of the preset image preprocessing model based on the third liveness classification loss information, and then return to execute S510, S520, and S530 until the preset liveness image preprocessing model converges, thereby obtaining the trained image preprocessing model. Alternatively, the server 130 can also use other parameter update algorithms to update the network parameters of the preset image preprocessing model based on the third liveness classification loss information, and then return to execute S510, S52, and S530 until the preset image preprocessing model converges, thereby obtaining the trained image preprocessing model, and so on.

[0234] 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 disclosure is intended to encompass various reasonable changes, improvements, and modifications to the embodiments. These changes, improvements, and modifications are intended to be made by this disclosure and are within the spirit and scope of the exemplary embodiments of this disclosure.

[0235] Furthermore, certain terms used in this disclosure have been used to describe embodiments of this disclosure. 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 disclosure. 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 disclosure 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 disclosure.

[0236] It should be understood that in the foregoing description of the embodiments of this disclosure, various features are sometimes combined in a single embodiment, drawing, or description for the purpose of simplifying the disclosure and to aid in understanding a feature. Alternatively, various features may be distributed across multiple embodiments of this disclosure. However, this does not mean that the combination of these features is necessary, and those skilled in the art may extract some features as separate embodiments when reading this disclosure. That is, the embodiments in this disclosure can also be understood as an integration of multiple sub-embodiments. It is also possible for each sub-embodiment to contain fewer features than all of the features of a single foregoing disclosed embodiment.

Claims

1. A live detection method, comprising: obtaining an initial feature vector map of a target image, the initial feature vector map comprising L vectors, L being a positive integer; obtaining N vector grouping results by performing N different grouping aggregations on the L vectors based on a live detection model, and inputting the N vector grouping results into an attention sub-module of the live detection model respectively to output a first feature vector map, wherein a feature dimension of the first feature vector map is D, N and D are positive integers, and each grouping aggregation comprises: dividing the L vectors into multiple groups, and aggregating vectors in each group into a group vector; obtaining a grouping fully connected result by performing M times of grouping fully connection on the first feature vector map according to the feature dimension D based on the live detection model, M being a positive integer; and determining a live classification result of the target image based on the live detection model and the grouping fully connected result.

2. The living body detecting method according to claim 1, wherein The obtaining of the initial feature vector map of the target image comprises: obtaining a target image, the target image comprising a biological feature of a user; determining a feature atlas of the target image by performing feature extraction on the target image based on an image preprocessing model, the feature atlas comprising information that the biological feature is from a live body or an attack; and determining the initial feature vector map based on the feature atlas.

3. The living body detecting method according to claim 2, wherein The determining of the initial feature vector map based on the feature atlas comprises: performing feature remodeling on the feature atlas to obtain the initial feature vector map.

4. The living body detecting method according to claim 1, wherein The each grouping aggregation further comprises: grouping the L vectors based on a grouping interval to obtain K groups of vectors, the grouping interval and K being natural numbers greater than 0; and aggregating vectors contained in each of the K groups of vectors to obtain K group vectors, and taking the K group vectors as one of the vector grouping results.

5. The vital signs detection method of claim 4, wherein, The number of times of the grouping aggregation is 2-4, and the grouping interval corresponding to each of the N times of grouping aggregation is different.

6. The vital signs detection method of claim 1, wherein, The inputting of the N vector grouping results into the attention sub-module of the live detection model to output the first feature vector map comprises: for each of the N vector grouping results: inputting the vector grouping result into the attention sub-module of the live detection model to output a grouping attention result; and summing N grouping attention results to obtain the first feature vector map.

7. The vital signs detection method of claim 1, wherein, The performing of M times of grouping fully connection on the first feature vector map according to the feature dimension D based on the live detection model comprises: for the first time of grouping fully connection in the M times of grouping fully connection: dividing the first feature vector map into F1 groups according to the feature dimension D based on the live detection model to obtain F1 groups of first feature sub-vector maps, F1 being a natural number greater than 0; performing grouping fully connection on the F1 groups of first feature sub-vector maps based on the live detection model to obtain a second feature vector map; and performing grouping rearrangement on the second feature vector map based on the live detection model to obtain a third feature vector map.

8. The vital signs detection method of claim 7, wherein, The M times of grouping full connection based on the living body detection model and the first feature vector graph according to the feature dimension D, comprising: For the second time of grouping full connection in the M times of grouping full connection: Based on the living body detection model, the third feature vector graph is divided into F2 groups according to the feature dimension D, and F2 third feature subvector graphs are obtained, F2 is a natural number greater than 0; Based on the living body detection model, the F2 third feature subvector graphs are grouped and fully connected to obtain a fourth feature vector graph; and Based on the living body detection model, the fourth feature vector graph is grouped and rearranged to obtain a fifth feature vector graph.

9. The vital signs detection method of claim 8, wherein, The M times of grouping full connection are 2-3 times; and / or The number of times of grouping full connection is determined to be 2 times, and the fifth feature vector graph is determined to be the grouping full connection result.

10. The vital signs detection method of claim 1, wherein, The living body classification result of the target image is determined based on the living body detection model and the grouping full connection result, comprising: Based on the living body detection model, the grouping full connection result is predicted to obtain the attack probability of the target image; and Based on the attack probability, the living body classification result of the target image is determined, which includes living body samples and attack samples.

11. The vital signs detection method of claim 10, wherein, The living body classification result of the target image is determined based on the attack probability, comprising: A preset probability threshold is obtained; The attack probability is compared with the probability threshold to obtain a comparison result; and The living body classification result of the target image is determined based on the comparison result.

12. The vital signs detection method of claim 1, wherein, The training process of the living body detection model, comprising: An initial feature vector graph of a target image is obtained, the initial feature vector graph includes L vectors, L is a natural number greater than 0; Based on a preset living body detection model, the L vectors are grouped and aggregated N times to obtain a first feature vector graph, and the preset living body detection model is trained based on the first feature vector graph to obtain a transition living body detection model, wherein the feature dimension of the first feature vector graph is D, N and D are natural numbers greater than 0; and Based on the transition living body detection model, the first feature vector graph is grouped and fully connected M times according to the feature dimension D to obtain a grouping full connection result, and the transition living body detection model is trained based on the grouping full connection result to obtain a trained living body detection model.

13. The vital signs detection method of claim 12, wherein, The first feature vector graph is obtained by grouping and aggregating the L vectors N times based on the preset living body detection model, and the preset living body detection model is trained based on the first feature vector graph to obtain a transition living body detection model, comprising: The L vectors are grouped and aggregated N times based on the preset living body detection model to obtain N vector grouping results; The N vector grouping results are respectively input into the attention sub module of the living body detection model to output a first feature vector graph, wherein the feature dimension of the first feature vector graph is D, and the N is a natural number greater than 0; Based on the first feature vector graph, the first living body classification prediction result of the target image is determined; and converge the preset live body detection model based on the first live body prediction result to obtain the transition live body detection model.

14. The vital signs detection method of claim 13, wherein, The converging the preset live body detection model based on the first live body prediction result to obtain the transition live body detection model comprises: obtaining a raw annotation image category of the target image; comparing the raw annotation image category with the first live body classification prediction result to obtain a first live body classification loss information; and converging the preset live body detection model based on the first live body classification loss information to obtain the transition live body detection model.

15. The vital sign detection method of Claim 12, wherein, The training the transition live body detection model based on the grouped full connection result to obtain a trained live body detection model comprises: predicting the grouped full connection result based on the transition live body detection model to determine a second live body classification prediction result of the target image; and converging the transition live body detection model based on the second live body prediction result to obtain the trained live body detection model.

16. The vital signs detection method of claim 15, wherein, The converging the transition live body detection model based on the second live body prediction result to obtain the trained live body detection model comprises: obtaining a raw annotation image category of the target image; comparing the raw annotation image category with the second live body classification prediction result to obtain a second live body classification loss information; and converging the transition live body detection model based on the second live body classification loss information to obtain the trained live body detection model.

17. The vital sign detection method of Claim 2, wherein, The training process of the image preprocessing model comprises: obtaining a target image; extracting features of the target image based on a preset image preprocessing model to obtain a feature map of the target image; and training the preset image preprocessing model based on the feature map to obtain a trained image preprocessing model.

18. The vital signs detection method of claim 17, wherein, The training the preset image preprocessing model based on the feature map to obtain the trained image preprocessing model comprises: classifying the target image based on the preset image preprocessing model and the feature map to obtain a third live body classification prediction result; and converging the preset image preprocessing model based on the third live body classification prediction result to obtain the trained image preprocessing model.

19. The vital signs detection method of claim 18, wherein, The converging the preset image preprocessing model based on the third live body classification prediction result to obtain the trained image preprocessing model comprises: obtaining a raw annotation image category of the target image; comparing the raw annotation image category with the third live body classification prediction result to obtain a third live body classification loss information; and converging the preset image preprocessing model based on the third live body classification loss information to obtain the trained image preprocessing model.

20. A live body detection system, comprising: at least one storage medium comprising at least one instruction set for implementing analysis of a live body detection method; and at least one processor in communication connection with the at least one storage medium, wherein, when the system is in operation, the at least one processor reads the at least one instruction set and performs the method of any one of claims 1-19 as directed by the at least one instruction set.

Citation Information

Patent Citations

  • Universal image target detection method and device based on self-attention mechanism

    CN113902926A