Exploiting feature fusion and long-term context dependencies for simultaneous ECG heartbeat segmentation and classification


Arrhythmia detection is an important research task in healthcare, which can be accomplished by classifying ECG heartbeats. Recently, there is a growing trend of applying deep learning models to solving this problem. Most existing deep learning-based methods consist of three steps: preprocessing, heartbeat segmentation and beat-wise classification. This methodology suffers from two drawbacks. First, explicit heartbeat segmentation can undermine the simplicity of the entire model. Second, performing classification on individual heartbeats fails to take into account inter-heartbeat contextual information that may be vital to accurate classification. In view of these drawbacks, we propose a novel deep learning model that simultaneously conducts heartbeat segmentation and classification. Without explicit heartbeat segmentation, the overall workflow of our method is streamlined to be simpler than existing methods. We achieve simultaneous segmentation and classification with a Faster R-CNN-based deep network that has been customized to handle ECG data. To capture inter-heartbeat contextual information, we utilize inverted residual blocks and a novel feature fusion and normalization subroutine which incorporates average pooling and max-pooling. We conduct extensive experiments on the well-known MIT-BIH arrhythmia database to validate the effectiveness of our method in both intra- and inter-patient arrhythmia detection tasks.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13


  1. 1.


  2. 2.



  1. 1.

    Acharya, U.R., Oh, S.L., Hagiwara, Y., Tan, J.H., Adam, M., Gertych, A., San Tan, R.: A deep convolutional neural network model to classify heartbeats. Comput. Biol. Med. 89, 389–396 (2017)

    Article  Google Scholar 

  2. 2.

    Alickovic, E., Subasi, A.: Medical decision support system for diagnosis of heart arrhythmia using dwt and random forests classifier. J. Med. Syst. 40(4), 108 (2016)

    Article  Google Scholar 

  3. 3.

    Atkielsk, A.: Atom. File:SinusRhythm withoutLabels.svg (2019)

  4. 4.

    Chawla, N.V., Bowyer, K.W., Hall, L.O., Kegelmeyer, W.P.: Smote: synthetic minority over-sampling technique. J. Artif. Intell. Res. 16, 321–357 (2002)

    Article  Google Scholar 

  5. 5.

    Chen, S., Hua, W., Li, Z., Li, J., Gao, X.: Heartbeat classification using projected and dynamic features of ecg signal. Biomed. Signal Process. Control 31, 165–173 (2017)

    Article  Google Scholar 

  6. 6.

    Clevert, DA., Unterthiner, T., Hochreiter, S.: Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289 (2015)

  7. 7.

    De Chazal, P., O’Dwyer, M., Reilly, R.B.: Automatic classification of heartbeats using ECG morphology and heartbeat interval features. IEEE Trans. Biomed. Eng. 51(7), 1196–1206 (2004)

    Article  Google Scholar 

  8. 8.

    EC57 AA, for the Advancement of Medical Instrumentation A, et al.: Testing and reporting performance results of cardiac rhythm and st segment measurement algorithms. Association for the Advancement of Medical Instrumentation, Arlington, VA (1998)

  9. 9.

    Fawaz, H.I., Forestier, G., Weber, J., Idoumghar, L., Muller, P.A.: Deep learning for time series classification: a review. Data Min. Knowl. Disc. 33(4), 917–963 (2019)

    MathSciNet  Article  Google Scholar 

  10. 10.

    Goldberger, A.L., Amaral, L.A., Glass, L., Hausdorff, J.M., Ivanov, P.C., Mark, R.G., Mietus, J.E., Moody, G.B., Peng, C.K., Stanley, H.E.: Physiobank, physiotoolkit, and physionet: components of a new research resource for complex physiologic signals. Circulation 101(23), e215–e220 (2000)

    Article  Google Scholar 

  11. 11.

    Hamilton, P.S., Tompkins, W.J.: Quantitative investigation of qrs detection rules using the mit/bih arrhythmia database. IEEE Trans. Biomed. Eng. 12, 1157–1165 (1986)

    Article  Google Scholar 

  12. 12.

    Hannun, A.Y., Rajpurkar, P., Haghpanahi, M., Tison, G.H., Bourn, C., Turakhia, M.P., Ng, A.Y.: Cardiologist-level arrhythmia detection and classification in ambulatory electrocardiograms using a deep neural network. Nat. Med. 25(1), 65 (2019)

    Article  Google Scholar 

  13. 13.

    Hao, P., Gao, X., Li, Z., Zhang, J., Wu, F., Bai, C.: Multi-branch fusion network for myocardial infarction screening from 12-lead ecg images. Comput. Methods Prog. Biomed. 184, 105286 (2020)

    Article  Google Scholar 

  14. 14.

    He, J., Rong, J., Sun, L., Wang, H., Zhang, Y.: An advanced two-step dnn-based framework for arrhythmia detection. In: Pacific-Asia Conference on Knowledge Discovery and Data Mining, pp. 422–434. Springer, New York (2020)

  15. 15.

    He, Z., Niu, J., Ren, J., Shi, Y., Zhang, W.: A deep learning method for heartbeat detection in ECG image. In: Chinese Intelligent Automation Conference, pp. 356–363. Springer, New York (2019)

  16. 16.

    Ji, Y., Zhang, S., Xiao, W.: Electrocardiogram classification based on faster regions with convolutional neural network. Sensors 19(11), 2558 (2019)

    Article  Google Scholar 

  17. 17.

    Kiranyaz, S., Ince, T., Gabbouj, M.: Real-time patient-specific ECG classification by 1-d convolutional neural networks. IEEE Trans. Biomed. Eng. 63(3), 664–675 (2015)

    Article  Google Scholar 

  18. 18.

    Lin, T.Y., Dollár, P., Girshick, R., He, K., Hariharan, B., Belongie, S.: Feature pyramid networks for object detection. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2117–2125 (2017)

  19. 19.

    Liu, F., Zhou, X., Cao, J., Wang, Z., Wang, H., Zhang, Y.: Arrhythmias classification by integrating stacked bidirectional lstm and two-dimensional cnn. In: Pacific-Asia Conference on Knowledge Discovery and Data Mining, pp. 136–149. Springer, New York (2019a)

  20. 20.

    Liu, F., Zhou, X., Cao, J., Wang, Z., Wang, H., Zhang, Y.: A lstm and cnn based assemble neural network framework for arrhythmias classification. ICASSP 2019–2019 IEEE International Conference on Acoustics, pp. 1303–1307. Speech and Signal Processing (ICASSP), IEEE (2019b)

  21. 21.

    Luz, E.J.S., Schwartz, W.R., Cámara-Chávez, G., Menotti, D.: Ecg-based heartbeat classification for arrhythmia detection: a survey. Comput. Methods Programs Biomed. 127, 144–164 (2016)

    Article  Google Scholar 

  22. 22.

    Ma, J., Sun, L., Wang, H., Zhang, Y., Aickelin, U.: Supervised anomaly detection in uncertain pseudoperiodic data streams. ACM Trans. Internet Technol. (TOIT) 16(1), 1–20 (2016)

    Article  Google Scholar 

  23. 23.

    Martínez, J.P., Almeida, R., Olmos, S., Rocha, A.P., Laguna, P.: A wavelet-based ECG delineator: evaluation on standard databases. IEEE Trans. Biomed. Eng. 51(4), 570–581 (2004)

    Article  Google Scholar 

  24. 24.

    Martis, R.J., Acharya, U.R., Min, L.C.: ECG beat classification using pca, lda, ica and discrete wavelet transform. Biomed. Signal Process. Control 8(5), 437–448 (2013)

    Article  Google Scholar 

  25. 25.

    Melgani, F., Bazi, Y.: Classification of electrocardiogram signals with support vector machines and particle swarm optimization. IEEE Trans. Inf Technol. Biomed. 12(5), 667–677 (2008)

    Article  Google Scholar 

  26. 26.

    Moody, G.B., Mark, R.G.: The impact of the mit-bih arrhythmia database. IEEE Eng. Med. Biol. Mag. 20(3), 45–50 (2001)

    Article  Google Scholar 

  27. 27.

    Mousavi, S., Afghah, F.: Inter-and intra-patient ECG heartbeat classification for arrhythmia detection: a sequence to sequence deep learning approach. ICASSP 2019–2019 IEEE International Conference on Acoustics, pp. 1308–1312. Speech and Signal Processing (ICASSP), IEEE (2019)

  28. 28.

    Oh, S.L., Ng, E.Y., San Tan, R., Acharya, U.R.: Automated beat-wise arrhythmia diagnosis using modified u-net on extended electrocardiographic recordings with heterogeneous arrhythmia types. Comput. Biol. Med. 105, 92–101 (2019)

    Article  Google Scholar 

  29. 29.

    Pan, J., Tompkins, W.J.: A real-time qrs detection algorithm. IEEE Trans. Biomed. Eng. 32(3), 230–236 (1985)

    Article  Google Scholar 

  30. 30.

    Podrid, P.J., Kowey, P.R.: Cardiac Arrhythmia: Mechanisms, Diagnosis, and Management. Lippincott Williams & Wilkins, Philadelphia (2001)

    Google Scholar 

  31. 31.

    Ren, S., He, K., Girshick, R., Sun, J.: Faster r-cnn: Towards real-time object detection with region proposal networks. In: Advances in Neural Information Processing Systems, pp. 91–99 (2015)

  32. 32.

    Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., Chen, LC.: Mobilenetv2: inverted residuals and linear bottlenecks. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520 (2018)

  33. 33.

    Shi, H., Wang, H., Jin, Y., Zhao, L., Liu, C.: Automated heartbeat classification based on convolutional neural network with multiple kernel sizes. In: 2019 IEEE Fifth International Conference on Big Data Computing Service and Applications (BigDataService). IEEE, pp. 311–315 (2019)

  34. 34.

    Sun, L., Wang, Y., He, J., Li, H., Peng, D., Wang, Y.: A stacked lstm for atrial fibrillation prediction based on multivariate ecgs. Health Inf. Sci. Syst. 8, 1–7 (2020)

    Article  Google Scholar 

  35. 35.

    Tereshchenko, L.G., Josephson, M.E.: Frequency content and characteristics of ventricular conduction. J. Electrocardiol. 48(6), 933–937 (2015)

    Article  Google Scholar 

  36. 36.

    Warrick, P., Homsi, MN.: Cardiac arrhythmia detection from ECG combining convolutional and long short-term memory networks. In: 2017 Computing in Cardiology (CinC). IEEE, pp. 1–4 (2017)

  37. 37.

    Yan, G., Liang, S., Zhang, Y., Liu, F.: Fusing transformer model with temporal features for ecg heartbeat classification. In: 2019 IEEE International Conference on Bioinformatics and Biomedicine (BIBM). IEEE, pp. 898–905 (2019)

  38. 38.

    Ye, C., Coimbra, MT., Kumar, BV.: Arrhythmia detection and classification using morphological and dynamic features of ecg signals. In: 2010 Annual International Conference of the IEEE Engineering in Medicine and Biology. IEEE, pp. 1918–1921 (2010)

  39. 39.

    Yildirim, Ö.: A novel wavelet sequence based on deep bidirectional lstm network model for ECG signal classification. Comput. Biol. Med. 96, 189–202 (2018)

    Article  Google Scholar 

  40. 40.

    Yu, R., Gao, Y., Duan, X., Zhu, T., Wang, Z., Jiao, B.: Qrs detection and measurement method of ECG paper based on convolutional neural networks. In: 2018 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC). IEEE, pp. 4636–4639 (2018)

  41. 41.

    Zhang, Z., Dong, J., Luo, X., Choi, K.S., Wu, X.: Heartbeat classification using disease-specific feature selection. Comput. Biol. Med. 46, 79–89 (2014)

    Article  Google Scholar 

Download references

Author information



Corresponding author

Correspondence to Yanchun Zhang.

Ethics declarations

Conflict of interest

On behalf of all authors, the corresponding author states that there is no conflict of interest.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This is an extended version of our PAKDD 2020 paper Simultaneous ECG Heartbeat Segmentation and Classification with Feature Fusion and Long Term Context Dependencies. This work is funded by NSFC grant 61672161 and Dongguan Innovative Research Team Program (No. 2018607201008). We sincerely thank Prof Chun Liang and Dr Zhiqing He from Department of Cardiology, Shanghai Changzheng Hospital for their valuable advice.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Qiu, X., Liang, S., Meng, L. et al. Exploiting feature fusion and long-term context dependencies for simultaneous ECG heartbeat segmentation and classification. Int J Data Sci Anal 11, 181–193 (2021). https://doi.org/10.1007/s41060-020-00239-9

Download citation


  • Arrhythmia detection
  • ECG classification
  • End-to-end deep neural network
  • Heartbeat segmentation