Live detection method, apparatus, device, and storage medium
Patent Information
- Application Number
- CN202310340248.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-27
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2043-03-27
AI Technical Summary
[0004]本说明书的主要目的在于提供一种活体检测方法、装置、设备与存储介质,旨在解决现有活体检测方法灵活性低,无法适应不同的场景要求的问题
[0072]在本说明书实施例中,通过采集目标检测对象针对刷脸事务的场景图像,基于场景图像,确认场景图像的场景时效分类结果,基于场景时效分类结果,确认目标检测对象的目标认证动作,生成认证交互信息用于指示目标检测对象做出目标认证动作,获取目标检测对象做出目标认证动作的认证动作图像,基于认证动作图像,生成目标检测对象的活体检测结果。通过分析当前场景对于时效的要求,根据场景对于时效的要求高低,来选择目标交互动作,然后根据目标检测对象做出目标认证动作的认证动作图像进行活体检测,从而能够根据场景的不同灵活地进行活体检测,保障刷脸事务的安全性。
Smart Images

Figure CN116416688B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for detecting liveness. Background Technology
[0002] While facial recognition technology brings convenience to people's lives and work, it also introduces additional risks. A typical example is liveness detection, which involves attempts to impersonate a user using photos, mobile phones, or other media. Liveness detection is currently the most threatening security vulnerability facing facial recognition systems. The solution to this problem is usually called liveness detection, which aims to determine whether the acquired biometric features belong to a living, present, and real person.
[0003] Several liveness detection methods have been proposed to address existing liveness attack incidents. Currently, achieving a good trade-off between security and user experience remains a challenge for liveness detection. Summary of the Invention
[0004] The main purpose of this specification is to provide a method, apparatus, device, and storage medium for liveness detection, aiming to solve the problem that existing liveness detection methods are inflexible and unable to adapt to different scenario requirements. The technical solution is as follows:
[0005] Firstly, embodiments of this specification provide a method for detecting liveness, including:
[0006] Collect scene images of the target detection object for facial recognition transactions;
[0007] Based on the scene image, confirm the scene timeliness classification result of the scene image;
[0008] Based on the scenario timeliness classification results, the target authentication action of the target detection object is confirmed, and authentication interaction information is generated to instruct the target detection object to perform the target authentication action.
[0009] Obtain the authentication action image of the target detection object performing the target authentication action;
[0010] Based on the authentication action image, a liveness detection result for the target object is generated.
[0011] Secondly, embodiments of this specification provide a method for training a scene state awareness model, including:
[0012] Initialize the first initial structural parameters in the scene state awareness model;
[0013] Acquire a sample scene image containing the sample detection object, the sample scene image being labeled with a crowd density tag and an image timeliness requirement tag;
[0014] The sample scene image is input into the basic feature encoding module, which outputs the sample scene feature map;
[0015] Input the sample scene feature map into the crowding level module and output the crowding level result of the sample people;
[0016] The sample crowding results and the sample scene feature map are input into the timeliness perception module, and the sample timeliness classification results are output.
[0017] The crowding results of the sample individuals and the crowding loss values corresponding to the crowding labels of the individuals are calculated based on the crowding loss function.
[0018] The timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image are calculated based on the timeliness classification loss function.
[0019] The first initial structural parameters are adjusted based on the crowding loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters.
[0020] Thirdly, embodiments of this specification provide a training method for an action selection model, including:
[0021] The initialization action selects the fifth initial structural parameter in the model;
[0022] Obtain sample human body segmentation results, sample human body counting results, and sample timeliness classification results corresponding to sample scene images containing sample detection objects, wherein the sample scene images are labeled with the preferred authentication action tags of the sample detection objects;
[0023] The sample human body segmentation result, the sample human figure count result, and the sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample human figure count result feature, and sample timeliness classification result feature;
[0024] The sample human body segmentation result features, sample human body counting result features, and sample timeliness classification result features are input into the action classification module, and the sample authentication action of the sample detection object is output.
[0025] Calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function;
[0026] The fifth initial structural parameter is adjusted based on the action classification loss value to obtain the fifth target structural parameter, and the trained action selection model is generated based on the fifth target structural parameter.
[0027] Fourthly, embodiments of this specification provide a method for training a liveness detection model, including:
[0028] Initialize the sixth initial structural parameter in the liveness detection model;
[0029] Obtain a sample authentication action image of the sample detection object, wherein the sample authentication action image is labeled with the sample identity tag of the sample detection object;
[0030] The sample authentication action image is input into the basic feature encoder, and the sample authentication action features are output.
[0031] The sample authentication action features are input into the future action prediction module, and the sample predicted authentication action features are output.
[0032] Calculate the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features;
[0033] The sample residual features and the sample authentication action features are input into the differential liveness classification module, and the sample liveness detection results are output.
[0034] Calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function;
[0035] The liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label are calculated based on the liveness detection loss function;
[0036] The sixth initial structural parameter is adjusted based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and the trained liveness detection model is generated based on the sixth target structural parameter.
[0037] Fifthly, embodiments of this specification provide a liveness detection device, comprising:
[0038] The first acquisition module is used to acquire scene images of the target detection object for face recognition transactions;
[0039] The scene classification module is used to confirm the scene timeliness classification result based on the scene image;
[0040] The authentication action confirmation module is used to confirm the target authentication action of the target detection object based on the scenario timeliness classification result; and to generate authentication interaction information to instruct the target detection object to perform the target authentication action.
[0041] The second acquisition module is used to acquire an image of the authentication action performed by the target detection object.
[0042] The result generation module is used to generate a liveness detection result for the target detection object based on the authentication action image.
[0043] Sixthly, embodiments of this specification provide a liveness detection device, comprising:
[0044] The first parameter setting module is used to initialize the first initial structural parameters in the scene state perception model.
[0045] The first sample acquisition module is used to acquire a sample scene image containing the sample detection object. The sample scene image is labeled with a crowding level label and an image timeliness requirement label.
[0046] The first feature extraction module is used to input the sample scene image into the basic feature encoding module and output the sample scene feature map;
[0047] The crowding detection module is used to input the sample scene feature map into the people crowding module and output the sample people crowding result;
[0048] The timeliness perception module is used to input the sample crowding degree result and the sample scene feature map into the timeliness perception module, and output the sample timeliness classification result.
[0049] The crowding loss calculation module is used to calculate the crowding result of the sample person and the crowding loss value corresponding to the crowding label of the person based on the crowding loss function;
[0050] The timeliness classification loss calculation module is used to calculate the timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image based on the timeliness classification loss function.
[0051] The first training module is used to adjust the first initial structural parameters based on the crowding loss value, the character counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and to generate the trained scene state perception model based on the first target structural parameters.
[0052] Seventhly, embodiments of this specification provide a liveness detection device, comprising:
[0053] The second parameter setting module is used to initialize the fifth initial structure parameter in the action selection model;
[0054] The second sample acquisition module is used to acquire the sample human body segmentation result, sample human body counting result and sample time classification result corresponding to the sample image containing the sample detection object. The sample scene image is labeled with the preferred authentication action tag of the sample detection object.
[0055] The second feature extraction module is used to input the sample human body segmentation result, the sample human body counting result, and the sample timeliness classification result into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample human body counting result feature, and sample timeliness classification result feature;
[0056] The authentication action prediction module is used to input the sample human body segmentation result features, sample person counting result features and sample time classification result features into the action classification module, and output the sample authentication action of the sample detection object.
[0057] The action classification loss calculation module is used to calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function.
[0058] The second training module is used to adjust the fifth initial structural parameter based on the action classification loss value to obtain the fifth target structural parameter, and to generate the trained action selection model based on the fifth target structural parameter.
[0059] Eighthly, embodiments of this specification provide a liveness detection device, comprising:
[0060] The third parameter setting module is used to initialize the sixth initial structural parameter in the liveness detection model;
[0061] The third sample acquisition module is used to acquire a sample authentication action image of the sample detection object, wherein the sample authentication action image is labeled with the sample identity tag of the sample detection object.
[0062] The third feature extraction module is used to input the sample authentication action image into the basic feature encoder and output the sample authentication action features.
[0063] The future action prediction module is used to input the sample authentication action features into the future action prediction module and output the sample predicted authentication action features.
[0064] The residual calculation module is used to calculate the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features;
[0065] The sample result generation module is used to input the sample residual features and the sample authentication action features into the differential liveness classification module and output the sample liveness detection results.
[0066] The future feature prediction loss calculation module is used to calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function;
[0067] The liveness detection loss calculation module is used to calculate the liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label based on the liveness detection loss function;
[0068] The third training module is used to adjust the sixth initial structural parameters based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameters, and to generate the trained liveness detection model based on the sixth target structural parameters.
[0069] Ninthly, embodiments of this specification provide an electronic device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method described above.
[0070] In a tenth aspect, embodiments of this specification provide a storage medium storing a computer program, wherein the liveness detection program, when executed by a processor, implements the steps of the method described above.
[0071] Eleventhly, embodiments of this specification provide a computer program product, including: a computer program that, when executed by a processor of an electronic device, enables the processor to at least implement the methods described in the first to fourth aspects.
[0072] In the embodiments of this specification, scene images of the target detection object for facial recognition transactions are acquired. Based on the scene images, the scene timeliness classification result of the scene images is confirmed. Based on the scene timeliness classification result, the target authentication action of the target detection object is confirmed, and authentication interaction information is generated to instruct the target detection object to perform the target authentication action. The authentication action image of the target detection object performing the target authentication action is obtained, and based on the authentication action image, the liveness detection result of the target detection object is generated. By analyzing the timeliness requirements of the current scene, the target interaction action is selected according to the level of timeliness requirements of the scene. Then, liveness detection is performed based on the authentication action image of the target detection object performing the target authentication action. This allows for flexible liveness detection according to different scenes, ensuring the security of facial recognition transactions. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0074] Figure 1This is a schematic diagram illustrating an example of a liveness detection method provided in the embodiments of this specification;
[0075] Figure 2 This is a schematic flowchart of a liveness detection method provided in the embodiments of this specification;
[0076] Figure 3 This is a schematic flowchart of a liveness detection method provided in the embodiments of this specification;
[0077] Figure 4 This is a schematic flowchart of a liveness detection method provided in the embodiments of this specification;
[0078] Figure 5 This is a schematic flowchart of a liveness detection method provided in the embodiments of this specification;
[0079] Figure 6 This is a schematic diagram of the training process of a liveness detection model provided in the embodiments of this specification;
[0080] Figure 7 This is a schematic diagram of the training process of a liveness detection model provided in the embodiments of this specification;
[0081] Figure 8 This is a schematic diagram of the training process of a liveness detection model provided in the embodiments of this specification;
[0082] Figure 9 This is a schematic diagram of the training process of a liveness detection model provided in the embodiments of this specification;
[0083] Figure 10 This is a schematic diagram of the structure of a liveness detection device provided in the embodiments of this specification;
[0084] Figure 11 This is a schematic diagram of the structure of a liveness detection device provided in the embodiments of this specification;
[0085] Figure 12 This is a schematic diagram of the structure of a liveness detection device provided in the embodiments of this specification;
[0086] Figure 13 This is a schematic diagram of the structure of a liveness detection device provided in the embodiments of this specification;
[0087] Figure 14 This is a schematic diagram of the structure of an electronic device provided in the embodiments of this specification. Detailed Implementation
[0088] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0089] Furthermore, it should be noted that the acquisition, storage, use, and processing of data involved in the embodiments of this specification, such as face recognition and liveness detection, all comply with the relevant provisions of national laws and regulations.
[0090] The liveness detection device can be a terminal device such as a mobile phone, computer, tablet, smartwatch, or in-vehicle device, or it can be a module in the terminal device used to implement the liveness detection method. The liveness detection device can collect scene images of the target detection object for face recognition transactions, confirm the scene timeliness classification result of the scene image based on the scene timeliness classification result, confirm the target authentication action of the target detection object based on the scene timeliness classification result, generate authentication interaction information to instruct the target detection object to perform the target authentication action, obtain the authentication action image of the target detection object performing the target authentication action, and generate the liveness detection result of the target detection object based on the authentication action image.
[0091] Correspondingly, the liveness detection device can train the liveness detection model. The liveness detection model initializes the sixth initial structural parameter, acquires the sample authentication action image of the sample detection object (annotated with the sample identity label), inputs the sample authentication action image into the basic feature encoder, outputs the sample authentication action features, inputs the sample authentication action features into the future action prediction module, outputs the sample predicted authentication action features, calculates the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features, inputs the sample residual features and the sample authentication action features into the differential liveness classification module, outputs the sample liveness detection result, calculates the future feature prediction loss value corresponding to the sample authentication action features and the predicted authentication action features based on the future feature prediction loss function, calculates the liveness detection loss value corresponding to the sample liveness detection result and the sample identity label based on the liveness detection loss function, adjusts the sixth initial structural parameter based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and generates the trained liveness detection model based on the sixth target structural parameter.
[0092] Furthermore, the liveness detection device can train a liveness detection model. The liveness detection model includes an action selection model. By initializing the fifth initial structural parameter in the action selection model, it obtains the sample human body segmentation result, sample person count result, and sample timeliness classification result corresponding to the sample scene image containing the sample detection object. The sample scene image is labeled with the preferred authentication action tag of the sample detection object. The sample human body segmentation result, sample person count result, and sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result features, sample person count result features, and sample timeliness classification result features. These features are then input into the action classification module, which outputs the sample authentication action of the sample detection object. Based on the action classification loss function, the action classification loss value corresponding to the sample authentication action and the preferred authentication action tag is calculated. The fifth initial structural parameter is adjusted based on the action classification loss value to obtain the fifth target structural parameter. The trained action selection model is then generated based on the fifth target structural parameter.
[0093] Furthermore, the liveness detection device can also train a liveness detection model. The liveness detection model includes a scene state perception model. By initializing the first initial structural parameters in the scene state perception model, sample scene images containing the sample detection objects are obtained. These sample scene images are labeled with crowding level and timeliness requirement labels. The sample scene images are input into a basic feature encoding module, which outputs a sample scene feature map. The sample scene feature map is input into a crowding level module, which outputs a crowding level result. The crowding level result and the sample scene feature map are input into a timeliness perception module, which outputs a timeliness classification result. Based on a crowding level loss function, the crowding level loss value corresponding to the crowding level result and the crowding level label is calculated. Based on a timeliness classification loss function, the timeliness classification result and the timeliness requirement label corresponding to the timeliness classification result are calculated. Based on the crowding level loss value, the crowding level loss value, and the timeliness classification loss value, the first initial structural parameters are adjusted to obtain the first target structural parameters. The trained scene state perception model is then generated based on the first target structural parameters.
[0094] It should be noted that the liveness detection device used for liveness detection and the liveness detection model training device can be the same device or different devices. Preferably, the liveness detection method and the liveness detection model training method are implemented on different liveness detection devices.
[0095] Please see also Figure 1This document provides a scenario illustration of a liveness detection method according to an embodiment of the present specification. When the liveness detection device detects a target object approaching, it acquires a scene image containing the target object (the nearest target to the liveness detection device can be considered the target object by default). Based on the scene image, it confirms the scene timeliness classification result of the scene image. Based on the scene timeliness classification result, it confirms the target authentication action of the target object and generates authentication interaction information to instruct the target object to perform the target authentication action. Then, it acquires an authentication action image of the target object performing the target authentication action and generates a liveness detection result of the target object based on the authentication action image.
[0096] The liveness detection method provided in this specification will be described in detail below with reference to specific embodiments.
[0097] Please see Figure 2 This is a schematic flowchart illustrating a liveness detection method provided in the embodiments of this specification. Figure 2 As shown, the method described in the embodiments of this specification may include the following steps S102-S110.
[0098] Obtain the authentication request initiated by the target detection object for the transaction, generate authentication interaction information based on the authentication request, and use the authentication interaction information to instruct the target detection object to perform an authentication action.
[0099] The authentication actions of the target detection object are collected to generate an authentication action video;
[0100] S102, Collect scene images of the target detection object for face recognition transactions;
[0101] S104, Based on the scene image, confirm the scene timeliness classification result of the scene image;
[0102] S106, Based on the scenario timeliness classification result, confirm the target authentication action of the target detection object, and generate authentication interaction information to instruct the target detection object to perform the target authentication action;
[0103] S108, Obtain the authentication action image of the target detection object performing the target authentication action;
[0104] S110, Based on the authentication action image, generate a liveness detection result for the target object.
[0105] Common liveness detection methods can be categorized into two types based on their emphasis on security and user experience. The first type prioritizes security: active interactive liveness detection methods. These methods typically require the user to perform various actions, such as blinking or opening their mouth. Since user interaction takes a considerable amount of time, both overall system efficiency and user experience are significantly reduced. The second type prioritizes user experience: silent liveness detection methods. These methods complete data collection and liveness detection without the user's awareness or awareness, and in a natural state. This improves overall system efficiency and is therefore widely used in efficiency-critical scenarios such as access control and attendance systems. However, due to the lack of user interaction and insufficient information, these methods suffer from significantly reduced security and are easily compromised.
[0106] Traditional liveness detection in access control and attendance applications uses silent, non-interactive liveness detection regardless of the scenario. Therefore, to improve the security of liveness detection in access control scenarios, the liveness detection method described in this specification is proposed. The target detection object can be a live organism with differentiated biometric features, or it can be a fake face used for attack. Furthermore, the target detection object is referred to as "user" in this specification; the two terms can be used interchangeably and will not be further explained below. The following will provide a detailed description of each step:
[0107] S102, Collect scene images of the target detection object for face recognition transactions;
[0108] In one embodiment of this specification, facial recognition can be used in access control and attendance scenarios to identify the identity of attendance personnel or visitors. Facial recognition can verify whether the target detection object is a real, live person and whether its identity is correct. That is, liveness detection is only one part of facial recognition; if the liveness detection passes, the identity of the target detection object can be further identified. The scene image is an image of the current scene containing the target detection object and its surrounding environment. The scene image may include one or more candidate detection objects. When a candidate detection object enters the preset detection range of the liveness detection device, the candidate detection object becomes the target detection object, and the liveness detection device begins to acquire scene images containing the target detection object.
[0109] It should be noted that the image acquisition range of the liveness detection device can be determined according to actual needs and the location of the liveness detection device.
[0110] S104, Based on the scene image, confirm the scene timeliness classification result of the scene image;
[0111] In one embodiment of this specification, the scene timeliness classification result represents the timeliness requirement of the current scene. For example, the scene timeliness classification result can be divided into three categories: high, medium, and low, based on the timeliness requirements, and then the corresponding scene timeliness classification result can be confirmed based on the scene image. It is understandable that in access control and attendance scenarios, multiple detection objects may need to be detected by the same liveness detection device, thus requiring a certain level of timeliness. If the detection process is too slow, it will lead to congestion and queuing, thereby reducing the user experience. By analyzing the scene image, the timeliness requirement of the current scene can be obtained. A higher timeliness requirement indicates a larger number of users waiting for facial recognition, while a lower timeliness requirement indicates a smaller number of users waiting for facial recognition. In one feasible implementation, a correlation is established in advance based on the total number of people and the scene timeliness classification result, and then the scene timeliness classification result can be confirmed by identifying the number of people in the scene image.
[0112] S106, Based on the scenario timeliness classification result, confirm the target authentication action of the target detection object, and generate authentication interaction information to instruct the target detection object to perform the target authentication action;
[0113] In one embodiment of this specification, after confirming the scene timeliness classification result, the target authentication action of the target detection object is determined based on the scene timeliness classification result. The target authentication action is a preferred interactive action selected from multiple candidate authentication actions according to the timeliness requirement of the scene. In a feasible implementation, the candidate authentication actions may include opening the mouth, blinking, shaking the head, nodding, and looking left and right. The time consumption of each candidate authentication action is confirmed, and the candidate authentication actions are sorted according to the time consumption. The target authentication action is determined according to the degree of timeliness requirement of the scene timeliness classification result. For example, if the scene timeliness classification result is high, the corresponding target authentication action is "blinking"; if the scene timeliness classification result is medium, the corresponding target authentication action is "nodding"; and if the scene timeliness classification result is low, the corresponding target authentication action is "opening the mouth".
[0114] Once the target authentication action is confirmed, authentication interaction information can be output. This information includes prompts to guide the user to perform the authentication action. The authentication interaction information can be output as audio and / or as images on the display screen of the liveness detection device. Optionally, the authentication interaction information may also include authentication posture prompts, instructing the user to place their head or face within a preset frame, as well as text or video prompts on how to perform the authentication action.
[0115] Optionally, after confirming the scene timeliness classification result, if the scene timeliness classification result indicates that the timeliness required in the current scene is very high, the target detection object may not need to perform target authentication actions, and silent liveness detection may be performed directly on the target detection object.
[0116] S108, Obtain the authentication action image of the target detection object performing the target authentication action;
[0117] In one embodiment of this specification, the authentication action image is an image captured when the target detection object performs a target authentication action. Multiple consecutive authentication action images can be acquired using the image acquisition device on the liveness detection device. For example, after displaying authentication interaction information, images of the target detection object can be acquired, and multiple action images can be captured, from which a preset number of action images can be selected as the authentication action images.
[0118] S110, Based on the authentication action image, generate a liveness detection result for the target object.
[0119] In one embodiment of this specification, after acquiring an authentication action image, a liveness detection result for the target object is generated based on the authentication action image. For example, features of the authentication action image can be extracted using a pre-trained machine learning algorithm. Based on these features, the probability that the target object is a liveness attack is predicted. The predicted attack probability p is compared with a probability threshold T. If p is greater than T, it is determined to be an attack, and a liveness detection result for the target object is obtained.
[0120] In the embodiments of this specification, scene images of the target detection object for facial recognition transactions are acquired. Based on the scene images, the scene timeliness classification result of the scene images is confirmed. Based on the scene timeliness classification result, the target authentication action of the target detection object is confirmed, and authentication interaction information is generated to instruct the target detection object to perform the target authentication action. The authentication action image of the target detection object performing the target authentication action is obtained, and based on the authentication action image, the liveness detection result of the target detection object is generated. By analyzing the timeliness requirements of the current scene, the target interaction action is selected according to the level of timeliness requirements of the scene. Then, liveness detection is performed based on the authentication action image of the target detection object performing the target authentication action. This allows for flexible liveness detection according to different scenes, ensuring the security of facial recognition transactions.
[0121] Please see Figure 3 This is a schematic flowchart illustrating a liveness detection method provided in the embodiments of this specification. Figure 3 As shown, the method described in the embodiments of this specification may include the following steps S202-S206.
[0122] S202, Extract the features of the scene image to generate a scene feature map;
[0123] In one embodiment of this specification, feature extraction is performed on a scene image to obtain a scene feature map. Specifically, convolutional layers in a convolutional neural network can be used to perform convolution operations on the scene image. The feature map is obtained after the image pixel values pass through the filters in the convolutional layer. The network parameters, such as the size and number of filters and the number of convolutional layers, can be selected according to actual conditions and are not specifically limited. By setting different network parameters, the convolutional neural network can focus on certain pixel portions of the scene image, thereby obtaining a scene feature map that is more closely related to the determination of crowding of people.
[0124] S204, Based on the scene feature map, determine the crowding degree of people in the scene image; the crowding degree of people represents the density of people in the scene image.
[0125] In one embodiment of this specification, after obtaining the scene feature map, the people in the map can be further identified through a classification task. The crowding density of people represents the degree of density of people in the scene image.
[0126] In one feasible implementation, HOG can be used for feature extraction to obtain a scene feature map. Then, a linear SVM can be used as a classifier to detect people in the image. Once the people in the image are identified, the number of people can be determined, and the crowding level can be determined based on the number of people. Optionally, a convolutional neural network can be used for density estimation, such as the crowd counting model DecideNet. There is a positive correlation between the number of people and the crowding level. The crowding level of the current scene image can be obtained by establishing a correlation between the number of people and the crowding level for each individual person; for example, if the number of people is 2, the crowding level is 4; if the number of people is 3, the crowding level is 6.
[0127] S206, Based on the crowding level of the people and the scene feature map, confirm the scene timeliness classification result of the scene image.
[0128] Specifically, based on the identified crowding levels of people and scene feature maps, a pre-trained classification model is used to obtain the scene timeliness classification result for the scene images. This can be understood as follows: multiple sample scene images are pre-collected, and each sample scene image is labeled with its corresponding scene timeliness classification result. A convolutional neural network is used to extract features from the sample scene images to obtain sample scene feature maps. Then, a crowding level confirmation model is used to confirm the corresponding crowding level of the people in the samples. Based on the crowding level of the people in the samples and the sample scene feature maps, a classification model is used to confirm the corresponding scene timeliness classification result. This result is compared with the labeled scene timeliness classification result to confirm the model accuracy. The model is then iteratively optimized to obtain the trained model. Once the scene images are acquired, scene timeliness classification can be performed directly.
[0129] Please see Figure 4 This is a schematic flowchart illustrating a liveness detection method provided in the embodiments of this specification. Figure 4 As shown, the method described in the embodiments of this specification may include the following steps S302-S308.
[0130] S302, Extract the features of the scene image to generate a scene feature map;
[0131] Please refer to step S202 of the above embodiment in the instruction manual, which will not be repeated here.
[0132] S304, Based on the scene feature map, confirm the person counting result and human body segmentation result of the scene image;
[0133] In one embodiment of this specification, the crowding level includes a person count and a human body segmentation result. The person count and human body segmentation results in the scene image are confirmed based on the scene feature map. Specifically, the human body segmentation result is the image after performing human body segmentation processing on the scene feature map, dividing the image into pixels belonging to people and pixels not belonging to people. This can be achieved using human body segmentation algorithms such as Bodypix or Unet. The person count result is the number of people in the scene image, which can be confirmed using a person counting algorithm.
[0134] S306, perform feature encoding on the human body segmentation result, the human figure counting result, and the timeliness classification result, and output the corresponding human body segmentation result feature, human figure counting result feature, and timeliness classification result feature;
[0135] In one embodiment of this specification, after obtaining the human body segmentation result, the human body counting result, and the timeliness classification result, the three data are feature-encoded and transformed into the features corresponding to the three data, namely, the human body segmentation result feature, the human body counting result feature, and the timeliness classification result feature.
[0136] S308, based on the human body segmentation result features, the person counting result features, and the time-based classification result features, confirm the target authentication action of the target detection object.
[0137] In one embodiment of this specification, the target authentication action for the detected object is determined based on human segmentation result features, task counting result features, and timeliness classification result features. Specifically, a dataset is constructed, which includes scene images containing one or more target detection objects. Preferred authentication actions are manually labeled on the scene images. The authentication action selection model may include a feature encoding module and an action classification module. The feature encoding module extracts features from the obtained human segmentation results, task counting results, and timeliness classification results. The extracted human segmentation result features, task counting result features, and timeliness classification result features are input into the action classification module, which outputs a predicted preferred authentication action. The model accuracy index is confirmed based on the predicted preferred authentication action and the labeled preferred authentication action. The network parameters of the authentication action selection model are randomly distributed, and the above dataset is used to iteratively update the network parameters. At the end of each iteration, it is determined whether the updated network parameters meet the network parameter accuracy index.
[0138] In the embodiments of this specification, features of the scene image are extracted to generate a scene feature map. Based on the scene feature map, the crowding level of people in the scene image is determined. Based on the crowding level and the scene feature map, the scene timeliness classification result of the scene image is determined. By introducing crowding level, and using crowding level and scene image features together as factors to evaluate the scene timeliness classification result, the timeliness requirements of the scene image can be better predicted, thereby obtaining the timeliness classification result. Optionally, crowding level includes people counting results and human segmentation results. The human segmentation result features, people counting result features, and timeliness classification result features corresponding to the people counting result, human segmentation result, and scene timeliness classification result are obtained. Based on the human segmentation result features, people counting result features, and timeliness classification result features, the target authentication action of the target detection object is determined. By training models for the three tasks of human segmentation, people counting, and timeliness classification, the multiple tasks can promote each other, ultimately making the performance of each task better than that of training alone. Therefore, action selection based on the results of multiple tasks can improve the accuracy of action selection.
[0139] Please see Figure 5 This is a schematic flowchart illustrating a liveness detection method provided in the embodiments of this specification. Figure 5 As shown, the method described in the embodiments of this specification may include the following steps S402-S408.
[0140] S402, continuously acquire a sequence of images of the target detection object performing the target authentication action for a preset number of frames, and use the sequence of images as the authentication action images;
[0141] In one embodiment of this specification, after instructing the target detection object to perform a target authentication action, a sequence of images showing the target detection object performing the authentication action can be acquired as authentication action images. The number of images in the sequence and the acquisition interval can be set according to actual needs. For example, one authentication action image can be acquired every five frames, and this process can be repeated ten times to obtain ten authentication action images, resulting in a sequence of images used as the authentication action images. Alternatively, the acquisition interval can be set to zero, meaning ten frames of authentication action images can be acquired continuously to obtain a sequence of images, which can then be used as the authentication action images.
[0142] S404, Perform feature extraction on the authentication action image to obtain the first real feature vector corresponding to the authentication action image;
[0143] In one embodiment of this specification, feature extraction is performed on the authentication action images to obtain the true feature vectors corresponding to each authentication action image in the authentication action images, thereby obtaining the first true feature vector. It should be noted that since the authentication action images are a sequence of images, the first true feature vector contains the true feature vectors corresponding to each authentication action image in the authentication action images. The feature extraction method is not limited here.
[0144] S406, Based on the first real feature vector, obtain the first predicted feature vector of the authentication action image, and calculate the first residual vector corresponding to the authentication action image based on the first real feature vector and the first predicted feature vector;
[0145] In one embodiment of this specification, a first predicted feature vector of the authentication action image is obtained based on a first ground truth feature vector of the authentication action image, and a first residual vector is calculated. The first predicted feature vector contains the predicted feature vector corresponding to each authentication action image in the authentication action image. The first residual vector is obtained by performing feature difference between the first ground truth feature vector and the first predicted feature vector. It should be noted that the feature difference is performed on the predicted feature vector and the ground truth feature vector of the same authentication action image.
[0146] S408, Based on the first residual vector and the first true feature vector, generate the liveness detection result of the target detection object.
[0147] In one embodiment of this specification, liveness detection of the target object can be achieved by authenticating the first residual vector and the first true feature vector of the action image. That is, a pre-trained liveness detection model can determine whether the target object is a liveness attack.
[0148] It's understandable that calculating the average vector using the first true feature vector of each frame of the authentication action image can achieve liveness detection. However, introducing a difference vector can improve the accuracy of liveness detection. The movement patterns of a real live person differ from those of a fake face attack. For example, generating a blinking motion using software transforms a stationary eye into a blink, which differs from the normal movement patterns of a real live person. Therefore, the predicted feature vector for the next frame, based on the current frame, will differ from the true feature vector for the next frame. By calculating the difference between the predicted and true feature vectors, a residual vector is obtained and used as an incremental feature. This residual vector, along with the true feature vector of each frame of the authentication action image, is then used as features for model training, which can improve the accuracy of liveness detection.
[0149] Optionally, the liveness detection method further includes the following steps S502-S504:
[0150] S502, based on the second true feature vector of the second action image in the authentication action image, obtain the second predicted feature vector of the third action image, wherein the second action image is any frame of the authentication action image; the first action image is the last frame of the authentication action image; and the third action image is the next frame of the authentication action image after the second action image.
[0151] S504, based on the second predicted feature vector and the third true feature vector of the third action image, calculate the third residual vector corresponding to the third action image.
[0152] In one embodiment of this specification, a scheme for calculating the residual vector of an authentication action image is provided. Specifically, the second predicted feature vector of the next frame authentication action image (third action image) is predicted using the second true feature vector of the previous frame authentication action image (second action image). Then, based on the third true feature vector of the next frame authentication action image (third action image), the difference between the second predicted feature vector and the third true feature vector is calculated to obtain the second residual vector. The first residual vector is composed of the residual vectors corresponding to each authentication action image.
[0153] It should be noted that the first frame of the certified action image does not have the true feature vector of the previous frame that can be used to predict the feature vector. Therefore, the predicted feature vector of the previous frame can also be predicted from the subsequent action image to calculate the residual vector.
[0154] In the embodiments of this specification, a sequence of images of the target detection object performing the target authentication action is continuously acquired for a preset number of frames. The sequence of images is used as the authentication action images. Feature extraction is performed on the authentication action images to obtain a first true feature vector corresponding to the authentication action images. Based on the first true feature vector, a first predicted feature vector of the authentication action images is obtained. Based on the first true feature vector and the first predicted feature vector, a first residual vector corresponding to the authentication action images is calculated. Based on the first residual vector and the first true feature vector, a liveness detection result of the target detection object is generated, which can improve the accuracy of the liveness detection result.
[0155] Please see Figure 6 This is a schematic flowchart illustrating a training method for a liveness detection model provided in an embodiment of this specification. Figure 6 As shown, the method described in the embodiments of this specification may include the following steps S602-S610.
[0156] S602, Initialize the first initial structural parameters in the scene state perception model;
[0157] Traditional liveness detection in access control and attendance applications uses silent, non-interactive liveness detection regardless of the scenario. This provides an opportunity for attackers. Based on actual data analysis, attackers often operate alone, where the timeliness requirement is actually lower (no one is queuing). Based on this characteristic, a training method for a scenario-state-aware model is proposed to identify the timeliness requirements of the scenario, thereby enabling liveness detection in different scenarios.
[0158] Specifically, first set the initial structural parameters of the action prediction model, such as the model's network structure parameters and loss function. The model's network structure can use an existing convolutional neural network, and the loss function can be set according to actual needs; this specification does not impose specific limitations on the embodiments.
[0159] S604, Obtain a sample scene image containing the sample detection object, wherein the sample scene image is labeled with a crowding level label and an image timeliness requirement label;
[0160] In one embodiment of this specification, the sample scene image of the sample detection object is used as training data for training the scene state awareness model. Each sample scene image is also labeled with a crowding level label and an image timeliness requirement label. The crowding level label characterizes the crowding level of the sample scene image, and the image timeliness requirement label characterizes the timeliness requirement of the sample scene image.
[0161] S606, Input the sample scene image into the basic feature encoding module and output the sample scene feature map;
[0162] In one embodiment of this specification, a sample scene image is input into a basic feature encoding module for feature extraction to obtain a sample scene feature map.
[0163] S608, Input the sample scene feature map into the crowding degree module and output the crowding degree result of the sample people;
[0164] In one embodiment of this specification, the sample scene feature map obtained by the basic feature encoding module is input into the crowding degree module to identify the sample task crowding degree result of the scene image.
[0165] S610, input the sample crowding result and the sample scene feature map into the timeliness perception module, and output the sample timeliness classification result;
[0166] In one embodiment of this specification, after obtaining the sample crowding results and sample scene feature maps, the sample crowding results and sample scene feature maps are input into the timeliness perception module to obtain the sample timeliness classification results.
[0167] S612, Calculate the crowding result of the sample person and the crowding loss value corresponding to the person crowding label based on the crowding loss function;
[0168] S614, Calculate the timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image based on the timeliness classification loss function;
[0169] S616, Adjust the first initial structural parameters based on the congestion loss value and the timeliness classification loss value;
[0170] S618, determine whether the crowding loss value and time classification loss value calculated by the liveness detection model after adjusting the first initial structural parameters meet the preset convergence conditions. If they meet the conditions, obtain the first target structural parameters, stop training, and obtain the trained liveness detection model. If they do not meet the conditions, proceed to step S606.
[0171] Understandably, steps S616 and S618 can be combined into the following steps: adjusting the first initial structural parameters based on the crowding loss value and the timeliness classification loss value to obtain the first target structural parameters, and generating the trained scene state perception model based on the first target structural parameters.
[0172] In the embodiments of this specification, after obtaining the sample timeliness classification result corresponding to the sample scene image, the crowding loss value corresponding to the sample person crowding result and the person crowding label, the timeliness classification loss value corresponding to the sample timeliness classification result and the image timeliness requirement label are calculated based on the preset loss function. The first initial structural parameter model of the scene state perception model is updated and optimized based on the crowding loss value and the timeliness classification loss value. It is then determined whether the scene state perception model after updating and optimizing the model parameters has converged. If the model converges, training is stopped and the trained scene state perception model is obtained. If the model does not converge, step S606 is executed to continue training the scene state perception model based on the sample scene image until the model converges.
[0173] Please see Figure 7 This is a schematic flowchart illustrating a training method for a liveness detection model provided in an embodiment of this specification. Figure 7 As shown, the method described in the embodiments of this specification may include the following steps S702-S720.
[0174] S702, Initialize the first initial structural parameters in the scene state perception model;
[0175] In one embodiment of this specification, step S202 is described in detail in another embodiment of this specification for step S102, and will not be repeated here.
[0176] S704, Obtain a sample scene image containing the sample detection object, wherein the sample scene image is labeled with a crowding level label and an image timeliness requirement label;
[0177] In one embodiment of this specification, the crowding level label includes a human segmentation map label and a number of people label. After obtaining the sample scene image of the sample detection object, the sample scene image can be labeled with a number of people label, a human segmentation map label, and an image timeliness requirement label. The number of people label represents the number of people in the sample scene image, the human segmentation map label represents the number of pixels occupied by the human body and the number of pixels occupied by the non-human body in the sample scene image, and the image timeliness requirement label is described in detail in another embodiment of this specification for step S104.
[0178] S706, Input the sample scene image into the basic feature encoding module and output the sample scene feature map;
[0179] In one embodiment of this specification, step S706 is described in detail in another embodiment of this specification, and will not be repeated here.
[0180] S708, Input the sample scene feature map into the human body segmentation module and output the sample human body segmentation result;
[0181] In one embodiment of this specification, after obtaining the sample scene feature map, the sample scene feature map is input into the human body segmentation module to obtain the sample human body segmentation result.
[0182] S710, Input the sample scene feature map into the person counting module and output the sample person counting result;
[0183] In one embodiment of this specification, after obtaining the sample scene feature map, the sample scene feature map is input into the person counting module to obtain the sample person counting result.
[0184] S712, input the sample scene feature map, the sample human body segmentation result and the sample human body counting result into the timeliness perception module, and output the sample timeliness classification result;
[0185] In one embodiment of this specification, the sample scene feature map, the sample human body segmentation result, and the sample human body counting result are input into the timeliness perception module, and the sample timeliness classification result is obtained based on the sample scene feature map, the sample human body segmentation result, and the sample human body counting result.
[0186] S714, Calculate the human segmentation result of the sample and the human segmentation loss value corresponding to the human segmentation map label based on the human segmentation loss function;
[0187] In one embodiment of this specification, after obtaining the sample human body segmentation result, the human body segmentation loss value between the sample human body segmentation result and the human body segmentation map label is calculated based on the pre-labeled human body segmentation map label.
[0188] S716, Calculate the sample person counting result and the person counting loss value corresponding to the person count label based on the person counting loss function;
[0189] In the embodiments of this specification, after obtaining the sample person count results, the person count loss function is applied.
[0190] S718, Calculate the timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image based on the timeliness classification loss function;
[0191] In one embodiment of this specification, after obtaining the sample timeliness classification result, the timeliness classification loss value between the sample timeliness classification result and the image timeliness requirement label is calculated based on the timeliness classification loss function. It should be noted that the timeliness classification loss function, the person counting loss function, and the human body segmentation loss function can all be selected according to actual needs, such as the exponential loss function, the absolute value loss function, etc.
[0192] S720, the first initial structural parameters are adjusted based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters.
[0193] In one embodiment of this specification, the first initial structural parameter model of the scene state perception model is updated and optimized based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value. It is then determined whether the scene state perception model after updating and optimizing the model parameters has converged. If the model converges, training is stopped, and the trained scene state perception model is obtained. If the model does not converge, step S706 is executed to continue training the scene state perception model based on the sample scene images until the model converges.
[0194] Optionally, in one embodiment of this specification, the first initial structural parameter includes a second initial structural parameter, a third initial structural parameter, and a fourth initial structural parameter;
[0195] The step of adjusting the first initial structural parameters based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and generating the trained scene state perception model based on the first target structural parameters, includes:
[0196] If the human body segmentation loss value does not converge to the first preset value, the second initial structural parameters of the human body segmentation module are adjusted based on the human body segmentation loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the human body segmentation loss value converges to the first preset value, and the second target structural parameters are obtained.
[0197] If the character counting loss value does not converge to the second preset value, the third initial structure parameter of the character counting module is adjusted based on the character counting loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the character counting loss value converges to the second preset value, and the third target structure parameter is obtained.
[0198] If the timeliness classification loss value does not converge to the third preset value, the fourth initial structural parameter of the timeliness perception module is adjusted based on the timeliness classification loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the timeliness classification loss value converges to the third preset value, and the fourth target structural parameter is obtained.
[0199] The first target structure parameter is obtained based on the second target structure parameter, the third target structure parameter, and the fourth target structure parameter, and the trained scene state perception model is generated based on the first target structure parameter.
[0200] Specifically, the loss function is: Loss total =Loss seg +Loss count +Loss cls Loss total Loss represents the total loss value of the scene state awareness model. seg Loss is the loss value for human body segmentation. count Loss is the character count loss value. cls The loss value is for timeliness classification. Based on the above model structure and loss function, the network is trained. When each loss value converges to a preset value, the model converges, and the trained scene state perception model is obtained. It is understandable that since the scene state perception model is obtained through multi-task training, each task needs to meet its corresponding convergence condition. The parameters of the three task models are tuned separately. When the human segmentation loss value converges to the first preset value, the person counting loss value converges to the second preset value, and the timeliness classification loss value converges to the third preset value, the first target structure parameter is obtained based on the second, third, and fourth target structure parameters, completing the model training. If the model converges, training stops, and the trained scene state perception model is obtained. If the model does not converge, step S706 is executed, and the human segmentation module, person counting module, and timeliness perception module are trained again based on sample scene images until the model converges.
[0201] In the embodiments of this specification, the first initial structural parameters in the initialization of the action prediction model include the second initial structural parameters of the human body segmentation module, the third initial structural parameters of the person counting module, and the fourth initial structural parameters of the timeliness perception module. The second initial structural parameters of the human body segmentation module are iteratively optimized based on the human body segmentation loss value until the human body segmentation loss value converges to a first preset value. The third initial structural parameters of the person counting module are optimized based on the person counting loss value until the person counting loss value converges to a second preset value. The fourth initial structural parameters of the timeliness perception module are optimized based on the timeliness classification loss value until the timeliness classification loss value converges to a third preset value. The training effect of the model is improved through multi-task training.
[0202] Please see Figure 8 This is a schematic flowchart illustrating a training method for a liveness detection model provided in an embodiment of this specification. Figure 8 As shown, the method described in the embodiments of this specification may include the following steps S802-S810.
[0203] Step S802: Initialize the fifth initial structure parameter in the action selection model;
[0204] In one embodiment of this specification, considering that different actions have different impacts on efficiency—for example, blinking saves more time than shaking one's head—action selection is made based on the multi-task results obtained from the scene state perception model. This involves training an action selection model to select the authentication action. Specifically, the fifth initial structural parameters of the action selection model are first set, such as the model's network structure parameters and loss function. The convolutional layers, fully connected layers, activation functions, etc., in the model's network structure can be set according to actual needs; this embodiment does not impose specific limitations.
[0205] Step S804: Obtain the sample human body segmentation result, sample human body counting result, and sample timeliness classification result corresponding to the sample scene image containing the sample detection object, wherein the sample scene image is labeled with the preferred authentication action tag of the sample detection object;
[0206] In one embodiment of this specification, the sample human body segmentation result, sample person counting result, and sample timeliness classification result corresponding to the sample scene image are obtained, and the preferred authentication action label corresponding to the sample scene image is labeled. The preferred authentication action label is the authentication action corresponding to the sample scene image that is manually labeled.
[0207] Step S806: Input the sample human body segmentation result, the sample human figure counting result, and the sample timeliness classification result into the feature encoding module to obtain the corresponding sample human body segmentation result features, sample human figure counting result features, and sample timeliness classification result features;
[0208] In one embodiment of this specification, the sample human body segmentation result, the person counting result, and the sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample person counting result feature, and sample timeliness classification result feature.
[0209] Step S808: Input the sample human body segmentation result features, the sample person counting result features, and the sample timeliness classification result features into the action classification module, and output the sample authentication action of the sample detection object;
[0210] In one embodiment of this specification, after obtaining the sample human body segmentation result features, the sample person counting result features, and the sample timeliness classification result features, the data are input into the action classification module, and the sample authentication action of the sample detection object is obtained based on the action classification module.
[0211] Step S810: Calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function;
[0212] In one embodiment of this specification, after obtaining the sample authentication action, an action classification loss value is calculated between the sample authentication action and the preferred authentication action label based on the action classification loss function. The action classification loss value characterizes the difference between the sample authentication action predicted by the model and the preferred authentication action. It can be understood that the smaller the difference, the higher the model accuracy and the better the performance.
[0213] Step S812: Adjust the fifth initial structural parameter based on the action classification loss value to obtain the fifth target structural parameter, and generate the trained action selection model based on the fifth target structural parameter.
[0214] Understandably, the optimization process for the model aims to ensure its performance meets the desired results. Therefore, through iterative training, the fifth initial structural parameter of the action selection model is adjusted. Training ends when the action classification loss value meets the preset convergence condition, generating the trained action selection model. It's also understandable that during the action selection model training process, the model can be input solely based on the time-sensitive classification results, and the action selection result can be confirmed based on the features of the time-sensitive classification results. However, using human segmentation results, person counting results, and time-sensitive classification results can improve the model's accuracy in action selection, making it more aligned with the time-sensitive requirements of the scenario.
[0215] In the embodiments of this specification, by initializing the initial structural parameters in the action selection model, the sample human body segmentation result, sample person counting result, and sample timeliness classification result corresponding to the sample scene image containing the sample detection object are obtained. The sample human body segmentation result, sample person counting result, and sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result features, sample person counting result features, and sample timeliness classification result features. The sample human body segmentation result features, sample person counting result features, and sample timeliness classification result features are input into the action classification module to output the sample authentication action of the sample detection object. The action classification loss value corresponding to the sample authentication action and the preferred authentication action label is calculated based on the action classification loss function. The fifth initial structural parameter is adjusted based on the action classification loss value to obtain the fifth target structural parameter. The trained action selection model is generated based on the fifth target structural parameter. Thus, during the face recognition process, the action selection model can be directly called to select the authentication action that meets the scene timeliness requirements, and the authentication action can be flexibly generated for liveness detection.
[0216] Please see Figure 9 This is a schematic diagram illustrating the training process of a liveness detection model provided in an embodiment of this specification. Figure 9 As shown, the method described in the embodiments of this specification may include the following steps S902-S910.
[0217] S902, Initialize the sixth initial structural parameter in the liveness detection model;
[0218] In one embodiment of this specification, liveness detection is performed based on the authentication action image generated by the user's cooperative authentication action. Unlike the traditional simple binary classification approach, this embodiment proposes a liveness detection method based on future action prediction differentials. First, the sixth initial structural parameters of the liveness detection model are initialized, such as the model's network structure parameters and loss function.
[0219] S904, Obtain a sample authentication action image of the sample detection object, wherein the sample authentication action image is labeled with the sample identity tag of the sample detection object;
[0220] In one embodiment of this specification, a sample authentication action image of a sample detection object is acquired, and the sample authentication action image is labeled with a sample identity tag of the sample detection object. For a single sample detection object, there may be multiple authentication action images, which may include sample authentication action images collected separately when the sample detection object performs multiple authentication actions.
[0221] Optionally, the sample authentication action images are sequence images, that is, multiple sample authentication action images acquired in chronological order.
[0222] S906, Input the sample authentication action image into the basic feature encoder and output the sample authentication action feature;
[0223] In one embodiment of this specification, for the obtained sample authentication action image, the sample authentication action image can be input into the basic feature encoder, and the sample authentication action features can be obtained through feature encoding processing, for example, 10 frames of images, corresponding to 10 feature vectors.
[0224] S908, Input the sample authentication action features into the future action prediction module and output the sample prediction authentication action features;
[0225] In one embodiment of this specification, after obtaining the sample authentication action features, the sample authentication action features are input into the future action prediction module, and the sample predicted authentication action features are output, that is, the authentication action features predicted from the sample authentication action image.
[0226] Specifically, in one feasible implementation, after inputting the sample authentication action features of each authentication action image into the future action prediction module, the future action prediction module can predict the sample predicted authentication action features of the next frame of authentication action image based on each sample authentication action feature.
[0227] S910, calculate the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features;
[0228] In one embodiment of this specification, after predicting the sample authentication action features, the sample authentication action features and the corresponding sample residual features are calculated. For example, the sample residual features can be obtained by directly subtracting the sample authentication action features from the sample predicted authentication action features. A corresponding sample residual feature can be calculated for each extracted sample authentication action feature.
[0229] S912, input the sample residual features and the sample authentication action features into the differential liveness classification module, and output the sample liveness detection result;
[0230] In one embodiment of this specification, the differential liveness classification module performs liveness detection based on sample residual features and sample authentication action features to obtain sample liveness detection results.
[0231] S914, Calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function;
[0232] In one embodiment of this specification, after obtaining the sample liveness detection result, the future feature prediction loss value between the sample authentication action feature and the predicted authentication action feature is calculated based on the future feature prediction loss function.
[0233] S916, Calculate the liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label based on the liveness detection loss function;
[0234] In one embodiment of this specification, the liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label are calculated based on the liveness detection loss function.
[0235] S918, the sixth initial structural parameter is adjusted based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and the trained liveness detection model is generated based on the sixth target structural parameter.
[0236] In one embodiment of this specification, the sixth initial structural parameter model of the liveness detection model is updated and optimized based on the future feature prediction loss value and the liveness detection loss value. It is then determined whether the liveness detection model after updating and optimizing the model parameters has converged. If the model converges, training is stopped, and a trained scene state perception model is obtained. If the model does not converge, step S906 is executed to continue training the liveness detection model based on the sample authentication action image until the model converges.
[0237] Optionally, the method described in the embodiments of this specification may include the following steps S1002-S1010.
[0238] S1002, if the future feature prediction loss value does not converge to the fourth preset value, then adjust the fourth initial structure parameter of the future action prediction module based on the future feature prediction loss value, and proceed to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the future feature prediction loss value converges to the fourth preset value, and obtain the fourth target structure parameter.
[0239] S1004, if the liveness detection loss value does not converge to the fifth preset value, then adjust the eighth initial structural parameter of the differential liveness classification module based on the liveness detection loss value, and proceed to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the liveness detection loss value converges to the fifth preset value, and the eighth target structural parameter is obtained.
[0240] S1006, based on the seventh target structural parameters and the eighth target structural parameters, the fifth target structural parameters are obtained, and the trained liveness detection model is generated based on the fifth target structural parameters.
[0241] By optimizing the structural parameters of the future action prediction module and the differential liveness classification module respectively.
[0242] In the embodiments described in this specification, the sixth initial structural parameter in the liveness detection model is initialized.
[0243] The process involves acquiring sample authentication action images of the target object, inputting these images into a basic feature encoder to output sample authentication action features, inputting these features into a future action prediction module to output predicted authentication action features, calculating the sample residual features corresponding to the sample authentication action features and the predicted authentication action features, inputting these residual features and sample authentication action features into a differential liveness classification module to output sample liveness detection results, calculating the future feature prediction loss value corresponding to the sample authentication action features and the predicted authentication action features based on a future feature prediction loss function, calculating the liveness detection loss value corresponding to the sample liveness detection result and the sample identity label based on a liveness detection loss function, adjusting the sixth initial structural parameters based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameters, and generating a trained liveness detection model based on the sixth target structural parameters. During training, by predicting the action features of future authentication action images based on sample authentication action images, sample differential features of the authentication action images are calculated, further ensuring the detection accuracy of the liveness detection model.
[0244] In the embodiments of this specification, after training the scene state perception model, action selection model, and liveness detection model using the aforementioned training methods for the scene state perception model, action selection model, and liveness detection model, the three trained models (scene state perception model, action selection model, and liveness detection model) are deployed to a cloud server or terminal device. Scene images containing the target detection object are collected and input into the scene state analysis model to obtain scene timeliness classification results, human body segmentation results, and human body counting results. The scene timeliness classification results, human body segmentation results, and human body counting results are then input into the action selection model to obtain the preferred action (target authentication action). The target detection object is prompted to complete the target authentication action, and corresponding sequence images are collected to obtain the authentication action image. The authentication action image is input into the liveness detection model to obtain the liveness attack probability p. For a pre-set threshold T, if p is greater than T, it is judged as an attack; otherwise, it is judged as a liveness.
[0245] It should be noted that after the training methods of the above-mentioned scene state perception model, action selection model, and liveness detection model are completed, when using the actual model, the implementation methods of the liveness detection method in steps S102-S504 of the above-mentioned specification embodiment can be referred to.
[0246] The following will be combined with the appendix Figure 10-14 This specification provides a detailed description of the liveness detection device provided in the embodiments. It should be noted that the appendix... Figure 10 The liveness detection device described herein is used to perform the functions described in this manual. Figures 2-5The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figures 2-5 The example shown.
[0247] Please see Figure 10 This diagram illustrates a structural schematic of a liveness detection device provided in an exemplary embodiment of this specification. The liveness detection device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 1 includes a first acquisition module 11, a scene classification module 12, an authentication action confirmation module 13, a second acquisition module 14, and a result generation module 15.
[0248] The first acquisition module 11 is used to acquire scene images of the target detection object for face recognition transactions;
[0249] Scene classification module 12 is used to confirm the scene timeliness classification result based on the scene image;
[0250] The authentication action confirmation module 13 is used to confirm the target authentication action of the target detection object based on the scenario timeliness classification result; and to generate authentication interaction information to instruct the target detection object to perform the target authentication action.
[0251] The second acquisition module 14 is used to acquire an authentication action image of the target detection object performing the target authentication action;
[0252] Result generation module 15 is used to generate a liveness detection result of the target detection object based on the authentication action image.
[0253] Optionally, the scene classification module 12 is specifically used to extract features from the scene image and generate a scene feature map;
[0254] Based on the scene feature map, the crowding degree of people in the scene image is determined; the crowding degree of people represents the density of people in the scene image.
[0255] Based on the crowding density of the people and the scene feature map, the scene timeliness classification result of the scene image is confirmed.
[0256] Optionally, the scene classification module 12 is specifically used to confirm the person counting result and human body segmentation result of the scene image based on the scene feature map;
[0257] Based on the scene feature map, the human body segmentation result, and the human body counting result, the scene timeliness classification result of the scene image is confirmed.
[0258] Optionally, the authentication action confirmation module 13 is specifically used to perform feature encoding on the human body segmentation result, the person counting result, and the timeliness classification result, and output the corresponding human body segmentation result features, person counting result features, and timeliness classification result features;
[0259] Based on the human body segmentation result features, the person counting result features, and the time-based classification result features, the target authentication action of the target detection object is confirmed.
[0260] Optionally, the second acquisition module 14 is specifically used to continuously acquire a sequence of images of the target detection object performing the target authentication action for a preset number of frames, and use the sequence of images as the authentication action images.
[0261] Optionally, the result generation module 15 is specifically used to extract features from the authentication action image to obtain the first true feature vector corresponding to the authentication action image;
[0262] Based on the first real feature vector, obtain the first predicted feature vector of the authentication action image, and calculate the first residual vector corresponding to the authentication action image based on the first real feature vector and the first predicted feature vector.
[0263] Based on the first residual vector and the first true feature vector, a liveness detection result for the target object is generated.
[0264] Optionally, the result generation module 15 is specifically used to obtain the second predicted feature vector of the third action image based on the second true feature vector of the second action image in the authentication action image, wherein the second action image is any frame of the authentication action image; the first action image is the last frame of the authentication action image; and the third action image is the next frame of the authentication action image after the second action image.
[0265] Based on the second predicted feature vector and the third true feature vector of the third action image, the second residual vector corresponding to the third action image is calculated.
[0266] Further, refer to the appendix Figure 11 The liveness detection device shown is equipped with... Figure 11 The liveness detection device described herein is used to perform the functions described in this manual. Figures 6-7 The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figures 6-7 The example shown.
[0267] Please see Figure 11This document illustrates a schematic diagram of a liveness detection device provided in an exemplary embodiment. The liveness detection device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 2 includes a first parameter setting module 21, a first sample acquisition module 22, a first feature extraction module 23, a crowding detection module 24, a timeliness perception module 25, a crowding loss calculation module 26, a timeliness classification loss calculation module 27, and a first training module 28.
[0268] The first parameter setting module 21 is used to initialize the first initial structure parameters in the scene state perception model;
[0269] The first sample acquisition module 22 is used to acquire a sample scene image containing the sample detection object, wherein the sample scene image is labeled with a crowding level label and an image timeliness requirement label.
[0270] The first feature extraction module 23 is used to input the sample scene image into the basic feature encoding module and output the sample scene feature map;
[0271] Crowding detection module 24 is used to input the sample scene feature map into the people crowding module and output the sample people crowding result;
[0272] The timeliness perception module 25 is used to input the sample crowding degree result and the sample scene feature map into the timeliness perception module and output the sample timeliness classification result;
[0273] The crowding loss calculation module 26 is used to calculate the crowding result of the sample person and the crowding loss value corresponding to the crowding label of the person based on the crowding loss function;
[0274] The timeliness classification loss calculation module 27 is used to calculate the timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image based on the timeliness classification loss function;
[0275] The first training module 28 is used to adjust the first initial structural parameters based on the crowding loss value, the character counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and to generate the trained scene state perception model based on the first target structural parameters.
[0276] Optionally, the first training module 28 is specifically used to adjust the second initial structural parameters of the human body segmentation module based on the human body segmentation loss value if the human body segmentation loss value does not converge to the first preset value, and then proceed to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the human body segmentation loss value converges to the first preset value, and the second target structural parameters are obtained.
[0277] If the character counting loss value does not converge to the second preset value, the third initial structure parameter of the character counting module is adjusted based on the character counting loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the character counting loss value converges to the second preset value, and the third target structure parameter is obtained.
[0278] If the timeliness classification loss value does not converge to the third preset value, the fourth initial structural parameter of the timeliness perception module is adjusted based on the timeliness classification loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the timeliness classification loss value converges to the third preset value, and the fourth target structural parameter is obtained.
[0279] The first target structure parameter is obtained based on the second target structure parameter, the third target structure parameter, and the fourth target structure parameter, and the trained scene state perception model is generated based on the first target structure parameter.
[0280] Further, refer to the appendix Figure 12 The liveness detection device shown is equipped with... Figure 12 The liveness detection device described herein is used to perform the functions described in this manual. Figure 8 The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figure 8 The example shown.
[0281] Please see Figure 12 This diagram illustrates a structural schematic of a liveness detection device provided in an exemplary embodiment of this specification. The liveness detection device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 3 includes a second parameter setting module 31, a second sample acquisition module 32, a second feature extraction module 33, an authentication action prediction module 34, an action classification loss calculation module 35, and a second training module 36.
[0282] The second parameter setting module 31 is used to initialize the fifth initial structure parameter in the action selection model;
[0283] The second sample acquisition module 32 is used to acquire the sample human body segmentation result, sample human body counting result and sample time classification result corresponding to the sample image containing the sample detection object, wherein the sample scene image is labeled with the preferred authentication action tag of the sample detection object;
[0284] The second feature extraction module 33 is used to input the sample human body segmentation result, the sample human body counting result and the sample timeliness classification result into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample human body counting result feature and sample timeliness classification result feature;
[0285] The authentication action prediction module 34 is used to input the sample human body segmentation result features, sample human body counting result features and sample time classification result features into the action classification module, and output the sample authentication action of the sample detection object.
[0286] The action classification loss calculation module 35 is used to calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function;
[0287] The second training module 36 is used to adjust the fifth initial structural parameter based on the action classification loss value to obtain the fifth target structural parameter, and to generate the trained action selection model based on the fifth target structural parameter.
[0288] Further, refer to the appendix Figure 13 The liveness detection device shown is equipped with... Figure 13 The liveness detection device described herein is used to perform the functions described in this manual. Figure 8 The methods shown in the embodiments are illustrated for ease of explanation, showing only the parts related to the embodiments of this specification. For specific technical details not disclosed, please refer to this specification. Figure 8 The example shown.
[0289] Please see Figure 13 This document illustrates a schematic diagram of a liveness detection device provided in an exemplary embodiment. The liveness detection device can be implemented as all or part of a device through software, hardware, or a combination of both. The device 4 includes a third parameter setting module 41, a third sample acquisition module 42, a third feature extraction module 43, a future action prediction module 44, a residual calculation module 45, a sample result generation module 46, a future feature prediction loss calculation module 47, a liveness detection loss calculation module 48, and a third training module 49.
[0290] The third parameter setting module 41 is used to initialize the sixth initial structural parameter in the liveness detection model;
[0291] The third sample acquisition module 42 is used to acquire a sample authentication action image of the sample detection object, wherein the sample authentication action image is labeled with the sample identity tag of the sample detection object.
[0292] The third feature extraction module 43 is used to input the sample authentication action image into the basic feature encoder and output the sample authentication action features.
[0293] The future action prediction module 44 is used to input the sample authentication action features into the future action prediction module and output the sample prediction authentication action features.
[0294] The residual calculation module 45 is used to calculate the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features;
[0295] The sample result generation module 46 is used to input the sample residual features and the sample authentication action features into the differential liveness classification module and output the sample liveness detection results.
[0296] The future feature prediction loss calculation module 47 is used to calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function;
[0297] The liveness detection loss calculation module 48 is used to calculate the liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label based on the liveness detection loss function;
[0298] The third training module 49 is used to adjust the sixth initial structural parameter based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and to generate the trained liveness detection model based on the sixth target structural parameter.
[0299] Optionally, the third training module 49 is specifically used to adjust the fourth initial structural parameters of the future action prediction module based on the future feature prediction loss value if the future feature prediction loss value does not converge to the fourth preset value, and then proceed to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action features, until the future feature prediction loss value converges to the fourth preset value, and the fourth target structural parameters are obtained.
[0300] If the liveness detection loss value does not converge to the fifth preset value, the eighth initial structural parameter of the differential liveness classification module is adjusted based on the liveness detection loss value, and the process proceeds to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the liveness detection loss value converges to the fifth preset value, and the eighth target structural parameter is obtained.
[0301] The fifth target structure parameter is obtained based on the seventh target structure parameter and the eighth target structure parameter, and the trained liveness detection model is generated based on the fifth target structure parameter.
[0302] It should be noted that the liveness detection device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the liveness detection method and the liveness detection model training method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the liveness detection device and the liveness detection method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0303] The embodiment numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0304] This specification also provides a storage medium storing a computer program, which, when executed by a processor, implements the above-described functionality. Figures 2-9 The liveness detection method described in the illustrated embodiment can be found in the following document for a detailed execution process. Figures 2-9 The specific details of the illustrated embodiments will not be elaborated here.
[0305] Please refer to Figure 14 This diagram illustrates the structure of an electronic device provided in an exemplary embodiment of this specification. The liveness detection device in this specification may include one or more components such as a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 may be connected via the bus 150.
[0306] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the entire liveness detection device using various interfaces and lines, and executes various functions of terminal 100 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user page, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.
[0307] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the various method embodiments described above, etc. The operating system may be the Android system, including systems deeply developed based on the Android system, the iOS system developed by Apple Inc., including systems deeply developed based on the iOS system, or other systems.
[0308] The memory 120 can be divided into operating system space and user space. The operating system runs in the operating system space, while native and third-party applications run in user space. To ensure that different third-party applications can achieve good running performance, the operating system allocates corresponding system resources for each application. However, different application scenarios within the same third-party application have different requirements for system resources. For example, in local resource loading scenarios, third-party applications have high requirements for disk read speed; in animation rendering scenarios, third-party applications have high requirements for GPU performance. Since the operating system and third-party applications are independent of each other, the operating system often cannot promptly perceive the current application scenario of a third-party application, resulting in the operating system's inability to adapt system resources accordingly.
[0309] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to establish data communication between the third-party applications and the operating system. This would allow the operating system to obtain the current scenario information of the third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0310] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 can be a touch display screen.
[0311] The touch display screen can be designed as a full-screen, curved screen, or irregularly shaped screen. It can also be designed as a combination of a full-screen and a curved screen, or a combination of an irregularly shaped screen and a curved screen; however, this specification does not limit the specific design of the embodiments.
[0312] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above figures does not constitute a limitation on the liveness detection device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the liveness detection device may also include radio frequency circuits, input units, sensors, audio circuits, WiFi modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.
[0313] exist Figure 14 In the illustrated electronic device, the processor 110 can be used to call computer applications stored in the memory 120 and specifically perform the following operations:
[0314] Collect scene images of the target detection object for facial recognition transactions;
[0315] Based on the scene image, confirm the scene timeliness classification result of the scene image;
[0316] Based on the scenario timeliness classification results, the target authentication action of the target detection object is confirmed, and authentication interaction information is generated to instruct the target detection object to perform the target authentication action.
[0317] Obtain the authentication action image of the target detection object performing the target authentication action;
[0318] Based on the authentication action image, a liveness detection result for the target object is generated.
[0319] In one embodiment, when the processor 110 executes the process of confirming the scene timeliness classification result based on the scene image, it specifically performs the following operations:
[0320] Extract features from the scene image to generate a scene feature map;
[0321] Based on the scene feature map, the crowding degree of people in the scene image is determined; the crowding degree of people represents the density of people in the scene image.
[0322] Based on the crowding density of the people and the scene feature map, the scene timeliness classification result of the scene image is confirmed.
[0323] In one embodiment, when the processor 110 performs the operation of determining the crowding level of people in the scene image based on the scene feature map, it specifically performs the following operations:
[0324] Based on the scene feature map, the person counting results and human body segmentation results of the scene image are confirmed.
[0325] In one embodiment, when the processor 110 executes the process of confirming the scene timeliness classification result of the scene image based on the crowding density of people and the scene feature map, it specifically performs the following operations:
[0326] Based on the scene feature map, the human body segmentation result, and the human body counting result, the scene timeliness classification result of the scene image is confirmed.
[0327] In one embodiment, when the processor 110 performs the target authentication action based on the scene timeliness classification result to confirm the target detection object, it specifically performs the following operations:
[0328] The human body segmentation result, the human figure counting result, and the time-based classification result are feature-encoded, and the corresponding human body segmentation result features, human figure counting result features, and time-based classification result features are output.
[0329] Based on the human body segmentation result features, the person counting result features, and the time-based classification result features, the target authentication action of the target detection object is confirmed.
[0330] In one embodiment, when the processor 110 executes the step of acquiring the authentication action image of the target detection object performing the target authentication action, it specifically performs the following operations:
[0331] A sequence of images of the target detection object performing the target authentication action is continuously acquired for a preset number of frames, and the sequence of images is used as the authentication action image.
[0332] In one embodiment, when the processor 110 generates a liveness detection result for the target object based on the authentication action image, it specifically performs the following operations:
[0333] Feature extraction is performed on the authentication action image to obtain the first true feature vector corresponding to the authentication action image;
[0334] Based on the first real feature vector, obtain the first predicted feature vector of the authentication action image, and calculate the first residual vector corresponding to the authentication action image based on the first real feature vector and the first predicted feature vector.
[0335] Based on the first residual vector and the first true feature vector, a liveness detection result for the target object is generated.
[0336] In one embodiment, when the processor 110 performs the steps of obtaining a first predicted feature vector of the authentication action image based on the first real feature vector, and calculating a first residual vector corresponding to the authentication action image based on the first real feature vector and the first predicted feature vector, the processor 110 specifically performs the following operations:
[0337] Based on the second true feature vector of the second action image in the authentication action image, the second predicted feature vector of the third action image is obtained, wherein the second action image is any frame of the authentication action image; the first action image is the last frame of the authentication action image; and the third action image is the next frame of the authentication action image after the second action image.
[0338] Based on the second predicted feature vector and the third true feature vector of the third action image, the second residual vector corresponding to the third action image is calculated.
[0339] The processor 110 can also be used to call computer applications stored in the memory 120 and specifically perform the following operations:
[0340] Initialize the first initial structural parameters in the scene state awareness model;
[0341] Acquire a sample scene image containing the sample detection object, the sample scene image being labeled with a crowd density tag and an image timeliness requirement tag;
[0342] The sample scene image is input into the basic feature encoding module, which outputs the sample scene feature map;
[0343] Input the sample scene feature map into the crowding level module and output the crowding level result of the sample people;
[0344] The sample crowding results and the sample scene feature map are input into the timeliness perception module, and the sample timeliness classification results are output.
[0345] The crowding results of the sample individuals and the crowding loss values corresponding to the crowding labels of the individuals are calculated based on the crowding loss function.
[0346] The timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image are calculated based on the timeliness classification loss function.
[0347] The first initial structural parameters are adjusted based on the crowding loss value and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters.
[0348] In one embodiment, when the processor 110 performs the operation of inputting the sample scene feature map into the crowding density module and outputting the sample crowding density result, it specifically performs the following operations:
[0349] The sample scene feature map is input into the human body segmentation module, and the sample human body segmentation result is output.
[0350] The sample scene feature map is input into the person counting module, and the sample person counting result is output.
[0351] In one embodiment, when the processor 110 executes the sample crowding result and the sample scene feature map input to the timeliness perception module and outputs the sample timeliness classification result, it specifically performs the following operations:
[0352] The sample scene feature map, the sample human body segmentation result, and the sample human body counting result are input into the timeliness perception module, and the sample timeliness classification result is output.
[0353] In one embodiment, when the processor 110 performs the calculation of the crowding result of the sample person and the crowding loss value corresponding to the person crowding label based on the crowding loss function, it specifically performs the following operations:
[0354] The human segmentation loss value corresponding to the human segmentation result of the sample and the human segmentation map label is calculated based on the human segmentation loss function.
[0355] The person counting loss value is calculated based on the person counting loss function, which calculates the person counting result of the sample and the person counting loss value corresponding to the person count label.
[0356] In one embodiment, when the processor 110 adjusts the first initial structural parameters based on the crowding loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and generates the trained scene state awareness model based on the first target structural parameters, it specifically performs the following operations:
[0357] The first initial structural parameters are adjusted based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters.
[0358] In one embodiment, when the processor 110 performs the following operations while adjusting the first initial structural parameters based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and generating the trained scene state awareness model based on the first target structural parameters:
[0359] If the human body segmentation loss value does not converge to the first preset value, the second initial structural parameters of the human body segmentation module are adjusted based on the human body segmentation loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the human body segmentation loss value converges to the first preset value, and the second target structural parameters are obtained.
[0360] If the character counting loss value does not converge to the second preset value, the third initial structure parameter of the character counting module is adjusted based on the character counting loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the character counting loss value converges to the second preset value, and the third target structure parameter is obtained.
[0361] If the timeliness classification loss value does not converge to the third preset value, the fourth initial structural parameter of the timeliness perception module is adjusted based on the timeliness classification loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the timeliness classification loss value converges to the third preset value, and the fourth target structural parameter is obtained.
[0362] The first target structure parameter is obtained based on the second target structure parameter, the third target structure parameter, and the fourth target structure parameter, and the trained scene state perception model is generated based on the first target structure parameter.
[0363] In one embodiment, when the processor 110 invokes a computer application stored in the memory 120, it specifically performs the following operations:
[0364] The initialization action selects the fifth initial structural parameter in the model;
[0365] Obtain sample human body segmentation results, sample human body counting results, and sample timeliness classification results corresponding to sample scene images containing sample detection objects, wherein the sample scene images are labeled with the preferred authentication action tags of the sample detection objects;
[0366] The sample human body segmentation result, the sample human figure count result, and the sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample human figure count result feature, and sample timeliness classification result feature;
[0367] The sample human body segmentation result features, the sample person counting result features, and the sample timeliness classification result features are input into the action classification module, and the sample authentication action of the sample detection object is output.
[0368] Calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function;
[0369] The fifth initial structural parameter is adjusted based on the action classification loss value to obtain the fifth target structural parameter, and the trained action selection model is generated based on the fifth target structural parameter.
[0370] In one embodiment, when the processor 110 invokes a computer application stored in the memory 120, it specifically performs the following operations:
[0371] Initialize the sixth initial structural parameter in the liveness detection model;
[0372] Obtain a sample authentication action image of the sample detection object, wherein the sample authentication action image is labeled with the sample identity tag of the sample detection object;
[0373] The sample authentication action image is input into the basic feature encoder, and the sample authentication action features are output.
[0374] The sample authentication action features are input into the future action prediction module, and the sample predicted authentication action features are output.
[0375] Calculate the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features;
[0376] The sample residual features and the sample authentication action features are input into the differential liveness classification module, and the sample liveness detection results are output.
[0377] Calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function;
[0378] The liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label are calculated based on the liveness detection loss function;
[0379] The sixth initial structural parameter is adjusted based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and the trained liveness detection model is generated based on the sixth target structural parameter.
[0380] In one embodiment, when the processor 110 adjusts the sixth initial structural parameter based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and generates the trained liveness detection model based on the sixth target structural parameter, it specifically performs the following operations:
[0381] If the future feature prediction loss value does not converge to the fourth preset value, then the fourth initial structural parameter of the future action prediction module is adjusted based on the future feature prediction loss value, and the process proceeds to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the future feature prediction loss value converges to the fourth preset value, and the fourth target structural parameter is obtained.
[0382] If the liveness detection loss value does not converge to the fifth preset value, the eighth initial structural parameter of the differential liveness classification module is adjusted based on the liveness detection loss value, and the process proceeds to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the liveness detection loss value converges to the fifth preset value, and the eighth target structural parameter is obtained.
[0383] The fifth target structure parameter is obtained based on the seventh target structure parameter and the eighth target structure parameter, and the trained liveness detection model is generated based on the fifth target structure parameter.
[0384] In the embodiments of this specification, scene images of the target detection object for facial recognition transactions are acquired. Based on the scene images, the scene timeliness classification result of the scene images is confirmed. Based on the scene timeliness classification result, the target authentication action of the target detection object is confirmed, and authentication interaction information is generated to instruct the target detection object to perform the target authentication action. The authentication action image of the target detection object performing the target authentication action is obtained, and based on the authentication action image, the liveness detection result of the target detection object is generated. By analyzing the timeliness requirements of the current scene, the target interaction action is selected according to the level of timeliness requirements of the scene. Then, liveness detection is performed based on the authentication action image of the target detection object performing the target authentication action. This allows for flexible liveness detection according to different scenes, ensuring the security of facial recognition transactions.
[0385] Furthermore, by extracting features from the scene image, a scene feature map is generated. Based on the scene feature map, the crowding level of people in the scene image is determined. Based on the crowding level and the scene feature map, the scene timeliness classification result is determined. By introducing crowding level, and using crowding level and scene image features together as factors to evaluate the scene timeliness classification result, the timeliness requirements of the scene image can be better predicted, thus obtaining the timeliness classification result. Optionally, crowding level includes people counting results and human segmentation results. The human segmentation result features, people counting result features, and timeliness classification result features corresponding to the people counting result, human segmentation result, and scene timeliness classification result are obtained. Based on the human segmentation result features, people counting result features, and timeliness classification result features, the target authentication action of the target detection object is determined. By training models for the three tasks of human segmentation, people counting, and timeliness classification, the multiple tasks can promote each other, ultimately making the performance of each task better than training alone. Therefore, action selection based on the results of multiple tasks can improve the accuracy of action selection.
[0386] Furthermore, by continuously acquiring a sequence of images of the target detection object performing the target authentication action for a preset number of frames, and using the sequence of images as the authentication action images, feature extraction is performed on the authentication action images to obtain the first true feature vector corresponding to the authentication action images. Based on the first true feature vector, the first predicted feature vector of the authentication action images is obtained. Based on the first true feature vector and the first predicted feature vector, the first residual vector corresponding to the authentication action images is calculated. Based on the first residual vector and the first true feature vector, the liveness detection result of the target detection object is generated, which can improve the accuracy of the liveness detection result.
[0387] Furthermore, the first initial structural parameters in the initialization of the action prediction model include the second initial structural parameters of the human body segmentation module, the third initial structural parameters of the person counting module, and the fourth initial structural parameters of the timeliness perception module. The second initial structural parameters of the human body segmentation module are iteratively optimized based on the human body segmentation loss value until the human body segmentation loss value converges to the first preset value. The third initial structural parameters of the person counting module are optimized based on the person counting loss value until the person counting loss value converges to the second preset value. The fourth initial structural parameters of the timeliness perception module are optimized based on the timeliness classification loss value until the timeliness classification loss value converges to the third preset value. The training effect of the model is improved through multi-task training.
[0388] Furthermore, by initializing the initial structural parameters in the action selection model, the sample human body segmentation result, sample person counting result, and sample timeliness classification result corresponding to the sample scene image containing the sample detection object are obtained. The sample human body segmentation result, sample person counting result, and sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result features, sample person counting result features, and sample timeliness classification result features. The sample human body segmentation result features, sample person counting result features, and sample timeliness classification result features are input into the action classification module to output the sample authentication action of the sample detection object. The action classification loss value corresponding to the sample authentication action and the preferred authentication action label is calculated based on the action classification loss function. The fifth initial structural parameter is adjusted based on the action classification loss value to obtain the fifth target structural parameter. The trained action selection model is generated based on the fifth target structural parameter. Thus, during the face recognition process, the action selection model can be directly called to select the authentication action that meets the scene timeliness requirements, and the authentication action can be flexibly generated for liveness detection.
[0389] Furthermore, by initializing the sixth initial structural parameter in the liveness detection model,
[0390] The process involves acquiring sample authentication action images of the target object, inputting these images into a basic feature encoder to output sample authentication action features, inputting these features into a future action prediction module to output predicted authentication action features, calculating the sample residual features corresponding to the sample authentication action features and the predicted authentication action features, inputting these residual features and sample authentication action features into a differential liveness classification module to output sample liveness detection results, calculating the future feature prediction loss value corresponding to the sample authentication action features and the predicted authentication action features based on a future feature prediction loss function, calculating the liveness detection loss value corresponding to the sample liveness detection result and the sample identity label based on a liveness detection loss function, adjusting the sixth initial structural parameters based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameters, and generating a trained liveness detection model based on the sixth target structural parameters. During training, by predicting the action features of future authentication action images based on sample authentication action images, sample differential features of the authentication action images are calculated, further ensuring the detection accuracy of the liveness detection model.
[0391] Additionally, embodiments of this specification provide a computer program product comprising a computer program that, when executed by a processor of an electronic device, enables the processor to at least perform the functions described above. Figures 1 to 9 The method provided in the illustrated embodiment.
[0392] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0393] The above-disclosed embodiments are merely preferred embodiments of this specification and should not be construed as limiting the scope of this specification. Therefore, any equivalent variations made in accordance with the claims of this specification shall still fall within the scope of this specification.
Claims
1. A method for detecting liveness, comprising: Collect scene images of the target detection object for facial recognition transactions; Based on the scene image, the scene timeliness classification result of the scene image is confirmed, and the scene timeliness classification result is the timeliness requirement of the current scene; Based on the scenario timeliness classification results, the target authentication action of the target detection object is confirmed, and authentication interaction information is generated to instruct the target detection object to perform the target authentication action. The target authentication action is a preferred interaction action selected from candidate authentication actions according to the timeliness requirements of the scenario. Obtain authentication action images of the target detection object performing the target authentication action, wherein the authentication action images are a sequence of images continuously collected when the target detection object performs the target authentication action for a preset number of frames; Based on the authentication action image, generate the liveness detection result of the target object; The step of generating a liveness detection result for the target object based on the authentication action image includes: Feature extraction is performed on the authentication action image to obtain the first true feature vector corresponding to the authentication action image; Based on the second true feature vector of the second action image in the authentication action image, the second predicted feature vector of the third action image is obtained, wherein the second action image is any frame of the authentication action image; and the third action image is the next frame of the authentication action image of the second action image. Based on the second predicted feature vector and the third true feature vector of the third action image, the second residual vector corresponding to the third action image is calculated, and the second residual vector corresponding to each frame of the certified action image forms the first residual vector. Based on the first residual vector and the first true feature vector, the liveness detection result of the target detection object is generated; The step of confirming the scene timeliness classification result of the scene image based on the scene image includes: Extract features from the scene image to generate a scene feature map; Based on the scene feature map, the crowding degree of people in the scene image is determined, and the crowding degree of people represents the density of people in the scene image. Based on the crowding density of the people and the scene feature map, the scene timeliness classification result of the scene image is confirmed.
2. The method as described in claim 1, wherein the crowding degree includes the person counting result and the human body segmentation result; The step of determining the crowding level of people in the scene image based on the scene feature map includes: Based on the scene feature map, the person counting results and human body segmentation results of the scene image are confirmed; The process of determining the scene timeliness classification result of the scene image based on the crowding density of people and the scene feature map includes: Based on the scene feature map, the human body segmentation result, and the human body counting result, the scene timeliness classification result of the scene image is confirmed.
3. The method as described in claim 2, wherein confirming the target authentication action of the target detection object based on the scene timeliness classification result includes: The human body segmentation result, the human figure counting result, and the time-based classification result are feature-encoded, and the corresponding human body segmentation result features, human figure counting result features, and time-based classification result features are output. Based on the human body segmentation result features, the person counting result features, and the time-based classification result features, the target authentication action of the target detection object is confirmed.
4. A method for training a liveness detection model, wherein the liveness detection model includes a scene state perception model, comprising: Initialize the first initial structural parameters in the scene state awareness model; Obtain a sample scene image containing the sample detection object. The sample scene image is labeled with a crowding level label and an image timeliness requirement label. The crowding level label includes a human body segmentation map label and a number of people label. The sample scene image is input into the basic feature encoding module, which outputs a sample scene feature map. The sample scene feature map is input into the crowding of people module, and the crowding of people module is output. The crowding of people module includes the human body segmentation result and the human body counting result. The sample crowding results and the sample scene feature map are input into the timeliness perception module, and the sample timeliness classification results are output. The crowding results of the sample individuals and the crowding loss values corresponding to the crowding labels of the individuals are calculated based on the crowding loss function. The timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image are calculated based on the timeliness classification loss function. The first initial structural parameters are adjusted based on the crowding loss value and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters. The step of inputting the sample scene feature map into the crowding density module and outputting the crowding density result of the sample people includes: The sample scene feature map is input into the human body segmentation module, which outputs the sample human body segmentation result. The sample scene feature map is input into the person counting module, and the sample person counting result is output. The sample crowding density result and the sample scene feature map are input into the timeliness perception module, which outputs the sample timeliness classification result, including: The sample scene feature map, the sample human body segmentation result, and the sample human body counting result are input into the timeliness perception module, and the sample timeliness classification result is output. The calculation of the crowding result of the sample person and the crowding loss value corresponding to the crowding label based on the crowding loss function includes: The human segmentation loss value corresponding to the human segmentation result of the sample and the human segmentation map label is calculated based on the human segmentation loss function. The person counting loss value corresponding to the person count label in the sample is calculated based on the person counting loss function. The process of adjusting the first initial structural parameters based on the crowding loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and generating the trained scene state perception model based on the first target structural parameters, includes: The first initial structural parameters are adjusted based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters.
5. The method as described in claim 4, wherein the first initial structural parameter includes a second initial structural parameter, a third initial structural parameter, and a fourth initial structural parameter; The step of adjusting the first initial structural parameters based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and generating the trained scene state perception model based on the first target structural parameters, includes: If the human body segmentation loss value does not converge to the first preset value, the second initial structural parameters of the human body segmentation module are adjusted based on the human body segmentation loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the human body segmentation loss value converges to the first preset value, and the second target structural parameters are obtained. If the character counting loss value does not converge to the second preset value, the third initial structure parameter of the character counting module is adjusted based on the character counting loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the character counting loss value converges to the second preset value, and the third target structure parameter is obtained. If the timeliness classification loss value does not converge to the third preset value, the fourth initial structural parameter of the timeliness perception module is adjusted based on the timeliness classification loss value, and the process proceeds to the step of inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map, until the timeliness classification loss value converges to the third preset value, and the fourth target structural parameter is obtained. The first target structure parameter is obtained based on the second target structure parameter, the third target structure parameter, and the fourth target structure parameter, and the trained scene state perception model is generated based on the first target structure parameter.
6. A method for training a liveness detection model, the liveness detection model comprising an action selection model, including: The initialization action selects the fifth initial structural parameter in the model; Obtain sample human body segmentation results, sample human body counting results, and sample timeliness classification results corresponding to sample scene images containing sample detection objects, wherein the sample scene images are labeled with the preferred authentication action tags of the sample detection objects; The sample human body segmentation result, the sample human figure count result, and the sample timeliness classification result are input into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample human figure count result feature, and sample timeliness classification result feature; The sample human body segmentation result features, the sample person counting result features, and the sample timeliness classification result features are input into the action classification module, and the sample authentication action of the sample detection object is output. Calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function; The fifth initial structural parameter is adjusted based on the action classification loss value to obtain the fifth target structural parameter, and the trained action selection model is generated based on the fifth target structural parameter. The process of obtaining the sample human segmentation result, sample human counting result, and sample time-related classification result corresponding to the sample scene image containing the sample detection object includes: The sample scene image is input into the basic feature encoding module, which outputs a sample scene feature map. The sample scene feature map is input into the human body segmentation module, and the sample human body segmentation result is output. The sample scene feature map is input into the person counting module, and the sample person counting result is output. The sample scene feature map, the sample human body segmentation result, and the sample human body counting result are input into the timeliness perception module, and the timeliness classification result of the sample is output.
7. A method for training a liveness detection model, comprising: Initialize the sixth initial structural parameter in the liveness detection model; Acquire sample authentication action images of the sample detection object. The sample authentication action images are labeled with the sample identity tag of the sample detection object. The sample authentication action images are sequence images, which are multiple sample authentication action images collected in chronological order when the sample detection object performs multiple authentication actions. The sample authentication action image is input into the basic feature encoder, and the sample authentication action features are output. For any one of the multiple sample authentication action images, input the sample authentication action features of the sample authentication action image into the future action prediction module, and output the sample prediction authentication action features of the next sample authentication action image. For any one of the multiple sample authentication action images, calculate the sample authentication action feature and the sample residual feature corresponding to the sample predicted authentication action feature of the sample authentication action image; The sample residual features and the sample authentication action features are input into the differential liveness classification module, and the sample liveness detection results are output. Calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function; The liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label are calculated based on the liveness detection loss function; The sixth initial structural parameter is adjusted based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and the trained liveness detection model is generated based on the sixth target structural parameter.
8. The method of claim 7, wherein the sixth initial structural parameter includes a seventh initial structural parameter and an eighth initial structural parameter; The process of adjusting the sixth initial structural parameter based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameter, and generating the trained liveness detection model based on the sixth target structural parameter, includes: If the future feature prediction loss value does not converge to the fourth preset value, the seventh initial structural parameter of the future action prediction module is adjusted based on the future feature prediction loss value, and the process proceeds to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the future feature prediction loss value converges to the fourth preset value, and the seventh target structural parameter is obtained. If the liveness detection loss value does not converge to the fifth preset value, the eighth initial structural parameter of the differential liveness classification module is adjusted based on the liveness detection loss value, and the process proceeds to the step of inputting the sample authentication action image into the basic feature encoder and outputting the sample authentication action feature, until the liveness detection loss value converges to the fifth preset value, and the eighth target structural parameter is obtained. The fifth target structure parameter is obtained based on the seventh target structure parameter and the eighth target structure parameter, and the trained liveness detection model is generated based on the fifth target structure parameter.
9. A liveness detection device, the device comprising: The first acquisition module is used to acquire scene images of the target detection object for face recognition transactions; The scene classification module is used to confirm the scene timeliness classification result based on the scene image, wherein the scene timeliness classification result is the timeliness requirement of the current scene; The authentication action confirmation module is used to confirm the target authentication action of the target detection object based on the scenario timeliness classification result. The generated authentication interaction information is used to instruct the target detection object to perform a target authentication action. The target authentication action is a preferred interaction action selected from candidate authentication actions based on the timeliness requirements of the scenario. The second acquisition module is used to acquire an authentication action image of the target detection object performing the target authentication action. The authentication action image is a sequence of images continuously acquired when the target detection object performs the target authentication action for a preset number of frames. The result generation module is used to generate a liveness detection result of the target detection object based on the authentication action image; The result generation module is specifically used for: extracting features from the authentication action image to obtain a first true feature vector corresponding to the authentication action image; obtaining a second predicted feature vector for a third action image based on the second true feature vector of the second action image in the authentication action image, wherein the second action image is any frame of the authentication action image; the third action image is the next frame of the authentication action image of the second action image; calculating a second residual vector corresponding to the third action image based on the second predicted feature vector and the third true feature vector of the third action image, wherein the second residual vector corresponding to each authentication action image forms a first residual vector; and generating a liveness detection result for the target detection object based on the first residual vector and the first true feature vector. The scene classification module is specifically used to: extract features from the scene image and generate a scene feature map; based on the scene feature map, determine the crowding degree of people in the scene image, where the crowding degree represents the density of people in the scene image; Based on the crowding density of the people and the scene feature map, the scene timeliness classification result of the scene image is confirmed.
10. A liveness detection device, the device comprising: The first parameter setting module is used to initialize the first initial structural parameters in the scene state perception model. The first sample acquisition module is used to acquire a sample scene image containing the sample detection object. The sample scene image is labeled with a crowding level label and an image timeliness requirement label. The crowding level label includes a human body segmentation map label and a number of people label. The first feature extraction module is used to input the sample scene image into the basic feature encoding module and output the sample scene feature map; The crowding detection module is used to input the sample scene feature map into the person crowding module and output the sample person crowding result, which includes the sample human body segmentation result and the sample person counting result. The timeliness perception module is used to input the sample crowding results and the sample scene feature map into the timeliness perception module and output the sample timeliness classification results. The crowding loss calculation module is used to calculate the crowding result of the sample person and the crowding loss value corresponding to the crowding label of the person based on the crowding loss function; The timeliness classification loss calculation module is used to calculate the timeliness classification result of the sample and the timeliness classification loss value corresponding to the timeliness requirement label of the image based on the timeliness classification loss function. The first training module is used to adjust the first initial structural parameters based on the crowding loss value, the character counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and to generate the trained scene state perception model based on the first target structural parameters. The crowding detection module is specifically used for: The sample scene feature map is input into the human body segmentation module, which outputs the sample human body segmentation result. The sample scene feature map is input into the person counting module, and the sample person counting result is output. The timeliness perception module is specifically used for: The sample scene feature map, the sample human body segmentation result, and the sample human body counting result are input into the timeliness perception module, and the sample timeliness classification result is output. The congestion loss calculation module is specifically used for: The human segmentation loss value corresponding to the human segmentation result of the sample and the human segmentation map label is calculated based on the human segmentation loss function. The person counting loss value corresponding to the person count label in the sample is calculated based on the person counting loss function. The first training module is specifically used for: The first initial structural parameters are adjusted based on the human body segmentation loss value, the person counting loss value, and the timeliness classification loss value to obtain the first target structural parameters, and the trained scene state perception model is generated based on the first target structural parameters.
11. A liveness detection device, the device comprising: The second parameter setting module is used to initialize the fifth initial structure parameter in the action selection model; The second sample acquisition module is used to acquire the sample human body segmentation result, sample human body counting result and sample time classification result corresponding to the sample image containing the sample detection object. The sample scene image is labeled with the preferred authentication action tag of the sample detection object. The second feature extraction module is used to input the sample human body segmentation result, the sample human body counting result, and the sample timeliness classification result into the feature encoding module to obtain the corresponding sample human body segmentation result feature, sample human body counting result feature, and sample timeliness classification result feature; The authentication action prediction module is used to input the sample human body segmentation result features, sample human body counting result features and sample timeliness classification result features into the action classification module, and output the sample authentication action of the sample detection object. The action classification loss calculation module is used to calculate the action classification loss value corresponding to the sample authentication action and the preferred authentication action label based on the action classification loss function. The second training module is used to adjust the fifth initial structural parameter based on the action classification loss value to obtain the fifth target structural parameter, and to generate the trained action selection model based on the fifth target structural parameter; The second sample acquisition module is specifically used for: inputting the sample scene image into the basic feature encoding module and outputting the sample scene feature map; inputting the sample scene feature map into the human body segmentation module and outputting the sample human body segmentation result; and inputting the sample scene feature map into the human body counting module and outputting the sample human body counting result. The sample scene feature map, the sample human body segmentation result, and the sample human body counting result are input into the timeliness perception module, and the timeliness classification result of the sample is output.
12. A liveness detection device, the device comprising: The third parameter setting module is used to initialize the sixth initial structural parameter in the liveness detection model; The third sample acquisition module is used to acquire sample authentication action images of the sample detection object. The sample authentication action images are labeled with the sample identity tag of the sample detection object. The sample authentication action images are sequence images, which are multiple sample authentication action images acquired in chronological order when the sample detection object performs multiple authentication actions. The third feature extraction module is used to input the sample authentication action image into the basic feature encoder and output the sample authentication action features. The future action prediction module is used to input the sample authentication action features of any one of the multiple sample authentication action images into the future action prediction module and output the sample prediction authentication action features of the next sample authentication action image. The residual calculation module is used to calculate the sample residual features corresponding to the sample authentication action features and the sample predicted authentication action features of any one of the multiple sample authentication action images. The sample result generation module is used to input the sample residual features and the sample authentication action features into the differential liveness classification module and output the sample liveness detection results. The future feature prediction loss calculation module is used to calculate the future feature prediction loss value corresponding to the sample authentication action feature and the predicted authentication action feature based on the future feature prediction loss function; The liveness detection loss calculation module is used to calculate the liveness detection result of the sample and the liveness detection loss value corresponding to the sample identity label based on the liveness detection loss function; The third training module is used to adjust the sixth initial structural parameters based on the future feature prediction loss value and the liveness detection loss value to obtain the sixth target structural parameters, and to generate the trained liveness detection model based on the sixth target structural parameters.
13. An electronic device, comprising: Processor and memory; The memory stores a computer program adapted to be loaded by the processor and to execute the steps of the method as described in any one of claims 1 to 8.
14. A storage medium storing a computer program that, when executed by a processor, implements the steps of the method as claimed in any one of claims 1 to 8.
15. A computer program product comprising: A computer program, when executed by a processor of an electronic device, causes the processor to perform the steps of the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Crowding degree detection method, device and system and electronic equipment
CN108021949A
Living body detection method and device, computer device and storage medium
CN109858381A
Real name authentication method, device and system, electronic equipment and storage medium
CN113961899A
Image processing method and device, electronic equipment and storage medium
CN114283463A