Electrocardiogram image classification method and system based on deep learning

By employing a deep learning-based electrocardiogram (ECG) image classification method, combined with denoising preprocessing, waveform feature point extraction, and model prediction, the problems of accuracy in ECG image classification and workload for professional physicians have been solved, achieving efficient diagnosis and prediction of patient conditions.

CN115546557BActive Publication Date: 2025-11-11QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211290787.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-21
Publication Date
2025-11-11
Estimated Expiration
2042-10-21

AI Technical Summary

Technical Problem

Current ECG image classification relies on the judgment of professional physicians, which is labor-intensive and lacks accuracy. It is also difficult to capture ECG images with non-significant abnormal features in a timely manner, leading to difficulties in diagnosing the condition.

Method used

A deep learning-based electrocardiogram (ECG) image classification method is adopted, which includes denoising preprocessing, waveform feature point extraction, and a combination of support vector machine and linear regression model. Long short-term memory model is used for prediction, and wavelet transform and MATLAB tools are used for data processing and analysis.

Benefits of technology

It reduces the workload of professional physicians, improves the accuracy and effectiveness of electrocardiogram image classification, enables timely judgment of patients' conditions, and provides effective disease prediction support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115546557B_ABST
    Figure CN115546557B_ABST
Patent Text Reader

Abstract

This invention discloses a deep learning-based electrocardiogram (ECG) image classification method and system, belonging to the field of intelligent medical and image classification technology. The technical problem this invention aims to solve is how to utilize deep learning to classify and predict ECG images, reducing the workload of professional physicians while improving the accuracy and effectiveness of ECG image classification, thus providing effective assistance for timely diagnosis of patients' conditions. The technical solution adopted is as follows: The method specifically involves: selecting ECG images; performing denoising preprocessing on the ECG images; extracting waveform feature points from the denoised ECG images; classifying the images using a support vector machine (SVM) model and a linear regression model; and predicting the ECG images to be classified using a long short-term memory (LSTM) model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent medical and image classification technology, specifically to a method and system for classifying electrocardiogram (ECG) images based on deep learning. Background Technology

[0002] An electrocardiogram (ECG) reflects the health of the heart and is an important basis for diagnosing cardiovascular disease. However, currently, relying solely on clinicians to analyze ECG waveform changes is not ideal for diagnosing cardiovascular disease; further confirmation by a specialist physician is necessary. Even with a specialist diagnosis, some patients may not show obvious abnormalities on their ECGs. These patients may only exhibit specific abnormal waveforms characteristic of their condition during illness or when the disease worsens. Therefore, applying computer image classification technology to medicine undoubtedly helps in diagnosing patients' diseases. Classifying and predicting diseases based on extracted pathological features is of great significance for the development of computer-aided medicine.

[0003] However, current methods for classifying electrocardiogram (ECG) images have the following shortcomings:

[0004] ① Classifying electrocardiogram (ECG) images requires professional physicians to make judgments based on ECG waveform characteristics, which requires a high level of expertise and places an excessive workload on these physicians.

[0005] ② Some diseases or patients only show obvious characteristics on ECG images when the disease occurs or the condition worsens. However, the timing of the onset is not easy to determine, so it is difficult to capture abnormal ECG images, which brings great difficulty to judging the patient's condition.

[0006] Therefore, how to utilize deep learning to classify and predict electrocardiogram (ECG) images, reduce the workload of professional physicians, improve the accuracy and effectiveness of ECG image classification, and provide effective assistance for timely diagnosis of patients' conditions is a technical problem that urgently needs to be solved. Summary of the Invention

[0007] The technical objective of this invention is to provide a deep learning-based electrocardiogram (ECG) image classification method and system to address the problem of how to utilize deep learning to classify and predict ECG images, thereby reducing the workload of professional physicians while improving the accuracy and effectiveness of ECG image classification and providing effective assistance for timely diagnosis of patients' conditions.

[0008] The technical objective of this invention is achieved as follows: a deep learning-based electrocardiogram (ECG) image classification method, the specific method of which is as follows:

[0009] Select an electrocardiogram image;

[0010] Denoising preprocessing is performed on electrocardiogram images;

[0011] Extract waveform feature points from the denoised electrocardiogram image;

[0012] Classification is performed using support vector machine and linear regression models;

[0013] Long Short-Term Memory (LSTM) model is used to predict the classification of electrocardiogram images.

[0014] As a preferred method, the denoising preprocessing of the electrocardiogram image is as follows:

[0015] Wavelet Transform: After obtaining the original waveform of the electrocardiogram (ECG) image, wavelet basis functions are used to process the original waveform to obtain the waveform after wavelet transform. The formula is as follows:

[0016]

[0017] Where x represents the original waveform of the electrocardiogram image; y represents the waveform after wavelet basis function transformation;

[0018] Denoising: The wavedec function in MATLAB is used to decompose the waveform after wavelet transform to obtain the denoised waveform. The formula is as follows:

[0019] [C,L] = wavedec(E,3,coif5);

[0020] Where [C,L]=wavedec(E,3,coif5) is the coif5 wavelet basis, which performs a 3-level decomposition on the waveform E after wavelet transform to obtain the denoised waveforms respectively; C represents each layer component; L represents the component length.

[0021] More specifically, the waveform feature points extracted from the denoised electrocardiogram image are as follows:

[0022] R-wave extraction: The R-wave of the denoised waveform is detected and extracted using a fixed differential threshold analysis method with a scale of n.

[0023] Extracting Q and S waves: After detecting and extracting the R wave, the positions of possible Q and S waves are pre-judged to determine whether there is a modulus maximum. The modulus maximum is located before and after the center of the R wave peak. To ensure the accuracy of the determination of the modulus maximum, the position of the modulus maximum is corrected twice to obtain the final Q or S point.

[0024] P-wave and T-wave extraction: P-wave and T-wave are extracted and detected using a slope threshold.

[0025] More specifically, the R-wave is extracted as follows:

[0026] All extreme points on the denoised waveform are detected and sorted according to their amplitude;

[0027] The threshold value is determined based on the magnitude of the amplitude: r% of the difference between the maximum and minimum amplitude values ​​is used as the threshold, i.e., the critical value.

[0028] Compare all extreme points on the denoised waveform with the critical value to determine whether the extreme points on the denoised waveform are higher than the critical value:

[0029] If so, it is predicted to be an R wave;

[0030] After determining all extreme points on the denoised waveform, error detection and elimination of R-waves are performed: if the threshold is greater than the RR interval, the amplitudes of two adjacent R-waves are compared, the one with the higher amplitude is the R-wave, and the one with the lower amplitude is directly removed.

[0031] After all R-waves have been checked and eliminated, local micro-corrections are performed on the R-waves to obtain more accurate and correct waveforms.

[0032] The Q wave extraction is as follows:

[0033] Before the predicted point is located, take the data 20ms in advance and set its coordinates as (x1, y1);

[0034] Connect the predicted point with the peak of the R-wave using a straight line; where the coordinates of the R-wave peak are (x2, y2); the formula for the straight line is as follows:

[0035]

[0036] Calculate the distance from each modulus maximum point to the line, and the point with the farthest distance is the Q point after the first correction; the formula for the distance from a point to the line is as follows:

[0037]

[0038] The extraction of P waves and T waves is as follows:

[0039] Find the point with the maximum modulus within a defined range;

[0040] Calculate the modulus of the slope between points within a set range before and after the maximum point, and select the maximum value of the slope modulus.

