Cardiac Arrhythmia Detection Using Deep Learning
Cardiac Arrhythmia Detection Using Deep Learning
● ABSTRACT :
For the assessment of cardiac arrhythmias in clinical routine we can use an electrocardiogram or (ECG) as
an important diagnostic tool. By applying the deep learning framework trained on a general image set is
transferred to carry out automatic ECG arrhythmia diagnostics by classifying patient’s ECG into
corresponding cardiac conditions. The aim of this paper is to implement a simple, reliable and easily
applicable deep learning framework (as mentioned above) to carry out automatic ECG arrhythmia
diagnostics by classifying patient’s ECG into corresponding cardiac conditions.
● INTRODUCTION :
Cardiac arrhythmia occurs when electrical impulses in the heart don't work properly. There may be no
symptoms or symptoms like a fluttering in the chest, chest pain, fainting or dizziness. If required, treatment
includes anti-arrhythmic drugs, medical procedures, implantable devices and surgery. There is a wide range
of things that can lead to or cause an arrhythmia like health issues such as sleep apnea, diabetes, stress, high
blood pressure, and thyroid problems. Heart diseases like cardiomyopathy and coronary artery disease can
cause heart rhythm problems. Smoking, drinking and drug abuse can also result in rhythm complications.
Fig1
The above pictures demonstrate how a normal heart functions v/s how a person’s heart diagnosed with
cardiac arrhythmia functions. Electrocardiogram (ECG) is used to diagnose cardiac arrhythmia. This test uses
a monitor with electrodes attached to your body to measure your heart's electrical activity for a short time.
1
Electrophysiology study includes a catheter-based test that assesses serious arrhythmias by recording your
heart's electrical activity from the inside. It is an established technique in cardiology for the analysis of
cardiac conditions of the patients. The rhythm of the heart in terms of beats per minute (bpm) can be easily
calculated by counting the R peaks (as observed in the previous diagram) of the ECG wave during one
minute of recording. More importantly, rhythm and the morphology of the ECG waveform is altered by
cardiovascular diseases and abnormalities such as cardiac arrhythmias. Where, normal beats are healthy adult
human ECG waveform; paced beats are artificial beats from the device called pacemaker; and RBBB is an
arrhythmia that is frequently associated with ischemic, hypertensive, rheumatic and pulmonary heart disease,
right ventricular hypertrophy and some drug intoxication which has a ECG waveform with QRS duration
between 0.10 and 0.11 sec (incomplete RBBB) or 0.12sec or more (complete RBBB), prolonged ventricular
activation time or QR interval (0.03sec or more) and right axis deviation. However, apart from these the
system can also be easily adapted to further classify other various similar cardiac arrhythmias. [1]
● LITERATURE REVIEW :
Although most of the conventional pattern recognition techniques have been previously applied successfully
to the ECG arrhythmia detection tasks, recent state-of-the-art performances obtained by deep learning
methods encouraged researchers to implement these techniques to the field of medical image and signal
processing. Application of deep learning methods even to the most complex medical pattern recognition
tasks proved to be very promising. In general, extracting highly representative features from the data in hand
has the most significant impact on the performance of computerized classification/recognition systems.
However, this being a time-consuming process requires expert knowledge and often selected features fail to
be robust with respect to the variations in the data. When compared to conventional classification methods,
CNNs automatically learn representative complex features directly from the data itself, thus the need for
handcrafting features to represent the data effectively is eliminated.
In one of the recent studies a deep neural network was proposed to recognize premature ventricular
contraction (PVC) beats from ECG recordings with six hidden layers is trained by feeding six different
features extracted from ECGs to carry out the classification between normal and PVC beats. Although, a
deep neural network is used authors still preferred handcrafting their own features from the ECG data.
In 2016, a deep convolutional neural network was trained to extract features directly from raw ECG signals
and to carry out the classification between two cardiac conditions i.e normal beats and paroxysmal atrial
fibrillation.
2
(ECG signals for detection of Atrial Fibrillation)
One of the drawbacks of training a deep convolutional neural network from scratch is the need for a quite
large labeled training dataset size to obtain improved network performance by making the network deeper
i.e. increasing the number of convolutional layers. Despite this, increasing the depth of the network will also
increase the computation cost during training due to the increase in complex convolutional operations
throughout deep convolutional layers. Thus, powerful GPU powered computers are required for such training
tasks. [2]
3
(Block diagram of the ECG arrhythmia classification operation)
4
Each of these records has a sample frequency of 360Hz and contains two leads (two signals recorded from
different angles on chest). As a final step, one of the channels is removed and only one channel for each
recording is used for the rest of the system (channel MLII). In the end of this part a total of 214 waveforms (as 3
separate recordings each representing a normal, rbbb and paced waveform class) for training and 202 waveforms
for testing are prepared ready for next step which is signal pre-processing or simply pre-processing.
2. Pre-Processing :
This step is focused on removing noise from ECG recordings. ECG data obtained from MIT-BIH database is not
expected to contain as much disruptive noise as an ECG data obtained directly from a patient, it still contains
some noise which requires attention to improve the subsequent steps of the system. Firstly, mean removal is
applied to remove the dc noise present in the ECG signals by subtracting the mean of the ECG recording from
every sample point, the unwanted dc component is removed and the signal baseline amplitude is pulled back to
level zero. Due to depressing high frequency interference of the ECG signals, low pass filters preprocesses ECG
signals. It proposes a QRs complex detection method based on wavelet transform. After the removal of high
frequency noise, the next step is to remove low frequency noise components. This low frequency noise is
removed by a derivative based (high pass) filter, which passes high frequencies but attenuates low frequencies
and is thus applied to all ECG recordings.
5
All of the steps mentioned above are applied to all training and testing ECG records and filtered ECG signals are
obtained ready for the next i,e QRS detection step. [4]
3. QRS Detection :
It is the most striking waveform within the ECG as it reflects the electrical activity within the heart during the
ventricular contraction, the time of its occurrence as well as its shape provide valuable information about the
current state of the heart. In that sense, QRS detection provides the fundamentals for almost all automated ECG
analysis algorithms. The ECG waveform contains, in addition to the QRS complex, P and T waves, 60-Hz noise
from powerline interference, EMG from muscles, motion artifact from the electrode and skin interface, and
possibly other interference from electrosurgery equipment in the operating room. Many clinical instruments such
as a cardiotachometer and an arrhythmia monitor require accurate real-time QRS detection. It is necessary to
extract the signal of interest, the QRS complex, from the other noise sources such as the P and T waves.
( Representation of the relative power spectra of the ECG, QRS complexes, P and T waves, motion artifact, and muscle noise)
QRS complex detection algorithm has been studied for decades, two major methods of study being hardware and
software methods classified by the way of realization, of which hardware methods are, according to literature, far
less flexible and convenient, so that software methods are under more discussion. [5]
6
After the ECG signals are converted into 256x256x3 sized images representing R-T intervals, they are fed into
the pre-trained AlexNet and the outputs of the 6th and 7th fully connected layers of the AlexNet are extracted as
features representing our R-T segment images for the three different cardiac conditions.
Since the fully connected layers of the AlexNet contains 4096 neurons each, this procedure will result in 4096
features for each input ECG waveform that will enable accurate ECG arrhythmia classification.
(graphical representation of R-T intervals of all training ECG data) (graphical representation of R-T intervals of all testing ECG data)
All these obtained features are then ready for the next classification step. As the ECG data in hand is
investigated, it can be observed that the features that clearly distinguish each class (normal, rbbb and paced) lies
between the R-T interval.We will be extracting the bottleneck features from all our images beforehand to speed
up training later, since building a sequence model with several LSTMs will take a lot of training time even on
GPUs, as we will see shortly. [6]
5. Classification :
The multilayer perceptron neural network classifier is used to classify the four types of ECG beats namely:
normal beat, congestive heart failure beat, ventricular tachyarrhythmia beat, and atrial fibrillation beat. These
networks are trained using scaled conjugate gradient back-propagation algorithm.
7
The first network i.e (N-Fc6) takes the output of the 6th fully connected layer of AlexNet as inputs (as mentioned
earlier), the second one i.e (N-Fc7) takes the output of the 7th layer, and the third network i.e (N-tst) takes 200
samples of the R-T intervals directly as inputs without any deep learning feature extraction. Additionally, each of
these networks are trained using different number of hidden layer neurons and the best performing hidden layer
neuron numbers are fixed for the final tests. Output layer neuron number is also fixed as three neurons. As the
final step, output vectors are formed as shown in Table 1 and the training of the networks are carried out using
the default settings of the Matlab`s neural network pattern recognition application. Accompanying each record in
the MIT-BIH database there is an annotations file in which each heartbeat has been identified by expert
cardiologist annotators. This annotated information is employed for designing the corresponding target vector for
each R-T segment and also used for evaluating the classifier performance. [7]
● RESULT ANALYSIS :
ECG Data obtained from the mentioned MIT-BIH database are pre-processed, followed by QRS complexes
detection and features in R-T intervals were extracted. After all these steps, three different networks that use
these different features as inputs were designed, trained, tested and evaluated for pattern recognition and
classification of ECG signals for three different cardiac conditions. When all of the tested networks were
evaluated it was found that networks based on transferred deep learning feature extraction (N-Fc6 and
N-Fc7) obtained almost 100% recognition rates and accuracies above 95% in the training phase. For this
reason it is not found necessary to change any parameters like maximum epochs, error limits or learning
rates. When compared, the network that is not based on deep learning (N-tst) obtained 90-92% recognition
rate and accuracy of around 89-90% in the training phase.
8
● REFERENCES :