ELECTROCARDIOGRAM COLLECTION, PATTERN RECOGNITION, AND CLASSIFICATION SYSTEM SUPPORTING A MOBILE CARDIOVASCULAR DISEASE DETECTION AID A Thesis in Computer Engineering Submitted in Partial Fulfillment of the Requirements for the.

Download Report

Transcript ELECTROCARDIOGRAM COLLECTION, PATTERN RECOGNITION, AND CLASSIFICATION SYSTEM SUPPORTING A MOBILE CARDIOVASCULAR DISEASE DETECTION AID A Thesis in Computer Engineering Submitted in Partial Fulfillment of the Requirements for the.

ELECTROCARDIOGRAM COLLECTION,
PATTERN RECOGNITION, AND
CLASSIFICATION SYSTEM
SUPPORTING A MOBILE
CARDIOVASCULAR DISEASE
DETECTION AID
A Thesis in Computer Engineering
Submitted in Partial Fulfillment of the
Requirements for the Degree of Master of Science
By Patrick R. DaSilva
COMMITTEE
Dr. Paul Fortier (Advisor)
 Dr. Howard Michel
 Dr. Kristen Sethares
 Dr. Honggang Wang

2
AGENDA

Introduction

Background
 Problem Statement
 Research Questions
Detection
 Classification
 Performance Testing


Research

Organizational
Questions
Development


Implementation

Live System Testing
Conclusion
 Questions

3
INTRODUCTION
4
HEART DISEASE

CDC Division of Vital
Statistics
Heart disease
accounts for 26% of
total deaths in 2007
 Preliminary 2009 data
showed that heart
disease was still the
main cause of death


Patients don’t
understand symptoms


Leads to multiple
hospitalizations


Associate with other
ailments
Costs 34 billion dollars
yearly
Puts a financial strain
on our healthcare
system
5
CURRENT NURSING METHODS
Nurse-led HF clinics
 Home care nursing


Visit frequency varies

Depends on patient physical activity ability
Still require face-face
 Patients don’t remember or understand
instructions
 Visitations not real-time


do not always happen when they are needed
6
SUPPORTED SYSTEM

Focus is to support a mobile patient-centric, selfmonitoring and self-intervention system with a
clinical nursing tool to aid in collaborative patientclinician chronic disease management
7
MOBILE CARDIAC HEART MONITOR
SENSOR SUITE
FSM
Ctrl
Cardiac
Wellness Engine
Synthetic
Sensor
Derivations
Tx
DSP
Temp
A/D Conversion
SPO2
Analog Conditioning
EKG
Memory
Cardiac
Event
Monitor
Rx
Position /
Motion
8
PROBLEM STATEMENT

Focus on the research, development, design,
testing and validation of the electrocardiogram
sensor
RESEARCH QUESTIONS



Is it feasible to autonomously detect and classify EKG
arrhythmias to assist in a medical situational
assessment and health status feedback?
Will the system be able to differentiate a normal
rhythm from an abnormal one?
Will the system be able to perform in or close to realtime?
9
RESEARCH
10
WHAT IS AN EKG?

Recorded electrical activity that represents the
heart’s conduction system
11
HOW IS AN EKG COLLECTED?

Limb Leads


Lead I, Lead II, Lead III
Precordial Leads
V1, V5
 V2, V3, V4, V6


Augmented Limb Leads

aVR, aVL, aVF
12 Lead
5 Lead
3 Lead
12
WHICH CLASSIFICATIONS?
Normal EKG (LII, V1)
Sinus Bradycardia (LII)
Sinus Tachycardia (LII)
Supraventricular Tachycardia (LII, V1)
Slow-Fast Rate
Atrial Fibrillation (LII)
Irregular Rhythm
Atrial Flutter (LII)
First-Degree AV Block (LII)
Type 1 Second-Degree AV Block (LII)
Junctional Rhythm (LII, V1)
Abnormal P Only
Type 2 Second-Degree AV Block (LII)
Third-Degree AV Block (LII)
Bundle Branch Block (V1)
Premature Ventricular Complex (LII, V1)
Abnormal QRS Only
Ventricular Tachycardia (V1)
Ventricular Fibrillation (V1)
Asystole (LII, V1)
Abnormal P and QRS
13
HOW IS AN EKG PERFORMED TODAY?

Stress tests are performed
to monitor the effect of
exercise on the heart
Motion artifacts appear as
various peaks or HF noise
which affect detections
 Artifacts as well as an
increased heart rate
ultimately affect
classifications



Research has been done by
others to eliminate such
noise
Software will assume
patient is at rest
14
WHAT ARE THE PIPS?
R
P
T
Q
PR
Interval
S
Characteristic
Description
P wave
3mm high
0.12 seconds long
upright
QRS complex
g.t. 5mm high
0.06 – 0.12s long
upright
T wave
g.t. 0.5mm high
upright
U wave
upright
PR interval
0.12 – 0.2s long
Atrial rate
60 – 100bpm
Ventricular rate
60 – 100bpm
15
WHAT ARE CURRENT PIP EXTRACTION METHODS?

Pan Tompkins method


Developed in 1985



Non-linear transformation
Jiapu Pan and Willis Tompkins
Detection rule set further
developed by Patrick Hamilton
and EPLimited
Finds QRS complex, but further
filters required to find P and T
waves
Y(n)
EKG
Low Pass
High Pass
d
 
dt
 2
1
32
32

Z(n)
1
16
WHAT ARE CURRENT PIP EXTRACTION METHODS?
(CONT.)

Dyadic Quadratic Spline
Wavelet Transform

Q1

Q2

Q4
Q5
Uses 5 FIR filters running in
parallel

Q3

Focuses on time frequency
analysis
Separates EKG characteristics
into various scales
A peak’s delayed location is
found when there is a zero
crossing between two local
maxima and minima peaks on
a subset of the filter outputs
Onsets and offsets calculated
based on maxima and minima
onsets and offsets
17
DEVELOPMENT
18
SYSTEM BLOCK DIAGRAM
Filter 1
QRS Detect
Filter 2
ADC
Filter 3
Filter 4
Filter 5
Threshold
Post-Detect
Classify
P/T Detect
19
FILTER DESIGN AND IMPLEMENTATION
𝐺 𝜔
𝑄𝑗 𝜔 = 𝐺 2𝜔 𝐻 𝜔
𝐺 2𝑗 −1 𝜔 𝐻 2𝑗 −2 𝜔 ⋅⋅⋅ 𝐻 𝜔
𝑗=1
𝑗=2
𝑗>2
20
FILTER DESIGN AND IMPLEMENTATION
(CONT.)

Constant 62
millisecond
delay
MIT-BIH Record 100 Filtered
21
DETECTION DESIGN AND IMPLEMENTATION

QRS complex and P/T wave detection schemes
run in parallel

Decided by thresholds

Shared Buffer
Possible QRS peaks stay on the QRS side
 Possible P/T peaks may migrate to the QRS side

QRS Detect
Threshold
Post-Detect
P/T Detect
22
DETECTION THRESHOLDS

Autonomous threshold technique used to find
modulus peaks on filter outputs

4 sets of 2
2 sets for QRS (1,2)
 2 sets for P/T (3,4)

𝑃𝑂𝑆𝑇𝐻𝑅𝑆1 = 𝑚𝑒𝑎𝑛 𝑃𝑂𝑆𝑃𝐸𝐴𝐾𝑆, 4 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹1
𝑃𝑂𝑆𝑇𝐻𝑅𝑆2 = 𝑃𝑂𝑆𝑇𝐻𝑅𝑆1 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹2
𝑃𝑂𝑆𝑇𝐻𝑅𝑆3 = 𝑃𝑂𝑆𝑇𝐻𝑅𝑆2 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹3
𝑃𝑂𝑆𝑇𝐻𝑅𝑆4 = 𝑃𝑂𝑆𝑇𝐻𝑅𝑆3 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹4
𝑁𝐸𝐺𝑇𝐻𝑅𝑆1 = 𝑚𝑒𝑎𝑛 𝑁𝐸𝐺𝑃𝐸𝐴𝐾𝑆, 4 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹1
𝑁𝐸𝐺𝑇𝐻𝑅𝑆2 = 𝑁𝐸𝐺𝑇𝐻𝑅𝑆1 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹2
𝑁𝐸𝐺𝑇𝐻𝑅𝑆3 = 𝑁𝐸𝐺𝑇𝐻𝑅𝑆2 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹3
𝑁𝐸𝐺𝑇𝐻𝑅𝑆4 = 𝑁𝐸𝐺𝑇𝐻𝑅𝑆3 ∗ 𝑇𝐻𝑅𝑆𝐶𝑂𝐸𝐹4
23
QRS DETECTION
Filters Q1, Q2, Q3 to
find QRS
 Three simultaneous