[0041] When the threshold is less than the maximum value of the slope modulus, the maximum value of the modulus is the peak of the P wave or T wave, and the corresponding baseline point is the start and end point of the P wave or T wave. At the same time, the amplitude and duration of the P wave or T wave can be calculated.

[0042] When the threshold is greater than the maximum value of the slope, it means that there is no P wave or T wave in the waveform of the electrocardiogram image, and the amplitude and duration of the P wave are both 0.

[0043] Even better, classification can be performed using support vector machine and linear regression models, as detailed below:

[0044] Support Vector Machine (SVM) model: In the MATLAB environment, the K-CV (K-fold Cross Validation) method is used to obtain the classification index, as follows: The electrocardiogram images are divided into K (K>2) groups, one of which is used as the validation set, and the remaining K-1 groups are used as the training set. The support vector machine model is trained to obtain K classifier models. Finally, the average classification accuracy of these K classifier models is used as the index.

[0045] Linear Regression Model: A linear regression model was established using SPSS. Specifically, eight independent variables were selected, with the dependent variable being GROUP. "Input" was chosen as the regression method. Regression coefficients were used to represent the relationship between each independent variable and the dependent variable. The significance of the difference between the coefficients and 0 was represented by Sig. The specific expression for the linear regression model is as follows:

[0046] GROUP = -0.581 × V R -2.181×V P -0.89×V T -0.001×T RR +0.006×T QT -0.007×T PR +0.063×|V ST +0.107×N P +0.296;

[0047] Among them, V R Indicates the amplitude of the R wave; V P Indicates the P-wave amplitude; V T Indicates the amplitude of the T wave; T RR Indicates the RR interval; T QT T represents the QT interval; PR Indicates the PR interval; V ST Indicates the potential shift of segment ST; N P This indicates whether premature beats (PVCs) have occurred. If PVCs are present, then N... P =1; if no premature beats occur, then N P =0;

[0048] Electrocardiogram (ECG) image classification, the formula is as follows:

[0049] M = αS + βL;

[0050] Where 0 < α < 1, 0 < β < 1 and α + β = 1, M represents the final classification model DSLM; S represents the SVM model; L represents the linear regression model; α and β are the coefficients of the SVM model and the linear regression model in DSLM, respectively. The coefficients in DSLM are obtained through multiple learning processes, specifically by comparing the accuracy of the parameters and selecting the parameter with the highest accuracy as the final parameter.

[0051] Even better, the Long Short-Term Memory (LSTM) model is used to predict the ECG images to be classified, as follows:

[0052] Forget Gate: Determines which information in the waveform of the ECG image to be classified needs to be forgotten from the LSTM model; specifically, the sigmoid unit determines the information to be discarded from the waveform of the ECG image to be classified, and checks h t-1 and x t The information outputs a vector between 0 and 1, where the 0-1 values ​​represent the C of the LSTM model. t-1 How much of the information should be retained or discarded? 0 indicates no retention, and 1 indicates all information should be retained. The formula is:

[0053] f t =σ(W f ·[h t-1 ,x t ]+b f );

[0054] Among them, f t Indicates the degree of forgetting of waveform information in an electrocardiogram image; σ represents the sigmoid function; W f b represents the weights generated by the model learning; f This represents the bias in model learning; W in the relevant LSTM model formula * and b * These all represent the parameters learned by the model; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0055] Input gate: Determines which new information from the waveform of the ECG image to be classified is stored in the LSTM model. Specifically, it uses h... t-1 and x t The information to be added is determined by the input gate; h is used. t-1 and x t New candidate information that may be updated into the LSTM model is obtained through a tanh function layer. The formula is:

[0056] i t =σ(W i·[h t-1 ,x t ]+b i );

[0057]

[0058] Among them, i t This represents the ECG image information that needs to be updated; σ represents the sigmoid function; W * and b * These all represent the parameters learned by the model; This represents a new alternative scheme for updating the ECG waveform information of the input model using the tanh function; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0059] Output gate: Determines which values ​​in the waveform of the ECG image to be classified are output, specifically: updating C. t-1 Become the new C t The rule is to use the forget gate to select and forget a portion of the old information, and the input gate to select and add candidate information. Part of it receives new information C t The formula is:

[0060]

[0061] Among them, f t Indicates the degree of forgetting of waveform information in the electrocardiogram image at the forgetting gate; C t-1 This represents the waveform information of the electrocardiogram image output from the previous layer; i t This indicates that the electrocardiogram (ECG) image information needs to be updated; This represents an alternative scheme for updating the ECG waveform information of the input model using a new method created by the tanh function.

[0062] A deep learning-based electrocardiogram (ECG) image classification system, comprising,

[0063] The selection unit is used to select an electrocardiogram (ECG) image.

[0064] The preprocessing unit is used to perform noise reduction preprocessing on the electrocardiogram images;

[0065] The extraction unit is used to extract waveform feature points from the denoised electrocardiogram image;

[0066] Classification units are used for classification using support vector machine and linear regression models;

[0067] The prediction unit is used to predict the electrocardiogram images to be classified using a long short-term memory model (LSTM).

[0068] Preferably, the preprocessing unit includes,

[0069] The wavelet transform module is used to obtain the original waveform of the electrocardiogram (ECG) image, and then process the original waveform using wavelet basis functions to obtain the wavelet-transformed waveform. The formula is as follows:

[0070]

[0071] Where x represents the original waveform of the electrocardiogram image; y represents the waveform after wavelet basis function transformation;

[0072] The denoising module uses the `wavedec` function in MATLAB to decompose the waveform after wavelet transform to obtain the denoised waveform. The formula is as follows:

[0073] [C,L] = wavedec(E,3,coif5);

[0074] Where [C,L]=wavedec(E,3,coif5) is the coif5 wavelet basis, which performs a 3-level decomposition on the waveform E after wavelet transform to obtain the denoised waveforms respectively; C represents each layer component; L represents the component length.

[0075] Preferably, the extraction unit includes,

[0076] The R-wave extraction module is used to detect and extract R-waves from denoised waveforms using a fixed differential threshold analysis method, with a scale of n.

[0077] The Q-wave and S-wave extraction module is used to detect and extract the R-wave and pre-judge the possible positions of the Q-wave and S-wave to determine whether there is a modulus maximum. The modulus maximum is located before and after the center of the R-wave peak. To ensure the accuracy of the determination of the modulus maximum, the modulus maximum is corrected twice to obtain the final Q-point or S-point.

[0078] The P-wave and T-wave extraction module is used to extract and detect P-waves and T-waves using a slope threshold.

[0079] More preferably, the working process of the classification unit is as follows:

[0080] (1) Support Vector Machine (SVM) model: In the MATLAB environment, the K-CV (K-fold CrossValidation) method is used to obtain the classification index, as follows: The electrocardiogram images are divided into K (K>2) groups, one of which is used as the validation set and the remaining K-1 groups are used as the training set. The support vector machine model is trained to obtain K classifier models. Finally, the average classification accuracy of these K classifier models is used as the index.

[0081] (2) Linear Regression Model: The linear regression model was established using SPSS. Specifically, eight independent variables were selected, with the dependent variable being GROUP. "Input" was selected as the regression method. The regression coefficients were used to represent the relationship between each independent variable and the dependent variable, and the significance of the difference between the coefficients and 0 was represented by Sig. The specific expression of the linear regression model is as follows:

