Professional Documents
Culture Documents
Deteksi Jantung
Deteksi Jantung
Deteksi Jantung
By:
SARAH FAHIRA ADRIATI
152045800960
APPROVAL SHEET
By :
SARAH FAHIRA ADRIATI
152045800960
Approved by:
Supervisor I Supervisor II
Certified by:
VALIDATION SHEET
By:
SARAH FAHIRA ADRIATI
NIM : 152045800960
Approved by:
Certified by:
JUNE, 2019
iii
iv
This work is dedicated to my beloved mother and father, for their constant
encouragement and support through my educational endeavors.
DEDICATION
v
ACKNOWLEDGEMENT
I wish to express my deepest gratitude to Dr. Ariffuddin Bin Joret, Mr. Faqih
ST., MT & Dr. Sabar Setiawidayat, MT for the opportunity and constant supervision
in carrying out this project. I am extremely thankful for their kind guidance and
valuable expertise, providing me with necessary information which help me to
complete this project.
ABSTRACT
The heart rhythm abnormalities can be detected by interpreting the ECG signal.
However, there are many ECG pattern to be interpreted. Neural network is an artificial
intelligent based technique which can identify pattern and one of the most used
learning algorithm is backpropagation. The system is built to help interpretation
process of ECG signal in heart rhythm abnormalities diagnosis. The data used in this
study are obtained from MIT-BIH database. The data has been pre-processed to be
used in the developed identification system of this study. The pre-processing are
separating signal into one cycle and equalize the size of the signal by using zero padded
technique. In this system, a good feature extraction of the ECG signal is needed to
increase the accuracy. Discrete wavelet transform is used as a feature extraction and
the level which carrying out is until ten. Each level results are used as an input to the
identification system and derive different accuracy value. For this study, the accuracy
is set to 80%. The results below 80% considered not eligible. The developed
identification system of ECG signal achieves an average 91.3% accuracy using ECG
signal’s feature calculated using Discrete Wavelet Transform technique in identifying
normal and abnormal heart pulse.
vii
ABSTRAK
Kelainan denyutan jantung dapat dikesan dengan mentafsirkan signal Electro Cardio
Graph (ECG). Namun, terdapat banyak paten / bentuk signal ECG untuk ditafsirkan.
Projek ini mencadangkan sistem pengecaman signal ECG dengan menggunakan
rangkaian neural jenis backpropagation. Rangkaian neural adalah teknik pengecaman
berdasarkan kecerdasan buatan dimana ianya dapat mengecam paten dan algoritma
pembelajaran yang sering digunakan ialah backpropagation. Sistem ini dibangunkan
untuk membantu proses mentafsiran signal ECG dalam mengdiagnosis kelainan
denyut jantung. Data yang digunakan dalam projek ini telah diambil dari database
MIT-BIH. Data ECG ini telah dipra-proses terlebih dahulu sebelum digunakan dalam
sistem pengecaman yang telah dibangunkan dalam projek ini. Dalam projek ini,
pengekstarakan ciri signal ECG yang baik diperlukan untuk meningkatkan ketepatan
sistem. Terdapat tiga jenis pengektrakkan ciri yang digunakan sebagai perbandingan,
iaitu ciri statistic signal, moment Hu, dan Discrete Wavelet Transform. Sistem
pengecaman signal ECG yang telah dibangunkan dalam kajian ini mencapai 91.3%
ketepatan menggunakan ciri signal ECG yang dikira menggunakan teknik Discrete
Wavelet Transform dalam melakukan pengecaman denyut jantung normal dan tidak
normal.
viii
ABSTRAK
Kelainan denyut jantung dapat dideteksi dengan menafsirkan sinyal EKG. Namun, ada
banyak pola EKG yang harus ditafsirkan. Neural network adalah teknik berbasis
kecerdasan buatan yang dapat mengidentifikasi pola dan salah satu algoritma
pembelajaran yang paling banyak digunakan adalah backpropagation. Sistem ini
dibangun untuk membantu proses interpretasi sinyal EKG dalam mendiagnosa
kelainan denyut jantung. Data yang digunakan dalam penelitian ini diperoleh dari
database MIT-BIH. Data telah diproses untuk digunakan dalam sistem identifikasi
yang dikembangkan dari penelitian ini. Pra-pemrosesan memisahkan sinyal menjadi
satu siklus dan menyamakan ukuran sinyal dengan menggunakan teknik zero padded.
Dalam sistem ini, ekstraksi fitur yang baik dari sinyal EKG diperlukan untuk
meningkatkan akurasi. Transformasi wavelet diskrit digunakan sebagai ekstraksi fitur
dan level yang dijalankan hingga sepuluh. Setiap hasil level digunakan sebagai input
ke sistem identifikasi dan mendapatkan nilai akurasi yang berbeda. Untuk studi ini,
keakuratannya diatur ke 80%. Apabila hasil di bawah 80%, maka dianggap tidak
memenuhi syarat. Sistem identifikasi sinyal EKG yang dikembangkan mencapai
akurasi rata-rata 91,3% menggunakan fitur sinyal EKG yang dihitung menggunakan
teknik Discrete Wavelet Transform dalam mengidentifikasi denyut jantung normal dan
abnormal.
ix
CONTENTS
APPROVAL SHEET i
VALIDATION SHEET ii
DECLARATION iii
DEDICATION iv
ACKNOWLEDGEMENT v
ABSTRACT vi
ABSTRAK vii
ABSTRAK viii
TABLE OF CONTENT ix
LIST OF TABLES xii
LIST OF FIGURES xiii
LIST OF SYMBOLS AND ABBREVIATIONS xv
LIST OF APPENDICES xvi
CURICULUM VITAE xvii
STATEMENT OF AUTHENTICITY xviii
UNDERGRADUATE PROJECT REPORT
CHAPTER 1 INTRODUCTION 1
1.1 Background of study 1
1.2 Problem Statement 2
1.3 Objectives of the study 2
1.4 Scope of project 3
1.5 Project report outline 3
CHAPTER 3 METHODOLOGY 18
3.1 Introduction 18
3.2 Identification of ECG signal 18
3.3 Digital signal processing 19
3.3.1 Pre-processing 19
3.2.1.1Separating signal into one 20
cycle
3.2.1.2 Equalizing the size of the 21
signal
3.3.2 Feature extraction 22
3.2.2.1 Signal’s statistic features 22
extraction
3.2.2.2 Hu moment 23
3.2.2.3 Discrete wavelet transform 24
3.4 Identification of ECG signal using 26
backpropagation neural network with two
layers feed forward
3.5 Summary of chapter 27
CHAPTER 5 CONCLUSION 45
5.1 Conclusion 45
5.2 Recommendation 45
REFERENCES 47
APPENDIX 49
xii
LIST OF TABLES
LIST OF FIGURES
LIST OF APPENDICES
A Gantt chart 49
B Weight and bias of the identification system 51
C Main algorithm of the system in MATLAB 58
xvii
CURICULUM VITAE
Educational Background
- SD Al-Falah Tropodo II, Waru, Sidoarjo (2003 – 2009)
- SMP Al-Falah Deltasari, Waru, Sidoarjo (2009 – 2012)
- SMAN 20 Surabaya, Specialist subject: Science (2012 – 2015)
- Universitas Widyagama Malang, Electrical Engineering (2015-2019)
xviii
INTRODUCTION
turned into 15’, 30’, 45, until 90’ but this method able to identify the pattern [5]. This
project is about a study and identifies recording patterns on the ECG to determine
abnormalities in the heart by using a backpropagation neural network method.
In the medical field, the ECG signal is used to diagnose the abnormalities of the heart.
The diagnosis is based on the signal pattern. However, there are several patterns of
ECG signal which indicate the different interpretation of the heart's abnormalities.
Therefore, the interpretation must be right and accurate. In order to avoid the wrong
diagnosis of patient's sickness which will effect on the patient’s medication.
To overcome this problem, this project proposes an artificial intelligence based
method for ECG signal identification. The proposed method is a well-known method
called backpropagation neural network. However, to obtain the optimum result the
neural network needs a feature extraction. Feature extraction helps the neural network
to identification signal. There are several methods of feature extraction with a different
result. Hence, it is needed to choose the method with the most optimal results suitable
to a neural network.
The main objective of this project is to identify the ECG signal by using a neural
network. As a result, the objectives of the proposed project are:
(i) To process ECG signal into one cycle signal and suitable to the system.
(ii) To determine a feature extraction with an optimum result for the neural
network.
(iii) To classify the ECG signal into two classes, normal and abnormal.
(iv) To build a Graphical User Interface which can identify the ECG signal using
MATLAB.
3
(i) All the process of the identification is using a personal laptop with Intel
processor core i5 2^nd generation.
(ii) The data were obtained from the PhysioNet service (http://www.physionet.org)
from the MIT-BIH Arrhythmia database.
(iii) The ECG signals were from 45 patients: 19 female (age: 23-89) and 26 male
(age: 32-89) which contained 17 classes: normal sinus rhythm, pacemaker
rhythm, and 15 types of cardiac dysfunctions (for each of which at least 10
signal fragments were collected).
(iv) All ECG signals were recorded at a sampling frequency of 360 [Hz] and a gain
of 200 [adu / mV] and selecting a random 10-second (3600 samples) fragments
of the ECG signal (not overlapping)
(v) The signals only derived from one lead, the MLII and the data are in mat format
(MATLAB).
(vi) For this project, the data must be separated into one cycle and have the same
size.
(vii) The neural network algorithm used is backpropagation with two layer feed
forward network.
(viii) The program used is MATLAB R2013a which can load the data.
(ix) The GUI is consist of two-part namely feature extraction and classify.
(x) The feature extraction used are signal’s statistic feature, Hu moment feature,
and discrete wavelet transfor.
This thesis consists of five chapters. Chapter 1 serves as an introduction to the thesis.
It contains the problem statement, objectives, and scope of the project. The rest of the
thesis is organized as follows: Chapter 2 covers a relevant theory about
backpropagation neural network, feature extraction, ECG signal and relevant research
related to identification using neural network method. Chapter 3 explain the method
implemented in this project. This chapter is divided into two part. The first part is
digital signal processing signal and the other part is the identification process. It will
4
be explained about digital signal processing signal until derive the best signal feature
which suitable with the identification process. In the last part, identification ECG
signal using a backpropagation neural network method will be defined.
In chapter 4, the result will be analyzed. The analyze is about the effect of the
separating ECG signal into one cycle, determine a feature extraction between a statistic
of the signal, Hu moment, and wavelet discrete transform and the last is analyzing the
result of the performance of the identification system using backpropagation neural
network.
Chapter 5 is the last chapter of this thesis which explains about conclusion and
review based on the previous chapter. The suggestions regarding future research that
can be implemented in the future end this chapter.
CHAPTER 2
2
LITERATURE REVIEW
2.1 Introduction
This chapter discusses the theory related to the identification of ECG signal pattern for
this project. The topic will discuss are about ECG signal as an object in this project,
Hu moment and Discrete wavelet transform as a feature extraction used in this project,
and neural network as a method used for the identification. At last part of this chapter,
the previous project related to this project will be served.
Based on Einthoven, there are some part of heart activities which is depicted as ECG
signal, namely:
In the clinical practice, ECG signal is usually used. Holter ECG device is the
most used ECG signal record [10]. This device applied to a patient if the paramedics
need to monitor the abnormalities of their ECG. The waves and complexes of the ECG
signal will be interpreted by the paramedics. The parameters calculated to find out if
the ECG is normal or not. The parameters are RR interval, PP interval, QT interval,
and ST segment, which are the interval and the height of the wave [7].
2.2.1 Arrhythmia
Cardiac arrhythmia or irregular heartbeat is a conditions when the beat of the cardiac
irregular (rapid or too slow) [11]. There are many kinds of arrhythmia, i.e :
(i) Atrial Premature Beat (APB)
Atrial premature beats is an abnormal heartbeat which commonly occur to a people
who has lungs abnormalities. There is not specific symptoms. However it can be
discovered by looking the ECG signal. APB patients have heart pulse irregularity, a
premature P waves, a narrow QRS complex and shortened or prolonged PR interval.
(ii) Atrial Flutter (AFL)
Atrial flutter is an abnormal cardiac rhythm because the atrium beat too rapid. It makes
the contraction of the atrium muscle is faster and make it out of 1st paragraph.
Synchronization with the ventricle. The ECG characteristics of AFL are the atrial rate
is around 300bpm, the QRS rate is 150 bpm or normal, and a narrow complex
tachycardia at a ventricular rate is 150 bpm.
(iii) Atrial Fibrillation (AF)
Atrial fibrillation is cardiac abnormalities because the electrical impulses shoot from
different place in the atrium in an irregular way. This condition makes the atrium
twitch and generate an irregular pulse in the cardiac. The ECG characteristics of AF
are the atrium rate is about 400-600 bpm, the amplitude is low, and the P waves cannot
be seen.
(iv) Supraventricular tachycardia (SVTA)
Supraventricular tachycardia (SVT) or paroxysmal supraventricular tachycardia, is an
irregularly fast heartbeat. It is a general term of cardiac arrhythmias which occur in
above the ventricles in the atrium or AV node.
(v) Wolf Parkinson White Syndrom (WPW)
8
Wolff Parkinson white syndrome is a syndrome caused of the extra electrical pathway
in the cardiac. It can lead of fast heartbeat. The characteristics of WPW based on the
ECG signal are a shortened P-R interval which is around less than 0.12 s and a
prolonged a QRS complex around 0.11 s or more.
(vi) Premature ventricular contractions (PVCs)
Premature ventricular contractions are an additional cardiac pulse that begin in one of
two ventricles. It bothers a normal cardiac rhythm and causing a skipped pulse in the
heart.
(vii) Trigeminy
Trigeminy is a typical heart rhythm, the heart beats in an even pattern. The top part of
the heart kneads abnormal, then the bottom part of the heart kneads in a regular rhythm.
This is known as a premature ventricular complex (PVC) or ventricular premature
beat. When this occurs in a three-beat pattern, it called trigeminy.
(viii) Ventricular tachycardia (VT)
Ventricular tachycardia is a cardiac rhythm problem caused by irregular electrical
signals in the ventricles. The heartbeat of VT patients usually 100 or more bpm and it
out of sync with the atrium.
(ix) Fusion
A fusion occurs when electrical impulses fire off from different or even the same
region of the heart at the same time. If it occurs in the ventricle, so it called as
ventricular fusion. However, if it occurs in the atrium, it called atrial fusion. The cause
of ventricular fusion is when a normal cardiac rhythm and the impulse from a
pacemaker coincide to activate the same part of a ventricle in one time.
(x) Left Bundle Branch Block (LBBB)
Left bundle branch block (LBBB) is a heart conduction irregularity showed on the
electrocardiogram (ECG). It occurs because the activation of left ventricles is delayed,
then caused the contraction of the left ventricles slower than the right ventricle. The
characteristics of LBBB are the cardiac rhythm is from supraventricular and the QRS
duration is must be more than equal 120ms.
(xi) Right Bundle Branch Block (RBBB)
A right bundle branch block (RBBB) is a cardiac conduction abnormality occurs in the
right bundle branch. It happened because the right ventricle is not directly activated by
impulses, but the left ventricle still activated normally. These impulses move through
left ventricle myocardium to right ventricle and depolarize the right ventricle. because
9
the conduction through the myocardium is slower than conduction through the Bundle
of His-Purkinje fibers, the QRS complex is widened. The QRS complex often shows
an extra deflection that reflects the rapid depolarization of the left ventricle followed
by the slower depolarization of the right ventricle. The parameter to diagnose a right
bundle branch block are the heart rhythm must be from above the ventricles and the
QRS duration more than 100 ms (incomplete block) or more than 120 ms (complete
block).
(xii) Second Degree Heart Block
Second-degree atrioventricular block (AV block) is an irregularity of the electrical
conduction system of the cardiac. It is a conduction block between the atrium and
ventricles. The presence of second-degree AV block is diagnosed when one or more
(but not all) of the atrial impulses fail to conduct to the ventricles due to impaired
conduction. It is classified as a block of the AV node and is categorized in between
first-degree (slowed conduction) and third-degree blocks (complete block).
(xiii) Pacemaker Rhythm
Pacemakers provide an artificial electrical impulse to the cardiac. This impulse and the
normal electrical signals of the cardiac can be interpreted. It is provided a training
module for pacemaker rhythms and links to practice strips of pacemaker patients.
There are multiple types of pacemaker rhythms:
a. Normal Single Chamber Pacemaker
b. Normal Dual Chamber Pacemaker
c. Failure to Capture
d. Failure to Pace
e. Failure to Sense
2.3 Hu moment
Moment Hu invariants were first published to the pattern recognition and image
processing community in 1962 [12]. When Hu applied the results of the theory of
algebraic invariants and derived seven invariants to the rotation of 2-D objects.
Two dimensional ( + ) order moment are defined as follows:
10
∫ ( , )
=∫ (2.1)
, = 0,1,2 …
If the pattern function f(x,y) is piecewise continuous bounded function, the
moment of all orders exist and the moment sequence { } is uniquely determined
by f(x,y). And correspondingly, f(x,y) is also uniquely determined by the moment
sequence { }. One should note that moments in (1) may be not invariant when f(x,y)
changes by translating, rotating, or scaling. The invariant features can be achieved
using central moments, which are defined as follows:
( − ̅) ( − ) ( , ) (2.2)
=
, = 0,1,2 …
where,
̅= =
The point ( ̅ . ) is the centroid of the pattern f (x,y). The centroid moments
computed using the centroid of the ECG signal pattern f(x,y) is equivalent to the
whose center has been shifted to the centroid of the pattern. Therefore, the central
moment is invariant to pattern translation. Scale invariance can be obtained by
normalization. The normalized central moments are defined as follows:
=( − ) +4 (2.5)
=( −3 ) + (3 − ) (2.6)
=( −3 ) + (3 − ) (2.7)
=( −3 ) ( + )[( + ) −
3 − ) + (3 − ) ( − )
11
[(3 + ) −( + ) ] (2.8)
=( − ) [( + ) − + ) +
(4 ( + )−( + ) (2.9)
= (3 − ) ( + ) [ + ) − (3 + )
−( +3 )( + ) [3( + ) −( + ) ] (2.10)
The seven Hu moment invariants are useful properties of being unchanged under
pattern scaling, translation, and rotation [13].
A wavelet transform that is discretely sampled called discrete wavelet transform (dwt)
in numerical and functional analysis. The advantage of this transform as same as other
wavelet transform, it is temporal resolution. Dwt can capture frequency and location
in time which is cannot be done by Fourier transform. A signal is decomposed by dwt
into detail which are a low frequency and a high-frequency component [14]. The
discrete wavelet transform can be written as:
, = ∫ ( ) , ( ) , (2.11)
, = ∫ ( ) , ( ) , (2.12)
But the discrete signal is of finite length N. So the range of the scales that can be
investigated is 0<m<M. therefore, a discrete approximation of the signal can be written
as :
12
( )= + ∑ ( ), (2.13)
( )= ∑ , , ( ), (2.14)
( )= ( )− ( ), (2.15)
A method inspired by a neuron in human body and brain called Neural Network. As
how neuron works which transfers the information from human brain to other body
parts, in neural network the neuron receives input and do dot operation with a weight,
weighted sum and adds bias. This operation results a parameters of the activation
function which is the output of the neuron. Referring to Figure 2.3, the neural network
has the same system as a neuron. Dendrites which accepts the information is
represented as an input in the neural network. In the neuron system, the information
will be processed in the cell body. The cell body is represented as an activation
function in the neural network. The activation function is needed by the network to
make the output nonlinearity node so that the node does not only produce output as
input. Another function is to limit the output value to a certain range [16]. For output,
the axon is represented as an output in a neural network. Neural networks can be
applied to do various things, namely:
(i) Grouping/classification
- In marketing, it can be used to group consumer action patterns.
- In agriculture and fisheries, it can be used for grouping of grade fruits and fish.
13
2.5.1 Backpropagation
Backpropagation works by adjusting the neural network’s weight based on the desired
output and target to decrease the error rate. It is a learning algorithm and also a
systematic method for multilayer ANN training. Backpropagation has three layers in
the training process called input layer, hidden layer and output layer.
14
Output Data
(Target)
Output Prediction
Input data Neural Network
-
Loss/Error
Back Propagation
Weight Update
There are a few journals that are related to this project. The following is an advantage
and disadvantage for each journal.
15
The ECG signal is a signal produced from the electrical activity of a heart which is
detected using ECG device. This signal can be used to detect the abnormalities of the
heart. There is an abnormality of a heart called arrhythmia. It is an irregular heartbeat
disease. The disease can be detected by identify the ECG signal pattern. However,
there are many pattern to be interpreted. Neural network can be used to interpret the
pattern but, it needs the right feature extraction to get optimal result. Hu moment and
discrete wavelet transform can be used as a feature extraction to help neural network
identify the ECG signal.
3CHAPTER 3
METHODOLOGY
3.1 Introduction
This chapter defines the detail of the method and the technique of the project. The
process in this research is divided into two parts namely digital signal processing and
identification of the ECG signal by using Neural Network.
In the digital signal processing, every step that has been done will be explained
starting from separating the signal into one cycle until the feature extraction process
to obtain the best features of the signal. In the identification process, a backpropagation
neural network with two layer feed forward network has been used.
Identification of ECG signal which has been built in this project consists of two parts,
i.e. digital signal processing and classification using Neural Network[10] [26]. In the
digital signal processing part, there are two main unit known as pre-processing and
feature extraction. Based on the pre-processing unit of this project, there are two sub-
unit, which are separating the signal into one cycle and equalizing the size of the signal.
Figure 3.1 shows the flowchart of the project which includes all the sub-unit.
19
3.3.1 Pre-Processing
Pre-processing has a purpose to edit and increase the quality of the signal. Besides, it
helps feature extraction process by providing a signal that matches the characteristics
20
to be extracted. In this project, the pre-processing process has been divided into two
parts, namely separating the signal into one cycle and equalizing the size of the signal.
START
Select
ECG
signal
END
Figure 3.2: The process of separating the signal into one cycle using MATLAB
21
The data of this project was obtained from the PhysioNet service
(http://www.physionet.org) of the MIT-BIH Arrhythmia database [27]. The ECG
signal samples contain more than one cycle which is about 10 second (3600 samples).
Based on this signal, it needs to be applied to extract one cycle of the sample signal.
Figure 3.2 shows the flowchart of the proposed technique.
START
y = Input Data
Signal
y1=[y zeros(1,500-a)]/max(y)
SHOW
y1
Save y1
END
Equalizing the size of the signal aims to normalize the data. After the data was
separated, the size of each data is different. In order to make the data have the same
size, the ECG signal will be interpolated using zero padded technique. This technique
22
built by using MATLAB code. Figure 3.3 shows the flowchart of the equalizing
process.
Feature extraction is the most important step in the identification process. Choosing a
suitable feature will increase the accuracy of the identification. The result of the feature
extraction will be the input for classifying the ECG signal. This selection of inputs
determines the outcome of the classification. If the inputs are not good, the
performance of the classifier will inadequate[28].
Start
END
Signal statistic feature extraction is a feature extraction of input ECG signal using its
statistic features. The statistic feature used is the maximum value of the signal, the
minimum value of the signal, the variance value of the signal, and the standard
deviation value of the signal. Figure 3.4 shows the flowchart of the statistic feature
extraction in this project
3.3.2.2 Hu Moment
START
Load function
cent_moment
Load function
feature_vec
g = calculate hu moment
Display (g)
END
START
y1 = input data
signal
Calculate ca and cd of
1 dwt transformation
Calculate ca and cd of
2 dwt transformation
Calculate ca and cd of
3 dwt transformation
Calculate ca and cd of
4 dwt transformation
A
25
Display dwt
transformation results
from 1 10
END
START
Select input
data
Select target
data
Plot result
No Result≥
80%
Yes
END
In this project, the identification system used is a neural network technique. Referring
to the neural network, the technique requires the weight value of the network to be
determined based on the input and target data. In this project, the learning algorithm
chosen for the neural network is the backpropagation with two layer feed forward
network. According to El-Khafif and El-Brawany [30], the backpropagation neural
network can be used effectively in ECG signal processing.
As the neural network needs inputs and targets to determine the weight and
bias value, the inputs in this project are the features of the ECG signal that has been
extracted and represented as numbers. There are three phases of the neural network,
namely training, testing, and validating, where the phase's percentage used for this
project is 80% for training, 10% for testing, and 10% for validating. In this project, the
minimum result of the identification set to 80%. If the result obtained less than 80%,
the system will be re-train.
This chapter has discussed the entire process of the project. Starting from the digital
signal processing which contains pre-processing and feature extraction and follows the
neural network pattern identification process. In the pre-processing part, there are two
sub-unit involve, namely the separating signal into one cycle and the signal size
equalize.
Referring to the feature extraction part, this project uses three methods: Signal
statistic extraction, hu moment extraction, and discrete wavelet transform. At the end
of this chapter, the identification of the ECG signal by using a backpropagation neural
network has been discussed.
CHAPTER 4
4
4.1 Introduction
This chapter discusses the result analysis of the identification and feature extraction
system analysis of the project. The analysis will be discussed as follows:
(i) Separating the signal into one cycle analysis in pre-processing system.
(ii) Equalizing the size of the signal analysis in the pre-processing system.
(iii) Signal statistic extraction for backpropagation neural network system analysis
(iv) Hu moment extraction for backpropagation neural network system analysis
(v) Discrete wavelet transform for backpropagation neural network system
(vi) Graphical User Interface in MATLAB
All discussions related to the above analysis will determine the effectiveness
of this identification of the ECG signal pattern. In addition, the analysis of the results
also determines the reliability of the algorithm that has been used.
4.2 The result on analysis of separating the signal into one cycle
This analysis used to specify a signal form. Figure 4.1 shows the signal before
separating process, while figure 4.2 shows the ECG signal after separating process.
The total of the signal which has been separated is 2000, 1000 normal and 1000
abnormal.
29
ECG signal
1350
1300
1250
1200
Amplitude(v)
1150
1100
1050
1000
950
900
0 500 1000 1500 2000 2500 3000 3500 4000
Sample(n)
ECG signal
1500
1400
1300
Amplitude(v)
1200
1100
1000
900
800
0 20 40 60 80 100 120 140 160
Sample(n)
Figure 4.2: The ECG signal after separating process
The data signal obtained after separating process has a different size in each cycle. So
in order to equalize the size, the ECG signal needs to interpolate using the zero padded
technique. Figure 4.3 shows the result of the interpolation technique used in this
project.
30
Amplitude (v)
1000
500
0
0 50 100 150 200 250 300 350 400 450 500
Sampling(n)
ECG signal after equalizing
1
Amplitude (v)
0.5
0
0 50 100 150 200 250 300 350 400 450 500
Sampling
Figure 4.3: Equalizing the size of the signal using the interpolating technique
This analysis has been done to observe the suitability of the feature extraction method
in the identification of the ECG signal using a backpropagation neural network
method. The first feature extraction is the statistic feature of the ECG signal which
contains maximum, minimum, variance, and standard deviation of the signal
In this project, the neural network using MATLAB nntool which the results are
shown in a plot confusion. Plot confusion (targets, outputs) is matrix which contained
the true labels targets and predicted labels outputs [31]. The predicted class (target) is
corresponding with the rows and the true class (output) is corresponding with the
column on the matrix plot. The correct classified observation is corresponding with
the diagonal cells, while the incorrect classified observation is corresponding with the
off-diagonal cells. The result shown in each cell are the number of the observation and
the percentage of the observation.
The MATLAB nntool has been run for several times until it gives the
performance of the system which is more than 80%. Figure 4.4 and 4.5 shows the final
31
result of the neural network system in classifying the ECG signal using signal statistic
features.
Output Class
Output Class
139 619 81.7% 24 126 84.0%
2 2
9.9% 44.2% 18.3% 8.0% 42.0% 16.0%
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Based on the moment features, the ECG signal can be represented as a seven number.
These numbers were used in the neural network system as an inputs parameter. Figure
4.6 and 4.7 shows the result of the ECG signal classification using Hu moment
features. Referring to figure 4.6 and 4.7, the result of the neural network system
performance is about 81.3% and 82%.
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Output Class
Output Class
61 518 89.5% 13 104 88.9%
2 2
4.4% 37.0% 10.5% 4.3% 34.7% 11.1%
1 2 1 2
Target Class Target Class
Output Class
13 104 88.9% 87 726 89.3%
2 2
4.3% 34.7% 11.1% 4.3% 36.3% 10.7%
1 2 1 2
Target Class Target Class
The discrete wavelet transform features used in this project in order to classify the
ECG signal into normal and abnormal. The classification has been done from 1
extraction until 10 extractions. Figure 4.8 to Figure 4.17 show the classification
performance of the ECG signal in this project using discrete wavelet transform from 1
until 10 times extraction.
Referring to figure 4.8, the one times the extraction of the discrete wavelet
transform of the ECG signal used as the input parameter of the neural network system
has produced 90.1% of overall performance.
34
Output Class
Output Class
51 702 93.2% 7 94 93.1%
2 2
3.2% 43.9% 6.8% 3.5% 47.0% 6.9%
1 2 1 2
Target Class Target Class
Output Class
7 72 91.1% 65 868 93.0%
2 2
3.5% 36.0% 8.9% 3.3% 43.4% 7.0%
1 2 1 2
Target Class Target Class
Figure 4.8: Plot confusion discrete wavelet transform one times extraction (90.1%)
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Figure 4.9: Plot confusion discrete wavelet transform two times extraction (89.6%)
35
The overall classification performance using two times dwt extraction is about
89.6% as shown in figure 4.9. Classification performance using three times dwt is
about 91.2%,
Training Confusion Matrix Validation Confusion Matrix
Output Class
Output Class
33 609 94.9% 8 137 94.5%
2 2
2.4% 43.5% 5.1% 2.7% 45.7% 5.5%
1 2 1 2
Target Class Target Class
Output Class
8 127 94.1% 49 873 94.7%
2 2
2.7% 42.3% 5.9% 2.5% 43.6% 5.3%
1 2 1 2
Target Class Target Class
Figure 4.10: Plot confusion discrete wavelet transform three times extraction (91.2%)
Training Confusion Matrix Validation Confusion Matrix
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Figure 4.11: Plot confusion discrete wavelet transform four times extraction (91.3%)
36
Based on the Figure, the overall the ECG signal while the performance of the
classification using four and five times extraction of dwt is about 91.3% which are the
highest accuracy value obtained from this project. This can be seen in Figure 4.11 and
Figure 4.12.
Output Class
44 631 93.5% 10 138 93.2%
2 2
3.1% 45.1% 6.5% 3.3% 46.0% 6.8%
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
The overall classification performance of the ECG signal in this project using
six times until ten times extraction of dwt has produced results which range from 70%
until 89%. These results can be seen in Figure 4.13 until Figure 4.17.
37
Output Class
Output Class
56 622 91.7% 12 132 91.7%
2 2
4.0% 44.4% 8.3% 4.0% 44.0% 8.3%
1 2 1 2
Target Class Target Class
Output Class
11 115 91.3% 79 869 91.7%
2 2
3.7% 38.3% 8.7% 4.0% 43.5% 8.3%
1 2 1 2
Target Class Target Class
Figure 4.13: Plot confusion discrete wavelet transform six times extraction (89.5%)
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Figure 4.14: Plot confusion discrete wavelet transform seven times extraction (82.6%)
38
Output Class
Output Class
97 525 84.4% 22 114 83.8%
2 2
6.9% 37.5% 15.6% 7.3% 38.0% 16.2%
1 2 1 2
Target Class Target Class
Output Class
25 108 81.2% 144 747 83.8%
2 2
8.3% 36.0% 18.8% 7.2% 37.4% 16.2%
1 2 1 2
Target Class Target Class
Figure 4.15: Plot confusion discrete wavelet transform eight times extraction (80.2%)
Output Class
1 2 1 2
Target Class Target Class
Output Class
1 2 1 2
Target Class Target Class
Figure 4.16: Plot confusion discrete wavelet transform nine times extraction (71.8%)
39
Output Class
Output Class
121 432 78.1% 39 75 65.8%
2 2
8.6% 30.9% 21.9% 13.0% 25.0% 34.2%
1 2 1 2
Target Class Target Class
Output Class
31 88 73.9% 191 595 75.7%
2 2
10.3% 29.3% 26.1% 9.6% 29.8% 24.3%
1 2 1 2
Target Class Target Class
Figure 4.17: Plot confusion discrete wavelet transform ten times extraction (70.2%)
The overall classification performance of the ECG signal in this project using
six times until ten times extraction of dwt has produced results which range from 70%
until 89%. The summary of the classification performance of the ECG signal using
discrete wavelet transform from 1 until 10 times extraction shown in table 4.1.
Table 4.1: The summary of the classification performance of the ECG signal using dwt
HIDDEN
DWT TRAINING TESTING VALIDATION RESULT
NODE
1 time 80% 10% 10% 10 90.1%
2 times 80% 10% 10% 10 89.6%
3 times 80% 10% 10% 10 91.2%
4 times 80% 10% 10% 10 91.3%
5 times 80% 10% 10% 10 91.3%
6 times 80% 10% 10% 10 89.5%
7 times 80% 10% 10% 10 82.8%
8 times 80% 10% 10% 10 80.2%
40
HIDDEN
DWT TRAINING TESTING VALIDATION RESULT
NODE
9 times 80% 10% 10% 10 71.8%
10 times 80% 10% 10% 10 70.2%
4.7 The ECG signal classification system using a Graphical User Interface in
MATLAB
The result derived from the feature extraction which has the best value is simulated
and used as input data for Graphical User Interface (GUI) in MATLAB. For this
project, the result of the feature extraction used is dwt feature extraction with five times
extraction. Based on the results, the neural network parameter such as input node,
hidden node, and output node are used to develop the GUI system. The neural network
inputs parameter are shown in table 4.2. Moreover, there are other parameters namely
weight, and bias which shows in appendix B.
Figure 4.18 shows the main GUI interface of the ECG signal classification
system. The ‘feature extraction button’ is used to show the selected ECG signal and
it’s dwt features plot.
Figure 4.19 shows the interface of the selection menu for the ECG signal
selected by the user after clicking button ‘feature extraction’. Based on this figure, the
user can select the ECG file in a .mat format using mouse click.
ECG SIGNAL
1100
Amplitude (v)
1000
900
800
0 50 100 150 200 250
Sampling
Feature wavelet
3
Amplitude (v)
0
0 10 20 30 40 50 60 70
Sampling
Figure 4.20: Plotting data before and after feature extraction using dwt
43
The plot of the example of the selected ECG signal and its five times dwt
features are shown in figure 4.21. The ‘classify' button used in this GUI to run the
neural network calculation for the classification of the selected ECG signal. In figure
4.22, the message box will appear to inform the user regarding the types of the ECG
signal selected.
In this GUI, the ‘Info' button is used to display the information of the signal
types, while the ‘Exit' button is used to close the GUI program. Figure 4.23 shows the
signal information after clicking the ‘Info' button.
In this project, there are two sub-unit in pre-processing which are separating the signal
into one cycle and equalizing the size of the signal. Both are important for digital signal
processing. Because if it uses the original signal without pre-processing, the result
derived will different and it will make a problem for the feature extraction process. If
the signal is not separated, the signal feature will not specific. Afterward, this process
if the signal is not equalized its size, the data cannot be processed in feature extraction.
In feature extraction, selecting the suitable features determine the result of the
ECG signal classification. For this project, the features used are the signal's statistic,
Hu moment, and discrete wavelet transform from 1 time until 10 times. Based on the
ECG signal classification using these features as inputs of the neural network system
the highest result obtained by discrete wavelet transform for 4 and 5 times extraction.
In this project, the GUI system has also been developed. The classification of
the ECG signal can be made easily using this developed GUI system, where the user
only needs to click the button of the system to select the ECG signal and classify it.
5CHAPTER 5
5.1 Conclusions
The classification of the ECG signal into normal and abnormal types in this project is
using a backpropagation neural network. Two main processes of this classification
system are the discrete signal processing and neural network. In this project, based on
discrete signal processing, it can be divided into two sub-unit is known as pre-
processing and feature extraction.
In the classification of the ECG signal, this project has evaluated the
backpropagation neural network using several types of features such as signal’s
statistic, Hu moment, and discrete wavelet transform (dwt). Based on the classification
performance the ECG signal using backpropagation neural network, the used of four
and five times extraction of dwt give the best result at about 91.3%.
The implementation of the ECG signal classification using GUI system has
also developed. The GUI system designed can ease the classification process by using
a button to select the featured signal.
5.2 Recommendations
Even though this project proves that backpropagation neural network can identify ECG
signal, but the classes are only two. It will be better if the future project can identify
more than two classes. Besides, the ECG signal classification of this project can be
upgraded from the MATLAB GUI system into the Android application system. In the
46
future, as to improve this ECG signal classification system another features types can
be considered such as Zernike moment and affine moment.
REFERENCES
[1] J. Arifin, “Identifikasi dan Klasifikasi Pola Sinyal EKG Berdasarkan Sifat
Keacakan (Entropy),” 2013.
[2] F. Lutfi and A. Arifin, “Klasifikasi Sinyal Elektrokardiografi Menggunakan
Wavelet Transform dan Neural Network,” 2012.
[3] S. Karpagachelvi, M. Arthanari, and M. Sivakumar, “ECG feature extraction
techniques-a survey approach,” ArXiv Prepr. ArXiv10050957, 2010.
[4] R. Hecht-Nielsen, “Theory of the backpropagation neural network,” in Neural
networks for perception, Elsevier, 1992, pp. 65–93.
[5] A. Riztyan and R. B. Dariska, “Analisis Pengenalan Motif Songket Palembang
Menggunakan Algoritma Propagasi Balik,” 2013.
[6] Sabar Setiawidayat, Rudi Joegijantoro, and Akhmad Farikh, “Pemakaian
Electrocardiograph Diskrit Untuk Pemeriksaan Jantung Secara Standard Klinis,”
Pros. Semin. Nas. FDI, p. AT 29-33, 2016.
[7] Malcolm S. Thaler, Satu-satunya buku EKG yang anda perlukan (The only EKG
book you’ll ever need), 5th ed. Penerbit Buku Kedokteran.
[8] Ahmad Handayani, “Sistem Konduksi Jantung,” vol. 2, no. 3, pp. 116–123,
Oktober 2017.
[9] S. Setiawidayat, R. Hidayati, E. B. Sulistiarini, and N. Finahari, “PENDETEKSI
AMPLITUDO ELEKTROKARDIOGRAM DISKRIT MENGGUNAKAN
ALGORITMA PQRST,” 2017.
[10] Q. Zhao and L. Zhang, “ECG feature extraction and classification using wavelet
transform and support vector machines,” in 2005 International Conference on
Neural Networks and Brain, 2005, vol. 2, pp. 1089–1092.
[11] pilcher J, Pocket Guide to Neonatal ECG interpretation, 3rd ed. NICU INK
Book.
48
[12] Hu M.-K., “Visual pattern recognition by moment invariants,” vol. 8, no. 2, pp.
179–187, 1962.
[13] Zhihu Huang and Jinsong Leng, “Analysis of Hu’s Moment Invariants on Image
Scaling and Rotation,” ECU Publ., pp. 476–480.
[14] R. J. Martis, U. R. Acharya, and L. C. Min, “ECG beat classification using PCA,
LDA, ICA and discrete wavelet transform,” Biomed. Signal Process. Control,
vol. 8, no. 5, pp. 437–448, 2013.
[15] C. Saritha, V. Sukanya, and Y. N. Murthy, “ECG signal analysis using wavelet
transforms,” Bulg J Phys, vol. 35, no. 1, pp. 68–77, 2008.
[16] S. Sena, “Pengenalan Deep Learning Part 1 : Neural Network,” Samuel Sena, 28-
Oct-2017. .
[17] A. T. Goh, “Back-propagation neural networks for modeling complex systems,”
Artif. Intell. Eng., vol. 9, no. 3, pp. 143–151, 1995.
[18] N. Maglaveras, T. Stamkopoulos, K. Diamantaras, C. Pappas, and M. Strintzis,
“ECG pattern recognition and classification using non-linear transformations and
neural networks: A review,” Int. J. Med. Inf., vol. 52, no. 1–3, pp. 191–208, 1998.
[19] U. R. Acharya et al., “Deep convolutional neural network for the automated
diagnosis of congestive heart failure using ECG signals,” Appl. Intell., vol. 49,
no. 1, pp. 16–27, 2019.
[20] H. Gothwal, S. Kedawat, and R. Kumar, “Cardiac arrhythmias detection in an
ECG beat signal using fast fourier transform and artificial neural network,” J.
Biomed. Sci. Eng., vol. 4, no. 04, p. 289, 2011.
[21] U. R. Acharya, H. Fujita, S. L. Oh, Y. Hagiwara, J. H. Tan, and M. Adam,
“Application of deep convolutional neural network for automated detection of
myocardial infarction using ECG signals,” Inf. Sci., vol. 415, pp. 190–198, 2017.
[22] H. M. Rai, A. Trivedi, and S. Shukla, “ECG signal processing for abnormalities
detection using multi-resolution wavelet transform and Artificial Neural Network
classifier,” Measurement, vol. 46, no. 9, pp. 3238–3246, 2013.
[23] L.-Y. Shyu, Y.-H. Wu, and W. Hu, “Using wavelet transform and fuzzy neural
network for VPC detection from the Holter ECG,” IEEE Trans. Biomed. Eng.,
vol. 51, no. 7, pp. 1269–1273, 2004.
[24] P. P\lawiak, “Novel methodology of cardiac health recognition based on ECG
signals and evolutionary-neural system,” Expert Syst. Appl., vol. 92, pp. 334–
349, 2018.
49
[25] T.-E. Chen et al., “S1 and S2 heart sound recognition using deep neural
networks,” IEEE Trans. Biomed. Eng., vol. 64, no. 2, pp. 372–380, 2016.
[26] A. Joret, N. A. M. Isa, A. N. Ali, K. Z. Zamli, K. A. Azizli, and M. S. M. Al
Batah, “Classifying the shape of aggregate using hybrid multilayered perceptron
network,” in Proceeding ICS’05 Proceedings of the 9th WSEAS International
Conference on Systems, 2005, pp. 1–6.
[27] P. Plawiak, “ECG signals (1000 fragments),” vol. 3, Nov. 2017.
[28] A. Subasi, “EEG signal classification using wavelet feature extraction and a
mixture of expert model,” Expert Syst. Appl., vol. 32, no. 4, pp. 1084–1093, 2007.
[29] A. N. Sarlashkar, M. Bodruzzaman, and M. J. Malkani, “Feature extraction using
wavelet transform for neural network based image classification,” in Proceedings
of Thirtieth Southeastern Symposium on System Theory, 1998, pp. 412–416.
[30] S. H. El-Khafif and M. A. El-Brawany, “Artificial Neural Network-Based
Automated ECG Signal Classifier,” International Scholarly Research Notices,
2013. [Online]. Available:
https://www.hindawi.com/journals/isrn/2013/261917/. [Accessed: 15-May-
2019].
[31] “Plot classification confusion matrix - MATLAB plotconfusion.” [Online].
Available:
https://www.mathworks.com/help/deeplearning/ref/plotconfusion.html.
[Accessed: 11-Jun-2019].
50
APPENDIX A
GANTT CHART
Week
No Task
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 Meeting with supervisor and discuss about the project
2 Build an algorithm using MATLAB for identification system
3 Design MATLAB GUI
4 Build an application from MATLAB GUI
5 Writing report
6 Submit the report to supervisor
7 Make a correction to the report
8 Send final report to panel
9 Presentation
1. APPEN
51
APPENDIX B
Weight and Bias of the Identification System
for i=1:2000,
y = Data(:,i);
a=length(y);
y1=[y zeros(1,500-a)]/max(y);
[ca,cd] = dwt(y1,'db1','mode','sym');
[ca2,cd2] = dwt(ca,'db1','mode','sym');
[ca3,cd3] = dwt(ca2,'db1','mode','sym');
[ca4,cd4] = dwt(ca3,'db1','mode','sym');
[ca5,cd5] = dwt(ca4,'db1','mode','sym');
[ca6,cd6] = dwt(ca5,'db1','mode','sym');
[ca7,cd7] = dwt(ca6,'db1','mode','sym');
[ca8,cd8] = dwt(ca7,'db1','mode','sym');
[ca9,cd9] = dwt(ca8,'db1','mode','sym');
[ca10,cd10] = dwt(ca9,'db1','mode','sym');
SampleData1(:,i)=ca;
SampleData2(:,i)=ca2;
SampleData3(:,i)=ca3;
SampleData4(:,i)=ca4;
SampleData5(:,i)=ca5;
SampleData6(:,i)=ca6;
SampleData7(:,i)=ca7;
SampleData8(:,i)=ca8;
SampleData9(:,i)=ca9;
SampleData10(:,i)=ca10;
end
59
APPENDIX C
clear;
clc;
data=importdata('wavelet_result');
inputs = 1;
targets = 2;
nprtool
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = prog_Gui_Final_OutputFcn(hObject, eventdata,
handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[ca,cd] = dwt(y1,'db1','mode','sym');
[ca2,cd2] = dwt(ca,'db1','mode','sym');
[ca3,cd3] = dwt(ca2,'db1','mode','sym');
data=[ca3'];
figure(1)
subplot(211),plot(y),title('ECG SIGNAL'), xlabel('Sampling'),
ylabel('Amplitude (v)');
grid on
subplot(212),plot(data), title('Feature wavelet'),
xlabel('Sampling'), ylabel('Amplitude (v)');;
grid on