zero crossings
correlate to a QRS
peak
 Filter Q2 is used to
locate the onset and
offset of each QRS

MIT-BIH Record 100 Filtered
24
CALCULATING PULSE RATE

Ventricular heart rate calculated at this point as the mean
of the last 8 heart rates

found by getting the difference between successive R peaks
MIT-BIH Record 100
25
P AND T WAVE DETECTION
Filters Q3, Q4, Q5 to
find P and T waves
 Found peak on Q3
&& Q4 || Q4 && Q5
 Detected as ‘Blip’
wave



MIT-BIH Record 100 Filtered
P,T, or U wave
decided in postdetection
Onset and offset are
calculated similar to
QRS onset and offset
using Q4
26
POST DETECTION
27
DETECTION DELAYS

QRS detection delay: 262ms to 462ms


P/T detection delay: 162ms to 362ms


62 milliseconds
Blanking Window


Lag seen after 165 beats per minute
Filter Delay


Lag seen after 129 beats per minute
200 milliseconds for QRS, 100 milliseconds for P/T
Future Values



200 milliseconds
Finding second modulus peak
Finding offset
28
CLASSIFICATION DESIGN AND IMPLEMENTATION
1. Examine the Rate
2. Examine the
Rhythm
3. Examine the axis,
intervals and
segments
4. Examine
everything else
29
CLASSIFICATION DESIGN AND IMPLEMENTATION
(CONT.)
1. Examine the Rate
2. Examine the
Rhythm
3. Examine the axis,
intervals and
segments
4. Examine
everything else
Classification
NSR
Sinus Bradycardia
Sinus Tachycardia
SVT
Atrial Fibrillation
Atrial Flutter
1st Degree AV Block
2nd Degree Block Type 1 (Wenckebach)
Junctional Escape Rhythm
2nd Degree Block Type 2
3rd Degree Block (Complete Block)
Bundle Branch Block
PVC
Ventricular Tachycardia
Ventricular Fibrillation
Asystole
Abnormality/Rhythm
Sinus Rhythm
Atrial Arrhythmias/Sinus Rhythm
Atrial Arrhythmias/Sinus Rhythm
Atrial Arrhythmias/Supraventricular Rhythm
Atrial Arrhythmias/Supraventricular Rhythm
Atrial Arrhythmias/Supraventricular Rhythm
Conduction Abnormalities
Conduction Abnormalities
Ventricular Arrhythmia/Supraventricular Rhythm
Conduction Abnormalities
Conduction Abnormalities
Conduction Abnormalities
Ventricular Arrhythmias/Ventricular Rhythm
Ventricular Arrhythmias/Ventricular Rhythm
Ventricular Arrhythmias/Ventricular Rhythm
Ex. Sinus Rhythm is present when there is a 1:1 P wave ratio with
all P waves being upright
30
CLASSIFICATION N-ARY TREE
31
CLASSIFICATION DELAY

Overall classification delay is one beat

Takes three normal beats for a normal classification
MIT-BIH Record 16773 (NSR)
32
PERFORMANCE TESTING

Test setup



Test procedure





Resample signals to 250Hz
Start at 20 seconds into signal
Stop at 10 minutes into signal
Count hits and misses
Test result type






MIT-BIH Arrhythmia Database
MIT-BIH Normal Sinus Rhythm Database
Positive Abnormal Classification (PC)
Positive Unknown Classification (PU)
Positive Normal Classification (PN)
Negative or missed Abnormal Classification (NC)
Negative or missed Normal Classification (NU)
Test Metrics

Classification Hit Ratio (%)


((PC+PN)/(PC+PN+NC))*100
Normal Hit Ratio

(PN/(PN+NU))*100
33
PERFORMANCE TESTING RESULTS
Record
100
101
102
103
106
107
108
109
111
124
207
219
222
223
231
16265
16272
16773
PC
1
14
4
3
153
26
2
PU
5
9
378
PN
8
179
NC
2
15
22
36
NU
723
442
130
666
542
680
6
8
1
28
77
736
32
36
344
815
679
476
554
4
5
33
319
311
38
446
536
1
4
673
699
691
548
322
Class %
100
100
99.47
NA
28
100
0
99.03
99.85
94.44
90.18
0.54
13.51
62.11
48.27
NA
NA
NA
Norm %
1.09
28.82
0.00
2.20
3.90
NA
0.00
NA
NA
0.00
0.00
NA
0.00
0.00
NA
31.04
6.48
58.07
34
INVALID NORMAL CLASSIFICATIONS