[0082] GROUP = -0.581 × V R -2.181×V P -0.89×V T -0.001×T RR +0.006×T QT -0.007×T PR +0.063×|V ST +0.107×N P +0.296;

[0083] Among them, V R Indicates the amplitude of the R wave; V P Indicates the P-wave amplitude; V T Indicates the amplitude of the T wave; T RR Indicates the RR interval; T QT T represents the QT interval; PR Indicates the PR interval; V ST Indicates the potential shift of segment ST; N P This indicates whether premature beats (PVCs) have occurred. If PVCs are present, then N... P =1; if no premature beats occur, then N P =0;

[0084] (3) Electrocardiogram image classification, the formula is as follows:

[0085] M = αS + βL;

[0086] Where 0 < α < 1, 0 < β < 1 and α + β = 1, M represents the final classification model DSLM; S represents the SVM model; L represents the linear regression model; α and β are the coefficients of the SVM model and the linear regression model in DSLM, respectively. The coefficients in DSLM are learned through multiple learning processes. Specifically, the parameters are selected by comparing the accuracy results, and the parameter with the highest accuracy result is selected as the final parameter.

[0087] The prediction unit's operation process includes three stages, as detailed below:

[0088] The first stage, the forgetting gate, determines which information in the ECG image waveform to be classified needs to be forgotten from the LSTM model. Specifically, the sigmoid unit determines the information to be discarded from the ECG image waveform by checking h. t-1 and x t The information outputs a vector between 0 and 1, where the 0-1 values ​​represent the C of the LSTM model. t-1 How much of the information should be retained or discarded? 0 indicates no retention, and 1 indicates all information should be retained. The formula is:

[0089] f t =σ(W f ·[h t-1 ,x t ]+b f );

[0090] Among them, f t Indicates the degree of forgetting of waveform information in an electrocardiogram image; σ represents the sigmoid function; W f b represents the weights generated by the model learning; f This represents the bias in model learning; W in the relevant LSTM model formula * and b * These all represent the parameters learned by the model; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0091] The second stage, the input gate, determines which new information from the waveform of the ECG image to be classified is stored in the LSTM model. Specifically, it uses h... t-1 and x t The information to be added is determined by the input gate; h is used. t-1 and x t New candidate information that may be updated into the LSTM model is obtained through a tanh function layer. The formula is:

[0092] i t =σ(W i ·[h t-1 ,x t ]+b i );

[0093]

[0094] Among them, i t This represents the ECG image information that needs to be updated; σ represents the sigmoid function, W * and b * These all represent the parameters learned by the model; This represents a new alternative scheme for updating the ECG waveform information of the input model using the tanh function; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0095] The third stage output gate determines which values ​​in the waveform of the ECG image to be classified are output, specifically: updating C. t-1 Become the new C t The rule is to use the forget gate to select and forget a portion of the old information, and the input gate to select and add candidate information. Part of it receives new information C t The formula is:

[0096]

[0097] Among them, f t Indicates the degree of forgetting of waveform information in the electrocardiogram image at the forgetting gate; C t-1 This represents the waveform information of the electrocardiogram image output from the previous layer; i t This indicates that the electrocardiogram (ECG) image information needs to be updated; This represents an alternative scheme for updating the ECG waveform information of the input model using a new method created by the tanh function.

[0098] The deep learning-based electrocardiogram (ECG) image classification method and system of the present invention have the following advantages: The present invention can classify, identify and predict ECG images to solve the problem of inaccuracy in existing ECG image classification, reduce the workload of professional physicians, improve the accuracy and effectiveness of ECG image classification, and provide effective assistance for timely judgment of patients' conditions. Attached Figure Description

[0099] The invention will be further described below with reference to the accompanying drawings.

[0100] Appendix Figure 1 This is a block diagram of a deep learning-based electrocardiogram image classification method.

[0101] Appendix Figure 2 A schematic diagram of the forget gate in an LSTM model;

[0102] Appendix Figure 3 A schematic diagram of the input gate for an LSTM model;

[0103] Appendix Figure 4 A schematic diagram of the output gate of an LSTM model;

[0104] Appendix Figure 5 This is a schematic diagram of an LSTM model;

[0105] Appendix Figure 6 This is a comparison image before and after the wavelet transform;

[0106] Appendix Figure 7 Comparison of wavelet denoising techniques;

[0107] Appendix Figure 8 Schematic diagram of R wave localization in a normal electrocardiogram image;

[0108] Appendix Figure 9 This is a schematic diagram of QRS wave localization in a normal electrocardiogram image.

[0109] Appendix Figure 10 A schematic diagram of QRS wave localization in an electrocardiogram image of a patient with the disease.

[0110] Appendix Figure 11 Diagram showing the location of P-waves and T-waves;

[0111] Appendix Figure 12 Electrocardiogram image of a myocardial infarction;

[0112] Appendix Figure 13 This is a normal electrocardiogram image. Detailed Implementation

[0113] The following detailed description of the deep learning-based electrocardiogram image classification method and system of the present invention is provided with reference to the accompanying drawings and specific embodiments.

[0114] Example 1:

[0115] As attached Figure 1 As shown in the figure, this embodiment provides a deep learning-based electrocardiogram (ECG) image classification method, which is as follows:

[0116] S1. Selecting ECG images: Specifically, ECG images are selected from the PhysioNet database, specifically from the PTB myocardial infarction database. This includes ECG image data from 290 subjects, each labeled with either "0" or "1". "0" indicates a healthy individual, and "1" indicates an individual with the disease. Of these 290 subjects, 148 were diagnosed with myocardial infarction, 52 were healthy controls, and the remaining 90 had other cardiac conditions. Data signals from the PTB database were recorded at a sampling frequency of 1000Hz, with a total of 12 leads. This invention focuses on the V5 lead signal from myocardial infarction patients and healthy controls. The V5 lead is located in the chest closest to the heart and is the most effective for identifying ECG signal characteristics associated with myocardial infarction. Statistical analysis of the ECG image data is shown in Table 1. After data analysis, SPSS is used for data correlation analysis to establish a model. The results of the ECG image data correlation analysis are shown in Table 2.

[0117] Table 1: Analysis of Electrocardiogram Image Data of Myocardial Infarction

[0118] Relevant parameters healthy control group Myocardial infarction patients R amplitude 1.563±0.105 0.896±0.395 T-amplitude 0.446±0.112 -0.100±0.25 P-amplitude 0.106±0.070 0.070±0.011 T-wave duration 127.83±29.26 130.23±37.60 P-wave duration 69.21±11.00 67.86±14.04 QRS time limit 78.40±9.11 78.73±9.15 RR interval 814.43±137.22 752.06±157.83 QT interval 381.45±43.86 446.60±37.20 PR interval 151.14±21.29 123.21±25.32 ST segment offset none 38 cases of elevation or depression premature ventricular contractions none 21 cases of premature beats

[0119] Table 2: Correlation Analysis of Electrocardiogram Image Data of Myocardial Infarction

[0120]

[0121]

[0122] In Table 2, R wave amplitude, T wave amplitude, P wave amplitude, and QT interval were significantly correlated at the 0.01 level, while RR interval, PR interval, ST segment deviation, and premature beats were significantly correlated at the 0.05 level. The remaining P wave duration, T wave duration, and QRS duration were not significantly correlated. Therefore, the eight data points with correlation were selected as the data source for model building.

[0123] S2. Perform noise reduction preprocessing on the electrocardiogram image;

[0124] S3. Extract waveform feature points from the denoised electrocardiogram image;

