Professional Documents
Culture Documents
Classical Versus Deep Learning Methods For Anomaly Detection in ECG Using Wavelet Transformation
Classical Versus Deep Learning Methods For Anomaly Detection in ECG Using Wavelet Transformation
Military University of Technology,Faculty of Electronic Engineering (1), Warsaw University of Technology, Faculty of Electrical Engineering (2)
doi:10.15199/48.2021.06.13
Keywords: anomaly detection, wavelet transform, diagnostic features of ECG, classification, CNN.
Słowa kluczowe: wykrywanie anomalii, transformacja falkowa, cechy diagnostyczne ECG, klasyfikacja, CNN
Fig. 1 The exemplary ECG representations of three classes of DWT in application to feature generation
ECG: arrhythmia (ARR), congestive heart failure (CHG), and In the case of discrete wavelet transform (DWT) the
normal sinus rhythm (NSR) values of a and b are discrete and taken in a dyadic system
m m
as follows a→am=2 and b→bm,n=2 nT, T – the sampling
Frequency analysis of signals period. The original discrete signal x(t) is now represented
As the ECG signal is recorded directly from a patient’s as the weighted sum of wavelet functions of different scale
body, the recording will be disturbed by some noise. The and shift values
noise signals are due to factors such as baseline
wandering, motion artifacts, supply-line interference within (2) x(t ) Wx 2m , 2m nT m, n t
the signal, electrode contact, or attenuation losses [7].
Baseline wandering noise is caused by respiration,
electrode impedance variation, or excessive body
where m ,n t is the wavelet function at mth level, shifted
movements. by n samples.
The DWT transformation is most often used in practice
since it is very easily implemented using the Mallat
algorithm [9, 11]. In this approach the integration is replaced
by the digital filtering operations, applying FIR low-pass and
high-pass filters [8,10,11]. The low-pass filter is responsible
for generating the lower resolution approximation of signal
and the high-pass filter generates the so-called details, i.e.,
the difference between approximated signals of two
neighboring levels of resolution. The detailed signals of the
highest resolution are usually associated with the high-
frequency components, often treated as the noise. The
interesting point is that small detail values might be dropped
without affecting the major features of the data set.
Therefore, reconstructing signals deprived of such removed
details results in the operation of de-noising [10,11].
The idea of DWT signal decomposition is to split the
original signal into different frequency sub-bands. Their
number is dictated by the user. It should be observed, that
Fig. 2 The representation of three types of signals (left) and their the succeeding levels of decomposition reveal separate
Fourier transforms (right) frequency characteristics in particular sub-bands. Different
statistical parameters characterizing these distributions in
One of the typical approaches to feature generation of
different levels of decomposition, such as mean, median,
ECG signals is the application of Fourier transformation.
standard deviation, skewness, kurtosis, different percentile
Fig. 2 presents three types of signals and their Fourier
values, etc., may be used as the numerical descriptors, well
transforms. As it is seen power distribution differs
characterizing the analyzed ECG waveform. Additionally,
significantly in different ranges of frequency, as the basic
zero-crossings, mean-crossing, and entropy may be also
waves of the ECG signal are different. The most different is
calculated for each level of DWT decompositions and used
the spectrum of the CHG signal.
as additional descriptors of the analyzed waveform
However, it should be observed, that the Fourier
[12,13,14]. In our approach, every coefficient of
transform is representative only when ECG segment
decomposition is assigned to the bin with a width of 0.2
variation over time is negligibly low since it assumes the
standard deviations. Entropy was estimated using the
stationarity of the analyzed signal. Moreover, it applies the
following equation:
basis function of infinite support, hence in the frequency
domain, time dependency is irreversibly lost. Therefore, the 3 ∑ log
Fourier approach to ECG analysis is of limited usage.
Instead, we will use wavelet transformation in its continuous where N is the total number of coefficients, and pi is the
and discrete form. probability of the ith coefficient.
The next step of processing is the selection of the most
Applied methods significant features. The selected descriptors create the set
In our approach, we will apply the wavelet of diagnostic features, serving as the input attributes to the
transformation instead of Fourier. The wavelet transform classifier, which is responsible for the final recognition of
provides simultaneously high resolution in the frequency classes. Different types of classifiers have been used in this
Table 1 The results of numerical experiments at the application of DWT at the different number of diagnostic features for different
implementation of the classification system.
Extra
Gradient ADA Random SVM Gaussian MLP with Naïve
Features selected Random KNN
boosting classifier Forests classifier Process SGD Bayes
Forests
ACC [%] 94.19 83.79 96.07 94.99 93.42 89.76 81.91 95.27 81.3
12 PREC [%] 92.68 81.78 94.93 93.55 91.78 87.55 81.8 93.53 78.53
SENS [%] 93.84 86.18 95.75 94.56 92.82 88.26 76.53 94.57 75.41
ACC [%] 95.12 90.18 97.78 97.61 95.82 92.61 84.5 97.37 80.05
PREC [%] 95.09 88.56 97.54 97.13 94.28 91.54 81.42 96.3 73.92
24
SENS [%] 93.49 89.62 97.20 96.49 94.44 90.34 81.09 96.07 72.32
ACC [%] 93.00 91.88 96.14 92.81 90.79 93.85 85.51 95.85 73.71
PREC [%] 93.25 93.38 96.58 94.37 93.22 93.50 86.64 95.30 69.08
48
SENS [%] 88.90 87.37 94.27 88.74 84.95 89.43 80.05 94.45 65.86
ACC [%] 92.61 92.10 94.27 91.40 90.18 94.08 88.97 96.32 50.65
PREC [%] 90.53 90.20 94.78 92.70 93.51 94.67 89.50 96.03 70.95
78
SENS [%] 91.18 89.47 91.29 86.80 84.71 91.06 84.54 95.11 52.28
Table 2 The results of numerical experiments at the application of CNN and CWT at different types of wavelet mother function
Levels 16 32 64 128
Wavelet ACC [%] PREC [%] SENS [%] ACC [%] PREC [%] SENS [%] ACC [%] PREC [%] SENS [%] ACC [%] PREC [%] SENS [%]
Gauss8 69.62 70.53 68.33 71.93 72.37 71.16 81.00 81.31 80.55 81.42 81.69 81.03
Mex hat 72.96 73.47 72.19 75.98 76.38 75.57 80.16 80.51 79.81 82.06 82.28 81.51
Morlet 72.16 72.58 71.32 75.15 75.63 74.83 77.27 77.76 76.43 80.00 80.46 79.55