Liveness detection model training and liveness detection method, device, equipment and medium

By introducing the metric reward value of the target scene in the training of the face live detection model, a scene-specific loss function is constructed, which solves the problem of insufficient accuracy caused by the difference in tolerance of misjudgment in different scenarios, and achieves higher accuracy and adaptability of live detection.

CN116884097BActive Publication Date: 2025-08-22BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310703457.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-14
Publication Date
2025-08-22
Estimated Expiration
2043-06-14

AI Technical Summary

Technical Problem

The prior art uses the same loss function to train the face live detection model in different scenarios, ignoring the difference in tolerance of misjudgment in different scenarios, resulting in insufficient accuracy of the live detection results.

Method used

The reward value is determined by using the measurement indicators of the target scenario, and the loss function for different scenarios is constructed. The model parameters of the live detection model are adjusted through reinforcement learning, and metric indicators such as TAR and TRR are introduced to improve model adaptability.

Benefits of technology

It improves the accuracy of the live detection model in different scenarios, has stronger adaptability, reduces misjudgment, and improves the overall performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116884097B_ABST
    Figure CN116884097B_ABST
Patent Text Reader

Abstract

The present disclosure provides a liveness detection model training and liveness detection method, device, equipment and storage medium, which relate to the field of artificial intelligence technology, specifically computer vision, image processing, deep learning and other technical fields. The training method of the liveness detection model includes: using the liveness detection model of the target scene to process the sample image to obtain the predicted detection result of the sample image; determining the reward value of the target scene based on the index value of the metric of the target scene; constructing the loss function of the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image and the reward value of the target scene; adjusting the model parameters of the liveness detection model of the target scene based on the loss function of the target scene. The present disclosure can improve the accuracy of liveness detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, specifically computer vision, image processing, deep learning and other technical fields, and more particularly to a liveness detection model training and liveness detection method, device, equipment and medium. Background Art

[0002] Face liveness detection is the process of distinguishing whether an image is taken by a real person. It is a fundamental module of face recognition systems and ensures their security. Face liveness detection models are typically used for face liveness detection, and the detection result is either liveness or an attack. Summary of the Invention

[0003] The present disclosure provides a method, apparatus, device, and medium for training a liveness detection model and for detecting liveness.

[0004] According to one aspect of the present disclosure, a training method for a liveness detection model is provided, comprising: processing a sample image using a liveness detection model of a target scene to obtain a predicted detection result of the sample image; determining a reward value of the target scene based on an index value of a metric of the target scene; constructing a loss function of the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image, and the reward value of the target scene; and adjusting model parameters of the liveness detection model of the target scene based on the loss function of the target scene.

[0005] According to another aspect of the present disclosure, a liveness detection method is provided, comprising: acquiring an image to be processed; processing the image to be processed using a pre-trained liveness detection model to obtain a detection result of the image to be processed; wherein the liveness detection model is trained using any of the methods described in any of the above aspects.

[0006] According to another aspect of the present disclosure, a training device for a liveness detection model is provided, comprising: a prediction module for processing a sample image using a liveness detection model of a target scene to obtain a predicted detection result of the sample image; a determination module for determining a reward value of the target scene based on an index value of a metric of the target scene; a construction module for constructing a loss function of the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image and the reward value of the target scene; and an adjustment module for adjusting model parameters of the liveness detection model of the target scene based on the loss function of the target scene.

[0007] According to another aspect of the present disclosure, a liveness detection device is provided, comprising: an acquisition module for acquiring an image to be processed; a detection module for processing the image to be processed using a pre-trained liveness detection model to obtain a detection result of the image to be processed; wherein the liveness detection model is trained using any of the methods described in any of the above aspects.

[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any one of the methods described in any one of the above aspects.

[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to any one of the above aspects.

[0010] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method according to any one of the above aspects.

[0011] According to the technical solution disclosed in the present invention, the accuracy of living body detection can be improved.

[0012] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0014] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;

[0015] Figure 2 is a schematic diagram of an application scenario provided according to an embodiment of the present disclosure;

[0016] Figure 3 Schematic diagram of the overall architecture of a training method for a liveness detection model provided according to an embodiment of the present disclosure;

[0017] Figure 4 is a schematic diagram according to a second embodiment of the present disclosure;

[0018] Figure 5is a schematic diagram of a method for obtaining reward values ​​provided in accordance with an embodiment of the present disclosure;

[0019] Figure 6 is a schematic diagram according to a third embodiment of the present disclosure;

[0020] Figure 7 is a schematic diagram according to a fourth embodiment of the present disclosure;

[0021] Figure 8 is a schematic diagram according to a fifth embodiment of the present disclosure;

[0022] Figure 9 Schematic diagram of an electronic device used to implement the training method of a liveness detection model or the liveness detection method of an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0024] In related technologies, the same loss function is used for training facial liveness detection models in different scenarios. However, the tolerance for misclassifying liveness as an attack or misclassifying an attack as liveness varies in different scenarios. For example, the tolerance for the former is low in traffic scenarios, while the tolerance for the latter is low in financial scenarios.

[0025] If the same loss function is used for different scenarios, the differences between different scenarios will be ignored, resulting in insufficient accuracy of liveness detection results.

[0026] In order to improve the accuracy of liveness detection, the present disclosure provides the following embodiments.

[0027] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. This embodiment provides a method for training a liveness detection model, the method comprising:

[0028] 101. Process a sample image using a liveness detection model of a target scene to obtain a predicted detection result of the sample image.

[0029] 102. Determine a reward value for the target scenario based on the indicator value of the metric of the target scenario.

[0030] 103. Construct a loss function for the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image, and the reward value of the target scene.

[0031] 104. Adjust model parameters of a living body detection model for the target scene based on the loss function of the target scene.

[0032] Among them, the liveness detection model is a deep neural network model, which can be a convolutional neural network (CNN) model or a Transformer model.

[0033] The liveness detection model takes an image as input and outputs a detection result, which can be either live or attack. That is, if the image is taken by a real person, the correct detection result is liveness; if the image is not taken by a real person, the correct detection result is attack.

[0034] The training process of the liveness detection model includes multiple rounds of iterations, starting from the initial value, and continuously updating the model parameters until the preset end conditions are met (such as reaching a preset number of times or model convergence), and the final liveness detection model is obtained.

[0035] The model is updated based on the loss function. For example, the back propagation (BP) algorithm is used to adjust the model parameters and the model parameters are updated based on the loss function.

[0036] The adjustment parameters can be: adjusted parameters = parameters before adjustment + learning rate * gradient value, where the gradient value is obtained by derivatizing the loss function with respect to the model parameters.

[0037] During each iteration, a loss function can be constructed based on the training data.

[0038] The training data may include samples and label values. In this embodiment, the sample is a sample image, and the label value is the real detection result of the sample image. The real detection result is used to characterize whether the sample image is taken by a real person. For example, the real detection result is a living body (which can be represented by 1) or an attack (which can be represented by 0).

[0039] During training, the sample image is input into the liveness detection model before updating, and the output is the predicted detection result of the sample image.

[0040] In related technologies, loss functions are typically constructed based on predicted and actual detection results. However, due to varying tolerances for misjudgments in different scenarios, these loss functions are inaccurate, and consequently, the model and the liveness detection based on it are also inaccurate.

[0041] In this embodiment, when constructing the loss function, it is based not only on the predicted detection results and the actual detection results, but also on the reward value, so that a liveness detection model can be obtained based on reinforcement learning.

[0042] The reward value is determined based on the indicator value of the measurement indicator. The measurement indicator is preset and different measurement indicators can be set in different scenarios.

[0043] For example, in a traffic scenario, the metric can be set as the Truth Accept Rate (TAR); or in a financial scenario, the metric can be set as the Truth Reject Rate (TRR).