[0125] S4. Classification is performed using support vector machine and linear regression models;

[0126] S5. Use the Long Short-Term Memory (LSTM) model to predict the electrocardiogram images to be classified.

[0127] The specific denoising preprocessing of the electrocardiogram image in step S2 of this embodiment is as follows:

[0128] S201. Wavelet Transform: When obtaining the wavelet transform signal from the original waveform of the electrocardiogram image, a continuous wavelet transform with a scale of 6 is used. The wavelet basis function is the Mexican wavelet function, which is the second derivative of the Gaussian function. Because the shape of this function is very similar to the cross-section of a Mexican hat, it is often figuratively called the Mexican hat function. Compared with other wavelet basis functions, the Mexican wavelet function is not very sensitive to angles, so it is more suitable for feature extraction. At the same time, it also has the advantage of being able to extract relatively stable extreme points or feature points.

[0129] After obtaining the original waveform of the electrocardiogram (ECG) image, wavelet basis functions are used to process the original waveform to obtain the wavelet transform waveform. The formula is as follows:

[0130]

[0131] Where x represents the original waveform of the electrocardiogram (ECG) image; y represents the waveform after wavelet basis function transformation; the signal of the original ECG image after wavelet transform is shown in the attached figure. Figure 6 As shown.

[0132] S202. Denoising: The wavedec function in MATLAB is used to decompose the waveform after wavelet transform to obtain the denoised waveform. The formula is as follows:

[0133] [C,L] = wavedec(E,3,coif5);

[0134] Where [C,L]=wavedec(E,3,coif5) is the coif5 wavelet basis, which performs a 3-level decomposition on the waveform E after wavelet transform to obtain the denoised waveforms separately; C represents each layer component; L represents the component length, which is a fixed usage. A comparison of the denoised ECG image with the original ECG image is attached. Figure 7 As shown in the attached figure. The electrocardiogram (ECG) images used in the example are from the PTB ECG database of patient number 1 with myocardial infarction. Unless otherwise noted, the ECG images of this patient will be used for example analysis below.

[0135] After denoising is completed in step S3 of this embodiment, feature extraction of the electrocardiogram (ECG) image is required for better disease identification. Among the waveforms of the ECG image, the QRS complex has the most obvious features and the highest energy, so it is the easiest to detect. Moreover, in current detection methods for ECG waveform research, the QRS complex is detected first and located in the ECG image, and then the P wave, T wave, etc. are detected based on this.

[0136] In this invention, wavelet analysis is mainly used for feature extraction. First, the R-wave is detected. Since the amplitude and slope of the R-wave are relatively large compared to other waveforms, it is detected first. After detection, the Q-wave and S-wave can also be successfully detected.

[0137] The specific steps for extracting waveform feature points from the denoised electrocardiogram image in step S3 of this embodiment are as follows:

[0138] S301. Extracting R-waves: The R-waves of the denoised waveform are detected and extracted using a fixed differential threshold analysis method with a scale of n.

[0139] S302. Extracting Q and S waves: After detecting and extracting the R wave, the positions of possible Q and S waves are pre-judged to determine whether there is a modulus maximum. The modulus maximum is located before and after the center of the R wave peak. To ensure the accuracy of the determination of the modulus maximum, the position of the modulus maximum is corrected twice to obtain the final Q or S point.

[0140] S303. Extract P-waves and T-waves: Use slope thresholding to extract and detect P-waves and T-waves.

[0141] The extraction of the R-wave in step S301 of this embodiment is as follows:

[0142] S30101. Detect all extreme points on the denoised waveform and sort them according to their amplitude;

[0143] S30102. Determine the threshold value based on the amplitude: take r% of the difference between the maximum and minimum amplitude values ​​as the threshold value, i.e., the critical value.

[0144] S30103. Compare all extreme points on the denoised waveform with the critical value to determine whether the extreme points on the denoised waveform are higher than the critical value:

[0145] If so, it is predicted to be an R wave;

[0146] S30104. After determining all extreme points on the denoised waveform, perform error detection and elimination of R-waves: If the threshold is greater than the RR interval, compare the amplitudes of two adjacent R-waves, the one with the higher amplitude is the R-wave, and the one with the lower amplitude is directly removed.

[0147] S30105. After checking and eliminating all R-waves, perform local micro-correction on the R-waves to obtain more accurate and correct R-waves.

[0148] After the Mexican wavelet transform described above, extreme points are extracted. A threshold needs to be determined. The purpose of determining the threshold is to check if the extracted extreme point is greater than the threshold. If it is, it needs to be further determined whether this value is the maximum value within a range of 10 points before and after it. If so, the distance between these two peaks is calculated. If not, the point with the largest modulus within that range needs to be selected, and it needs to be determined whether the time between the two points is less than 400ms. If it is greater, it is the peak of the R-wave; if it is less, the point with the larger modulus of the two R-waves needs to be selected as the peak of the R-wave. The R-wave extraction process for healthy subject No. 205 is attached. Figure 8As shown. During R-wave extraction, through experimental results and process observation, using 6 as the wavelet transform scale n and 40% as the differential threshold coefficient yielded better results. Later, in eliminating false R-wave detections, to achieve the same better effect as the previous step, the RR interval threshold needs to be set to 0.4s. That is, if the duration of two RR intervals is less than 0.4s, it will be considered a false R-wave detection. This is because the human heart rate ranges from 60-100 beats / min, with a minimum of 40 and a maximum of 120, meaning the shortest RR interval will not be less than 0.5s. However, considering that heart rate may become irregular due to illness, the RR interval may be shorter than before the occurrence of such an event; therefore, setting the threshold to 0.4s is better. Meanwhile, the setting of this threshold conforms to the specifications, and its usability and applicability are also relatively high. Finally, in order to more accurately determine the position of the R-wave, it is necessary to take 10ms of data before and after the detected R-wave, compare and sort them, and take the coordinates of the modulus maxima as the final R-wave position.

[0149] The extraction of the Q wave in step S302 of this embodiment is as follows:

[0150] S30201. Before the predicted point is located, take the data 20ms in advance and set its coordinates as (x1, y1).

[0151] S30202. Connect the predicted point with the peak of the R-wave using a straight line; where the coordinates of the R-wave peak are (x2, y2); the formula for the straight line is as follows:

[0152]

[0153] S30203. Calculate the distance from each modulus maximum point to the line. The point with the farthest distance is the Q point after the first correction. The formula for the distance from a point to the line is as follows:

[0154]

[0155] Where A, B, and C are the coefficients of the line, which can be obtained from the equation.

[0156] After extracting the Q-wave and S-wave, the start point of the Q-wave and the end point of the S-wave can be easily found. This is done by finding the nearest extreme points, which are located within 100ms before the Q-point and after the S-point, respectively, and using these as the start and end points of the QRS composite wave. The time difference between the start and end points is the time limit of the QRS composite wave, and the amplitude difference between the R-wave peak and the QRS start point is the R-wave amplitude.

[0157] As attached Figure 9The location of the Q wave, R wave, and S wave in the original electrocardiogram image of healthy control subject No. 205 is attached. Figure 10 The location of Q wave, R wave and S wave in the denoised electrocardiogram image of patient No. 1 with myocardial infarction.

[0158] The extraction of P-waves and T-waves in step S303 of this embodiment is as follows:

[0159] S30301. Find the maximum value of the modulus within a defined range;

