Living body detection model training method and device, storage medium and terminal

CN116486491BActive Publication Date: 2026-08-07ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
Filing Date
2022-09-07
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0003]本说明书实施例提供一种活体检测模型训练方法、装置、存储介质以及终端,可以解决相关技术中无法准确识别检测活体图像和非活体图像的技术问题

Benefits of technology

[0024]本说明书实施例提供一种活体检测模型训练方法,首先确定需要进行检测的目标场景对应的活体样本数据,将活体样本数据输入已有用于在原始场景中检测活体数据的原始活体检测模型中,得到第一输出数据;再将活体样本数据输入根据原始活体检测模型确定的目标活体检测模型中,将活体样本数据输入目标活体检测模型中得到第二输出数据,基于第一输出数据和第二输出数据构成的损失函数对目标活体检测模型进行训练。由于在训练新场景下的目标活体检测模型的过程中,使用完成原有场景活体检测的原始模型对新场景活体样本数据的输出,来与目标活体检测模型的输出一起构建出训练新模型的损失函数,使得目标活体检测模型在训练时受到原模型的约束,保证了训练得到的目标活体检测模型可以保有原始活体检测模型的性能,以使得模型在已有功能不被覆盖的基础上继续优化,大幅度提升在多种场景下的活体检测准确度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116486491B_ABST
    Figure CN116486491B_ABST
Patent Text Reader

Abstract

The embodiment of the specification discloses a kind of live detection model training method, device, storage medium and terminal, first input live sample data in original live detection model and obtain first output data;Second live sample data is input into target live detection model and obtain second output data, and target live detection model is trained based on first output data and second output data.Due to the target live detection model in the training of new scene, the target live detection model for new scene is obtained on the basis of original live detection model, the output of original live detection model to live sample data in new scene is used to constrain the parameter adjustment direction of target live detection model, so that target live detection model can retain the accuracy of original live detection model, while continuing optimization on the basis that existing function is not covered, improve the detection accuracy of live detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of artificial intelligence technology, and in particular to a method, apparatus, storage medium, and terminal for training a liveness detection model. Background Technology

[0002] With the development of internet technology in recent years, people can use liveness detection systems to identify their identities in daily life. However, this process may capture images of non-living individuals. To avoid adverse effects, it is necessary to accurately identify and block operations related to non-living images. However, due to the structural and storage limitations of liveness detection systems, handling new tasks in new scenarios can lead to the overriding of existing functions. Consequently, the system may be unable to complete liveness detection in the original scenario, meaning it cannot accurately identify non-living images, thus jeopardizing user data security. Summary of the Invention

[0003] This specification provides a method, apparatus, storage medium, and terminal for training a liveness detection model, which can solve the technical problem in related technologies that cannot accurately identify and detect liveness images and non-liveness images.

[0004] Firstly, embodiments of this specification provide a method for training a liveness detection model, the method comprising:

[0005] Acquire live sample data in the target scene, determine the first output data corresponding to the live sample data in the original live detection model, the original live detection model is used to detect live data in the original scene;

[0006] The target liveness detection model is determined based on the original liveness detection model, and the liveness sample data is input into the target liveness detection model to obtain the second output data;

[0007] The target liveness detection model is trained based on the loss function formed by the second output data and the first output data.

[0008] Secondly, embodiments of this specification provide a method for detecting live organisms, the method comprising:

[0009] Acquire real-time liveness data in the current scene, and input the real-time liveness data into the liveness detection model;

[0010] Based on the output data of the liveness detection model, determine the liveness detection result corresponding to the real-time liveness data;

[0011] The liveness detection model is the target liveness detection model in the above-mentioned liveness detection model training method.

[0012] Thirdly, embodiments of this specification provide a liveness detection model training device, the device comprising:

[0013] The original model acquisition module is used to acquire live sample data in the target scene and determine the first output data corresponding to the live sample data in the original live detection model. The original live detection model is used to detect live data in the original scene.

[0014] The sample data input module is used to determine the target liveness detection model based on the original liveness detection model, and input the liveness sample data into the target liveness detection model to obtain the second output data;

[0015] The target model training module is used to train the target liveness detection model based on the loss function composed of the second output data and the first output data.

[0016] Fourthly, embodiments of this specification provide a liveness detection device, which includes:

[0017] The data acquisition module is used to acquire real-time liveness data in the current scene and input the real-time liveness data into the liveness detection model.

[0018] The liveness detection module is used to determine the liveness detection result corresponding to the real-time liveness data based on the output data of the liveness detection model.

[0019] The liveness detection model is the target liveness detection model in the aforementioned liveness detection model training device.

[0020] Fifthly, embodiments of this specification provide a computer program product containing instructions that, when run on a computer or processor, cause the computer or processor to perform the steps of the method described above.

[0021] Sixthly, embodiments of this specification provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the steps of the method described above.

[0022] In a seventh aspect, embodiments of this specification provide a terminal including a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being adapted to be loaded by the processor and to execute the steps of the method described above.

[0023] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:

[0024] This specification provides a method for training a liveness detection model. First, liveness sample data corresponding to the target scene to be detected is determined. This liveness sample data is then input into an existing liveness detection model used to detect liveness data in the original scene, yielding first output data. Next, the liveness sample data is input into a target liveness detection model determined based on the original liveness detection model, yielding second output data. The target liveness detection model is then trained based on a loss function composed of the first and second output data. Because the output of the original model used to detect liveness in the original scene is used to construct the loss function for training the new model, the target liveness detection model is constrained by the original model during training. This ensures that the trained target liveness detection model retains the performance of the original liveness detection model, allowing for further optimization without overwriting existing functionalities, significantly improving liveness detection accuracy in various scenarios. Attached Figure Description

[0025] 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.

[0026] Figure 1 An exemplary system architecture diagram of a liveness detection model training method provided in the embodiments of this specification;

[0027] Figure 2 A flowchart illustrating a liveness detection model training method provided in the embodiments of this specification;

[0028] Figure 3 A flowchart illustrating a liveness detection model training method provided in the embodiments of this specification;

[0029] Figure 4 A flowchart illustrating a liveness detection model training method provided in the embodiments of this specification;

[0030] Figure 5 A schematic flowchart of a liveness detection method provided in the embodiments of this specification;

[0031] Figure 6 A structural block diagram of a liveness detection model training device provided in the embodiments of this specification;

[0032] Figure 7A structural block diagram of a liveness detection device provided in the embodiments of this specification;

[0033] Figure 8 This is a schematic diagram of the structure of a terminal provided in an embodiment of this specification. Detailed Implementation

[0034] To make the features and advantages of the embodiments of this specification more apparent and understandable, the technical solutions of 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.

[0035] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.

[0036] With the continuous development of facial recognition systems in recent years, the liveness detection models deployed in these systems can automatically identify whether the currently collected images are live data and provide users with various services based on the detection results, such as payment services and account binding services. However, since users' liveness data is highly correlated with their personal information, liveness attacks targeting the liveness detection model may be collected during the information collection process, such as facial images and photos. If a liveness attack that collects non-real live data is detected incorrectly, it may lead to the leakage of user information and cause losses. Therefore, it is necessary to train the liveness detection model with a large number of samples from target scenarios so that the liveness detection model can effectively intercept non-liveness type attacks.

[0037] When a trained liveness detection model is deployed in a real-world application scenario, it may encounter various scenarios with vastly different representations. When a new scenario is encountered that is different from the original scenario corresponding to the training samples, the differences between the new scenario and the original scenario corresponding to the original liveness detection model, such as differences in lighting when acquiring liveness images and differences in the features of liveness detection targets, make it impossible for the original liveness detection model to rely on its original knowledge to infer when detecting live targets in the new scenario. Therefore, it is necessary to retrain the liveness detection model to adapt to the new scenario.

[0038] If a new liveness detection model is directly retrained based on liveness data from a new scenario, the training workload will be very large and the existing knowledge in the original liveness detection model will be wasted. Therefore, in order to reduce training costs, a model corresponding to the requirements of the new scenario is usually trained based on the original liveness detection model. This allows the model to make full use of the original liveness detection knowledge in the original liveness detection model while also adapting to the new scenario, so as to obtain accurate detection and recognition results when performing liveness detection in the new scenario.

[0039] When training the original liveness detection model to adapt to a new scene, the model needs to learn the feature knowledge of the target liveness in the new scene. Under the constraints of the model's structural space and other conditions, the new knowledge may overwrite the old knowledge learned by the model in the old scene. This will cause the liveness detection model adapted to the new scene to be unable to accurately detect and identify live targets in the original scene. Therefore, when training the liveness detection model adapted to the new scene, it is necessary to protect the original knowledge in the model to ensure the generalization ability of the liveness detection model in the new scene, so that the liveness detection model can adapt to the new scene while maintaining the safety capability of the historical scene.

[0040] Therefore, this specification provides a liveness detection model training method, which obtains a target liveness detection model for a new scene based on the original liveness detection model. The output of the original liveness detection model on the liveness sample data in the new scene is used to constrain the parameter tuning direction of the target liveness detection model, so that the target liveness detection model can retain the accuracy of the original liveness detection model, thereby solving the above-mentioned technical problem of not being able to obtain accurate liveness detection results.

[0041] Please see Figure 1 , Figure 1 This is an exemplary system architecture diagram of a liveness detection model training method provided in the embodiments of this specification.

[0042] like Figure 1 As shown, the system architecture may include a terminal 101, a network 102, and a server 103. The network 102 serves as the medium for providing a communication link between the terminal 101 and the server 103. The network 102 may include various types of wired or wireless communication links, such as wired communication links including fiber optic cables, twisted-pair cables, or coaxial cables, and wireless communication links including Bluetooth communication links, Wireless-Fidelity (Wi-Fi) communication links, or microwave communication links, etc.

[0043] Terminal 101 can interact with server 103 via network 102 to receive messages from or send messages to server 103. Alternatively, terminal 101 can interact with server 103 via network 102 to receive messages or data sent to server 103 by other users. Terminal 101 can be hardware or software. When terminal 101 is hardware, it can be various electronic devices, including but not limited to smartwatches, smartphones, tablets, laptops, and desktop computers. When terminal 101 is software, it can be installed in the aforementioned electronic devices and can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module; no specific limitation is made here.

[0044] Optionally, the terminal 101 can acquire live sample data in the target scene, determine the first output data corresponding to the live sample data in the original live detection model, the original live detection model is used to detect live data in the original scene; determine the target live detection model according to the original live detection model, input the live sample data into the target live detection model to obtain the second output data; and train the target live detection model based on the loss function composed of the second output data and the first output data.

[0045] Server 103 can be an integrated server providing various services. It should be noted that server 103 can be either hardware or software. When server 103 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When server 103 is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module; no specific limitations are made here.

[0046] It should be understood that Figure 1 The number of terminals, networks, and servers shown is only illustrative; the number can be any number of terminals, networks, and servers depending on the implementation requirements.

[0047] Please see Figure 2 , Figure 2 This is a flowchart illustrating a liveness detection model training method provided in an embodiment of this specification. The execution entity in this embodiment can be a terminal executing liveness detection model training, a processor within the terminal executing the liveness detection model training method, or a liveness detection model training service within the terminal executing the liveness detection model training method. For ease of description, the following example uses a processor within the terminal as the execution entity to illustrate the specific execution process of the liveness detection model training method.

[0048] like Figure 2 As shown, the training method for a liveness detection model can include at least the following:

[0049] S201. Obtain live sample data in the target scene, and determine the first output data corresponding to the live sample data in the original live detection model. The original live detection model is used to detect live data in the original scene.

[0050] Optionally, due to the rapid development of liveness detection technology, many devices can identify user information by performing liveness detection to provide services. During this process, non-liveness images such as facial images and videos may be used to launch liveness attacks against the liveness detection model. If a liveness attack succeeds, user information will be under security threat. Therefore, the liveness detection model needs to be able to accurately detect liveness. Thus, before deploying a liveness detection model, it is first trained with liveness sample data corresponding to the original scene to obtain an original liveness detection model capable of accurately detecting liveness data in the original scene. However, in practical applications, facing diverse liveness detection scenarios, directly using the original liveness detection model for various scenarios will lead to inaccurate detection results due to scene differences. Retraining the liveness detection model for each scenario would result in high training costs and waste the existing liveness detection knowledge in the original liveness detection model.

[0051] Optionally, for various liveness detection scenarios, the detection target in both the target scene and the original scene is a human face, and the detection purpose is the same. Therefore, there is a correlation between the target scene and the original scene. Based on this, a new liveness detection model corresponding to the target scene can be determined on the basis of the original liveness detection model, so that the liveness detection model can be adapted to the target scene and complete accurate liveness detection.

[0052] Optionally, when the original liveness detection model learns liveness detection knowledge in the target scene, it first needs to obtain liveness sample data corresponding to the target scene. The liveness sample data includes a large number of features that the target liveness will appear in the target scene. Using the liveness sample data of the target scene as the training sample of the model can enable the model to learn liveness detection features better and output more accurate liveness detection results.

[0053] Furthermore, during the learning process of target liveness detection model, due to limitations in model space and structure, the original liveness detection model tends to favor newly added liveness detection knowledge, causing the original liveness detection knowledge to be overwritten. This results in the original liveness detection model being unable to accurately detect liveness in the original scene after adapting to a new scene. Therefore, it is necessary to maintain the original liveness detection performance while training the liveness detection model to learn new knowledge. Thus, during model training, datasets including liveness sample data from both the original and target scenes can be used to train the original liveness detection model. However, as the number of target scenes increases and the data volume grows, the model training time becomes lengthy, wasting significant time and computational resources. It is also important to note that when the training data from the original and target scenes cannot be shared due to data privacy, both datasets cannot be used together to train the liveness detection model; in this case, only the liveness sample data from the target scene can be used to train the model.

[0054] Optionally, when only liveness sample data of the target scene is available, considering that the detection performance of the original liveness detection model can be reflected in the detection results output by the model, the first output data corresponding to the liveness sample data in the target scene in the original liveness detection model is determined. The first output data can represent the original detection performance in the original liveness detection model. Then, the first output data is used as a constraint condition for training the target liveness detection model. This ensures that the target liveness detection model will not significantly lose the monitoring performance of the original liveness detection model in the original scene when trained based on the liveness sample data of the target scene. At the same time, in order to ensure that the constraint of the first output data does not affect the detection performance of the target liveness detection model, the target scene and the original scene can have a preset correlation. The preset correlation can refer to the preset similarity of the features for detecting live targets. When two scenes have a preset correlation, the liveness detection models corresponding to the two scenes will have some common liveness detection features. At this time, it can be ensured that the target liveness detection model can maintain the detection capability in the original scene while training the detection capability in the target scene.

[0055] S202. Determine the target liveness detection model based on the original liveness detection model, and input the liveness sample data into the target liveness detection model to obtain the second output data.

[0056] Optionally, as can be seen from the above embodiments, the target liveness detection model for adapting to the target scene can be trained based on the original liveness detection model. That is, the target liveness detection model is determined based on the original liveness detection model. At this time, the liveness sample data in the target scene is input into the target liveness detection model to obtain the second output data output by the target liveness detection model. The second output data can reflect the liveness detection capability of the current target detection model in the target scene. Therefore, training the target liveness detection model with the second output data can enable the model to output accurate detection results.

[0057] S203. The target liveness detection model is trained based on the loss function composed of the second output data and the first output data.

[0058] Optionally, when training a liveness detection model, multiple training iterations are typically used to verify whether the current target detection model can output accurately in the target scene. The parameter used to verify the performance of the current model is the loss function. The loss function represents the deviation between the output result and the target result, and its value can be used to judge the fitting result of the current model and guide the parameter tuning direction of the current model. Therefore, in the embodiments of this specification, liveness sample data is determined to be input into the first output data and the second output data obtained from the original liveness detection model and the target liveness detection model, respectively. The first output data and the second output data can constitute the loss function, and the target liveness detection model can be trained based on the loss function.

