Abnormal electrocardio position positioning and disease prediction classification method based on deep learning
By combining the CNN-LSTM-Attention model and PCA feature dimensionality reduction method, the problem of difficult to capture global features and transconductance information in ECG analysis is solved, and efficient ECG abnormality positioning and disease prediction classification are achieved, improving the quality and classification accuracy of ECG signals.
Patent Information
- Application Number
- CN202510512929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-01
AI Technical Summary
The existing electrocardiogram analysis methods rely on manual feature extraction, making it difficult to fully capture the global characteristics and transconductance information of ECG signals, and their performance is unstable in different data scenarios, especially in multi-lead high-dimensional data.
The CNN-LSTM-Attention model is used to combine wavelet denoising, high-pass filtering and normalized preprocessing to perform abnormal heart rhythm positioning and classification for single-lead data; for multi-lead data, PCA feature dimensionality reduction and improved multi-layer perceptron model are used, and data imbalance problem is solved through SMOTE sampling, and the early stop mechanism is combined to prevent overfitting.
It significantly improves the quality and feature recognizability of ECG signals, improves the accuracy and generalization ability of abnormal heart rhythm recognition and heart disease classification, and realizes an efficient ECG intelligent diagnostic system, which has good user interaction and scalability.
Smart Images

Figure CN120408374A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of artificial intelligence and medical health, and particularly relates to a method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning. Background Art
[0002] Cardiovascular diseases are one of the disease types with the highest mortality rates globally. Early detection and intervention are of great significance for reducing the disability and mortality rates. As a non-invasive, low-cost, and real-time diagnostic tool, electrocardiogram is widely used in the diagnosis of clinical arrhythmias, myocardial infarctions, conduction blocks, and other diseases. With the development of wearable devices and telemedicine, the acquisition of ECG signals has become more convenient, and the demand for intelligent analysis of electrocardiograms has also increased.
[0003] Traditional ECG analysis methods rely on the experience of medical experts and achieve abnormal detection by manually setting rules and feature extraction algorithms (such as RR interval, QRS wave width). However, ECG signals have the following characteristics: weak waveforms, vulnerable to noise interference (such as electromyogram, power frequency interference, baseline drift), large individual differences, and complex waveform morphologies. These factors seriously affect the accuracy and robustness of the rule-based methods. Manual feature extraction methods also have limitations such as strong feature dependence and poor generalization ability, making it difficult to meet the needs of large-scale automated analysis.
[0004] Currently, most electrocardiogram abnormal classification methods usually rely on feature extraction algorithms for modeling. For example, abnormal detection is achieved through the RR interval and QRS wave width. This method is difficult to comprehensively capture the global features and cross-lead information in ECG signals. Different from some existing research methods, the combination of deep learning models and electrocardiogram signals provides a new direction for improving the accuracy of electrocardiogram abnormality localization and classification. Among them, convolutional neural network (CNN) has advantages in local feature extraction, long short-term memory network (LSTM) is suitable for modeling time-dependent structures, multi-layer perceptron (MLP) is suitable for structures with stable features, and the attention mechanism can enhance the model's ability to focus on key electrocardiogram bands. However, most existing methods use these models separately and lack a fusion modeling strategy, making it difficult to maintain stable performance in different data scenarios.
[0005] How to solve the above technical problems has become the subject of the present invention. Summary of the Invention
[0006] The purpose of the present invention is to provide a method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning, which can more effectively perform abnormal localization and disease type classification.
[0007] The idea of the present invention is as follows: The present invention proposes a method for abnormal electrocardiogram location and disease prediction classification based on deep learning. Aiming at the characteristics of electrocardiogram data such as high dimension, large noise, and sample imbalance, this method combines various preprocessing means such as wavelet denoising, high-pass filtering, and normalization to improve the data quality; and respectively uses the CNN-LSTM-Attention model and the principal component analysis PCA combined with the multi-layer perceptron MLPS model to model the MIT-BIH and PTB-XL datasets, improving the accuracy and generalization ability of abnormal heart rhythm recognition and heart disease classification. By introducing SMOTE sampling to alleviate the problem of insufficient tail class samples and combining the early stopping mechanism to prevent overfitting, an efficient ECG intelligent diagnosis system based on deep learning is finally realized.
[0008] The present invention is achieved by the following measures: A method for abnormal electrocardiogram location and disease prediction classification based on deep learning, which includes the following steps:
[0009] 1.1: Preprocess the dataset, perform wavelet transform denoising, high-pass filtering, and normalization operations on the two electrocardiogram datasets of MIT-BIH and PTB-XL respectively to improve the signal quality and feature stability;
[0010] 1.2: Use the stratified sampling method to divide the dataset into a training set and a test set according to a ratio of 8:2;
[0011] 1.3: For the MIT-BIH data, which is the second lead data, extract the heartbeat segment containing the center of the R wave, construct a CNN-LSTM-Attention deep learning model, and combine convolution, time series dependence modeling, and attention mechanism for abnormal heart rhythm location and classification;
[0012] 1.4: For the PTB-XL data, which is the twelfth lead data, use SMOTE sampling to solve data imbalance, then use principal component analysis (PCA) for feature dimensionality reduction, and construct a multi-layer perceptron (MLPS) model for disease category prediction to enhance the modeling ability for high-dimensional multi-lead signals;
[0013] 1.5: Adopt the early stopping strategy to avoid model overfitting, stop training when the test set accuracy has not improved for multiple consecutive rounds, and retain the optimal model parameters;
[0014] 1.6: Input the test set data into the trained deep learning model, and output the abnormal heart rhythm location and disease prediction results.
[0015] Furthermore, in step 1.1, it specifically includes the following steps:
[0016] 2.1: Perform three-layer wavelet decomposition on the electrocardiogram signal using the Daubechies wavelet basis to remove high-frequency electromyogram interference and baseline drift. Its adaptive threshold is where σ is the noise standard deviation and N is the signal length;
[0017] 2.2: Use a Butterworth high-pass filter (cutoff frequency 0.5 Hz) to eliminate low-frequency noise, and map the signal to the [-1, 1] interval using min-max normalization, which is defined as x is the original signal point, x min is the minimum amplitude point, and x max is the maximum amplitude point;
[0018] Furthermore, in step 1.3, it specifically includes the following steps:
[0019] 3.1: The data is from the second lead in the electrocardiogram;
[0020] 3.2: Construct a convolutional layer to extract local heartbeat waveform features. The convolutional kernel size is 5×1, and it is combined with ReLU activation;
[0021] 3.3: Use a bidirectional LSTM network to model the time dependence in the electrocardiogram sequence, with 64 hidden units;
[0022] 3.4: Introduce a multi-head attention mechanism to assign weights to key electrocardiogram segments, improving the model's ability to identify abnormal signals;
[0023] 3.5: The output end adopts a multi-task learning structure of a classification branch and a localization branch to simultaneously perform heart rhythm category discrimination and abnormal position probability estimation. The probability estimation is defined as where R is the abnormal point, σ is the standard deviation, and x is the position of the data point.
[0024] Furthermore, in step 1.4, it specifically includes the following steps:
[0025] 4.1: Perform SMOTE sampling on the PTB-XL data and reorganize it into a two-dimensional time series feature matrix based on lead information;
[0026] 4.2: Apply PCA to reduce the high-dimensional signal to 100-dimensional principal components, retaining the main diagnostic information while improving the training efficiency.
[0027] 4.3: Input the PTB-XL features after dimensionality reduction into an MLPS network with a three-layer fully connected structure, using ReLU activation and Dropout regularization;
[0028] 4.4: Add a residual connection mechanism to improve the training stability and generalization ability of the deep network;
[0029] 4.5: Use the cross - entropy loss function for multi - class classification training and output electrocardiogram disease labels (NORM, MI, STTC, HYP, CD).
[0030] Furthermore, in step 1.5, it specifically includes the following steps:
[0031] 5.1: During the model training process, calculate the accuracy of the test set in each round and record the optimal model.
[0032] 5.2: When the validation performance has not improved for 5 consecutive rounds, trigger the early stopping mechanism, terminate the training, and return the optimal model.
[0033] Furthermore, in step 1.6, it specifically includes the following steps:
[0034] 6.1: Transmit the twelve - lead signals to the backend data processing.
[0035] 6.2: Input the second - lead data into the CNN - LSTM - Attention model and output the prediction of the abnormal location and the type of arrhythmia.
[0036] 6.3: Input the twelve - lead data into the MLPS model and output the predicted disease type.
[0037] 6.4: The backend synthesizes the prediction data and returns the result to the data receiving place.
[0038] 6.5: Visualize and display the prediction results through the front - end interface of the system, including waveform diagrams and diagnostic labels.
[0039] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0040] 1. The present invention proposes a method for abnormal electrocardiogram location positioning and disease prediction classification based on deep learning. By introducing classical signal processing techniques such as wavelet transform denoising, high - pass filtering, and normalization, the quality and feature recognizability of electrocardiogram signals are significantly improved, providing higher - quality data input for subsequent model training, especially showing good adaptability and robustness when dealing with multi - lead and high - dimensional ECG data.
[0041] 2. The present invention adopts a dual-model combined design in the model structure, and constructs adapted deep learning models for different data types respectively. For single-lead ECG signals, a CNN-LSTM-Attention structure is adopted, which combines the local feature extraction of the convolutional network, the temporal modeling ability of LSTM, and the key band focusing ability of the attention mechanism to achieve the joint detection of the location and category of arrhythmias. For multi-lead high-dimensional ECG data such as PTB-XL, the present invention adopts PCA feature dimensionality reduction and combines it with an improved multi-layer perceptron (MLPS) model to improve the classification performance and training efficiency in the high-dimensional space.
[0042] 3. The present invention effectively solves the problem of class imbalance. In the electrocardiogram classification task, especially in the PTB-XL database, the types of abnormal heartbeats show an obvious long-tail distribution, and traditional methods often have poor recognition effects on minority classes. For this reason, this method introduces the SMOTE oversampling technique to enhance the model's learning ability for tail class data, thereby improving the overall classification balance and accuracy.
[0043] 4. The present invention has good system deployment capabilities and scalability. Compared with existing research that only optimizes model algorithms, this method further completes the front-end and back-end integration of the model, and constructs a back-end service based on Flask and a front-end visualization system based on React. Users can upload ECG files through the interface, and the system automatically completes the entire process of signal preprocessing, abnormal classification, abnormal location annotation, etc., and displays the results in the form of charts, with good user interactivity and engineering feasibility.
[0044] 5. Through empirical experiments on two authoritative public databases, MIT-BIH and PTB-XL, the present invention verifies the performance improvement of the method in classification tasks such as arrhythmia recognition, ST-T abnormality, and myocardial infarction. The classification accuracy of the CNN-LSTM-Attention model on the MIT-BIH dataset reaches 97.21%, and the accuracy of the improved MLPS model on the PTB-XL dataset reaches 89.53%, which is better than most current mainstream research results and has broad application potential in scenarios such as telemedicine and smart wearable devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention.
[0046] Figure 1 It is a framework diagram of the method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning provided by the present invention.
[0047] Figure 2 It is a front-end and back-end interaction flowchart provided by the present invention. Detailed implementation manners
[0048] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Of course, the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0049] Embodiment 1
[0050] See Figure 1 As shown, this embodiment provides an abnormal electrocardiogram position localization and disease prediction classification method based on deep learning, which specifically includes the following contents:
[0051] (1-1) Preprocess the data set, perform wavelet transform denoising, high-pass filtering and normalization operations on the two electrocardiogram data sets of MIT-BIH and PTB-XL respectively to improve signal quality and feature stability;
[0052] (1-2) Adopt a stratified sampling method to divide the data set into a training set and a test set according to a ratio of 8:2;
[0053] (1-3) For the MIT-BIH data, which is the second lead data, extract the heartbeat segment containing the center of the R wave, construct a CNN-LSTM-Attention deep learning model, and perform abnormal heart rhythm localization and classification by combining convolution, temporal dependence modeling and attention mechanism;
[0054] (1-4) For the PTB-XL data, which is the twelfth lead data, use SMOTE sampling to solve data imbalance, then use principal component analysis (PCA) for feature dimensionality reduction, and construct a multi-layer perceptron (MLPS) model for disease category prediction to enhance the modeling ability for high-dimensional multi-lead signals;
[0055] (1-5) Adopt an early stopping strategy to avoid model overfitting. Stop training when the test set accuracy has not improved for multiple consecutive rounds, and retain the optimal model parameters;
[0056] (1-6) Input the test set data into the trained deep learning model, and output the abnormal heart rhythm position and disease prediction results.
[0057] Furthermore, in the step (1-1), the following steps are specifically included:
[0058] (2-1) Perform three-layer wavelet decomposition on the electrocardiogram signal using the Daubechies wavelet basis to remove high-frequency myoelectric interference and baseline drift, and its adaptive threshold is where σ is the noise standard deviation and N is the signal length;
[0059] (2-2) The Butterworth high-pass filter (cutoff frequency 0.5 Hz) is used to eliminate low-frequency noise, and the signal is mapped to the [-1, 1] interval using min-max normalization, which is defined as x is the original signal point, x min is the lowest amplitude point, x max is the maximum amplitude point;
[0060] Furthermore, in the step (1-3), the following steps are specifically included:
[0061] (3-1) The data is the data of the second lead in the electrocardiogram;
[0062] (3-2) A convolutional layer is constructed to extract local heartbeat waveform features, and the convolutional kernel size is 5×1, combined with ReLU activation;
[0063] (3-3) A bidirectional LSTM network is used to model the time dependence in the electrocardiogram sequence, and the hidden unit is 64;
[0064] (3-4) A multi-head attention mechanism is introduced to assign weights to key electrocardiogram segments, improving the model's ability to identify abnormal signals;
[0065] (3-5) The output end adopts a multi-task learning structure of a classification branch and a localization branch, simultaneously performing heart rhythm category discrimination and abnormal position probability estimation, and the probability estimation is defined as where R is the abnormal point, σ is the standard deviation, and x is the data point position.
[0066] Furthermore, in the step (1-4), the following steps are specifically included:
[0067] (4-1) The PTB-XL data is processed by SMOTE sampling and recombined into a two-dimensional time series feature matrix based on lead information;
[0068] (4-2) PCA is applied to reduce the high-dimensional signal to 100-dimensional principal components, retaining the main diagnostic information while improving the training efficiency.
[0069] (4-3) The PTB-XL features after dimensionality reduction are input into the MLPS network containing a three-layer fully connected structure, using ReLU activation and Dropout regularization;
[0070] (4-4) A residual connection mechanism is added to improve the training stability and generalization ability of the deep network;
[0071] (4-5) The cross-entropy loss function is used for multi-class classification training, and the electrocardiogram disease labels (NORM, MI, STTC, HYP, CD) are output.
[0072] Furthermore, in the step (1-5), the following steps are specifically included:
[0073] (5-1) During the model training process, calculate the accuracy of the test set in each round and record the optimal model;
[0074] (5-2) When the validation performance does not improve for 5 consecutive rounds, trigger the early stopping mechanism, terminate the training, and return the optimal model.
[0075] See Figure 2 As shown, this embodiment provides a front-end and back-end interaction flowchart, which specifically includes the following content:
[0076] (6-1) The front end uploads the twelve-lead signal to the back-end data processing;
[0077] (6-2) Extract the second-lead data and input it into the CNN-LSTM-Attention model to output the prediction of the abnormal location and the type of cardiac arrhythmia;
[0078] (6-3) Input the twelve-lead data into the MLPS model to output the predicted disease type;
[0079] (6-4) The back end synthesizes the prediction data and returns the result to the data receiving place;
[0080] (6-5) Visualize and display the prediction results through the front-end interface of the system, including waveform diagrams and diagnostic labels.
[0081] (7) Compare the method of this embodiment with the existing model classification method on the same MIT-BIH dataset. The following four performance indicators (i.e., Accuracy, Precision, Recall, and F1-score) are used to automatically evaluate the quality of the model:
[0082] Table 1 Comparison table of the results of the method of this embodiment and the control method
[0083]
[0084] Through experimental verification, the software vulnerability type classification method based on adaptive data augmentation and prompt fine-tuning proposed in this embodiment is mostly superior to the corresponding baseline results in the four performance indicators of Accuracy, Precision, Recall, and F1-score compared with the existing baseline methods, demonstrating the outstanding performance of the method of this embodiment in anomaly classification. Specifically, the experimental results are as follows: the accuracy index of the method of this embodiment is increased by 1.61% to 5.81%, the precision index is increased by up to 34.76%, the recall index is increased by 4.06% to 22.01%, and the F1 score is increased by 15.22% to 30.74%. These results show the competitiveness of the method proposed in this embodiment.
[0085] (8) The method of this embodiment and the existing model classification method are compared on the same PTB-XL dataset. The following four performance metrics (i.e., Accuracy, Precision, Recall, and F1-score) are used to automatically evaluate the quality of the model:
[0086] Table 2 Comparison table of the results of the method of this embodiment and the control method Table 2
[0087]
[0088]
[0089] Verified by experiments, the software vulnerability type classification method based on adaptive data augmentation and prompt fine-tuning proposed in this embodiment is mostly superior to the corresponding benchmark results in the four performance metrics of Accuracy, Precision, Recall, and F1-score compared with the existing benchmark methods, demonstrating the outstanding performance of the method of this embodiment in anomaly classification. Specifically, the experimental results are as follows: The accuracy metric of the method of this embodiment has increased by up to 8.2%, the precision metric has increased by up to 5.35%, the recall metric has increased by 7.92% to 9.82%, and the F1 score has increased by 7.71% to 11.01%. These results demonstrate the competitiveness of the method proposed in this embodiment.
[0090] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for abnormal electrocardiogram location and disease prediction classification based on deep learning, characterized by including the following steps: 1.1: Preprocess the dataset, and perform wavelet transform denoising, high-pass filtering, and normalization operations on the two electrocardiogram datasets of MIT-BIH and PTB-XL respectively; 1.2: Adopt a stratified sampling method to divide the dataset into a training set and a test set according to a ratio of 8:2; 1.3: For MIT-BIH data, which is the second lead data, extract the cardiac cycle segment containing the center of the R wave, construct a CNN-LSTM-Attention deep learning model, and combine convolution, temporal dependence modeling, and attention mechanism for abnormal heart rhythm location and classification; 1.4: For PTB-XL data, which is the twelfth lead data, use SMOTE sampling to solve data imbalance, then use principal component analysis PCA for feature dimensionality reduction, and construct a multi-layer perceptron MLPS model for disease category prediction; 1.5: Adopt an early stopping strategy to avoid model overfitting. Stop training when the accuracy of the test set has not improved for multiple consecutive rounds, and retain the optimal model parameters. 1.6: Input the test set data into the trained deep learning model to output the abnormal heart rhythm position and disease prediction results.
2. The method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning according to claim 1, wherein The steps in step 1.1 include the following steps: 2.1: Perform three-layer wavelet decomposition on the electrocardiogram signal using the Daubechies wavelet basis to remove high-frequency electromyogram interference and baseline drift. Its adaptive threshold is where σ is the noise standard deviation and N is the signal length; 2.2: A Butterworth high-pass filter is used to eliminate low-frequency noise, and min-max normalization is used to map the signal to the interval [-1, 1], which is defined as where x is the original signal point, x min is the lowest amplitude point, and x max is the maximum amplitude point.
3. The method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning according to claim 1, wherein The steps in step 1.3 include the following steps: 3.1: The data is the data of the second lead in the electrocardiogram. 3.2: Construct a convolutional layer to extract local heartbeat waveform features. The size of the convolutional kernel is 5×1, and ReLU activation is used. 3.3: Use a bidirectional LSTM network to model the time dependence in the electrocardiogram sequence, with 64 hidden units. 3.4: Introduce a multi-head attention mechanism to assign weights to key electrocardiogram segments. 3.5: The output end adopts a multi-task learning structure of a classification branch and a localization branch, and performs heart rhythm category discrimination and abnormal position probability estimation. The probability estimation is defined as where R is the abnormal point, σ is the standard deviation, and x is the position of the data point.
4. The method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning according to claim 1, wherein The steps in step 1.4 include the following steps: 4.1: Perform SMOTE sampling on the PTB-XL data and reorganize it into a two-dimensional time series feature matrix based on lead information. 4.2: Apply PCA to reduce the high-dimensional signal to 100 principal components, retaining the main diagnostic information. 4.3: Input the PTB-XL features after dimensionality reduction into the MLPS network with a three-layer fully connected structure, and use ReLU activation and Dropout regularization. 4.4: Add a residual connection mechanism to improve the training stability and generalization ability of the deep network. 4.5: Use the cross-entropy loss function for multi-class classification training and output electrocardiogram disease labels.
5. The method for abnormal electrocardiogram position localization and disease prediction classification based on deep learning according to claim 1, wherein The steps in step 1.5 include the following steps: 5.1: During the model training process, calculate the accuracy of the test set in each round and record the optimal model. 5.2: When the validation performance has not improved for 5 consecutive rounds, trigger the early stopping mechanism, terminate the training, and return the optimal model.
6. The method for abnormal electrocardiogram position localization and disease prediction and classification based on deep learning according to claim 1, wherein, The steps in step 1.6 include the following steps: 6.1: Transmit the twelve-lead signal to the backend data processing. 6.2: Input the second-lead data into the CNN-LSTM-Attention model to output the prediction of the abnormal position and the type of arrhythmia. 6.3: Input the twelve-lead data into the MLPS model to output the predicted disease type. 6.4: The backend synthesizes the prediction data and returns the result to the data receiving place. 6.5: Visualize and display the prediction results through the system front-end interface, including waveform diagrams and diagnostic labels.