[0044] The pass rate (TAR) refers to the probability that the detection result of an image taken by a real person is alive. For example, if the indicator value is 99%, it means that out of 100 real-person requests, 99 will pass because the liveness score is above the threshold.

[0045] The TRR (Treatment Rejection Rate) refers to the probability that the detection result corresponding to an image not taken by a real person is an attack. For example, if the indicator value is 99%, it means that 99 out of 100 attack requests will be identified as attacks and rejected.

[0046] The target scenario refers to the scenario where the liveness detection model is to be applied, such as a traffic scenario or a financial scenario.

[0047] Different scenarios can use liveness detection models corresponding to the scenarios. For example, for traffic scenarios, liveness detection is performed using the liveness detection model for traffic scenarios; for financial scenarios, liveness detection is performed using the liveness detection model for financial scenarios.

[0048] Different scenarios can correspond to different measurement indicators. After obtaining the indicator value of the measurement indicator of the corresponding scenario, the reward value of the corresponding scenario can be determined based on the indicator value. Then, based on the actual detection results, predicted detection results and reward value, the loss function of the target scenario can be constructed. Then, based on the loss function of the target scenario, the model parameters can be adjusted until the preset end condition is reached, and the final liveness detection model of the target scenario is obtained.

[0049] In this embodiment, a reward value is introduced when constructing a loss function. The reward value is constructed based on the indicator value of the metric of the target scene. Since the metric can be set for the target scene, appropriate metric can be set based on the target scene. Different metric can be set in different scenes as needed, and then loss functions based on different metric can be constructed in different scenes, thereby improving the accuracy of the loss function, improving the performance of the liveness detection model, and improving the accuracy of active detection.

[0050] In order to better understand the embodiments of the present disclosure, application scenarios to which the embodiments of the present disclosure can be applied are described.

[0051] Figure 2 This is a schematic diagram of an application scenario corresponding to the embodiment of the present disclosure. This embodiment takes liveness detection based on face images as an example. Figure 2 As shown, the user can use a user terminal to upload the face image to be processed. The user terminal can be a terminal with an image acquisition module (such as a camera), such as a mobile phone, tablet computer, laptop computer, smart wearable device, etc.

[0052] Taking a mobile phone as an example, an application (Application, APP) that needs to perform liveness detection can be installed on the mobile phone 201. When liveness detection is required, the APP can use the camera on the mobile phone 201 to collect the user's facial image and transmit the facial image to the server corresponding to the client. The server can be deployed on the server 202, and the server can be a local server or a cloud server. After the server receives the facial image, it can input the facial image into the liveness detection model and output the liveness detection result, which is live or attack. The server can return the liveness detection result to the APP, and the APP can pass or fail the liveness detection based on the liveness detection result. The above takes the example of the server performing liveness detection based on the liveness detection model. It can be understood that if the user terminal has the corresponding capability locally, liveness detection can also be performed locally on the user terminal based on the liveness detection model.

[0053] The liveness detection model is obtained through training. For the training phase of the liveness detection model, Figure 4 As shown, in this embodiment, the overall training phase includes two phases, namely the pre-training phase and the dedicated training phase. The pre-training phase is used to obtain a pre-training model that is universal for different scenarios, and the dedicated training phase is used to obtain a liveness detection model that is dedicated to each scenario.

[0054] like Figure 3 As shown, the training data in the pre-training phase is<x1,y1> Represents, where x1 is the pre-training image and y1 is the label value of the pre-training image, that is, the true detection result. For example, y1=1 means that the pre-training image is taken by a real person, that is, the true detection result is a living body; y1=0 means that the pre-training image is not taken by a real person, that is, the true detection result is an attack.

[0055] Similarly, the training data for the dedicated training phase is<x2,y2> Represents, where x2 is the sample image and y2 is the label value of the sample image, that is, the true detection result. For example, y2=1 means that the sample image is taken by a real person, that is, the true detection result is liveness; y2=0 means that the sample image is not taken by a real person, that is, the true detection result is attack.

[0056] During the pre-training phase, the pre-training model processes the input pre-training image (x1) and outputs the predicted detection result (y1') corresponding to the pre-training image x1. A pre-training loss function (e.g., represented by L1) can then be constructed based on the predicted detection result y1' and the true detection result y1. This L1 is then used to adjust the model parameters of the pre-training model until the pre-training phase ends (e.g., a preset number of times is reached or the pre-training model converges), resulting in the final pre-training model. L1 can specifically be a cross-entropy loss function, and the specific calculation formula can be expressed as:

[0057]

[0058] Among them, x1 i ,y1 i ,y1 i ' respectively represent the i-th pre-training image, the true detection result of the i-th pre-training image, and the predicted detection result of the i-th pre-training image during the pre-training phase. n1 represents the total number of samples. Training can be performed in batches, so n1 can be specifically the total number of samples in the corresponding batch. θ represents the model parameters.

[0059] During the dedicated training phase, the liveness detection model processes the input sample image (x2) and outputs the predicted detection result (y2') corresponding to the sample image x2. Unlike the pre-training phase, where the loss function is directly constructed based on the predicted detection results and the actual detection results, the dedicated training phase constructs the loss function using reinforcement learning. Specifically, the loss function for the target scenario in the dedicated training phase is constructed based on the predicted detection result y2', the actual detection result y2, and the reward value r.

[0060] Assuming that the loss function of the target scene is expressed as L2, the calculation formula of L2 can be:

[0061]

[0062] Among them, x2 i ,y2 i ,y2 i ' respectively represent the i-th sample image in the dedicated training phase, the true detection result for the i-th sample image, and the predicted detection result for the i-th sample image. n2 represents the total number of samples, which may be the same as or different from n1. Training can be performed in batches, so n2 can be the total number of samples in the corresponding batch. θ represents the model parameters, and r represents the reward value.

[0063] The reward value r can be calculated based on the indicator value of the metric. The metric can be set according to the target scenario, and different metric can be set for different target scenarios. For example, in the traffic scenario, the metric can be set to TAR, and in the financial scenario, the metric can be set to TRR.

[0064] The metric value can be obtained using pre-set test images and a liveness detection model. Taking TAR as an example, for N test images with actual liveness detection results, each test image is input into the liveness detection model, and the output is a predicted detection result. Assuming that the number of test images predicted to be liveness is M, the metric value of TAR = M / N.

[0065] Using the above calculation formula, based on the same test image, we can obtain the corresponding index values ​​of the liveness detection model at different times. Furthermore, the difference between the current index value and the previous index value can be used as the reward value. For example, if the current index value is represented by r1 and the previous index value is represented by r0, then the reward value r = r1 - r0.

[0066] In combination with the above application scenarios, the present disclosure also provides the following embodiments.

[0067] Figure 4 is a schematic diagram according to the second embodiment of the present disclosure. This embodiment provides a method for training a liveness detection model, the method comprising:

[0068] 401. Process a pre-trained image using a pre-trained model to obtain a predicted detection result of the pre-trained image.

[0069] 402. Construct a pre-training loss function based on the actual detection result of the pre-training image and the predicted detection result of the pre-training image.

[0070] 403. Based on the pre-training loss function, adjust the model parameters of the pre-training model to obtain a final pre-training model, and use the final pre-training model as the initial value of the living body detection model of the target scene.

[0071] Combine Figure 3 , the above 401-403 can be completed in the pre-training stage.

[0072] The training data in the pre-training stage includes pre-training images and their label values ​​(real detection results). After the pre-training images are input into the pre-training model, the output is the predicted detection results of the pre-training images. A pre-training loss function is constructed based on the predicted detection results and the real detection results. The model parameters are adjusted through the pre-training loss function until the end conditions of the pre-training stage are met (such as reaching the preset number of times, or the pre-training model converges), and the final pre-training model is obtained.

[0073] The pre-training model is universal for various scenarios, and its pre-training images can be selected from images of various scenarios. The pre-training loss function can be a cross-entropy loss function constructed based on the predicted detection results and the actual detection results.

[0074] The final pre-trained model can be used as the initial value of the liveness detection model for different scenarios. In different scenarios, the general final pre-trained model can be fine-tuned to obtain the final liveness detection model for each scenario.

[0075] In this embodiment, the overall training phase consists of two stages: a pre-training stage and a dedicated training stage. The pre-training stage allows for rapid convergence of the pre-trained model, improving model training efficiency. The model is pre-trained only once, followed by fine-tuning through reinforcement learning in different target scenarios to rapidly produce different capabilities. This significantly reduces the cost of subsequent model maintenance and upgrades, while also enabling rapid iterative updates.

[0076] 404. Process the sample image using the liveness detection model of the target scene to obtain a predicted detection result of the sample image.

[0077] 405. Determine a reward value for the target scenario based on the indicator value of the metric of the target scenario.

[0078] 406. Construct a loss function for the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image, and the reward value of the target scene.

[0079] 407. Adjust model parameters of a living body detection model for the target scene based on the loss function of the target scene.

[0080] Among them, in different target scenarios, images of corresponding scenarios can be selected as sample images. For example, in a traffic scenario, images related to traffic are selected as sample images of the traffic scenario; in a financial scenario, images related to finance are selected as sample images of the traffic scenario.

[0081] The initial values ​​of the liveness detection models for different scenarios are all the final pre-trained models. Since the final pre-trained model has achieved good performance, fine-tuning the target scenario based on this model can improve the training effect.

[0082] Different target scenarios may be set with different metrics. For example, if the target scenario is a traffic scenario, the metric is TAR; or if the target scenario is a financial scenario, the metric is TRR.

[0083] Since traffic scenarios are more tolerant of misidentifying attacks as live entities, and TAR is a metric that reflects the pass rate, TAR is more suitable for traffic scenarios. Similarly, financial scenarios are more tolerant of misidentifying live entities as attacks, and TRR focuses more on the rejection rate, making TRR more suitable for financial scenarios.

[0084] In this embodiment, by selecting different measurement indicators in different scenarios, appropriate measurement indicators can be selected based on actual conditions, thereby improving the model training effect and the accuracy of liveness detection.

[0085] In some embodiments, the reward value is determined based on the index value of the metric of the target scene, including: processing the test image using the liveness detection model of the target scene to obtain a predicted detection result of the test image; performing statistics on the predicted detection result of the test image and the actual detection result of the test image to obtain the index value of the metric at the current moment; and determining the reward value of the target scene based on the index value at the current moment.

[0086] Among them, such as Figure 5 As shown, a batch of test images can be preset for the target scenario. These test images are used to test the performance of the liveness detection model at different times. For example, a test cycle can be preset. After the test cycle is reached, the test images are input into the liveness detection model at the current moment, and the output is the predicted detection result of the test images at the current moment. By statistically analyzing the actual detection results and the predicted detection results of the test images, the indicator value at the current moment can be obtained.

[0087] Taking the metric TAR as an example, at the current moment, N real detection results are test images of living things. Each test image is input into the living thing detection model, and the output is the predicted detection result. Assuming that the number of test images with predicted detection results of living things is M, then the indicator value of the metric TAR at the current moment = M / N.

[0088] Through the liveness detection model at each moment and the same test image, the index value at each moment can be obtained.

[0089] For the current moment, the index value at the current moment may be used as the reward value, or the difference between the index value at the current moment and the index value at the previous moment may be used as the reward value.

[0090] like Figure 5 As shown, the current moment is represented by the t-th moment, the previous moment is represented by the (t-1)-th moment, and the reward value is taken as the difference between the index value at the current moment and the index value at the previous moment.

[0091] In this embodiment, the reward value is determined based on the indicator value of the metric, and the metric that is more concerned by different target scenarios can be used as a reward, so that the model can be more in line with the dedicated capabilities of a specific target scenario.

[0092] In this embodiment, by using the difference between the index value at the current moment and the index value at the previous moment as the reward value, the index value increment can be used as the reward value, which can improve the reinforcement learning performance, thereby improving the model performance and improving the liveness detection effect.

[0093] After obtaining the reward value, the loss function of the target scene can be constructed based on the actual detection results of the sample image, the predicted detection results, and the reward value.

[0094] Specifically, it may include: constructing an initial loss function based on the actual detection result of the sample image and the predicted detection result of the sample image; and multiplying the reward value by the initial loss function to obtain the loss function of the target scene.

[0095] Among them, the initial loss function can be a cross-entropy loss function constructed based on the actual detection results and the predicted detection results. After that, the reward value is used as a weight coefficient and multiplied by the cross-entropy loss function to obtain the loss function of the target scene.

[0096] In this embodiment, the loss function of the target scene is obtained by multiplying the reward value with the initial loss function. The reward value can be introduced into the loss function of the target scene. Under the guidance of the reward value, the model can be fine-tuned in the direction required by the target scene to obtain a more effective liveness detection model suitable for the target scene, thereby improving the accuracy of liveness detection.

[0097] Figure 6 is a schematic diagram according to a third embodiment of the present disclosure. This embodiment provides a liveness detection method, the method comprising:

[0098] 601. Obtain an image to be processed.

[0099] 602. Use a pre-trained living body detection model to process the image to be processed to obtain a detection result of the image to be processed.

[0100] The liveness detection model is trained using any of the above embodiments.

[0101] In this embodiment, the loss function of the liveness detection model is constructed based on a reward value, which is constructed based on the index value of the target scenario's metric. Since different metric indicators can be set for different scenarios, appropriate metric indicators can be set based on the target scenario, and loss functions based on different metric indicators can be constructed for different scenarios. This improves the accuracy of the loss function and enhances the performance of the liveness detection model. Liveness detection based on this high-performance liveness detection model can therefore improve liveness detection results.

[0102] Figure 7 This embodiment provides a training device for a liveness detection model, such as Figure 7 As shown, the device 700 includes: a prediction module 701, a determination module 702, a construction module 703 and an adjustment module 704.

[0103] The prediction module 701 is used to process the sample image using the liveness detection model of the target scene to obtain the predicted detection result of the sample image; the determination module 702 is used to determine the reward value of the target scene based on the index value of the measurement index of the target scene; the construction module 703 is used to construct the loss function of the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image and the reward value of the target scene; the adjustment module 704 is used to adjust the model parameters of the liveness detection model of the target scene based on the loss function of the target scene.

[0104] In this embodiment, a reward value is introduced when constructing a loss function. The reward value is constructed based on the indicator value of the metric of the target scene. Since the metric can be set for the target scene, appropriate metric can be set based on the target scene. Different metric can be set in different scenes as needed, and then loss functions based on different metric can be constructed in different scenes, thereby improving the accuracy of the loss function, improving the performance of the liveness detection model, and improving the accuracy of active detection.

[0105] In some embodiments, the determination module 702 is further used to: process the test image using the liveness detection model of the target scene to obtain a predicted detection result of the test image; perform statistics on the predicted detection result of the test image and the actual detection result of the test image to obtain the index value of the metric at the current moment; and determine the reward value of the target scene based on the index value at the current moment.

[0106] In this embodiment, the reward value is determined based on the indicator value of the metric, and the metric that is more concerned by different target scenarios can be used as a reward, so that the model can be more in line with the dedicated capabilities of a specific target scenario.

[0107] In some embodiments, the determination module 702 is further configured to: use the indicator value at the current moment as the reward value; or calculate the difference between the indicator value at the current moment and the indicator value at the previous moment, and use the difference as the reward value.

[0108] In this embodiment, by using the difference between the index value at the current moment and the index value at the previous moment as the reward value, the index value increment can be used as the reward value, which can improve the reinforcement learning performance, thereby improving the model performance and improving the liveness detection effect.

[0109] In some embodiments, the construction module 703 is further used to: construct an initial loss function based on the actual detection result of the sample image and the predicted detection result of the sample image; and multiply the reward value by the initial loss function to obtain the loss function of the target scene.

[0110] In this embodiment, the loss function of the target scene is obtained by multiplying the reward value with the initial loss function. The reward value can be introduced into the loss function of the target scene. Under the guidance of the reward value, the model can be fine-tuned in the direction required by the target scene to obtain a more effective liveness detection model suitable for the target scene, thereby improving the accuracy of liveness detection.

[0111] In some embodiments, the apparatus 700 further includes:

[0112] A pre-training module is used to process a pre-training image using a pre-training model to obtain a predicted detection result of the pre-training image; construct a pre-training loss function based on the actual detection result of the pre-training image and the predicted detection result of the pre-training image; and, based on the pre-training loss function, adjust the model parameters of the pre-training model to obtain a final pre-training model, and use the final pre-training model as the initial value of the liveness detection model of the target scene.

[0113] In this embodiment, the overall training phase consists of two stages: a pre-training stage and a dedicated training stage. The pre-training stage allows for rapid convergence of the pre-trained model, improving model training efficiency. The model is pre-trained only once, followed by fine-tuning through reinforcement learning in different target scenarios to rapidly produce different capabilities. This significantly reduces the cost of subsequent model maintenance and upgrades, while also enabling rapid iterative updates.

[0114] In some embodiments, if the target scenario is a traffic scenario, the metric is TAR; or, if the target scenario is a financial scenario, the metric is TRR.

[0115] In this embodiment, by selecting different measurement indicators in different scenarios, appropriate measurement indicators can be selected based on actual conditions, thereby improving the model training effect and the accuracy of liveness detection.

[0116] Figure 8 This is a schematic diagram of the fifth embodiment of the present disclosure. This embodiment provides a living body detection device, such as Figure 8 As shown, the device 800 includes: an acquisition module 801 and a detection module 802.

[0117] The acquisition module 801 is used to acquire an image to be processed; the detection module 802 is used to process the image to be processed using a pre-trained liveness detection model to obtain a detection result of the image to be processed;

[0118] The liveness detection model is trained using any of the above embodiments.

[0119] In this embodiment, the loss function of the liveness detection model is constructed based on a reward value, which is constructed based on the index value of the target scenario's metric. Since different metric indicators can be set for different scenarios, appropriate metric indicators can be set based on the target scenario, and loss functions based on different metric indicators can be constructed for different scenarios. This improves the accuracy of the loss function and enhances the performance of the liveness detection model. Liveness detection based on this high-performance liveness detection model can therefore improve liveness detection results.

[0120] It can be understood that in the embodiments of the present disclosure, the same or similar contents in different embodiments can be referenced to each other.

[0121] It can be understood that the terms “first”, “second”, etc. in the embodiments of the present disclosure are only used for distinction and do not indicate the degree of importance, time sequence, etc.

[0122] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0123] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0124] Figure 9A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device 900 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0125] like Figure 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0126] Multiple components in the electronic device 900 are connected to the I / O interface 905, including an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a magnetic disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0127] The computing unit 901 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the training method of the liveness detection model or the liveness detection method. For example, in some embodiments, the training method of the liveness detection model or the liveness detection method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the training method of the liveness detection model or the liveness detection method described above can be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to execute a training method for a liveness detection model or a liveness detection method in any other appropriate manner (for example, by means of firmware).

[0128] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0129] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0130] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0131] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0132] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0133] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact via a communication network. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and VPS services ("Virtual Private Servers" or simply "VPS"). The server may also be a server in a distributed system or a server integrated with blockchain.

[0134] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0135] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A method for training a liveness detection model, comprising: Processing the sample image using a liveness detection model of the target scene to obtain a predicted detection result of the sample image; Determining a reward value for the target scenario based on an indicator value of a metric of the target scenario; constructing a loss function for the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image, and the reward value of the target scene; Adjusting model parameters of a liveness detection model for the target scene based on the loss function of the target scene; The determining of the reward value based on the indicator value of the metric of the target scenario includes: Processing the test image using the liveness detection model of the target scene to obtain a predicted detection result of the test image; Performing statistics on the predicted detection result of the test image and the actual detection result of the test image to obtain the index value of the measurement index at the current moment; Determining a reward value for the target scenario based on the indicator value at the current moment; The constructing of a loss function of the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image, and the reward value of the target scene includes: constructing an initial loss function based on the actual detection result of the sample image and the predicted detection result of the sample image; The reward value is multiplied by the initial loss function to obtain the loss function of the target scene.

2. The method according to claim 1, wherein The determining the reward value of the target scenario based on the current indicator value includes: The current indicator value is used as the reward value; or The difference between the index value at the current moment and the index value at the previous moment is calculated, and the difference is used as the reward value.

