# Convolutional Autoencoding and Gaussian Mixture Clustering for Unsupervised Beat-to-Beat Heart Rate Estimation of Electrocardiograms from Wearable Sensors

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Work

Algorithm Category | Year | Method |
---|---|---|

Traditional detection methods | 1985 | Pan–Tompkins [13] |

1999 | Fourier-transform neural network [16] | |

1999 | Filter banks [21] | |

2002 | Phase space [22] | |

2004 | Support vector machine-based expert system [20] | |

2005 | Morphological transform [17] | |

2010 | Discrete wavelet transform [15] | |

2011 | Difference operation [18] | |

2015 | Multilevel Teager energy operator (METO) [23] | |

2016 | UNSW [25] | |

2016 | Discrete wavelet transform and artificial neural network [19] | |

2017 | Adaptive threshold [14] | |

Supervised deep neural network methods | 2018 | Combination of 1D-CNN and LSTM [26] |

2018 | Convolutional neural networks [28] | |

2020 | Deep convolutional LSTM regression [27] | |

Unsupervised machine learning methods | 2012 | Clustering and multimethod approach [31] |

2016 | Advanced K-means clustering algorithm and K-SVD [29] | |

2016 | Unsupervised ELM and decision rule [30] |

## 3. Proposed Method

#### 3.1. The 1D Convolutional Self-Encoder

#### 3.2. Gaussian Mixture Clustering

- (1)
- Initialize the model parameters of each Gaussian mixture component;
- (2)
- Calculate the posterior probability ${\gamma}_{ik}={p}_{M}$ of each feature ${\mathbf{y}}_{\mathbf{i}}$ generated by each mixed component according to Equation (7);
- (3)
- Calculate the new mean vector $\mu $ of each Gaussian mixture component,$${\mu}_{k}^{\prime}=\frac{{\sum}_{i=1}^{N}{\gamma}_{ik}{\mathbf{y}}_{\mathbf{i}}}{{\sum}_{i=1}^{N}{\gamma}_{ik}},\phantom{\rule{1.em}{0ex}}k=1,2,3,\dots ,K$$$${\Sigma}_{k}^{\prime}=\frac{{\sum}_{i=1}^{N}{\gamma}_{ik}\left({\mathbf{y}}_{\mathbf{i}}-{\mu}_{k}^{\prime}\right){\left({\mathbf{y}}_{\mathbf{i}}-{\mu}_{k}^{\prime}\right)}^{T}}{{\sum}_{i=1}^{N}{\gamma}_{ik}{\mathbf{y}}_{\mathbf{i}}},\phantom{\rule{1.em}{0ex}}k=1,2,3,\dots ,K$$$${\alpha}_{k}^{\prime}=\frac{{\sum}_{i=1}^{N}{\gamma}_{ik}}{N},\phantom{\rule{1.em}{0ex}}k=1,2,3,\dots ,K$$
- (4)
- Update the parameters of each Gaussian mixture component;
- (5)
- If the termination condition is satisfied, the final clustering classification is determined according to Equation (8). If not, repeat Step (2)∼(4) until the termination condition is satisfied.

#### 3.3. Cluster Evaluation Function

#### 3.4. Algorithm Model

Algorithm 1:AE-GMM |

01 Find all peak locations of the three lead ECG signals. |

02 Extract data segment centered at each peak with radius r = 45 as the input feature for this candidate peak, resulting in feature tensor X in dimension [M, 91, 3], where M is the total number of peaks, 2r + 1 = 91 is the total length of th input heartbeat signals. |

03 Standardize the input feature tensor X. |

04 Train the autoencoding network and extract the compressed feature tensor Y with dimension (M, 91, 1). |

05 Perform Gaussian mixture clustering as described in Section 3.2. |

06 Determine the heartbeat cluster according to the Calinski–Harabasz clustering scores. |

07 Calculate the beat-to-beat heart rate based on the R wave locations. |

## 4. Experiment

#### 4.1. Data Preprocessing

**X**denote the example locations of R waves manually labeled by us and confirmed by a medical expert. The peak of the R wave in the ECG signal is the most prominent feature. Based on this, we assume that the heartbeat will only appear at the peak position.

#### 4.2. Analysis of Experimental Results

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Conflicts of Interest

## References

- Virani, S.S.; Alonso, A.; Benjamin, E.J.; Bittencourt, M.S.; Callaway, C.W.; Carson, A.P.; Chamberlain, A.M.; Chang, A.R.; Cheng, S.; Delling, F.N.; et al. Heart Disease and Stroke Statistics—2020 Update: A Report From the American Heart Association. Circulation
**2020**, 141, e139–e596. [Google Scholar] [CrossRef] - Junaid, M.J.A.; Kumar, R. Data Science And Its Application In Heart Disease Prediction. In Proceedings of the 2020 International Conference on Intelligent Engineering and Management, London, UK, 17–19 June 2020; pp. 396–400. [Google Scholar]
- Ghaleb, F.A.; Kamat, M.; Salleh, M.; Rohani, M.F.; Hadji, S.E. Motion Artifact Reduction Algorithm Using Sequential Adaptive Noise Filters and Estimation Methods for Mobile ECG. In Proceedings of the International Conference of Reliable Information and Communication Technology, Johor Bahru, Malaysia, 23–24 April 2017; pp. 116–123. [Google Scholar]
- Yoo, J.; Yan, L.; Lee, S.; Kim, H.; Yoo, H.J. A Wearable ECG Acquisition System with Compact Planar-Fashionable Circuit Board-Based Shirt. IEEE Trans. Inf. Technol. Biomed.
**2009**, 13, 897–902. [Google Scholar] [CrossRef] [PubMed] - Pham, T.; Lau, Z.J.; Chen, S.H.A.; Makowski, D. Heart Rate Variability in Psychology: A Review of HRV Indices and an Analysis Tutorial. Sensors
**2021**, 21, 3998. [Google Scholar] [CrossRef] - Dittmar, A.; Axisa, F.; Delhomme, G.; Gehin, C. New Concepts and Technologies in Home Care and Ambulatory Monitoring. Stud. Health Technol. Inform.
**2004**, 108, 9–35. [Google Scholar] - Sung, M.; Marci, C.; Pentland, A. Wearable feedback systems for rehabilitation. J. Neuroeng. Rehabil.
**2005**, 2, 17. [Google Scholar] [CrossRef] [Green Version] - Heilman, K.J.; Porges, S.W. Accuracy of the LifeShirt
^{®}(Vivometrics) in the detection of cardiac rhythms. Biol. Psychol.**2007**, 75, 300–305. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Curone, D.; Secco, E.L.; Tognetti, A.; Loriga, G.; Dudnik, G.; Risatti, M.; Whyte, R.; Bonfiglio, A.; Magenes, G. Smart Garments for Emergency Operators: The ProeTEX Project. IEEE Trans. Inf. Technol. Biomed.
**2010**, 14, 694–701. [Google Scholar] [CrossRef] [PubMed] - Lee, Y.D.; Chung, W.Y. Wireless Sensor Network based Wearable Smart Shirt for Ubiquitous Health and Activity Monitoring. Sens. Actuators B Chem.
**2009**, 140, 390–395. [Google Scholar] [CrossRef] - Chen, C.C.; Lin, S.Y.; Chang, W.Y. Novel Stable Capacitive Electrocardiogram Measurement System. Sensors
**2021**, 21, 3668. [Google Scholar] [CrossRef] [PubMed] - Cheng, J.; Zhong, J.; Wang, H.; Tang, X.; Jiao, C.; Zhou, H. Evolutionary Optimized Multiple Instance Concept Learning for Beat-to-Beat Heart Rate Estimation from Electrocardiograms. In Proceedings of the 2020 13th International Congress on Image and Signal Processing, BioMedical Engineering and Informatics, Chengdu, China, 17–19 October 2020; pp. 727–732. [Google Scholar]
- Pan, J.; Tompkins, W.J. A Real-time QRS Detection Algorithm. IEEE Trans. Biomed. Eng.
**1985**, BME-32, 230–236. [Google Scholar] [CrossRef] - Ramakrishnan, S.; Yogeswaran, R. Design and Analysis of Feature Extraction Algorithm for ECG Signals using Adaptive Threshold Method. In Proceedings of the 2017 Trends in Industrial Measurement and Automation, Chennai, India, 6–8 January 2017; pp. 1–8. [Google Scholar]
- Banerjee, S.; Mitra, M. ECG Feature Extraction and Classification of Anteroseptal Myocardial Infarction and Normal Subjects using Discrete Wavelet Transform. In Proceedings of the 2010 International Conference on Systems in Medicine and Biology, Kharagpur, India, 16–18 December 2010; pp. 55–60. [Google Scholar]
- Minami, K.I.; Nakajima, H.; Toyoshima, T. Real-time Discrimination of Ventricular Tachyarrhythmia with Fourier-Transform Neural Network. IEEE Trans. Biomed. Eng.
**1999**, 46, 179–185. [Google Scholar] [CrossRef] - Sun, Y.; Chan, K.L.; Krishnan, S.M. Characteristic Wave Detection in ECG Signal using Morphological Transform. BMC Cardiovasc. Disord.
**2005**, 5, 1–7. [Google Scholar] [CrossRef] [Green Version] - Kim, M.S.; Cho, Y.C.; Seo, S.T.; Son, C.S.; Kim, Y.N. Auto-Detection of R Wave in Electrocardiography for Patch-Type ECG Remote Monitoring System. Biomed. Eng. Lett.
**2011**, 1, 180. [Google Scholar] [CrossRef] - Dewangan, N.K.; Shukla, S. ECG Arrhythmia Classification using Discrete Wavelet Transform and Artificial Neural Network. In Proceedings of the 2016 IEEE International Conference on Recent Trends in Electronics, Information & Communication Technology, Bangalore, India, 20–21 May 2016; pp. 1892–1896. [Google Scholar]
- Osowski, S.; Hoai, L.T.; Markiewicz, T. Support Vector Machine-based Expert System for Reliable Heartbeat Recognition. IEEE Trans. Biomed. Eng.
**2004**, 51, 582–589. [Google Scholar] [CrossRef] - Afonso, V.X.; Tompkins, W.J.; Nguyen, T.Q.; Luo, S. ECG Beat Detection using Filter Banks. IEEE Trans. Biomed. Eng.
**1999**, 46, 192–202. [Google Scholar] [CrossRef] - Lee, J.W.; Kim, K.S.; Lee, B.; Lee, B.; Lee, M.H. A Real Time QRS Detection Using Delay-Coordinate Mapping for the Microcontroller Implementation. Ann. Biomed. Eng.
**2002**, 30, 1140–1151. [Google Scholar] [CrossRef] - Sedghamiz, H.; Santonocito, D. Unsupervised Detection and Classification of Motor Unit Action Potentials in Intramuscular Electromyography Signals. In Proceedings of the 2015 E-Health and Bioengineering Conference, Iasi, Romania, 19–21 November 2015; pp. 1–6. [Google Scholar]
- Scholkmann, F.; Boss, J.; Wolf, M. An Efficient Algorithm for Automatic Peak Detection in Noisy Periodic and Quasi-Periodic Signals. Algorithms
**2012**, 5, 588–603. [Google Scholar] [CrossRef] [Green Version] - Khamis, H.; Weiss, R.; Xie, Y.; Chang, C.W.; Lovell, N.H.; Redmond, S.J. QRS Detection Algorithm for Telehealth Electrocardiogram Recordings. IEEE Trans. Biomed. Eng.
**2016**, 63, 1377–1388. [Google Scholar] [CrossRef] - Oh, S.L.; Ng, E.Y.; Tan, R.S.; Acharya, U.R. Automated Diagnosis of Arrhythmia using Combination of CNN and LSTM Techniques with Variable Length Heart Beats. Comput. Biol. Med.
**2018**, 102, 278–287. [Google Scholar] [CrossRef] [PubMed] - Fotiadou, E.; Xu, M.; van Erp, B.; van Sloun, R.J.; Vullings, R. Deep Convolutional Long Short-Term Memory Network for Fetal Heart Rate Extraction. In Proceedings of the 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), Montreal, QC, Canada, 20–24 July 2020; pp. 1–4. [Google Scholar]
- Lee, J.S.; Seo, M.; Kim, S.W.; Choi, M. Fetal QRS detection based on convolutional neural networks in noninvasive fetal electrocardiogram. In Proceedings of the 2018 4th International Conference on Frontiers of Signal Processing (ICFSP), Poitiers, France, 24–27 September 2018; pp. 75–78. [Google Scholar]
- Balouchestani, M.; Krishnan, S. Advanced K-means clustering algorithm for large ECG data sets based on a collaboration of compressed sensing theory and K-SVD approach. Signal Image Video Process.
**2016**, 10, 113–120. [Google Scholar] [CrossRef] - Annam, J.R.; Surampudi, B.R. AAMI Based ECG Heart-Beat Time-Series Clustering Using Unsupervised ELM and Decision Rule. In Proceedings of the 2016 International Conference on Information Technology, Bhubaneswar, India, 22–24 December 2016; pp. 137–141. [Google Scholar]
- Zazula, D. Optimization of Heartbeat Detection based on Clustering and Multimethod Approach. In Proceedings of the 2012 Annual International Conference of the IEEE Engineering in Medicine and Biology Society, San Diego, CA, USA, 28 August–1 September 2012; pp. 5–8. [Google Scholar]
- Dempster, A.P.; Laird, N.M.; Rubin, D.B. Maximum Likelihood from Incomplete Data via the EM Algorithm. J. R. Stat. Soc. Ser. B (Methodol.)
**1977**, 39, 1–22. [Google Scholar] - Caliński, T.; Harabasz, J. A Dendrite Method for Cluster Analysis. Commun.-Stat.-Theory Methods
**1974**, 3, 1–27. [Google Scholar] [CrossRef] - Jiao, C.; Su, B.Y.; Lyons, P.; Zare, A.; Ho, K.C.; Skubic, M. Multiple instance dictionary learning for beat-to-beat heart rate monitoring from ballistocardiograms. IEEE Trans. Biomed. Eng.
**2018**, 65, 2634–2648. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Sedghamiz, H. BioSigKit: A Matlab Toolbox and Interface for Analysis of Biosignals. J. Open Source Softw.
**2018**, 3, 671. [Google Scholar] [CrossRef] - Chen, T.; Guestrin, C. Xgboost: A Scalable Tree Boosting System. In Proceedings of the 22nd ACM Sigkdd International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar]
- Rosales, L.; Su, B.Y.; Skubic, M.; Ho, K. Heart Rate Monitoring using Hydraulic Bed Sensor Ballistocardiogram. J. Ambient. Intell. Smart Environ.
**2017**, 9, 193–207. [Google Scholar] [CrossRef]

**Figure 1.**A wearable ECG device that collects the ECG signals through three embedded fabric electrodes in the vest.

**Figure 4.**The structure of AE-GMM, which contains encoder and decoder convolution layers and Gaussian mixture clustering.

**Figure 5.**The feature extraction structure of the encoder is composed of 6 layers of 1D CNN, batch normalization (BN), and ReLU activation layer.

**Figure 6.**Calculation of beat-to-beat heart rate. The blue curve is the ECG signal, and the yellow solid dot is the reference position of the R wave.

**Figure 8.**Data segment diagram. The blue curve is the ECG three-lead signal, and the orange circle represents the position of each signal segment intercepted by the point at the center with the left and right radius r, and the red X are the ground truth of R wave locations.

**Figure 9.**Comparison of heart rate estimation between AE-GMM and HT on subject no. 10. (

**a**) Heart rate estimation of AE-GMM on subject no. 10. (

**b**) Heart rate estimation of HT on subject no. 10.

**Figure 10.**Heartbeat detection result of AE-GMM on subject no. 10. The figure shows the signals of three leads from 20 to 25 s, and the horizontal axis of leads 2 and 3 are shifted downward by 3.5 and 7, respectively.

Subject | Signal Length(s) |
---|---|

1 | 360 |

2 | 570 |

3, 5 | 420 |

4 | 540 |

6–10 | 180 |

Method Abbreviation | Method |
---|---|

PT | Pan–Tompkins [13] |

AMPD | Automatic peak detection [24] |

METO | Multilevel Teager energy operator [23] |

UNSW | UNSW [25] |

HT | Hilbert transform [37] |

Evo-MIACE | Evolutionary optimized multiple instance concept learning [12] |

XGBoost | eXtreme gradient boosting [36] |

**Table 4.**Performance of AG-GMM and comparisons across the 10 subjects, bold for the best, underline for the second best, standard deviations smaller than 0.01 are denoted as 0.00.

Subject | Mean Absolute Error (beat/min) | |||||||
---|---|---|---|---|---|---|---|---|

PT [13] | AMPD [24] | METO [23] | UNSW [25] | HT [37] | Evo-MIACE [12] | XGBoost [36] | AE-GMM | |

1 | 2.27 | 0.09 | 16.16 | 22.32 | 3.45 | 2.28 ± 0.15 | 2.24 | 0.05 |

2 | 1.00 | 1.55 | 0.92 | 1.18 | 3.53 | 2.19 ± 0.59 | 2.93 | 1.07 |

3 | 0.15 | 0.17 | 0.04 | 24.65 | 1.65 | 0.92 ± 0.50 | 1.30 | 0.00 |

4 | 0.09 | 0.16 | 0.00 | 0.05 | 2.67 | 1.25 ± 1.34 | 2.18 | 0.19 |

5 | 0.58 | 0.58 | 0.62 | 0.42 | 1.54 | 3.29 ± 0.70 | 2.47 | 0.96 |

6 | 0.45 | 20.02 | 0.80 | 2.56 | 1.36 | 1.59 ± 0.10 | 2.51 | 1.58 |

7 | 2.91 | 20.18 | 2.56 | 6.50 | 0.73 | 2.31 ± 0.29 | 1.63 | 1.48 |

8 | 0.00 | 0.71 | 0.76 | 0.00 | 3.71 | 3.76 ± 1.22 | 1.95 | 0.13 |

9 | 0.00 | 1.77 | 0.00 | 0.56 | 2.07 | 6.27 ± 2.64 | 3.49 | 0.91 |

10 | 12.64 | 0.28 | 0.30 | 0.12 | 2.91 | 0.00 ± 0.00 | 1.64 | 0.36 |

Total average | 2.01 | 4.55 | 2.22 | 5.84 | 2.36 | 2.39 | 2.23 | 0.67 |

**Table 5.**Heart rate estimation error under different sample lengths. The bold are the sample length set in our method and the heart rate estimation error.

Sample length | 31 | 61 | 121 | 151 | 91 |

Average error | 2.49 | 2.02 | 1.31 | 1.29 | 0.51 |

**Table 6.**Heart rate estimation error under different number of convolutional layers of autoencoder. The bold are the number of layers set in our method and the heart rate estimation error.

Number of layers | 3 | 9 | 6 |

Average error | 1.01 | 0.54 | 0.50 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Zhong, J.; Hai, D.; Cheng, J.; Jiao, C.; Gou, S.; Liu, Y.; Zhou, H.; Zhu, W.
Convolutional Autoencoding and Gaussian Mixture Clustering for Unsupervised Beat-to-Beat Heart Rate Estimation of Electrocardiograms from Wearable Sensors. *Sensors* **2021**, *21*, 7163.
https://doi.org/10.3390/s21217163

**AMA Style**

Zhong J, Hai D, Cheng J, Jiao C, Gou S, Liu Y, Zhou H, Zhu W.
Convolutional Autoencoding and Gaussian Mixture Clustering for Unsupervised Beat-to-Beat Heart Rate Estimation of Electrocardiograms from Wearable Sensors. *Sensors*. 2021; 21(21):7163.
https://doi.org/10.3390/s21217163

**Chicago/Turabian Style**

Zhong, Jun, Dong Hai, Jiaxin Cheng, Changzhe Jiao, Shuiping Gou, Yongfeng Liu, Hong Zhou, and Wenliang Zhu.
2021. "Convolutional Autoencoding and Gaussian Mixture Clustering for Unsupervised Beat-to-Beat Heart Rate Estimation of Electrocardiograms from Wearable Sensors" *Sensors* 21, no. 21: 7163.
https://doi.org/10.3390/s21217163