Next Article in Journal
Blockchain Systems in Embedded Internet of Things: Systematic Literature Review, Challenges Analysis, and Future Direction Suggestions
Next Article in Special Issue
A Point Cloud Registration Method Based on Histogram and Vector Operations
Previous Article in Journal
From Ranking Search Results to Managing Investment Portfolios: Exploring Rank-Based Approaches for Portfolio Stock Selection
Previous Article in Special Issue
Thermal Biometric Features for Drunk Person Identification Using Multi-Frame Imagery
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Novel Algorithm for Automated Human Single-Lead ECG Pre-Annotation and Beat-to-Beat Separation for Heartbeat Classification Using Autoencoders

by
Abdallah Benhamida
1,* and
Miklos Kozlovszky
2,3,*
1
Doctoral School of Applied Informatics and Applied Mathematics, BioTech Research Center, Óbuda University, 1034 Budapest, Hungary
2
John von Neumann Faculty of Informatics, Institute of Biomatics, Óbuda University, 1034 Budapest, Hungary
3
Laboratory of Parallel and Distributed Systems, Institute for Computer Science and Control, Eötvös Lóránd Research Network, 1518 Budapest, Hungary
*
Authors to whom correspondence should be addressed.
Electronics 2022, 11(23), 4021; https://doi.org/10.3390/electronics11234021
Submission received: 21 October 2022 / Revised: 14 November 2022 / Accepted: 30 November 2022 / Published: 4 December 2022

Abstract

:
An electrocardiogram (ECG) is used to check the electrical activity of the heart over a limited short-term or long-term period. Short-term observations are often used in hospitals or clinics, whereas long-term observations (often called continuous or stream-like ECG observations) are used to monitor the heart’s electrical activity on a daily basis and during different daily activities, such as sleeping, running, eating, etc. ECG can reflect the normal sinus rhythm as well as different heart problems, which might vary from Premature Atrial Contractions (PAC) and Premature Ventricular Contractions (PVC), to Sinus Arrest and many other problems. In order to perform such monitoring on a daily basis, it is very important to implement automated solutions that perform most of the work of the daily ECG analysis and could alert the doctors in case of any problem, and could even detect the type of the problem in order for the doctors to have an immediate report about the patient’s health status. This paper aims to provide a workflow for abnormal ECG signals detection from different sources of digitized ECG signals, including ambulatory devices. We propose an algorithm for ECG pre-annotation and beat-to-beat separation for heartbeat classification using Autoencoders. The algorithm includes the training of different models for different types of abnormal ECG signals, and has shown promising results for normal sinus rhythm and PVC compared to other solutions. This solution is proposed for no-noise and noisy signals as well.

1. Introduction

Monitoring the overall status of patients on a daily basis has become a very important key point in the field of healthcare due to the fact that patients cannot stay under long-term monitoring in Intensive Care Units (ICU), which is limited to cases of serious health problems. Therefore, another solution is to use the capabilities of IT in order to come up with much easier ways to automate such tasks and alert doctors in cases of the detection of any deterioration in the health status of their patients. Telemedicine is a good solution for this, as it provides the ability to share the actual health status of patients using a shared online service between doctors and patients, which shares immediate data related to different human bio-signals that could be collected using either small non-invasive sensors, such as pulse meters, pulse belts, ECG single-channel/multi-channel sensors and even body temperature sensors, or minimal-invasive sensors, such as instant blood glucose sensors or continuous blood glucose sensors that perform Continuous Glucose Monitoring (CGM).
ECG is a very important parameter for detecting human bio-signals as it might reflect both the normal sinus rhythm of the heart as well as many heart problems that are usually very critical to human life. By monitoring human ECG, we can detect many kinds of heart problems/failures, such as Premature Atrial Contractions (PAC), also called atrial premature complex (APC), Premature Ventricular Contractions (PVC), Sick Sinus Syndrome (Bradycardia, Tachycardia), or Sinus Arrest. PAC [1] is described as an extra heartbeat starting in the upper chamber of the human heart, where it could be felt as a skipped beat if the heart contains less blood at that moment, or is felt as an extra heartbeat if the heart contains a lot of blood at the moment of this beat. PVC [2] is described as a very early heartbeat in the ventricles, which follows a normal beat and causes a small pause in the heart and then a strong heartbeat due to the amount of blood that was collected in the heart during the pause. A “normal sinus rhythm” will result in a normal pulse ranging from 60 bpm to 100 bpm; however, the “Sick Sinus Syndrome” [3] is basically described as an abnormal sinus rhythm, which could be a “Bradycardia” that presents a slow sinus rhythm (pulse is less than 60 bpm) or a “Tachycardia” that presents a fast sinus rhythm (pulse is higher than 100 bpm). Sinus Arrest/Pause is a pause in the heart’s sinus rhythm, presented as a slightly longer time period between two sequential heartbeats.
From the previous explanation, we can see that these are the most relevant sinus rhythms for this study. We can extract seven different signal types, with different ECG shapes for each one of them. The different shapes are explained by the following characteristics:
  • Normal sinus rhythm in a normal healthy person would result in a normal pulse rate of a value of 60–100 bpm. Each beat has a normal shape in the PQRST complex;
  • PAC, which might not affect the pulse rate but will affect the sinus rhythm by causing an early heartbeat generated in the upper part of the heart (Atrial) followed by a small pause of the sinus rhythm. It has a normal ECG shape in the PQRST complex, but occurs earlier than usual, so that the time period between the “P” peak of this beat and the “T” peak of the previous beat is almost null;
  • PVC shape 1, which is an extra heartbeat generated in the lower part of the heart (ventricle) and disrupts the normal heartbeat generated in the upper part. This will result in a different shape, whereby the peaks “P” and “T” are missing, and a wide QRS complex;
  • PVC shape 2, which is the same as the previous but is different only in the shape;
  • Sinus Arrest, which is a pause in the sinus rhythm, meaning that we can detect a slightly longer time period between two beats, and this could have a big influence on the pulse if the pause is repeated;
  • Sick Sinus Syndrome (Bradycardia), which is a slow sinus rhythm and will result in a pulse of less than 60 bpm. The shape of the PQRST complex is normal;
  • Sick Sinus Syndrome (Tachycardia), which is a fast sinus rhythm and will result in a pulse of more than 100 bpm. The shape of the PQRST complex is normal.
As the digitalized ECG values are presented as a signal, we are able to use different signal processing approaches to analyze the ECG signal. The main idea here is that we are interested in detecting the different peaks of a heartbeat from the whole ECG signal. To do so, we need to first split every beat; then we are able to train a model in order to predict the type of every beat. The first step in splitting the beats is calculating the discrete derivative of the ECG signal function, then checking the points where the derivative changes its sign in order to find the “R” peaks. Finally, we split the heartbeats in connection with the sampling rate (or the measurement frequency) of the used sensor.
After splitting the heartbeats, we use so-called Autoencoders in order to detect if a given ECG signal of a heartbeat is normal or abnormal. The Autoencoder will provide a reconstructed version of the formal shape of a normal sinus rhythm in an ECG signal. After determining that a given heartbeat is abnormal, we perform the next step to predict the type of abnormal ECG signal according to the known characteristics of heart problems. Any failure in detecting the shape of the ECG signal could mean that the given signal presents another heart problem, and this is alerted to doctors for manual assessment.
Autoencoders are often used for noise reduction in images [4], human bio-signals such as the ECG [5,6], and even for speech signals [7], but they are here used to train a model for abnormal ECG arrhythmia detection by comparing the test data to the reconstructed ECG signal. The training is performed using the MIT-BIH database, the St Petersburg INCART 12-lead Arrhythmia Database, and the Long-Term Atrial Fibrillation (AF) Database (LTAFDB). The prediction result is further assessed by calculating the error value between every heartbeat and the reconstructed ECG signal. The error is introduced by the area surface between the heartbeat and the reconstructed ECG signal, whereas, in this case, it is the cumulative absolute value of the difference between these two signals for all consecutive values of one heartbeat.
In this paper, we propose a novel algorithm for ECG pre-annotation and beat-to-beat separation for heartbeat classification using Autoencoders. The solution and workflow are proposed for no-noise and noise-based ECG signals, where the noisy ECG signal mostly comes from stream-like ECG sensors. In the pre-annotation process, we aim to detect the R peaks in order to use them to separate the heartbeats, and make the prediction later using the trained Autoencoder models. First, we get the first discrete derivative of the original signal, calculated as the difference between all consecutive values of the data. Second, we calculate the threshold based on the maximum value of the discrete derivative. Finally, we determine which represents the R peaks.
The novelty of our research is our use of Autoencoders to learn the formal shape of a normal heartbeat ECG curve, reconstruct its shape, and then compare it to any input signal in order to check the similarity between the two input signals and thus predict if it is a normal or abnormal heartbeat, using the auto-calculated threshold derived from the training process. Therefore, we first had to develop a preprocessing block to perform the pre-annotation based on the first discrete derivative of the input signal, calculated as the difference between every two consecutive values of the signal, and then detect the spots where this derivative changes its polarity and has a big value of change in a small time period. The change should be bigger than the threshold calculated automatically based on the input signal, where these detected spots present the R peaks of the different heartbeats. These annotations are used to split the heartbeats based on the sensor sampling rate. The different heartbeats are then assessed using the trained Autoencoder model to detect normal or abnormal beats. If any arrhythmia is detected in any of these beats, the given heartbeat is checked again with the very same process, but using another Autoencoder model trained to detect anomalies such as different shapes of PVC heartbeats. The same process is used to detect other types of arrhythmias.
In the Section 3, we introduce the background of similar attempts using automated ECG annotation tools. In the Section 4, we start by introducing heart problems, which helps us to understand the patterns of these heart issues; then, we give a deep explanation of the proposed algorithm. Section 5 gives a brief introduction of the achieved results, followed by a discussion, and finally, we summarize the technical contributions of our paper compared to other existing solutions.

2. Materials and Methods

This research presents briefly the new proposed algorithm for human heart arrhythmia detection. It presents the use of Autoencoders for the purpose of detecting abnormality in ECG signals. The proposed algorithm involves the training of Autoencoder models for different types of arrhythmias that show different shapes in the ECG signal. The pre-trained models could detect whether the input signal has the same shape as the reconstructed version of the signal or not by using a threshold that defines the maximum accepted error between the two signals. The proposed workflow involves the pre-annotation process applied to feed the models with pre-annotated data related to different peaks in the ECG signal, and/or detect these peaks in the ECG signals as normal signals. Then, the mathematical format for calculating the threshold of the binarization process is defined after the pre-annotation algorithm. In addition, the detailed structure of the built-in Neural Network for the Autoencoder is briefly explained.
The data used to train these models are taken from the following annotated ECG databases: the MIT-BIH Arrhythmia Database, the St Petersburg INCART 12-lead Arrhythmia Database, and the Long-Term Atrial Fibrillation Database (LTAFDB). These databases are all available online, and the results achieved in this research could be easily reproduced by using these databases together with the proposed algorithm in Section 4.2 of this article. Its results could thus be validated together with the results presented in Section 5.

3. Related Work

