| Literature DB >> 36117713 |
Lianfeng Shan1, Yu Li2, Hua Jiang3, Peng Zhou2, Jing Niu2, Ran Liu2, Yuanyuan Wei2, Jiao Peng2, Huizhen Yu2, Xianzheng Sha2, Shijie Chang2.
Abstract
Automatic detection and alarm of abnormal electrocardiogram (ECG) events play an important role in an ECG monitor system; however, popular classification models based on supervised learning fail to detect abnormal ECG effectively. Thus, we propose an ECG anomaly detection framework (ECG-AAE) based on an adversarial autoencoder and temporal convolutional network (TCN) which consists of three modules (autoencoder, discriminator, and outlier detector). The ECG-AAE framework is trained only with normal ECG data. Normal ECG signals could be mapped into latent feature space and then reconstructed as the original ECG signal back in our model, while abnormal ECG signals could not. Here, the TCN is employed to extract features of normal ECG data. Then, our model is evaluated on an MIT-BIH arrhythmia dataset and CMUH dataset, with an accuracy, precision, recall, F1-score, and AUC of 0.9673, 0.9854, 0.9486, 0.9666, and 0.9672 and of 0.9358, 0.9816, 0.8882, 0.9325, and 0.9358, respectively. The result indicates that the ECG-AAE can detect abnormal ECG efficiently, with its performance better than other popular outlier detection methods.Entities:
Keywords: ECG; autoencoder (AE); generative adversarial network (GANs); outlier detection (OD); temporal convolutional network (TCN)
Year: 2022 PMID: 36117713 PMCID: PMC9481281 DOI: 10.3389/fphys.2022.961724
Source DB: PubMed Journal: Front Physiol ISSN: 1664-042X Impact factor: 4.755
FIGURE 1Typical sketch of normal and abnormal heartbeats.
Number of heartbeats involved in each dataset and the division of datasets.
| Dataset | Type | Type of heartbeats | Number of heartbeats | Number of cases | Sample size | Number of training set | Number of test set |
|---|---|---|---|---|---|---|---|
| MIT-BIH | Normal | N | 74,962 | 40 | 15,000 | 10,000 | 5,000 |
| Abnormal | A | 2,545 | — | 5,000 | 0 | 5,000 | |
| L | 8,068 | — | |||||
| R | 7,254 | — | |||||
| V | 7,034 | — | |||||
| Total | 99,863 | 47 | 20,000 | 10,000 | 10,000 | ||
| CMUH | Normal | N | 20,000 | 20,000 | 15,000 | 10,000 | 5,000 |
| Abnormal | A | 6,811 | 6,811 | 5,000 | 0 | 5,000 | |
| L | 1,247 | 1,247 | |||||
| R | 8,268 | 8,268 | |||||
| V | 7,847 | 7,847 | |||||
| Total | 44,173 | 44,173 | 20,000 | 10,000 | 10,000 |
FIGURE 2ECG-AAE framework consists of three parts: (1) an autoencoder, (2) a discriminator, and (3) an outlier detector. Here, R score is the reconstruction error score; D score is the discrimination score; S is the anomaly scores (the sum of R score and D score). T is the threshold of outlier data.
Detailed overview of the proposed ECG-AAE model.
| Modules | Layers | Types | Activation function | Output shapes | Kernel size | No. of filters |
|---|---|---|---|---|---|---|
| Encoder | 0 | Input | — | 250 × 1 | — | — |
| 1 | TCN block | ReLU | 250 × 32 | 9 | 32 | |
| 2 | MaxPooling1D | — | 50 × 32 | — | — | |
| 3 | TCN block | ReLU | 50 × 16 | 9 | 16 | |
| 4 | MaxPooling1D | — | 10 × 16 | — | — | |
| 5 | TCN block | ReLU | 10 × 8 | 9 | 8 | |
| 6 | MaxPooling1D | — | 2 × 8 | — | — | |
| 7 | Flatten | — | 16 | — | — | |
| 8 | Dense | ReLU - | 8 | — | — | |
| Decoder | 0 | Input | — | 8 | — | — |
| 1 | Dense | ReLU | 16 | — | — | |
| 2 | Reshape | — | 2 × 8 | — | — | |
| 3 | UpSampling1D | — | 10 × 8 | — | — | |
| 4 | TCN block | ReLU | 10 × 8 | 9 | 8 | |
| 5 | UpSampling1D | — | 50 × 16 | — | — | |
| 6 | TCN block | ReLU | 50 × 16 | 9 | 16 | |
| 7 | UpSampling1D | — | 250 × 16 | — | — | |
| 8 | TCN block | ReLU | 250 × 32 | 9 | 32 | |
| 9 | Conv1D | ReLU | 250 × 1 | 9 | 1 | |
| Discriminator | 0 | Input | — | 250 × 1 | — | — |
| 1 | TCN block | ReLU | 250 × 32 | 9 | 32 | |
| 2 | MaxPooling1D | — | 50 × 32 | — | — | |
| 3 | TCN block | ReLU | 50 × 16 | 9 | 16 | |
| 4 | MaxPooling1D | — | 10 × 16 | — | — | |
| 5 | TCN block | ReLU | 10 × 8 | 9 | 8 | |
| 6 | MaxPooling1D | — | 2 × 8 | — | — | |
| 7 | Flatten | — | 16 | — | — | |
| 8 | Dense | ReLU | 8 | — | — | |
| 9 | Dense | sigmoid | 1 |
FIGURE 3Residual block.
FIGURE 4Stacked convolutional layers in the TCN.
FIGURE 5Distribution of anomaly scores of the MIT-BIH training set (T = 0.025).
FIGURE 6Distribution of anomaly scores of the CMUH training set (T = 0.01).
FIGURE 7Reconstruction of ECG data: (A) normal and (B) abnormal.
FIGURE 8Confusion matrix of (A) MIT-BIH dataset and (B) CMUH dataset (1 = normal 0 = abnormal).
Average classification performance for different methods on the MIT-BIH dataset.
| Methods | Acc ±SD | Pre ±SD | Rec ±SD | F1-score ± SD | AUC ±SD |
|---|---|---|---|---|---|
| OURS |
| 0.9854 ± 0.0003 | 0.9486 ± 0.0001 |
|
|
| AnoGAN (Schlegl et al.) | 0.9257 ± 0.0101 | 0.8829 ± 0.0167 | 0.9876 ± 0.0027 | 0.9323 ± 0.0085 | 0.9283 ± 0.0101 |
| AE (K.Wang et al.) | 0.9282 ± 0.0180 | 0.8733 ± 0.2042 |
| 0.9281 ± 0.1490 | 0.9233 ± 0.0049 |
| VAE (X.Wang et al.) | 0.8048 ± 0.0028 | 0.7196 ± 0.0029 | 0.9874 ± 0.0002 | 0.8325 ± 0.0157 | 0.8013 ± 0.0028 |
| Stack LSTM (Chauhan et al.) | 0.8875 ± 0.0017 | 0.8313 ± 0.0021 | 0.9740 ± 0.0007 | 0.8970 ± 0.0019 | 0.8882 ± 0.0052 |
| GRU (Cowton et al.) | 0.8764 ± 0.0040 | 0.8128 ± 0.0064 | 0.9746 ± 0.0017 | 0.8864 ± 0.0031 | 0.8751 ± 0.0040 |
| RNN (Latif et al.) | 0.8568 ± 0.0031 | 0.7826 ± 0.0040 | 0.9798 ± 0.0003 | 0.8702 ± 0.0024 | 0.8538 ± 0.0031 |
| DEEP-SVDD (Ruff et al.) | 0.8039 ± 0.0035 | 0.7221 ± 0.0037 | 0.8342 ± 0.0002 | 0.8342 ± 0.0025 | 0.8037 ± 0.0033 |
| AE + OCSVM (Mo et al.) | 0.8624 ± 0.0036 | 0.7965 ± 0.0046 | 0.9788 ± 0.0003 | 0.8783 ± 0.0029 | 0.8644 ± 0.0050 |
| DAGMM (Song et al.) | 0.7646 ± 0.0007 |
| 0.5304 ± 0.0004 | 0.6930 ± 0.0019 | 0.7650 ± 0.0019 |
| GMM (Dai et al.) | 0.6462 ± 0.0463 | 0.9986 ± 0.1603 | 0.2924 ± 0.0068 | 0.4524 ± 0.0274 | 0.6460 ± 0.0042 |
| OCSVM (Schölkopf et al.) | 0.8376 ± 0.0009 | 0.9982 ± 0.0006 | 0.6760 ± 0.0005 | 0.8061 ± 0.0018 | 0.8374 ± 0.0019 |
| iForest (Liu et al.) | 0.6521 ± 0.0106 | 0.9987 ± 0.2119 | 0.3046 ± 0.3468 | 0.4668 ± 0.1334 | 0.6521 ± 0.0106 |
| LOF (Bin Yao et al.) | 0.5050 ± 0.0006 | 0.5027 ± 0.0007 | 0.9170 ± 0.0025 | 0.6494 ± 0.0018 | 0.5050 ± 0.0020 |
SD, standard deviation.
The bold values mean maximum.
Average classification performance for different methods on the CMUH dataset.
| Methods | Acc ± SD | Pre ± SD | Rec ± SD | F1-score ± SD | AUC ± SD |
|---|---|---|---|---|---|
| OURS |
| 0.9816 ± 0.0002 | 0.8882 ± 0.0010 |
|
|
| AnoGAN (Schlegl et al.) | 0.8985 ± 0.0092 | 0.8396 ± 0.0128 | 0.9852 ± 0.0018 | 0.9066 ± 0.0078 | 0.8985 ± 0.0092 |
| AE (K.Wang et al.) | 0.9103 ± 0.0181 | 0.8504 ± 0.0253 |
| 0.9169 ± 0.0148 | 0.9098 ± 0.0181 |
| VAE (X.Wang et al.) | 0.7744 ± 0.0040 | 0.6885 ± 0.0039 | 0.9910 ± 0.0015 | 0.8125 ± 0.0027 | 0.7713 ± 0.0041 |
| Stack LSTM (Chauhan et al.) | 0.8754 ± 0.0033 | 0.8097 ± 0.0051 | 0.9772 ± 0.0019 | 0.8856 ± 0.0025 | 0.8738 ± 0.0033 |
| GRU (Cowton et al.) | 0.8779 ± 0.0038 | 0.8156 ± 0.0052 | 0.9748 ± 0.0019 | 0.8881 ± 0.0030 | 0.8772 ± 0.0038 |
| RNN (Latif et al.) | 0.8221 ± 0.0037 | 0.7414 ± 0.0041 | 0.9860 ± 0.0021 | 0.8464 ± 0.0026 | 0.8210 ± 0.0037 |
| DEEP-SVDD (Ruff et al.) | 0.7649 ± 0.0050 | 0.6794 ± 0.0047 | 0.9908 ± 0.0017 | 0.8061 ± 0.0032 | 0.7616 ± 0.0050 |
| AE + OCSVM (Mo et al.) | 0.8245 ± 0.0030 | 0.7436 ± 0.0034 | 0.9864 ± 0.0022 | 0.8479 ± 0.0021 | 0.8231 ± 0.0030 |
| DAGMM (Song et al.) | 0.7260 ± 0.0012 | 0.9991 ± 0.0004 | 0.4520 ± 0.0024 | 0.6224 ± 0.0023 | 0.7258 ± 0.0012 |
| GMM (Dai et al.) | 0.6057 ± 0.0037 |
| 0.2148 ± 0.0074 | 0.3536 ± 0.0101 | 0.6074 ± 0.0037 |
| OCSVM (Schölkopf et al.) | 0.7600 ± 0.0024 | 0.9985 ± 0.0010 | 0.5208 ± 0.0048 | 0.6845 ± 0.0041 | 0.7600 ± 0.0024 |
| iForest (Liu et al.) | 0.6303 ± 0.0043 |
| 0.2606 ± 0.0086 | 0.4135 ± 0.0107 | 0.6303 ± 0.0043 |
| LOF (Bin Yao et al.) | 0.5767 ± 0.0059 |
| 0.1700 ± 0.0117 | 0.2906 ± 0.0174 | 0.5850 ± 0.0059 |
SD, standard deviation.
The bold values mean maximum.
FIGURE 9Analysis of the predication error (A,B) noise interference ECG, (C,D) baseline drift ECG.