A classification method and system for twelve-lead electrocardiogram
By using residual networks and bidirectional gated recurrent unit networks in computer-aided electrocardiogram diagnosis, combined with a multi-stage attention mechanism, the problem of insufficient electrocardiogram classification accuracy in the existing technology is solved and higher recognition accuracy is achieved.
Patent Information
- Application Number
- CN202211578452.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-09
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-12-09
AI Technical Summary
Existing computer-aided ECG diagnosis methods have shortcomings in accuracy. In particular, traditional machine learning methods require manual feature extraction, and convolutional neural networks and recurrent neural networks do not fully consider the correlation between data forms, resulting in low adaptability. The classification and recognition accuracy needs to be improved.
Using the residual network and the bidirectional gated recurrent unit network to build a benchmark model, and combined with the multi-stage attention mechanism, the model can model the correlation between data at different stages, thereby improving the classification and recognition accuracy of electrocardiograms.
By introducing the residual network and the bidirectional gated recurrent unit network, combined with the multi-stage attention mechanism, the local spatial and temporal features of the ECG are effectively extracted, the accuracy of the ECG classification is improved, and the gradient disappearance problem caused by the deepening of the convolutional neural network is avoided. , which enhances the focus on features between heartbeats, rhythms and leads, and significantly improves the accuracy of classification and recognition.
Smart Images

Figure CN115886830B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a classification method and system for a twelve-lead electrocardiogram. Background Art
[0002] The prevalence and severity of heart disease have a great impact on the general public. Since it takes years of study to train a professional electrocardiogram (ECG) diagnostician, the cost is very high. In addition, since the volume of ECGs is very large, long-term manual reading of ECGs will also cause fatigue to ECG doctors, leading to misdiagnosis, etc. Therefore, computer-aided ECG diagnosis came into being.
[0003] Computer-aided diagnosis of electrocardiogram Figure 1 Generally, various algorithms are used for auxiliary diagnosis, such as traditional machine learning methods for classification diagnosis, or convolutional neural networks and recurrent neural networks for electrocardiogram classification diagnosis.
[0004] The applicant found during the research that the traditional machine learning method needs to rely on manual feature extraction, which will cause problems such as insufficient feature extraction; and the use of convolutional neural networks and recurrent neural networks for electrocardiogram classification does not consider the correlation between the data forms at each stage, and most of the work is carried out for a single lead or two leads, which is not very adaptable. The above factors have led to the need to improve the accuracy of existing computer-aided diagnosis of electrocardiograms. Summary of the invention
[0005] In order to solve the accuracy problem of existing computer-aided diagnosis of electrocardiograms, the present invention provides a classification method and system for a twelve-lead electrocardiogram. A residual network and a bidirectional gated recurrent unit network are used to build a benchmark model, and the correlation between data at different stages of the attention mechanism is combined for modeling, thereby improving the classification and recognition accuracy of the electrocardiogram.
[0006] In order to solve the above technical problems, the first aspect of the present invention discloses a classification method for a twelve-lead electrocardiogram, the method comprising:
[0007] Obtain the ECG signal to be classified from the ECG file to be classified;
[0008] Preprocessing the electrocardiogram signal to be classified;
[0009] The preprocessed ECG signal to be classified is input into a trained hybrid neural network based on a multi-stage attention mechanism to obtain a classification result; wherein the hybrid neural network simultaneously uses a residual network and a bidirectional gated recurrent unit network to build a benchmark model, and combines the attention mechanism with the data correlation at different stages for modeling.
[0010] Preferably, the preprocessing of the electrocardiogram signal to be classified specifically includes:
[0011] Unifying the length of the electrocardiogram signals to be classified;
[0012] The electrocardiogram signals to be classified with unified lengths are standardized to be converted into a standard normal distribution.
[0013] Preferably, the network structure of the hybrid neural network based on the multi-stage attention mechanism includes: sequentially connected convolutional layers, the residual network, alternately used attention scoring layers and bidirectional gated recurrent unit networks, batch normalization layers (BN layers), rectified linear unit layers, and fully connected layers;
[0014] The convolution layer is connected to a data dimension transformation layer in front, the convolution layer is connected to a batch normalization layer BN layer and a rectified linear unit layer in sequence behind, and the rectified linear unit layer is connected to the residual network;
[0015] The residual network includes: more than three first-type residual modules and more than one second-type residual module; the second-type residual module is connected between two first-type residual modules;
[0016] The output of the residual network is used as the input of the first attention scoring layer, and the bidirectional gated recurrent unit network is connected to the data dimension transformation layer in front and connected to the attention scoring layer in the back;
[0017] The fully connected layer is followed by an activation function.
[0018] Preferably, the first type of residual module includes a main branch and a shortcut branch;
[0019] The main branch includes two convolutional layers, and each convolutional layer is followed by the BN layer and the rectified linear unit layer; the output of the previous rectified linear unit layer is used as the input of the next convolutional layer;
[0020] The shortcut branch connects the input end of the main branch and the output end of the next BN layer, and is used to copy the input of the previous convolutional layer and add it to the output of the next BN layer to obtain a sum, which is used as the input of the next rectified linear unit layer.
[0021] Preferably, the convolution kernel parameters in the first type of residual module can be adaptively changed.
[0022] Preferably, the structure of the second type of residual module is the same as the structure of the first type of residual module;
[0023] The shortcut branch of the second type of residual module has a convolutional layer;
[0024] The convolution kernel parameters in the second type of residual module are different from the convolution kernel parameters in the first type of residual module.
[0025] Preferably, each of the attention scoring layers comprises a scoring layer and a normalization layer;
[0026] In the scoring layer, the scoring function is: score = xWs; where x is the output of the previous layer, including x1, x2...x n …x N , each output has three dimensions (dimension 1, dimension 2, dimension 3), W represents the trainable parameters in the training process, s represents the query vector of the stage to which the attention scoring layer belongs, the data dimension of W is (dimension 3, dimension 2), and the data dimension of s is (dimension 2, 1);
[0027] In the normalization layer, each scoring result obtained by the scoring function is normalized along dimension 2 using a normalization function to obtain a distribution α of the scoring results. n , α n = Where N represents the size of dimension 2, j represents each count of dimension 2, and x j Indicates the scoring result corresponding to dimension 2;
[0028] Using the formula The distribution of scoring results α n Perform weighted processing as the output of the attention scoring layer, where output represents the output of the attention scoring layer, x n =x1,x2…x N , α n =α1, α2…α N .
[0029] Preferably, the hybrid neural network is trained in the following manner:
[0030] Obtain an electrocardiogram dataset;
[0031] The electrocardiogram data set is preprocessed and then input into the hybrid neural network, and the hybrid neural network is trained in combination with a back propagation algorithm until the accuracy requirement is met.
[0032] A second aspect of the present invention discloses a classification system for a twelve-lead electrocardiogram, comprising:
[0033] An acquisition module, used for acquiring the electrocardiogram signal to be classified from the electrocardiogram file to be classified;
[0034] A preprocessing module, used for preprocessing the electrocardiogram signal to be classified;
[0035] The classification module is used to input the preprocessed ECG signal to be classified into a hybrid neural network based on a multi-stage attention mechanism that has been trained to obtain a classification result; wherein the hybrid neural network simultaneously uses a residual network and a bidirectional gated recurrent unit network to build a benchmark model, and combines the attention mechanism to model the data correlation at different stages.
[0036] According to a third aspect of the present invention, a computer-readable storage medium is disclosed, on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented.
[0037] According to a fourth aspect of the present invention, a computer device is disclosed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.
[0038] Through one or more technical solutions of the present invention, the present invention has the following beneficial effects or advantages:
[0039] The technical solution provided by the present invention adopts the structure of the residual network and the structure of the bidirectional gated recurrent unit network at the same time, introduces a multi-stage attention mechanism, and improves the classification and recognition accuracy of the electrocardiogram. Specifically, the advantages mainly come from the following aspects. On the one hand, the introduction of the residual structure in the residual network can avoid the gradient vanishing problem caused by the deepening of the convolutional neural network. At the same time, this part can effectively extract the local spatial features of the electrocardiogram. On the other hand, in addition to the convolutional neural network, since the electrocardiogram is essentially a time series data, a bidirectional gated recurrent unit network is used to model the sequence of the electrocardiogram and extract the time series features of the electrocardiogram. Finally, through the multi-stage attention mechanism, the attention score is calculated between the heartbeat, rhythm and leads, so that the scheme can better focus on the important features of each stage. The above technical points have made great contributions to the high-precision classification and recognition achieved by the present invention.
[0040] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] By reading the detailed description of the preferred embodiment below, various other advantages and benefits will become clear to those of ordinary skill in the art. The accompanying drawings are only used for the purpose of illustrating the preferred embodiment and are not considered to be limitations of the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings.
[0042] In the attached picture:
[0043] Figure 1 A schematic flow chart of a twelve-lead electrocardiogram classification method according to an embodiment of the present invention is shown;
[0044] Figure 2 A schematic diagram showing a network structure of a hybrid neural network according to an embodiment of the present invention;
[0045] Figure 3 A schematic diagram of the structure of a first type of residual module according to an embodiment of the present invention is shown;
[0046] Figure 4 A schematic diagram of the structure of a first type of residual module according to an embodiment of the present invention is shown;
[0047] Figure 5 A logical schematic diagram of an attention scoring layer according to an embodiment of the present invention is shown;
[0048] Figure 6 A schematic diagram of a classification system for a twelve-lead electrocardiogram according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0049] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0050] See also Figure 1 The embodiment of the present invention discloses a classification method for a twelve-lead electrocardiogram, comprising the following steps:
[0051] Step 101, obtaining an electrocardiogram signal to be classified from an electrocardiogram file to be classified.
[0052] In this embodiment, the ECG signal in the ECG file is a graph of the electrical activity changes generated by each cardiac cycle of the heart recorded from the body surface by an ECG machine. In order to reflect the electrical activity of different surfaces of the heart, electrodes are generally placed in different parts of the human body to record and reflect the electrical activity of the heart. In a conventional ECG examination, 4 limb lead electrodes and 6 chest lead electrodes V1-V6 are placed to obtain a conventional 12-lead ECG file, from which the ECG signal to be classified corresponding to the second lead can be obtained. The 12 leads include: lead I, lead II, lead III, avR lead, avL lead, avF lead, V1 lead, V2 lead, V3 lead, V4 lead, V5 lead and V6 lead.
[0053] Step 102: preprocessing the electrocardiogram signal to be classified.
[0054] In this embodiment, the preprocessing includes: unifying the length of the electrocardiographic signals to be classified; and standardizing the electrocardiographic signals to be classified after the length unification to convert them into a standard normal distribution.
[0055] Specifically, the ECG signals of uniform length are obtained by clipping for subsequent processing. For example, if the clipping standard is 10s, the ECG signals to be classified whose length is greater than 10s are randomly clipped to obtain ECG signals to be classified of 10s, and the ECG signals to be classified whose length is less than 10s are padded with zeros to obtain ECG signals to be classified of 10s.
[0056] The standardized processing of the ECG signal to be classified after the unified length is to convert it into a standard normal distribution, thereby improving the convergence speed and accuracy of the model and preventing the gradient explosion of the model. The standardized conversion function is:
[0057] x * =(x―μ) / σ(1)
[0058] Among them, x * is a normal distribution, x is the ECG signal to be classified, μ is the mean of the ECG signal to be classified, and σ is the standard deviation of the ECG signal to be classified.
[0059] Step 103: input the preprocessed ECG signal to be classified into a trained hybrid neural network based on a multi-stage attention mechanism to obtain a classification result.
[0060] In this embodiment, the hybrid neural network uses both a residual network (ResNet) and a bidirectional gated recurrent unit network (Bi-GRU) to build a benchmark model, and combines the attention mechanism to model the data correlation at different stages. The activation function used by the hybrid neural network is a leaky rectified linear unit (Leaky ReLU), the loss function used is a cross entropy loss function, and the activation function of the output layer is a sigmoid function, but this does not form a limitation.
[0061] It can be seen that the hybrid neural network of this embodiment adopts a hybrid network based on ResNet and BiGRU in network construction. It not only uses convolutional neural networks to extract the spatial features of electrocardiograms, but also uses bidirectional gated recurrent unit networks to mine the correlation between each sampling point in the time series, that is, the correlation between each sampling point of the twelve-lead electrocardiogram. In addition, a multi-stage attention mechanism is combined. When performing twelve-lead classification, the attention mechanism is used to perform attention scoring-normalization-weighting operations on the data at each level, from the heartbeat level between the heartbeats of the same lead to the twelve leads, to measure the importance of each heartbeat, rhythm and lead, and effectively improve the accuracy of the twelve-lead electrocardiogram classification method.
[0062] Specifically, the network structure of the hybrid neural network includes: sequentially connected convolutional layers (the convolution kernel size is 1x8, the number of convolution kernels is 32, the step size is 1, and the padding method is the same), the residual network, alternating attention scoring layers and Bi-GRU, batch normalization layer BN layer, Leaky ReLU layer (alpha parameter is 0.3), fully connected layer, and the fully connected layer is followed by an activation function.
[0063] The convolution layer is connected to a data dimension transformation layer in front, the convolution layer is connected to a BN layer and a Leaky ReLU layer in sequence behind, and the Leaky ReLU layer is connected to the residual network behind;
[0064] The residual network includes two types of residual modules, specifically including more than three first-type residual modules and more than one second-type residual module; the second-type residual module is connected between two first-type residual modules.
[0065] The output of the residual network is used as the input of the first attention scoring layer. The front of Bi-GRU is connected to the data dimension transformation layer, and the back is connected to the attention scoring layer.
[0066] The output of the final attention layer enters the BN layer, the Leaky ReLU layer, and then the fully connected layer.
[0067] To better understand the network structure of the hybrid neural network, see Figure 2 Provide explanation.
[0068] exist Figure 2 In the example, it mainly includes 1 convolutional layer, 2 Bi-GRUs, 3-stage attention layers, and a residual network consisting of 4 residual modules. The connection relationship is residual module A1→residual module A2→residual module B1→residual module A3. It is worth noting that the number can be determined according to the actual situation and is not limited.
[0069] Specifically, in Figure 2 The network structure of the hybrid neural network shown includes, as a whole, the following: input, data dimension transformation layer-1, convolution layer-1D, BN layer, Leaky ReLU layer, a residual network composed of 4 residual modules, which are: residual module A1→residual module A2→residual module B1→residual module A3, attention scoring layer-1, data dimension transformation layer-2, Bi-GRU-1, attention scoring layer-2, data dimension transformation layer-3, Bi-GRU-2, attention scoring layer-3, BN layer, LeakyReLU layer, fully connected layer, activation function, and output.
[0070] In order to better understand the residual network, the first residual module and the second residual module of the residual network are described below.
[0071] The first type of residual module includes a main branch and a shortcut branch.
[0072] The main branch includes two convolutional layers, each of which is followed by a BN layer and a Leaky ReLU layer; the output of the previous Leaky ReLU layer is used as the input of the next convolutional layer.
[0073] The shortcut branch connects the input end of the main branch and the output end of the next BN layer, and is used to copy the input of the previous convolutional layer and add it to the output of the next BN layer to obtain a sum, which is used as the input of the next LeakyReLU layer.
[0074] See also Figure 3 , shows a schematic structural diagram of the first type of residual module of the residual network.
[0075] The first type of residual module has no downsampling operation on the shortcut, and mainly includes a convolution layer-1D, a BN layer, a Leaky ReLU layer, a convolution layer-1D, and a BN layer. The output after the above layers is added to the input data of the first type of residual module, and the sum is obtained and then input into the next Leaky ReLU layer.
[0076] It is worth noting that the convolution kernel parameters in the first type of residual module can be adaptively changed. That is, the convolution kernel parameters in the first type of residual module can be modified according to needs to adapt to the calculation. This will be explained later.
[0077] The structure of the second type of residual module is the same as that of the first type of residual module, but the shortcut branch of the second type of residual module has a convolution layer for downsampling operation. In addition, the convolution kernel parameters in the second type of residual module are different from the convolution kernel parameters in the first type of residual module.
[0078] See also Figure 4, shows a schematic structural diagram of the second type of residual module of the residual network.
[0079] The above two types of residual modules can be adaptively selected to form a residual network. Figure 2 The residual network shown has a total of 4 residual modules, including 3 first-class residual modules (A1, A2, A3) and 1 second-class residual module (B1). The connection relationship is residual module A1→residual module A2→residual module B1→residual module A3, where the convolution and parameters of residual modules A1 and A2 are the same. Specifically: the convolution kernel size is 1x8, the number of convolution kernels is 32, the step size is 1, and the padding method is same. The convolution kernel size of residual module B1 on the main branch is 1x8, the number of convolution kernels is 64, the convolution kernel size on the shortcut branch is 1x1, the number of convolution kernels is 64, and the padding method is valid. Because residual module A3 is behind residual module B1, the convolution kernel size is adaptively adjusted to 1x8, the number of convolution kernels is 64, and the padding method is same. The output data dimension is (number of heart beats, number of sampling points of one heart beat / 2, 64).
[0080] In this embodiment, each of the attention scoring layers includes a scoring layer and a normalized softmax. Figure 5 , which is a logical diagram of the attention scoring layer.
[0081] In the scoring layer, the scoring function is: score = xWs (2)
[0082] Among them, x is the output of the previous layer, including x1, x2…x n …x N , and each output has three dimensions (dimension1, dimension2, dimension3).
[0083] In this embodiment, the three dimensions have different meanings depending on the stage to which the attention scoring layer belongs. Specifically, the hybrid neural network in this embodiment has a total of three stages of attention scoring layers, namely: attention scoring layer-1, attention scoring layer-2, and attention scoring layer-3.
[0084] In the attention scoring layer-1, the three dimensions of x (dimension 1, dimension 2, dimension 3) are: the number of heartbeats, the number of sampling points of one heartbeat / 2, and 64.
[0085] In the attention scoring layer-2, the three dimensions of x (dimension 1, dimension 2, dimension 3) are: the number of leads, the number of heartbeats in a lead, and 64.
[0086] In the attention scoring layer-3, the three dimensions of x (dimension 1, dimension 2, dimension 3) are: 1, the number of leads, 64.
[0087] W represents the trainable parameters during training. In the attention scoring layer of the same stage, the first data dimension of W needs to be the same as the third data dimension in x to facilitate matrix multiplication. Therefore, the data dimension of W is (dimension 3, dimension 2).
[0088] s represents the query vector of the stage to which the attention scoring layer belongs, and is also a trainable parameter. In the attention scoring layer of the same stage, the first data dimension of s needs to be the same as the second data dimension in W to facilitate matrix multiplication. Therefore, the data dimension of s is (dimension 2, 1).
[0089] In the normalization layer, a normalization function is used to normalize each scoring result obtained by the scoring function along dimension 2 (i.e., the dimension with the same meaning among the three parameters in the scoring function) to obtain a distribution α of the scoring results. n .
[0090] The normalization formula is:
[0091]
[0092] Where N represents the size of dimension 2, j represents each count of dimension 2, and x j Indicates the scoring result corresponding to dimension 2; exp represents the exponential function.
[0093] Use the weighted formula to distribute the scoring results α n The weighted processing is performed as the output of the attention scoring layer.
[0094] The weighted formula is:
[0095]
[0096] Among them, output represents the output of the attention layer, x n =x1,x2…x N , α n =α1, α2…α N .
[0097] The above is the structural description of the hybrid neural network in this embodiment. Based on the above structural description, the hybrid neural network is trained in the following manner:
[0098] Obtain an electrocardiogram dataset;
[0099] The electrocardiogram data set is preprocessed and then input into the hybrid neural network, and the hybrid neural network is trained in combination with a back propagation algorithm until the accuracy requirement is met.
[0100] In order to illustrate the above training process, the following Figure 2Provide explanation.
[0101] After preprocessing, the ECG data set obtains an ECG signal with the dimension of (number of leads, number of sampling points for each lead, 1).
[0102] After the data dimension transformation layer-1, the ECG signal is converted into heartbeat data with the dimension of (number of heartbeats, number of sampling points of one heartbeat, 1).
[0103] Among them, the calculation formula for the number of heart beats in the ECG signal is:
[0104] L=M 导联 / M 心拍 (5)
[0105] L represents the number of leads, M 导联 Indicates the number of sampling points for each lead, M 心拍 Indicates the number of sampling points of a heartbeat. This formula uses a non-overlapping sliding window to determine the heartbeat data. Specifically, the number of sampling points of a heartbeat is fixed first. For example, if the heartbeat size is fixed to 50, the number of sampling points of a heartbeat is 50. Then the number of sampling points of the entire ECG signal is calculated by multiplying the number of leads by the number of sampling points of each lead, and then divided by the number of sampling points of a heartbeat to obtain the number of heartbeats of the entire ECG signal.
[0106] The heartbeat data is input into the convolutional layer-1, BN layer, Leaky ReLU layer, and the residual network composed of 4 residual modules in sequence. The output data dimension is (number of heartbeats, number of sampling points of one heartbeat / 2, 64).
[0107] The output result of the residual network is input into the attention scoring layer. The hybrid neural network of this embodiment has a total of 3 stages of attention scoring layers, namely: attention scoring layer-1, attention scoring layer-2, and attention scoring layer-3.
[0108] Each attention layer consists of two parts: the scoring layer and the normalization layer softmax. The scoring layer calculates the result using the above formula (2), and then uses formula (3) to normalize each scoring result along dimension 2 to obtain the distribution α of the scoring result. n Then use formula (4) for weighted processing to obtain the output of the attention scoring layer. The processing process and formula used in each attention layer are the same.
[0109] Following the above description, the output result of the residual network is input into the attention scoring layer-1, and the output result is input into the data dimension transformation layer-2 to transform the data dimension. The transformed dimension is (number of leads, number of heartbeats in one lead, 64). Among them, the number of heartbeats in one lead = the signal length of a single lead / the signal length of a single heartbeat; the reason why the third dimension is 64 is that the number of convolution kernels processed at the end is 64.
[0110] The data with transformed data dimensions is input into Bi-GRU-1 with 64 nodes to obtain the corresponding output. Then the data is input into the attention scoring layer-2 and the same operation as above is performed to obtain the corresponding output.
[0111] The above output result is input into the data dimension transformation layer-3 to transform the data dimension. The transformed dimension is (1, number of leads, 64).
[0112] The data with transformed data dimensions is input into Bi-GRU-2 with 64 nodes to obtain the corresponding output. Then the data is input into the attention scoring layer-3 and the same operation as above is performed to obtain the corresponding output.
[0113] The extracted feature outputs are passed through the BN layer, the Leaky ReLU layer (alpha is 0.3), and the fully connected layer. The output node of the fully connected layer is the specific number of classifications. Then it passes through a sigmoid function to get the final output. The final output is a probability between 0 and 1. The model is trained by the back-propagation algorithm to obtain a trained hybrid neural network based on a multi-stage attention mechanism.
[0114] The pre-processed ECG signal to be classified is processed according to the above steps using a trained hybrid neural network based on a multi-stage attention mechanism to obtain a classification result.
[0115] Compared with the existing electrocardiogram classification method, the technical solution provided by the present invention adopts the structure of a residual network and a bidirectional gated recurrent unit network at the same time, introduces a multi-stage attention mechanism, and improves the classification and recognition accuracy of the electrocardiogram.
[0116] Specifically, the advantages mainly come from the following aspects: on the one hand, the introduction of the residual structure in the residual network can avoid the gradient vanishing problem caused by deepening the convolutional neural network, and at the same time, this part can effectively extract the local spatial features of the electrocardiogram; on the other hand, in addition to the convolutional neural network, since the electrocardiogram is essentially a time series data, a bidirectional gated recurrent unit network is used to model the electrocardiogram sequence and extract the time series features of the electrocardiogram; finally, through a multi-stage attention mechanism, the attention scores are calculated for the heart beat, rhythm and leads, so that the scheme can better focus on the important features of each stage. The above technical points have made great contributions to the high-precision classification and recognition achieved by the present invention.
[0117] Based on the same inventive concept as in the above-mentioned embodiment, the present invention also discloses a classification system for a twelve-lead electrocardiogram. Figure 6 ,include:
[0118] An acquisition module 601 is used to acquire an electrocardiogram signal to be classified from an electrocardiogram file to be classified;
[0119] A preprocessing module 602 is used to preprocess the ECG signal to be classified;
[0120] The classification module 603 is used to input the preprocessed ECG signal to be classified into a hybrid neural network based on a multi-stage attention mechanism that has been trained to obtain a classification result; wherein the hybrid neural network simultaneously uses a residual network and a bidirectional gated recurrent unit network to build a benchmark model, and combines the attention mechanism with the data correlation at different stages for modeling.
[0121] Based on the same inventive concept as in the aforementioned embodiments, an embodiment of the present invention further discloses a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any of the aforementioned methods are implemented.
[0122] Based on the same inventive concept as in the aforementioned embodiments, an embodiment of the present invention further discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the aforementioned methods when executing the program.
[0123] Through one or more embodiments of the present invention, the present invention has the following beneficial effects or advantages:
[0124] The technical solution provided by the present invention adopts the structure of the residual network and the structure of the bidirectional gated recurrent unit network at the same time, introduces a multi-stage attention mechanism, and improves the classification and recognition accuracy of the electrocardiogram. Specifically, the advantages mainly come from the following aspects. On the one hand, the introduction of the residual structure in the residual network can avoid the gradient vanishing problem caused by the deepening of the convolutional neural network. At the same time, this part can effectively extract the local spatial features of the electrocardiogram. On the other hand, in addition to the convolutional neural network, since the electrocardiogram is essentially a time series data, a bidirectional gated recurrent unit network is used to model the sequence of the electrocardiogram and extract the time series features of the electrocardiogram. Finally, through the multi-stage attention mechanism, the attention score is calculated between the heartbeat, rhythm and leads, so that the scheme can better focus on the important features of each stage. The above technical points have made great contributions to the high-precision classification and recognition achieved by the present invention.
[0125] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
[0126] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0127] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0128] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0129] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0130] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in a gateway, proxy server, or system according to an embodiment of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0131] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
Claims
1. A classification method for a twelve-lead electrocardiogram, characterized in that: The method comprises: Acquire the electrocardiogram signal to be classified from the electrocardiogram file to be classified; wherein the electrocardiogram signal in the electrocardiogram file is a graph of electrical activity changes generated by each cardiac cycle of the heart recorded from the body surface by an electrocardiograph; Preprocessing the electrocardiogram signal to be classified; The preprocessed ECG signal to be classified is input into a hybrid neural network based on a multi-stage attention mechanism that has been trained to obtain a classification result; wherein the hybrid neural network simultaneously uses a residual network and a bidirectional gated recurrent unit network to build a benchmark model, and combines the data correlation of the attention mechanism at different stages to perform modeling; wherein, in the hybrid neural network, the output of the residual network is used as the input of the first attention scoring layer in the multi-stage attention mechanism, and the attention scoring layer in the multi-stage attention mechanism and the bidirectional gated recurrent unit network are used alternately; the hybrid neural network is trained in the following manner: Obtain an electrocardiogram data set; preprocess the electrocardiogram data set to obtain an electrocardiogram signal, the dimensions of which are the number of leads, the number of sampling points for each lead, and 1; after passing through a data dimension transformation layer-1, the electrocardiogram signal is converted into heartbeat data, the dimensions of which are the number of heartbeats, the number of sampling points for one heartbeat, and 1; the heartbeat data is sequentially input into the residual network and the attention scoring layer-1 in the multi-stage attention mechanism to obtain an output result input into a data dimension transformation layer-2, the dimensions after the transformation are the number of leads, the number of heartbeats in one lead, and 64; the data with the transformed data dimensions is input into the Bi-GRU in the bidirectional gated recurrent unit network -1, the attention scoring layer -2 in the multi-stage attention mechanism, and the data dimension transformation layer -3, the transformed dimensions are 1, the number of leads, and 64; the data with transformed data dimensions are input into the Bi-GRU -2 in the bidirectional gated recurrent unit network, the attention scoring layer -3 in the multi-stage attention mechanism, the BN layer, the Leaky ReLU layer, and the fully connected layer, and then pass through a sigmoid function to obtain the final output, and the final output is a probability between 0 and 1. The model is trained through the back-propagation algorithm to obtain a trained hybrid neural network based on the multi-stage attention mechanism.
2. The method according to claim 1, characterized in that The preprocessing of the electrocardiogram signal to be classified specifically includes: Unifying the length of the electrocardiogram signals to be classified; The electrocardiogram signals to be classified with unified lengths are standardized to be converted into a standard normal distribution.
3. The method according to claim 1, characterized in that The network structure of the hybrid neural network based on the multi-stage attention mechanism includes: sequentially connected convolutional layers, the residual network, alternately used attention scoring layers and bidirectional gated recurrent unit networks, batch normalization layers (BN layers), rectified linear unit layers, and fully connected layers; The convolution layer is connected to a data dimension transformation layer in front, the convolution layer is connected to a batch normalization layer BN layer and a rectified linear unit layer in sequence behind, and the rectified linear unit layer is connected to the residual network; The residual network includes: at least three first-type residual modules and at least one second-type residual module; the second-type residual module is connected between two first-type residual modules; The output of the residual network is used as the input of the first attention scoring layer, and the bidirectional gated recurrent unit network is connected to the data dimension transformation layer in front and connected to the attention scoring layer in the back; The fully connected layer is followed by an activation function.
4. The method according to claim 3, characterized in that The first type of residual module includes a main branch and a shortcut branch; The main branch includes two convolutional layers, and each convolutional layer is followed by the BN layer and the rectified linear unit layer; the output of the previous rectified linear unit layer is used as the input of the next convolutional layer; The shortcut branch connects the input end of the main branch and the output end of the next BN layer, and is used to copy the input of the previous convolutional layer and add it to the output of the next BN layer to obtain a sum, which is used as the input of the next rectified linear unit layer.
5. The method according to claim 4, characterized in that The convolution kernel parameters in the first type of residual module can be adaptively changed.
6. The method according to claim 4, characterized in that The structure of the second type of residual module is the same as the structure of the first type of residual module; The shortcut branch of the second type of residual module has a convolutional layer; The convolution kernel parameters in the second type of residual module are different from the convolution kernel parameters in the first type of residual module.
7. A classification system for a twelve-lead electrocardiogram, characterized in that: include: The acquisition module is used to acquire the electrocardiogram signal to be classified from the electrocardiogram file to be classified; wherein the electrocardiogram signal in the electrocardiogram file is a graph of electrical activity changes generated by each cardiac cycle of the heart recorded from the body surface by an electrocardiograph; A preprocessing module, used for preprocessing the electrocardiogram signal to be classified; A classification module is used to input the preprocessed ECG signal to be classified into a hybrid neural network based on a multi-stage attention mechanism that has been trained to obtain a classification result; wherein the hybrid neural network simultaneously uses a residual network and a bidirectional gated recurrent unit network to build a benchmark model, and combines the data correlation of the attention mechanism at different stages to perform modeling; wherein, in the hybrid neural network, the output of the residual network is used as the input of the first attention scoring layer in the multi-stage attention mechanism, and the attention scoring layer in the multi-stage attention mechanism and the bidirectional gated recurrent unit network are used alternately; the hybrid neural network is trained in the following manner Obtain: obtain an electrocardiogram data set; obtain an electrocardiogram signal after preprocessing the electrocardiogram data set, the dimensions of which are the number of leads, the number of sampling points of each lead, and 1; after passing through the data dimension transformation layer-1, the electrocardiogram signal is converted into heartbeat data, the dimensions of which are the number of heartbeats, the number of sampling points of one heartbeat, and 1; the heartbeat data is sequentially input into the residual network and the attention scoring layer-1 in the multi-stage attention mechanism, and the output result is input into the data dimension transformation layer-2, and the transformed dimensions are the number of leads, the number of heartbeats in one lead, and 64; the data with the transformed data dimensions is input into the Bi-GRU in the bidirectional gated recurrent unit network -1, the attention scoring layer -2 in the multi-stage attention mechanism, and the data dimension transformation layer -3, the transformed dimensions are 1, the number of leads, and 64; the data with transformed data dimensions are input into the Bi-GRU -2 in the bidirectional gated recurrent unit network, the attention scoring layer -3 in the multi-stage attention mechanism, the BN layer, the Leaky ReLU layer, and the fully connected layer, and then pass through a sigmoid function to obtain the final output, and the final output is a probability between 0 and 1. The model is trained through the back-propagation algorithm to obtain a trained hybrid neural network based on the multi-stage attention mechanism.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.