Many attempts have been made to provide automated solutions to detect deteriorations in patients by detecting different types of abnormalities in human bio-signals. In the case of human ECG signals, some research has been undertaken to provide annotated ECG databases that will enable researchers to then further improve the manual annotations, detect important spots in the signals, such as the QRS complex of the ECG signal, or to find the RR intervals between different heartbeats. Other types of research include the use of machine learning techniques and trained models to automatically detect the different peaks or the key points of an ECG signal (PQRST peaks). Furthermore, other advanced research has been undertaken to enable patient monitoring with noisy signals, or even to provide a real-time solution to enable the real-time monitoring of patients in all types of daily activities. In this section, we provide a good description of the related work, assessing all the different contributions made by researchers in this field.
PhysioBank, PhysioToolkit, and PhysioNet [8] are the three main components of a research solution that enables researchers to save, archive, or reuse complex physiologic signals in the PhysioBank, using the libraries of PhysioToolkit and visualizing using PhysioNet. The MIT-BIH Arrhythmia Database [9] was the first standard test material available for researchers to undertake further research on the usage of automated solutions for patient monitoring. The St Petersburg INCART 12-lead Arrhythmia Database [10] is a 12-lead ECG database of heart ECG arrhythmia records presented and contributed by the St. Petersburg Institute of Cardiological Technics (Incart). The Long-Term Atrial Fibrillation (AF) Database [11] is another ECG database available online that provides 84 long-term ECG signals of patients with paroxysmal or sustained atrial fibrillation. Moreover, the Chinese Cardiovascular Disease Database (CCDD or CCD database) [12] was developed to provide a wide set of improved technical parameters of raw ECG data.
Some attempts have been made to automate the annotation process of these ECG signal recordings and/or those from many other databases that are available online. A cascaded classification system is provided in [13] for multi-lead ECG signals based on feature fusion to improve the performance of ECG signal classification on a beat-to-beat basis. In this research, ten different features were selected and used to train the model separately on the 12 different leads of the ECG input signal. Furthermore, these ten features were fused together in a novel feature fusion method to implement the cascaded classifier using multilayer perceptron (MLP) and random forest (RF). A new single lead delineator [14] was developed based on phasor transform by converting every ECG sample into a phasor that can easily manage P and T peaks with low amplitude compared to the R peak; this research used many different online databases and reached 99.81% detection accuracy for the QRS complex, with a maximum localization error of 6 milliseconds between the automated and the manual annotation.
A convolutional neural network (CNN) model was trained in [15] using PhysioNet databases for ECG annotation of P waves, QRS complexes, T waves, noise signals, and inter-beat ECG segments. This research was performed as the basis for proposing a classification system of normal or abnormal cardiac rhythms. Signal features were extracted for NSR, AF, alternative rhythm and noisy signals. This research achieved a 98% positive detection rate in the manual annotation of R peaks in the QT database, and a 99% positive predictive value. However, the positive detection rate of the P and T peaks reached 92% and 88%, respectively. A semi-automated solution was introduced in [16] based on the PhysioNet LightWAVE visualization tool to extend its capabilities for ECG peak annotation. This solution is referred to as semi-automated because it can produce automated annotations, but will require manual annotation by specialists in cases of low detection confidence compared to a threshold.
A novel algorithm was presented in [17] to enable the real-time detection of heart rate and the annotation of heart-beats in multi-model data that consist of the ECG signal together with the blood pressure signals. This latter is used to detect heartbeat annotations if the ECG signal is unavailable, distorted, or very noisy. As part of the PhysioNet/CinC Challenge 2017, the authors of [18] presented an automated algorithm that classifies atrial fibrillation (AF), normal sinus rhythm (NSR), and noisy signals in short and single-channel ECG records. Another method was used to combine two different methods for a better onset prediction of atrial fibrillation using the variability of ECG signals [19], and the final prediction rate reached 90%; the first method involved the analysis of the ECG signal’s heart rate variability (HRV), while the second method is based on the ECG signal’s morphologic variability (MV). Furthermore, a system [20] was implemented to perform the automated annotation of different specific peaks of the ECG signal, as well as the rhythm of the heartbeats, by diagnosing and detecting significant changes in the ECG signal.
In the case of ambulatory ECG devices, the results obtained in [21] show that this is a good starting point, and is suitable to include in next-generation wearable devices or sensors. This research involves the use of a reliability index that is assigned to ECG segments in order to assess the reliability of heart rate signals retrieved from ambulatory ECG sensors or devices. The proposed method was validated on 1500 manually annotated samples of ECG signals with different sampling rates taken from other studies. Another study was undertaken in [22] to provide a filtering and classification tool for ECG signals in free-living or so-called non-supervised environments. An integral–coefficient–band-stop (ICBS) filter and two-layered Hidden Markov Models (HMMs) are used to firstly remove the time-consuming floating-point processes and then perform the feature extraction and classification of the input signals into the normal or one of the two abnormal ECG signals (either APC or PVC).
Other research was performed in [23] to provide decision support or a decision-making system to diagnose coronary heart disease caused by plaque in the walls of heart arteries. This research involves the implementation and comparison of seven different algorithms that are used for the baseline removal of the ECG signal. The compared algorithms involve the use of different approaches and methods, such as adaptive filters, linear digital filters, polynomial-based approaches, multi-resolution analysis, and curve fitting. The comparison was made according to the manual annotation of ST segments in many ST segment deviation records of the European Society of Cardiology (ESC) ST-T database. This research shows that the results obtained from the use of a “Wavelet Adaptive Filter” for baseline removal were the closest to the ground-truth manual annotations. Another study [24] combined the analysis of ECG signals and motion activity to diagnose coronary heart disease. The research involves the detection of the ST segments of ECG signals together with the motion activity, represented by the heart rate signal. The method is trained and simulated using the Long-Term ST Database, which includes in its annotation whether the specific patient has a coronary heart disease, and achieves an accuracy of 80%.
Other studies used wavelet transform to detect the R peaks, such as in [25], where the authors introduced a supervised learning algorithm that is able to automatically detect the scales of the used training database using a small dataset with manual annotations made by physicians. The selected scales are applied to the whole ECG signal in order to annotate the R peaks. Furthermore, the wavelet transform technique was used to analyze ECG data compression in [26] by looking for redundancy in the ECG signal and trying to find an optimal compression method based on a strategy specifically designed for ECG signals. In addition to this research, an automated solution [27] was developed and tested to detect pediatric ventricular pre-excitation (VPE) with a trained classifier based on decision trees, where the positive prediction value reached 88%. Furthermore, a novel real-time classifier for normal human cardiac behavior detection was proposed in [28]. This classifier is used to profile different cardiac behaviors in different patients, and even for different physical conditions for the same patient.
The applied research did not focus only on classifying ECG heartbeats, but also on detecting the quality of the ECG signal. The research in [29] was based on a tree classifier that classifies the ECG signal into four different classes, ranging from high quality signal to electrode shedding with serious noise.
Furthermore, it is worth noting that the annotation of ECG is used in other research related to seismocardiography (SCG), such as in [30], where the authors collected ECG and SCG data from 18 participants subjected to lower negative body pressure and the corresponding manual ECG annotation of R peaks, and then automatically annotated the SCG. The results of comparing the manual isovolumic moment timings and the automated results of the algorithm look promising. Another research [31] introduced a novel algorithm for the use of micro-electro-mechanical system (MEMS) accelerometers in the automated annotation of seismocardiographic (SCG) recordings for patients in a resting state, achieving a 96.9% detection rate of isovolumic moment (IM) peaks and a 95.6% rate for aortic valve closure (AC) peaks.
In the previous research presented in the literature, many problems have been detected regarding ECG monitoring, such as the problems related to the digitalization and storage of stream-like long ECG recordings that are collected from long-term ambulatory sensors or devices [32]. A framework and a real solution for all the steps involved in ECG monitoring, from data collection from single-channel ECG sensors and digitalization to data storing, were introduced in [33]. Furthermore, we have presented a new enhanced version of the Health Level Seven International (HL7) Fast Healthcare Interoperability Resources (FHIR) data format, named HL7-aECG. The new enhanced version, published in [34], serves to improve the ability to store stream-like ECG data, which we have reviewed previously. Finally, one of the most important problems when dealing with digital ECG data regards the interoperability issues between different data formats or standards; therefore, we introduced a conversion tool in [35] that uses an intermediate flexible data format in order to enable data transfer between different standards, via mapping all data of different standards to an intermediate data format. This was applied to conversion between digitized ECG signals. On the other hand, the conversion from paper-based to digitized ECG signals is a difficult task; however, a morphological method was presented in [36] introducing a new conversion process that separates the background noise from the input paper-based signal and provides it in a digital format in the corresponding ECG signal.
The novelty of our research lies in the use of Autoencoders, not for signal noise reduction, but to learn the shape of a normal heartbeat ECG curve, reconstructing its formal shape, and then comparing it to any input signal in order to extract a similarity approximation between the two signals, then predicting its normality vs. abnormality status compared to the threshold auto-calculated in the training process. To do so, we first had to develop a pre-annotation solution based on the first discrete derivative of the input signal, calculated as the difference between each two consecutive values of the signal, and then detect the spots where this derivative shows a large change value (above a given threshold calculated automatically based on the input signal) in a small time period. These spots present the R peaks of the different heartbeats, and these annotations are used to split the heartbeats based on the frequency of the sensor sampling rate. The different heartbeats are then predicted using the trained Autoencoder model to identify normal or abnormal beats. If any arrhythmia is detected in any of these beats, then the given heartbeat is predicted again with the very same process using another Autoencoder model, trained to detect anomalies such as a PVC heartbeat. The same process is used to detect other types of arrhythmias.

4. Heart Arrhythmia and Proposed Algorithm

Before describing the details about the proposed algorithm, it is necessary to give brief overview of the different problems related to heart rhythm in order to better understand the process of the novel algorithm. The heart problems presented in the Section 1 of the Introduction will be explained, and an example is presented for each type of arrhythmia.

4.1. Heart Arrhythmia Problems

4.1.1. Premature Contractions

Premature Contractions are heartbeats that are generated either in the atrial or the ventricle. The type generated in the atrial are referred to as Premature Atrial Contractions (PAC), whereas those generated in the ventricle are called Premature Ventricular Contractions (PVC). PAC and PVC have different ECG signal shapes, and it is also important to mention that the PVC exhibits two differently shape ECG signals.
PAC [1] is an extra heartbeat that is generated in one of the two upper chambers (atrial) of the human heart, and it could be felt by the patient as a skipped beat if the heart contains less blood at that moment, or as an extra heartbeat if the heart contains more blood at the moment of this beat. This will result in a heartbeat that looks the same as a normal heartbeat, but with a small RR interval between the affected heartbeat and its predecessor. Figure 1a shows the general shape of a PAC, where we can see that the third heartbeat comes too early and has the shape of a normal heartbeat, because it was generated in the upper chambers of the heart.
PVC [2] is described as a very early heartbeat in the ventricles that follows a normal beat, and it causes a small pause in the heart and then a strong heartbeat due to the amount of blood that was collected in the heart during the pause. A PVC can show two different ECG curves depending on the amount of blood collected in the heart and the timing of the generation of the affected heartbeat in the ventricle. Figure 1b shows periodical Premature Ventricular Contractions (PVC) of two different shapes in the second, fifth, and the seventh heartbeats, whereas Figure 1c shows a single PVC of the first shape in the third heartbeat.

4.1.2. Sinus Arrest

Sinus Arrest (also called Sinus Pause) is a pause in the heart’s sinus rhythm presented as a slightly longer period between two sequential heartbeats. The RR interval is used to detect Sinus Arrest. The RR interval in Normal Sinus Rhythm is the same as that for most of heartbeats; however, it looks very long (with a big RR value) in heartbeats affected by a Sinus Arrest. Figure 2 shows an example of a Sinus Arrest presenting as a pause in the normal sinus rhythm between the second and third heartbeats, which would feel like a skipped heartbeat for the patient.