[0059] This specification provides a method for training a liveness detection model. Liveness sample data is input into an existing liveness detection model used to detect liveness data in an original scene to obtain first output data. Then, the liveness sample data is input into a target liveness detection model determined based on the original liveness detection model, and the liveness sample data is input into the target liveness detection model to obtain second output data. The target liveness detection model is trained based on a loss function composed of the first and second output data. Because the output of the original model on liveness sample data in a new scene is used together with the output of the target liveness detection model to construct the loss function for training the new model, the target liveness detection model is constrained by the original model during training. This ensures that the target liveness detection model retains the performance of the original liveness detection model, allowing the model to continue to be optimized without overwriting existing functions, significantly improving the liveness detection accuracy in various scenarios.

[0060] Please see Figure 3 , Figure 3 This is a flowchart illustrating a liveness detection model training method provided in an embodiment of this specification.

[0061] like Figure 3 As shown, the training method for a liveness detection model can include at least the following:

[0062] S301. Obtain live sample data and standard detection data of live sample data in the target scene.

[0063] Optionally, when training the target liveness detection model, in order to enable the target liveness detection model to perform accurate liveness detection in the target scene, the training detection data output by the target liveness detection model and the standard detection data corresponding to the liveness sample data can be compared. This allows us to know the capability gap between the current detection capability of the target liveness detection model and the standard detection capability. At the same time, the capability gap can guide the optimization and parameter tuning direction of the target liveness detection model, enabling the target liveness detection model to optimize in the direction of the standard detection model. Based on this, while obtaining the liveness sample data in the target scene, it is also necessary to obtain the standard detection data corresponding to the liveness sample data, so that the target liveness detection model can be trained and learned based on the standard detection data.

[0064] S302. Determine the first output data corresponding to the live sample data in the original live detection model. The original live detection model is used to detect live data in the original scene.

[0065] Optionally, as can be seen from the above embodiments, if there is already an original liveness detection model for liveness detection in the original scene, then based on the correlation between the original scene and the target scene, a target liveness detection model can be trained on the basis of the original liveness detection model. In order to protect the detection accuracy of the target liveness detection model in the original scene, the target liveness detection model can be constrained based on the first output data of the original liveness detection model for liveness sample data. Therefore, it is first necessary to determine the first output data corresponding to the liveness sample data in the original liveness detection model so that the target liveness detection model will not lose a large amount of detection accuracy in the original scene when training the detection accuracy in the target scene.

[0066] S303. Determine the target liveness detection model based on the original liveness detection model, and input the liveness sample data into the target liveness detection model to obtain the second output data.

[0067] For details regarding step S303, please refer to the description in step S202; it will not be repeated here.

[0068] S304, The first loss is based on the second output data and the standard detection data, and the second loss is based on the second output data and the first output data.

[0069] Optionally, the loss function, as a function to measure the model's ability to complete the task, can express the degree of deviation between the model's predicted output data and the actual standard data. In the embodiments of this specification, after obtaining the second output data of the target liveness detection model on the liveness sample data, the second output data and the standard detection data can constitute the first loss. The first loss value can express the gap between the detection capability of the target liveness detection model and the standard detection capability. At the same time, the second output data and the first output data of the original liveness detection model on the liveness sample data can constitute the second loss. The second loss value can express the gap between the existing detection capability of the target liveness detection model and the original detection capability of the original liveness detection model, which facilitates the target liveness detection model to train and learn based on the first loss and the second loss.

[0070] S305. Train the target liveness detection model based on the loss function composed of the first loss and the second loss.

[0071] Optionally, after obtaining the first loss and the second loss, a loss function is constructed based on the first loss and the second loss. The target liveness detection model is then trained using the loss function. The first loss part in the loss function helps the target liveness detection model learn the liveness detection capability in the target scene, while the second loss part helps the target liveness detection model retain the liveness detection capability in the original scene. This ensures that the target liveness detection model can output accurate detection results in both new and old scenes.

[0072] Furthermore, in the loss function, the first loss and the second loss guide the training direction of the target liveness detection model differently. Therefore, to ensure the comprehensive detection capability of the target liveness detection model, the first loss and the second loss can be assigned different weights in the loss function. The weight of each part of the loss represents its ratio in the total value of the loss function and also affects the final training direction of the target liveness detection model. Therefore, the first loss can be set as the first weight, and the second loss can be set as the second weight. Finally, in the loss function composed of the first loss and the second loss, the product of the first loss and the first weight is used as the first loss value, and the product of the second loss and the second weight is used as the second loss value. The sum of the first loss value and the second loss value is the final loss value of the loss function. Based on this loss value, the target liveness detection model is trained again until the loss value meets the preset conditions. It can be considered that the various capabilities of the target liveness detection model meet the requirements, and the training of the target liveness detection model is completed.

[0073] Optionally, when setting the first and second weights, since the ultimate goal of training the target liveness detection model is to ensure accurate liveness detection results when deployed in the target scene, the training process must first ensure the accurate detection capability of the target liveness detection model in the target scene. When training the target liveness detection model, the first weight of the first loss and the second weight of the second loss in the corresponding loss function guide the training of the target liveness detection model's detection capability in the target scene. Therefore, in order to ensure the maximum training objective of the target liveness detection model, the first weight should be set greater than the second weight, so that the target liveness detection model can have excellent detection capability in the target scene while reducing the loss of detection capability in the original scene.

[0074] This specification provides a method for training a liveness detection model. When training a target liveness detection model, liveness sample data from the target scene is acquired simultaneously with standard detection data corresponding to the liveness sample data. The difference between the second output data of the target liveness detection model based on the liveness sample data and the standard detection data is used as a first loss to measure the detection capability of the target liveness detection model in the target scene. The difference between the second output data and the first output data is used as a second loss to measure the detection capability of the target liveness detection model in the original scene. The first loss with a larger first weight and the second loss with a smaller second weight together constitute the loss function for training the target liveness detection model. This ensures that the trained target liveness detection model meets accuracy requirements in the target scene while retaining a significant amount of detection capability from the original scene. This achieves the ability to train the target liveness detection model for adaptability in new scenes using only liveness detection samples from the target scene, while preserving its adaptability in the original scene.

[0075] Please see Figure 4 , Figure 4 This is a flowchart illustrating a liveness detection model training method provided in an embodiment of this specification.

[0076] like Figure 4 As shown, the training method for a liveness detection model can include at least the following:

[0077] S401. Determine the target live sample data group in the live sample dataset corresponding to the target scene, and use the live sample data in the target live sample data group as the live sample data for training the live detection model this time.

[0078] Optionally, when training a network model based on sample data, a large amount of sample data is typically used to enable the network model to learn the training target comprehensively and accurately. However, when a large amount of live sample data is input into the target liveness detection model, the target liveness detection model needs to analyze each live sample data and output the corresponding detection result as output data. In this process, the target liveness detection model requires a lot of time and computation for data analysis and calculation in a single training cycle. Furthermore, training the target liveness detection model with a large amount of live sample data simultaneously leads to the target liveness detection model having to learn a large number of features at the same time, which may cause overfitting or underfitting. Based on this, a large amount of live sample data can be divided into a predetermined number of live sample data groups according to preset grouping conditions. The target liveness detection model can then be trained in batches based on each live sample data group, allowing the target liveness detection model to learn the task features in multiple batches and iterate multiple times based on a single training target.

[0079] Optionally, all live sample data can be divided into multiple live sample data groups. The set of all live sample data groups serves as the live sample dataset corresponding to the target scene. When training the liveness detection model, firstly, from all live sample data groups in the live sample dataset, identify the unused target live sample data group, and use this target live sample data group as the target live sample data group required for training the liveness detection model. Specifically, when grouping the live sample data, all live sample data can be divided into an equal number of pre-set live sample data groups to ensure that each training iteration of the liveness detection model is in a balanced state and the training results are not affected by the number of live samples in each live sample data group.

[0080] S402. Determine the first output data corresponding to the live sample data in the original live detection model. The original live detection model is used to detect live data in the original scene.

[0081] Optionally, as can be seen from the above embodiments, determining the first output data corresponding to the live sample data in the original live detection model can determine the detection performance of the original live detection model. By comparing the first output data with the second output data of the target live detection model for the live sample data, the detection performance of the original live detection model can be used as a standard to constrain the training of the target live detection model's detection capability in the original scene.

[0082] S403. Use the original liveness detection model as the initial form of the target liveness detection model.

[0083] Optionally, after obtaining live sample data, it is necessary to determine the target live detection model for implementing live detection in the target scene. Since the original live detection model has the ability to complete the live detection task in the original scene, and there is a preset correlation between the original scene and the target scene, that is, the object features of live detection in the target scene will not be significantly different from those in the original scene. This means that the existing live detection knowledge in the original live detection model can be appropriately adapted to the target scene. Therefore, the target live detection model can be determined based on the original live detection model.

[0084] Furthermore, in order to ensure that the detection capability of the target liveness detection model is not significantly lost in the original scene, the original liveness detection model can be directly used as the initial form of the target liveness detection model. That is, during the training process, in the first iteration of training, the liveness sample data is input as the original liveness detection model of the target liveness detection model, and the parameters of the target liveness detection model are adjusted based on the loss function. Subsequent iterations of training are then carried out based on the target liveness detection model.

[0085] or

[0086] S404. Create a new target liveness detection model and determine the initial parameters of the target liveness detection model based on the parameters of the original liveness detection model.

[0087] Optionally, when determining the target liveness detection model based on the original liveness detection model, a new model can be created as the target liveness detection model. The initial parameters of the target liveness detection model are determined based on the parameters of the original liveness detection model. Furthermore, the detection capability of the original liveness detection model can be replicated in the initial state of the target liveness detection model. That is, the parameters in the original liveness detection model are used as the initial parameters of the target liveness detection model, ensuring that the performance of the target liveness detection model is consistent with that of the original liveness detection model in the initial state. This facilitates the protection of the detection capability in the original scene when training the target liveness detection model later.

[0088] S405. Input the live sample data into the target live detection model to obtain the second output data.

[0089] Optionally, live sample data from the target scene can be input into the target liveness detection model to obtain the second output data of the target liveness detection model. The second output data can reflect the liveness detection capability of the current target detection model in the target scene. Therefore, training the target liveness detection model with the second output data can enable the model to output accurate detection results.

[0090] S406. The target liveness detection model is trained based on the loss function composed of the second output data and the first output data.

[0091] For details regarding step S406, please refer to the description in step S203; it will not be repeated here.

[0092] In the embodiments of this specification, a method for training a liveness detection model is provided. When acquiring liveness sample data, all liveness sample data are divided into a preset number of liveness sample data groups according to preset grouping conditions. The target liveness detection model is then subjected to multiple batches of iterative training to reduce the training time and computational load of each iteration, thereby alleviating the computational pressure on the device. When determining the target liveness detection model, the original liveness detection model itself or its parameters are used as the initial state of the target liveness detection model or the initial parameters used therein. This ensures that the performance of the target liveness detection model remains consistent with that of the original liveness detection model in the initial state, which facilitates the protection of the detection capability in the original scene during subsequent training of the target liveness detection model.

[0093] Please see Figure 5 , Figure 5 This is a schematic flowchart of a liveness detection method provided in the embodiments of this specification.

[0094] like Figure 5 As shown, a liveness detection method may include at least:

[0095] S501. Obtain real-time liveness data in the current scene and input the real-time liveness data into the liveness detection model.

[0096] Optionally, in practical application scenarios, in order to achieve automatic collection and detection of liveness data, it is necessary to deploy a liveness detection model. At this time, the liveness detection model can obtain real-time liveness data in the current scenario based on its own deployment task, and input the real-time liveness data into the liveness detection model, so that the liveness detection model can detect and analyze the real-time liveness data, so that the user needs can be responded to based on the accurate detection results output by the liveness detection model. The liveness detection model used is the target liveness detection model in any embodiment of this specification.

[0097] Optionally, when acquiring real-time liveness data in the current scene, the device's built-in camera or an external camera connected to the device can be used to capture liveness data in the current scene in real time. After acquiring the real-time liveness data, the real-time liveness data is input into the liveness detection model. The liveness detection model can detect the liveness data and finally determine whether the real-time liveness data meets the preset response conditions. Based on the detection results, the current task is processed.

[0098] S502. Based on the output data of the liveness detection model, determine the liveness detection result corresponding to the real-time liveness data.

[0099] Optionally, after real-time liveness data is input into the liveness detection model, the model analyzes the real-time liveness data based on the knowledge learned during training to detect liveness data in the current scene and obtains output data. The output data can be the probability that the real-time liveness data is from a live person and the probability that it is from an attack. Based on this output data, the liveness detection result corresponding to the real-time liveness data can be determined. For example, if the probability that the real-time liveness data output by the liveness detection model is from a live person is relatively high, then the real-time liveness data is judged to correspond to a real live image, and the response continues based on user needs. If the probability that the real-time liveness data output by the liveness detection model is from an attack is relatively high, then the real-time liveness data is judged to correspond to a live attack image, the prompt information corresponding to the detection result is displayed, and the acquisition process can be reset to continue liveness data acquisition.

[0100] In the embodiments of this specification, a liveness detection method is provided. In a practical application scenario, the target liveness detection model of any of the foregoing embodiments is deployed as a liveness detection model. Real-time liveness data in the current scene is acquired and input into the liveness detection model. Based on the output data of the liveness detection model after detecting the real-time liveness data, the detection result corresponding to the real-time liveness data is determined. The target liveness detection model can simultaneously possess accurate detection capabilities in both the current scene and the original scene, so as to output accurate detection results, achieve precise response to user needs, and enhance the user experience.

[0101] Please see Figure 6 , Figure 6 This is a structural block diagram of a liveness detection model training device provided in an embodiment of this specification. Figure 6 As shown, the liveness detection model training device 600 includes:

[0102] The original model acquisition module 610 is used to acquire live sample data in the target scene and determine the first output data corresponding to the live sample data in the original live detection model. The original live detection model is used to detect live data in the original scene.

[0103] The sample data input module 620 is used to determine the target liveness detection model based on the original liveness detection model, and input liveness sample data into the target liveness detection model to obtain the second output data;

[0104] The target model training module 630 is used to train the target liveness detection model based on the loss function composed of the second output data and the first output data.

[0105] Optionally, the original model acquisition module 610 is also used to acquire live sample data in the target scene and standard detection data of the live sample data.

[0106] Optionally, the target model training module 630 is further configured to construct a first loss based on the second output data and standard detection data, and to construct a second loss based on the second output data and the first output data; and to train the target liveness detection model according to the loss function composed of the first loss and the second loss.

[0107] Optionally, the target model training module 630 is further configured to determine the first weight of the first loss and the second weight of the second loss, wherein the first weight is greater than the second weight; to construct a loss function based on the sum of the product of the first loss and the first weight and the product of the second loss and the second weight, and to train the target liveness detection model based on the loss function.

[0108] Optionally, there is a preset correlation between the original scene and the target scene.

[0109] Optionally, the sample data input module 620 is also used to use the original liveness detection model as the initial form of the target liveness detection model; or to create a new target liveness detection model and determine the initial parameters of the target liveness detection model based on the parameters of the original liveness detection model.

[0110] Optionally, the original model acquisition module 610 is further used to determine the target live sample data group in the live sample dataset corresponding to the target scene, and use the live sample data in the target live sample data group as the live sample data for training the live detection model in this training; wherein, the live sample data in the live sample dataset is divided into a preset number of live sample data groups according to preset grouping conditions.