3. The method according to claim 1, further comprising: Processing the pre-trained image using the pre-trained model to obtain a predicted detection result of the pre-trained image; Constructing a pre-training loss function based on the actual detection results of the pre-training images and the predicted detection results of the pre-training images; Based on the pre-training loss function, the model parameters of the pre-training model are adjusted to obtain a final pre-training model, and the final pre-training model is used as the initial value of the living body detection model of the target scene.

4. The method according to any one of claims 1 to 3, wherein: If the target scene is a traffic scene, the measurement indicator is the passing rate TAR; or If the target scenario is a financial scenario, the measurement indicator is the rejection rate TRR.

5. A liveness detection method, comprising: Get the image to be processed; Using a pre-trained liveness detection model to process the image to be processed to obtain a detection result of the image to be processed; The liveness detection model is trained using the method according to any one of claims 1 to 4.

6. A training device for a liveness detection model, comprising: A prediction module, configured to process a sample image using a liveness detection model of a target scene to obtain a predicted detection result of the sample image; A determination module, configured to determine a reward value for the target scenario based on an indicator value of a metric of the target scenario; A construction module, configured to construct a loss function of the target scene based on the actual detection result of the sample image, the predicted detection result of the sample image, and the reward value of the target scene; An adjustment module, configured to adjust model parameters of a liveness detection model for the target scene based on a loss function of the target scene; The determining module is further configured to: Processing the test image using the liveness detection model of the target scene to obtain a predicted detection result of the test image; Performing statistics on the predicted detection result of the test image and the actual detection result of the test image to obtain the index value of the measurement index at the current moment; Determining a reward value for the target scenario based on the indicator value at the current moment; The building blocks are further configured to: constructing an initial loss function based on the actual detection result of the sample image and the predicted detection result of the sample image; The reward value is multiplied by the initial loss function to obtain the loss function of the target scene.

7. The device according to claim 6, wherein The determining module is further configured to: The current indicator value is used as the reward value; or The difference between the index value at the current moment and the index value at the previous moment is calculated, and the difference is used as the reward value.

8. The apparatus according to claim 6, further comprising: A pre-training module is used to process the pre-training image using the pre-training model to obtain a prediction detection result of the pre-training image; Based on the actual detection results of the pre-training image and the predicted detection results of the pre-training image, a pre-training loss function is constructed; and based on the pre-training loss function, the model parameters of the pre-training model are adjusted to obtain a final pre-training model, and the final pre-training model is used as the initial value of the liveness detection model of the target scene.

9. The device according to any one of claims 6 to 8, wherein: If the target scene is a traffic scene, the measurement indicator is the passing rate TAR; or If the target scenario is a financial scenario, the measurement indicator is the rejection rate TRR.

10. A living body detection device, comprising: An acquisition module, used for acquiring an image to be processed; A detection module is used to process the image to be processed using a pre-trained liveness detection model to obtain a detection result of the image to be processed; The liveness detection model is trained using the method according to any one of claims 1 to 4.

11. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.

12. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 5.

13. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Living body detection method and device, equipment and storage medium

    CN111753595A

  • Living body test model training method and device, living body test method and device and storage medium

    CN116071833A