Classified Normal as Abnormal Sinus Rhythm




Classified Normal as Sinus Tachycardia



(100, 101, 103, 106, 223, 16265, 16272, 16773)
Morphology calculations landed outside of textbook normal
Still found a sinus rhythm, just wider/taller waves
(16265, 16773)
Software was correct after a further look into the signal
Classified Normal as PVC
(219, 223, 16265)
Missed P waves, low ST segments that look like inverted T
waves, same ASR issues
 Still underlying normal heart rate



Classified Normal as Unknown



High frequency noise that carried over to filters (108, 222)
Missed P waves, low ST segments cause inverted T waves
Tall Narrow P waves in close proximity to QRS (222)
35
ABNORMAL CLASSIFICATIONS

PVCs classified as Unknown
Incorrect QRS polarity detection (106,109)
 Missing P waves and underlying sinus rhythm
(109,219)
 Really wide QRS complex (124)
 Triplet PVCs at rate less than 100 BPM (124)


Atrial Fibrillation classified as Unknown


Fibrillatory waves’ amplitude too low to detect atrial
rate (219,222)
Atrial Flutter classified as Unknown

P waves tall, wide, close together cause incorrect P
wave detections (222)
36
FIXING ASR

To fix ASR issue,
slightly modified
textbook normal
morphology



MIT-BIH Record 103 before (top) & after (bottom)
P wave height
and width, PR
interval
Increased accuracy
by an average of
38.06%
More reliable fix
Use a frequent
Pattern Tree in a
learning phase to
learn the
patient’s normal
sinus rhythm
 Accelerometer
input

37
INVALID ATRIAL FLUTTER

Fix to Atrial Flutter classified as Unknown

Create separate detection with same filter or
separate filter/detection scheme all together
MIT-BIH Record 222
38
P/T DETECTION INTERFERENCE
MIT-BIH Record 222

To fix the
Normal as
Unknown
classifications
Add smoothing
filters on front
end
 Independent
filter output
buffers for
QRS and P/T
detection

39
CLASSIFICATION MODIFICATIONS
40
PERFORMANCE TESTING SUMMARY
Detection modifications still need to be made
 Classification modifications were made


Improved accuracy
Auto-Threshold allowed for QRS detection after
pacemaker stopped pacing to still detect QRS
complexes
 Pacemaker spikes detected as QRS complexes
 Wavelet Transform still allows QRS complexes to
be detected among HF baseline drifts

41
PROPOSED FUTURE MODIFICATIONS
ADC
Threshold12
Smooth
Filter
QRS Detect
Filter
5x
Post-Detect
Threshold34
Classify
P/T Detect
42
LIVE SYSTEM TESTING
43
LIVE SYSTEM TESTING
Bytes
Before
After
.text
.data
.bss
Program Memory Usage
32596
336
30048
32932, 6.3%
32448
336
30048
32784, 6.3%

Run Length (16 MHz Clock)
Initialization: 100 us
 Classification Not Found: 150 – 210 us
 Classification Found: 460 – 550 us

44
LIVE SYSTEM TESTING DEMO
45
CONCLUSION
46
PROBLEM STATEMENT

Focus on the research, development, design,
testing and validation of the electrocardiogram
sensor
RESEARCH QUESTIONS



Is it feasible to autonomously detect and classify EKG
arrhythmias to assist in a medical situational
assessment and health status feedback?
Will the system be able to differentiate a normal
rhythm from an abnormal one?
Will the system be able to perform in or close to realtime?
47
RESULTS
Proved feasibility to autonomously detect
arrhythmias, differentiate between normal and
abnormal rhythms all in real-time
 Contributed an additional combination of
detection and classification software geared
towards classifying normal sinus rhythm as well
as 15 other abnormal classifications in realtime on an embedded platform with the ability to
become mobile once integrated with other noise
canceling sensors/filters

48
SUGGESTIONS FOR FUTURE WORK
Further research and modifications needed for P
and T wave detections
 Research required into a frequent pattern tree for
classification with a learning phase

49
QUESTIONS
50