A method and device for training an electrocardiogram time series signal atrial fibrillation detection model
By combining a multi-branch residual network and a generative adversarial classification network, reliable pseudo labels are generated and their confidence is evaluated, which solves the problem of insufficient model robustness in atrial fibrillation detection of ECG signals and achieves more efficient ECG data classification.
Patent Information
- Application Number
- CN202111248135.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-26
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2041-10-26
AI Technical Summary
Existing technologies for atrial fibrillation detection in ECG signals lack sufficient labeled samples, resulting in poor model robustness and difficulty in effectively classifying ECG data, especially poor performance on large amounts of unlabeled data.
A dual-channel network method consisting of a multi-branch residual network and a generative adversarial classification network is adopted. Pseudo-labels are generated through the adaptive stage, and pseudo-label confidence evaluation is added to the domain difference measurement function to improve the accuracy and stability of model training.
The classification accuracy and stability of the atrial fibrillation detection model for ECG time series signals have been improved, making it more reliable when processing unlabeled data and enhancing the model's adaptability.
Smart Images

Figure CN114154530B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of model training, and in particular to a method and device for training an electrocardiogram (ECG) timing signal atrial fibrillation detection model. Background Art
[0002] To meet the need to improve neural network performance on both small amounts of labeled ECG data and large amounts of unlabeled ECG data, a new method was developed and tested to obtain a highly accurate ECG signal atrial fibrillation detection model. Labeling ECG signals is a complex process. Obvious arrhythmia symptoms may not be visible during ECG signal acquisition, and analysis by professionals requires a large amount of data. Furthermore, ECG signal properties (such as period and amplitude) vary from person to person, depending on factors such as age, gender, physical condition, and lifestyle. This can lead to misjudgments during the labeling process. Furthermore, given the large amount of ECG data, it is unrealistic to require professionals to accurately label each sample. This results in a very limited number of labeled samples available for research, and poor performance when processing out-of-sample data.
[0003] The vast majority of existing research is based on supervised learning. Supervised learning involves updating model parameters at each iteration based on the discrepancy between the model's sample classification results and the sample's actual label, aiming to improve the model's classification capabilities by approaching local or global optimality. In other words, all samples in supervised learning must have clear labels; otherwise, the model will not be able to learn useful information from them.
[0004] The training process requires a large amount of ECG signal data with category labels. However, during the acquisition of ECG signals, obvious arrhythmia symptoms may not be seen. Experts need to consider a large amount of data when analyzing. Moreover, the properties of ECG signals (such as period and amplitude) vary from person to person and depend on different factors such as age, gender, physical condition and lifestyle. Experts are bound to make misjudgments during the labeling process. In addition, faced with a large amount of ECG data, it is unrealistic for experts to accurately label each sample, resulting in a very limited number of labeled samples available for research and poor performance when processing out-of-sample data. The limited number of samples greatly limits the breadth of researchers' research in the field of ECG signal classification, ultimately resulting in poor model robustness and reduced classification accuracy for samples outside the dataset. Summary of the Invention
[0005] The technical problem solved by the present invention is to overcome the deficiencies of the prior art and provide a method and device for training an atrial fibrillation detection model using an electrocardiogram timing signal.
[0006] The technical solution of the present invention is:
[0007] In a first aspect, an embodiment of the present application provides a method for training an electrocardiogram time sequence signal atrial fibrillation detection model, comprising:
[0008] obtaining model training samples; the model training samples are 3D data constructed according to electrocardiogram signal data, a relative front RR interval and a relative rear RR interval, and the model training samples include labeled first model training samples and unlabeled second model training samples;
[0009] training an initial electrocardiogram time sequence signal atrial fibrillation detection model based on the first model training samples to obtain a trained electrocardiogram time sequence signal atrial fibrillation detection model; the initial electrocardiogram time sequence signal atrial fibrillation detection model is a model formed by connecting a multi-branch residual network layer and a generated multi-ant classification network layer in parallel;
[0010] inputting the second model training samples into the trained electrocardiogram time sequence signal atrial fibrillation detection model to obtain pseudo-label samples corresponding to the second model training samples;
[0011] based on the pseudo-label samples and the first model training samples, the trained electrocardiogram time sequence signal atrial fibrillation detection model is trained again to obtain an electrocardiogram time sequence signal atrial fibrillation detection model.
[0012] Optionally, the obtaining model training samples comprises:
[0013] obtaining the electrocardiogram signal data;
[0014] calculating a global RR interval corresponding to the electrocardiogram signal data;
[0015] based on the global RR interval, the relative front RR interval and the relative rear RR interval are calculated;
[0016] based on the electrocardiogram signal data, the relative front RR interval and the relative rear RR interval, 3D data is constructed, and the constructed 3D data is used as a model training sample.
[0017] Optionally, the first model training sample corresponds to a sample label value, wherein,
[0018] the training of the initial electrocardiogram time sequence signal atrial fibrillation detection model based on the first model training samples to obtain the trained electrocardiogram time sequence signal atrial fibrillation detection model comprises:
[0019] inputting the first model training samples into the initial electrocardiogram time sequence signal atrial fibrillation detection model;
[0020] calling the multi-branch residual network layer to process the first model training samples to obtain a first predicted label value corresponding to the first model training samples;
[0021] Calling the generated multi-antibody classification network layer to process the first model training sample to obtain a second predicted label value corresponding to the first model training sample;
[0022] Calculating a loss value corresponding to the initial ECG time series signal detection model based on the first predicted label value, the second predicted label value, and the sample label value;
[0023] When the loss value is within a preset range, the trained initial ECG timing signal detection model is used as the training ECG timing signal detection model.
[0024] Optionally, the calculating, based on the first predicted label value, the second predicted label value, and the sample label value, a loss value corresponding to the initial ECG time series signal detection model includes:
[0025] Calculating a first loss value of the multi-branch residual network layer according to the first predicted label value and the sample label value;
[0026] Calculating a second loss value of the generated multi-antibody classification network layer according to the second predicted label value and the sample label value;
[0027] The loss value of the initial ECG timing signal detection model is determined according to the first loss value and the second loss value.
[0028] Optionally, inputting the second model training sample into the training ECG timing signal atrial fibrillation detection model to obtain a pseudo-label sample corresponding to the second model training sample includes:
[0029] Inputting the second model training sample into the training ECG timing signal atrial fibrillation detection model;
[0030] Calling the multi-branch residual network layer to process the second model training sample to generate a first classification result corresponding to the second model training sample;
[0031] Calling the generated multi-antibody classification network layer to process the second model training sample to generate a second classification result corresponding to the second model training sample;
[0032] When the first classification result and the second classification result are the same, the second model training sample is labeled to generate the pseudo-label sample.
[0033] In a second aspect, an embodiment of the present invention provides a device for training an atrial fibrillation detection model using an electrocardiogram timing signal, comprising:
[0034] A model training sample acquisition module is used to acquire model training samples; the model training samples are 3D data constructed based on ECG signal data, relative front RR intervals, and relative back RR intervals, and the model training samples include a labeled first model training sample and an unlabeled second model training sample;
[0035] a training detection model acquisition module, configured to train an initial ECG time series signal atrial fibrillation detection model based on the first model training sample to obtain a training ECG time series signal atrial fibrillation detection model; the initial ECG time series signal atrial fibrillation detection model is a model formed by connecting a multi-branch residual network layer and a generative multi-antibody classification network layer in parallel;
[0036] a pseudo-label sample acquisition module, configured to input the second model training sample into the training ECG time series signal atrial fibrillation detection model to obtain a pseudo-label sample corresponding to the second model training sample;
[0037] The ECG detection model acquisition module is used to perform secondary training on the training ECG time series signal atrial fibrillation detection model based on the pseudo-label samples and the first model training samples to obtain the ECG time series signal atrial fibrillation detection model.
[0038] Optionally, the model training sample acquisition module includes:
[0039] an electrocardiogram signal data acquisition unit, configured to acquire the electrocardiogram signal data;
[0040] A global RR interval calculation unit, configured to calculate the global RR interval corresponding to the electrocardiogram signal data;
[0041] a relative RR interval calculation unit, configured to calculate the relative front RR interval and the relative back RR interval based on the global RR interval;
[0042] The model training sample acquisition unit is used to construct 3D data based on the electrocardiogram signal data, the relative front RR interval and the relative back RR interval, and use the constructed 3D data as a model training sample.
[0043] Optionally, the first model training sample corresponds to a sample label value, wherein,
[0044] The training detection model acquisition module includes:
[0045] A first model sample input unit, configured to input the first model training sample into the initial ECG timing signal atrial fibrillation detection model;
[0046] The first prediction label value obtaining unit is configured to call the multi-branch residual network layer to process the first model training sample, and obtain a first prediction label value corresponding to the first model training sample.
[0047] The second prediction label value obtaining unit is configured to call the generative multi-antibody classification network layer to process the first model training sample, and obtain a second prediction label value corresponding to the first model training sample.
[0048] The loss value calculating unit is configured to calculate a loss value corresponding to the initial electrocardio time sequence signal detection model based on the first prediction label value, the second prediction label value and the sample label value.
[0049] The trained detection model obtaining unit is configured to, in a case where the loss value is within a preset range, take the trained initial electrocardio time sequence signal detection model as the trained electrocardio time sequence signal detection model.
[0050] Optionally, the loss value calculating unit comprises:
[0051] The first loss value calculating sub-unit is configured to calculate a first loss value of the multi-branch residual network layer based on the first prediction label value and the sample label value.
[0052] The second loss value calculating sub-unit is configured to calculate a second loss value of the generative multi-antibody classification network layer based on the second prediction label value and the sample label value.
[0053] The loss determining sub-unit is configured to determine the loss value of the initial electrocardio time sequence signal detection model based on the first loss value and the second loss value.
[0054] Optionally, the pseudo label sample obtaining module comprises:
[0055] The second model sample input unit is configured to input the second model training sample into the trained electrocardio time sequence signal atrial fibrillation detection model.
[0056] The first classification result generating unit is configured to call the multi-branch residual network layer to process the second model training sample, and generate a first classification result corresponding to the second model training sample.
[0057] The second classification result generating unit is configured to call the generative multi-antibody classification network layer to process the second model training sample, and generate a second classification result corresponding to the second model training sample.
[0058] The pseudo label sample generating unit is configured to, in a case where the first classification result and the second classification result are the same, label the second model training sample, and generate the pseudo label sample.
[0059] The present application has the advantages compared with the prior art:
[0060] The ECG time sequence signal atrial fibrillation detection model training method and device provided by the embodiment of the present application uses a dual-channel network method composed of a multi-branch residual neural network and a generative adversarial classification network to perform dual-dimension feature extraction, and in the adaptive stage, it jointly participates in the pseudo-label generation work to make more reliable pseudo-labels, ensuring the accuracy and speed of model updating. In addition, in the domain difference measurement function, the evaluation process of the confidence of each pseudo-label is added, and the contribution of the more reliable pseudo-label to the domain difference loss value is greater, further improving the stability of model updating. BRIEF DESCRIPTION OF DRAWINGS
[0061] Figure 1 A step flowchart of an ECG time sequence signal atrial fibrillation detection model training method provided by the embodiment of the present application;
[0062] Figure 2 A schematic diagram of a multi-branch residual network layer provided by the embodiment of the present application;
[0063] Figure 3 A schematic diagram of a generative adversarial classification network layer provided by the embodiment of the present application;
[0064] Figure 4 A schematic diagram of a generator provided by the embodiment of the present application;
[0065] Figure 5 A schematic diagram of a discriminator provided by the embodiment of the present application;
[0066] Figure 6 A schematic diagram of a model training stage provided by the embodiment of the present application;
[0067] Figure 7 A schematic diagram of obtaining a pseudo-label sample provided by the embodiment of the present application;
[0068] Figure 8 A schematic diagram of domain difference measurement calculation provided by the embodiment of the present application;
[0069] Figure 9 A schematic diagram of a confusion matrix provided by the embodiment of the present application;
[0070] Figure 10 A schematic diagram of a pre-training stage (a) and an adaptive stage (b) model prediction state provided by the embodiment of the present application;
[0071] Figure 11 A structural schematic diagram of an ECG time sequence signal atrial fibrillation detection model training device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0072] Embodiment one
[0073] Reference Figure 1 , a step flow chart of a method for training an electrocardiosignal time sequence signal atrial fibrillation detection model is shown, as Figure 1 shown, the method for training the electrocardiosignal time sequence signal atrial fibrillation detection model can include the following steps:
[0074] Step 101: obtaining a model training sample; the model training sample is 3D data constructed according to electrocardiosignal data, a relative front RR interval and a relative rear RR interval, and the model training sample includes a first model training sample with a label and a second model training sample without a label.
[0075] Embodiments of the present application can be applied to the training scene of the electrocardiosignal time sequence signal atrial fibrillation detection model.
[0076] The model training sample refers to a sample used for training the electrocardiosignal time sequence signal atrial fibrillation detection model. In this example, the model training sample can be 3D data constructed according to electrocardiosignal data, a relative front RR interval and a relative rear RR interval. The model training sample can include a first model training sample with a label and a second model training sample without a label, i.e. a labeled sample and an unlabeled sample.
[0077] The process of obtaining the model training sample can be described in detail in combination with the following specific implementation mode.
[0078] In one specific implementation mode of the embodiments of the present application, the above step 101 can include:
[0079] Sub-step A1: obtaining the electrocardiosignal data.
[0080] Sub-step A2: calculating the global RR interval corresponding to the electrocardiosignal data;
[0081] Sub-step A3: based on the global RR interval, calculating the relative front RR interval and the relative rear RR interval;
[0082] Sub-step A4: based on the electrocardiosignal data, the relative front RR interval and the relative rear RR interval, constructing 3D data, and taking the constructed 3D data as a model training sample.
[0083] In this embodiment, the original electrocardiosignal data can be processed first, and 3D data is constructed using the RR interval of electrocardiosignal, and the RR interval is defined as the interval from one QRS main peak to the next QRS main peak as Figure 2 shown.
[0084] During the construction process, we considered that individual differences between people can cause significant differences in the RR interval values for the same category of data samples, affecting the model's classification performance. Therefore, for each person, we first calculated the global RR interval of the sample. Then, we used this global RR interval to calculate the ratio of the preceding and following RR intervals to obtain the relative preceding and following RR intervals. This can reduce the numerical fluctuations caused by individual differences to a certain extent. Finally, we constructed 3D data based on the ECG signal, the relative preceding and following RR intervals, and the 3D data used as the model training sample.
[0085] After obtaining the model training samples, step 102 is executed.
[0086] Step 102: Based on the first model training samples, the initial ECG time series signal atrial fibrillation detection model is trained to obtain a trained ECG time series signal atrial fibrillation detection model; the initial ECG time series signal atrial fibrillation detection model is a model formed by connecting a multi-branch residual network layer and a generated multi-antibody classification network layer in parallel.
[0087] In this example, the initial ECG timing signal atrial fibrillation detection model refers to an ECG timing signal atrial fibrillation detection model that has not yet started training.
[0088] When it is necessary to train an atrial fibrillation detection model based on ECG timing signals, the model can be built first.
[0089] In this embodiment, two neural networks can be built, namely a multi-branch residual network and a generative adversarial classification neural network.
[0090] Among them, the structure of the multi-branch residual network is as follows Figure 3 As shown in the figure, the multi-branch residual network includes: convolution layer, average pooling layer (including: batch normalization layer, ReLU activation layer, convolution layer, ReLU activation layer and convolution layer in sequence), batch normalization layer, ReLU activation layer, void convolution layer, global pooling layer, fully connected layer and softmax layer.
[0091] The structure of the generative adversarial classification network can be as follows Figure 4 As shown in the figure, the generative adversarial classification network is composed of a generator, a discriminator, and a classifier. For a general generative adversarial network, the generator generates pseudo data based on the input data, while the discriminator needs to determine whether the input data is pseudo data. That is, the generator needs to continuously learn to generate samples that can deceive the discriminator, while the discriminator needs to continuously learn to identify pseudo samples. In the process of continuous adversarial learning between the two networks, each improves the performance of the other, so it is called a generative adversarial network. The structure of the generator can be as follows: Figure 5 As shown, the structure of the discriminator can be as follows Figure 6 shown.
[0092] After building the model, a model pre-training process can be performed. Specifically, the initial ECG time-series signal atrial fibrillation detection model can be trained based on the labeled first model training samples to obtain a trained ECG time-series signal atrial fibrillation detection model. This training process is described in detail in conjunction with the specific implementation methods described below.
[0093] In another specific implementation of the embodiment of the present invention, the first model training sample corresponds to a sample label value, and the above step 102 may include:
[0094] Sub-step B1: inputting the first model training sample into the initial ECG timing signal atrial fibrillation detection model.
[0095] In this embodiment, when pre-training the initial ECG timing signal atrial fibrillation detection model, the first model training sample can be input into the initial ECG timing signal atrial fibrillation detection model to perform supervised learning on the two networks on a small amount of labeled data, and then execute sub-step B2.
[0096] Sub-step B2: calling the multi-branch residual network layer to process the first model training sample to obtain a first predicted label value corresponding to the first model training sample.
[0097] Sub-step B3: calling the generated multi-antibody classification network layer to process the first model training sample to obtain a second predicted label value corresponding to the first model training sample.
[0098] Sub-step B4: calculating a loss value corresponding to the initial ECG time series signal detection model based on the first predicted label value, the second predicted label value, and the sample label value;
[0099] Sub-step B5: When the loss value is within a preset range, the trained initial ECG timing signal detection model is used as the training ECG timing signal detection model.
[0100] The first predicted label value refers to the predicted label value of the first model training sample output by the multi-branch residual network layer.
[0101] The second predicted label value refers to the predicted label value of the first model training sample output by the generative adversarial classification network layer.
[0102] The multi-branch residual network uses an end-to-end approach for error calculation and parameter optimization. The sample is input into the model, passes through the residual network and the multi-branch network in sequence, and finally spliced into the classifier. The Softmax layer outputs the model result y', and the error value between it and the true label value y is calculated by cross entropy, as shown in the following formula (1):
[0103] loss ce=y×logy'+(1-y)×log(1-y') (1)
[0104] Error loss ce The back-propagation method is used to update the parameters of each layer of the network from back to front.
[0105] During the training phase, the Generative Adversarial Classification Network performs different calculations on the output values and intermediate feature values between the three modules of the generator, discriminator, and classifier to achieve a mutual constraint effect, thereby improving the performance of each module. The process of the pre-training phase can be as follows: Figure 7 shown.
[0106] The discriminator receives real input and pseudo input, outputs the judgment result, and calculates the cross entropy loss value loss_D with the real label ce , as shown in the following formula (2):
[0107] loss_D ce =y D logy' D +(1-y D )log(1-y' D ) (2)
[0108] To ensure that the real input and the fake input are similar enough, it is necessary to calculate the distribution difference between the two to penalize the generator. This difference value is called the reconstruction loss. Here, the mean square error is used for calculation, as shown in the following formula (3):
[0109]
[0110] If Latent_i is only used to reconstruct the input sample, then Latent_i will continuously mine the descriptive features of the input data, that is, it can fully reflect every detail of the input data, and ensure that it can be as similar to the original image as possible after passing through the Decoder. However, the goal of this model is not only to be able to generate data similar to the original sample, but also to hope that the generated pseudo data can fully highlight the lesion features that may not be obvious in the original data, so Latent_i should also have the classification features of the original data. When Latent_i has classification features, the lesion area in the generated pseudo data is highlighted, and then higher-quality dense features are extracted through Encoder_2. After being input into the classifier, the classification accuracy can be significantly improved. In view of the above goals, Latent_i is input into the classifier for classification judgment, and then Latent_o is input into the classifier for classification judgment, and the cross entropy loss_C_i is calculated according to the classification results. ce and loss_C_o ce , as shown in the following formula:
[0111] loss_C_i ce =y C logC(Latent_i)+(1-y C )log(1-C(Latent_i)) (4)
[0112] loss_C_o ce =y C logC(Latent_o)+(1-y C )log(1-C(Latent_o)) (5)
[0113] Then the sum can be obtained: loss_C ce =loss_C_i ce +loss_C_o ce .
[0114] Among them, f True is the feature of the real sample output by the discriminator, f Fake is the feature of the pseudo sample output by the discriminator, and it is assumed that the feature has n dimensions. True_i Indicates the i-th dimension of the real feature. In addition, there will still be a problem of gradient disappearance at the beginning of training, so when loss_D_f is judged during the training process mse When it is less than a certain threshold, the weight of the discriminator is initialized to ensure the update speed of the generator.
[0115] Finally, the loss values of each component are integrated, that is, the discriminator loss value loss D , generator loss value loss G And the classifier loss value loss C According to the following formula:
[0116] loss D =loss_D ce +loss_D_f mse
[0117] loss G =loss_G mse +loss_C ce +loss_D ce
[0118] loss C =loss_C ce
[0119] And update the parameters of each component through back propagation of the chain derivative rule.
[0120] After the initial ECG time series signal atrial fibrillation detection model is trained based on the first model training sample to obtain a trained ECG time series signal atrial fibrillation detection model, step 103 is performed.
[0121] Step 103: Input the second model training samples into the training ECG timing signal atrial fibrillation detection model to obtain pseudo-label samples corresponding to the second model training samples.
[0122] Step 104: performing secondary training on the training ECG time series signal atrial fibrillation detection model based on the pseudo-label samples and the first model training samples to obtain the ECG time series signal atrial fibrillation detection model.
[0123] After obtaining the pre-trained ECG time-series signal atrial fibrillation detection model, the second model training samples can be input into the training ECG time-series signal atrial fibrillation detection model to obtain pseudo-label samples corresponding to the second model training samples. Then, the training ECG time-series signal atrial fibrillation detection model is retrained by combining the pseudo-label samples with the first model training samples, thereby obtaining the ECG time-series signal atrial fibrillation detection model.
[0124] In this embodiment, based on the pre-trained network, it is first necessary to add pseudo labels to the target domain data without labels. The two models give classification results for the input data respectively. In order to avoid errors in model judgment, the output results of the two models will be compared. If the two models have the same category judgment for the current input, then the judgment is considered reliable, that is, the input data is pseudo-labeled. If the output categories of the two models are inconsistent and ambiguous, then the judgments of each other are considered unreliable and the label is discarded. The flowchart can be as follows: Figure 7 As shown:
[0125] like Figure 7 In the example, a batch of m data is input, and the two models give m judgments respectively. They are compared one by one. Finally, there are k consistent results between the two models, that is, k pseudo labels are generated for subsequent domain difference measurement calculation. The entropy of each label is calculated to determine the credibility of the pseudo label. The smaller the entropy, the higher the credibility. Finally, the target domain data with pseudo labels participate in the domain difference measurement calculation with the source domain according to their respective labels and corresponding credibility. The specific process can be as follows: Figure 8 shown.
[0126] Taking the multi-branch residual network as an example, the network from the input receiving end to the global pooling layer is defined as a feature extractor, which is used to extract high-quality sample features. The fully connected layer and Softmax are classifiers, which judge the sample category based on the output of the feature extractor. s is the source domain feature output by the feature extractor of the source domain data, f tThe target domain data is outputted by the feature extractor, and the parameters of the two networks are shared. When calculating the source domain data, the output of the model classifier is calculated with the true label to calculate the cross-entropy loss L cls At the same time, when processing the target domain data, the pseudo label is made according to the flowchart of the figure, and the pseudo label is calculated according to the corresponding f t of the source domain and the f s of the target domain. intra The intra-domain difference L inter and the inter-domain difference L t are calculated together, and finally the three loss values are integrated to update the parameters of the classifier and the feature extractor.
[0127] The domain difference calculation is only updated and calculated on the multi-branch residual network at this stage. The source data and the target data are respectively obtained by feature extraction to obtain their respective feature domains. The features of the target data are compared with the results of the generative adversarial network after passing through the classifier, and the classification results that are consistent with the judgment are reserved as pseudo labels. The information entropy of the pseudo label of each sample x i is calculated by using the Shannon information entropy formula:
[0128]
[0129] Where M is the number of categories, here M = 5, and i represents the sample category. The larger the information entropy, the lower the confidence. At the same time, ensure that the feature domain is compact in the same class and far away from the different classes. The loss function is introduced to quantitatively calculate the domain difference, and the intra-class domain difference is as follows:
[0130]
[0131] The inter-class domain difference is defined as:
[0132]
[0133] In the above formula, F is the feature extractor, D is the distance metric function, c cls is the information entropy when the pseudo label of the sample is i, and τ is a constant. Then, the cross-entropy loss is calculated by combining the output of the source domain and the true label:
[0134]
[0135] Where N is the number of source domain samples in this iteration. Finally, the domain difference loss function of the whole adaptive stage is as follows:
[0136] L = L intra + L inter
[0137] The domain difference measurement function uses contrastive domain discrepancy (CDD). First, define the judgment function:
[0138]
[0139] Then define CDD:
[0140]
[0141] where e1, e2 and e3 are defined as:
[0142]
[0143]
[0144]
[0145] where n s is the number of samples in the source domain, n t is the number of samples in the target domain, x s and x t are samples of the source domain and the target domain, φ is the feature extraction network, and pseudo labels are made for the target domain samples through the previous multi-branch residual network and generative adversarial classification network, and some fuzzy labels are discarded to obtain The final complete CDD is:
[0146]
[0147] Among them, M is the number of categories of target data, which is set to 5 in this experiment. The first term in the above formula is to make the same category as compact as possible, and the second term is to keep the different categories as far away as possible.
[0148] During the testing phase, accuracy, precision, and recall can be used to evaluate the performance of the classification model.
[0149] Before explaining these three indicators, it is necessary to introduce the concept of confusion matrix, such as Figure 9 As shown. In binary classification, the two categories are P and N, and the model output is y′, which represents the probability that the sample belongs to category P. In actual use, a threshold θ is generally set: when y′ is greater than θ, the model predicts category P; when y′ is less than θ, the model predicts category N. In binary classification, each data point has a real, objective label (P or N). At the same time, the model will judge the label of the data and obtain a predicted label. Assume that there are a total of M test samples. These M samples consist of 4 cases.
[0150] TP represents the number of samples whose true label is P and whose model predicts that they are of class P.
[0151] FP represents the number of samples whose true label is N and the model predicts that they are of class P.
[0152] FN represents the number of samples whose true label is P and whose model predicts N categories.
[0153] TN represents the number of samples whose true label is N and the model predicts that they are classified as N.
[0154] Clearly, M = TP + FP + FN + TN. Furthermore, we can obtain the number of samples with the true label P, MP = TP + FN, and the number of samples with the true label N, MN = FP + FN. Of the four cases above, only the first two (TP and TN) have consistent model predictions and true results. Therefore, Accuracy is calculated as follows: Accuracy = (TP + TN) / M.
[0155] However, the above formula has flaws. When the test sample categories are unbalanced, for example, when the samples of class N are far more than the samples of class P (MN≥MP), the indicator Accuracy will not be able to objectively reflect the actual performance of the model. In order to overcome the problem of important information being hidden when the number of test samples is unbalanced, the accuracy rate Precision and recall rate Recall are introduced. Precision and Recall are not an overall indicator. They are evaluated for the prediction of a specific class (class P or class N). Taking class P as an example, the definitions of the two are as follows:
[0156] Precision = TP / (TP+FP)
[0157] Recall = TP / (TP+FN)
[0158] That is, the accuracy rate refers to the proportion of data that the model predicts to be in category P that actually belongs to category P, and the recall rate refers to the proportion of data that belongs to category P that the model judges to be in category P.
[0159] Through iterative training in the adaptive phase, we compared the pre-trained classifier, the adaptive training using a single channel without information entropy, and the adaptive training using a dual channel with information entropy. We also compared the experimental results of other researchers in the field of ECG semi-supervised learning, as shown in the following table:
[0160]
[0161]
[0162] According to the above table, through the training of the domain adaptation stage, the performance of the model is improved, and the dual-channel network is used to generate the pseudo label, and the information entropy is added in the domain difference loss calculation process, which can further improve the training effect of the adaptation stage. In the field of semi-supervised learning, the model is in the leading level in terms of Precision and Recall, and slightly lags behind the optimal model in terms of Accuracy. In summary, the model has a good performance in the classification of electrocardiogram.
[0163] In addition, the model classification prediction diagram of the drawing model in the pre-training stage and the adaptation stage is as shown in Figure 10 The vertical coordinate is the real label of the sample, and the horizontal coordinate is the judgment result of the model. The comparison of the two diagrams can clearly show that compared with diagram (a), the values on the main diagonal line of diagram (b) increase obviously, which indicates that the number of prediction pairs increases, and it is proved that the domain adaptation technology can significantly improve the classification accuracy of the model.
[0164] The comparison of the classification accuracy matrix of the model in the two stages and the comparison of the feature space distribution of the model in the two stages can clearly show that the model structure proposed in the present research has good performance in diagnosing atrial fibrillation of electrocardiogram, and the design of the domain difference measurement function in the adaptation stage can effectively further improve the performance of the model.
[0165] Embodiment two
[0166] Referring to Figure 11 , a structure schematic diagram of an electrocardiogram time sequence signal atrial fibrillation detection model training device provided by an embodiment of the present application is shown, as shown in Figure 11 The electrocardiogram time sequence signal atrial fibrillation detection model training device can include the following modules:
[0167] The model training sample acquisition module 210 is configured to acquire a model training sample; the model training sample is a 3D data constructed according to electrocardiogram signal data, a relative front RR interval and a relative rear RR interval, and the model training sample includes a first model training sample with a label and a second model training sample without a label;
[0168] The training detection model acquisition module 220 is configured to train an initial electrocardiogram time sequence signal atrial fibrillation detection model based on the first model training sample to obtain a trained electrocardiogram time sequence signal atrial fibrillation detection model; the initial electrocardiogram time sequence signal atrial fibrillation detection model is a model formed by connecting a multi-branch residual network layer and a generated multi-antigen classification network layer in parallel;
[0169] A pseudo-label sample acquisition module 230 is configured to input the second model training sample into the training ECG time series signal atrial fibrillation detection model to obtain a pseudo-label sample corresponding to the second model training sample;
[0170] The ECG detection model acquisition module 240 is configured to perform secondary training on the training ECG time series signal atrial fibrillation detection model based on the pseudo-label samples and the first model training samples to obtain the ECG time series signal atrial fibrillation detection model.
[0171] Optionally, the model training sample acquisition module includes:
[0172] an electrocardiogram signal data acquisition unit, configured to acquire the electrocardiogram signal data;
[0173] A global RR interval calculation unit, configured to calculate the global RR interval corresponding to the electrocardiogram signal data;
[0174] a relative RR interval calculation unit, configured to calculate the relative front RR interval and the relative back RR interval based on the global RR interval;
[0175] The model training sample acquisition unit is used to construct 3D data based on the electrocardiogram signal data, the relative front RR interval and the relative back RR interval, and use the constructed 3D data as a model training sample.
[0176] Optionally, the first model training sample corresponds to a sample label value, wherein,
[0177] The training detection model acquisition module includes:
[0178] A first model sample input unit, configured to input the first model training sample into the initial ECG timing signal atrial fibrillation detection model;
[0179] A first predicted label value acquisition unit, configured to call the multi-branch residual network layer to process the first model training sample to obtain a first predicted label value corresponding to the first model training sample;
[0180] A second predicted label value acquisition unit is used to call the generated multi-antibody classification network layer to process the first model training sample to obtain a second predicted label value corresponding to the first model training sample;
[0181] a loss value calculation unit, configured to calculate a loss value corresponding to the initial ECG time series signal detection model based on the first predicted label value, the second predicted label value, and the sample label value;
[0182] The training detection model acquisition unit is used to use the trained initial electrocardiogram timing signal detection model as the training electrocardiogram timing signal detection model when the loss value is within a preset range.
[0183] Optionally, the loss value calculation unit includes:
[0184] A first loss value calculation subunit, configured to calculate a first loss value of the multi-branch residual network layer according to the first predicted label value and the sample label value;
[0185] A second loss value calculation subunit is used to calculate the second loss value of the generated multi-antibody classification network layer according to the second predicted label value and the sample label value;
[0186] The loss determination subunit is configured to determine a loss value of the initial ECG timing signal detection model according to the first loss value and the second loss value.
[0187] Optionally, the pseudo-label sample acquisition module includes:
[0188] a second model sample input unit, configured to input the second model training sample into the training ECG timing signal atrial fibrillation detection model;
[0189] A first classification result generating unit, configured to call the multi-branch residual network layer to process the second model training sample to generate a first classification result corresponding to the second model training sample;
[0190] A second classification result generating unit is configured to call the generated multi-antibody classification network layer to process the second model training sample to generate a second classification result corresponding to the second model training sample;
[0191] The pseudo-label sample generating unit is used to label the second model training sample and generate the pseudo-label sample when the first classification result and the second classification result are the same.
[0192] The device for training an atrial fibrillation detection model for ECG time-series signals, provided by an embodiment of the present invention, utilizes a dual-channel network approach consisting of a multi-branch residual neural network and a generative adversarial classification network for two-dimensional feature extraction. These networks jointly participate in pseudo-label generation during the adaptive phase, producing more reliable pseudo-labels and ensuring the accuracy and speed of model updates. Furthermore, a confidence assessment process for each pseudo-label is incorporated into the domain difference metric function. More reliable pseudo-labels contribute more significantly to the domain difference loss, further improving the stability of model updates.
[0193] The specific embodiments described in this application can help those skilled in the art to more fully understand this application, but do not limit this application in any way. Therefore, those skilled in the art should understand that this application can still be modified or replaced by equivalents; and all technical solutions and improvements that do not deviate from the spirit and technical essence of this application should be included in the scope of protection of the patent application.
[0194] The contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.
Claims
1. A method for training an atrial fibrillation detection model based on an electrocardiogram timing signal, characterized in that: include: Obtaining model training samples; the model training samples are 3D data constructed based on electrocardiogram signal data, relative front RR intervals, and relative back RR intervals, and the model training samples include a labeled first model training sample and an unlabeled second model training sample; The obtaining of model training samples includes: Acquiring the electrocardiogram signal data; Calculating the global RR interval corresponding to the electrocardiogram signal data; Based on the global RR interval, the relative front RR interval and the relative back RR interval are calculated; constructing 3D data based on the electrocardiogram signal data, the relative front RR interval, and the relative back RR interval, and using the constructed 3D data as a model training sample; The initial ECG time series signal atrial fibrillation detection model is trained based on the first model training sample to obtain a trained ECG time series signal atrial fibrillation detection model; the initial ECG time series signal atrial fibrillation detection model is a model formed by connecting a multi-branch residual network layer and a generative multi-antibody classification network layer in parallel; Inputting the second model training sample into the training ECG time series signal atrial fibrillation detection model to obtain a pseudo-label sample corresponding to the second model training sample; The training ECG time series signal atrial fibrillation detection model is trained twice based on the pseudo-label samples and the first model training samples to obtain the ECG time series signal atrial fibrillation detection model.
2. The method according to claim 1, characterized in that The first model training sample corresponds to a sample label value, wherein, The initial electrocardiogram time series signal atrial fibrillation detection model is trained based on the first model training sample to obtain a trained electrocardiogram time series signal atrial fibrillation detection model, including: Inputting the first model training sample into the initial ECG timing signal atrial fibrillation detection model; Calling the multi-branch residual network layer to process the first model training sample to obtain a first predicted label value corresponding to the first model training sample; Calling the generated multi-antibody classification network layer to process the first model training sample to obtain a second predicted label value corresponding to the first model training sample; Calculating a loss value corresponding to the initial ECG time series signal detection model based on the first predicted label value, the second predicted label value, and the sample label value; When the loss value is within a preset range, the trained initial ECG timing signal detection model is used as the training ECG timing signal detection model.
3. The method according to claim 2, characterized in that The calculating, based on the first predicted label value, the second predicted label value, and the sample label value, a loss value corresponding to the initial ECG time series signal detection model includes: Calculating a first loss value of the multi-branch residual network layer according to the first predicted label value and the sample label value; Calculating a second loss value of the generated multi-antibody classification network layer according to the second predicted label value and the sample label value; The loss value of the initial ECG timing signal detection model is determined according to the first loss value and the second loss value.
4. The method according to claim 1, wherein Inputting the second model training sample into the training ECG time series signal atrial fibrillation detection model to obtain a pseudo-label sample corresponding to the second model training sample includes: Inputting the second model training sample into the training ECG timing signal atrial fibrillation detection model; Calling the multi-branch residual network layer to process the second model training sample to generate a first classification result corresponding to the second model training sample; Calling the generated multi-antibody classification network layer to process the second model training sample to generate a second classification result corresponding to the second model training sample; When the first classification result and the second classification result are the same, the second model training sample is labeled to generate the pseudo-label sample.
5. A device for training atrial fibrillation detection model based on electrocardiogram timing signals, characterized in that: include: A model training sample acquisition module is used to acquire model training samples; the model training samples are 3D data constructed based on ECG signal data, relative front RR intervals, and relative back RR intervals, and the model training samples include a labeled first model training sample and an unlabeled second model training sample; a training detection model acquisition module, configured to train an initial ECG time series signal atrial fibrillation detection model based on the first model training sample to obtain a training ECG time series signal atrial fibrillation detection model; the initial ECG time series signal atrial fibrillation detection model is a model formed by connecting a multi-branch residual network layer and a generative multi-antibody classification network layer in parallel; a pseudo-label sample acquisition module, configured to input the second model training sample into the training ECG time series signal atrial fibrillation detection model to obtain a pseudo-label sample corresponding to the second model training sample; an ECG detection model acquisition module, configured to perform secondary training on the training ECG time series signal atrial fibrillation detection model based on the pseudo-label samples and the first model training samples to obtain the ECG time series signal atrial fibrillation detection model; The model training sample acquisition module includes: an electrocardiogram signal data acquisition unit, configured to acquire the electrocardiogram signal data; A global RR interval calculation unit, configured to calculate the global RR interval corresponding to the electrocardiogram signal data; a relative RR interval calculation unit, configured to calculate the relative front RR interval and the relative back RR interval based on the global RR interval; The model training sample acquisition unit is used to construct 3D data based on the electrocardiogram signal data, the relative front RR interval and the relative back RR interval, and use the constructed 3D data as a model training sample.
6. The device according to claim 5, characterized in that The first model training sample corresponds to a sample label value, wherein, The training detection model acquisition module includes: A first model sample input unit, configured to input the first model training sample into the initial ECG timing signal atrial fibrillation detection model; A first predicted label value acquisition unit, configured to call the multi-branch residual network layer to process the first model training sample to obtain a first predicted label value corresponding to the first model training sample; A second predicted label value acquisition unit is used to call the generated multi-antibody classification network layer to process the first model training sample to obtain a second predicted label value corresponding to the first model training sample; a loss value calculation unit, configured to calculate a loss value corresponding to the initial ECG time series signal detection model based on the first predicted label value, the second predicted label value, and the sample label value; The training detection model acquisition unit is used to use the trained initial electrocardiogram timing signal detection model as the training electrocardiogram timing signal detection model when the loss value is within a preset range.
7. The device according to claim 6, characterized in that The loss value calculation unit includes: A first loss value calculation subunit, configured to calculate a first loss value of the multi-branch residual network layer according to the first predicted label value and the sample label value; A second loss value calculation subunit is used to calculate the second loss value of the generated multi-antibody classification network layer according to the second predicted label value and the sample label value; The loss determination subunit is configured to determine a loss value of the initial ECG timing signal detection model according to the first loss value and the second loss value.
8. The device according to claim 5, characterized in that The pseudo-label sample acquisition module includes: a second model sample input unit, configured to input the second model training sample into the training ECG timing signal atrial fibrillation detection model; A first classification result generating unit, configured to call the multi-branch residual network layer to process the second model training sample to generate a first classification result corresponding to the second model training sample; A second classification result generating unit is configured to call the generated multi-antibody classification network layer to process the second model training sample to generate a second classification result corresponding to the second model training sample; The pseudo-label sample generating unit is used to label the second model training sample and generate the pseudo-label sample when the first classification result and the second classification result are the same.
Citation Information
Patent Citations
Electrocardiosignal atrial fibrillation detection method based on one-dimensional dense connection convolutional network
CN110680310A
Deep learning-based automatic detecting system for atrial fibrillation of electrocardiograph signal
CN111772628A