CN109948647B - Electrocardiogram classification method and system based on depth residual error network - Google Patents

Electrocardiogram classification method and system based on depth residual error network Download PDF

Info

Publication number
CN109948647B
CN109948647B CN201910067775.3A CN201910067775A CN109948647B CN 109948647 B CN109948647 B CN 109948647B CN 201910067775 A CN201910067775 A CN 201910067775A CN 109948647 B CN109948647 B CN 109948647B
Authority
CN
China
Prior art keywords
data
residual error
electrocardiogram
layer
error network
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.)
Active
Application number
CN201910067775.3A
Other languages
Chinese (zh)
Other versions
CN109948647A (en
Inventor
钱步月
李晓宇
刘涛
陈思睿
李安
林佳亮
刘璇
吕欣
郑庆华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Jiaotong University
Original Assignee
Xian Jiaotong University
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xian Jiaotong University filed Critical Xian Jiaotong University
Priority to CN201910067775.3A priority Critical patent/CN109948647B/en
Publication of CN109948647A publication Critical patent/CN109948647A/en
Application granted granted Critical
Publication of CN109948647B publication Critical patent/CN109948647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses an electrocardiogram classification method and system based on a depth residual error network, which comprises the following steps: acquiring marked electrocardiogram data to obtain electrocardiogram sample data, category labels and key waveform labels; integrating the three and the corresponding relation among the three into a data set; the data set comprises a training set and a verification set; constructing a basic depth residual error network, and constructing branches for reconstructing key waveform positions at preset positions of a main network of the basic depth residual error network; the branch comprises: convolutional layers and Sigmoid layers; after training, obtaining a well-trained depth residual error network model with branches; and classifying the electrocardiogram data to be classified and detected through the trained model. According to the invention, the new branch is introduced into the deep residual error network to detect the key waveform, so that the model can pay more attention to the key waveform of the electrocardiogram, the interpretability and the performance are improved, and the classification data output to a doctor has higher reference value.

Description

Electrocardiogram classification method and system based on depth residual error network
Technical Field
The invention belongs to the technical field of electrocardiogram classification, and particularly relates to an electrocardiogram classification method and system based on a deep residual error network.
Background
In the classification of electrocardiogram, the traditional method based on manual characteristics needs deep participation of cardiologist in practice, the selection of characteristics depends heavily on professional medical knowledge, and complicated fine adjustment is needed. In recent years, a series of end-to-end deep learning models are increasingly emphasized in the classification of electrocardiogram, and with the increase of the data volume of electrocardiogram, the data volume reaches the level of common experts from the aspect of performance. However, such a model cannot be directly applied, because the deep learning model driven by data only has a significant problem: as a black box model, it is difficult to make a reasonable interpretation of the results. In addition, in the current electrocardiogram classification method based on the depth residual error network, the adopted depth residual error network lacks prior knowledge in the medical field, and the classification accuracy is low under the condition of less sample size.
For example, document 1 provides a referable technical solution for electrocardiogram classification based on a deep residual network:
document 1.Rajpurkar P, Hannun a Y, haghpahi M, et al, cardiologist-Level Arrhythmia Detection with connected Neural Networks [ J ].2017, document 1 proposes to use a depth residual network to solve the problem of classification of electrocardiograms and declares that the expert Level is reached. The authors of this document collected electrocardiographic data of 29163 patients, containing 14 classes of arrhythmias, providing a data basis for training of a deep residual network. Technically, based on the deep residual network proposed by the method of nakamm, a residual network with 34 layers is constructed for a data set. In addition to calculating the F1 value of the model in the test set, a group of intracardiac experts is provided for judging the results of the test set to calculate the F1 value of the intracardiac experts, and the model performance is found to be higher than that of the intracardiac experts.
However, the method described in document 1 has two significant problems in application: firstly, as a deep learning model driven by data only, the discrimination mode learned by the model is not matched with the doctor discrimination mode, and the model result is difficult to be understood and utilized by the doctor; secondly, the performance of the deep residual error network is poor when the data quantity is insufficient. In practical application, experts require that the model reaches an application level in interpretability and performance, which cannot be guaranteed by the pure depth residual model in document 1.
Disclosure of Invention
The invention aims to provide an electrocardiogram classification method and system based on a deep residual error network, so as to solve the existing technical problems. According to the invention, the new branch is introduced into the deep residual error network to detect the key waveform, so that the model can pay more attention to the key waveform of the electrocardiogram, the interpretability and the performance are improved, and the classification data output to a doctor has higher reference value.
In order to achieve the purpose, the invention adopts the following technical scheme:
an electrocardiogram classification method based on a depth residual error network comprises the following steps:
s1, sample data preprocessing: acquiring a preset number of marked electrocardiogram data, and preprocessing to obtain electrocardiogram sample data and category labels which are used as model training input; extracting a key waveform position according to electrocardiogram sample data to obtain a key waveform label; integrating electrocardiogram sample data, category labels, key waveform labels and corresponding relations among the electrocardiogram sample data, the category labels and the key waveform labels into a data set; dividing a data set into a training set and a verification set according to a preset proportion;
s2, constructing a depth residual error network model with branches: constructing a basic depth residual error network, and constructing branches for reconstructing key waveform positions at preset positions of a main network of the basic depth residual error network; the branch comprises: convolutional layers and Sigmoid layers; in the training process of the depth residual error network model with branches, calculating a classification loss function through the constructed basic depth residual error network, calculating a loss function of waveform detection through the constructed branches, and obtaining a final loss function according to the calculated classification loss function and the loss function of the waveform detection;
s3, setting batch processing quantity and initial learning rate, and training the depth residual error network model with branches constructed in the step S2 through the training set obtained in the step S1; verifying the trained deep residual error network model with the branches through the verification set obtained in the step S1, and finishing the training when the loss function of the verification set reaches the preset convergence condition to obtain the trained deep residual error network model with the branches;
and S4, inputting the electrocardiogram data to be classified and detected into the trained depth residual error network model with branches obtained in the step S3, and outputting an electrocardiogram classification result by the model.
Further, in step S1, the key waveform includes one or both of a P-wave and an R-wave.
Further, the preprocessing in step S1 includes: normalizing, filtering and denoising the acquired electrocardiogram data;
the method specifically comprises the following steps: the collected electrocardiogram data are filled to a uniform preset length for normalization, and then the electrocardiogram data are sequentially passed through a low-pass filter and a high-pass filter to filter noise signals.
Further, in the basic depth residual network model constructed in step S2: after entering the model, the data sequentially passes through a convolution layer, a batch normalization layer and a ReLU activation layer; then, the data are divided into two parts, one part is directly processed by a maximum pooling layer, the other part is sequentially processed by a convolution layer, a batch normalization layer, a ReLU activation layer, a Dropout layer, a convolution layer and a maximum pooling layer, the two parts of data obtained after processing are added together and are sequentially processed by a preset number of convolution blocks, and the processed data are sequentially processed by a batch processing layer, a ReLU activation layer, a full connection layer and a Softmax layer and then output; the input end of the winding layer of the branch is connected with the output end of the winding block at the preset position of the backbone network.
Furthermore, the input data of the volume block is divided into two branches; one branch is processed by only one maximum pooling layer, the other branch is processed by one maximum pooling layer after sequentially passing through a preset number of convolution layers, batch normalization layers, ReLU activation layers and Dropout layers, and the data processed by the two branches are added together to be used as the output of the convolution block.
Further, the calculation formula of the classification loss function is:
Figure BDA0001956282260000031
in the formula, S is a preprocessed electrocardiogram sequence, Y is a category label, p () function is a probability of predicting that the current electrocardiogram belongs to a certain category, and N is the number of categories.
Further, in step S2, a branch is respectively introduced into two preset positions of the backbone network of the constructed basic depth residual error network, a convolution layer and a Sigmoid layer are respectively connected behind each branch, the number of neurons in the convolution layer is set to 2, the Sigmoid layer outputs a three-dimensional tensor (b, f, 2), b represents the batch processing number, f represents the feature map length, 2 represents the tensor to predict a bigram (x, c), x is the relative position of the vertex of the key waveform, and c is the probability of the key waveform.
Further, the calculation formula of the loss function of the waveform detection is:
Figure BDA0001956282260000041
in the formula, S is an electrocardiogram sequence after pretreatment, X represents a key waveform position label, and C represents a confidence label; lambda [ alpha ]coordDenotes the coefficient for regression of the relative coordinates of x, λnoobjA coefficient representing a result of the prediction calculated for the grid without the object, for controlling a ratio of contribution of the positive and negative examples to the result;
Figure BDA0001956282260000042
and
Figure BDA0001956282260000043
respectively indicating that the value is 1 when the object exists or does not exist, and otherwise, the value is 0;
Figure BDA0001956282260000044
and
Figure BDA0001956282260000045
respectively representing the true relative position and true confidence, x, of the predicted objectiAnd ciRespectively representing the relative position and confidence of the object predicted by the current model.
Further, the key waveforms include P-wave and R-wave, and the final loss function is calculated as:
Figure BDA0001956282260000046
in the formula, XPIndicating P-wave key location tag, XRA key position label representing R wave; c denotes the confidence label of the P-wave, CRRepresenting the confidence label of the R-wave.
An electrocardiogram classification system based on a depth residual error network, comprising:
the sample data preprocessing module is used for acquiring and acquiring a preset number of marked electrocardiogram data, and preprocessing the electrocardiogram data to obtain electrocardiogram sample data and category labels which are used as model training input; extracting a key waveform position according to electrocardiogram sample data to obtain a key waveform label; the electrocardiogram data acquisition system is used for integrating electrocardiogram sample data, category labels, key waveform labels and corresponding relations among the electrocardiogram sample data, the category labels and the key waveform labels into a data set, and dividing the data set into a training set and a verification set according to a preset proportion;
the device comprises a depth residual error network model building module with branches, a data processing module and a data processing module, wherein the depth residual error network model building module is used for building a basic depth residual error network and then building branches for reconstructing key waveform positions at preset positions of a main network; the branch comprises: convolutional layers and Sigmoid layers; in the training process of the depth residual error network model with branches, calculating a classification loss function through the constructed basic depth residual error network, calculating a loss function of waveform detection through the constructed branches, and obtaining a final loss function according to the calculated classification loss function and the loss function of the waveform detection;
the training verification module is used for setting batch processing quantity and initial learning rate and training the constructed depth residual error network model with branches through a training set; verifying the trained deep residual error network model with the branches through the obtained verification set, and finishing training when the loss function of the verification set reaches a preset convergence condition to obtain the trained deep residual error network model with the branches;
and the input and output module is used for inputting the electrocardiogram data to be classified and detected into a trained depth residual error network model with branches, and the model outputs an electrocardiogram classification result.
Compared with the prior art, the invention has the following beneficial effects:
the deep residual error network comprises a trunk and branches, the trunk network is used for detection and classification, and the introduced new branches are used for detecting key waveforms, so that the model can pay more attention to the key waveforms of the electrocardiogram, the interpretability and the performance can be improved, and classification result data output to doctors have higher reference value.
Further, the key waveforms include one or both of P-waves and R-waves, which is more beneficial for atrial fibrillation classification.
Furthermore, an object detection method in the field of two-dimensional image recognition is adopted to detect the key waveform, and the position of the key waveform can be accurately obtained.
The system can complete electrocardiogram classification, and the key waveforms are detected by introducing new branches into the deep residual error network, so that a system model can pay more attention to the key waveforms of the electrocardiogram, the interpretability and the performance of data output to a doctor can be improved, and the output classified data has higher reference value.
Drawings
FIG. 1 is a schematic block diagram of a model training process in the present invention;
FIG. 2 is a schematic block diagram of a depth residual error network structure for fusing expertise in the present invention;
FIG. 3 is a block diagram illustrating the structure of a convolution block in the present invention;
FIG. 4 is a schematic diagram of a waveform position detection method according to the present invention.
Detailed Description
In order to more clearly illustrate the technical solution of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
Referring to fig. 1, a method for classifying an electrocardiogram based on a deep residual error network according to the present invention includes the following steps:
step1, data preprocessing.
And acquiring electrocardiogram data, and supplementing all the acquired electrocardiogram data to a uniform length for normalization. Then, denoising is performed by using a general filtering technique, for example, a 5Hz low-pass filter and a 41Hz high-pass filter are sequentially passed to filter noise signals, and the electrocardiogram data after passing through the filters is used as the input of the model. The acquired electrocardiogram data comprises electrocardiogram sample data, classification labels and a corresponding relation between the electrocardiogram sample data and the classification labels.
The electrocardiogram data input as model training is used as a label of a subsequent reconstruction task by extracting the position of a key waveform from the electrocardiogram data by using a traditional medical detection method, wherein the key waveform is one or two of a P wave and an R wave. The data sets were classified as 8:1:1 or 7:2:1 into training, validation and test sets.
And 2, constructing a model.
Referring to fig. 2 and fig. 3, a basic deep residual network is constructed, and then a new branch is constructed on the backbone network to reconstruct the key waveform position, and the final network structure is shown in fig. 2.
Step 1: the method specifically comprises the steps that the deep residual error network is formed by a series of network layers, after data enter a model, the data sequentially pass through a convolutional layer (Conv), a batch normalization layer (BN) and a ReLU activation layer (ReLU), then are divided into two parts, and one part directly passes through a Max pooling layer (Max pooling), and the other part passes through a series of layers and then is added together. This is followed by a series of convolutional blocks (Conv blocks), each of which consists of two branches, one of which passes through only one max pooling layer, the other of which passes through a series of levels and then a max pooling layer, and then the two branches are added together as the output of the convolutional Block. In order to guarantee the depth of the hierarchy, here the largest pooling layer among the volume blocks only occurs in an odd number of volume blocks. Finally, these volume blocks are followed by a batch layer, a ReLU activation layer, a full connectivity layer (Dense) and a Softmax layer, calculated using the output of the Softmax layer, where the classification loss function is calculated:
Figure BDA0001956282260000071
where S is the input electrocardiogram sequence, Y is the class label, the p () function is the probability of predicting the current electrocardiogram belonging to a class, and N is the number of classes.
In a specific embodiment, we set the convolutional neurons to 64 lengths and 64 k counts, where k is initially 1 and increases by 1 after every 4 convolutional blocks, and set all convolutional kernel lengths to 16, and the maximum pool convolutional layer length and interval to 2.
Step 2: branches introducing expertise are added. Specifically, a new branch is respectively introduced into two specific positions in the network, and a convolution layer and a Sigmoid layer are respectively connected after the branch, and are respectively used for P waves and R waves.
Referring to fig. 4, in the embodiment of the present invention, the number of neurons in the convolutional layers of the two branches is set to 2, and finally, a three-dimensional tensor (b, f, 2) is obtained, where b represents the number of batches, f represents the feature map length, and 2 represents the tensor to predict a bigram (x, c), and based on the linear mapping relationship of the convolutional neural network, it is equivalent to regard an original electrocardiogram input as f grids, and predict the probability c of occurrence of a key waveform in the grid and the relative position x of a vertex of the key waveform in the grid in each grid, so as to calculate the loss function of the waveform detection task:
Figure BDA0001956282260000081
in the formula, S represents original input, X represents a waveform position label, and C represents a confidence label; lambda [ alpha ]coordDenotes the coefficient for regression of the relative coordinates of x, λnoobjA coefficient representing a result of the prediction calculated for the grid without the object, for controlling a ratio of contribution of the positive and negative examples to the result;
Figure BDA0001956282260000082
and
Figure BDA0001956282260000083
respectively indicating that the value is 1 when the object exists or does not exist, and otherwise, the value is 0;
Figure BDA0001956282260000085
and
Figure BDA0001956282260000086
respectively representing the true relative position and true confidence, x, of the predicted objectiAnd ciRespectively representing the relative position and confidence of the object predicted by the current model. The loss function value of certain waveform detection can be calculated by the above formula by respectively performing x coordinate regression on the grids of the object and calculating the confidence coefficient prediction of the existing object for all the grids. Respectively detecting the R wave and the P wave, and adding the classification loss function to obtain a final loss function as follows:
Figure BDA0001956282260000084
in the formula, XPIndicating P-wave key location tag, XRA key position label representing R wave; c denotes the confidence label of the P-wave, CRRepresenting the confidence label of the R-wave.
In the invention, an input is divided into f grids according to a linear mapping relation, and then a position lower case x and a confidence coefficient c are respectively predicted for each grid; the classification is considered and the detection of the P wave and the R wave is considered, so that the classification network can pay more attention to the key waveforms, namely the R wave and the P wave.
And 3, training and testing the model.
When the model is trained, the batch processing quantity and the initial learning rate are set, when the loss function of the verification set is not reduced in three continuous periods, the learning rate is reduced to one n times of the original learning rate, if the loss function of the verification set is not reduced in five continuous periods, the training is finished, the best model parameters are stored every time, and the method is suitable for the pre-training and fine-tuning processes.
Specifically, the main classification branch is removed first, the network only including the P-wave branch and the R-wave branch is pre-trained, the original main branch is added for fine tuning after the pre-training is finished, and finally the test is performed on the test set. After the end, the obtained classifier model can be used for electrocardiogram classification, and due to the fact that the P wave branch and the R wave branch introduce priori knowledge, the model focuses more on the P wave and the R wave, and the result is superior to a deep residual error network lacking the P wave and the R wave branch. In the invention, the model can be trained more fully through pre-training. Because for an input length of 18000, for a sample size of fifty-six thousand, the classification task itself will over-fit for five-six cycles (epoch), while the detection task will over-fit for three-forty cycles, if trained together, the detection task may be under-trained to fail the method.
Firstly, filtering and normalizing data, and using a traditional method to provide P wave and R wave positions as subsequent labels; secondly, constructing a basic depth residual error network, and most importantly, constructing new branches in the depth residual error network to detect the positions of P waves and R waves respectively, regarding the problem as an object detection problem, regarding the input as a series of grids by utilizing the linear mapping relation of a depth convolution network, predicting whether key waveforms exist in the grids, and performing regression on the relative positions of the predicted waveforms, so that a network model focuses more on the key waveforms, and professional knowledge is introduced; and finally, removing the main branch for pre-training, then taking back the main branch for fine adjustment, training a final model in the mode, and testing the model for electrocardiogram classification. The invention solves the problem of typical object detection by introducing branches for detecting key waveforms in a deep residual error network, thereby fusing professional knowledge and relieving the problems that the model has poor interpretability and the performance cannot be ensured on small data.
The invention discloses an electrocardiogram classification system based on a depth residual error network, which comprises:
the sample data preprocessing module is used for acquiring and acquiring a preset number of marked electrocardiogram data, and preprocessing the electrocardiogram data to obtain electrocardiogram sample data and category labels which are used as model training input; extracting a key waveform position according to electrocardiogram sample data to obtain a key waveform label; the electrocardiogram data acquisition system is used for integrating electrocardiogram sample data, category labels, key waveform labels and corresponding relations among the electrocardiogram sample data, the category labels and the key waveform labels into a data set, and dividing the data set into a training set and a verification set according to a preset proportion;
the device comprises a depth residual error network model building module with branches, a data processing module and a data processing module, wherein the depth residual error network model building module is used for building a basic depth residual error network and then building branches for reconstructing key waveform positions at preset positions of a main network; the branch comprises: convolutional layers and Sigmoid layers; in the training process of the depth residual error network model with branches, calculating a classification loss function through the constructed basic depth residual error network, calculating a loss function of waveform detection through the constructed branches, and obtaining a final loss function according to the calculated classification loss function and the loss function of the waveform detection;
the training verification module is used for setting batch processing quantity and initial learning rate and training the constructed depth residual error network model with branches through a training set; verifying the trained deep residual error network model with the branches through the obtained verification set, and finishing training when the loss function of the verification set reaches a preset convergence condition to obtain the trained deep residual error network model with the branches;
and the input and output module is used for inputting the electrocardiogram data to be classified and detected into a trained depth residual error network model with branches, and the model outputs an electrocardiogram classification result.
Example 1
The classification method based on the depth residual error network and fusing the professional knowledge comprises the following steps:
step1, data preprocessing.
In this example, the data is the data of the CinC Challenge 2017 game of the International Classification of atrial fibrillation, the frequency of the data is 300Hz, the time length is different from 9 seconds to 60 seconds, namely, the maximum time is about 18000(300 × 60) points, and for the convenience of calculation, all the input is supplemented to 18176(71 × 2) in length8) All electrocardiogram data are normalized and then pass through a 5Hz low-pass filter and a 41Hz high-pass filter in sequence, and the data after passing through the filters are used as the input of the model. Meanwhile, the key waves are extracted from the electrocardiogram data by using the traditional medical detection methodThe positions of the waveforms (P-wave and R-wave) serve as labels for the following reconstruction tasks, and the key waveforms are P-wave and R-wave. Then, the data set is divided into 8:1:1 is divided into a training set, a validation set and a test set.
Step2, constructing a model; a basic depth residual error network is constructed, then a new branch is constructed on the backbone network to reconstruct the key waveform position, and finally the network structure is as shown in fig. 2.
Step 1: and constructing a basic residual error network. Specifically, the deep residual network is composed of a series of network layers. After entering the model, the data passes through a convolutional layer (Conv), a batch normalization layer (BN) and a ReLU activation layer (ReLU) in sequence, and then is divided into two parts, wherein one part directly passes through a Max pooling layer (Max pooling), and the other part passes through a series of layers and then is added together. Followed by 16 convolutional blocks (Conv blocks), each of which consists of two branches, one of which passes through only one max pooling layer, the other of which passes through a maximum pooling layer after a series of levels, and then the two branches are added together as the output of the convolutional blocks. In order to guarantee the depth of the hierarchy, here the largest pooling layer among the volume blocks only occurs in an odd number of volume blocks. Finally, in 16 volume blocks, a batch layer, a ReLU activation layer, a full connection layer (density) and a Softmax layer follow, where the calculation of the classification loss function is performed:
Figure BDA0001956282260000111
in the formula, S is an inputted electrocardiogram sequence, Y is a category label, the p () function is a probability of predicting that the current electrocardiogram belongs to a certain category, and N is the number of categories.
In a specific layer network setup, the convolutional neurons are all set to 64 in length and 64 × k in number, where k is initially 1 and increases by 1 after every 4 convolutional blocks, and all convolutional kernel lengths are set to 16, and the maximum pool convolutional layer length and interval are both 2.
Step 2: branches introducing expertise are added. Specifically, we introduce a new branch after the fifth and sixth convolution blocks, respectively, and connect a convolution layer and a Sigmoid layer after the branch, respectively, for P-waves and R-waves. The invention sets the neuron number of the convolution layer as 2, finally obtains a three-dimensional tensor (b, f, 2), wherein b represents batch processing number, f represents feature map length, 2 represents the tensor to predict a binary group (x, c), based on the linear mapping relation of the convolution neural network, it is equivalent to that we regard an original electrocardiogram input as f grids, and predict the probability c of the key waveform appearing in the grid and the relative position x of the peak of the key waveform in the grid in each grid, then the loss function of the waveform detection task can be calculated, the calculation formula is:
Figure BDA0001956282260000121
in the formula, S represents that an original input X represents a waveform position label, and C represents a confidence label; lambda [ alpha ]coordDenotes the coefficient for regression of the relative coordinates of x, λcoobjCoefficients representing the results of the prediction calculated for a grid without objects, used to control the proportion of the positive and negative cases contributing to the results, where we take λcoordIs equal to 5, lambdacoobjEqual to 0.5;
Figure BDA0001956282260000122
and
Figure BDA0001956282260000123
respectively indicating that the value is 1 when the object exists or does not exist, and otherwise, the value is 0;
Figure BDA0001956282260000124
and
Figure BDA0001956282260000125
respectively representing the true relative position and true confidence, x, of the predicted objectiAnd ciRespectively representing the relative position and confidence of the object predicted by the current model. By performing x-coordinate regression on the grids of the object respectively and calculating the existence of the object for all the gridsThe confidence prediction of (2) can be used to calculate a loss function value for a certain waveform detection by the above equation. Respectively detecting the R wave and the P wave, and adding the classification loss function to obtain a final loss function as follows:
Figure BDA0001956282260000126
and 3, training and testing the model.
Training the model, setting the initial learning rate to be 0.001, reducing the learning rate to one tenth of the original learning rate when the loss function of the verification set does not decrease for three continuous periods, and finishing the training if five continuous periods do not decrease, wherein the best model parameters are stored every time, and the same is true for the pre-training and fine-tuning processes. Specifically, the main classification branch is removed first, the network including only the P-wave branch and the R-wave branch is pre-trained, the original main branch is added after the pre-training is finished, and finally the test is performed on the test set. After the classification, the obtained classifier model can be used for atrial fibrillation classification, and due to the fact that the P wave branch and the R wave branch introduce priori knowledge, the model focuses more on the P wave and the R wave, and the result is superior to a depth residual error network lacking the P wave and the R wave branch.
In the embodiment, a new branch is established at a reasonable position of the network based on the depth residual error network to introduce a key waveform (P wave and R wave) detection task and solve the task as an object detection task, so that the model focuses more on the key waveform for detecting atrial fibrillation, and medical knowledge is fused in the depth residual error network.
In summary, the present invention provides a classification method based on a deep residual error network and integrated with professional knowledge, comprising the steps of: firstly, carrying out necessary preprocessing on training data, wherein the training data is used as model input on one hand, and the positions of key waveforms of the electrocardiogram are detected by using a traditional medical detection method and used as labels for calculating a reconstruction task loss function later; secondly, constructing a basic depth residual error network for classifying current electrocardiogram data, constructing a new branch on the original network to perform a reconstruction task of a key waveform position, and solving the problem of object detection by regarding the reconstruction as a new branch; and finally, training the model, wherein the trained model can be used for detecting and classifying the electrocardiogram. According to the invention, the new branch is introduced into the depth residual error network to detect the key waveform, and medical knowledge is fused into the depth model, so that the model can pay more attention to the key waveform of the electrocardiogram, and the interpretability and performance are improved.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art can make modifications and equivalents to the embodiments of the present invention without departing from the spirit and scope of the present invention, which is set forth in the claims of the present application.

Claims (7)

1. An electrocardiogram classification method based on a depth residual error network is characterized by comprising the following steps:
s1, sample data preprocessing: acquiring a preset number of marked electrocardiogram data, and preprocessing to obtain electrocardiogram sample data and category labels which are used as model training input; extracting a key waveform position according to electrocardiogram sample data to obtain a key waveform label; integrating electrocardiogram sample data, category labels, key waveform labels and corresponding relations among the electrocardiogram sample data, the category labels and the key waveform labels into a data set; dividing a data set into a training set and a verification set according to a preset proportion;
s2, constructing a depth residual error network model with branches: constructing a basic depth residual error network, and constructing branches for reconstructing key waveform positions at preset positions of a main network of the basic depth residual error network; the branch comprises: convolutional layers and Sigmoid layers; in the training process of the depth residual error network model with branches, calculating a classification loss function through the constructed basic depth residual error network, calculating a loss function of waveform detection through the constructed branches, and obtaining a final loss function according to the calculated classification loss function and the loss function of the waveform detection;
s3, setting batch processing quantity and initial learning rate, and training the depth residual error network model with branches constructed in the step S2 through the training set obtained in the step S1; verifying the trained deep residual error network model with the branches through the verification set obtained in the step S1, and finishing the training when the loss function of the verification set reaches the preset convergence condition to obtain the trained deep residual error network model with the branches;
s4, inputting the electrocardiogram data to be classified and detected into the trained depth residual error network model with branches obtained in the step S3, and outputting an electrocardiogram classification result by the model;
in step S1, the key waveform includes one or both of a P-wave and an R-wave;
in the basic depth residual error network model constructed in step S2: after entering the model, the data sequentially passes through a convolution layer, a batch normalization layer and a ReLU activation layer; then, the data are divided into two parts, one part is directly processed by a maximum pooling layer, the other part is sequentially processed by a convolution layer, a batch normalization layer, a ReLU activation layer, a Dropout layer, a convolution layer and a maximum pooling layer, the two parts of data obtained after processing are added together and are sequentially processed by a preset number of convolution blocks, and the processed data are sequentially processed by a batch processing layer, a ReLU activation layer, a full connection layer and a Softmax layer and then output; the input end of the winding layer of the branch is connected with the output end of the winding block at the preset position of the backbone network;
the data flow in the convolution block is divided into two branches for processing; one branch is processed by only one maximum pooling layer, the other branch is processed by one maximum pooling layer after sequentially passing through a preset number of convolution layers, batch normalization layers, ReLU activation layers and Dropout layers, and the data processed by the two branches are added together to be used as the output of the convolution block.
2. The method for classifying electrocardiograms based on the deep residual error network as claimed in claim 1, wherein the preprocessing in step S1 includes: normalizing, filtering and denoising the acquired electrocardiogram data;
the method specifically comprises the following steps: the collected electrocardiogram data are filled to a uniform preset length for normalization, and then the electrocardiogram data are sequentially passed through a low-pass filter and a high-pass filter to filter noise signals.
3. The method for classifying electrocardiograms based on the deep residual error network as claimed in claim 1, wherein the classification loss function is calculated by the formula:
Figure 4293DEST_PATH_IMAGE001
wherein S is a preprocessed electrocardiogram sequence, Y is a class label, p () function is used for predicting the probability that the current electrocardiogram belongs to a certain class, N is the number of classes, Y isiIs the ith category.
4. The method for classifying electrocardiograms based on the depth residual error network as claimed in claim 3, wherein in step S2, a branch is respectively introduced at two preset positions of a backbone network of the constructed basic depth residual error network, a convolutional layer and a Sigmoid layer are respectively connected behind each branch, the number of neurons of the convolutional layer is set to be 2, the Sigmoid layer outputs a three-dimensional tensor (b, f, 2), b represents the batch processing number, f represents the length of the feature, 2 represents the tensor to predict a bigram (x, c), x is the relative position of the vertex of the key waveform, and c is the probability of the key waveform.
5. The method of claim 4, wherein the loss function of the waveform detection is calculated by the following formula:
Figure 130381DEST_PATH_IMAGE002
wherein S is a preprocessed electrocardiogram sequence, X represents a key waveform position label,c represents a confidence label;
Figure 63702DEST_PATH_IMAGE003
representing the coefficients for regression of the x relative coordinates,
Figure 467002DEST_PATH_IMAGE004
a coefficient representing a result of the prediction calculated for the grid without the object, for controlling a ratio of contribution of the positive and negative examples to the result;
Figure 194786DEST_PATH_IMAGE005
and
Figure 555973DEST_PATH_IMAGE006
respectively indicating that the values are 1 when the object exists and 0 when the object does not exist;
Figure 27406DEST_PATH_IMAGE007
and
Figure 285212DEST_PATH_IMAGE008
respectively representing the true relative position and true confidence of the predicted object,
Figure 715056DEST_PATH_IMAGE009
and
Figure 691102DEST_PATH_IMAGE010
respectively representing the relative position and confidence of the object predicted by the current model.
6. The method of claim 5, wherein the key waveforms include P-wave and R-wave, and the final loss function is calculated by the following formula:
Figure 825280DEST_PATH_IMAGE011
in the formula, XPIndicating P-wave key location tag, XRA key position label representing R wave; cPConfidence labels representing P-waves, CRA confidence label representing an R-wave; c represents the confidence label of the key waveform.
7. An electrocardiogram classification system based on a depth residual error network is characterized by comprising:
the sample data preprocessing module is used for acquiring and acquiring a preset number of marked electrocardiogram data, and preprocessing the electrocardiogram data to obtain electrocardiogram sample data and category labels which are used as model training input; extracting a key waveform position according to electrocardiogram sample data to obtain a key waveform label; the electrocardiogram data acquisition system is used for integrating electrocardiogram sample data, category labels, key waveform labels and corresponding relations among the electrocardiogram sample data, the category labels and the key waveform labels into a data set, and dividing the data set into a training set and a verification set according to a preset proportion;
the device comprises a depth residual error network model building module with branches, a data processing module and a data processing module, wherein the depth residual error network model building module is used for building a basic depth residual error network and then building branches for reconstructing key waveform positions at preset positions of a main network; the branch comprises: convolutional layers and Sigmoid layers; in the training process of the depth residual error network model with branches, calculating a classification loss function through the constructed basic depth residual error network, calculating a loss function of waveform detection through the constructed branches, and obtaining a final loss function according to the calculated classification loss function and the loss function of the waveform detection;
the training verification module is used for setting batch processing quantity and initial learning rate and training the constructed depth residual error network model with branches through a training set; verifying the trained deep residual error network model with the branches through the obtained verification set, and finishing training when the loss function of the verification set reaches a preset convergence condition to obtain the trained deep residual error network model with the branches;
the input and output module is used for inputting the electrocardiogram data to be classified and detected into a trained deep residual error network model with branches, and the model outputs electrocardiogram classification results;
in the sample data preprocessing module, the key waveform comprises one or two of a P wave and an R wave;
in the constructed basic depth residual error network model: after entering the model, the data sequentially passes through a convolution layer, a batch normalization layer and a ReLU activation layer; then, the data are divided into two parts, one part is directly processed by a maximum pooling layer, the other part is sequentially processed by a convolution layer, a batch normalization layer, a ReLU activation layer, a Dropout layer, a convolution layer and a maximum pooling layer, the two parts of data obtained after processing are added together and are sequentially processed by a preset number of convolution blocks, and the processed data are sequentially processed by a batch processing layer, a ReLU activation layer, a full connection layer and a Softmax layer and then output; the input end of the winding layer of the branch is connected with the output end of the winding block at the preset position of the backbone network; the data flow in the convolution block is divided into two branches for processing; one branch is processed by only one maximum pooling layer, the other branch is processed by one maximum pooling layer after sequentially passing through a preset number of convolution layers, batch normalization layers, ReLU activation layers and Dropout layers, and the data processed by the two branches are added together to be used as the output of the convolution block.
CN201910067775.3A 2019-01-24 2019-01-24 Electrocardiogram classification method and system based on depth residual error network Active CN109948647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910067775.3A CN109948647B (en) 2019-01-24 2019-01-24 Electrocardiogram classification method and system based on depth residual error network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910067775.3A CN109948647B (en) 2019-01-24 2019-01-24 Electrocardiogram classification method and system based on depth residual error network

Publications (2)

Publication Number Publication Date
CN109948647A CN109948647A (en) 2019-06-28
CN109948647B true CN109948647B (en) 2021-02-02

Family

ID=67007419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910067775.3A Active CN109948647B (en) 2019-01-24 2019-01-24 Electrocardiogram classification method and system based on depth residual error network

Country Status (1)

Country Link
CN (1) CN109948647B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110390301A (en) * 2019-07-24 2019-10-29 厦门理工学院 A kind of intelligent identification Method for searching abnormal data from magnanimity history harmonic data
CN110731773B (en) * 2019-10-28 2022-10-28 浙江工业大学 Abnormal electrocardiogram screening method based on fusion of global and local depth features of electrocardiogram
CN110812699B (en) * 2019-12-03 2021-09-28 四川大学 Remote defibrillation protection system and control method thereof
CN111192237B (en) * 2019-12-16 2023-05-02 重庆大学 Deep learning-based glue spreading detection system and method
CN111275093B (en) * 2020-01-17 2024-01-26 上海乐普云智科技股份有限公司 Heart beat classification method and device for labeling electrocardiosignals with multiple labels
CN111242098B (en) * 2020-02-27 2022-04-22 西安交通大学 Electrocardiogram data classification method and system combining feature extraction and initiation network
CN111652302B (en) * 2020-05-28 2023-05-23 泰康保险集团股份有限公司 Method and device for explaining insurance verification classification result
CN111956203A (en) * 2020-08-18 2020-11-20 广州视源电子科技股份有限公司 Electrocardiosignal parameterization method, model training method, device, equipment and medium
CN112529839B (en) * 2020-11-05 2023-05-02 西安交通大学 Method and system for extracting carotid vessel centerline in nuclear magnetic resonance image
CN112568908A (en) * 2020-12-14 2021-03-30 上海数创医疗科技有限公司 Electrocardiogram waveform positioning and classifying model device adopting multi-scale visual field depth learning
CN112674780A (en) * 2020-12-23 2021-04-20 山东省人工智能研究院 Automatic atrial fibrillation signal detection method in electrocardiogram abnormal signals
CN112633402A (en) * 2020-12-30 2021-04-09 南京大学 High-precision high-proportion classification model and classification method for realizing dynamic calculation
CN112906748A (en) * 2021-01-25 2021-06-04 浙江大学 12-lead ECG arrhythmia detection classification model construction method based on residual error network
CN113469218A (en) * 2021-06-02 2021-10-01 安徽心之声医疗科技有限公司 Electrocardiosignal critical value processing method, system and medium based on deep learning
CN113288163A (en) * 2021-06-04 2021-08-24 浙江理工大学 Multi-feature fusion electrocardiosignal classification model modeling method based on attention mechanism
CN114224354B (en) * 2021-11-15 2024-01-30 吉林大学 Arrhythmia classification method, arrhythmia classification device, and readable storage medium
CN116898455B (en) * 2023-07-06 2024-04-16 湖北大学 Sleep electroencephalogram signal detection method and system based on deep learning model
CN117077541B (en) * 2023-10-11 2024-01-09 北京芯联心科技发展有限公司 Efficient fine adjustment method and system for parameters of medical model

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107714023A (en) * 2017-11-27 2018-02-23 乐普(北京)医疗器械股份有限公司 Static ecg analysis method and apparatus based on artificial intelligence self study
CN108836314A (en) * 2018-07-13 2018-11-20 希蓝科技(北京)有限公司 A kind of ambulatory ECG analysis method and system based on network and artificial intelligence

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
HUE054674T2 (en) * 2015-10-27 2021-09-28 Cardiologs Tech An automatic method to delineate or categorize an electrocardiogram
CN107657318A (en) * 2017-11-13 2018-02-02 成都蓝景信息技术有限公司 A kind of electrocardiogram sorting technique based on deep learning model
CN108175402A (en) * 2017-12-26 2018-06-19 智慧康源(厦门)科技有限公司 The intelligent identification Method of electrocardiogram (ECG) data based on residual error network
CN109117730B (en) * 2018-07-11 2021-05-11 上海夏先机电科技发展有限公司 Real-time electrocardiogram atrial fibrillation judgment method, device and system and storage medium
CN109171707A (en) * 2018-10-24 2019-01-11 杭州电子科技大学 A kind of intelligent cardiac figure classification method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107714023A (en) * 2017-11-27 2018-02-23 乐普(北京)医疗器械股份有限公司 Static ecg analysis method and apparatus based on artificial intelligence self study
CN108836314A (en) * 2018-07-13 2018-11-20 希蓝科技(北京)有限公司 A kind of ambulatory ECG analysis method and system based on network and artificial intelligence

Also Published As

Publication number Publication date
CN109948647A (en) 2019-06-28

Similar Documents

Publication Publication Date Title
CN109948647B (en) Electrocardiogram classification method and system based on depth residual error network
CN111160139B (en) Electrocardiosignal processing method and device and terminal equipment
CN107822622B (en) Electrocardiogram diagnosis method and system based on deep convolutional neural network
CN110188836B (en) Brain function network classification method based on variational self-encoder
CN111772619B (en) Heart beat identification method based on deep learning, terminal equipment and storage medium
CN113080990B (en) Heart beat anomaly detection method based on CycleGAN and BilSTM neural network method
CN110619322A (en) Multi-lead electrocardio abnormal signal identification method and system based on multi-flow convolution cyclic neural network
CN111626114B (en) Electrocardiosignal arrhythmia classification system based on convolutional neural network
CN109376663A (en) A kind of human posture recognition method and relevant apparatus
CN111291727B (en) Method and device for detecting signal quality by using photoplethysmography
CN109567789B (en) Electrocardiogram data segmentation processing method and device and readable storage medium
CN111956208B (en) ECG signal classification method based on ultra-lightweight convolutional neural network
CN112426160A (en) Electrocardiosignal type identification method and device
CN111803059A (en) Electrocardiosignal classification method and device based on time domain convolution network
CN116361688A (en) Multi-mode feature fusion model construction method for automatic classification of electrocardiographic rhythms
CN114241240A (en) Method and device for classifying brain images, electronic equipment and storage medium
CN112932431B (en) Heart rate identification method based on 1DCNN + Inception Net + GRU fusion network
CN113679393B (en) ECG data feature generation model based on contrast predictive coding
CN113171102B (en) ECG data classification method based on continuous deep learning
CN115470832A (en) Electrocardiosignal data processing method based on block chain
CN113128585B (en) Deep neural network based multi-size convolution kernel method for realizing electrocardiographic abnormality detection and classification
CN112686091A (en) Two-step arrhythmia classification method based on deep neural network
CN112914585B (en) Single-lead electrocardiogram-oriented classification method, system and device
CN116211315B (en) Single-lead electrocardiosignal auxiliary diagnosis method and diagnosis terminal
CN113349790B (en) Heart beat classification method and system of 2D convolutional neural network based on S-shaped reconstruction

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
GR01 Patent grant
GR01 Patent grant