4.1.3. Sick Sinus Syndrome

A Normal Sinus Rhythm (NSR) [3] presents an ECG curve status that would normal for a healthy person, which will result in a normal pulse ranging from 60 bpm to 100 bpm and, in the normal case of daily activities without extra physical effort, will show almost equal values of RR intervals between all heartbeats, ranging from 0.6 s to 1 s. Figure 3a shows the Normal Sinus Rhythm of a healthy person, where we can see all the PQRST peaks of all the heartbeats, in addition to the normal range of RR intervals between all heartbeats.
However, “Sick Sinus Syndrome” [3], which could also be called “Abnormal Sinus Rhythm”, can basically be described as an abnormal signal of the sinus rhythm that will result in RR interval values that are out of the normal range. An Abnormal Sinus Rhythm could mean either a “Bradycardia” (Figure 3b), presenting a slow sinus rhythm (where the pulse is less than 60 bpm and the RR value is more than 1 s), or a “Tachycardia” (Figure 3c), presenting a fast sinus rhythm (the pulse is higher than 100 bpm and the RR value is less than 0.6 s). In order to determine that a given ECG signal is a Bradycardia or a Tachycardia, the signal should indicate a sinus rhythm with RR interval values all above 1 s or less than 0.6 s consecutively.

4.2. Proposed Algorithm

According to the description of the different types od ECG signals and arrhythmias, the following workflow is proposed to provide a generic solution for detecting abnormalities in ECG signals using Autoencoders. Autoencoders are used to determine the formal shape of a normal heartbeat ECG curve, reconstruct its shape, and then compare it to an input signal, which could be saved previously or even derived from real-time ECG data collected from patients during different daily activities, in order to check for similarities between the two input signals and then predict if this is a normal or abnormal heartbeat using the auto-calculated threshold derived in the training process.
Therefore, the proposed algorithm involves the following steps:
  • First, start with the preprocessing block to form a pre-annotation based on the first discrete derivative of the input signal, which is calculated as the difference between each two consecutive values of the signal;
  • Detect the spots where this derivative changes its polarity and shows a big value of change in a small time period—the change should be bigger than the threshold calculated automatically based on the input signal. These detected spots present the R peaks of the different heartbeats;
  • These annotations of R peaks are used to split the heartbeats based on the sensor sampling rate;
  • The different heartbeat types are then predicted using the trained Autoencoder model to determine if this presents a normal or abnormal beat;
  • If any arrhythmia is detected in any of these beats, the given heartbeat is checked again with another Autoencoder model, which is trained to detect anomalies such as different shapes in a PVC heartbeat;
  • The same process is used to detect other types of arrhythmias.
Figure 4 shows the overall structure of the proposed algorithm for the whole process of classification.
In the process of training the Autoencoders, we used over four thousand heartbeats from the MIT-BIH ECG data of different patients, of which 20% were used for testing and 80% for training, and the numbers of signals implying normal and abnormal ECG were almost equal. More than 1500 heartbeats were NSR (normal sinus rhythm), and an equal number were abnormal heartbeats containing APC, PVC, and noise data. However, in the case of the Autoencoder dedicated to NSR detection, we selected only the heartbeats annotated as NSR, while in the case of the Autoencoder dedicated to PVC detection, we used the “St Petersburg INCART 12-lead Arrhythmia Database” dataset, which provides a wide set of records with PVC annotations.
We used “Tensorflow” and “Keras” to build our model of the three main densely connected Neural Network (NN) layers for both the encoder part and the decoder part. The model was built to be trained using the “Adam” optimizer with 100 epochs and a batch size of 512. In the case of the encoder, we used the following layers:
  • Dense layer with a 32-unit output shape and rectified linear activation process (relu);
  • Dense layer with a 16-unit output shape and rectified linear activation process (relu);
  • Dense layer with an 8-unit output shape and rectified linear activation process (relu).
For the decoder, we used the following dense layers:
4.
Dense layer with a 16-unit output shape and rectified linear activation process (relu);
5.
Dense layer with a 32-unit output shape and rectified linear activation process (relu);
6.
Dense layer with an output shape of the minimum signal length units and the sigmoid activation function. The minimum signal length is calculated based on the sampling rate/frequency of the input data depending on the used ECG device.
In the pre-annotation process, we aimed to detect the R peaks in order to use them to separate the heartbeats and thus later make the prediction using the trained Autoencoder models. This step consists of three main sub-parts:
The first is to get the first discrete derivative of the original signal, calculated as the difference between all consecutive values of the data. The proposed algorithm for the pre-annotation is shown in Algorithm 1, and the necessary formulae from the algorithm follow it.
Algorithm 1: Pre-annotate ECG Data
   Data: X ← dataSignal        # the whole ECG input signal
   Result: R_annotations       # the pre-annotated R peaks indices in the signal
   dxdy ← diff(X);            # calculate the first forward discrete derivative
   th ← max(dxdy)/2; # the threshold could be changed, for instance using the standard deviation
   dataLength ← sizeOf(dxdy);
   dxdy_bin ← [];            # to contain the detected spots for possible R peak
   rm ← 5;
   R_annotations ← [];         # to contain the R peaks
   for i ← 1, dataLength do:
     if dxdy[i] ≥ th then:
       dxdy_bin.append(1);
     else:
       dxdy_bin.append(0);
     end
   end
   for i ← 1, dataLength do:
       if dxdy_bin[i]=1 then:
          R_annotations.append(max(X[(i+1-rm, i+1+rm)]); # append the index of the detected R peak
       end
   end
   return R_annotations;
The signal values are saved in the array “X”, “t” is the time axis (in this case, the index of the data inside the data array, depending on the used sensor sampling rate), and “dx” is the first forward discrete derivative of the signal data (Equation (1)).
The second sub-part is to calculate the threshold based on the maximum value of the discrete derivative (Equation (2)).
d x = f ( x ) = d X d t = X ( x + 1 ) X ( x ) ( t + 1 ) t = X ( x + 1 ) X ( x ) ,   x N   ( x < | X | ) ,
t h = m a x ( d x ) 2 ,
where “th” is the threshold. The third sub-part is finding the R peaks. In our case, it is considered that the noise generated during the collection of data will have smaller values than the actual change in voltage caused by the QRS complex; therefore, the detection of the R peak is made easier by using the first discrete derivative of the ECG signal. Since we are using the first forward discrete derivative, the selection of the R peak demands finding the spots where the derivative changes its polarity with a value greater than the threshold; however, it should be found within a given range from the detected spot, where the margin of this range could be determined at the beginning (for instance, the range rm = 5).
The next task is what we call the “binarization” of the results by finding the points of interest (POI), where “dx” surpasses the threshold “th”.
P O I = b i n ( x ) = { 1 ,     d x t h 0 ,     d x < t h   , x N   ( x < | d x | ) ,
The R peaks are detected using the following formula:
R ( x ) = { m a x ( X [ x r m ,   x + r m ] , d x = 1 n u l l , d x = 0   , x N   ( x < | d x | ) ,
After the detection of the R peaks, we split the beats by taking the same amount of signal data before and after each R peak, wherein the amounts of values taken before and after depend on the sampling rate of the used sensor or device, taking into account the fact that the normal pulse for a healthy person ranges from 60 bpm to 100 bpm, and in a normal case of daily activities without extra physical effort, it will show almost equal values of RR intervals between all heartbeats, ranging from 0.6 s to 1 s.

5. Results

This section outlines all the relevant results achieved in this research regarding all the sub-sections related in Figure 4 in the previous section.

5.1. Pre-Annotation Results

This process consists of three main parts, shown in Figure 5, where we show an example of testing data extracted in our lab for manual testing purposes. It is clear that the signal that is collected using an ambulatory device (Savvy ECG) contains lot of distracting noise (especially in the last third of the data). The first discrete derivative of the signal is obtained, and we then calculate the threshold based on the maximum value of the derivative signal. Then, a “binarization” process finds the spots where the values exceed the threshold. These spots are the R peaks of the original signal.
As shown in Figure 5, the detection algorithm is limited to the high noise in the original signal. In fact, Figure 5 shows the wrong detection that could occur in the system; for instance, R peak 15 is missing because the value of change in the original signal was slightly under the detected threshold, and this resulted in excluding this peak. Furthermore, R peaks 28 and 29 are missing from the original signal due to the high noise frequency, caused by the intentional movement of the sensor used in order to show the limitations of the system.
The beats are then split as shown in Figure 6, where we can see that all the detected R peaks from all data sources are perfectly aligned together. It is clear that the data in (a), showing the values before and after the R peaks, are noisy, as we used an ambulatory sensor that in some cases produces large noise values depending on the daily activity the patient is performing. (b) shows the NSR heartbeats in the MIT-BIH database that are split correctly; however, the data are slightly noisy, but not as much as those previous. (c) shows the NSR heartbeat data of the INCART database split correctly, which are not noisy. (d) shows the PVC heartbeat data from the INCART database split correctly, which are not noisy; (e) shows the NSR heartbeat data from the LTAFDB database, split correctly except for one heartbeat, which is clearly not aligned with the rest of the heartbeats but is still considered because it is annotated as NSR in the original annotation, and the original data are very noisy.
According to the used datasets and their noise, we expected that the training and validation loss would be better when training the PVC model, as it is uses the non-noisy data from the INCART ECG database.

5.2. NSR and PVC Autoencoders Training Results

According to the previous step of splitting the heartbeats for the training process, the results of the training and those regarding validation loss were exactly as we expected, as we see a big difference between the training of the NSR Autoencoder and the PVC Autoencoder models. The training of the latter was far better than that of the first; however, both trained models reached very low loss during both the training and the validation processes. The training loss of the NSR Autoencoder reached 0.001 at the end of the training process, while the validation loss was 0.0419. On the other hand, the training loss for the PVC Autoencoder ended at 0.00097, with 0.004 for the validation. Figure 7 shows that the training of both models was smooth and started to attain the optimum training value from the 10th epoch.
After the training of both Autoencoders, multiple testing processes were performed to ensure the validity of the obtained results and the trained Autoencoder models, as shown in Figure 8. The first involved predicting the MIT-BIH testing data of normal sinus rhythm heartbeats (refer to Figure 8b). The second test involved the use of the anomalous testing data from the MIT-BIH database (refer to Figure 8c). It is clear that the testing loss results of the NSR data are much closer to the NSR Autoencoder training results (Figure 8a). The third test took place during the training process of the PVC Autoencoder (Figure 8d). The other test involved using the testing data of the INCART database (Figure 8e), where the similarity of the distribution of the results is clear, except for the number of data points. Finally, the last test used the LTAFDB data to check NSR heartbeats. Furthermore, we tested the INCART ECG data using the NSR Autoencoder, and compared them against the PVC Autoencoder in order to validate the obtained results.
Figure 9 shows the confusion matrices for: (a) the training data from the MIT-BIH database, where no false positives were present, which means that no bad heartbeat was predicted as an NSR; (b) testing data collected from the ambulatory sensor (Savvy ECG), where all the heartbeats were well predicted compared to our manual annotation of the heartbeats, whereby we annotated only 18 abnormal heartbeats due to the high noise in them; (c) INCART data tested using the NSR Autoencoder; (d) PVC Autoencoder prediction results for the INCART data.
In the last two, we used the very same testing data with two different Autoencoders; however, we derived different results due to the fact that the NSR Autoencoder was trained using the MIT-BIH database, which contains some noise and shows differences in the voltage rate compared to the INCART database (refer to Figure 6 for more details). The results shows that the PVC Autoencoder was able to fix all the false negatives and false positives in the NSR Autoencoder, which means that any problem with the detection in the first Autoencoder will be resolved in the second attempt with the PVC Autoencoder.

5.3. Reconstruction Accuracy and Results

The trained models yielded very good results regarding the reconstructed models, and the predictions according to the training, testing, and validation of the reconstructed models are, in some testing cases, almost the same as the testing data. Figure 10 shows the reconstruction shapes achieved for both the NSR (Figure 10a,b) and the PVC data (Figure 10c). In addition, the achieved accuracy, precision, and recall are all presented in Table 1, where we can see that the NSR Autoencoder achieved great results in the prediction of the MIT-BIH data, the ambulatory sensor (Savvy ECG) data, and the LTAFDB data; however, its performance was low when applied to the INCART database because the voltage of the T peak in this database is very high compared to those in the MIT-BIH and Savvy ECG data. However, these problems were overcome by the use of the PVC Autoencoder, which is accepted in the workflow proposed in Figure 4.

5.4. PQRS Peaks Detection

The previous results were used in the same built system in order to detect the P, Q, R and S peaks of every ECG beat separately when the given ECG heartbeat was annotated as a normal heartbeat. The detection of P, Q, R and S peaks was performed as follows:
  • First, we detected the R peak as the maximum point of the signal;
  • Then, Q was taken as the minimum point between the beginning of the signal and the R peak;
  • The P peak is the maximum point between the beginning of the signal and the Q peak;
  • Finally, S is the minimum point between the R peak and the end of the signal.
This is the basic automated task of the ECG signal annotation of P, Q, R and S peaks. However, it is recommended for use to minimize the requirement of manual ECG data annotation and improve the results by reducing the time of the annotation process. The results of this process could be improved by manually checking after the automated process is finished in order to confirm the achieved annotation. Table 2 shows an extracted version of the PQRS peak detection results from the MIT-BIH database, where the detected values present the index of the detected peak in the same heartbeat with a 360 Hz sampling rate in the case of the MIT-BIH database. The proposed solution for PQRS peak detection achieved, in the case of MIT-BIH data, 100% accuracy in detecting the R peak compared to the original annotation of the MIT-BIH database, and even corrected these annotations by confirming them in relation to the detection of the R peak with a margin of +/− 2 positions, which means +/− 6 milliseconds from the original annotation. All the corrected annotations were checked and validated manually.

6. Discussion

The achieved results show high reliability compared to existing solutions in the field of Neural Networks applied in patient health monitoring in general, and in ECG monitoring specifically. This paper aims to present the whole workflow, not only an algorithm. All the proposed solutions have been developed and tested, showing high precision and performance. The workflow structure is well explained and anyone could reproduce the results when following the exact description and configuration given in this paper. During the implementation of this research, we used different sources of ECG data, and all the results and the necessary comparisons of the trained models are well presented; the MIT-BIH database showed good results for NSR heartbeat detection (with a normal low voltage value for the T peak), while the INCART database is more suitable for PVC detection.
Regarding the pre-annotation solution, it is clear that the detection of the R peaks is precise, and can be used for beat-to-beat separation, by which the detected R peaks are well cropped and aligned, as presented in Section 5.1. The training process of the NSR and PVC Autoencoders finished with fairly low data loss for both models, as described in Section 5.2, and were used to attain high prediction accuracy, precision, and recall for all the different sources of data, as shown in Section 5.3. In the case of any failure in the first trained model of NSR heartbeats, the PVC model will perform rechecking in order to validate the results and detect whether the given heartbeat is a PVC heartbeat. The achieved results are very good in comparison with pre-existing solutions, and could be prepared and validated further for real-world use.
Further work in this area will include the final validation of the achieved results with a bigger ECG dataset and with other available datasets. It is worth saying that the INCART and LTAFDB databases could also be used to retrain the first Autoencoder in order to yield a wider prediction rate for NSR heartbeats with high voltage of the T peak (in the case of the INCART data) and for noisy NSR heartbeats (in the case of the LTAFDB data). In addition, this research could be extended using the same proposed workflow to detect other types of heart arrhythmias in ECG signals, or even for other types of time series related to human bio-signals.
Table 3 gives a comparison of detection accuracy between the results of the proposed workflow, with its two Autoencoder models, and the single lead delineator presented in [14], the CNN sing PhysioNet database [15], the onset prediction system of atrial fibrillation [19], the coronary heart disease diagnostic system [24], the pediatric ventricular pre-excitation detector [27], and the isovolumic moment (IM) peak detector [31].

7. Conclusions

This paper aimed to present a novel workflow and an algorithm for patient monitoring using ECG data. The proposed workflow involved the use of Neural Networks in order to train, test, and validate Autoencoder-based models using different sources of ECG data that contain different types of heartbeat, including NSR and some types of heart arrhythmia. The trained models are used to encode the normal ECG data using the encoder part of the Autoencoder, and then build a reconstructed version of the NSR beat for use in predicting the input ECG data, either on a real-time basis or for previously digitized data. The trained models and the proposed workflow show promising results for future work, enabling us to introduce more arrhythmias for a better and more robust patient health status monitoring system, either in Intensive Care Units (ICU) or during daily activities. The achieved results have been discussed and compared to other pre-existing solutions, and show great promise. Further works could focus on using a wider set of databases with bigger number of records in order to give more precise results for clinical use.

Author Contributions

Conceptualization, A.B.; methodology, A.B.; software, A.B.; validation, A.B. and M.K.; formal analysis, A.B.; investigation, A.B.; resources, A.B.; data curation, A.B.; writing—original draft preparation, A.B.; writing—review and editing, A.B. and M.K.; visualization, A.B.; supervision, M.K.; project administration, M.K.; funding acquisition, M.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Eötvös Loránd Research Network Secretariat under grant agreement no. ELKH KÖ-40/2020 (Development of cyber-medical systems based on AI and hybrid cloud methods), the GINOP-2.2.1-15-2017-00073 “Telemedicina alapú ellátási formák fenntartható megvalósítását támogató keretrendszer kialakítása és tesztelése” project, and the 2019-1.3.1-KK-2019-00007 “In-novációs szolgáltató bázis létrehozása diagnosztikai, terápiás és kutatási célú kiberorvosi rend-szerek fejlesztésére” project.

Data Availability Statement

Not applicable.

Acknowledgments

The research was supported by the Ministry of Innovation and Technology NRDI Office within the framework of the Infocommunications and Information Technologies National Laboratory. The authors hereby thank the Eötvös Loránd Research Network Secretariat under grant agreement no. ELKH KÖ-40/2020 (Development of cyber-medical systems based on AI and hybrid cloud methods), the GINOP-2.2.1-15-2017-00073 “Telemedicina alapú ellátási formák fenntartható megvalósítását támogató keretrendszer kialakítása és tesztelése” project, and the 2019-1.3.1-KK-2019-00007 “Innovációs szolgáltató bázis létrehozása diagnosztikai, terápiás és kutatási célú kiberorvosi rendszerek fejlesztésére” project for their financial support.

Conflicts of Interest

The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

References

  1. Conen, D.; Adam, M.; Roche, F.; Barthelemy, J.-C.; Felber Dietrich, D.; Imboden, M.; Künzli, N.; von Eckardstein, A.; Regenass, S.; Hornemann, T.; et al. Premature Atrial Contractions in the General Population. Circulation 2012, 126, 2302–2308. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. Cha, Y.-M.; Lee, G.K.; Klarich, K.W.; Grogan, M. Premature Ventricular Contraction-Induced Cardiomyopathy. Circ. Arrhythm. Electrophysiol. 2012, 5, 229–236. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  3. Gregoratos, G. Sick Sinus Syndrome. Circulation 2003, 108, e143–e144. [Google Scholar] [CrossRef] [PubMed]
  4. Zhang, C.; Zhou, L.; Zhao, Y.; Zhu, S.; Liu, F.; He, Y. Noise reduction in the spectral domain of hyperspectral images using denoising autoencoder methods. Chemom. Intell. Lab. Syst. 2020, 203, 104063. [Google Scholar] [CrossRef]
  5. Chiang, H.-T.; Hsieh, Y.-Y.; Fu, S.-W.; Hung, K.-H.; Tsao, Y.; Chien, S.-Y. Noise Reduction in ECG Signals Using Fully Convolutional Denoising Autoencoders. IEEE Access 2019, 7, 60806–60813. [Google Scholar] [CrossRef]
  6. Xiong, P.; Wang, H.; Liu, M.; Liu, X. Denoising Autoencoder for Eletrocardiogram Signal Enhancement. J. Med. Imaging Health Inform. 2015, 5, 1804–1810. [Google Scholar] [CrossRef]
  7. Lu, X.; Tsao, Y.; Matsuda, S.; Hori, C. Speech Enhancement Based on Deep Denoising Autoencoder. 5. Interspeech 2013, 2013, 436–440. [Google Scholar]
  8. 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 2000, 101, E215–E220. [Google Scholar] [CrossRef] [Green Version]
  9. Moody, G.B.; Mark, R.G. The impact of the MIT-BIH Arrhythmia Database. IEEE Eng. Med. Biol. Mag. 2001, 20, 45–50. [Google Scholar] [CrossRef]
  10. Tihonenko, V.; Khaustov, A.; Ivanov, S.; Rivin, A.; Yakushenko, E. St Petersburg INCART 12-lead arrhythmia database. PhysioBank PhysioToolkit PhysioNet. 2008. Available online: https://physionet.org/content/incartdb/1.0.0/ (accessed on 14 June 2022).
  11. Petrutiu, S.; Sahakian, A.V.; Swiryn, S. Abrupt changes in fibrillatory wave characteristics at the termination of paroxysmal atrial fibrillation in humans. EP Eur. 2007, 9, 466–470. [Google Scholar] [CrossRef]
  12. Jia-Wei, Z.; Xia, L.; Jun, D. Ccdd: An Enhanced Standard Ecg Database with Its Management and Annotation Tools. Int. J. Artif. Intell. Tools 2012, 21, 1240020. [Google Scholar] [CrossRef]
  13. Chen, G.; Hong, Z.; Guo, Y.; Pang, C. A cascaded classifier for multi-lead ECG based on feature fusion. Comput. Methods Progr. Biomed. 2019, 178, 135–143. [Google Scholar] [CrossRef] [PubMed]
  14. Martinez, A.; Alcaraz, R.; Joaquin Rieta, J. Application of the phasor transform for automatic delineation of single-lead ECG fiducial points. Physiol. Meas. 2010, 31, 1467–1485. [Google Scholar] [CrossRef] [PubMed]
  15. Sodmann, P.; Vollmer, M.; Nath, N.; Kaderali, L. A convolutional neural network for ECG annotation as the basis for classification of cardiac rhythms. Physiol. Meas. 2018, 39, 104005. [Google Scholar] [CrossRef]
  16. Citi, L.; Olariu, C.; Barbieri, R. A LightWAVE client for Semi-automated Annotation of Heart Beats from ECG Time Series. In Proceedings of the 2015 Computing in Cardiology Conference (CINC), Nice, France, 6–9 September 2015; Murray, A., Ed.; IEEE: New York, NY, USA, 2015; Volume 42, pp. 605–608. [Google Scholar]
  17. Abromavicius, V.; Serackis, A. Algorithm for Real-Time Detection of Heart Rate from Noisy ECG Signals Supported by Continuous Blood Pressure Analysis. In Proceedings of the 2015 Open Conference of Electrical, Electronic and Information Sciences (ESTREAM), Vilnius, Lithuania, 21 April 2015; IEEE: New York, NY, USA, 2015. [Google Scholar]
  18. Parvaneh, S.; Rubin, J.; Rahman, A.; Conroy, B.; Babaeizadeh, S. Analyzing single-lead short ECG recordings using dense convolutional neural networks and feature-based post-processing to detect atrial fibrillation. Physiol. Meas. 2018, 39, 084003. [Google Scholar] [CrossRef] [PubMed]
  19. Costin, H.; Rotariu, C.; Pasarica, A. Atrial Fibrillation Onset Prediction Using Variability of ECG Signals. In Proceedings of the 2013 8th International Symposium on Advanced Topics in Electrical Engineering (ATEE), Bucharest, Romania, 23–25 May 2013; IEEE: New York, NY, USA, 2013. [Google Scholar]
  20. Nikitin, V.M.; Muromtsev, V.V.; Efremova, O.A.; Lipunova, E.A.; Kamyshnikova, L.A. Automated Detection and Recognition of Diagnostically Significant Ecg Changes. J. Fundam. Appl. Sci. 2017, 9, 929–938. [Google Scholar] [CrossRef] [Green Version]
  21. Orphanidou, C.; Bonnici, T.; Vallance, D.; Darrell, A.; Charlton, P.; Tarassenko, L. A Method for Assessing the Reliability of Heart Rates obtained from Ambulatory ECG. In Proceedings of the IEEE 12th International Conference on Bioinformatics & Bioengineering, Washington, DC, USA, 11–13 November 2012; Kyriacou, E., Promponas, V., Loizou, C., Schizas, C.N., Pattichis, C.S., Eds.; IEEE: New York, NY, USA, 2012; pp. 193–196. [Google Scholar]
  22. Liang, W.; Zhang, Y.; Tan, J.; Li, Y. A Novel Approach to ECG Classification Based upon Two-Layered HMMs in Body Sensor Networks. Sensors 2014, 14, 5994–6011. [Google Scholar] [CrossRef] [Green Version]
  23. Afsar, F.A.; Riaz, M.S.; Arif, M. A Comparison of Baseline Removal Algorithms for Electrocardiogram (ECG) based Automated Diagnosis of Coronory Heart Disease. In Proceedings of the 2009 3rd International Conference on Bioinformatics and Biomedical Engineering, Beijing, China, 11–13 June 2009; IEEE: New York, NY, USA, 2009; Volumes 1–11, pp. 2511–2514. [Google Scholar]
  24. Yin, L.; Chen, Y.; Ji, W. A Novel Method of Diagnosing Coronary Heart Disease by Analysing Ecg Signals Combined with Motion Activity. In Proceedings of the 2011 IEEE International Workshop on Machine Learning for Signal Processing (MLSP), Beijing, China, 18–21 September 2011; Tan, T., Katagiri, S., Tao, J., Nakamura, A., Larsen, J., Eds.; IEEE: New York, NY, USA, 2011. [Google Scholar]
  25. de Lannoy, G.; de Decker, A.; Verleysen, M. A supervised learning approach based on the continuous wavelet transform for R spike detection in ECG. In Proceedings of the Biosignals 2008: Proceedings of the First International Conference on Bio-Inspired Systems and Signal Processing, Porto, Portugal, 14–17 January 2009; Encarnacao, P., Veloso, A., Eds.; Insticc-Inst Syst Technologies Information Control & Communication: Setubal, Portugal, 2008; Volume 1, pp. 140–145. [Google Scholar]
  26. Tun, H.M.; Moe, W.K.; Naing, Z.M. Analysis on ECG Data Compression Using Wavelet Transform Technique. Int. J. Psychol. Brain Sci. 2017, 2, 127. [Google Scholar] [CrossRef] [Green Version]
  27. Gregg, R.E.; Zhou, S.H.; Dubin, A.M. Automated detection of ventricular pre-excitation in pediatric 12-lead ECG. J. Electrocardiol. 2016, 49, 37–41. [Google Scholar] [CrossRef]
  28. Faezipour, M.; Saeed, A.; Nourani, M. Automated ECG Profiling and Beat Classification. In Proceedings of the 2010 IEEE International Conference on Acoustics, Speech, and Signal Processing, Dallas, TX, USA, 14–19 March 2010; IEEE: New York, NY, USA, 2010; pp. 2198–2201. [Google Scholar]
  29. Wang, Q.; Mao, Y.W.; Ren, L.; Li, Z.; Liu, H. Automatic Classification of ECG Data Quality for Each Channel. IEEE Access 2020, 8, 196094–196101. [Google Scholar] [CrossRef]
  30. Laurin, A.; Khosrow-Khavar, F.; Blaber, A.P.; Tavakolian, K. Accurate and consistent automatic seismocardiogram annotation without concurrent ECG. Physiol. Meas. 2016, 37, 1588–1604. [Google Scholar] [CrossRef] [PubMed]
  31. Yang, C.; Tang, S.; Tavassolian, N. Annotation of Seismocardiogram Using Gyroscopic Recordings. In Proceedings of the 2016 IEEE Biomedical Circuits and Systems Conference (BIOCAS), Shanghai, China, 17–19 October 2016; IEEE: New York, NY, USA, 2016; pp. 204–207. [Google Scholar]
  32. Benhamida, A.; Zouaoui, A.; Szócska, G.; Karóczkai, K.; Slimani, G.; Kozlovszky, M. Problems in archiving long-term continuous ECG data—A review. In Proceedings of the 2019 IEEE 17th World Symposium on Applied Machine Intelligence and Informatics (SAMI), Herlany, Slovakia, 24–26 January 2019; pp. 263–268. [Google Scholar]
  33. Benhamida, A.; Kozlovszky, M. Human ECG data collection, digitalization, streaming and storing. In Proceedings of the 2020 IEEE 18th World Symposium on Applied Machine Intelligence and Informatics (SAMI), Herl’any, Slovakia, 23–25 January 2020; pp. 105–110. [Google Scholar]
  34. Benhamida, A.; Kanas, A.; Vincze, M.; Papp, K.T.; Abbassi, M.; Kozlovszky, M. SaECG: A new FHIR Data format revision to enable continuous ECG storage and monitoring. In Proceedings of the 2020 IEEE 20th International Symposium on Computational Intelligence and Informatics (CINTI), Budapest, Hungary, 5–7 November 2020; pp. 115–120. [Google Scholar]
  35. Benhamida, A.; Slimani, G.; Kucarov, M.D.; Abbassi, M.; Koroknai, E.; Szarvák, A.; Ogbolu, M.; Vincze, M.; Kozlovszky, M. Effective ECG data conversion solution to solve ECG data interoperability problems. In Proceedings of the 2021 IEEE 21st International Symposium on Computational Intelligence and Informatics (CINTI), Budapest, Hungary, 18–20 November 2021; pp. 67–72. [Google Scholar]
  36. Tun, H.M.; Moe, W.; Naing, Z. Analysis on conversion process from paper record ECG to computer based ECG. MOJ Appl. Bionics Biomech. 2017, 1, 1–11. [Google Scholar] [CrossRef]
Figure 1. Premature Contraction examples: (a) Premature Atrial Contractions (PAC) in the third heartbeat; (b) periodical Premature Ventricular Contractions (PVC) of two different shapes in the second, fifth, and the seventh heartbeats; (c) single PVC with the first shape in the third heartbeat.
Figure 1. Premature Contraction examples: (a) Premature Atrial Contractions (PAC) in the third heartbeat; (b) periodical Premature Ventricular Contractions (PVC) of two different shapes in the second, fifth, and the seventh heartbeats; (c) single PVC with the first shape in the third heartbeat.
Electronics 11 04021 g001
Figure 2. Sinus Arrest example presented as a pause in the normal sinus rhythm between the second and third heartbeats.
Figure 2. Sinus Arrest example presented as a pause in the normal sinus rhythm between the second and third heartbeats.
Electronics 11 04021 g002
Figure 3. Normal Sinus Rhythm vs. Sick Sinus Syndrome examples: (a) Normal Sinus Rhythm example; (b) Bradycardia example that shows a slow sinus rhythm (big RR intervals); (c) Tachycardia example that shows a fast sinus rhythm (small RR intervals).
Figure 3. Normal Sinus Rhythm vs. Sick Sinus Syndrome examples: (a) Normal Sinus Rhythm example; (b) Bradycardia example that shows a slow sinus rhythm (big RR intervals); (c) Tachycardia example that shows a fast sinus rhythm (small RR intervals).
Electronics 11 04021 g003aElectronics 11 04021 g003b
Figure 4. General structure of the proposed algorithm.
Figure 4. General structure of the proposed algorithm.
Electronics 11 04021 g004
Figure 5. Pre-annotation results: (a) original noisy signal for testing taken from an ambulatory device (Savvy ECG); (b) discrete derivative of the signal (difference between sequential values) and the detected threshold; (c) detected R peaks; (d) final pre-annotation result.
Figure 5. Pre-annotation results: (a) original noisy signal for testing taken from an ambulatory device (Savvy ECG); (b) discrete derivative of the signal (difference between sequential values) and the detected threshold; (c) detected R peaks; (d) final pre-annotation result.
Electronics 11 04021 g005
Figure 6. Beat-to-beat separation of the (a) testing data collected from the ambulatory sensor (Savvy ECG); (b) training data derived from the MIT-BIH database; (c) NSR testing data taken from the INCART database; (d) PVC training and testing data from the INCART database; (e) NSR testing data from the LTAFDB database. (x-axis: sequential time value index; y-axis: ECG voltage measured in millivolts (mV)).
Figure 6. Beat-to-beat separation of the (a) testing data collected from the ambulatory sensor (Savvy ECG); (b) training data derived from the MIT-BIH database; (c) NSR testing data taken from the INCART database; (d) PVC training and testing data from the INCART database; (e) NSR testing data from the LTAFDB database. (x-axis: sequential time value index; y-axis: ECG voltage measured in millivolts (mV)).
Electronics 11 04021 g006
Figure 7. Training and validation loss for (a) NSR autoencoder; (b) PVC autoencoder. (x-axis: training epochs; y-axis: training/validation loss value).
Figure 7. Training and validation loss for (a) NSR autoencoder; (b) PVC autoencoder. (x-axis: training epochs; y-axis: training/validation loss value).
Electronics 11 04021 g007
Figure 8. Training and testing loss distribution with number of samples: (a) MIT-BIH training data; (b) MIT-BIH normal testing data; (c) MIT-BIH abnormal testing data; (d) INCART training data; (e) INCART testing data; (f) LTAFDB testing data.
Figure 8. Training and testing loss distribution with number of samples: (a) MIT-BIH training data; (b) MIT-BIH normal testing data; (c) MIT-BIH abnormal testing data; (d) INCART training data; (e) INCART testing data; (f) LTAFDB testing data.
Electronics 11 04021 g008
Figure 9. Confusion matrices for the: (a) training data from the MIT-BIH database; (b) testing data collected from the ambulatory sensor (Savvy ECG); (c) NSR testing data from the INCART database; (d) PVC training and testing data from the INCART database.
Figure 9. Confusion matrices for the: (a) training data from the MIT-BIH database; (b) testing data collected from the ambulatory sensor (Savvy ECG); (c) NSR testing data from the INCART database; (d) PVC training and testing data from the INCART database.
Electronics 11 04021 g009aElectronics 11 04021 g009b
Figure 10. Reconstruction and testing results for: (a) MIT-BIH training data tested against the NSR Autoencoder; (b) Savvy ECG data tested against the NSR Autoencoder; (c) PVC heartbeat from the INCART database tested against the PVC Autoencoder.
Figure 10. Reconstruction and testing results for: (a) MIT-BIH training data tested against the NSR Autoencoder; (b) Savvy ECG data tested against the NSR Autoencoder; (c) PVC heartbeat from the INCART database tested against the PVC Autoencoder.
Electronics 11 04021 g010
Table 1. Testing results of different data sources.
Table 1. Testing results of different data sources.
Data SourceData Length (Heartbeats)AccuracyPrecisionRecall
MIT-BIH dataset (NSR)396699.90%100%99.80%
Data from ambulatory sensor (Savvy ECG)18099.44%99.39%100%
St Petersburg INCART 12-lead Arrhythmia Database (NSR)183895.10%96.98%97.46%
St Petersburg INCART 12-lead Arrhythmia Database (PVC)1838100%100%100%
Long Term Atrial Fibrillation (AF) Database (NSR)353999.80%99.97%99.83%
Table 2. Short extract from the PQRS peak detection.
Table 2. Short extract from the PQRS peak detection.
PredictionTruthResultPQRS
1 *FalseTrueFalse----
2FalseFalse-----
3TrueTrue-88131140146
4FalseFalse-----
5TrueTrue-87131141146
6TrueTrue-77130141150
7FalseFalse-----
8FalseFalse-----
9TrueTrue-90129141147
10TrueTrue-92129141146
11TrueTrue-90132141146
12TrueTrue-90130141147
13FalseFalse-----
14FalseFalse-----
15TrueTrue-92131141146
* False negative detection.
Table 3. Performance comparison with other solutions.
Table 3. Performance comparison with other solutions.
AccuracyPrecisionRecallTraining Loss
MIT-BIH dataset (NSR)99.90% *100%99.80%0.001
St Petersburg INCART 12-lead Arrhythmia Database (PVC)100% *100%100%0.00097
Single lead delineator 1499.81%---
CNN sing PhysioNet databases 1599%---
Onset prediction of atrial fibrillation 1990%---
Coronary heart disease diagnostic 2480%---
Pediatric ventricular pre-excitation detector 2788%---
Isovolumic moment (IM) peaks detector 3196.9%---
Aortic valve closure (AC) peaks detector 3195.6%---
* best performing accuracy for our NSR and PVC models.
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Benhamida, A.; Kozlovszky, M. A Novel Algorithm for Automated Human Single-Lead ECG Pre-Annotation and Beat-to-Beat Separation for Heartbeat Classification Using Autoencoders. Electronics 2022, 11, 4021. https://doi.org/10.3390/electronics11234021

AMA Style

Benhamida A, Kozlovszky M. A Novel Algorithm for Automated Human Single-Lead ECG Pre-Annotation and Beat-to-Beat Separation for Heartbeat Classification Using Autoencoders. Electronics. 2022; 11(23):4021. https://doi.org/10.3390/electronics11234021

Chicago/Turabian Style

Benhamida, Abdallah, and Miklos Kozlovszky. 2022. "A Novel Algorithm for Automated Human Single-Lead ECG Pre-Annotation and Beat-to-Beat Separation for Heartbeat Classification Using Autoencoders" Electronics 11, no. 23: 4021. https://doi.org/10.3390/electronics11234021

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop