TIA NOI UNIVERSITY OF SCIENCE AND TECIINOLOGY SCHOOL OF ELECTRICAL & ELECTRONIC ENGINEERING MASTER THESIS ASLEEP APNEA DETECTION FROM ECG SIGNAL AND CLASSIFICATION METHOD BASED ON THE
Trang 1TIA NOI UNIVERSITY OF SCIENCE AND TECIINOLOGY
SCHOOL OF ELECTRICAL & ELECTRONIC ENGINEERING
MASTER THESIS
ASLEEP APNEA DETECTION FROM ECG SIGNAL AND CLASSIFICATION METHOD
BASED ON THE SE-ResNeXt MODEL
DO THI THU PHUONG
Phuong DT1212478M@hust.edu.vn
Advanced Program in Biomedical Kngincering
Instructor’s signature
HANOI, 7 2023
Trang 2HA NO}, 8” 2023 SOCIALIST REPUBLIC OF VIET NAM
Independence- Freedom- Happiness
VERIFICATION OF THE MASTER THESIS
The full name of the author: Do Thi Thu Phuong,
Thesis topic: A sleep apnea detection from ECG signal and classification method based on the SH-ResNeXt model
Majority: Biomedical Engineering
The student code: 20212478M
The instructor and the chairman of committee verify that the author has corrected and supplemented the thesis according to the minutes of the meeting committee with the following contents
1 Add content on why ECG signals are related to sleep apnea
2 Add content to the LCG signal lead
3 Use exactly words (detection => classification, project => thesis)
4, Remove 2.6; Other classification methods content
Ha Noai, / /2021
CHAIRMAN OF THE COMMITTEE
Trang 3MASTER THESIS
ASLEEP APNEA DETECTION FROM ECG SIGNAL AND
CLASSIFICATION METHOD BASED ON THE SE-ResNeXt MODEL,
Instructor
Sign and write full name
Trang 4ACKNOWLEDGEMENT
During my studies at Hanoi University of Science and Technology, I was equipped with in-depth knowledge, helping me grow in learning and scientific research I would like to thank my teachers, wha taught me whole heartedly during
any time at the university
With deep respect and gratitude, T express my sincere thanks to PhD Tran Anh
Vu, lecturer in the Electronic Technology and Biomedical Engineering Department, who is a instructor and has spent a lot of time guiding, instructing, and supporting me throughout the research and completion of this thesis
During the research and completion of my thesis, T received encouragement, sharing, and help from family, friends, colleagues, and other close people T would like to express my deep gratitude
Thank you for the support!
ABSTRACT
Sleep apnea (SA) is a serious sleep disorder thal happens when a person’s breathing repeatedly stops and starts during sleep Thesis "A sleep apnea detection from ECG signal and classification method based on the SE-ResNeXt model" Once completed, accurate classification of sleep apnea episodes is a crucial step to develop effective therapies and management strategies for treatment In this work, the
SA classification procedure is based ona single-lead electrocardiogram (ECG), which
is one of the most physiologically relevant signals for SA 1 propose a new feature extraction technique, which utilized the detection of R peaks Particularly, we dorive from the Yeager Hnergy Operator (HO) algorithm to detect 8 peaks and then obtain the RR intervals and amplitudes Afterward, the SE-ResNeXt $0 deep learning model
is used as a classifier to detect sleep apnea This model is a variant of ResNet 50 and can learn how to use global information to selectively emphasize useful information and suppress less beneficial ones, as well as allow feature recalibration The dataset
is taken from a published database and is initiated by 70 recordings of the PhysicNet LCG Sleep Apnea v1.0.0 dataset The performance of my classification method is 89,21% accuracy, 90.29% sensitivity, and 87,36% specificity, demonstrating the model's validity when compared to other researches This is also proof that I can utilize the HOG signal to efficiently classify SA
STUDENT
Sign and write full name
Trang 5CONTENTS
CHAPTER 1, INTRODUCTION vas cssssssneneesessisensetnoseiatiniatineeneieeneenes d
2.3 ‘Teager energy operator
CHAPTER 3: DATASET AND PROPOSED METHODS _—- 3.1 Chapter description .cscssesseusereersneseaseisinesseenineeietnenatineenneeneen 22
Trang 6Reason of choosing the topic
Purpose, Research Object, Scope of Research
Content Summary and Author’s Contribution
Trang 7Figure 2.2-1; An example of HCG signal s2 sreserrrrrrerrv., Ð
Figure 2.2-3: The HC WAV cu ieee ieseanessesanesnsesesnneriee ED
Figure 24-2: The schema of the original Inception module (left) and the SE-
Tigtưe 2.1-3: The schema of the original Residual module (left) and the SE-ResNet
Trang 8Table 4.1-1: Result table
LIST OF TABLES
46
Trang 9CHAPTER 1, INTRODUCTION
1.1 Chapter description
Chapter 1 presents the clinical basics of the sleep apnea ‘Ihe first chapter of the thesis will focus on clarifying the definition, symplomes, causes and risks of patients with the sleep apnea Ther fromm the clinical facility will use ECG signal combined with Machine Loaming (MI, application in disease classification This is an effective, optimal solution and offers many treatment opportunities for patients with the sleep
apnea
1.2 The sleep apnea overview
A repeated interruption or sleep disorder called sleep apnea (SA) is characterized by the collapse of the upper airway, which could result in the atic reduction of respiration airflow The word “apnea” comes from the Greek word for
“breathless” SA events can occur hundreds of times as you sleep, and if they do so repeatedly overtime, they can lead to a variety of health issues [1]
Sleep apnea occurs more ofien in mon (han in women Sleep apnea ean cour al
any age including infants, children, especially those over SO and people who are
overweight Sleep apnea is uncommon but widespread Experts estimate it affects about 5% to 10% of peaple worldwide The American Academy of Sleep Medicine (AASM) defines SA patients as individuals who have an apnea-hypopnea index (ALL)
of 5 or higher [2] Nearly 90% of SA patients do not receive timely diagnosis and treatment Besides, people with obesity and overweight are more likely to suffer from
SA [3] The resulting lack of oxygen activates a survival retlex that wakes you up just enough to resume breathing While that reflex keeps you alive, it also intetrupts your sleop cycle Thal prevents restful sleep and can have ofher effects, inchuding pulling
stress on your heart that can have potentially deadly consequences
‘rhe symptoms of obstructive and central sleep apneas overlap, sometimes making it difficult to determine which type you have ‘I'he most common symptoms
of obstructive and central sleep apneas include: loud snoring, episodes in which you stop breathing during sleep which would be reported by another person, gasping for air during slecp, awakening with a dry mouth, moming headache, difficulty staying, asleep, known as insomnia, excessive dayime sleepiness, knowm as hypersomuria, difficully paying attention while awake, irritability
The main causes of sleep apnea are:
- Obstructive sleep apnea (OSA), which is the more common form that occurs whon throat muscles relax and block the flow of air into the lungs These muscles support the soft palate, the triangular piece of tissue hanging from the soft palate called the uvula, the tonsils, the side walls of the throat and the
1
Trang 10tongue When the muscles relax, your airway narrows or closes as you breathe
in You can't get enough air, which can lower the oxygen level in your blood
Your brain senses that you can't breathe, and briefly wakes you so that you can
reopen your airway This awakening is usually so brief that you don't
remember it You might snort, choke or gasp This pattern can repeat itself 5
to 30 times or more each hour, all night This makes it hard to reach the deep,
restful phases of sleep
Normal breathing during sleep
Figure 1.2-1: Obstructive sleep apnea
Central sleep apnea (CSA), which occurs when the brain doesn't send proper
signals to the muscles that control breathing Central sleep apnea is a disorder
in which you breathing repeatedly stops and starts during sleep This condition
is different from obstructive sleep apnea, in which you can't breathe normally
because of upper airway obstruction Central sleep apnea is less common than
obstructive sleep apnea Central sleep apnea can result from other conditions, such as heart failure and stroke Another possible cause is sleeping at a high altitude Treatments for central sleep apnea might involve treating existing conditions, using a device to assist breathing or using supplemental oxygen Treatment-emergent central sleep apnea, also known as complex sleep apnea,
which happens when someone has OSA diagnosed with a sleep study that
converts to CSA when receiving therapy for OSA.
Trang 11Despite the significant incidence of this disorder, most patients are unaware of how SA affects their breathing pattorn And as a result, many people choose not to
seek professional care Several studies have examined the morbidity of SA [1] These
studies’ findings suggest thal failure ip delect and treal SA in a Limely marmer can canse daytime drowsiness [4] [5], cognitive dysfunction [6], cardiovascular diseases auch as hypertension [7], coronary arlery discase [8], heart failure [9], stroke [10] [11],
and metabolic diseases such as diabetes []2] Therefore in order to prevent further
difficulties, it is crucial to find SA as soon as possible To investigate sleep and respiration parameters, polysomnography (PSG), a comprehensive test used to diagnose sleep disorder, uses electroencephalograms (LG), electrocardiograms (ICG), electroculograms (BOG), electromyograms (EMG), and pulse oximetry [13] PSG has a high diagnostic sensitivity [14] Some of its drawbacks inchide high costs, patient inconvenicnee, labor intensive data recording, and challenging data interpretation Additionally, lengthy PSG equipment evaluation wait times make it amore dillieult lo promptly diagnose and treat SA [15] Therefore, i is necessary la provide an alleruative method for early diagnosis and deteclion of SA while cuhanving
patients’ comforl and reducing costs [16]
Machine learning (ML) methods have been considered effective for computer-
aided diagnosis without the use of PSG Different ML methods have been used in SA
detection, such as Logistic Regression [17], K-Nearest Neighbor (KNN) [18], Ensemble Leaming [19], Lincar Discriminant Analysis (LDA) 120], Support Vector
Machine (SVM) [21], Empirical Mode Decomposition (EMD) [22], Principal Component Auulysis (PCA) [23], Fast Fourier arid Wavelet Transform [24] [25], ele
In [26], the authors used ECG signals of ten patients with Obstructive Sleep Apnea
(OSA) against ten healthy controls This study first extracted Meart Rate Variability (HRV) from ECG, and then extracted the QRS component at different frequencies using a digital filter The features were then selected using PCA Classification was performed by the (ENN) algorithm The achieved accuracy is more than 80% Deep
learning has also been shown more effective in SA detection [27] [28] [29] In [30], data was collected from 86 patients, of which 69 were used in training and 17 in
testing Ihe Residual Neural Network (RNN) algorithm was reported to offer the
highest accuracy of 99% In [31], luc Heart Rate Vanability (HRV) dala was used to
automatically detect SA
‘The PhysioNet Apnea-ECG dataset has been widely used in SA classification
In [32], a deep neural network and Llidden Markov Model (LMM) were used to detect
SA ‘The method utilized a sparse auto-encoder to leam features, which belongs to unsupervised feaming that only requires unlabeled ECG signals i'wo types of classifiers (SVM and ANN) are used to classify the features extracted from the sparse auto-cricoder, Considering the (smporal dependoney, HMM was adopted to improve the classification accuracy Finally, a devision Cusion method is adopted to improve
a
Trang 12the classification performance About 85% classification accuracy is achieved in the per-segment SA detection, and the sensitivity is up to 88.9%, Or another study [33] also used in the Physionet datoset, the HUG signal was modeled in order to obtain the Heart Rale Variability (HRV) and the ECG-Derived Respiration (EDR) Selected feature techniques were used for benchmark with different classifiers such as Antificial Neural Networks (ANN) and Support Vector Machine (SVM), among others The results evidence that the best accuracy was 82.12%, with a sensitivity and specificity of 88.41% and 72.29%, respectively
0,
Tummy thesis, T also used the PhysioNet Apnea dataset lo classify SA The dataset contains V2 ECG lead signal 1 first used a Finile Impulse Response (FIR) band-pass
filter to eliminate noise and artifact T then extracted features from the R peaks of the
ECG signal, including the amplitude and interval between the R peaks Normally, the
R peak is found using Hamilton algorithm [34] in which a S-mimute segment of an
ECG record is separated, and then cubic interpolation is used to generate 900 values for each feature However, Hamilton algorithm is a complex algorithm with long computation times It is difficult to solve [lamiltonian path and cycle problems on conventional computers Moreover, in graphs in which all vertices have an odd
degree, an argument related to the handshake lemma shows that the number of
Hamiltonian cycles through any fixed edge is always even, so if one Hamiltonian cycle is given, then a second one must also exist This second cycle is not easy to cumpute Therelure, I used the Teager Energy Operator (TEO) algorithin to detect R
peaks instead of Hamilton algorithin in my thesis
After | have extracted features, 1 use the SL-ResNeXt 50 model to classify the
disease Generally, SE-ResNeXt 50 model is a variant of a ResNext that employs squeeze-and-excitation blocks to enable the network to perform dynamic channel-
wise feature recalibration It is a mew model that has been applicd lo various ECG
signal applications In particular, SE-ResNeXt is used to predict heart discase [35] In 136], they propose a strategy thal combines the hearlbeal model based on deep
learning with statistical heart rate features, using a SE-ResNeXt classifier to identify alnal fibrillation rhythm Ta my study, the SE-ResNeXi 50 classification algorithm
has been shown to be mare effective to classify SA when compared to the state-of-
the-art researches
My thesis is orgenived as follows Chapter 1 is the introduction Chapter 2 provides the (heorctical basic Next, chapter 3 presents (he dataset and process Finally, chapler 4 is resull, discussion and conclusion
1.3 Chapter canclusion
Chapter 1 presented an overview of sleop apnea and went in depth lo clarify the
risks as well as adverse effects on patients if not detected and treated promptly In addition, Ihis chapter outlines studies using MI that have been used to classify
4
Trang 13disease I also gave an overview of the new methods to be used in my thesis in conjunction with ECG signal Details of the proposed methods and an overview of the HCG signal will be presented in Chapter 2,
Trang 14CHAPTER 2: THEORETICAL BASIC
2.1 Chapter description
Chapter 2 will present the basic theories to understand about the HCG signal and the proposed methods to be used as well as it will answer the question why ECG signal plays an important role in classifying sleep apnea signals Therefore, the reader can know the methods easily This can explain why the proposed methods can provide high accuracy when classifying sleep apnea
2.2 ECG signal
2.2.1 Definition
An electrocardiogram (ECG) signal is a praphic record produced by an electrocardiograph that provides details about one’s heart rate and rhythm and any other related abnormalities; it depicts if the heart has enlarged due to hypertension (high blood pressure) or evidence of a myocardial infarction previously (heart attack
if any) he LCG signal is one of the most commen and effective tests for all drugs [tis easy to perform, non-invasive, yields outcomes instantly and is useful to identify hundreds of heart conditions,
ICGs from healthy hearts have a distinct, characteristic shape Any inconsistency in the rhythm of the heart or damage to the heart muscle can alter the heart’s electrical activity thereby changing the shape on the LCG
ECG test can be used lo check the rhyttin of the hearl and the electrical
movement The electrical signals are detected due to the attachment of the sensors to the skin which are generated as and when the heart beats These signals are recorded
by the machine and examined by a medical practitioner for an unusual sign
The ECG leads are electrical connections or electrodes placed on the body to
ineasure and record the electrical activity of the heart The ECG leads allow healthcare professionals to caplure the eleetrival signals generated by the heart as it contracts arid
pumps bload These signals provide valuable information about the heart's rhythm, rate, and overail electrical function
There arc two main types of ECG leads: limb leads and precordial (chest) leads Those leads are placed strategically on the body to provide a comprehensive view of the heart's clectrieal activity from different angles
- Limb Leads: Limb leads are placed on the arms and legs ‘hey are typically categorized into three lead groups:
® Lead I: One electrode on the left arm and another on the right arm This lead records the electrical activity between the left and right arms
Trang 15® Lead IE: One electrode on the right leg (or right leg combined with the left arm) and another on the left arm This lead records the electrical activity between the right leg and left arm
© Lead ITT: One electrode on the left log and another on the Jef) arm This lead records the electrical activity between the left leg and left arm
= Preourdial (Chest) Leads: Precordial leads are placed on specific poinls on the chest to provide a view of the heart's electrical activity from the front of the body These leads are labeled V1 to V6
© Vi: Placed on the fourth intercostal space just to the right of the
sternum
* V2: Placed on the fourth intercostal space just to the left of the steam
© V3: Placed between V2 and VA
« V4: Placed on the fifth intercostal space in the mid-clavicular line (between the armpil and nipple)
® V5: Placed on the same horizontal level as VA but in the anterior axillary Ine (in line with the front of the armpit)
*® V6: Placed on the same horizontal level as V4 and VS but in the midaxillary line (in line with the center of the armpit)
By placing clectrades in these specific locations, hoaltheare professionals can ereale a 12-lead ECG, which includes a combimalion of limb leads and precordial leads This allows for a comprehensive evaluation of the heart's electrical activity from different perspectives The information gathered fram these leads helps in diagnosing various heart conditions, such as amhythmias, heart attacks, and other cardiac abnormalities
Two main forms of dala are given by an ROG signal
- Determining time taken for electromagnetic pulse to travel through the heart
- To find if areas of heart are overworked ot too large
First, a surgeon will determine how long it takes for the electromagnetic pulse to travel through the heart by calculating time imtervals on the ECG Whether the electrical activity is natural or shuggish, fast or erratio, figuring out how long, a pulse takes to travel from one part of the heart to the next
Second, a cardiologist may be able to find out if areas of the heart are too large
or overworked by measuring the amount of electrical activity that flows thraugh the
heart muscle Ten electrodes are mounted on the arms of the patient and on the top of
the heart in a traditional 12-Iead LCG The average strength of the electrical potential
of the heart is then calculated fram 12 different angles (“leads”) and reported over a period of time (usually 10 seconds) Throughout the cardiac phase, the total intensity
Trang 16and trajectory of the electrical depolarization of the heart are observed at each
smoment
Bvidence does not support the use of ECGs as an attempt for prevention among those without symptoms or at low risk of cardiovascular disease ‘This is because an BCG may incorrectly suggest a concer, leading to misdiagnosis, initiation for invasive procedures, and overtreatment Individuals working in certain sensitive professions, such as acro plane pilots, may nocd to have an ECG as part of their routine safety evaluations,
Trang 17to be understood Some signs for an ECG are as follows:
An ECG is used to measure:
- Any heart damage and weaknesses in various parts of the heart muscle
- How quickly your heart beats and whether it normally beats
- The effects of drugs or devices used to control your heart (such as a pacemaker)
- The size and position of your heart chambers
Trang 18- ‘To diagnose abnormal heart rhythms
‘The ECG signals are primarily used to monitor and record the electrical activity
of the heart Ilowever, in addition to heart-related information, ECG signals can also provide insights into other physiological phenomena, including sleep apnea Sleep apnea is a sleep disorder characterized by repeated interruptions in breathing during sleep
While FCG is not a direct measure of sleep apnea itself, certain changes in the TCG signat during sleep can provide indications that sleep apnea might be accurring Here's how:
- Heart Rate Variability (HRV): Sleep apnea can lead lo disruptions im the
normal breathing patlers, causing fluctualions in oxygen levels and carbon
dioxide levels in the blood These disruptions can trigger changes in the
autonomic nervous system, which ean be reflected in the heart rate variability Abnormalities in HRV, inchiding increased sympathetic activity (associated with stress responses) and decreased parasympathetic aotivity (associated with relaxation), can be indicative of sleep apnea events
- Arousal Responses: Sleep apnea events often lead to brief awakenings or arousals from sleep These awakenings can trigger changes in the ECG signal, such as increased heart rate or changes in heart rate pattems Monitoring these changes can help in detecting sleep disturbances
- §T-Scemont Changes: Severe cases of sleep apnea, especially obstructive sleep apnea, can rosull im reduced oxygen levels in the blood This can lead to ST-
segment changes in the ECG signal, indicating inadequate oxygen supply to
the heart muscles:
- Arrhythmias: Sleep apnea can contribute to arrhythmias (abnormal heart
rhythms) due ta the fluctuations in oxygen and carbon dioxide levels These
arrhythmias can be detected through ECG monitoring
As aresult, the amount of oxyger is nol good enough for the hearl, making (he
heart rale not normal (ie., reduced) The easiest way lo monitor the heart rate
performance is an ECG signal that can indicate the oxygen level that comes to the
heart The ECG signal plays a critical role in identifying SA since it might reveal
abnormal cardiac activity Many recent studies on ECG-based SA detection have focused on feature engineering techniques that extract specific characteristics from multiple-lead LCG signals and use them as classification model inputs ‘They achieved many possible results for SA detection by Machine learning
2.2.3 LCG test procedure
An ECG is a safe and painless test that usually takes only a few minutes
10
Trang 19Using adhesive patches to bind leads from an electrocardiograph system to the skin on your hands, legs, and chest This leads to your heart reading signals and
sending this information to the electrocardiograph On a paper strip or on a monitor,
the computer then prints the text
Before the patches are attached, one is usually asked to remove the upper
clothing, the chest needs to be cleaned or shaved Once the patches are placed, hospital staff offers a gown to cover self The ECG test takes about only a few minutes
Figure 2.2-2: The ECG test procedure 2.2.4 Types
There are three primary ECG types:
- Resting ECG: if your doctor is interested in how your heart works while you're
in rest, you'll be asked to lie down and relax while recording your heartbeat
- Exercise ECG: the doctor may be interested in how the heart responds to
movement and you may be asked to walk or run on a treadmill or cycle on an
exercise bike when monitoring your pulse
- 24-hour ECG: often checking your rhythm throughout the day may be useful,
so you'll be asked to wear a portable electrocardiographic unit A doctor will
read the notes from the device when you access the machine
2.2.5 The ECG wave
An ECG has three main components: The P wave, which denotes depolarizing atria; the QRS complex, denotes the depolarization of the ventricles; and the T wave represents repolarizing ventticles
11
Trang 20During each pulse, a healthy heart has an ordered process of depolarization that starts with pacemaker cells in the sinoatrial node, extends throughout the atrium, and
moves through the atrioventricular node into its bundle and into the fibers of Purkinje, spreading throughout the ventricles and to the left
The electrical activity occurs ina small patch of pacemaker cells called the sinus
node during a regular heartbeat This produces a small blip called the P wave when the impulse stimulates the atria It then activates the main pumping chambers, the ventricles, and produces the large up-and-down in the middle, the QRS complex The
last T wave is a time of regeneration as the impulse reverses over the ventricles and travels back
If the heart is beating normally, it takes about a second (approximately 60 heartbeats per minute) for the entire cycle
Depolatisation of the Repolarisation of the the atria ventricles ventricle
Figure 2.2-3: The ECG wave
a Normal
12
Trang 21Figure 2.2-4: The normal ECG signal
In the normal ECG pattern, there is a regular pattern of The P wave, QRS complex, and T wave They occur in a sequence
b Angina
x
Figure 2.2-5: The angina ECG signal
When the heart muscle doesn’t get enough blood with oxygen, it causes discomfort, that feels like putting pressure on the chest This condition is termed as
‘Angina pain It can sometimes be misunderstood as indigestion As you can see in the figure above (see arrow), the ST-segment dips, which normally is flat
c Serious heart attack
Figure 2.2-6: The serious heart attack
13
Trang 22The elevated ST segment of the ECG is an indication of a serious heart attack
In the medical terminology, it is referred to as “STEMI”, which needs immediate
attention Generally, the ST segment remains flat
d Atrial fibrillation
Figure 2.2-7: The atrial fibrillation ECG signal Atrial fibrillation is the state when the atria and the ventricles show a lack of coordination of movement It results in rapid heartbeat, weakness and shortness of breath On ECG, it is represented by jumpy baseline and the P wave disappears
2.3 Teager energy operator
Teager Energy Operator (TEO) mainly shows the frequency and instantaneous changes of the signal amplitude that is very sensitive to subtle changes
TEO algorithm is presented as a simple nonlinear method that is capable of
analyzing and detecting a signal TEO was first introduced as a simple algorithm in speech processing by H.M Teager that was able to estimate an amount of energy ina
signal TEO has been recently used in many scientific fields, such as fault feature extraction and diagnosis of bearings, PQ event detection and classification, detection
of speech signals, heart failure detection, ete
For an oscillating continuous-time signal, x(t)= Acos(w,t + 0), TEO, P[x(t)], is defined as
WX] = OOP x(x" =AtwF @1)
Which is shown as:
x(t) = Acos(w,t +0) x'(t)= -Aw,sin(on,t + 0)
x(t) = -A@,?cos(w,t + 8)
W[x()] = [xŒ} - x()x'”() = A?@° (2.2)
14