[0111] In this embodiment, a liveness detection model training device is provided. The device includes an original model acquisition module for inputting liveness sample data into an existing original liveness detection model used to detect liveness data in an original scene, obtaining first output data; a sample data input module for inputting liveness sample data into a target liveness detection model determined based on the original liveness detection model, and inputting the liveness sample data into the target liveness detection model to obtain second output data; and a target model training module 630 for training the target liveness detection model based on a loss function composed of the first and second output data. Because the output of the original model to liveness sample data in a new scene is used together with the output of the target liveness detection model to construct the loss function for training the new model, the target liveness detection model is constrained by the original model during training. This ensures that the target liveness detection model retains the performance of the original liveness detection model, allowing the model to continue to be optimized without overwriting existing functions, significantly improving the liveness detection accuracy in various scenarios.

[0112] Please see Figure 7 , Figure 7This is a structural block diagram of a liveness detection device provided in an embodiment of this specification. Figure 7 As shown, the liveness detection device 700 includes:

[0113] The data acquisition module 710 is used to acquire real-time liveness data in the current scene and input the real-time liveness data into the liveness detection model;

[0114] The liveness detection module 720 is used to determine the liveness detection result corresponding to the real-time liveness data based on the output data of the liveness detection model.

[0115] The liveness detection model is the target liveness detection model in the above embodiments.

[0116] In the embodiments of this specification, a liveness detection device is provided. In a practical application scenario, the target liveness detection model of any of the foregoing embodiments is deployed as a liveness detection model. The data acquisition module is used to acquire real-time liveness data in the current scene and input the real-time liveness data into the liveness detection model. The liveness detection module is used to determine the detection result corresponding to the real-time liveness data based on the output data output by the liveness detection model after detecting the real-time liveness data. The target liveness detection model can simultaneously possess accurate detection capabilities in both the current scene and the original scene, so as to output accurate detection results, achieve precise response to user needs, and enhance the user experience.

[0117] This specification provides a computer program product containing instructions that, when run on a computer or processor, cause the computer or processor to perform the steps of any of the methods described in the above embodiments.

[0118] This specification also provides a computer storage medium that can store multiple instructions adapted for loading by a processor and executing the steps of any of the methods described in the above embodiments.

[0119] Please see Figure 8 , Figure 8 This is a schematic diagram of the structure of a terminal provided in an embodiment of this specification. Figure 8 As shown, terminal 800 may include: at least one terminal processor 801, at least one network interface 804, user interface 803, memory 805, and at least one communication bus 802.

[0120] The communication bus 802 is used to enable communication between these components.

[0121] The user interface 803 may include a display screen and a camera. Optionally, the user interface 803 may also include a standard wired interface and a wireless interface.

[0122] The network interface 804 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0123] The terminal processor 801 may include one or more processing cores. The terminal processor 801 connects to various parts within the terminal 800 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 805, and by calling data stored in the memory 805. Optionally, the terminal processor 801 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The terminal processor 801 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the terminal processor 801.

[0124] The memory 805 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 805 may include a non-transitory computer-readable storage medium. The memory 805 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 805 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 at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 805 may also be at least one storage device located remotely from the aforementioned terminal processor 801. Figure 8As shown, the memory 805, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a liveness detection model training program and / or a liveness detection program.

[0125] exist Figure 8 In the terminal 800 shown, the user interface 803 is mainly used to provide an input interface for the user and to obtain the user's input data; while the terminal processor 801 can be used to call the liveness detection model training program stored in the memory 805 and specifically perform the following operations:

[0126] Acquire live sample data in the target scene, determine the first output data corresponding to the live sample data in the original live detection model, and use the original live detection model to detect live data in the original scene;

[0127] The target liveness detection model is determined based on the original liveness detection model, and the liveness sample data is input into the target liveness detection model to obtain the second output data;

[0128] The target liveness detection model is trained based on the loss function composed of the second output data and the first output data.

[0129] In some embodiments, there is a preset correlation between the original scene and the target scene.

[0130] In some embodiments, when the terminal processor 801 performs the acquisition of live sample data in the target scene, it specifically performs the following steps: acquiring live sample data in the target scene and standard detection data of the live sample data.

[0131] In some embodiments, when the terminal processor 801 trains the target liveness detection model using a loss function composed of the second output data and the first output data, it specifically performs the following steps: constructing a first loss based on the second output data and standard detection data, and constructing a second loss based on the second output data and the first output data; and training the target liveness detection model according to the loss function composed of the first loss and the second loss.

[0132] In some embodiments, when the terminal processor 801 trains the target liveness detection model using a loss function composed of a first loss and a second loss, it specifically performs the following steps: determining a first weight of the first loss and a second weight of the second loss, wherein the first weight is greater than the second weight; constructing a loss function based on the sum of the product of the first loss and the first weight and the product of the second loss and the second weight, and training the target liveness detection model based on the loss function.

[0133] In some embodiments, when the terminal processor 801 determines the target liveness detection model based on the original liveness detection model, it specifically performs the following steps: using the original liveness detection model as the initial form of the target liveness detection model; or creating a new target liveness detection model and determining the initial parameters of the target liveness detection model based on the parameters of the original liveness detection model.

[0134] In some embodiments, when the terminal processor 801 acquires live sample data in the target scene, it specifically performs the following steps: determining the target live sample data group in the live sample dataset corresponding to the target scene, and using the live sample data in the target live sample data group as the live sample data for training the live detection model in this session; wherein, the live sample data in the live sample dataset is divided into a preset number of live sample data groups according to preset grouping conditions.

[0135] Optionally, in Figure 8 In the terminal 800 shown, the user interface 803 is mainly used to provide an input interface for the user and to acquire user input data; while the terminal processor 801 can also be used to call the liveness detection program stored in the memory 805 and specifically perform the following operations:

[0136] Acquire real-time liveness data in the current scene and input the real-time liveness data into the liveness detection model;

[0137] Based on the output data of the liveness detection model, determine the liveness detection result corresponding to the real-time liveness data;

[0138] The liveness detection model is any of the target liveness detection models included in the above embodiments.

[0139] In the several embodiments provided in this specification, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0140] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0141] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this specification are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The aforementioned available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).

[0142] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0143] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0144] The above is a description of a liveness detection model training method, apparatus, storage medium, and terminal provided in the embodiments of this specification. For those skilled in the art, based on the ideas of the embodiments of this specification, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this specification.

Claims

1. A method for training a liveness detection model, the method comprising: Acquire live sample data in the target scene, determine the first output data corresponding to the live sample data in the original live detection model, the original live detection model is used to detect live data in the original scene; The target liveness detection model is determined based on the original liveness detection model, and the liveness sample data is input into the target liveness detection model to obtain the second output data; The target liveness detection model is trained based on the loss function formed by the second output data and the first output data; The acquisition of live sample data in the target scene includes: Acquire live sample data from the target scene and standard detection data of the live sample data; The training of the target liveness detection model based on the loss function composed of the second output data and the first output data includes: The first loss is constructed based on the second output data and the standard detection data, and the second loss is constructed based on the second output data and the first output data. The first loss expresses the gap between the detection capability of the target liveness detection model and the standard detection capability, which helps the target liveness detection model learn the liveness detection capability in the target scene. The second loss expresses the gap between the existing detection capability of the target liveness detection model and the original detection capability of the original liveness detection model, which helps the target liveness detection model retain the liveness detection capability in the original scene. The target liveness detection model is trained based on the loss function formed by the first loss and the second loss; Training the target liveness detection model based on the loss function formed by the first loss and the second loss includes: A first weight for the first loss and a second weight for the second loss are determined, wherein the first weight is greater than the second weight; The loss function is constructed by combining the product of the first loss and the first weight with the product of the second loss and the second weight, and the target liveness detection model is trained based on the loss function.

2. The method according to claim 1, wherein the original scene and the target scene have a preset correlation.

3. The method according to claim 1, wherein determining the target liveness detection model based on the original liveness detection model comprises: The original liveness detection model is used as the initial form of the target liveness detection model; or A new target liveness detection model is established, and the initial parameters of the target liveness detection model are determined based on the parameters of the original liveness detection model.

4. The method according to claim 1, wherein acquiring live sample data in the target scene includes: Determine the target live sample data group in the live sample dataset corresponding to the target scene, and use the live sample data in the target live sample data group as the live sample data for training the live detection model in this training; The live sample data in the live sample dataset is divided into a preset number of live sample data groups according to preset grouping conditions.

5. A method for detecting liveness, the method comprising: Acquire real-time liveness data in the current scene, and input the real-time liveness data into the liveness detection model; Based on the output data of the liveness detection model, determine the liveness detection result corresponding to the real-time liveness data; The liveness detection model is the target liveness detection model as described in any one of claims 1 to 4.

6. A liveness detection model training device, the device comprising: The original model acquisition module is used to acquire live sample data in the target scene and determine the first output data corresponding to the live sample data in the original live detection model. The original live detection model is used to detect live data in the original scene. The sample data input module is used to determine the target liveness detection model based on the original liveness detection model, and input the liveness sample data into the target liveness detection model to obtain the second output data; The target model training module is used to train the target liveness detection model based on the loss function composed of the second output data and the first output data; The original model acquisition module is also used to acquire live sample data in the target scene and standard detection data of the live sample data. The target model training module is further configured to construct a first loss based on the second output data and standard detection data, and a second loss based on the second output data and the first output data. The first loss expresses the gap between the detection capability of the target liveness detection model and the standard detection capability, and is used to help the target liveness detection model learn its liveness detection capability in the target scene. The second loss expresses the gap between the current detection capability of the target liveness detection model and the original detection capability of the original liveness detection model, and is used to help the target liveness detection model retain its liveness detection capability in the original scene. The target liveness detection model is trained according to the loss function composed of the first loss and the second loss. The target model training module is further used to determine the first weight of the first loss and the second weight of the second loss, wherein the first weight is greater than the second weight; to construct a loss function based on the sum of the product of the first loss and the first weight and the product of the second loss and the second weight, and to train the target liveness detection model based on the loss function.

7. A liveness detection device, the device comprising: The data acquisition module is used to acquire real-time liveness data in the current scene and input the real-time liveness data into the liveness detection model. The liveness detection module is used to determine the liveness detection result corresponding to the real-time liveness data based on the output data of the liveness detection model. The liveness detection model is the target liveness detection model as described in any one of claims 1 to 4.

8. A computer program product comprising instructions that, when run on a computer or processor, cause the computer or processor to perform the steps of the method as claimed in any one of claims 1 to 4 and / or claim 5.

9. A computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the steps of the method as claimed in any one of claims 1 to 4 and / or claim 5.

10. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method as claimed in any one of claims 1 to 4 and / or claim 5.

Citation Information

Patent Citations

  • Model training method, image processing method, electronic equipment and storage medium

    CN113326832A