[0160] S30302. Calculate the modulus of the slope between points within a set range before and after the maximum value point, and select the maximum value of the slope modulus.

[0161] S30303. Determine the relationship between the threshold and the maximum value of the slope's modulus:

[0162] ① When the threshold is less than the maximum value of the slope, the maximum value of the slope is the peak of the P wave or T wave, and the corresponding baseline point is the start and end point of the P wave or T wave. At the same time, the amplitude and duration of the P wave or T wave can be calculated.

[0163] ② When the threshold is greater than the maximum value of the slope modulus, it indicates that there is no P wave or T wave in the waveform of the electrocardiogram image, and the amplitude and duration of the P wave are both 0. P wave and T wave detection and extraction are shown in the attached figure. Figure 11 As shown.

[0164] In this embodiment, step S4, which involves classification using a support vector machine model and a linear regression model, is as follows:

[0165] S401. Support Vector Machine (SVM) Model: The SVM model has excellent stability because it considers minimizing empirical and structural risks. The Libsvm toolbox is widely used in the MATLAB environment, facilitating the creation and use of SVM models. The executable file under Windows does not require user compilation; the Libsvm toolbox provides pre-compiled code, further simplifying SVM model creation. Since K-fold Cross Validation (K-CV) is frequently used in this type of research, this invention also adopts this method. This method requires first dividing the data to be studied into K (K>2) groups, using one group as the validation set and the remaining K-1 groups as the training set to train the model. This method yields K classifier models. To ensure fair and reliable classifier performance, the average classification accuracy of these models is used as the metric. The K-CV cross-validation and parameter selection process is implemented using the MATLAB platform, and the final optimal values ​​for c and g are 0.758 and 4.

[0166] S402, Linear Regression Model: A linear regression model was established using SPSS statistical analysis software. Specifically, eight independent variables were selected, with the dependent variable being GROUP. "Input" was chosen as the regression method. Regression coefficients were used to represent the relationship between each independent variable and the dependent variable. The significance of the difference between the coefficients and 0 was represented by Sig. The specific expression for the linear regression model is as follows:

[0167] GROUP = -0.581 × V R -2.181×V P -0.89×V T -0.001×T RR +0.006×T QT -0.007×T PR +0.063×|V ST +0.107×N P +0.296;

[0168] Among them, V R Indicates the amplitude of the R wave; V P Indicates the P-wave amplitude; V T Indicates the amplitude of the T wave; T RR Indicates the RR interval; T QT T represents the QT interval; PR Indicates the PR interval; V ST Indicates the potential shift of segment ST; N P This indicates whether premature beats (PVCs) have occurred. If PVCs are present, then N... P =1; if no premature beats occur, then N P =0; The linear regression analysis of the electrocardiogram data of myocardial infarction is shown in Table 3:

[0169] Table 3: Linear Regression Analysis of Electrocardiogram Data for Myocardial Infarction

[0170]

[0171] For S403, ECG image classification, not only was an SVM model established, but a linear regression model was also built using SPSS. Using both models together resulted in higher accuracy in disease identification. The study showed that the linear regression model had an accuracy rate of 90.5%, with 11 cases misclassified as healthy and 5 as myocardial infarction patients. The SVM model had an accuracy rate of 97.1%, with only 1 case misclassified as healthy. The data shows that the SVM model has a higher accuracy rate, but it also has limitations. Specifically, features related to the pathological parameters of myocardial infarction cannot be observed through the SVM model, while the linear regression model can effectively address this issue. Therefore, using these two models for analysis allows for complementary advantages and provides better data for disease identification.

[0172] After numerous experiments, it was found that assigning different coefficients to the model using the following formula yielded the best results in identifying the unique characteristics of myocardial infarction, thereby enabling the classification and prediction of myocardial infarction. The formula is:

[0173] M = αS + βL;

[0174] Where 0 < α < 1, 0 < β < 1 and α + β = 1, M represents the final classification model DSLM, S represents the SVM model, L represents the linear regression model, and α and β are the coefficients of the SVM model and the linear regression model in DSLM, respectively. The coefficients are obtained through multiple learning iterations, specifically by comparing accuracy rates to select the parameters with the highest accuracy as the final parameters. The coefficients achieving the highest accuracy are 0.7 and 0.3, respectively.

[0175] From the regression coefficients of the linear regression model alone, we can see that three coefficients have negative values: the amplitudes of the T wave, P wave, and R wave. This phenomenon indicates that as the values ​​decrease, the probability of being classified as myocardial infarction increases significantly. We can conclude that patients with myocardial infarction have relatively low amplitudes of the R wave and P wave, and the T wave is more pronounced (and there are also patients with T wave inversion, such as patient number 1 mentioned earlier). Patients with myocardial infarction may also experience problems with signal transmission lag or blockage due to decreased myocardial activity or even necrosis, which will result in very weak overall ECG signal energy.

[0176] Secondly, the observation shows that the coefficients for the RR and PR intervals are negative, indicating that a higher heart rate corresponds to a shorter RR interval on the electrocardiogram, thus increasing the probability of myocardial infarction. The PR and RR intervals are directly proportional; a shorter PR interval corresponds to a higher probability of myocardial infarction. The table shows that the coefficient for the QT interval is positive, indicating that a longer QT interval corresponds to a higher probability of being classified as having myocardial infarction.

[0177] Furthermore, the coefficients for ST segment potential shift and premature beats are both positive. This phenomenon indicates that the occurrence of such characteristics is directly proportional to the probability of developing myocardial infarction. The more pronounced these characteristics are, the greater the probability of developing myocardial infarction.

[0178] After establishing and analyzing the linear regression model, the following conclusion can be drawn: if the electrocardiogram shows weak R and P wave amplitudes, inverted T waves, an unusually long QT duration, ST segment potential deviation exceeding 0.1mV, or excessively fast heart rate and premature beats, then the electrocardiogram image can be identified as that of a patient with myocardial infarction. This characteristic can accurately classify the electrocardiogram image as an electrocardiogram image of myocardial infarction.

[0179] Prediction, in particular, involves inferring the future development of things based on past and present objective processes and certain patterns. This allows for the judgment of possible future scenarios, leading to a better understanding of the development process and a more controlled direction of events. The LSTM method, with its unique three-gate structure, strong parallel distributed processing capabilities, and powerful memory function, is suitable for processing and predicting important events over a longer period.

[0180] As attached Figure 5 As shown, in LSTM, the first stage is the forget gate, which determines which information needs to be forgotten from the LSTM model; the next stage is the input gate, which determines which new information can be stored in the LSTM model; and the last stage is the output gate, which determines what value to output. Sometimes, the incoming and outgoing information needs to be selected before processing. The method for selectively using information is the "gate" structure. To achieve this, neural network layers with sigmoid and pointwise multiplication operations were developed.

[0181] In this embodiment, step S5, using a Long Short-Term Memory (LSTM) model to predict the electrocardiogram image to be classified, is as follows:

[0182] S501, Forget Gate: Determines which information in the waveform of the ECG image to be classified needs to be forgotten from the LSTM model; specifically: the sigmoid unit determines the information to be discarded in the waveform of the ECG image to be classified, and checks h... t-1 and x t The information outputs a vector between 0 and 1, where the 0-1 values ​​represent the C of the LSTM model. t-1 How much of the information in the document should be retained or discarded? 0 indicates no retention, and 1 indicates all information should be retained, as shown in the attached document. Figure 2As shown, the formula is:

[0183] f t =σ(W f ·[h t-1 ,x t ]+b f );

[0184] Among them, f t This indicates the degree of forgetting of waveform information from the electrocardiogram image; σ represents the sigmoid function, W f b represents the weights generated by the model learning; f This represents the bias in model learning; W in the relevant LSTM model formula below * and b * These all represent the parameters learned by the model; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0185] S502, Input Gate: Determines which new information from the waveform of the ECG image to be classified is stored in the LSTM model. Specifically, it uses h... t-1 and x t The information to be added is determined by the input gate; h is used. t-1 and x t New candidate information C that may be updated in the LSTM model is obtained through a tanh function layer. t As attached Figure 3 As shown, the formula is:

[0186] i t =σ(W i ·[h t-1 ,x t ]+b i );

[0187]

[0188] Among them, i t This represents the ECG image information that needs to be updated; σ represents the sigmoid function; W * and b * These all represent the parameters learned by the model; This represents a new alternative scheme for updating the ECG waveform information of the input model using the tanh function; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer.

[0189] S503, Output Gate: Determines which values ​​in the waveform of the ECG image to be classified are output, specifically: Update Ct-1 Become the new C t The rule is to use the forget gate to select and forget a portion of the old information, and the input gate to select and add candidate information. Part of it receives new information C t As attached Figure 4 As shown, the formula is:

[0190]

[0191] Among them, f t Indicates the degree of forgetting of waveform information in the electrocardiogram image at the forgetting gate; C t-1 This represents the waveform information of the electrocardiogram image output from the previous layer; i t This indicates that the electrocardiogram (ECG) image information needs to be updated; This represents an alternative scheme for updating the ECG waveform information of the input model using a new method created by the tanh function.

[0192] Based on the waveform features of the electrocardiogram (ECG) image extracted in step S4, an accurate prediction can be made using the LSTM model. It records disease features in the LSTM model structure, discards features irrelevant to the disease, and finally outputs the prediction result.

[0193] As attached Figure 12 The image shows a prediction for patient number 1. The blue line (representing the waveform) clearly shows greater fluctuations compared to the orange line. This graphical representation indicates that the patient's condition improved after pathological treatment, and the future potential changes are much smoother than before, demonstrating the effectiveness of the treatment. (See attached image.) Figure 13 As shown in the prediction for healthy individual number 205, the electrocardiogram waveform of this individual showed little fluctuation, indicating a low likelihood of developing myocardial infarction. This prediction serves two purposes: firstly, it allows for accurate forecasting of future disease progression, facilitating timely adjustments to treatment plans and providing patients with greater flexibility and more precise treatment options; secondly, it provides insights into potential future changes in healthy individuals, reminding people to pay sufficient attention to their health.

[0194] Example 2:

[0195] This embodiment provides a deep learning-based electrocardiogram (ECG) image classification system, which includes:

[0196] The selection unit is used to select an electrocardiogram (ECG) image.

[0197] The preprocessing unit is used to perform noise reduction preprocessing on the electrocardiogram images;

[0198] The extraction unit is used to extract waveform feature points from the denoised electrocardiogram image;

[0199] Classification units are used for classification using support vector machine and linear regression models;

[0200] The prediction unit is used to predict the classification of electrocardiogram images using a Long Short-Term Memory (LSTM) model.

[0201] The preprocessing unit in this embodiment includes,

[0202] The wavelet transform module is used to obtain the original waveform of the electrocardiogram (ECG) image, and then process the original waveform using wavelet basis functions to obtain the wavelet-transformed waveform. The formula is as follows:

[0203]

[0204] Where x represents the original waveform of the electrocardiogram image; y represents the waveform after wavelet basis function transformation;

[0205] The denoising module uses the `wavedec` function in MATLAB to decompose the waveform after wavelet transform to obtain the denoised waveform. The formula is as follows:

[0206] [C,L] = wavedec(E,3,coif5);

[0207] Where [C,L]=wavedec(E,3,coif5) is the coif5 wavelet basis, which performs a 3-level decomposition on the waveform E after wavelet transform to obtain the denoised waveforms respectively; C represents each layer component; L represents the component length.

[0208] The extraction unit in this embodiment includes,

[0209] The R-wave extraction module is used to detect and extract R-waves from denoised waveforms using a fixed differential threshold analysis method, with a scale of n.

[0210] The Q-wave and S-wave extraction module is used to detect and extract the R-wave and pre-judge the possible positions of the Q-wave and S-wave to determine whether there is a modulus maximum. The modulus maximum is located before and after the center of the R-wave peak. To ensure the accuracy of the determination of the modulus maximum, the modulus maximum is corrected twice to obtain the final Q-point or S-point.

[0211] The P-wave and T-wave extraction module is used to extract and detect P-waves and T-waves using a slope threshold.

[0212] The specific working process of the classification unit in this embodiment is as follows:

[0213] (1) Support Vector Machine (SVM) model: In the MATLAB environment, the K-CV (K-fold CrossValidation) method is used to obtain the classification index, as follows: The electrocardiogram images are divided into K (K>2) groups, one of which is used as the validation set and the remaining K-1 groups are used as the training set. The support vector machine model is trained to obtain K classifier models. Finally, the average classification accuracy of these K classifier models is used as the index.

[0214] (2) Linear Regression Model: The linear regression model was established using SPSS. Specifically, eight independent variables were selected, with the dependent variable being GROUP. "Input" was selected as the regression method. The regression coefficients were used to represent the relationship between each independent variable and the dependent variable, and the significance of the difference between the coefficients and 0 was represented by Sig. The specific expression of the linear regression model is as follows:

[0215] GROUP = -0.581 × V R -2.181×V P -0.89×V T -0.001×T RR +0.006×T QT -0.007×T PR +0.063×|V ST +0.107×N P +0.296;

[0216] Among them, V R Indicates the amplitude of the R wave; V P Indicates the P-wave amplitude; V T Indicates the amplitude of the T wave; T RR Indicates the RR interval; T QT T represents the QT interval; PR Indicates the PR interval; V ST Indicates the potential shift of segment ST; N P This indicates whether premature beats (PVCs) have occurred. If PVCs are present, then N... P =1; if no premature beats occur, then N P =0;

[0217] (3) Electrocardiogram image classification, the formula is as follows:

[0218] M = αS + βL;

[0219] Where 0 < α < 1, 0 < β < 1 and α + β = 1, M represents the final classification model DSLM; S represents the SVM model; L represents the linear regression model; α and β are the coefficients of the SVM model and the linear regression model in DSLM, respectively. The coefficients in DSLM are learned through multiple learning processes. Specifically, the parameters are selected by comparing the accuracy results, and the parameter with the highest accuracy result is selected as the final parameter.

[0220] The prediction unit in this embodiment operates in three stages, as follows:

[0221] The first stage, the forgetting gate, determines which information in the ECG image waveform to be classified needs to be forgotten from the LSTM model. Specifically, the sigmoid unit determines the information to be discarded from the ECG image waveform by checking h. t-1 and x t The information outputs a vector between 0 and 1, where the 0-1 values ​​represent the C of the LSTM model. t-1 How much of the information should be retained or discarded? 0 indicates no retention, and 1 indicates all information should be retained. The formula is:

[0222] f t =σ(W f ·[h t-1 ,x t ]+b f );

[0223] Among them, f t Indicates the degree of forgetting of waveform information in an electrocardiogram image; σ represents the sigmoid function; W f b represents the weights generated by the model learning; f This represents the bias in model learning; W in the relevant LSTM model formula below * and b * These all represent the parameters learned by the model; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0224] The second stage, the input gate, determines which new information from the waveform of the ECG image to be classified is stored in the LSTM model. Specifically, it uses h... t-1 and x t The information to be added is determined by the input gate; h is used. t-1 and x t New candidate information that may be updated into the LSTM model is obtained through a tanh function layer. The formula is:

[0225] i t =σ(W i·[h t-1 ,x t ]+b i );

[0226]

[0227] Among them, i t This represents the ECG image information that needs to be updated; σ represents the sigmoid function; W * and b * These all represent the parameters learned by the model; This represents a new alternative scheme for updating the ECG waveform information of the input model using the tanh function; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer;

[0228] The third stage output gate determines which values ​​in the waveform of the ECG image to be classified are output, specifically: updating C. t-1 Become the new C t The rule is to use the forget gate to select and forget a portion of the old information, and the input gate to select and add candidate information. Part of it receives new information C t The formula is:

[0229]

[0230] Among them, f t Indicates the degree of forgetting of waveform information in the electrocardiogram image at the forgetting gate; C t-1 This represents the waveform information of the electrocardiogram image output from the previous layer; i t This indicates that the electrocardiogram (ECG) image information needs to be updated; This represents an alternative scheme for updating the ECG waveform information of the input model using a new method created by the tanh function.

[0231] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A deep learning-based electrocardiogram (ECG) image classification method, characterized in that, The method is as follows: Select an electrocardiogram image; Denoising preprocessing is performed on electrocardiogram images; Extract waveform feature points from the denoised electrocardiogram image; Classification is performed using support vector machine and linear regression models; Predicting electrocardiogram images to be classified using a long short-term memory model; The waveform feature points extracted from the denoised electrocardiogram image are as follows: R-wave extraction: The R-wave of the denoised waveform is detected and extracted using a fixed differential threshold analysis method with a scale of n. Extracting Q and S waves: After detecting and extracting the R wave, the positions of possible Q and S waves are pre-judged to determine whether there is a modulus maximum. The modulus maximum is located before and after the center of the R wave peak. The modulus maximum is corrected twice to obtain the final Q or S point. P-wave and T-wave extraction: P-wave and T-wave are extracted and detected using a slope threshold. The classification process using support vector machine and linear regression models is as follows: Support Vector Machine Model: In the MATLAB environment, the K-CV method is used to obtain the classification index, as follows: The electrocardiogram images are divided into K groups, one of which is used as the validation set and the remaining K-1 groups are used as the training set. The support vector machine model is trained to obtain K classifier models. Finally, the average classification accuracy of these K classifier models is used as the index. Linear Regression Model: A linear regression model was established using SPSS. Specifically, eight independent variables were selected, with the dependent variable being GROUP. "Input" was chosen as the regression method. Regression coefficients were used to represent the relationship between each independent variable and the dependent variable. The significance of the difference between the coefficients and 0 was represented by Sig. The specific expression for the linear regression model is as follows: GROUP=-0.581×V R -2.181×V P -0.89×V T -0.001×T RR +0.006×T QT -0.007×T PR +0.063×|V ST |+0.107×N P +0.296; Among them, V R Indicates the amplitude of the R wave; V P Indicates the P-wave amplitude; V T Indicates the amplitude of the T wave; T RR Indicates the RR interval; T QT T represents the QT interval; PR Indicates the PR interval; V ST Indicates the potential shift of segment ST; N P This indicates whether premature beats (PVCs) have occurred. If PVCs are present, then N... P =1; if no premature beats occur, then N P =0; Electrocardiogram (ECG) image classification, the formula is as follows: M = αS + βL; Where 0 < α < 1, 0 < β < 1 and α + β = 1, M represents the final classification model DSLM; S represents the SVM model; L represents the linear regression model; α and β are the coefficients of the SVM model and the linear regression model in DSLM, respectively. The coefficients in DSLM are obtained through multiple learning processes, specifically by comparing the accuracy of the parameters and selecting the parameter with the highest accuracy as the final parameter.

2. The deep learning-based electrocardiogram image classification method according to claim 1, characterized in that, The specific steps for denoising electrocardiogram (ECG) images are as follows: Wavelet Transform: After obtaining the original waveform of the electrocardiogram (ECG) image, wavelet basis functions are used to process the original waveform to obtain the waveform after wavelet transform. The formula is as follows: Where x represents the original waveform of the electrocardiogram image; y represents the waveform after wavelet basis function transformation; Denoising: The wavedec function in MATLAB is used to decompose the waveform after wavelet transform to obtain the denoised waveform. The formula is as follows: [C,L] = wavedec(E,3,coif5); Where [C,L]=wavedec(E,3,coif5) is the coif5 wavelet basis, which performs a 3-level decomposition on the waveform E after wavelet transform to obtain the denoised waveforms respectively; C represents each layer component; L represents the component length.

3. The deep learning-based electrocardiogram image classification method according to claim 1, characterized in that, The R-wave extraction is as follows: All extreme points on the denoised waveform are detected and sorted according to their amplitude; The threshold value is determined based on the magnitude of the amplitude: r% of the difference between the maximum and minimum amplitude values ​​is used as the threshold, i.e., the critical value. Compare all extreme points on the denoised waveform with the critical value to determine whether the extreme points on the denoised waveform are higher than the critical value: If so, it is predicted to be an R wave; After determining all extreme points on the denoised waveform, error detection and elimination of R-waves are performed: if the threshold is greater than the RR interval, the amplitudes of two adjacent R-waves are compared, the one with the higher amplitude is the R-wave, and the one with the lower amplitude is directly removed. After eliminating all R-waves, perform local micro-correction on the R-waves to obtain the R-waves with correct waveforms. The Q wave extraction is as follows: Before the predicted point is located, take the data 20ms in advance and set its coordinates as (x1, y1); Connect the predicted point with the peak of the R-wave using a straight line; where the coordinates of the R-wave peak are (x2, y2); the formula for the straight line is as follows: Calculate the distance from each modulus maximum point to the line, and the point with the farthest distance is the Q point after the first correction; the formula for the distance from a point to the line is as follows: The extraction of P waves and T waves is as follows: Find the point with the maximum modulus within a defined range; Calculate the modulus of the slope between points within a set range before and after the maximum point, and select the maximum value of the slope modulus. When the threshold is less than the maximum value of the slope modulus, the maximum value of the modulus is the peak of the P wave or T wave, and the corresponding baseline point is the start and end point of the P wave or T wave. At the same time, the amplitude and duration of the P wave or T wave can be calculated. When the threshold is greater than the maximum value of the slope, it means that there is no P wave or T wave in the waveform of the electrocardiogram image, and the amplitude and duration of the P wave are both 0.

