Upload
chilads1003099
View
246
Download
3
Embed Size (px)
Citation preview
DeclarationI hereby declare that this project report titled “ECG INTELLIGENT DECISION
MAKER” was executed as per the course requirement for the Bachelor’s Degree of
Technology in The Open University of Sri Lanka. No part of this has been
submitted by me or any other candidate for a Degree or a Diploma in any other
University or institution before. It is my own work.
Date: 26/07/2011
i
AbstractAn Electrocardiogram is a bioelectric signal which record heart electrical activity
versus time. It is an important diagnostic tool for heart functioning. The
interpretation of ECG signal is an application of pattern recognition. The technique
used in this pattern recognition comprises: signal pre-processing, feature extraction,
neural network for classification.
This project consists with two parts because this is a group project.
The first part is an acquisition of ECG data from patients & record these data in the
application develop by C#.net & SQL Server. It does develop by My Colleague.
Second Part is Analysis the ECG record & gets the diagnosis result from trained
ANN. This report describes about the second part.
In this project wavelet transform and neural network toolbox are used from Matlab
environment. The processed signal is used from PhysioNet’s databases which were
developed for research in cardio electrophysiology.
An automated system for arrhythmia classification is developed. The system can
classify 3 different types of arrhythmia with an accuracy of 99.08%. These are
normal sinus rhythm, Right bundle branch block, left bundle branch block. Before
testing, the proposed structures are trained by back propagation algorithm. The
processed signal is used from MIT- Arrhythmia Database which is available in
PhysioNet’s database.
This part interconnects with main application & SQL server Database.
ii
Acknowledgments I would like to express my gratitude towards all the people who have contributed
their precious time and effort to help me. Without whom it would not have been
possible for me to understand and complete the project.
I would like to thank our Project Supervisor Eng. G.Anthonys, for him guidance,
support, motivation and encouragement throughout the period this work was carried
out. Him readiness for consultation at all times, him educative comments, him
concern and assistance even with practical things have been invaluable.
Last but not least, my utmost gratitude towards my family and loved ones for their
continuous support and encouragement.
Thank you all !!
iii
Table of ContentsDeclaration...................................................................................................................i
Abstract.......................................................................................................................ii
Acknowledgments.....................................................................................................iii
Table of Contents......................................................................................................iv
List of Figures...........................................................................................................vii
Chapter 1 Introduction..............................................................................................1
1.1 Project Background 1
1.2 Problem Statement 1
1.3 Project Aim and Objectives 2
Aim.......................................................................................................................2
Objectives.............................................................................................................2
1.4 Project Description 3
1.5 Organization of the Report 4
Chapter 2 - Project Literature Survey.....................................................................5
2.1 Review of Theory 5
2.1.1 ECG Signal & Characteristics.....................................................................5
2.1.2 Heart problems in this project......................................................................6
2.2 Review of Literature survey 8
2.2.1 Feature Extraction Methods.........................................................................9
2.2.2 Extraction Features to train ANN..............................................................12
Chapter 3 - Detail Design.........................................................................................14
3.1 Data Acquisition 14
3.1.1 Data Base...................................................................................................14
3.1.2 Signal Extraction........................................................................................14
3.2 Signal Pre-processing 15
3.2.1 Removal of the baseline drifts...................................................................15
3.2.2 Noise Filtering...........................................................................................16
3.3 Feature Extraction 17
3.3.1 Time Domain Features..........................................................................................17
3.3.2 Frequency Domain Features..................................................................................20
3.3.3 Feature Extraction Algorithm................................................................................21
iv
3.4 Build & Train the Neural Network 23
3.4.2 Train the network...................................................................................................26
3.4.3 Test the Neural Network........................................................................................26
Chapter 4 - Testing & Implementation..................................................................27
4.1 Toolboxes use to implement 27
4.2 Implementation Flow 27
4.2.1 Data Acquisition....................................................................................................27
4.2.2 Signal Pre-processing............................................................................................29
4.2.3 Feature Extraction 30
4.2.4 Train NN................................................................................................................31
4.2.5 Testing with real time data....................................................................................32
Chapter 5 - Results & Discussion............................................................................33
5.1 Results 33
5.1.1 Phase one – Training, Testing, Validation for pre-recorded data..........................33
5.1.2 Phase two – Testing Real Time Data..............................................................35
5.2 Specificity and Sensitivity 35
5.3 Discussions 36
5.3.1 Review of Theory & Approach.............................................................................36
5.3.2 Interpretation of Result..........................................................................................37
List of FiguresFigure 1.1-Overall project scope chart.........................................................................3
v
Figure 2.1-Charcteristics of ECG.................................................................................5Figure 3.1-Flow Diagram of the system.....................................................................14Figure 3.2-MIT-BIH Database...................................................................................14Figure 3.3-The MIT-BIH Arrhythmia Database Records..........................................15Figure 3.4-Algorithm for Base line drift....................................................................16Figure 3.5-Algorithm for Noise removing.................................................................17Figure 3.6-Samples of Beat........................................................................................20Figure 3.7-Feature Extraction Algorithm...................................................................23Figure 3.8-Flow Diagram of ANN.............................................................................24Figure 4.1-ECG Prerecorded Data.............................................................................29Figure 4.2-DW Toolbox use for Denoise...................................................................31Figure 4.3-Matlab GUI feature Extraction.................................................................31Figure 4.4-Beat Samples a) Normal ,b) LBBB ,c) RBBB.........................................33Figure 4.5-Train ANN................................................................................................33Figure 4.6-Real time ECG Diagnosis GUI.................................................................33Figure 5.1-Performance of ANN................................................................................34Figure 5.2-Training State of ANN.............................................................................35Figure 5.3-Confusion matrix of ANN........................................................................35Figure 5.4-Specificity & Sensitivity of ANN.............................................................37
List of Tables
vi
Table 2.1-Duration values & intervals for normal arrhythmia.....................................6Table 2.2-Comparison of Different Feature Extraction Techniques..........................12Table 3.1-ECG Wave Time Domain Feature Extraction...........................................18Table 3.2-Input Neurons of the ANN.........................................................................22Table 3.3-The output target vector of ANN...............................................................23Table 4.1-Use Toolboxes...........................................................................................25Table 4.2-ECG Records from MIT/BIH....................................................................26Table 4.3-Functions of Main Matlab GUI.................................................................29Table 5.1-Performance comparison of proposed Multi-ANN classifier....................35
List of Abbreviation
vii
ANN - Artificial Neural Network
BP - Back Propagation
DWT - Discreet Wavelet
ECG - Electro Cardio Graph
FNN - Fuzzy Neural Network
GUI - Graphical User Interface
LBBB - Left Bundle Branch Block
LVD - Left Ventricular Dimension
LVQ - Learning Vector Quantization
ML - Multi Layer
MLP - Multi Layer Perception
NN - Neural Network
NSR - Normal Sinus Rhythm
PB - Paced Beat
PCA - Principal Component Analysis
RBBB - Right Bundle Branch Block
SOM - Self Organizing Map
SVW - Slope Vector Waveform
viii
ix
ECG Intelligent Decision Maker
Chapter 1 - Introduction
1.1 Project Background
This project is a group project with two main parts. First part includes ECG gaining
hardware. It can get the ECG signal from the patient & analyze the signal. This part
has application develop by SQL SERVER & C#.net. Second part includes Intelligent
ECG analyzing system. This part consists with Signal processing techniques and
artificial neural network (ANN).In this part ANN train first using online databases.
After test the ANN using real time data get from the ECG hardware.
Our overall system will be used to implement a real time processing, intelligent, cost
effective, and easy-to-use ECG diagnostic system. It also gives suggestion to improve
the experiments and use of remote diagnostic medical systems for diagnosing at
homes in the future.
1.2 Problem Statement
Technological innovation has progressed at such an accelerated pace that it is has
permeated almost every facet of our lives. This is especially true in the field medicine
and delivery of health care services. As a result, AI technologies attached to the
biomedical experiments with better investing of more advanced technologies for best
monitoring of patient.
In Sri Lanka, cardiac disorders are common among the people but technology has not
improved with cardiac signal diagnosis technologies. Still Bioinformatics’
technologies and AI are rarely used for ECG signal diagnosis.
So Personnel Intelligent ECG Analyzing System is timely required with computerized
world to quick and accurate predictions which could be help to cardiologist to prevent
death amount by cardiac problems. This project idea is for making ECG Advisor
Intelligent software by using Signal Processing, Feature extraction, Neural
Networking, fuzzy logic and DB management technologies.
1
ECG Intelligent Decision Maker
1.3 Project Aim and Objectives
Aim
The aim of this overall project is to create ECG Signal analyzing system for diagnosis
decision making regarding to their health state without involving a doctor.
Objectives
Implementation a suitable method for the ECG features extraction.
Analyzing suitable features for improving the performance of diagnosis.
Build the best c architecture for the ECG signal classification.
2
ECG Intelligent Decision Maker
1.4 Project Description
The overall project has two main parts. Real time ECG Acquisition & Diagnosis the wave in
intelligently. Figure 1.1 shows the overall project scope.
Figure 1.1-Overall project scope chart
3
ECG Intelligent Decision Maker
1.5 Organization of the Report
In the second chapter I construe the basic principles of electrocardiogram
(ECG) which includes ECG Signal & Characteristics, Heart problems in this
project, literature survey of Feature Extraction Methods & researches done.
In the third chapter we discuss the detail design of the project.
The fourth chapter deals with implementation & testing of the design
In the last chapter I discuss the Results of the implementation & discussion,
conclusion and future works of the project.
4
ECG Intelligent Decision Maker
Chapter 2 - Project Literature Survey
2.1 Review of Theory
2.1.1 ECG Signal & Characteristics
Understanding the Electrocardiography and its characteristics is one of the most
important aspects during the development of this project. Electrocardiography or ECG
in short, is the most commonly used and direct method for assessing abnormalities of
cardiac rhythm. As shown in Figure 1 below, ECG tracing of the cardiac cycle
typically consists of a P wave, a QRS complex, and a T wave .
Figure 2.2-Charcteristics of ECG
ECG provides us with two types of information. First is the duration of electrical
wave crossing the heart, which is measured by measuring the time intervals on the
ECG. This will determined the regularity of the electrical activity, if it is normal,
slow, fast or irregular. Second is the amount of the electrical activity passing through
the heart muscle and is represented by the principal components (peaks and valleys)
of the ECG. Arrhythmia usually can be analyzed based on the change of the rhythm or
frequencies of the heartbeat. The normal values for duration of ECG waves and
intervals in adults were presented in the Table 2.1.
5
ECG Intelligent Decision Maker
Table 2.1-Duration values & intervals for normal arrhythmia
ECG Wave
Type
Description Time and
Amplitudes
P wave During normal atrial depolarization, the main
electrical vector is directed from the SA node
towards the AV node, and spreads from the right
atrium to the left atrium. This turns into the P wave
on the ECG.
0.25mV
0.08S
QRS
complex
The QRS complex is a recording of a single
heartbeat on the ECG that corresponds to the
depolarization of the right and left ventricles.
1.60mV
0.08S- 0.12S
PR interval The PR interval is measured from the beginning of
the P wave to the beginning of the QRS complex.
0. 12S to 0.2S
ST segment The ST segment connects the QRS complex and the
T wave.
0.08S to 0.12S
ST interval This represent the duration of J point to T on set 0.32S
T wave The T wave represents the repolarization (or
recovery) of the ventricles.
0.1mV to 0.5mV
0.16S
Q wave 0.4mV
QT interval The QT interval is measured from the beginning of
the QRS complex to the end of the T wave.
0.3S to 0.43S.
2.1.2 Heart problems in this project
Changes from the normal morphology of the electrocardiogram can be used to
diagnose many different types of arrhythmia or conduction problems. The
electrocardiogram can be split into different segments and intervals, which relate
directly to phases of cardiac conduction; limits can be set on these to diagnose
6
ECG Intelligent Decision Maker
abnormality. The physician normally uses the ECG and other factors to determine the
gross condition of the heart.
There are a lot of heart problems, which can be diagnosed from different ECG
waveforms. This project aims at classifying 5 different ECG waveforms from the
database. They are:
Normal (N)
Paced beats (P)
Right bundle branch block (R)
Left bundle branch block (L)
Fusion of paced (F)
They are explain as follows,
Paced beats
This is the artificial beat from the device called pacemaker. A pacemaker is a
treatment for dangerously slow heart beats. Without treatment, a slow heart beat can
lead to weakness, confusion, dizziness, fainting, shortness of breath and death. Slow
heart beats can be the result of metabolic abnormalities or occur as a result of blocked
arteries to the heart's conduction system. These conditions can often be treated and a
normal heart beat will resume. Slow heart beats can also be a side effect of certain
medications in which case discontinuation of the medicine or a reduction in dose may
correct the problem.
Right bundle branch block
Right bundle branch block (RBBB) can be suggested by the following ECG
characters:
1) The QRS duration between 0.10 and 0.11sec (Incomplete RBBB) or 0.12sec.or
more (complete RBBB);
2) Prolonged ventricular activation time or QR interval (0.03sec. or more in V1-V2);
3) Right axis deviation.
Incomplete RBBB often produce patterns similar to those of right ventricular
hypertrophy. The ECG pattern of RBBB is frequently associated with ischemic,
7
ECG Intelligent Decision Maker
hypertensive, rheumatic and pulmonary heart disease, right ventricular hypertrophy
and some drug intoxication; occasionally it may be found in healthy individuals.
Left bundle branch block
1. The heart rhythm must be supraventricular in origin
2. The QRS duration must be = or > 120 ms
3. There should be a QS or rS complex in lead V1
4. There should be a RsR' wave in lead V6.
Fusion of paced and normal beats
Ventricular fusions beats occur when impulses from an ectopic ventricular focus and
supraventricular pacemaker simultaneously activate the ventricular pacemaker
simultaneously activate the ventricules; the resulting QRS complex is of shorter
duration as compared to those of ventricular origin. Ventricular tachycardia is caused
by rapid and regular discharge in an ectopic focus in any portion of the ventricular
myocardium. Consequently, the ECG shows the following characteristic features:
1. A heart rate between 140 and 200 per minute; occasionally the rate may be
slightly slower or faster;
2. Wide and bizarre QRS complexes;
3. Regular or slightly irregular RR intervals;
4. P waves of sinus or atrial origin occurring at a slower rate (60-14);
5. A P wave bears no fixed relationship to the QRS complex.
Ventricular tachycardia has a premature onset and its termination is followed by a
pause. When the rate is below 150 per minute, the tracing may show ventricular
capture beats or ventricular fusion beats characterized by a narrow QRS complex.
2.2 Review of Literature survey
When I do the literature survey of this project, I found the most critical point is
Feature extraction. Therefore mainly my attention has goes to the Literature Survey of
feature Extraction Methodologies and most suitable features of the train ANN.
8
ECG Intelligent Decision Maker
2.2.1 Feature Extraction Methods
The proposed schemes were mostly based on Fuzzy Logic Methods, Artificial Neural
Networks (ANN), Genetic Algorithm (GA), Support Vector Machines (SVM), and
other Signal Analysis techniques. All these techniques and algorithms have their
advantages and limitations. This chapter discusses various techniques and
transformations proposed earlier in literature for extracting feature from an ECG
signal. In this chapter also provides a comparative study of various methods proposed
by researchers in extracting the feature from ECG signal.
Feature extraction methods literature
Author: Zhao et al. [1]
Techniques: Wavelet transform, Support vector machines
Method: The wavelet transform is used to extract the coefficients of the transform as
the features of each ECG segment. Concurrently, autoregressive modeling (AR) is
also applied to get hold of the temporal structures of ECG waveforms. Then at last the
support vector machine (SVM) with Gaussian kernel is used to classify different ECG
heart rhythm.
Accuracy: 99.68%.
Author: Mahmoodabadi et al. [2]
Techniques: Daubechies Wavelets transform.
Method: De-noise the ECG signal by removing the equivalent wavelet coefficients at
higher scales. Then, QRS complexes are detected and each one complex is used to
trace the peaks of the individual waves, including onsets and offsets of the P and T
waves which are present in one cardiac cycle
Accuracy: Sensitivity -99.18%
Positive predictivity -98%.
Author: Tadejko and Rakowski [3]
Techniques: SOM
LVQ
9
ECG Intelligent Decision Maker
Method: The obtained feature sets were based on ECG morphology and RR-intervals.
The mathematical morphology filtering is used for the preprocessing of ECG signal.
In addition their work compares two strategies for classification of annotated QRS
complexes.
Author: Tayel and Bouridy [4]
Techniques: Wavelet transformation
Neural networks
Method: Features are extracted from wavelet decomposition of the ECG images
intensity. The obtained ECG features are then further processed using artificial neural
networks. The features are: mean, median, maximum, minimum, range, standard
deviation, variance, and mean absolute deviation. The introduced ANN was trained by
the main features of the 63 ECG images of different diseases.
Accuracy: 92%.
Author: Xu et al. [5]
Techniques: SVW
Method: variable stage differentiation is used to achieve the desired slope vectors for
feature extraction, and the non-linear amplification is used to get better of the signal-
to-noise ratio. The method allows for a fast and accurate search of the R location,
QRS complex duration, and RR interval and yields excellent ECG feature extraction
results.
Author: Alexakis et al. [6]
Techniques: ANN
LDA
Method: Five ECG features namely RR, RTc, T wave amplitude, T wave skewness,
and T wave kurtosis were used in their method. These features are obtained with the
assistance of automatic algorithms. The onset and end of the T wave were detected
using the tangent method. The three feature combinations used had very analogous
performance when considering the average performance metrics.
10
ECG Intelligent Decision Maker
Author: Saxena et al. [7]
Techniques: Quadratic spline wavelet (QSWT)
Daubechies six coefficient (DU6)
Method: Two wavelets have been used, Quadratic spline wavelet (QSWT) for QRS
detection and the Daubechies six coefficient (DU6) wavelet for P and T detection. A
procedure has been evolved using electrocardiogram parameters with a point scoring
system for diagnosis of various cardiac diseases. The consistency and reliability of the
identified and measured parameters were confirmed when both the diagnostic criteria
gave the same results.
Author: Jen et al. in [8]
Techniques: Cepstrum coefficient method
ANN
Method: One can identify the characteristics hiding inside an ECG signal and then
classify the signal as well as diagnose the abnormalities. To explore the performance
of the proposed method various types of ECG data from the MIT/BIH database were
used for verification.
Accuracy: 97.5%.
Author: Ramli and Ahmad in [9]
Techniques: Correlation analysis
Method: Their proposed work investigated the technique to extract the important
features from the 12 lead system (electrocardiogram) ECG signals. They chose II for
their entire analysis due to its representative characteristics for identifying the
common heart diseases. The analysis technique chosen is the cross-correlation
analysis. Cross-correlation analysis measures the similarity between the two signals
and extracts the information present in the signals. Their test results suggested that the
proposed technique could effectively extract features, which differentiate between the
types of heart diseases analyzed and also for normal heart signal.
11
ECG Intelligent Decision Maker
2.2.2 Comparison of Different Feature Extraction Techniques
Below table 2.2 shows the comparison of the different feature extraction techniques
from an ECG Signal.
Table 2.2-Comparison of Different Feature Extraction Techniques
Approach Simplicity Accuracy Predictivity
Zhao et al. H H H
MahmoodabadiM H H
et al.
Tadejko andL M M
Rakowski
Tayel andM M H
Bouridy
Jen et al.
H H H
Alexakis et al.
H M M
Ramli andM M M
Ahmad
Xu et al.M H H
H- High, L-Low, M-Medium
2.2.2 Extraction Features to train ANN
The main objective of the feature extraction process is to derive a set of parameters
that could best characterize the signal. These parameters, in other words, should
12
ECG Intelligent Decision Maker
contain maximum information about the signal. Hence the selection of these
parameters is an important criterion to be considered for proper classification.
Arrhythmia classification, therefore, involves determination of several characteristic
features of the ECG signal.
In my literature survey I found two categories of features,
Time domain features
The time intervals of the characteristic waves of the ECG signal are used for
calculating a set of time domain parameters.
Frequency domain features
Samples of ECG wave
13
ECG Intelligent Decision Maker
Chapter 3 - Detail Design The algorithm proposed in this project is designed towards detecting of arrhythmia
based on ANN that has been build from ECG wave sample detection & fiducial point
detection, with the prerecorded and Real time ECG datasets. The algorithm applied is
mainly based on the theory and observation made on similarities of ECG wave-shapes
& ECG features that are presented in the same cardiovascular diseases. The flow of
the system & model of this algorithm is presented in Figure 3.1, and Figure 3.2.
Figure 3.3-Flow Diagram of the system
Figure 3.4-Decsion Maker algorithm
14
Data Acquisition
Signal Pre-
processing
Feature
Extraction
Build & Train
Neural Network
Test Neural Netwo
rk
ECG Intelligent Decision Maker
3.1 Data Acquisition
3.1.1 Data Base
I selected the MIT-BIH database to base my work on because it is available online
where the ECG files are easily accessible and because many important works in the
literature have based their work on this database and have reported their results and
findings in published and widely acknowledged papers.
Figure 3.5-MIT- BIH Database
3.1.2 Signal Extraction
As can be seen in Figure 3.2, the MIT-BIH Arrhythmia Database provides three set of
files to be downloaded for each record. The .dat files are binary signal files and
contain the actual data like the number of sample and the amplitude of the signal at
that sample point. The .hea files are short text “header” files used to determine the
location and format of the signal files by the software that reads them. Finally, the .atr
files are binary files containing annotations or labels pointing to specific locations
within the signals it is clearly stated at the PhysioBank that simply saving
the .dat, .hea, and .atr of each record would not enable the user to view the signals and
process them further.
15
ECG Intelligent Decision Maker
Figure 3.6-The MIT-BIH Arrhythmia Database Records
3.2 Signal Pre-processing
ECG signal mainly contains noises of different types, namely frequency interference,
baseline drift, electrode contact noise, polarization noise, muscle noise, the internal
amplifier noise and motor artifacts. Artifacts are the noise induced to ECG signals
that result from movements of electrodes. One of the common problems in ECG
signal processing is baseline wander removal and noise suppression.
3.2.1 Removal of the baseline drifts
Baseline wandering is one of the noise artifacts that affect ECG signals. Removal of
baseline wander is therefore required in the analysis of the ECG signal to minimize
the changes in beat morphology with no physiological counterpart. Respiration and
electrode impedance changes due to perspiration are important sources of baseline
wander in most types of ECG recordings. The frequency content of the baseline
wander is usually in a range well below 0.5Hz. This baseline drift can be eliminated
without changing or disturbing the characteristics of the waveform.
16
Load Signal .mat (S1)
Smooth signal (S2)
Out signal= (S1) - (S2)
Out signal
1
ECG Intelligent Decision Maker
Figure 3.7-Algorithm for Base line drift
3.2.2 Noise Filtering
After removing baseline wander, the resulting ECG signal is more stationary and
explicit than the original signal. However, some other types of noise might still affect
feature extraction of the ECG signal. In order to reduce the noise many techniques are
available like Digital filters, Adaptive method and Wavelet Transform thresholding
methods. Digital filters and Adaptive methods can be applied to signal whose
statistical characteristics are stationary in many cases. However, for nonstationary
signals it is not adequate to use Digital filters or Adaptive method because of loss of
information. To remove the noise, we use Discrete Wavelet transform.
17
1
Wavelet decomposition at level 8
Extract the coefficients
Default values for de-noising in Wavelet
Signal obtained by wavelet coefficients thresholding using global positive threshold
ECG Intelligent Decision Maker
Figure 3.8-Algorithm for Noise removing
3.3 Feature Extraction
ECG Feature Extraction plays a significant role in diagnosing most of the cardiac
diseases. One cardiac cycle in an ECG signal consists of the P-QRS-T waves. This
feature extraction scheme determines the amplitudes and intervals in the ECG signal
for subsequent analysis. The amplitudes and intervals value of P-QRS-T segment
determines the functioning of heart of every human. In feature extraction I used Time
Domain features & Frequency Domain features.
3.3.1 Time Domain Features
According to the literature survey of this project, I identify 12 main features to
extraction from the ECG wave. Also analyze the suitable methods to identify these
features. Below table summarize the Feature, Method use to extract value & graphical
view of the feature.
18
ECG Intelligent Decision Maker
Table 3.3 -ECG Wave Time Domain Feature Extraction
Feature name Method View
R peak amplitude The R-peak detection was
carried out by using the Pan,
Tompkins method of R peak
detection. The method uses
the threshold level to
calculate the maximum
amplitude in the ECG
waveform.fig(1)
Heart Beat Rate By taking the difference in
time between consecutive R-
peaks.Fig(2)
Q wave amplitude After detecting R-peak,
knowing the QRS complex
duration to be 60ms, points Q
was estimated as the first
inflection point to the left of
R-peak.
Fig(1)
T wave amplitude T-peak was estimated to
between R-peak+400ms to J-
point+80ms
Fig(2)
P wave amplitude P-point was estimated to be
the first inflection point after
K-point on the P-peak side
Fig(2)
T wave Duration Toffset-Tonset
Fig(3)
19
ECG Intelligent Decision Maker
QRS Duration Point S was estimated as the
first inflection point to the
right of R-peak.
Fig(3)
ST Duration T offset- S onset
Fig(4)
PR Duration R offset-P onset Fig(4)
P Wave Duration P offset-P onset Fig(4)
Cycle duration T offset-P onset Fig(4)
Auto Correlation
Coefficient
Getting two points with
adjacent to each other till the
end point.
Correlation Cofficient=∑ ( x−x )( y− y )
√∑ ( x−x )2∑ ( y− y )2
20
fid_index – [X] fid_index + [Y]
ECG signal divided into windows with length of one cardiac cycle
A simulation representation of all the cardiac cycle segmented overlapping one another
begin_pt end_ptfid_index
ECG Intelligent Decision Maker
3.3.2 Frequency Domain Features
In feature extraction of the ECG, I used No. of samples in the each cardiac cycle in
given time period. In this method I extract the 252 samples per each cardiac cycle.
Figure 3.9-Samples of Beat
First detect the R points of the full wave after that remove the first & last beats
according to R points. Remain signal cut the samples per + 0.35, R,-0.35.It gives the
number of samples of each time period.
3.3.3 Feature Extraction Algorithm
21
ECG Intelligent Decision Maker
22
ECG Intelligent Decision Maker
23
ECG Intelligent Decision Maker
Figure 3.10-Feature Extraction Algorithm
3.4 Build & Train the Neural Network
In this stage I use the ANN to classify the data, the ANN train to Identify Normal,
Abnormal, RBBB, LBBB & Paced beat.
3.4.1 Build ANN
24
ECG Intelligent Decision Maker
To build ANN I follow the below design steps,
Figure 3.11-Flow Diagram of ANN
Assemble the training data
In order to diagnose heart conditions using neural network technique, the most
common ECG waveforms were selected from the MIT/BIH database. The selected
ECG waveform which will be used in this project are divided into four categories,
namely
Normal (N)
Abnormal(AN)
Right bundle branch block (R)
Left bundle branch block (L)
Twenty two different patients, who have been considered in the experiments (taken
from
MITBIH),100,101,103,105,106,109,111,113,115,116,118,119,122,123,124,200,203,2
07,208,212,214,215.
Design the Neural Network Architecture
A 264-element input vector is defined as a matrix of input vectors for one sample to
compare the neural network performance. The input vector is defined for each
heartbeat and the corresponding element in the target vector is also defined with a
combination of 1s or 0s to represent each of the class. Output vectors include 5-
vectors. The network is required to classify 5 heart conditions by responding with this
output vector. Each output vector represents one of 5 classes.
Input Layer
Input payer include 264 neurons, like as below,
25
Assemble the
training data
Create the architecture of Neural Network
Train the network
Simulate the network response to new inputs
ECG Intelligent Decision Maker
Table 3.4-Input Neurons of the ANN
Feature Type Source Description
1 Morphological features P,T waves Cycle Duration
2 Morphological features P, R waves P-R interval
3 Morphological features QRS complex QRS Duration
4 Morphological features R waves R amplitude
5 Morphological features R waves HBR
6 Morphological features P wave P wave Amplitude
7 Morphological features T wave T wave Amplitude
8 Morphological features Q wave Q wave Amplitude
9 Morphological features S-T waves S-T Interval
10 Morphological features T wave T wave Duration
11 Morphological features P wave P wave Duration
12 Statistical features Correlation
Coefficient
Auto Correlation
Coefficient
13-264 Statistical features Number of samples Number of samples
on the ECG beat of
the given time period
26
ECG Intelligent Decision Maker
Output Layer
Target vectors of the NN shown in the Table 3.3,
Table 3.5-The output target vector of ANN
Signal Vector Heat condition
N [1 0 0 ] Normal
AN [0 1 0] Abnormal
L [0 0 1] Left bundle branch block
R [0 1 0 ] Right bundle branch block
3.4.2 Train the network
The Levenberg-Marquardt backpropagation was used to train the multi-layer
feedforward backpropagation networks. The training data sets were selected from the
most common ECG waveforms. Five classes with 100 time episodes in each were
selected to train the networks.
Training algorithm
The Levenberg-Marquardt backpropagation was used to train the multi-layer
feedforward backpropagation networks. It is very fast but requires a lot of memory to
run. For each epoch, if the network performance decreases toward the goal, the
learning rate is increased. If the performance increases, the learning rate is then
adjusted and the change, which increased the performance, is not made.
3.4.3 Test the Neural Network
To test the neural network I use 15% data of the overall Data selection in MIT/BIH
data base & real time data acquisition from ECG hardware.
27
ECG Intelligent Decision Maker
Chapter 4 - Testing & ImplementationIn this chapter represent the implementation of my design, discussed in the previous
chapter. Also describes how I test implementation using data & tools.
4.1 Toolboxes use to implement
Table 4.6-Use Toolboxes
Toolbox Name Purpose
MIT/BIH Arrhythmia Database To data acquisition
Matlab Wavelet Toolbox To DWT DB4 wavelet of ECG wave.
Matlab Guide Create GUI
Matlab Data base Toolbox To connect with Microsoft SQL server
and for execute the Queries of SELECT
and UPDATE
4.2 Implementation Flow
4.2.1 Data Acquisition
Step 01: Download each signal from MIT/BIH Arrhythmia database.
I downloaded 21 signals from mit/bih aryythmia database. Signal duration is 30
minutes. Segmented each signal in to 10s periods.
28
ECG Intelligent Decision Maker
Figure 4.12-ECG Prerecorded Data
Step 02: Analyze annotations
Analyze the annotation of the every 10s segment & list them like as below,
Table 4.7-Analyze Annotations
Using above list, I have limited the number of patients, taking part in the experiments,
to provide at least different arrhythmia cases (N, R and L).
Table 4.8-ECG Records from MIT/BIH
Records Normal RBBB LBBB
Patient 100 62 0 0
Patient 101 5 0 0
Patient 103 58 0 0
Patient 105 10 0 0
Patient 106 27 0 0
Patient 109 0 0 104
Patient 111 0 0 41
Patient 113 6 0 0
29
ECG Intelligent Decision Maker
Patient 115 10 0 0
Patient 116 45 0 0
Patient 118 0 12 0
Patient 119 50 0 0
Patient 122 5 0 0
Patient 123 5 0 0
Patient 124 0 33 0
Patient 200 0 0 0
Patient 203 0 0 0
Patient 207 0 0 40
Patient 208 0 0 0
Patient 212 5 26 0
Patient 214 0 0 50
Patient 215 103 0 0
391 71 235
4.2.2 Signal Pre-processing
Step 03: Discrete wavelet Analysis
After download ECG file in .mat format, start the preprocessing stage. In
preprocessing stage use the Wavelet toolbox .Load the data choose the wavelet type
db-4,level 8.It has given the signal like as below,
30
ECG Intelligent Decision Maker
Figure
4.13-DW Toolbox use for Denoise
4.2.3 Feature Extraction
To extract features I develop the Matlab GUI, using algorithm previous chapter
described.
a). Extract Time –Domain Features
Figure 4.14-Matlab GUI feature Extraction
The extraction features save to the excel sheet.
Functions
Table 4.9-Functions of Main Matlab GUI
31
ECG Intelligent Decision Maker
Function Description
Load Data Load the .mat data we need to extract feature values.
Analysis Identify peaks, & extract features
Save Save features to the excel sheet.
b).Extract Frequency Domain Feature
I get the samples in each wave using the frequency, samples in the three diagnoses
shown in Figure 4.4,
(a) (b)
(c)
Figure 4.15-Beat Samples a) Normal , b) LBBB , c) RBBB
32
ECG Intelligent Decision Maker
4.2.4 Train NN
To train ANN I used 2136 samples to both ANN. Here is the training stage result,
Hidden layer has 20 neurons.
Figure 4.16-Train ANN
4.2.5 Testing with real time data
In finally I have to interconnect my trained NN with ECG Advisor front end
application. Acquisition of the real time ECG wave from patient & give the Diagnoses
the result to the SQL Database. In Figure shows GUI, that’s connect with front end
application,
Figure 4.17-Real time ECG Diagnosis GUI
33
ECG Intelligent Decision Maker
Chapter 5 - Results & Discussion
5.1 Results
5.1.1 Phase one – Training, Testing, Validation for pre-recorded data
In this stage I trained ANN using several data sets in below,
Samples data set
Time Domain Data set
Time Domain + Samples data set
From above data sets I got the maximum result in Time Domain + Samples data set.
34
ECG Intelligent Decision Maker
Figure 5.18-Performance of ANN
Figure 5.19-Training State of ANN
Figure 5.20-Confusion matrix of ANN
35
ECG Intelligent Decision Maker
5.1.2 Phase two – Testing Real Time Data
When I test the real time ECG wave, I have to vary sampling frequency according to
the wave sampling ratio, & wave taken time.
Table 5.10-Testing accuracy of real time data
5.2 Specificity and Sensitivity
Specificity refers to the measurement of the proportion of negatives, which have been
detected. Sensitivity, on the other hand, measures the proportion of actual positives
that have been correctly identified.
36
File Name Duration(s) Percentage
Classify (%)
P1 10 100%
P2 11.1 90%
P3 12 93%
P4 10 80%
P5 10.6 94%
Overall
Accuracy
91.4%
ECG Intelligent Decision Maker
Figure 5.21-Specificity & Sensitivity of ANN
5.3 Discussions
Our target was to detect a lot of ECG signals and to recognize ECG arrhythmias. In
this study in which ANN was employed as the basic method accuracy rates were
appeared well than similar studies. Moreover, number of arrhythmias can be increased
in the ECGAnalyzer Software.
Therefore, lots of patients’ ECGs can be investigated and interpreted in a very short
time. This will improve the performance of heart treatment. These studies divided two
major groups, in terms of the data used. Those are MITBIH ECG arrhythmia database
and Real time data. It can easily be observed that our study is more recognized than
other studies using MIT-BIH database. Moreover we used data obtained from patients
together with real time data.
37
ECG Intelligent Decision Maker
5.3.1 Review of Theory & Approach
The approach taken in this project is based on the observation of ECG arrhythmias on
patients with the neural network. To recap, the algorithm applied involved with
feature extraction of the ECG, and build the NN using mean of every fiducially point
on the cycle segmented. NSR, RBBB, LBBB, ECG were tested using trained NN, and
determined the diagnosis result based on the parameters observed, such as the
intervals, fiducial points amplitudes, and Statically features. The testing phase was
divided into two phases testing with pre recoded data and testing with real time data.
5.3.2 Interpretation of Result
In each of the phases, based on the observation of the percentage ANN Training,
Testing & Validation, the results appeared to be better than expected. For most of the
result presented, the percentages are exactly 100% matched, which is slightly higher
than the minimum percentage set in the algorithm (i.e. >70%). The specificity,
sensitivity and accuracy, however, still display reasonably good results. Even though
the specificity and accuracy is lower, especially when compared to results from other
relevant studies/journals) the algorithm is still capable to detect Normal, Abnormal &
several diagnosis in random ECG obtained from the Physionet database & real-time
data , which has been further proven during test result (Table 5.2). By achieving this
result, the target of this project has been achieved.
Table 5.11-Performance comparison of proposed Multi-ANN classifier
Reference
Classifier
Classification Accuracy
(%)
Rajendra et al (2003) ANN and Fuzzy 95.00
Rajendra et al (2004) ANN and Fuzzy 87.00
Obayya et al (2008) Hidden Markov
Models
98.18
38
ECG Intelligent Decision Maker
Kannathal et al (2005) Adaptive Neuro Fuzzy 94.64
Proposed ANN 99.08
5.3.4 Problems Encountered
There are a few concerns relating to the feature extraction algorithm. One of the main
concerns is its capability to detect relative diagnosis in the presence of other
arrhythmia, abnormalities or stresses, within the same ECG. In this project, the main
focus is to be able to detect 4 arrhythmias, and the datasets used were mainly NSR,
RBBB, LBBB and PB ECG annotated. Due to lack of time, and database/resources
accessibility, no test was done for cases other than the above mentioned. Thus it is
unknown if the algorithm would be able to detect correctly or able to differentiate
between different arrhythmia, such as premature atrial contraction or multifocal atrial
tachycardia.
Another issue encountered was related to the detection of the R-peaks. Most of the
ECG datasets used did not present any problems, except for a few cases. In these
cases, based on observation, their R-peaks were generally quite low. The only way to
get them detected is to manually change the threshold values. However, upon testing,
it is quite impossible to modify the values without compromising the results for the
majority of the ECG datasets. Hence, this shows that the thresholds implemented for
the R-peak detection were not adaptive or dynamic enough to accommodate to this
scenario.
Another problem we faced when train the NN, arrhythmias RBBB, LBBB features are
show the close values. Therefore NN performance has gone to low.
5.4 Conclusion & Future work
The purpose of the project was to design an ECG Analyzer that takes human ECG
data, and provides a diagnosis for the state of the heart. The project was composed of
two main components: Feature Extraction and Train ANN.
39
ECG Intelligent Decision Maker
5.4.1 Conclusion
In this report, I have presented an algorithm for ANN diagnosis of ECG extracted
from digitized ECG database consisting of NSR, RBBB and LBBB recordings. The
idea of this algorithm was based on the theory studied that patients with same cardiac
arrhythmias/abnormalities tend to have similarities in their ECG. This observation,
however, was made by factoring out a number of morphological variations such as
variability that could affect the ECG amplitude level.
The results gathered was better than expected, especially with the algorithm’s
sensitivity, whereby more than 80% of the overall results were correctly identified as
positive. Further improvement could be made, however, as mentioned in the previous
chapter, there were issues that are yet to be resolved. The concerning issues are
involved with the algorithm’s incapability of detecting R-peaks that are lower than the
ones tested and found in a typical ECG, as well as the uncertainty of the outcome or
result if other types of arrhythmia were present in the datasets.
However, despite the problems encountered, I would conclude that the project is still
quite a success, since the objective of developing an algorithm to detect arrhythmia
has been achieved.
5.4.2 Recommendation for Future Work
There are few things I would like to recommend for future work. One of the things
will be improving the algorithm to detect more arrhythmias on real-time. The method
applied in this project is mainly focused on few ECG arrhythmias. To be able to do
this we have to extract additional advanced features of ECG.
Another improvement that could be made is to use fuzzy logic to smooth the answer
using beat by beat classification in NN.
40
ECG Intelligent Decision Maker
Reference[1].Zhao.O, and Zhan ,L., (2005),ECG Feature Extraction and Classification Using
Wavelet Transform and Support Vector Machines,International Conference on Neural
Networks and Brain, ICNN&B , vol. 2, pp. 1089-1092, . Available at:
http://www.citeulike.org/user/aau/article/7670446 [Accessed 25April2010].
[2]. Mahmoodabad, S.Z. & Ahmadian, A. & Abolhasani, M.D., (2005). ECG
FEATURE EXTRACTION USING DAUBECHIES WAVELETS, Proceeding of the
Fifth IASTED International Conference VISUALIZATION, IMAGING, AND
IMAGE PROCESSING. Benidorm, Spain, pp. 343-348. Available at:
http://rcstim.tums.ac.ir/papers_preview.aspx?id=45[Accessed 10June2010].
[3]. Tadejko, P.; Rakowski, W., (2007). Mathematical Morphology Based ECG
Feature Extraction for the Purpose of Heartbeat Classification, 6th International
Conference on Computer Information Systems and Industrial Management
Applications, CISIM '07, pp. 322-327, Available at:
http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4400676. [Accessed 22
August 2010].
[4]. Tayel,M.B.a nd El-Bouridy,M.E., 2006. ECG Images Classification Using
Feature Extraction Based On Wavelet Transformation And Neural Network, ICGST,
International Conference on AIML. Available at: http://www.qdocuments.com/ECG-
Images-Classification-Using-Feature-Extraction-Based-On------PDF.html [Accessed
17March2010].
[5]. Xu.X., and Liu .Y., 2003.ECG QRS Complex Detection Using Slope Vector
Waveform (SVW) Algorithm,Proceedings of the 26th Annual International Conference
41
ECG Intelligent Decision Maker
of the IEEE EMBS, pp. 3597-3600. ,Available at:
http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=1404011. [Accessed
25June2010].
[6]. ALEXAKIS, C et al. 2003. Feature extraction and classification of
electrocardiogram (ECG) signals related to hypoglycaemia.,30th Annual Meeting on
Computers in Cardiology Conference, Thessaloniki Chalkidiki, GREECE , SEP 21-
24, 2003 . pp.537-540. Available at: http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?
arnumber=1404011. [Accessed 17 December 2010].
[7]. S. C. Saxena and V. Kumar and S. T Hamde, 2003,Feature extraction from ECG
signals using wavelet transforms for disease diagnostics, International Journal of
Systems Science, U.K, Vol.33(13), PP. 1073-1085.Available at:
http://hdl.handle.net/123456789/184 [Accessed 17 Jan 2011].
[8]. Jen,K.K. and Hwang, Y.R.,2007. ECG Feature Extraction and Classification
Using Cepstrum and Neural Networks, Journal of Medical and Biological
Engineering, vol. 28, no. 1, Available at:
http://jmbe.bme.ncku.edu.tw/index.php/bme/article/view/241/607. [Accessed 20 July
2010].
[9]. Ramli, A.B. & Ahmad, P.A., 2003.,Correlation analysis for abnormal ECG
signal features extraction.,Telecommunication Technology, NCTT, pp.232-237.
Available at: http://ieeexplore.ieee.org/lpdocs/epic03/wrapper.htm?
arnumber=1188342.
42
ECG Intelligent Decision Maker
APPENDIX ATrain ANN
a).Load Data
b).Pre –Process
Correct Base Line
De-noise the signal
A1
ECG Intelligent Decision Maker
c).Detect R-Peaks
d) Cut samples
e) Extract Features
A2
ECG Intelligent Decision Maker
A3