A method, device, and medium for training and adjusting a causal model.

CN113486909BActive Publication Date: 2026-08-11NANJING TRANSWARP INTELLIGENCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-21
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

但这些方法的使用依赖于大量的人工分析,且分析结果往往仅具有局部解释性,不具备通用性

Benefits of technology

[0037]本发明实施例的技术方案,通过将目标样本输入至待训练的机器学习模型中进行前向计算,并获取与目标样本对应的至少一个原始特征向量;对各原始特征向量进行因果分析,提取与决策结果存在因果关系的因果特征,并得到与各原始特征向量分别对应的因果特征向量;根据各因果特征向量分别对对应的原始特征向量进行因果关系处理,得到目标特征向量;根据各目标特征向量,进行后向计算,对机器学习模型进行参数调整,直至模型训练结束。解决了机器学习模型训练中的基于因果关系去除选择性偏倚特征影响的问题,实现了降低选择性偏倚特征对决策结果的影响,提高机器学习模型的可解释性、鲁棒性以及精度,且适用于各类机器学习模型的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113486909B_ABST
    Figure CN113486909B_ABST
Patent Text Reader

Abstract

This invention discloses a method, device, and medium for training and adjusting a model based on causal relationships. The method includes: inputting a target sample into a machine learning model to be trained for forward computation and obtaining at least one original feature vector corresponding to the target sample; performing causal analysis on each original feature vector to extract causal features that have a causal relationship with the decision result, and obtaining causal feature vectors corresponding to each original feature vector; performing causal relationship processing on the corresponding original feature vectors according to each causal feature vector to obtain target feature vectors; and performing backward computation based on each target feature vector to adjust the parameters of the machine learning model until the model training is completed. This method can reduce the impact of selection bias features on the decision result based on causal relationships, improve the interpretability, robustness, and accuracy of the model, and has universality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and in particular to a method, device and medium for training and adjusting a model based on causality. Background Technology

[0002] As research and application of data analysis and artificial intelligence technologies deepen, people are paying increasing attention to the stability of machine learning models in different application scenarios.

[0003] Models based on probabilistic statistical learning can typically function correctly in specific scenarios. However, when the scenario changes, the model needs to relearn to continue working. This is because the learning objective of statistical models is to fit the samples and labels to the greatest extent possible. Selection bias factors are involved in the decision-making process, and there is a lack of strict logical relationship between data input and decision results. The presence of spurious correlations often leads to unexpected behaviors in current machine learning models.

[0004] For example, a model designed to distinguish between male and female might incorrectly use clothing color as a distinguishing feature, leading to people wearing brightly colored clothing being identified as female. Similarly, in the learning process of a sturgeon recognition model, because most samples of sturgeon are held in the hands of anglers, the model incorrectly treats the features of the hands as part of the sturgeon's features, resulting in a low recognition rate for sturgeon in their natural state.

[0005] To address these issues, existing technologies employ methods such as feature visualization, deconvolution, Local Interpretable Model-Agnostic Explanations (LIME), class activation mapping (CAM), and Layer-wise Relevance Propagation (LRP) to study the interpretability of machine learning. However, these methods rely heavily on manual analysis, and the results often offer only local interpretation and lack general applicability. Summary of the Invention

[0006] This invention provides a model training and adjustment method, device, and medium based on causal relationships. It can adjust the original feature vector based on causal relationships, reduce the impact of selective bias features on decision results, improve the interpretability, robustness, and accuracy of the model, and has universality.

[0007] In a first aspect, embodiments of the present invention provide a method for training a machine learning model based on causal relationships, the method comprising:

[0008] The target sample corresponding to the model training task is input into the machine learning model to be trained for forward computation, and at least one original feature vector corresponding to the target sample is obtained during the forward computation process.

[0009] Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result, and causal feature vectors corresponding to each of the original feature vectors are obtained based on each of the causal features.

[0010] Based on each of the aforementioned causal feature vectors, the corresponding original feature vectors are processed to obtain the target feature vectors;

[0011] Based on each of the target feature vectors, backward computation is performed to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0012] Secondly, embodiments of the present invention also provide a method for adjusting a machine learning model based on causal relationships, wherein a causal calculation module is set between the feature extraction module and the decision module of the machine learning model. This method is executed by the causal calculation module and includes:

[0013] The system receives at least one original feature vector extracted by the feature extraction module and performs bit-by-bit masking on each original feature vector to obtain a mask feature vector; wherein the number of mask feature vectors is the same as the length of the original feature vectors.

[0014] Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively.

[0015] Based on the original decision results and the Mask decision results, causal features that have a causal relationship with the decision results are determined, and causal feature vectors corresponding to the original feature vectors are obtained based on the causal features.

[0016] Based on each of the causal feature vectors, the corresponding original feature vectors are processed to obtain target feature vectors, and the target feature vectors are sent to the decision module to adjust the parameters of the machine learning model.

[0017] Thirdly, embodiments of the present invention also provide a computer device, including a processor and a memory, wherein the memory is used to store instructions, and when the instructions are executed, the processor performs the following operations:

[0018] The target sample corresponding to the model training task is input into the machine learning model to be trained for forward computation, and at least one original feature vector corresponding to the target sample is obtained during the forward computation process.

[0019] Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result, and causal feature vectors corresponding to each of the original feature vectors are obtained based on each of the causal features.

[0020] Based on each of the aforementioned causal feature vectors, the corresponding original feature vectors are processed to obtain the target feature vectors;

[0021] Based on each of the target feature vectors, backward computation is performed to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0022] Fourthly, embodiments of the present invention also provide a computer device, including a processor and a memory, wherein the memory is used to store instructions, and when the instructions are executed, the processor performs the following operations:

[0023] The system receives at least one original feature vector extracted by the feature extraction module and performs bit-by-bit masking on each of the original feature vectors to obtain mask feature vectors; wherein the number of mask feature vectors is the same as the length of the original feature vectors.

[0024] Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively.

[0025] Based on the original decision results and the Mask decision results, causal features that have a causal relationship with the decision results are determined, and causal feature vectors corresponding to the original feature vectors are obtained based on the causal features.

[0026] Based on each of the causal feature vectors, the corresponding original feature vectors are processed to obtain target feature vectors, and the target feature vectors are sent to the decision module to adjust the parameters of the machine learning model.

[0027] Fifthly, embodiments of the present invention also provide a storage medium for storing instructions for execution:

[0028] The target sample corresponding to the model training task is input into the machine learning model to be trained for forward computation, and at least one original feature vector corresponding to the target sample is obtained during the forward computation process.

[0029] Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result, and causal feature vectors corresponding to each of the original feature vectors are obtained based on each of the causal features.

[0030] Based on each of the aforementioned causal feature vectors, the corresponding original feature vectors are processed to obtain the target feature vectors;

[0031] Based on each of the target feature vectors, backward computation is performed to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0032] or,

[0033] The system receives at least one original feature vector extracted by the feature extraction module and performs bit-by-bit masking on each of the original feature vectors to obtain mask feature vectors; wherein the number of mask feature vectors is the same as the length of the original feature vectors.

[0034] Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively.

[0035] Based on the original decision results and the Mask decision results, causal features that have a causal relationship with the decision results are determined, and causal feature vectors corresponding to the original feature vectors are obtained based on the causal features.

[0036] Based on each of the causal feature vectors, the corresponding original feature vectors are processed to obtain target feature vectors, and the target feature vectors are sent to the decision module to adjust the parameters of the machine learning model.

[0037] The technical solution of this invention involves inputting a target sample into a machine learning model to be trained for forward computation, obtaining at least one original feature vector corresponding to the target sample; performing causal analysis on each original feature vector to extract causal features that have a causal relationship with the decision result, and obtaining causal feature vectors corresponding to each original feature vector; processing the corresponding original feature vectors based on each causal feature vector to obtain target feature vectors; and performing backward computation based on each target feature vector to adjust the parameters of the machine learning model until the model training is complete. This solves the problem of removing the influence of selective bias features based on causal relationships in machine learning model training, reduces the impact of selective bias features on decision results, improves the interpretability, robustness, and accuracy of the machine learning model, and is applicable to various types of machine learning models. Attached Figure Description

[0038] Figure 1a This is a flowchart of a machine learning model training method based on causal relationships provided in Embodiment 1 of the present invention;

[0039] Figure 1b This is a schematic diagram of the structure of a FasCausalModel provided in Embodiment 1 of the present invention;

[0040] Figure 2a This is a flowchart of a machine learning model training method based on causal relationships provided in Embodiment 2 of the present invention;

[0041] Figure 2b This is a schematic diagram of an original feature vector provided in Embodiment 2 of the present invention;

[0042] Figure 2c This is a schematic diagram of a feature vector category provided in Embodiment 2 of the present invention;

[0043] Figure 2d This is a schematic diagram of a target feature vector provided in Embodiment 2 of the present invention;

[0044] Figure 3a This is a flowchart of a machine learning model adjustment method based on causality provided in Embodiment 3 of the present invention;

[0045] Figure 3b This is a schematic diagram of the structure of a FasModel model in the prior art;

[0046] Figure 4 This is a schematic diagram of the structure of a machine learning model training device based on causality provided in Embodiment 4 of the present invention;

[0047] Figure 5 This is a schematic diagram of the structure of a machine learning model adjustment device based on causality provided in Embodiment 5 of the present invention;

[0048] Figure 6 This is a schematic diagram of the structure of a computer device provided in Embodiment Six of the present invention. Detailed Implementation

[0049] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0050] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. A process can be terminated when its operation is completed, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.

[0051] The term "target sample" used in this article can refer to a sample corresponding to the current training task of the machine learning model. A "target sample" can be a labeled sample or an unlabeled sample. For example, if there are 8 types of labeled samples in the sample library, and the current model training task is to train on a subset of these 8 labeled samples, such as 4 types, then the "target sample" can consist of a certain number of samples corresponding to each of the 4 labeled sample types. The number of samples corresponding to each labeled sample type can be the same.

[0052] The term "machine learning model" as used in this article can refer to a model trained with labels or a model trained without labels, and this embodiment of the invention does not specifically limit it.

[0053] The term "original feature vector" used in this article can refer to the initial feature vector of an image obtained through the feature extraction module in a machine learning model.

[0054] The term "causal analysis" used in this paper can refer to the analysis of the positive or negative impact of eigenvectors on decision outcomes. Causal analysis can categorize eigenvectors into correctly classified features, misclassified features, and selective bias features.

[0055] The term "selective bias feature" used in this paper can refer to the systematic error caused by differences in characteristics between selected and unselected subjects. Specifically, selective bias features can be features that are unrelated to the category but still participate in the decision-making process. For example, selective bias features can include sample-specific features as well as contextual features.

[0056] Example 1

[0057] Figure 1a This is a flowchart of a causal-based machine learning model training method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where machine learning models are trained by removing selection bias features based on causal relationships. This method can be executed by a causal-based machine learning model training device, which can be implemented in software and / or hardware, and can be integrated into a computer, such as... Figure 1a As shown, the method specifically includes:

[0058] Step 110: Input the target sample corresponding to the model training task into the machine learning model to be trained for forward computation, and obtain at least one original feature vector corresponding to the target sample during the forward computation process.

[0059] The machine learning model can be any model, and the method in this embodiment of the invention is universal and not limited to specific data, a specific framework, or a specific model structure. For example, this embodiment of the invention uses a liveness detection model (FasModel) as an example for illustration. Specifically, the machine learning model to be trained in this embodiment of the invention can be a causal liveness detection model (FasCausalModel).

[0060] Figure 1b This is a schematic diagram of the structure of a FasCausalModel provided in Embodiment 1 of the present invention. Figure 1b As shown, target samples corresponding to the current model training task can be determined by randomly sampling from the sample library. These target samples can be input into the feature extraction module of the FasCausalModel model to be trained. The feature extraction module can perform forward computation to determine the original feature vectors corresponding to each sample in the target sample set.

[0061] In an optional embodiment of the present invention, before inputting the target samples corresponding to the model training task into the machine learning model for forward computation, the method further includes: dividing the samples in the sample library into micro-batches according to the sample label categories, and generating corresponding target samples according to the sample label categories required by the model training task.

[0062] Among them, such as Figure 1b As shown, the sample library can be the total batch of samples. The size of the sample library can be the batch size. The samples corresponding to the model training task of the FasCausalModel are labeled samples. For example, the sample library can include live and non-live samples in four different environments, meaning the sample library includes eight sample labels. When training the FasCausalModel, the number of samples corresponding to each sample label category can be limited to at least 16. In actual model training, the hardware capacity of computer processors such as GPUs may limit the number of samples that can be processed; for example, the size of the minibatch is 64. The minibatch can be generated by dividing the sample library according to the sample label category. For example, when the minibatch has 64 samples and the number of samples corresponding to each sample label category is at least 16, the model training task can use a maximum of four sample labels.

[0063] In this embodiment of the invention, each sample label category can have the same number of samples, i.e., sampling is performed according to a 1:1 ratio of sample label categories. Generating target samples by evenly distributing samples according to sample label categories facilitates comparison of decision results in causal analysis. Alternatively, in engineering practice, due to sample imbalance, each sample label category can have a different number of samples, meaning sampling does not strictly adhere to a 1:1 ratio. When target samples are generated without evenly distributing samples according to sample label categories, the weights can be adjusted to make the samples comparable, thus enabling comparison of decision results in causal analysis.

[0064] Specifically, determining the target samples by dividing them into micro-batches according to each sample label category can be done in various ways. During the iterative training of the machine learning model, the target samples may differ in different iterations. This embodiment of the invention can comprehensively consider batch size, sample label categories, and the number of samples in each label category when determining the target samples. Taking the training of the FasCausalModel model as an example, the sample library contains 8 sample label categories, the minibatch is 64 samples, the model training task uses 4 sample label categories, and each sample label is sampled in a 1:1 ratio.

[0065] An exemplary way to determine the target samples is as follows: among the 8 sample label categories, 4 sample label categories are selected using a random function; for each sample label category, 64÷4=16 samples are randomly selected; and the 16 samples corresponding to the 4 selected sample label categories (a total of 64 samples) are used as the target samples.

[0066] To further improve the model training process and save time in determining target samples, another exemplary method for determining target samples is to prepare a minibatch allocation queue in advance. Specifically, the sample library is segmented according to each sample label category, generating segmented samples under different sample label categories. The samples in the segmented samples can be of the same sample label category. The number of samples in the segmented samples can be 64 ÷ 4 = 16. For example, the segmented sample numbers can be: S1_1, S1_2, S1_3, ...; S2_1, S2_2, S2_3, ...; S8_1, S8_2, S8_3, ... Here, "S" represents a segmented sample, and "Sa_b" represents the b-th segmented sample in the segmented samples of the a-th sample label category. a and b can be constants; a can be a natural number from 1 to 8, and b can be a non-zero natural number. "Sa_b" can contain 16 samples from the a-th sample label category. The sample can be randomly selected from four categories without replacement, and then allocated to a minibatch queue. Each item in the minibatch allocation queue is then identified as a target sample. For example, a target sample identified by the minibatch allocation queue could be {S1_2, S3_4, S8_6, S5_7}.

[0067] like Figure 1b As shown, the FasCausalModel performs forward computation on the target sample, and the original feature vectors output by the feature extraction module (FasExtra) are: feat1, feat2, ..., feat64. The length of each original feature vector is 128. For example, feat1 has a length of 128, meaning it consists of 128 elements.

[0068] Step 120: Perform causal analysis on each original feature vector, extract causal features that have a causal relationship with the decision result, and obtain the causal feature vector corresponding to each original feature vector based on each causal feature.

[0069] Causal analysis can be used to analyze the relationship between feature vectors and decision outcomes. For example, it can examine the positive, negative, or selective bias effects of features on decision outcomes. A causal feature vector can be a feature vector composed of the common components of causal features. For example, a causal feature might be a feature that negatively impacts the decision outcome. Alternatively, a causal feature vector can be a feature vector composed of the common components shared by corresponding features that produce negative impacts.

[0070] In an optional embodiment of the present invention, causal analysis is performed on each original feature vector to extract causal features that have a causal relationship with the decision result, including: performing at least one mask processing on each original feature vector to obtain at least one mask feature vector; performing decision calculations on each original feature vector and each mask feature vector using a machine learning model to obtain corresponding original decision results and mask decision results; and determining causal features that have a causal relationship with the decision result based on each original decision result and each mask decision result.

[0071] Masking can be used to mask elements in the original feature vector. For example, masking can be applied to the original feature vector using either 0 or 1. Specifically, when masking is 0, elements in the original feature vector are masked (e.g., elements are set to 0); when masking is 1, elements in the original feature vector are preserved. To ensure that all elements in the original feature vector are masked, the length of the mask can be the same as the length of the original feature vector. For example, the length of the mask could be 128.

[0072] Specifically, masking the original feature vector can be done through multiple random processes, generating multiple mask feature vectors. For example, the system can be configured to perform the masking process 32 times, resulting in 32 random mask feature vectors. The length of the mask feature vector is the same as that of the original feature vector. Figure 1b As shown, the causal computation module (CausalDo) in the FasCausalModel model can perform mask processing on the original feature vector. For example, the mask processing corresponding to the original feature vector feat1 is: mask_feat1_1, mask_feat1_2, ..., mask_feat1_128. Each mask processing can be 0 or 1, or it can be randomly generated. The masked feature vectors generated from the original feature vector are: feat1_1, feat1_2, ..., feat1_32; feat2_1, feat2_2, ..., feat2_32; ...; feat64_1, feat64_2, ..., feat64_32.

[0073] like Figure 1bAs shown, the decision module (FasCls) in the FasCausalModel can receive each original feature vector, perform decision calculations, and generate corresponding original decision results. The FasCls module can also receive each mask feature vector, perform decision calculations, and generate corresponding mask decision results. Decision results can include liveness detection results. For example, a decision result can be 0 or 1, where 0 represents non-liveness and 1 represents liveness.

[0074] like Figure 1b As shown, the CausalDo module can determine causal features that establish a causal relationship with the original decision result based on the original decision result and the corresponding Mask decision result. Specifically, the Mask decision results corresponding to feat1_1, feat1_2, ..., feat1_32 can be compared with the original decision result corresponding to feat1 to determine the specific impact of the Mask decision result corresponding to feat1 on the corresponding original decision result. For example, a positive impact or a negative impact.

[0075] In this embodiment of the invention, Mask feature vectors that have a negative impact on the original decision result can be recorded, and the difference between these Mask feature vectors and the corresponding original feature vectors can be used as causal features. Causal feature vectors can be determined based on the causal features.

[0076] In an optional embodiment of the present invention, obtaining causal feature vectors corresponding to each original feature vector based on each causal feature includes: performing bitwise logical operations on the causal features corresponding to each original feature vector to obtain causal feature vectors corresponding to each original feature vector.

[0077] Bitwise logical operations can be performed using bitwise AND, OR, or NOT operations. Specifically, Mask feature vectors that negatively impact the original decision result can be ANDed. For example, if the Mask decision result of feat1_1, feat1_2, feat1_5, feat1_7, feat1_20, and feat1_32 negatively impacts the original decision result of feat1, then a bitwise AND operation can be performed on feat1_1, feat1_2, feat1_5, feat1_7, feat1_20, and feat1_32 to form Mask_Causal_1, which serves as the causal feature vector corresponding to feat1. The causal feature vectors formed from each original feature vector can be Mask_Causal_1, Mask_Causal_2, ..., Mask_Causal_64.

[0078] Step 130: Perform causal relationship processing on the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector.

[0079] One method is to process the original feature vectors for causal relationships, which can be done by removing selective bias features from the original feature vectors.

[0080] In an optional embodiment of the present invention, the target feature vector is obtained by performing causal relationship processing on the corresponding original feature vectors according to each causal feature vector, including: performing mask processing on the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector.

[0081] In the causal feature vectors Mask_Causal_1, Mask_Causal_2, ..., Mask_Causal_64, the element 0 indicates that removing the corresponding element from the original feature vector negatively impacts the original decision result. Non-zero elements in the causal feature vectors can represent a negative impact that is insufficient to guarantee a positive decision result. The element in the original feature vector corresponding to the 0 in the causal feature vector has a positive impact on the decision result; that is, the element at that position can serve as either a correct or incorrect classification feature. The elements in the original feature vector corresponding to the non-zero positions in the causal feature vector can be understood as features exhibiting selective bias.

[0082] In this embodiment of the invention, the corresponding original feature vectors are masked according to the causal feature vectors. This can be done by retaining the elements in the original feature vectors that correspond to 0 in the causal feature vectors, while setting the elements that correspond to non-zero positions in the causal feature vectors to 0. The target feature vectors are, in order, feat1_Causal, feat2_Causal, ..., feat64_Causal.

[0083] For example, taking the generation of feat1_Causal as an example, the elements at positions 1, 3, 5, 8, 10, 11, 12, 13, 15, 18, 20, 21, 23, 24, 26, 28, 31, and 32 in Mask_Causal_1 are set to 0. Therefore, the elements at positions 1, 3, 5, 8, 10, 11, 12, 13, 15, 18, 20, 21, 23, 24, 26, 28, 31, and 32 in feat1 can be retained, while the elements at other positions (i.e., positions 2, 4, 6, 7, 9, 14, 16, 17, 19, 22, 25, 27, 29, and 30) can be set to 0 to generate feat1_Causal.

[0084] Step 140: Perform backward calculations based on each target feature vector to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0085] Among them, such as Figure 1bAs shown, adjusting the parameters of the machine learning model based on each target feature vector can be done as follows: Based on the target feature vectors, continue the forward computation of the machine learning model to determine the model's loss function value (Loss), and then perform backward computation to adjust the parameters of the machine learning model. Adjusting the parameters by removing selectively biased features from the target feature vectors can enhance the model's interpretability and improve its accuracy and precision. After parameter adjustment, the process can return to step 110 to begin the next cycle of model training until the model training is complete. The termination conditions for model training can be diverse. For example, it could be that the Loss value meets a preset condition.

[0086] The technical solution of this invention involves inputting a target sample into a machine learning model to be trained for forward computation and obtaining at least one original feature vector corresponding to the target sample; performing causal analysis on each original feature vector to extract causal features that have a causal relationship with the decision result, and obtaining causal feature vectors corresponding to each original feature vector; performing causal relationship processing on the corresponding original feature vectors according to each causal feature vector to obtain target feature vectors; and performing backward computation based on each target feature vector to adjust the parameters of the machine learning model until the model training is completed. This solves the problem of removing the influence of selective bias features based on causal relationships in machine learning model training, reduces the influence of selective bias features on the decision result, improves the interpretability, robustness, and accuracy of the machine learning model, and is applicable to various types of machine learning models.

[0087] Example 2

[0088] Figure 2a This is a flowchart of a machine learning model training method based on causality provided in Embodiment 2 of the present invention. The implementation method in this embodiment can be a refinement of the technical solution of the above embodiments, and can be combined with one or more of the above implementation methods, such as... Figure 2a As shown, the method specifically includes:

[0089] Step 210: Divide the samples in the sample library into micro-batches according to the sample label categories, and generate the corresponding target samples according to the sample label categories required for the model training task.

[0090] Step 220: Input the target sample corresponding to the model training task into the machine learning model to be trained for forward computation, and obtain at least one original feature vector corresponding to the target sample during the forward computation process.

[0091] Step 230: Perform masking on each original feature vector at least once to obtain at least one masked feature vector.

[0092] Step 240: Calculate decisions for each original feature vector and each Mask feature vector using a machine learning model to obtain the corresponding original decision results and Mask decision results.

[0093] Step 250: Based on the original decision results and the Mask decision results, determine the causal characteristics that have a causal relationship with the decision results.

[0094] In an optional embodiment of the present invention, based on each original decision result and each Mask decision result, determining the causal features that have a causal relationship with the decision results includes: determining the target Mask decision result that has a negative impact on the corresponding original decision result among each Mask decision result; and determining the Mask feature vector corresponding to the target Mask decision result as the causal feature that has a causal relationship with the decision results.

[0095] Negative impact can refer to the Mask feature vector having a negative effect on the correct decision for the corresponding sample. For example, the sample may be a living organism, but the Mask decision determined based on the Mask feature vector may be a non-living organism. Alternatively, the Mask decision determined based on the Mask feature vector may reduce the degree of correct decision for the sample. The correct decision for the sample can be the original decision result corresponding to the sample. Features corresponding to the 0 elements in the Mask feature vector that have a negative impact on the original decision result can be considered as causal features.

[0096] In an optional embodiment of the present invention, determining the target Mask decision result among the Mask decision results that has a negative impact on the corresponding original decision result includes: when the logit value or result confidence in the Mask decision result is less than the logit value or result confidence in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result; or, when the loss function value in the Mask decision result is greater than the loss function value in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result.

[0097] In addition to the liveness detection result, the decision outcome may also include the classification and rating model (logit) value and the confidence score of the result, which are determined as the current detection result. Both the logit value and the confidence score can represent the reliability of the current decision outcome, and these are data generated during model training.

[0098] In this embodiment of the invention, for training a machine learning model with sample label categories, the negative impact of the mask decision result on the original decision result can be accurately determined by the logit value or the result confidence score. Specifically, when the difference between the logit value or result confidence score in the mask decision result and the corresponding logit value or result confidence score in the original decision result is negative, it can be determined that the mask decision result has a negative impact on the original decision result. For example, when the difference between logit_feat3_32 (logit value of feat3_32) and logit_feat3 (logit value of feat3) is negative, it can be determined that the mask decision result of feat3_32 has a negative impact on the original decision result of feat3.

[0099] In this embodiment of the invention, for training a machine learning model without sample label categories, the negative impact of the mask decision result on the original decision result can be accurately determined by the loss value. Specifically, when the difference between the loss value in the mask decision result and the loss value in the original decision result is positive, it can be determined that the mask decision result has a negative impact on the original decision result.

[0100] Alternatively, in this embodiment of the invention, the impact of the Mask decision on the original decision can be determined by setting a preset threshold, such that the logit value is greater than a corresponding threshold, the result confidence level is greater than a corresponding threshold, or the loss value is less than a corresponding threshold. Alternatively, the impact of the Mask decision on the original decision can also be determined by the ranking of the differences in logit value, result confidence level, or loss value between the Mask decision and the original decision. For example, the top 50% of Mask decision results can be identified as the target Mask decision. This embodiment of the invention is not limited in this respect.

[0101] The technical solution of this invention determines the negative impact of the Mask decision result on the original decision result by using the logit value, result confidence score, or loss value. This makes the method of this invention applicable to the training of various machine learning models, such as labeled or unlabeled machine learning models, thereby improving the versatility of the method.

[0102] Step 260: Perform bitwise logical operations on the causal features corresponding to each original feature vector to obtain the causal feature vectors corresponding to each original feature vector.

[0103] Step 270: Mask the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector.

[0104] Figure 2bThis is a schematic diagram of an original feature vector provided in Embodiment 2 of the present invention. Figure 2c This is a schematic diagram of a feature vector category provided in Embodiment 2 of the present invention. Figure 2d This is a schematic diagram of a target feature vector provided in Embodiment 2 of the present invention. Figure 2b As shown, F01, F02, and F03 are the original feature vectors extracted from different samples by the FasModel model in existing technologies. F01, F02, and F03 correspond to positions pos1, pos2, and pos3 in the feature space, respectively. The dashed lines in the feature space represent the classification boundaries learned by the FasModel model; black squares represent the live class, and black triangles represent the non-live class. Whether it's the feature extraction process in pattern recognition or the automatic feature extraction process by deep learning models, bias is unavoidable.

[0105] like Figure 2c As shown, the feature vector extracted by a machine learning model typically includes correctly classified features (features with checkmarks), incorrectly classified features (features with crosses), sample-specific features, and background features (the remaining feature bits, which are unrelated to the category but participate in the decision-making process). Sample-specific features and background features can be categorized as selection bias features.

[0106] The target feature vector provided in this embodiment of the invention can be a feature that minimizes selection bias. For example... Figure 2d As shown, the method of this invention can retain both correctly classified and incorrectly classified features in the original feature vector. Samples are identified as live individuals based on the feature relationships between correctly classified features, or as non-live individuals based on the feature relationships between incorrectly classified features. The process of identifying sample categories is improved from statistical correlation in existing technologies to causal correlation, which can enhance the accuracy and robustness of machine learning models.

[0107] Step 280: Perform backward calculations based on each target feature vector to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0108] Step 290: Based on the causal analysis results of the original feature vector, determine the selective bias features, and prune the machine learning model according to the selective bias features.

[0109] In particular, when determining the selection bias feature, the computer stored procedures related to the selection bias feature can be removed according to the pruning method in the existing technology, which can "slim down" the machine learning model, improve the execution efficiency of the model, and reduce the hardware requirements.

[0110] The technical solution of this invention involves: dividing samples in a sample library into micro-batches according to each sample label category; generating corresponding target samples based on the sample label categories required for the model training task; inputting the target samples corresponding to the model training task into the machine learning model to be trained for forward computation, and obtaining at least one original feature vector corresponding to the target sample during the forward computation process; performing at least one mask processing on each original feature vector to obtain at least one mask feature vector; performing decision computation on each original feature vector and each mask feature vector through the machine learning model to obtain corresponding original decision results and mask decision results; determining causal features that have a causal relationship with the decision results based on each original decision result and each mask decision result; and performing bitwise logical operations on the causal features corresponding to each original feature vector. The algorithm calculates causal feature vectors corresponding to each original feature vector. Based on these causal feature vectors, it masks the corresponding original feature vectors to obtain target feature vectors. Then, based on these target feature vectors, it performs backward computation to adjust the parameters of the machine learning model until training is complete. Finally, based on the causal analysis of the original feature vectors, it determines selective bias features and prunes the machine learning model accordingly. This solves the problem of removing the influence of selective bias features based on causal relationships during machine learning model training. It reduces the impact of selective bias features on decision results, decreases the number of processing channels in the machine learning model, improves execution efficiency, reduces hardware requirements, and enhances the interpretability, robustness, and accuracy of the machine learning model. It is applicable to various types of machine learning models.

[0111] Based on the above implementation method, optionally, after the machine learning model training is completed, the method further includes: adjusting the trained machine learning model. This adjustment can be fine-tuning the machine learning model. The specific implementation of fine-tuning can be basically the same as the model training process, and the specific operations can be similar to steps 210 to 280. The main difference is that fine-tuning is performed on the trained machine learning model. Furthermore, during fine-tuning, the operation in step 230 needs to be adjusted, for example, by changing the random mask processing to bit-by-bit mask processing. In practical applications, if there is no limit to the training time of the machine learning model, the random mask processing in step 230 can be improved to bit-by-bit mask processing to achieve precise training of the machine learning model and maximize its accuracy.

[0112] The bit-by-bit masking process masks the original feature vector bit by bit, generating a mask feature vector of the same length as the original feature vector. For example, when the length of feat1 is 128, the first bit can be set to 0, and the remaining bits can be retained to generate feat1_1; the second bit can be set to 0, and the remaining bits can be retained to generate feat1_2; ...; the 128th bit can be set to 0, and the remaining bits can be retained to generate feat1_128.

[0113] It should also be noted that there are various variations and improvements to the calculation of the target mask decision result. For example, when performing mask processing, A / B testing can be conducted using an overlapping hierarchical binning approach to select the feature bits that need to be masked, thus achieving causal analysis. Alternatively, the target mask decision result can be determined by setting a preset threshold or a sorting method (which can be understood as a Top N value method). Furthermore, for special binary classification scenarios, negative impact results can be used for rapid calculation.

[0114] Example 3

[0115] Figure 3a This is a flowchart of a causal-based machine learning model adjustment method provided in Embodiment 3 of the present invention. This embodiment is applicable to situations where machine learning models are adjusted by removing selection bias features based on causal relationships. This method can be executed by a causal-based machine learning model adjustment device, which can be implemented in software and / or hardware and can be integrated into a computer. Specifically, when adjusting the machine learning model, this method can be executed by a newly added causal calculation module in the machine learning model.

[0116] The machine learning model can be any model in existing technologies, such as the FasModel model. Figure 3b This is a schematic diagram of the structure of a FasModel model in the prior art. For example... Figure 3b As shown, the FasModel model includes a feature extraction module (FasExtra) and a decision module (FasCls). In this embodiment of the invention, features can be extracted from the model as follows: Figure 3b The machine learning module in the existing technology shown can be adjusted. Specifically, a causal computation module (CausalDo) can be added between FasExtra and FasCls to make adjustments based on causal relationships, transforming the FasModel model into a FasCausalModel model, thereby improving the model's accuracy and robustness.

[0117] like Figure 3a As shown, the method specifically includes:

[0118] Step 310: Receive at least one original feature vector extracted by the feature extraction module, and perform bit-by-bit masking on each original feature vector to obtain a mask feature vector.

[0119] The number of mask feature vectors is the same as the length of the original feature vectors. The bit-by-bit masking process is the same as the fine-tuning of the FasCausalModel model in the above embodiments, and will not be repeated here.

[0120] Before step 310, target samples can be selected and input into the feature extraction module to obtain the corresponding original feature vectors. The method of selecting target samples can be the same as in the above embodiments. For example, in an optional embodiment of the present invention, generating target samples includes: dividing the samples in the sample library into micro-batches according to each sample label category, and generating corresponding target samples according to the sample label categories required for the model training task.

[0121] Step 320: Send each original feature vector and its corresponding Mask feature vector to the decision module, and receive the original decision results and Mask decision results fed back by the decision module.

[0122] Step 330: Based on each original decision result and each Mask decision result, determine the causal features that have a causal relationship with the decision results, and based on each causal feature, obtain the causal feature vectors corresponding to each original feature vector.

[0123] The method for determining causal features and causal feature vectors can be the same as in the above embodiments. For example, in an optional embodiment of the present invention, based on each original decision result and each Mask decision result, determining causal features that have a causal relationship with the decision results includes: determining the target Mask decision result that has a negative impact on the corresponding original decision result among each Mask decision result; and determining the Mask feature vector corresponding to the target Mask decision result as the causal feature that has a causal relationship with the decision results.

[0124] In an optional embodiment of the present invention, determining the target Mask decision result among the Mask decision results that has a negative impact on the corresponding original decision result includes: when the classification rating model logit value or result confidence in the Mask decision result is less than the logit value or result confidence in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result; or, when the loss function value in the Mask decision result is greater than the loss function value in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result.

[0125] In an optional embodiment of the present invention, obtaining causal feature vectors corresponding to each original feature vector based on each causal feature includes: performing bitwise logical operations on the causal features corresponding to each original feature vector to obtain causal feature vectors corresponding to each original feature vector.

[0126] In an optional embodiment of the present invention, the target feature vector is obtained by performing causal relationship processing on the corresponding original feature vectors according to each causal feature vector, including: performing mask processing on the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector.

[0127] Step 340: Perform causal relationship processing on the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector, and send the target feature vector to the decision module to adjust the parameters of the machine learning model.

[0128] The method for adjusting the parameters can be the same as in the above embodiments, and will not be repeated here.

[0129] The technical solution of this invention involves receiving at least one original feature vector extracted by a feature extraction module and performing a bit-by-bit masking process on each original feature vector to obtain a mask feature vector; wherein the number of mask feature vectors is the same as the length of the original feature vectors; sending each original feature vector and its corresponding mask feature vector to a decision module, and receiving the original decision results and mask decision results fed back by the decision module; determining causal features that have a causal relationship with the decision results based on each original decision result and each mask decision result, and obtaining causal feature vectors corresponding to each original feature vector based on each causal feature vector; performing causal relationship processing on the corresponding original feature vector based on each causal feature vector to obtain a target feature vector, and sending the target feature vector to the decision module to adjust the parameters of the machine learning model. This solves the problem of adjusting machine learning models based on causal relationships in the prior art, and improves the existing machine learning models by adding causal relationships to the model, making the model's recognition results not simply dependent on statistical associations, but more dependent on causal relationships, thereby improving the model's accuracy and robustness.

[0130] Example 4

[0131] Figure 4 This is a schematic diagram of the structure of a machine learning model training device based on causality provided in Embodiment 4 of the present invention. Combined with... Figure 4 The device includes: a raw feature vector acquisition module 410, a causal feature vector determination module 420, a target feature vector determination module 430, and a parameter adjustment module 440. Wherein:

[0132] The original feature vector acquisition module 410 is used to input the target sample corresponding to the model training task into the machine learning model to be trained for forward calculation, and to acquire at least one original feature vector corresponding to the target sample during the forward calculation process.

[0133] The causal feature vector determination module 420 is used to perform causal analysis on each original feature vector, extract causal features that have a causal relationship with the decision result, and obtain causal feature vectors corresponding to each original feature vector based on each causal feature.

[0134] The target feature vector determination module 430 is used to perform causal relationship processing on the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector;

[0135] The parameter adjustment module 440 is used to perform backward calculations based on each target feature vector to adjust the parameters of the machine learning model until the model training of the machine learning model is completed.

[0136] Optionally, the causal feature vector determination module 420 includes:

[0137] The Mask feature vector determination unit is used to perform at least one mask processing on each original feature vector to obtain at least one Mask feature vector.

[0138] The decision result determination unit is used to perform decision calculations on each original feature vector and each Mask feature vector through a machine learning model to obtain the corresponding original decision results and Mask decision results.

[0139] The causal feature determination unit is used to determine the causal features that have a causal relationship with the decision results based on each original decision result and each Mask decision result.

[0140] Optional, the causal feature determination unit includes:

[0141] The target Mask decision result determination subunit is used to determine the target Mask decision results that have a negative impact on the corresponding original decision results among the various Mask decision results;

[0142] The causal feature determination subunit is used to determine the Mask feature vector corresponding to the target Mask decision result as the causal feature that has a causal relationship with the decision result.

[0143] Optionally, the target mask decision result determination sub-unit is used for:

[0144] When the logit value or confidence score of the classification rating model in the Mask decision result is less than the logit value or confidence score of the corresponding original decision result, the Mask decision result is taken as the target Mask decision result; or,

[0145] When the loss function value in the Mask decision result is greater than the loss function value in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result.

[0146] Optionally, the causal feature vector determination module 420 includes:

[0147] The causal feature vector determination subunit is used to perform bitwise logical operations on the causal features corresponding to each original feature vector to obtain the causal feature vector corresponding to each original feature vector.

[0148] Optionally, the target feature vector determination module 430 includes:

[0149] The target feature vector determination unit is used to perform masking on the corresponding original feature vectors based on each causal feature vector to obtain the target feature vector.

[0150] Optionally, the device may also include:

[0151] The target sample generation module is used to divide the samples in the sample library into micro-batches according to the sample label categories before inputting the target samples corresponding to the model training task into the machine learning model for forward computation, and generate the corresponding target samples according to the sample label categories required by the model training task.

[0152] Optionally, the device may also include:

[0153] The pruning module is used to determine selective bias features based on the causal analysis results of the original feature vectors after the machine learning model training is completed, and to prune the machine learning model according to the selective bias features.

[0154] The causal machine learning model training device provided in this embodiment of the invention can execute the causal machine learning model training method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0155] Example 5

[0156] Figure 5 This is a schematic diagram of the structure of a machine learning model adjustment device based on causality provided in Embodiment 5 of the present invention. Combined with... Figure 5This device can be incorporated into the causal computation module of a machine learning model. The machine learning model may include a feature extraction module, a decision module, and a causal computation module positioned between the feature extraction module and the decision module. The causal-based machine learning model adjustment device includes: a Mask feature vector determination module 510, a decision result determination module 520, a causal feature vector determination module 530, and a target feature vector determination module 540. Wherein:

[0157] The Mask feature vector determination module 510 is used to receive at least one original feature vector extracted by the feature extraction module, and to perform bit-by-bit masking on each original feature vector to obtain a Mask feature vector; wherein the number of Mask feature vectors is the same as the length of the original feature vectors.

[0158] The decision result determination module 520 is used to send each original feature vector and the corresponding Mask feature vector to the decision module, and to receive the original decision result and Mask decision result fed back by the decision module respectively;

[0159] The causal feature vector determination module 530 is used to determine the causal features that have a causal relationship with the decision results based on each original decision result and each Mask decision result, and to obtain the causal feature vector corresponding to each original feature vector based on each causal feature.

[0160] The target feature vector determination module 540 is used to perform causal relationship processing on the corresponding original feature vectors according to each causal feature vector to obtain the target feature vector, and send the target feature vector to the decision module to adjust the parameters of the machine learning model.

[0161] The causal machine learning model adjustment device provided in this embodiment of the invention can execute the causal machine learning model adjustment method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method.

[0162] Example 6

[0163] Figure 6 This is a schematic diagram of the structure of a computer device provided in Embodiment Six of the present invention, as shown below. Figure 6 As shown, the device includes:

[0164] One or more processors 610, Figure 6 Taking the 610 processor as an example;

[0165] Memory 620;

[0166] The device may also include an input device 630 and an output device 640.

[0167] The processor 610, memory 620, input device 630, and output device 640 in the device can be connected via a bus or other means. Figure 6 Taking the example of a connection between China and Israel via a bus.

[0168] The memory 620, as a non-transitory computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as a causal-based machine learning model training method in an embodiment of the present invention, or program instructions / modules corresponding to a causal-based machine learning model adjustment method (e.g., attached). Figure 4 The module shown includes the original feature vector acquisition module 410, the causal feature vector determination module 420, the target feature vector determination module 430, and the parameter adjustment module 440; or, supplemented by... Figure 5 The diagram shows a Mask feature vector determination module 510, a decision result determination module 520, a causal feature vector determination module 530, and a target feature vector determination module 540. The processor 610 executes various functional applications and data processing of the computer device by running software programs, instructions, and modules stored in the memory 620, thereby implementing a causal-based machine learning model training method according to the above method embodiment.

[0169] The target sample corresponding to the model training task is input into the machine learning model to be trained for forward computation, and at least one original feature vector corresponding to the target sample is obtained during the forward computation process.

[0170] Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result, and causal feature vectors corresponding to each of the original feature vectors are obtained based on each of the causal features.

[0171] Based on each of the aforementioned causal feature vectors, the corresponding original feature vectors are processed to obtain the target feature vectors;

[0172] Based on each of the target feature vectors, backward computation is performed to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0173] Alternatively, a machine learning model adjustment method based on causality could be used, namely:

[0174] The system receives at least one original feature vector extracted by the feature extraction module and performs bit-by-bit masking on each original feature vector to obtain a mask feature vector; wherein the number of mask feature vectors is the same as the length of the original feature vectors.

[0175] Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively.

[0176] Based on the original decision results and the Mask decision results, causal features that have a causal relationship with the decision results are determined, and causal feature vectors corresponding to the original feature vectors are obtained based on the causal features.

[0177] Based on each of the causal feature vectors, the corresponding original feature vectors are processed to obtain target feature vectors, and the target feature vectors are sent to the decision module to adjust the parameters of the machine learning model.

[0178] The memory 620 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 620 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 620 may optionally include memory remotely located relative to the processor 610, and these remote memories can be connected to the terminal device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0179] Input device 630 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the computer device. Output device 640 may include display devices such as a display screen.

[0180] Example 7

[0181] Embodiment 7 of the present invention provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements a causal-based machine learning model training method as provided in this embodiment of the present invention, namely:

[0182] The target sample corresponding to the model training task is input into the machine learning model to be trained for forward computation, and at least one original feature vector corresponding to the target sample is obtained during the forward computation process.

[0183] Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result, and causal feature vectors corresponding to each of the original feature vectors are obtained based on each of the causal features.

[0184] Based on each of the aforementioned causal feature vectors, the corresponding original feature vectors are processed to obtain the target feature vectors;

[0185] Based on each of the target feature vectors, backward computation is performed to adjust the parameters of the machine learning model until the training of the machine learning model is completed.

[0186] Alternatively, a machine learning model adjustment method based on causality could be used, namely:

[0187] The system receives at least one original feature vector extracted by the feature extraction module and performs bit-by-bit masking on each original feature vector to obtain a mask feature vector; wherein the number of mask feature vectors is the same as the length of the original feature vectors.

[0188] Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively.

[0189] Based on the original decision results and the Mask decision results, causal features that have a causal relationship with the decision results are determined, and causal feature vectors corresponding to the original feature vectors are obtained based on the causal features.

[0190] Based on each of the aforementioned causal feature vectors, causal relationship processing is performed on the corresponding original feature vectors to obtain target feature vectors. These target feature vectors are then sent to the decision module to adjust the parameters of the machine learning model.

[0191] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0192] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0193] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0194] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0195] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A method for training a machine learning model based on causal relationships, characterized in that, include: The target sample, consisting of live and non-live samples, corresponding to the model training task, is input into the FasCausalModel, a causal-based liveness detection model to be trained, for forward computation. The original feature vector of at least one image corresponding to the target sample is obtained during the forward computation process. The FasCausalModel includes a feature extraction module, a decision module, and a causal computation module set between the feature extraction module and the decision module. Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result. Bitwise logical operations are then performed on the causal features corresponding to each of the original feature vectors to obtain causal feature vectors corresponding to each of the original feature vectors. The causal analysis involves analyzing the positive, negative, or selective bias effects of the feature vectors on the decision result, and classifying the feature vectors into correct classification features, incorrect classification features, and selective bias features. Negative effects include: when the sample is a live organism, the decision result determined based on the feature vector is a non-live organism. The decision result includes: the liveness detection result, the classification evaluation model value of the current detection result, and the result confidence level. Based on each of the causal feature vectors, the corresponding original feature vectors are masked to obtain the target feature vectors; Based on each of the target feature vectors, backward calculation is performed to adjust the parameters of the FasCausalModel until the training of the FasCausalModel is completed. The step of performing causal analysis on each of the original feature vectors to extract causal features that have a causal relationship with the decision result includes: Perform at least one masking process on each of the original feature vectors to obtain at least one masked feature vector; The machine learning model is used to perform decision calculations on each of the original feature vectors and each Mask feature vector to obtain the corresponding original decision results and Mask decision results. Based on the original decision results and the Mask decision results, determine the causal characteristics that are causally related to the decision results.

2. The method according to claim 1, characterized in that, Based on the original decision results and the Mask decision results, determine the causal characteristics that are causally related to the decision results, including: Identify the target Mask decision results among the Mask decision results that have a negative impact on the corresponding original decision results; The Mask feature vector corresponding to the target Mask decision result is determined as a causal feature that has a causal relationship with the decision result.

3. The method according to claim 2, characterized in that, Identify the target Mask decision results among the various Mask decision results that have a negative impact on the corresponding original decision results, including: When the classification rating model logit value or result confidence score in the Mask decision result is less than the corresponding logit value or result confidence score in the original decision result, the Mask decision result is taken as the target Mask decision result; or... When the loss function value in the Mask decision result is greater than the loss function value in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result.

4. The method according to claim 1, characterized in that, Before inputting the target samples, consisting of live and non-live samples, corresponding to the model training task into the FasCausalModel to be trained for forward computation, the following steps are also included: The samples in the sample library are divided into micro-batches according to the sample label categories, and corresponding target samples are generated according to the sample label categories required for the model training task.

5. The method according to claim 1, characterized in that, After the FasCausalModel model training is complete, the following is also included: Based on the causal analysis results of the original feature vectors, selective bias features are determined, and the FasCausalModel model is pruned according to the selective bias features.

6. A method for adjusting a machine learning model based on causal relationships, characterized in that, The machine learning model is a causal-based liveness detection model, FasCausalModel. A causal computation module is set between the feature extraction module and the decision module of the FasCausalModel model. The method is executed by the causal computation module and includes: The system receives at least one original feature vector of an image extracted by the feature extraction module, and performs bit-by-bit masking on each of the original feature vectors to obtain mask feature vectors; wherein the number of mask feature vectors is the same as the length of the original feature vectors. Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively; the decision results include: liveness detection results, classification evaluation model values ​​of the current detection results, and result confidence; Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result. Then, bitwise logical operations are performed on the causal features corresponding to each of the original feature vectors to obtain causal feature vectors corresponding to each of the original feature vectors. Masking is performed on the corresponding original feature vectors according to each of the causal feature vectors to obtain target feature vectors, and the target feature vectors are sent to the decision module to adjust the parameters of the FasCausalModel. The causal analysis involves analyzing the positive, negative, or selective bias effects of feature vectors on decision outcomes, and classifying feature vectors into correct classification features, incorrect classification features, and selective bias features. Negative effects include: when the sample is a living organism, the decision outcome determined based on the feature vector is a non-living organism. The step of performing causal analysis on each of the original feature vectors to extract causal features that have a causal relationship with the decision result includes: Perform at least one masking process on each of the original feature vectors to obtain at least one masked feature vector; The machine learning model is used to perform decision calculations on each of the original feature vectors and each Mask feature vector to obtain the corresponding original decision results and Mask decision results. Based on the original decision results and the Mask decision results, determine the causal characteristics that are causally related to the decision results.

7. A computer device comprising a processor and a memory, the memory being configured to store instructions that, when executed, cause the processor to perform the following operations: The target sample, consisting of live and non-live samples, corresponding to the model training task, is input into the FasCausalModel, a causal-based liveness detection model to be trained, for forward computation. During the forward computation, the original feature vector of at least one image corresponding to the target sample is obtained. The liveness detection model FasCausalModel includes a feature extraction module, a decision module, and a causal calculation module set between the feature extraction module and the decision module; Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result. Bitwise logical operations are then performed on the causal features corresponding to each of the original feature vectors to obtain causal feature vectors corresponding to each of the original feature vectors. The causal analysis involves analyzing the positive, negative, or selective bias effects of the feature vectors on the decision result, and classifying the feature vectors into correct classification features, incorrect classification features, and selective bias features. Negative effects include: when the sample is a live organism, the decision result determined based on the feature vector is a non-live organism. The decision result includes: the liveness detection result, the classification evaluation model value of the current detection result, and the result confidence level. Based on each of the causal feature vectors, the corresponding original feature vectors are masked to obtain the target feature vectors; Based on each of the target feature vectors, backward calculation is performed to adjust the parameters of the FasCausalModel until the training of the FasCausalModel is completed. The processor is configured to determine causal features that have a causal relationship with the decision outcome in the following manner: Perform at least one masking process on each of the original feature vectors to obtain at least one masked feature vector; The FasCausalModel liveness detection model is used to perform decision calculations on each of the original feature vectors and each Mask feature vector to obtain the corresponding original decision results and Mask decision results. Based on the original decision results and the Mask decision results, determine the causal characteristics that are causally related to the decision results.

8. The computer device according to claim 7, characterized in that, The processor is configured to determine causal features that are causally related to the decision outcome in the following manner: Identify the target Mask decision results among the Mask decision results that have a negative impact on the corresponding original decision results; The Mask feature vector corresponding to the target Mask decision result is determined as a causal feature that has a causal relationship with the decision result.

9. The computer device according to claim 8, characterized in that, The processor is configured to determine the target Mask decision result that has a negative impact on the original decision result in the following manner: When the classification rating model logit value or result confidence in the Mask decision result is less than the corresponding logit value or result confidence in the original decision result, the Mask decision result is taken as the target Mask decision result. or, When the loss function value in the Mask decision result is greater than the loss function value in the corresponding original decision result, the Mask decision result is taken as the target Mask decision result.

10. The computer device according to claim 7, characterized in that, The processor is configured to generate target samples before inputting the target samples (composed of live and non-live samples) corresponding to the model training task into the FasCausalModel to be trained for forward computation in the following manner: The samples in the sample library are divided into micro-batches according to the sample label categories, and corresponding target samples are generated according to the sample label categories required for the model training task.

11. The computer device according to claim 7, characterized in that, The processor is configured to prune the FasCausalModel model after training is complete in the following manner: Based on the causal analysis results of the original feature vectors, selective bias features are determined, and the FasCausalModel model is pruned according to the selective bias features.

12. A computer device comprising a processor and a memory, the memory being configured to store instructions that, when executed, cause the processor to perform the following operations: The system receives at least one original feature vector from an image extracted by a feature extraction module, and performs bit-by-bit masking processing on each of the original feature vectors to obtain a masked feature vector; wherein, The number of mask feature vectors is the same as the length of the original feature vectors; Each of the original feature vectors and the corresponding Mask feature vectors are sent to the decision module, and the original decision results and Mask decision results fed back by the decision module are received respectively; the decision results include: liveness detection results, classification evaluation model values ​​of the current detection results, and result confidence; Causal analysis is performed on each of the original feature vectors to extract causal features that have a causal relationship with the decision result. Then, bitwise logical operations are performed on the causal features corresponding to each of the original feature vectors to obtain causal feature vectors corresponding to each of the original feature vectors. Mask the corresponding original feature vectors according to each of the causal feature vectors to obtain target feature vectors, and send the target feature vectors to the decision module to adjust the parameters of the causal-based liveness detection model FasCausalModel. The causal analysis involves analyzing the positive, negative, or selective bias effects of feature vectors on decision outcomes, and classifying feature vectors into correct classification features, incorrect classification features, and selective bias features. Negative effects include: when the sample is a living organism, the decision outcome determined based on the feature vector is a non-living organism. The processor is configured to determine causal features that have a causal relationship with the decision outcome in the following manner: Perform at least one masking process on each of the original feature vectors to obtain at least one masked feature vector; The FasCausalModel liveness detection model is used to perform decision calculations on each of the original feature vectors and each Mask feature vector to obtain the corresponding original decision results and Mask decision results. Based on the original decision results and the Mask decision results, determine the causal characteristics that are causally related to the decision results.

13. A storage medium for storing instructions for executing a causal-based machine learning model training method as described in any one of claims 1-5; or, the instructions for executing a causal-based machine learning model tuning method as described in claim 6.

Citation Information

Patent Citations

  • Decision making method and system based on big data

    CN104123395A

  • Method and system for constructing medical-oriented causality knowledge base

    CN109801687A