4. The deep learning-based electrocardiogram image classification method according to claim 1, characterized in that, The Long Short-Term Memory (LSTM) model is used to predict the ECG images to be classified, as follows: Forget Gate: Determines which information in the waveform of the ECG image to be classified needs to be forgotten from the LSTM model; specifically, the sigmoid unit determines the information to be discarded from the waveform of the ECG image to be classified, and checks h t-1 and x t The information outputs a vector between 0 and 1, where the 0-1 values ​​represent the C of the LSTM model. t-1 How much of the information should be retained or discarded? 0 indicates no retention, and 1 indicates all information should be retained. The formula is: f t =σ(W f ·[h t-1 ,x t ]+b f ); Among them, f t Indicates the degree of forgetting of waveform information in an electrocardiogram image; σ represents the sigmoid function; W f b represents the weights generated by the model learning; f This represents the bias in model learning; W in the relevant LSTM model formula * and b * These all represent the parameters learned by the model; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer; Input gate: Determines which new information from the waveform of the ECG image to be classified is stored in the LSTM model. Specifically, it uses h... t-1 and x t The information to be added is determined by the input gate; h is used. t-1 and x t New candidate information that may be updated into the LSTM model is obtained through a tanh function layer. The formula is: i t =σ(W i ·[h t-1 ,x t ]+b i ); Among them, i t This represents the ECG image information that needs to be updated; σ represents the sigmoid function; W * and b * These all represent the parameters learned by the model; This represents a new alternative scheme for updating the ECG waveform information of the input model using the tanh function; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer; Output gate: Determines which values ​​in the waveform of the ECG image to be classified are output, specifically: updating C. t-1 Become the new C t The rule is to use the forget gate to select and forget a portion of the old information, and the input gate to select and add candidate information. Part of it receives new information C t The formula is: Among them, f t Indicates the degree of forgetting of waveform information in the electrocardiogram image at the forgetting gate; C t-1 This represents the waveform information of the electrocardiogram image output from the previous layer; i t This indicates that the electrocardiogram (ECG) image information needs to be updated; This represents an alternative scheme for updating the ECG waveform information of the input model using a new method created by the tanh function.

5. A deep learning-based electrocardiogram (ECG) image classification system, characterized in that, The system includes, The selection unit is used to select an electrocardiogram (ECG) image. The preprocessing unit is used to perform noise reduction preprocessing on the electrocardiogram images; The extraction unit is used to extract waveform feature points from the denoised electrocardiogram image; Classification units are used for classification using support vector machine and linear regression models; The prediction unit is used to predict the ECG images to be classified using a long short-term memory model; The extraction unit includes, The R-wave extraction module is used to detect and extract R-waves from denoised waveforms using a fixed differential threshold analysis method, with a scale of n. The Q-wave and S-wave extraction module is used to detect and extract the R-wave, and pre-judge the possible positions of the Q-wave and S-wave to determine whether there is a modulus maximum. The modulus maximum is located before and after the center of the R-wave peak. The modulus maximum is corrected twice to obtain the final Q-point or S-point. The P-wave and T-wave extraction module is used to extract and detect P-waves and T-waves using a slope threshold. The specific working process of the classification unit is as follows: (1) Support Vector Machine Model: In the MATLAB environment, the K-CV method is used to obtain the classification index, as follows: The electrocardiogram images are divided into K groups, one of which is used as the validation set and the remaining K-1 groups are used as the training set. The support vector machine model is trained to obtain K classifier models. Finally, the average classification accuracy of these K classifier models is used as the index. (2) Linear Regression Model: The linear regression model was established using SPSS. Specifically, eight independent variables were selected, with the dependent variable being GROUP. "Input" was selected as the regression method. The regression coefficients were used to represent the relationship between each independent variable and the dependent variable, and the significance of the difference between the coefficients and 0 was represented by Sig. The specific expression of the linear regression model is as follows: GROUP=-0.581×V R -2.181×V P -0.89×V T -0.001×T RR +0.006×T QT -0.007×T PR +0.063×|V ST |+0.107×N P +0.296; Among them, V R Indicates the amplitude of the R wave; V P Indicates the P-wave amplitude; V T Indicates the amplitude of the T wave; T RR Indicates the RR interval; T QT T represents the QT interval; PR Indicates the PR interval; V ST Indicates the potential shift of segment ST; N P This indicates whether premature beats (PVCs) have occurred. If PVCs are present, then N... P =1; if no premature beats occur, then N P =0; (3) Electrocardiogram image classification, the formula is as follows: M = αS + βL; Where 0 < α < 1, 0 < β < 1 and α + β = 1, M represents the final classification model DSLM; S represents the SVM model; L represents the linear regression model; α and β are the coefficients of the SVM model and the linear regression model in DSLM, respectively. The coefficients in DSLM are obtained through multiple learning processes, specifically by comparing the accuracy of the parameters and selecting the parameter with the highest accuracy as the final parameter.

6. The deep learning-based electrocardiogram image classification system according to claim 5, characterized in that, The preprocessing unit includes, The wavelet transform module is used to obtain the original waveform of the electrocardiogram (ECG) image, and then process the original waveform using wavelet basis functions to obtain the wavelet-transformed waveform. The formula is as follows: Where x represents the original waveform of the electrocardiogram image; y represents the waveform after wavelet basis function transformation; The denoising module uses the `wavedec` function in MATLAB to decompose the waveform after wavelet transform to obtain the denoised waveform. The formula is as follows: [C,L] = wavedec(E,3,coif5); Where [C,L]=wavedec(E,3,coif5) is the coif5 wavelet basis, which performs a 3-level decomposition on the waveform E after wavelet transform to obtain the denoised waveforms respectively; C represents each layer component; L represents the component length.

7. The deep learning-based electrocardiogram image classification system according to claim 5 or 6, characterized in that, The prediction unit's operation process includes three stages, as detailed below: The first stage, the forgetting gate, determines which information in the ECG image waveform to be classified needs to be forgotten from the LSTM model. Specifically, the sigmoid unit determines the information to be discarded from the ECG image waveform by checking h. t-1 and x t The information outputs a vector between 0 and 1, where the 0-1 values ​​represent the C of the LSTM model. t-1 How much of the information should be retained or discarded? 0 indicates no retention, and 1 indicates all information should be retained. The formula is: f t =σ(W f ·[h t-1 ,x t ]+b f ); Among them, f t Indicates the degree of forgetting of waveform information in an electrocardiogram image; σ represents the sigmoid function; W f b represents the weights generated by the model learning; f This represents the bias in model learning; W in the relevant LSTM model formula * and b * These all represent the parameters learned by the model; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer; The second stage, the input gate, determines which new information from the waveform of the ECG image to be classified is stored in the LSTM model. Specifically, it uses h... t-1 and x t The information to be added is determined by the input gate; h is used. t-1 and x t New candidate information that may be updated into the LSTM model is obtained through a tanh function layer. The formula is: i t =σ(W i ·[h t-1 ,x t ]+b i ); Among them, i t This represents the ECG image information that needs to be updated; σ represents the sigmoid function; W * and b * These all represent the parameters learned by the model; This represents a new alternative scheme for updating the ECG waveform information of the input model using the tanh function; x t This represents information from the electrocardiogram (ECG) image waveform of the input model; h t-1 This indicates the output of the previous layer; The third stage output gate determines which values ​​in the waveform of the ECG image to be classified are output, specifically: updating C. t-1 Become the new C t The rule is to use the forget gate to select and forget a portion of the old information, and the input gate to select and add candidate information. Part of it receives new information C t The formula is: Among them, f t Indicates the degree of forgetting of waveform information in the electrocardiogram image at the forgetting gate; C t-1 This represents the waveform information of the electrocardiogram image output from the previous layer; i t This indicates that the electrocardiogram (ECG) image information needs to be updated; This represents an alternative scheme for updating the ECG waveform information of the input model using a new method created by the tanh function.

Citation Information

Patent Citations

  • Electrocardiogram anomaly recognition method and system based on combination of AlexNet and transfer learning

    CN112006678A

  • Apparatus for disgnosis sign st segment and twave of electrocardiogram signal

    KR1019980030894A