Domain generalization-oriented multi-source ECG diagnosis method based on conditional adversarial
By introducing adversarial training with a denoising network and a multi-layer feature extractor, the domain shift problem of the ECG diagnostic model when crossing domains is solved, and the diagnostic performance and robustness of the model on data from different domains are improved.
Patent Information
- Application Number
- CN202511016785.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-11-04
AI Technical Summary
Existing ECG diagnostic models experience performance degradation when crossing domains and cannot effectively handle complex domain offset issues, especially when there are significant data differences between different populations and devices, making it difficult to effectively learn inter-domain common features and category relationships.
A conditional adversarial multi-source ECG diagnostic method is adopted. This method removes noise interference by introducing a denoising network, alleviates the distribution shift problem by using a multi-layer feature extractor, and learns detailed general feature representations between domains through adversarial training between the feature extractor and the domain classifier. Combined with the conditional constraints of the label classifier, the cross-domain generalization ability of the model is improved.
It improves the diagnostic performance of the model on data from different domains, achieves a higher degree of feature-class alignment, enhances the robustness and adaptability of the model, and significantly improves cross-domain performance.
Smart Images

Figure CN120895211A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of machine learning and pattern recognition, and aims to solve the problem of poor generalization of classification models when crossing domains. A multi-source ECG diagnosis method based on conditional adversarial domain generalization is proposed to improve the generalization of models for ECG data from different populations and machines. BACKGROUND
[0002] According to the report of the World Health Organization, cardiovascular disease is the leading cause of death worldwide, and it is estimated that about 1790 million people lose their lives every year. Arrhythmia is the most common and important cardiovascular disease, which refers to a group of conditions in which the heart beats too slowly, too fast or irregularly. Cardiovascular disease is often accompanied by arrhythmia in the early stage, and if arrhythmia can be diagnosed comprehensively in a timely and accurate manner in the early stage, targeted treatment and management measures can be taken in the early stage, thereby significantly improving the treatment effect and survival rate of patients.
[0003] Electrocardiogram (ECG) is a graphical representation method of recording the electrical activity of the heart. Normal ECG signals are composed of different types of wave segments, including P wave, QRS complex, T wave, PR segment, etc. The onset of heart disease affects the conduction system of the human heart, and specific heart conditions can be identified according to the characteristics and morphology of the waves through electrocardiogram, and health monitoring can be performed. However, accurate identification of these complex arrhythmia-related electrocardiogram rhythms requires considerable clinical experience and professional knowledge. The introduction of computer-aided diagnosis aims to assist doctors in making accurate ECG diagnosis and improve efficiency. At present, many computer-aided studies have been used for electrocardiogram diagnosis, which involves the process of model training and evaluation. Usually, when training and evaluating the model, the training data and evaluation data are assumed to be of the same distribution. However, in practical applications, the training data and evaluation data often come from different distributions, such as different populations and acquisition devices, which can lead to a decline in model performance when crossing domains.
[0004] At present, for the field generalization of ECG, some studies adopt methods such as integrated classifier or domain adversarial network, which can improve the generalization ability of the model on different domains to a certain extent, but still has some limitations. For example, when the data difference between domains is too large or the joint distribution of features and categories is different between domains, the current method ignores the reduction of the data difference between domains and the alignment of the more fine-grained category-level feature distribution between domains, and cannot effectively handle the complex domain shift problem. In addition, most methods usually only rely on the last layer of the neural network, in this case, the model cannot make inferences based on entangled representations, that is, it contains domain-invariant information and domain-specific information, and the model tends to make predictions based on false correlations in the data. Therefore, it has important practical significance to study more effective ECG diagnosis methods and improve the diagnosis performance of the model on different domain data. SUMMARY
[0005] In view of the problem that the training data and the evaluation data often come from different distributions, which can cause the performance of the model to decrease when crossing the domain, on the basis of the domain generalization idea, a multi-source ECG diagnosis method based on conditional adversarial is proposed, which aims to handle more complex domain shift situations and make the model learn the domain-universal feature and category relationship.
[0006] In the multi-source ECG diagnosis method based on conditional adversarial disclosed in the application, a denoising network is introduced to remove the common noise interference in ECG sampling, and the distribution transfer problem of different domain data is alleviated by using the multi-layer information transmitted in the feature extractor. The label classifier prediction is used as a conditional constraint, and the more detailed universal feature representation between domains is learned through the adversarial training between the feature extractor and the domain classifier.
[0007] The overall process and specific method steps of the application are as follows:
[0008] Step 1: Preprocess the 12-lead ECG signal;
[0009] (1) Reduce the sampling frequency of ECG data to 250HZ;
[0010] (2) Since the length of each ECG data is different, each ECG record is randomly divided into a specified length, which is 4096 sampling points,
[0011] (approximately 16s), and the insufficient is filled with 0, and the excess is cut;
[0012] (3) Standardize the ECG record using Z_Score, the process is as follows:
[0013]
[0014] where x represents the data value, μ is the mean of all data, and σ is the standard deviation of all data;
[0015] (4) For an original ECG signal, three common noises are added: baseline drift noise, power frequency interference noise, and electromyographic interference noise. The three kinds of noise ECGs are input to the denoising network for signal reconstruction to reduce the differences between signals in different domains caused by noise. For baseline drift noise, a low-frequency low-amplitude (0.2Hz, 0.2Mv) sine wave is used to construct it; for power frequency interference noise, a sine wave with a frequency of 50Hz and an amplitude of 0.3Mv is used to construct it; for electromyographic interference noise, a sine wave with a frequency of 30-300Hz and an amplitude of 0.4Mv is used to construct it.
[0016] Step two: Construct a CADG model oriented to multiple source domains;
[0017] The ECG data used for training comes from five different ECG data sets (domains), and the ECG data set used for testing is different from the training data source. The model is composed of three parts: a denoising network, a feature extractor and final feature, a label classifier and a domain classifier.
[0018] In the denoising network part, first, three common noises (baseline drift, power frequency noise and electromyographic noise) are added to the original ECG, and then a light codec is used to remove the noise of the ECG to reduce the differences between ECGs in different domains. In the feature extractor part, in order to avoid the model relying only on the domain-specific information of the last layer to make wrong judgments, information extraction is performed on multiple layers of the entire feature extractor and integrated into the final feature. BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 is the overall architecture diagram of the present application;
[0020] Figure 2 is the denoising network structure diagram designed by the present application;
[0021] Figure 3 is the integration module structure diagram designed by the present application, DETAILED DESCRIPTION
[0022] In order to make the purpose, technical scheme and advantages of the present application clearer, the following will give a detailed description of each specific detail involved in the technical invention scheme:
[0023] The application proposes a multi-source ECG diagnosis method based on conditional adversarial domain generalization, and the electrocardiogram signal data used is derived from the 2021 Computational Challenge in Cardiology (2021CinC). The CinC2021 dataset contains multiple datasets from different countries, hospitals and populations. Here, a dataset from different sources is regarded as a domain, and the idea of multi-source domain generalization is adopted. The specific dataset setting is as follows: five different source datasets, CPSC (6877 ECGs, sampling frequency 500Hz), CPSC-Extra (3463 ECGs, sampling frequency 500Hz), G12EC (10344 ECGs, sampling frequency 500Hz), Chapman-ShaoXing (10247 ECGs, sampling frequency 500Hz), INCART (74 ECGs, sampling frequency 257Hz), and Ningbo (34905 ECGs, sampling frequency 500Hz), are regarded as five source domains for model training, and PTB (516 ECGs, sampling frequency 1000Hz) and PTB-XL (21837 ECGs, sampling frequency 500Hz or 100Hz) are regarded as the target domain for model testing. Since the PTB series dataset does not contain Brady, PRWP and PVC types in Table 2-2, this task contains the diagnosis of 23 common heart conditions.
[0024] The overall flow and specific method steps of the application are as follows:
[0025] Step one: pre-processing of 12-lead electrocardiogram signals;
[0026] (1) reduce the sampling frequency of ECG data to 250HZ;
[0027] (2) since the length of each ECG data is different, each ECG record is randomly divided into a specified length of 4096 sampling points (about 16s), and the insufficient is filled with 0 and the excess is cut;
[0028] (3) use Z_Score to standardize the ECG record, and the process is as follows:
[0029]
[0030] Where x represents the data value, μ is the mean of all data, and σ is the standard deviation of all data;
[0031] (4) For an original ECG signal, three common noises are added: baseline drift noise, power frequency interference noise, and electromyographic interference noise. The three noise ECGs are input to the denoising network for signal reconstruction to reduce the differences between signals in different domains due to noise. For baseline drift noise, a low-frequency low-amplitude (0.2 Hz, 0.2 Mv) sine wave is used to construct it; for power frequency interference noise, a sine wave with a frequency of 50 Hz and an amplitude of 0.3 Mv is used to construct it; for electromyographic interference noise, a sine wave with a frequency of 30-300 Hz and an amplitude of 0.4 Mv is used to construct it.
[0032] Step two: Construct a CADG model oriented to multi-source domains
[0033] The ECG data used for training comes from five different ECG data sets (domains), and the ECG data set used for testing is different from the training data. The model is composed of three parts: a denoising network, a feature extractor and final feature, a label classifier and a domain classifier.
[0034] In the denoising network part, first, the original ECG is added with three common noises (baseline drift, power frequency noise and electromyographic noise), and then a light codec is used to remove the noise of the ECG, reducing the differences between ECGs in different domains. In the feature extractor part, in order to avoid the model relying only on the domain-specific information of the last layer to make wrong judgments, information is extracted from multiple layers of the entire feature extractor and integrated into the final feature.
[0035] In the label classifier and domain classifier part, the main task of the label classifier is to distinguish the disease category, and the task of the domain classifier is to distinguish which domain the data comes from, but the gradient of the domain classifier adds a gradient reversal layer in the feature extractor when backpropagation, which is a negative gradient transmission, that is, the feature extractor will not benefit the domain classifier when adjusting the parameters, but will try to make it difficult for the domain classifier to judge the source of the data. Each sample can be represented by a triple (x, y lc , y dc ), where x represents the ECG data, y lc represents the true label of the ECG data, and ydc represents the domain label of the ECG data. Then for such a sample, the target error terms of the label classifier and the domain classifier are as follows.
[0036]
[0037] where E represents the expected value, LC represents the label classifier, DC represents the domain classifier, f x = F(x), F represents the feature extractor, f xThe feature extractor extracts the features for sample x, LC(f) x ) i This represents the probability value that the label classifier predicts belongs to class i. Does sample x come from domain D? i P lc This represents the predicted probability of the label classifier for sample x. The joint distribution of representative features and categories, The domain classifier predicts the probability that sample x belongs to domain Di.
[0038] The optimization objective of the feature extractor is shown in the following formula.
[0039]
[0040] It represents minimizing the loss of the label classifier and maximizing the loss of the domain classifier, thereby learning inter-domain class-invariant information while ensuring classification accuracy.
[0041] Furthermore, by using the prediction results of the label classifier as conditions, a joint distribution of features and categories is constructed. For two random vectors x and y, their joint distribution P(x, y) can be expressed using cross-covariance. To model, among which Let be the expectation and be the operator. Then, for features f and categories y, their joint distribution can be represented in the following two forms.
[0042] (1) Concatenation, see the following formula. The expected mapping is the mean calculated independently, without considering the correlation between them.
[0043]
[0044] (2) Multilinear mapping, as shown in the following formula, the expected mapping calculates the mean of each class conditional distribution P(f|y=i), and simulates the multiplicative interaction between the captured feature representation and the class.
[0045]
[0046] For the representation of the joint distribution, multilinear mapping showed better performance in the experiment. Regarding the category representation, whether to use the true label or the model prediction, the model prediction showed better performance in the experiment. Therefore, multilinear mapping was used to model the joint distribution of features and category prediction.
[0047] Then, adversarial training is performed between the domain classifier and the feature extractor to make the relationship between features and categories more consistent in different domains and to match the feature distribution between different domains more precisely.
[0048] Compared with other mainstream methods, the beneficial effects of the present application are: (i) the alignment degree of different domain features and categories is higher; (ii) the complex domain offset situation is considered, and the cross-domain performance of the model is improved by using the denoising network, multi-layer feature extraction and class conditional adversarial training.
[0049] In order to verify the effectiveness of the present application, the comparison of the proposed method CADG with the mainstream ECG domain generalization (DG) method, the classical computer vision (CV) domain generalization method is shown in Table 1. Some methods only add a domain classifier and some specific training methods to deal with the domain offset problem, which only achieves about 1% weak improvement in F1 compared with the benchmark model ERM, and its main advantage is simple implementation and easy integration into existing deep learning framework, but its limitation is that it only improves the training strategy without deep optimization of the complex differences between domains, so the improvement effect is limited when dealing with complex domain offset problems. Some other methods also do not change the model structure, but add new optimization items in the loss function during training, such as the maximum difference distance between different sample data features, covariance, etc., which has the advantage of enhancing the robustness of the model to the difference between domains by optimizing the loss function, and the F1 is improved by 3%-4% compared with ERM, but its limitation is still dependent on the original model structure. The BioDG method changes the original model structure and adopts the idea of multi-level feature extraction, which extracts features at different levels to alleviate the distribution transfer problem, and its advantage is to enhance the adaptability and robustness of the model through multi-level feature extraction, but its limitation is that it does not fully consider the extraction of class-level features between domains. The proposed CADG method considers the complex domain offset situation, uses denoising network, multi-layer feature extraction and class conditional adversarial training to improve the cross-domain performance of the model. The F1, Pre, Rec, AUC indicators of CADG are the best among these domain generalization methods, compared with the best ECG domain generalization method BioDG, the F1 value is improved by 2.3%, compared with the best computer vision domain generalization method GroupDRO, the F1 value is improved by 1.8%, compared with the traditional empirical risk minimization method (ERM), the F1 value is improved by 5.5%, which indicates the effectiveness of the proposed method.
[0050] Table 1 Comparison of results of different methods
[0051]
[0052] The complexity indicators of different domain generalization methods are shown in Table 2. For example, in the DANN and Fusion_Classifier methods, the model structure is not changed, only the domain classifier and some specific training methods are added. The parameter quantity, computational complexity, and training and testing time of these methods have little change compared to the baseline ERM. In terms of classification performance, the F1 score is slightly improved by less than 1%. For example, MMD, CORAL, VREx, and GroupDRO methods also do not change the model structure, but add new optimization terms such as maximum difference distance and covariance between different sample data features in the loss function. The parameter quantity, computational complexity, and testing time of these methods have little change compared to the baseline ERM, while the training time has increased. In terms of classification performance, the F1 score has also improved significantly (3%-4%). For example, the CADG method and the BioDG method change the model structure. The parameter quantity, computational complexity, training and testing time of the model have increased compared to the baseline ERM. The F1 score of CADG is 2.3% higher than that of BioDG, which shows the effectiveness of the CADG method, but the parameter quantity, computational complexity, training and testing time of the model are general.
[0053] Table 2 Complexity comparison of different domain generalization methods
[0054]
[0055] [1] BALLAS A, DIOU C. Towards Domain Generalization for ECG and EEG Classification: Algorithms and Benchmarks [J]. IEEE Transactions on Emerging Topics in Computational Intelligence, 2024, 8(1): 44-54. DOI: 10.1109 / TETCI.2023.3306253.
[0056] [2] REYNAMA, SADR N, ALDAY E A P, et al. Will Two Do Varying Dimensions in Electrocardiography: The PhysioNet / Computing in Cardiology Challenge 2021 [C] / / 2021 Computing in Cardiology (CinC): Vol. 48. 2021: 1-4. DOI: 10.23919 / CinC53138.2021.9662687.
[0057] [3] SAGAWA S, KOH P W, HASHIMOTO T B, et al. Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization [A]. arXiv, 2020. DOI: 10.48550 / arXiv.1911.08731.
[0058] [4] KRUEGER D, CABALLERO E, JACOBSEN J H, et al. Out-of-Distribution Generalization via Risk Extrapolation (REx) [C] / / Proceedings of the 38th International Conference on Machine Learning. PMLR, 2021: 5815-5826.
[0059] [5] SUN B, SAENKO K. Deep CORAL: Correlation Alignment for Deep Domain Adaptation [C] / / HUA G, H. Computer Vision-ECCV 2016 Workshops. Cham: Springer International Publishing, 2016: 443-450. DOI: 10.1007 / 978-3-319-49409-8_35.
[0060] [6] LI H, PAN S J, WANG S, et al. Domain Generalization With Adversarial Feature Learning [C] / / Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2018: 5400-5409.
[0061] [7] YU W, ZHOU P, YAN S, et al. InceptionNeXt: When Inception Meets ConvNeXt [C] / / Proceedings of the IEEE / CVF Conference on Computer Vision and Pattern Recognition. 2024: 5672-5683.
[0062] [8] STRODTHOFF N, WAGNER P, SCHAEFFTER T, et al. Deep Learning for ECG Analysis: Benchmarks and Insights from PTB-XL [J]. IEEE Journal of Biomedical and Health Informatics, 2021, 25(5): 1519-1528. DOI: 10.1109 / JBHI.2020.3022989.
[0063] [9] GANIN Y, USTINOVA E, AJAKAN H, et al. Domain-Adversarial Training of Neural Networks [J]. Journal of Machine Learning Research, 2016, 17(59): 1-35.
[0064]
[10] HASANI H, BITARAFAN A, SOLEYMANI M. Classification of 12-lead ECG Signals With Adversarial Multi-Source Domain Generalization [C] / / 2020 Computing in Cardiology Conference. 2020. DOI: 10.22489 / CinC.2020.445.
[0065]
[11] DISSANAYAKE T, FERNANDO T, DENMAN S, et al. Domain Generalization in Biosignal Classification [J]. IEEE Transactions on Biomedical Engineering, 2021, 68(6): 1978-1989. DOI: 10.1109 / TBME.2020.3045720.
Claims
1. A multi-source ECG diagnostic method based on conditional adversarial approaches and domain generalization, comprising the following steps: Step 1: Preprocess the 12-lead ECG signal; (1) Reduce the sampling frequency of ECG data to 250Hz; (2)(2) Since the length of each ECG data is different, each ECG record is randomly divided into a specified length, which is set at 4096 sampling points (approximately 16s). If the length is insufficient, it is filled with 0; if it is excessive, it is truncated. (3) Standardize the ECG records using Z_Score, as shown in the following formula: Where x represents the data value, μ is the mean of all data, and σ is the standard deviation of all data; (4) For a raw ECG signal, three common types of noise are added: baseline drift noise, power line interference noise, and electromyography (EMG) interference noise. These three types of noise ECG signals are then input into a denoising network for signal reconstruction to reduce the differences in signals between different domains due to noise. For baseline drift noise, a low-frequency, low-amplitude (0.2Hz, 0.2Mv) sine wave is used for construction; for power line interference noise, a sine wave with a frequency of 50Hz and an amplitude of 0.3Mv is used for construction; and for EMG interference noise, a sine wave with a frequency of 30-300Hz and an amplitude of 0.4Mv is used for construction. Step 2: Construct a CATG model oriented towards multiple source domains; The ECG data used for training came from five different ECG datasets (domains), while the ECG dataset used for testing came from a different source. The model consists of three parts: a denoising network, a feature extractor and final features, a label classifier, and a domain classifier. In the denoising network, three common types of noise (baseline drift, power line noise, and electromyography noise) are first added to the original ECG. Then, a lightweight encoder-decoder is used to remove the noise from the ECG, reducing the differences between ECGs in different domains. In the feature extractor, to avoid the model making incorrect judgments by relying solely on domain-specific information from the last layer, information is extracted from all multiple layers of the feature extractor and integrated into the final features.