CN114118226A - ECG data classification method based on time convolution network model - Google Patents
ECG data classification method based on time convolution network model Download PDFInfo
- Publication number
- CN114118226A CN114118226A CN202111293471.2A CN202111293471A CN114118226A CN 114118226 A CN114118226 A CN 114118226A CN 202111293471 A CN202111293471 A CN 202111293471A CN 114118226 A CN114118226 A CN 114118226A
- Authority
- CN
- China
- Prior art keywords
- network model
- convolution network
- time convolution
- ecg data
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2413—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on distances to training or reference patterns
- G06F18/24133—Distances to prototypes
- G06F18/24137—Distances to cluster centroïds
- G06F18/2414—Smoothing the distance, e.g. radial basis function networks [RBFN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/048—Activation functions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Health & Medical Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)
Abstract
The invention discloses an ECG data classification method based on a time convolution network model, which specifically comprises the following steps: acquiring ECG data from a plurality of ECG databases to form an electrocardiogram sample set, and preprocessing the ECG data in the electrocardiogram sample set; constructing a time convolution network model, and setting hyper-parameters of the time convolution network model: learning rate, sample training batch times, threshold value, iteration times and discarding rate; training the time convolution network model by adopting the preprocessed ECG data, and reserving the optimal parameters of the time convolution network model; testing the trained time convolution network model; and acquiring the ECG data to be classified, and classifying the ECG data to be classified by adopting a time convolution network model to obtain a classification result. The time convolution network model avoids the problem of explosion or vanishing gradient which often appears in the recurrent neural network RNN, and meanwhile, under the condition of processing data sets with the same scale, the time convolution network model has higher data classification efficiency.
Description
Technical Field
The invention belongs to the technical field of ECG data classification, and particularly relates to an ECG data classification method based on a time convolution network model.
Background
The information society, the internet of things, big data, cloud computing and other technologies are rapidly developed. The small intelligent wearable equipment and the large factory machine work are implemented by handing the programmed algorithm to the chip through program design. However, in the face of more and more new challenges and demands, processing such as image recognition, physiological signal processing, etc. cannot be satisfied in some high-end technical fields by only relying on algorithm programs.
Deep learning has emerged to address these challenges that cannot be addressed by established logic rules. The electrocardiogram data, as a common physiological signal, can develop a popular research field for rapidly and accurately classifying the electrocardiogram data, and has a pioneering significance for building landing applications in the future.
However, the deep learning model currently classifies ECG data, and the following problems exist:
on one hand, when the data set is large in scale, the occupied hardware resources are more: when the existing sequence model processes a large-scale data set, a large amount of memories are needed to store partial intermediate calculation results of a plurality of unit gates of the existing sequence model, so that the load of a computer is heavy, and the calculation cost cannot be effectively controlled.
On the other hand, the classification efficiency is not high enough: when the existing model classifies the electrocardiogram data, a plurality of learning steps are often needed to extract useful data characteristics, so that useful information can be transmitted, and finally the model can make effective judgment. Therefore, the computer can analyze the signal for too long time to cause the classification efficiency to become slow, and more data cannot be classified in a limited time, so that the superiority of the classification algorithm cannot be reflected.
Disclosure of Invention
Aiming at the problems of large scale, large occupied hardware resources and low classification efficiency of the existing data set, the invention provides the ECG data classification method based on the time convolution network model, which optimizes the time convolution network model, establishes the deep learning model for automatically classifying the ECG data, can reduce the occupation of computing resources and improve the classification efficiency.
In order to solve the above problems, the present invention adopts the following technical solutions.
A method for classifying ECG data based on a time convolution network model comprises the following steps:
s1: acquiring ECG data from a plurality of ECG databases to form an electrocardiogram sample set, and preprocessing the ECG data in the electrocardiogram sample set;
s2: constructing a time convolution network model, and setting hyper-parameters of the time convolution network model: learning rate, sample training batch times, threshold value, iteration times and discarding rate;
s3: training the time convolution network model constructed in the S2 by using the ECG data preprocessed in the S1, and reserving the optimal parameters of the time convolution network model;
s4: testing the trained time convolution network model in the S3;
s5: and acquiring the ECG data to be classified, and classifying the ECG data to be classified by adopting the trained time convolution network model in S3 to obtain a classification result.
In a further technical solution, in S1, the step of preprocessing the electrocardiogram sample set is:
s101, ECG data with sampling rates of 250Hz and 360Hz are obtained from an ECG database to form an electrocardiogram sample set, wherein the 250Hz ECG data are re-sampled at a sampling frequency of 360Hz, and the sampling frequency of the ECG data in the electrocardiogram sample set is ensured to be 360 Hz;
s102, cutting ECG data in an electrocardiogram sample set into heartbeat data segments with the length of 10 seconds;
s103, re-labeling the heartbeat data segments according to the standard heartbeat type, and deleting heartbeat data segments which do not belong to the standard heartbeat type; wherein the standard heartbeat types include: normal pulsation, supraventricular ectopic pulsation, ventricular ectopic pulsation, fusion beat and unclassifiable beat, wherein the label of the normal pulsation is N, the label of the supraventricular ectopic pulsation is S, the label of the ventricular ectopic pulsation is V, the label of the fusion beat is F, and the label of the unclassifiable beat is Q.
In a further technical scheme, in S2, the time convolution network model is constructed by the following steps:
s201, building a model: the time convolution network model comprises a plurality of residual error units and a sigmoid active layer which are sequentially connected, wherein each residual error unit comprises two basic blocks which are sequentially connected, and each basic block comprises an expansion convolution layer, a batch normalization layer, a ReLU active layer and a discarding layer which are sequentially connected;
s202, setting hyper-parameters: the learning rate was set to 0.0001, the number of sample training batches was set to 100, the threshold was 0.65, the number of iterations was set to 500, and the discard rate was set to 0.01.
In a further technical scheme, in S3, the training step of the time convolution network model is:
s301, disordering the heartbeat data segments in the S103 with the labels corresponding to the heartbeat data segments, dividing 90% of heartbeat data into a training set, and taking the remaining 10% of heartbeat data as a test set;
s302, inputting the training set into a time convolution network model for training, and reserving the optimal parameters of the time convolution network model.
In a further technical scheme, the trained time convolution network model is tested by adopting the test set in S301, and the accuracy rate of time convolution network model classification is greater than or equal to 96%.
Compared with the prior art, the invention has the beneficial effects that:
(1) the invention provides an improved ECG data classification method based on a time convolution network model, the time directions of the back propagation path and the sequence of a time convolution network TCN are different, and the problem of gradient explosion or gradient disappearance frequently appearing in a recurrent neural network RNN is avoided; under the condition of processing the data sets with the same scale, the time convolution network model classification method is higher in efficiency and suitable for data classification of large-scale data sets.
(2) The invention provides an improved ECG data classification method based on a time convolution network model, wherein a batch normalization layer is used for replacing a weight normalization layer, so that the convergence rate of model loss is accelerated; the time convolution network provides more flexibility for changing the size of the receptive field, and the memory length of the model can be better controlled mainly by stacking more convolution layers, using larger expansion coefficient and increasing the size of the filter.
(3) The invention provides an improved ECG data classification method based on a time convolution network model, which still keeps higher classification accuracy rate under the condition of using a plurality of databases with unbalanced data distribution, and the average accuracy rate is maintained to be more than 96%.
Drawings
FIG. 1 is a schematic diagram of a time convolutional network model according to the present invention;
fig. 2 is a schematic structural diagram of a residual error unit according to the present invention.
Detailed Description
The invention is further described with reference to specific embodiments and the accompanying drawings.
Examples
An ECG data classification method based on a time convolution Network model is disclosed, as shown in fig. 1, the present application utilizes a modified time convolution Network (Temporal relational Network) to build a deep learning model for automatically classifying ECG data. The model-dependent causal convolution requires a prediction of time t, ytOnly by input x before time t1To xt-1And judging to ensure that future information is not leaked to the past. The invention mainly comprises the following steps:
step 1, ECG data preprocessing:
1.1, acquiring ECG data in an MIT-BIH arrhythmia database, an MIT-BIH ST Change database, an European ST-T electrocardio database and a sudden cardiac death dynamic electrocardio database to form an electrocardiogram sample set. The sampling rates of the MIT-BIH arrhythmia database and the MIT-BIH ST Change database are both 360Hz, so the ECG data in the MIT-BIH arrhythmia database and the MIT-BIH ST Change database can be directly used. The sampling frequency of the European ST-T electrocardio database and the sudden cardiac death dynamic electrocardio database is 250Hz, and the sampling frequency of the ECG data in the electrocardiogram sample set is ensured to be 360Hz by resampling through a WFDB (waveform database) tool kit.
1.2, cutting the electrocardiogram sample set in 1.1 into data segments with the unit of 10 seconds, the recording lengths of database signals with different lengths may not be consistent, so that the databases need to be merged and the data needs to be cut into a uniform length.
1.3, re-labeling the cut 10-second data segment:
standard heartbeat types can be divided into five major categories: normal beats (N), supraventricular ectopic beats (S), ventricular ectopic beats (V), fusion beats (F), and unclassifiable beats (Q). And re-labeling the cut data fragments and classifying the data fragments into the five classes, and deleting the data which are not in the five classes.
If the data tag contains repeated tags, the data tag is recorded only once and all the tags are put into a list set as the subset of the segment tags. For example, if a 10-second segment corresponds to 15 heartbeats and there are 5N, 3S and 7V heartbeats, we label the segment of heartbeat data with a new label [ N, S, V ]. If a certain 10-second heartbeat corresponds to 14 heartbeats and is all N types, a new label [ N ] is marked on the data. Due to the problems of sampling rate and segmentation, each segment is uniform in length of 10 seconds, but the number of heartbeats is not exactly the same. During training, the labels are encoded using the multilabel interface of the sklern toolkit.
Step 2, building a time convolution network model, initializing a hyper-parameter of the time convolution network model:
2.1, building a time convolution network model
As shown in FIG. 1, the overall architecture of the time convolution network model is five residual error units and one layer of sigmoid activated layer dependent secondary connection. As shown in fig. 2, one residual unit includes two basic blocks: the device comprises a basic block 1 and a basic block 2, wherein the basic block comprises an expansion convolution layer, a batch normalization layer, a ReLU activation layer and a discarding layer which are connected in sequence.
The method is characterized in that a layer jump connection is used in a residual error unit, a feature diagram of a lower layer is directly connected to an upper layer in a layer jump manner, one part of electrocardiogram data passes through a basic block 1 and a basic block 2, and the other part of electrocardiogram data directly skips the basic block 1 and the basic block 2, so that the channel numbers corresponding to the two data are possibly inconsistent, and therefore, in order to ensure that the channel numbers are the same when the upper layer and the lower layer are summed, the matrix shape converted from the two electrocardiogram data is the same by carrying out element combination through 1 x 1 convolution. The concept of upper and lower layers is generalized, as shown in fig. 1 and 2, the arrow indicates the lower layer, the upper and lower layers are relative, and the base block 2 is the lower layer of the base block 1. Inside the basic block, the expansion convolution layer, the batch normalization layer, the ReLU active layer, and the discard layer also apply to the concept of the upper and lower layers, i.e., the expansion convolution layer is the uppermost layer, and the lower layer is the batch normalization layer, the ReLU active layer, and the discard layer in this order.
2.2, setting hyper-parameters of the time convolution network model: the learning rate is 0.0001, the sample training batch number is 100, the threshold value is 0.65, the iteration number is 500, and the discarding rate of the discarding layer is 0.01, so that overfitting of the model is prevented.
The optimizer used in training is adaptive moment estimation (Adam) to allow the model to converge faster and better when losses are calculated. The loss function is cross entropy and is used for measuring the difference between the actual value of the label and the predicted value of the model, and the smaller the loss function is, the closer the predicted value of the representative model is to the actual value, the better the performance of the model is. The activation function uses sigmoid, whose role is to map real values between 0 and 1. And (3) judging output according to a threshold value by prediction, wherein the output 1 is greater than or equal to the threshold value, the output 0 is less than the threshold value, and each bit of output is combined into a prediction label set. And finally comparing with the correct label. And (4) counting and predicting the correct number, comparing the total amount of the tags, and calculating the accuracy.
Step 3, inputting ECG data into a time convolution network model for training, and reserving the optimal parameter test of the model:
3.1, in order to enable the model to learn the relation among the time series of the input heartbeat segments more comprehensively, all data need to be disorderly in sequence after mixing, and the corresponding labels need to be disorderly in the same sequence.
3.2, dividing 90% of data obtained by preprocessing in the step 1 into training sets by using a leave-out method, and using the rest 10% of data as a test set. And writing the divided data sets into a training data set, a testing data set, a training label set and a testing label set respectively so as to ensure that the data sets used before and after the multiple experiments are consistent and to facilitate parameter adjustment.
And 3.3, inputting the data of the training set into the built time convolution network model for training, adjusting the super parameters of the time convolution network, such as the learning rate, the discarding rate, the threshold value and the like, and observing the performance change of the model so as to obtain the optimal parameters of the model.
3.4, after the model is trained, the finally obtained optimal parameters are reserved, the optimal parameters are input into a test set to test the time convolution network model, the accuracy of the time convolution network model on the classification of the ECG data in the test set is greater than or equal to 96%, and the accuracy of the time convolution network model on the classification of the ECG data is verified.
And 4, acquiring the ECG data to be classified, and classifying the ECG data to be classified by adopting the time convolution network model obtained by training in the step 3 to obtain a classification result.
The examples described herein are merely illustrative of the preferred embodiments of the present invention and do not limit the spirit and scope of the present invention, and various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the design concept of the present invention shall fall within the protection scope of the present invention.
Claims (5)
1. A method for classifying ECG data based on a time convolution network model is characterized by comprising the following steps:
s1: acquiring ECG data from a plurality of ECG databases to form an electrocardiogram sample set, and preprocessing the ECG data in the electrocardiogram sample set;
s2: constructing a time convolution network model, and setting hyper-parameters of the time convolution network model: learning rate, sample training batch times, threshold value, iteration times and discarding rate;
s3: training the time convolution network model constructed in the S2 by using the ECG data preprocessed in the S1, and reserving the optimal parameters of the time convolution network model;
s4: testing the trained time convolution network model in the S3;
s5: and acquiring the ECG data to be classified, and classifying the ECG data to be classified by adopting the trained time convolution network model in S3 to obtain a classification result.
2. The method of claim 1 for classifying ECG data based on a time convolution network model, wherein: in S1, the step of preprocessing the electrocardiogram sample set comprises:
s101, acquiring ECG data with sampling rates of 250Hz and 360Hz from an ECG database to form an electrocardiogram sample set, wherein the 250Hz ECG data is resampled at a sampling frequency of 360 Hz;
s102, cutting ECG data in an electrocardiogram sample set into heartbeat data segments with the length of 10 seconds;
s103, re-labeling the heartbeat data segments according to standard heartbeat type division, and deleting the labels which do not belong to the standard types and the corresponding heartbeat data segments; wherein the standard heartbeat types include: normal pulsation, supraventricular ectopic pulsation, ventricular ectopic pulsation, fusion beat and unclassifiable beat, wherein the label of the normal pulsation is N, the label of the supraventricular ectopic pulsation is S, the label of the ventricular ectopic pulsation is V, the label of the fusion beat is F, and the label of the unclassifiable beat is Q.
3. The method of claim 2 for classifying ECG data based on a time convolution network model, wherein: in S2, the time convolution network model is constructed by the steps of:
s201, building a model: the time convolution network model comprises a plurality of residual error units and a sigmoid active layer which are sequentially connected, wherein each residual error unit comprises two basic blocks which are sequentially connected, and each basic block comprises an expansion convolution layer, a batch normalization layer, a ReLU active layer and a discarding layer which are sequentially connected;
s202, setting hyper-parameters: the learning rate was set to 0.0001, the number of sample training batches was set to 100, the threshold was 0.65, the number of iterations was set to 500, and the discard rate was set to 0.01.
4. The method of claim 3 for classifying ECG data based on a time convolution network model, wherein: in S3, the training step of the time convolution network model is:
s301, disordering the heartbeat data segments in the S103 with the labels corresponding to the heartbeat data segments, dividing 90% of heartbeat data into a training set, and taking the remaining 10% of heartbeat data as a test set;
s302, inputting the training set into a time convolution network model for training, and reserving the optimal parameters of the time convolution network model.
5. The method of claim 4 for classifying ECG data based on a time convolution network model, wherein: and testing the trained time convolution network model by adopting the test set in the S301, wherein the accuracy rate of the time convolution network model classification is greater than or equal to 96%.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111293471.2A CN114118226A (en) | 2021-11-03 | 2021-11-03 | ECG data classification method based on time convolution network model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111293471.2A CN114118226A (en) | 2021-11-03 | 2021-11-03 | ECG data classification method based on time convolution network model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114118226A true CN114118226A (en) | 2022-03-01 |
Family
ID=80380379
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111293471.2A Pending CN114118226A (en) | 2021-11-03 | 2021-11-03 | ECG data classification method based on time convolution network model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114118226A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114372538A (en) * | 2022-03-22 | 2022-04-19 | 中国海洋大学 | Method for convolution classification of scale vortex time series in towed sensor array |
-
2021
- 2021-11-03 CN CN202111293471.2A patent/CN114118226A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114372538A (en) * | 2022-03-22 | 2022-04-19 | 中国海洋大学 | Method for convolution classification of scale vortex time series in towed sensor array |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200337580A1 (en) | Time series data learning and analysis method using artificial intelligence | |
KR102455662B1 (en) | Method for predicting chronic disease based on ecg signal | |
CN110974214A (en) | Automatic electrocardiogram classification method, system and equipment based on deep learning | |
CN110502277B (en) | Code bad smell detection method based on BP neural network | |
CN110532880B (en) | Sample screening and expression recognition method, neural network, device and storage medium | |
CN113177357B (en) | Transient stability assessment method for power system | |
US11593942B2 (en) | Fully convolutional genetic neural network method for segmentation of infant brain record images | |
CN113871009A (en) | Sepsis prediction system, storage medium and apparatus in intensive care unit | |
CN112270240A (en) | Signal processing method and device, electronic equipment and storage medium | |
CN113570039A (en) | Optimized consensus block chain system based on reinforcement learning | |
CN116386899A (en) | Graph learning-based medicine disease association relation prediction method and related equipment | |
CN114118226A (en) | ECG data classification method based on time convolution network model | |
Rakhimov et al. | Artificial intelligence in medicine for chronic disease classification using machine learning | |
CN115185804A (en) | Server performance prediction method, system, terminal and storage medium | |
CN113705715B (en) | Time sequence classification method based on LSTM and multi-scale FCN | |
CN111062511A (en) | Aquaculture disease prediction method and system based on decision tree and neural network | |
CN108829846A (en) | A kind of business recommended platform data cluster optimization system and method based on user characteristics | |
CN110613445B (en) | DWNN framework-based electrocardiosignal identification method | |
CN113679393B (en) | ECG data feature generation model based on contrast predictive coding | |
CN115116619A (en) | Intelligent analysis method and system for stroke data distribution rule | |
Chen et al. | Heart Disease Prediction Method Based On ANN | |
CN108399369B (en) | Electrocardio beat classification method based on distributed computation and deep learning | |
CN112348275A (en) | Regional ecological environment change prediction method based on online incremental learning | |
Liu et al. | SSRNAS: Search Space Reduced One-shot NAS by a Recursive Attention-based Predictor with Cell Tensor-flow Diagram | |
CN115211866B (en) | Arrhythmia classification method and system and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |