1. Introduction
The number of people who suffer from cardiac diseases is increasing every day. This disease is the leading cause of death in developed countries [
1,
2,
3]. Electrocardiography is a method of recording and studying the electric fields that are generated during the work of the heart. An ECG is the result of electrocardiography [
4,
5] and is a graphical record of the electrical activity of the heart produced by depolarization and repolarization of the atria and ventricles. The electrocardiogram (ECG) is a non-invasive technique used to detect cardiovascular disease. The ECG is described by the waveforms of the P, QRS, and T waves, which are associated with each heart-rate function. The P wave displays the process of depolarization of the atrial myocardium; the QRS complex displays depolarization of the ventricles; the ST segment, and the T wave displays the processes of repolarization of the ventricular myocardium [
6].
Figure 1 shows an example of an electrocardiogram waveform with P, Q, R, S, and T characteristics, as well as standard electrocardiogram intervals are PQ intervals, ST intervals, and QRS complex.
Atrial fibrillation is a major risk factor for ischemic stroke [
7]. The main criteria for the presence of atrial fibrillation are the absence of P waves, the presence of atrial fibrillation waves, different R-R intervals, the heart-rate (HR) is constant or accelerated, and the QRS complex is less than 0.12 s [
8]. Since the P wave is not detected during atrial fibrillation, the interval between QRS complexes increases and there is no possibility to calculate the PQ and QT intervals. Calculating HR or QRS time from digital ECG signals is problematic. Therefore, it is necessary to pay attention to the absence of the P-peak and the presence of different intervals between R-R peaks when determining atrial fibrillation.
In some modern electrocardiographs, various signal filters are used, which allow obtainment of a higher quality of the electrocardiogram, while introducing some distortions in the form of the received signal. Low-pass filters in the range of 0.5–1 Hz can reduce the effect of the floating contour while introducing distortions in the shape of the ST segment [
4]. A low-frequency anti-tremor filter in the 35 Hz range suppresses artifacts associated with muscle activity. A notch filter in the range of 50–60 Hz neutralizes line pickups [
5].
Today, learning algorithms are becoming more accurate, but recognition systems created based on artificial intelligence in medicine, and in particular, in cardiology, are not able to achieve a 100% accurate result [
9]. For this reason, it is relevant to search for ways to increase this indicator. One of the possible ways to increase this indicator is the preliminary processing of ECG signals. Finding peaks in signals is an important step in many automatic ECG processing systems. In this work, a neural network classification system for ECG signals is proposed for determining atrial fibrillation with a preprocessing stage. At the stage of preprocessing, signals are selected by the number of heartbeat counts, as well as wavelet analysis to clean up noise and isolate the R-peak and spectral analysis to isolate the P-peak. Automatic detection of atrial fibrillation from ECG signals will allow doctors to determine if a patient needs cardiac care.
2. Related Research
Today, medicine is considered one of the promising areas for the introduction of artificial intelligence, because the analysis of medical signals is the most common research method in this area. An example is an algorithm for identifying patients with atrial fibrillation in sinus rhythm based on convolutional neural networks (CNN) in [
10]. The work [
11] presents a hybrid approach with the use of Empirical Mode Decomposition and CNN to classify ECG signals. In [
12], the author has implemented the extraction of ECG signal features based on wavelet transform with further classification using Long Short-Term Memory (LSTM). The work [
13] presents a method for detecting atrial fibrillation using LSTM. The method achieved an accuracy of 98.51%. The essence of the approach proposed in the work is the separation of ECG signals with a sliding window and the loading of the obtained blocks into the decision-making system. ECG signals were taken from the MIT-BIH database Atrial Fibrillation Database. Dataset was 10 h long and each signal contained 100 heartbeats (R-R peak). The authors point out the slow learning speed and high requirements for computing resources. For the simulation, the authors used the Quadro M5000 GPU (Nvidia, Santa Clara, CA, USA).
This work is of scientific interest, however, due to the different methodology and resources used, it cannot be compared with the proposed system for neural network determination of atrial fibrillation on ECG signals with wavelet-based preprocessing.
Finding peaks in signals is an important step in many signal processing applications. Automatic peak detection using neural network classification systems is difficult due to the physiological variability of P waves and QRS complexes, as well as the presence of various types of noise, including muscle noise, artifacts due to electrode movement, power-line noise, and baseline deviations.
Software QRS complex recognition is an integral part of modern computerized ECG monitoring systems. An algorithm for their recognition is presented in [
14] and is based on optimized filtering and simple threshold setting since optimized filtering is considered a factor in achieving good timing accuracy. The most widely known method for detecting a single R-peak is the Pan-Tomkins method, which uses three types of processing steps: linear digital filtering, nonlinear transformation, and decision rule algorithms [
15]. The work [
16] presents an algorithm for detecting QRS using multi-stage morphological filtering to suppress impulse noise. In work [
17], to determine the QRS complex, it is proposed to create an estimated QRS signal using the parameters extracted from the original ECG signal.
For automatic disease diagnosis systems based on ECG signals, accurate determination of the P wave is critical. In work [
18], one of the first methods of processing ECG signals to isolate the P-peak in its flow using wavelet transform and subsequent training of the neural network is described. In [
3], a system for determining the P and T waves based on the wavelet transform is presented.
The main methods of processing ECG signals for noise reduction are digital filtering, adaptive filtering, wavelet filtering. The paper [
19] describes a method for processing ECG signals using an adaptive wavelet transform based on the Poincare section and the Shannon method. There are also methods for processing signals online in real-time for use in pacemakers. The paper [
20] describes a processing method using biorthogonal wavelet transform based on a linear phase structure for noise removal, feature extraction, and compression of the ECG signal. There are also methods for computerized detection of fibrillation. Work [
21] describes a method for detecting fibrillation using an eight-layer neural convolutional network, which requires only basic data normalization without preliminary processing and extraction of features from raw ECG samples. Work [
7] describes a method for constructing classifiers based on several sets of functions (a set of Andreotti, Zabikhi functions, an aggregated set of functions, and a set of Dutt functions) and using a random forest classification method.
4. Results
For modeling, ECG signals were selected from the international open database PhysioNet Computing in Cardiology Challenge 2017 (CinC Challenge) [
31]. This database contains over 10,000 ECG records; it is freely available from AliveCor and is a random sample of patient records of no more than one minute in duration. The Physionet Computing in Cardiology Challenge 2017 database consists of 8528 ECG signals for training and 3658 ECG signals for validation. The base consists of four types of single-channel signals: 5152 normal signals (N), 771 signals with cardiac fibrillation (A), 46 noisy signals (~) and 2557 other signals (O). The simulations were performed using two categories of signals, namely signals without heart defects (N) and signals with atrial fibrillation (A). These signal categories were selected to study the signs of atrial fibrillation on ECG signals for more correct LSTM learning. A total of 1000 signals were selected from the database CinC Challenge for the first modeling. For the second experimental simulation, 5925 ECG signals were selected, namely 5152 normal signals (N) and 771 signals with cardiac fibrillation (A). Examples of selected ECG signals from the database CinC Challenge are shown in
Figure 6.
The simulation was carried out using the MatLab 2020b software package for solving technical calculations. The calculations were performed on a PC with a processor Intel(R) Core (TM) i5-10210U CPU @ 1.60 GHz (8 CPUs), 2.1 GHz.
Database PhysioNet Computing in Cardiology Challenge 2017 (CinC Challenge) consists of ECG signals with different numbers of samples.
Figure 7 shows that there are significantly more signals from 9000 samples. For correct training of the neural network, the input ECG signals must contain the same number of samples. Therefore, at the stage of preliminary data processing for the first training, 976 ECG signals with several samples to 9000 were selected. For the second simulation, 5754 ECG signals with 9000 samples were taken at the preprocessing stage.
DWT allows splitting the signal into high and low frequencies. Analysis of high frequencies of the ECG signal can determine the presence of peaks. Analysis of low frequencies of the ECG signal allows determining the presence of noise of varying nature [
22]. The symlet is an orthogonal wavelet and can be used to reconstruct the signal [
23] or to find R-peaks on ECG signals [
24,
32]. To remove noise from ECG signals and isolate R-peaks on them, the symlet wavelet filter was chosen. The symlet is similar in shape to the QRS complex on the ECG signal. This means that the decomposition coefficients of the ECG signal using the symlet-based DWT have a high correlation with the location of the P-peaks. Their number can be determined based on the analysis of the coefficients of the wavelet decomposition of the ECG signal.
Figure 8 shows a graphical display of the symlet and QRS complex.
Figure 9 shows examples of the five-level decomposition of an ECG signal based on a symlet. The spikes in coefficients D 2, D 3 and D 4 correspond to heartbeats, from which it is possible to determine the location of the R-peaks of the cardiogram.
The results from
Table 2 were obtained by simulating the proposed system using various symlet. Each value of the table is the result of training the proposed system for neural network determination of atrial fibrillation based on LSTM with signal preprocessing using different coefficients of symlet. The best learning result was obtained using a five-coefficient symlet.
For the correct selection of various signs on the ECG signals, one-dimensional functions must be used. The functions of instantaneous frequency and spectral entropy were selected to isolate the P-peak. Fourier series and integral Fourier transform are the basis of harmonic signal analysis. However, when analyzing ECG signals, these transformations do not provide the possibility of analyzing peaks, understanding the local properties of the signal and its frequency characteristics. Therefore, for these purposes, we used the characteristics of the Fourier spectrum. Instantaneous frequency calculates a spectrogram using short-term Fourier transforms versus window time. Spectral entropy estimates entropy based on a power spectrogram. The time output of the function corresponds to the center of the time windows.
The selected ECG signals from the CinC Challenge database were divided into signals for training and signals for testing in a percentage ratio of 90:10. For training, the architecture of the LSTM neural network was assembled. The network consisted of two input layers, to which preprocessed signals were applied, and one hundred hidden recurrent layers. Preprocessing of signals using a symlet and subsequent application of spectral analysis functions made it possible to reduce the length of ECG signals to 255 HC.
Table 3 presents the results of modeling various methods for detecting atrial fibrillation. The matrix of inaccuracies as a result of training the proposed system of neural network determination of atrial fibrillation from ECG signals is presented in
Figure 10 and
Figure 11.
The best indicator of the accuracy of ECG signal recognition was obtained using the method proposed in the work and amounted to 87.5%. This accuracy was obtained in the first simulation using 976 ECG signals. The indicator of the accuracy of ECG signal recognition during the second simulation was 87.4%. This result is identical to that obtained in the first simulation. The smallest indicator of recognition accuracy was obtained using a one-dimensional LSTM without preliminary signal processing. The results obtained indicate that the use of pre-processing of ECG signals can significantly increase the recognition accuracy of neural network classification systems.
5. Discussion
The article presents a system for neural network determination of atrial fibrillation on ECG signals with wavelet-based preprocessing. Simulation of the proposed system made it possible to achieve a recognition accuracy of 87.5%, which is significantly higher than the 79.0–82.0% level that can be achieved using known systems [
33,
34,
35].
Work [
33] is devoted to the development of a smartphone application for the detection of atrial fibrillation. The method proposed in [
33] uses preliminary preprocessing of the ECG signal, which includes the analysis of the R-R and P-peak intervals. Despite the identity of the methods used, the authors of the work indicate the accuracy of the system at 79.0%, which is significantly lower than the result obtained by modeling the system proposed in this work.
The authors of [
34] used the training of a recurrent neural network without preliminary signal processing and achieved an accuracy of 82.0%. The recurrent network is the basis of the LSTM network used in our method, which makes it possible to make comparisons.
In [
35], the authors used a part of the MIT-BH 2017 database consisting of normal ECG signals, signals with fibrillation, and “others.” A group of noisy signals was not used. For the experiment, the authors used signals with a length of 4 heart counts (4 R-R intervals). The method proposed in [
35] did not give a positive result for signals of the “other” category. The results shown for determining the presence of fibrillation from groups with normal signals and signals with fibrillations were 82.0% accuracy, which is also lower than the result of the accuracy of the proposed system for neural network determination of atrial fibrillation on ECG signals.
There are other ways to measure atrial fibrillation. In [
36], a more complex methodology is used that requires more computing power. Using multiple convolutional neural networks and LSTM networks is a resource-intensive method. At the same time, the use of pre-processing of the signal before training the neural network can reduce resource costs.
The proposed stages of preliminary processing of ECG signals made it possible to prepare data for further analysis to conduct an automated determination of atrial fibrillation. The average accuracy of a cardiologist’s diagnosis by visual analysis of ECG signals is 65.0–70.0% [
37]. The use of the proposed neural network system for determining atrial fibrillation from ECG signals by specialists will make it possible to increase the efficiency of diagnostics in comparison with methods of visual diagnosis. The proposed system for neural network determination of atrial fibrillation on ECG signals can only be used as an additional diagnostic tool by specialists. This system is not a medical device and cannot independently diagnose patients.
A promising direction for further research is the construction of more complex systems for the neural network classification of ECG signals, using, together with the analysis of signals, various metadata about patients, such as age, gender, race, genetic predisposition, and other descriptors. One of the next steps for further research is the creation of a mobile application for real-time fibrillation detection. Additionally, further research plans include the complication of the proposed system by using convolutional neural networks to improve the accuracy of determining atrial fibrillation.