The incidence of cardiovascular disease is increasing year by year and is showing a younger trend. At the same time, existing medical resources are tight. The automatic detection of ECG signals becomes increasingly necessary. This paper proposes an automatic classification of ECG signals based on a dilated causal convolutional neural network. To solve the problem that the recurrent neural network framework network cannot be accelerated by hardware equipment, the dilated causal convolutional neural network is adopted. Given the features of the same input and output time steps of the recurrent neural network and the nondisclosure of future information, the network is constructed with fully convolutional networks and causal convolution. To reduce the network depth and prevent gradient explosion or gradient disappearance, the dilated factor is introduced into the model, and the residual blocks are introduced into the model according to the shortcut connection idea. The effectiveness of the algorithm is verified in the MIT-BIH Atrial Fibrillation Database (MIT-BIH AFDB). In the experiment of the MIT-BIH AFDB database, the classification accuracy rate is 98.65%.
According to the “China Cardiovascular Disease Report 2018” [
The electrocardiogram (ECG) examination has become one of the four major routine examination items in modern medicine. ECG is the safest and most effective method for diagnosing cardiovascular diseases. The rapid development of electronic information technology has made ECG measurement more convenient and faster, which provides a lot of data for ECG automatic classification.
The theory of deep learning was proposed in the 1940s, but due to limited computing power, its development was particularly slow. After the 21st century, with the rapid development of computer technology and parallel accelerated computing technology, deep learning has been supported by hardware. In 2012, Hinton’s research team participated in the ImageNet image recognition competition, and the AlexNet [
In this work, there is first time to use the dilated causal convolution in the ECG classification task. The main contributions are as follows:
A novel ECG classification method based on shortcut connection and dilated causal convolution is proposed. The proposed method effectively improves the training speed and classification accuracy We explore the impact of the network structure and key parameters on classification results. A better parameter selection method is found, which further improved the classification accuracy of the model
The rest of the paper is organized as follows. In Section
The automatic classification of ECG signals is mainly divided into four steps: (1) input, (2) data preprocessing, (3) feature extraction, and (4) classification. The overall process is shown in Figure
Four steps for intelligent classification of the ECG signal diagram.
The MIT-BIH AFDB [
There will inevitably be noise during ECG signal acquisition, so the DB6 wavelet is used to decompose the original ECG signal with a 9-level wavelet [
The amplitude of ECG data varies greatly among different people. When there are large differences in the input data, the performance of the neural network is often not good enough. Therefore, the
where
Since the length of the ECG data in the MIT-BIH AFDB is relatively long, the ECG data is segmented according to the label file to obtain 288 normal ECG data, 291 atrial fibrillation ECG data, and 14 atrial flutter ECG data. After segmentation according to the type, the obtained ECG signal is cut into segments with a length of 4 s. And the data with a length of less than 4 s is discarded. The data distribution after segmentation is shown in Table
Data distribution of MIT-BIH AFDB.
Type | Num |
---|---|
Normal | 124808 |
Atrial fibrillation (AF) | 83626 |
Atrial flutter (AFL) | 1449 |
Total | 209883 |
In the experiment, 5-fold crossvalidation is adopted. The experimental data are divided into five parts, of which four parts are used as the training set in turn and one part as the testing set. The 5-fold crossvalidation can improve the stability of the model and facilitate the selection of hyperparameters. The data division diagram is shown in Figure
Data division diagram.
In this section, in view of the slow operation speed of the traditional ECG classification model, the DCC is introduced in the automatic classification of ECG signals. To facilitate subsequent comparative experiments, Sections
The convolutional layer is the core component of the convolutional neural networks (CNNs), in which most operations of convolutional neural networks are completed. The operation of the convolutional layer can be expressed by equation (
where
The development of convolutional networks has gone through the stages of LeNet [
Since convolutional neural networks cannot handle sequences related to time or space, recurrent neural networks (RNNs) [
Recurrent neural network structure diagram [
With the widespread application of RNNs models, the gradient problem in RNN networks has gradually attracted attention. At the same time, the shortcomings of the slow running time of RNN networks cannot meet people’s needs.
In order to solve the problems of RNNs, Bai et al. [
The dilated causal convolutional layer is the core network layer of the TCN. DCC can be divided into two parts: dilated convolution [
The ECG signals are time series, and the length is relatively long. These features can match the advantages of TCN. However, the result of the experiment is not satisfactory. To obtain better results, we propose an improved model. Improved model contains multiple DCC blocks and multiple shortcut connections [
(a) iDCC Network structure. (b) DCC Block composition structure.
To solve the problem of information leakage in the future, casual convolution [
Diagram of causal convolution [
Since the ECG signal generally has a high sampling rate and the collected signal lasts for a long time, the direct use of causal convolution will cause the network layer to be too deep, which is not conducive to neural network learning and greatly increases the computational burden. In order to effectively deal with data with long historical information such as ECG data, the idea of WaveNet [
Diagram of dilated causal convolution [
Visualization of the 1D convolution kernel with different dilation factors.
To further speed up the network operation, we changed the standardization layer in the model from the batch normalization layer to the weight normalization (WN) [
where
In the above formula,
Where
The ReLU [
To prevent the model from overfitting, a dropout layer [
In the above formula, the Bernoulli function will randomly generate a vector of 0 or 1.
The residual block structure usually appears in neural networks with deeper network structures. He [
Diagram of shortcut connection [
The number of channels between the original data
A convolution block joined in the shortcut connection [
The network structures proposed in this article are built by the PyTorch framework and trained on Nvidia Tesla V100 GPU. The Adam [
Accuracy (Acc), specificity (Spe), and sensitivity (Sen) are three important evaluation indicators of neural network models. To calculate these evaluation indicators, the true positive (TP), true negative (TN), false positive (FP), and false negative (FN) are introduced. The calculation equations of the evaluation indexes are shown in equations (
The accuracy of the improved dilated causal convolutional neural network (iDCCN) in the training set and the testing set of the atrial fibrillation database is shown in Figure
Accuracy of iDCCN classification results.
Confusion matrix of iDCCN classification results.
Table
Summary of selected studies conducted for the automated detection of AF.
Author, year | Method | Performance | ||
---|---|---|---|---|
Acc | Sen | Spe | ||
Lake et al., 2011 [ | Coefficient of sample entropy (COSEN) | — | 91% | 98% |
Asgari et al., 2015 [ | Stationary wavelet transforms, support vector machine (SVM) | _— | 97% | 97.1% |
Zhou et al., 2014 [ | Recursive algorithms | 97.67% | 96.89% | 98.25% |
Acharya et al., 2017 [ | CNNs | 94.9% | 99.13% | 81.44% |
Andersen et al., 2018 [ | CNNs-RNNs | 97.80% | 98.96% | 86.04% |
Dang et al., 2019 [ | Deep CNN-BiLSTM | 96.59% | 99.93% | 97.03% |
Proposed | iDCCN | 98.65% | 98.79% | 99.04% |
To verify the superiority of the proposed method in running time, we reproduced the network model used in [
Complexity analysis of the seven models in the testing set.
Model | Time(s) | Accuracy |
---|---|---|
Acharya et al., 2017 [ | 25.67 | 94.93% |
Andersen et al., 2018 [ | 32.60 | 97.80% |
Dang et al., 2019 [ | 40.82 | 96.59% |
Ma et al., 2020 [ | 30.64 | 97.21% |
Sangaiah et al., 2020 [ | 48.37 | 99.11% |
Park et al., 2020 [ | 46.20 | 97.05% |
Proposed | 27.62 | 98.65% |
As shown in Table
The proposed method removes the recurrent neural network in the model, which reduces the overall time complexity. The running time on the testing set is 27.62 s. And in traditional convolution layers, convolution kernels are tightly connected. But in the proposed model, the addition of dilated factors reduces the computational complexity of the convolutional layer.
To verify whether the number of dilated causal convolution blocks affects the experimental results, 3 blocks, 4 blocks, and 5 blocks are used relatively for comparison, and four different ways are adopted to define the dilated factor.
As shown in Table
Comparison of time and accuracy under different numbers of blocks. (A)
(A) | (B) | (C) | (D) | |||||
---|---|---|---|---|---|---|---|---|
Time(s) | Acc | Time(s) | Acc | Time(s) | Acc | Time(s) | Acc | |
3 blocks | 26.48 | 87.66% | 25.76 | 92.65% | 24.83 | 93.27% | 23.76 | 92.31% |
4 blocks | 29.34 | 89.78% | 28.97 | 94.22% | 28.35 | 95.43% | 27.62 | 98.65% |
5 blocks | 31.26 | 90.14% | 30.06 | 95.03% | 29.51 | 96.15% | 28.06 | 97.92% |
Comparison of time and accuracy under different numbers of blocks. (a)
When the dilated factor is 0, the computation time of 3 blocks, 4 blocks, 5 blocks is 26.48 s, 29.34 s, 31.26 s, respectively. And the accuracy is 87.66%, 89.78%, 90.14%. In the second case, the dilated factor is
The accuracy reaches the highest in the last case when the number of blocks is 4. And in the last case, the accuracy curve first rises in 3 and 4 block experiments and then falls in 5 block experiments. This may be caused by the network falling into a local optimal solution.
This paper proposes a novel ECG signal classification model based on DCC. The proposed model contains four iDCCN blocks, and each iDCCN block contains a dilated causal convolutional layer, a weight normalization layer, an activation function layer, a dropout layer, and a shortcut layer. 5-fold crossvalidations are used to train and test the model on the MIT-BIH AFDB. The proposed model increases the classification accuracy to 98.65% in the testing set. Experimental results validate the effectiveness of this method in atrial fibrillation detection. And the model reduces the running time. The method provides new ideas for real-time diagnosis of ECG signals.
The ECG signal data used to support the findings of this study have been deposited in the MIT-BIH Atrial Fibrillation Database repository (
The authors declare that they have no conflicts of interest.