Lab KhaldAli I. Aboalayon and Miad Faezipour University of ...

1
Data Decomposition Off Line System Results Significance Sleep is the primary function of the brain and plays an essential role in an individual’s performance, learning ability and physical movement. Sleep is a reversible state in which the eyes are closed and several nervous system centers are inactive. Hence, sleep renders the individual either partially or completely unconscious and makes the brain a less complicated network. Humans spend around one-third of their lives sleeping and conditions such as insomnia and Obstructive Sleep Apnea (OSA) are frequent and can severely affect physical health. New Feature Extraction Proposed Method Real Time Sleep Detection System Using New Statistical Features of the Single EEG Channel Khald Ali I. Aboalayon and Miad Faezipour Departments of Computer Science and Engineering and Biomedical Engineering University of Bridgeport, Bridgeport, CT University of Bridgeport Faculty Research Day (2017) Statistics Sleep analysis 18% Train operators 20% Pilots 14% Truck drivers National Sleep Foundation 2013 Sleepiness has a major impact in all kinds of transportation 3.5 M > 70 M 33% 2 - 4% & 1 - 3% >90% 1% Depressive disorder patients UK USA Sleep apnea Insomnia Epilepsy Sleep issues may cause sleepiness, depression or even death (NHTSA): over 250,000 sleep related traffic accidents each year 65,000 crashes. 1500 fatalities. 71,000 injuries. $12 B. 20% accidents One out of four accidents $1500 M monetary loss Rhythm Delta ∆ Theta θ Alpha α Beta β Gamma γ Frequency 0-4 Hz 4-8Hz 8-12Hz 12-22Hz >30Hz Amplitude 20-100μV 10μV 2-100μV 5-10μV - Sample EEG Signal Abstract Sleep specialists often conduct manual sleep stage scoring by visually inspecting the patient’s neurophysiological signals collected at sleep labs. This is, generally, a very difficult, tedious and time-consuming task. The limitations of manual sleep stage scoring have escalated the demand for developing Automatic Sleep Stage Classification (ASSC) systems. Sleep stage classification refers to identifying the various stages of sleep and is a critical step in an effort to assist physicians in the diagnosis and treatment of related sleep disorders. Many of the prior and current related studies use multiple EEG channels, and are based on 30s or 20s epoch lengths which affect the feasibility and speed of ASSC for real-time applications. Thus, the aim of this work is to present a novel and efficient real time technique that can be implemented in an embedded hardware device to identify sleep stages using new statistical features applied to 10 s epochs of single-channel EEG signals. First, we run our algorithm off line using the PhysioNet Sleep European Data Format (EDF) Database to classify six sleep stages. The proposed methodology achieves an average classification sensitivity, specificity and accuracy of 89.06%, 98.61% and 93.13%, respectively, when the decision tree classifier is applied. Second, our new method is compared with those in recently published studies, which reiterates the high classification accuracy performance. Finally, we propose an effective EEG classification technique for detecting sleep to only prove that our algorithm is simple and works fast in real time in an efficient way using Neurosky Mindwave headset that gathers the user’s brain waves. Signal Acquisition IIR Butterworth band-pass filters MM Distance Energy-Sis SVM - ANN – DT LDA - KNN - NB Post processing Signal Processing Feature Extraction Pre-processing Classification One-channel (b) Stage 1 EEG signal (c) Stage 2 EEG signal (a) Awake EEG signal (d) Stage 3 EEG signal (e) Stage 4 EEG signal (f) REM EEG signal Because EEG is considered a non-stationary signal, and unlike stationary signals, has no specific patterns, the signal was segmented in the time domain into sub-windows to apply the first feature, Maximum-Minimum (MM)-distance. The second feature, which determines the energy and speed of the EEG signal, is EnergySis. The assumption is that the number of samples (or length) of a sub-window is considered to be a power of 10, that should start from 100. This number is also used as the wavelength of the EEG waveform. In a generalized form, , , Sleep stages W S1 S2 S3 S4 REM Total No. of epochs in stages 5961 3552 7175 4321 1900 897 23,806 MM Distance = EnergySis = Classification C ONFUSION MATRIX FOR 5 - STAGE CLASSIFICATION Test Percentage Sleep EEG Classes A cc S1 S2 S3+S4 Wake REM 20 S e 92.53 96.34 97.82 97.88 67.23 95.46 S p 98.71 98.33 99.00 99.58 98.71 30 S e 91.18 96.38 97.42 97.28 72.14 95.19 S p 98.87 98.04 98.96 99.47 98.62 50 S e 91.40 95.54 97.49 97.73 66.88 94.87 S p 98.40 98.10 99.01 99.44 98.64 CONFUSION MATRIX FOR 4-STAGE CLASSIFICATION Test percentage Sleep EEG Classes A cc S1+S2 S3+S4 Wake REM 20 S e 96.33 98.19 98.13 70.05 96.30 S p 97.11 99.05 99.49 98.93 30 S e 95.50 98.52 98.24 68.63 95.98 S p 97.21 98.81 99.30 98.87 50 S e 96.41 98.00 97.82 64.85 95.90 S p 96.19 99.32 99.49 98.81 Test percentage Sleep EEG Classes A cc S1+REM S2 S3+S4 Wake 20 S e 96.22 95.76 98.14 97.92 96.99 S p 99.00 98.52 98.90 99.52 30 S e 95.53 96.36 98.32 98.69 97.29 S p 99.12 98.55 99.32 99.34 50 S e 94.48 96.64 97.76 98.15 96.89 S p 99.27 97.94 99.13 99.42 C ONFUSION MATRIX FOR 6 - STAGE CLASSIFICATION Test percentage Sleep EEG Classes A cc S1 S2 S3 S4 Wake REM 20 S e 91.19 96.43 91.25 86.88 98.64 66.32 93.29 S p 98.59 98.09 98.10 98.70 99.44 98.94 30 S e 91.06 95.84 90.95 86.15 97.41 76.26 93.18 S p 98.89 97.91 98.13 98.87 99.55 98.40 50 S e 91.46 95.05 90.83 87.60 97.63 72.22 92.92 S p 98.58 98.16 98.11 98.72 99.32 98.58 Comprehensive Comparison 0.00% 10.00% 20.00% 30.00% 40.00% 50.00% 60.00% 70.00% 80.00% 90.00% 100.00% A. R. Hassan et al 2016 C. Huang et al L. Fraiwan et al Y. Hsu et al S. Gunes et al O. Tsinalis et al S. R. I. Gabran1 et al Proposed method 0.00% 20.00% 40.00% 60.00% 80.00% 100.00% 120.00% A. R. Hassan et al. 2015 A. R. Hassan et al. 2016 C. Huanga, et al Y. Li et al C. Huang et al S. Gudmundsson et al T. H. Sanders et al L.J. Herrera et al Proposed method 0.00% 10.00% 20.00% 30.00% 40.00% 50.00% 60.00% 70.00% 80.00% 90.00% 100.00% A. R. Hassan et al 2015 G. Zhu et al L. Fraiwan et al A. B. Rossow et al O. Tsinalis et al S. R. I. Gabran1 et al Proposed method The methods that classify the six sleep stages using R&K standard, five sleep stages based on AASM rules and four sleep stages. D - BEST Lab Digital / Biomedical Embedded Systems & Technology Lab Future Work and Conclusion Real Time System Flowchart Start Establish connection Write data into file1 Time = 10 sec Start gathering Mindwave raw data Read file1 data Filter data Extract MMD Extract Esis Wait MMD finish Read file2 data Classify EEG signal Display result Quit End Write data into file2 YES YES NO NO Neurosky Mindwave An effective EEG sleep detection technique has been proposed to prove that our algorithm is simple and works fast in real time in an efficient way. The presented approach uses Neurosky Mindwave which is the obtainable, smallest and affordable EEG headset that gathers the user’s brain waves. Adjustable Head Band Sensor Tip/Arm Power Switch Battery Area Flexible Ear Arm Ear Clip Algorithm Time Complexity Execution Time The performance measurement for our algorithm takes to run is 0.7844 sec while the response of our system from initial connection between Mindwave and MATLAB until the EEG classified is approximately 15.0697 sec which is the actual time. Essentially, if this time is segmented and analyzed, the 10 sec is for recoding the data and the 5.07 is for our algorithm. Thus, approximately yielding the actual execution time of our algorithm. The new, simple statistical features developed in this work, called EnergySis and Maximum-Minimum Distance, provided an effective approach for analyzing the 10s EEG signal capability for measuring and identifying brain activity states [1]. The use of 10 s epoch lengths is beneficial for real-time applications. Since the MindWave device and most smart phone devices integrate with Bluetooth, future work can be extended to build a capable App software that will work on smart phone operating systems (OS) such as IOS and Android devices. Therefore, our simpler, quicker and more feasible scheme makes our approach attractive for easy implementation in any embedded devices to identify certain patterns such as fatigue, drowsiness and/or various sleep disorders (e.g., sleep apnea) in real-time. Real T ime System Results Alarm 1 Sending EEG Raw data App is running Reference : [ 1 ] Aboalayon, K.A.I.; Faezipour, M.; Almuhammadi, W.S.; Moslehpour, S. Sleep Stage Classification Using EEG Signal Analysis: A Comprehensive Survey and New Investigation. Entropy 2016, 18, 272. Feature No. Statement Running time Time Complexity MMD 1 strP=1; T(n) =1 O(1) 2 endP=range; T(n) =1 O(1) 3 for i=1:hSize T(n) = 2n O(n) 4 sgmD=xd(strP:endP); T(n) = 2+n O(1) 5 [Mi,Imi] = min(sgmD); T(n) = n log n O(n log n) 6 [Mx,Imx] = max(sgmD); T(n) = n log n O(n log n) 7 disD=disD+abs (sqrt((Mx-Mi).^2+(Imx-Imi).^2)); T(n)= 9n O(n) 8 strP=endP+1; T(n)= 2n O(n) 9 endP=endP+range; T(n)=2n O(n) Esis 10 sgmD=[]; T(n)=n O(n) 11 end T(n)=1 O(n) 12 Dfreq= Fstop/2; T(n) = 2 O(1) 13 vd= Dfreq*range; T(n)=2 O(1) 14 for i=1:el T(n)=2m O(m) 15 Ed=Ed+((abs(xd(i))^2)*vd); T(n) =6m O(m) 16 End T(n) = 1 O(1)

Transcript of Lab KhaldAli I. Aboalayon and Miad Faezipour University of ...

Page 1: Lab KhaldAli I. Aboalayon and Miad Faezipour University of ...

Data Decomposition

Off Line System Results

SignificanceSleep is the primary function of the brain and plays anessential role in an individual’s performance,learning ability and physical movement.Sleep is a reversible state in which theeyes are closed and several nervoussystem centers are inactive. Hence,sleep renders the individual eitherpartially or completely unconsciousand makes the brain a less complicatednetwork. Humans spend aroundone-third of their lives sleeping and conditions such asinsomnia and Obstructive Sleep Apnea (OSA) are frequentand can severely affect physical health.

New Feature Extraction

Proposed Method

Real Time Sleep Detection System UsingNew Statistical Features of the Single EEG Channel

Khald Ali I. Aboalayon and Miad FaezipourDepartments of Computer Science and Engineering and Biomedical Engineering

University of Bridgeport, Bridgeport, CT

University of BridgeportFaculty Research Day (2017)

Statistics

𝟏𝟏𝟑𝟑

Sleep analysis

18% Train operators

20% Pilots 14% Truck

drivers

National Sleep Foundation 2013

Sleepiness has a major impact in all kinds of transportation

3.5 M>

70 M33%

2-4%&

1-3%

>90%

1%

• Depressive disorder patients

• UK• USA

• Sleep apnea

• Insomnia

• Epilepsy

Sleep issues may cause sleepiness, depression or even death

(NHTSA): over 250,000 sleep related traffic accidents each year

• 65,000 crashes. • 1500 fatalities.• 71,000 injuries.• $12 B.

20% accidents

One out of four

accidents

$1500 M monetary loss

Rhythm Delta ∆ Theta θ Alpha α Beta β Gamma γFrequency 0-4 Hz 4-8Hz 8-12Hz 12-22Hz >30Hz

Amplitude 20-100µV 10µV 2-100µV 5-10µV -

Sample EEG Signal

AbstractSleep specialists often conduct manual sleep stage scoring byvisually inspecting the patient’s neurophysiological signalscollected at sleep labs. This is, generally, a very difficult,tedious and time-consuming task. The limitations of manualsleep stage scoring have escalated the demand for developingAutomatic Sleep Stage Classification (ASSC) systems. Sleepstage classification refers to identifying the various stages ofsleep and is a critical step in an effort to assist physicians inthe diagnosis and treatment of related sleep disorders. Many ofthe prior and current related studies use multiple EEGchannels, and are based on 30s or 20s epoch lengths whichaffect the feasibility and speed of ASSC for real-timeapplications. Thus, the aim of this work is to present a noveland efficient real time technique that can be implemented in anembedded hardware device to identify sleep stages using newstatistical features applied to 10 s epochs of single-channelEEG signals. First, we run our algorithm off line using thePhysioNet Sleep European Data Format (EDF) Database toclassify six sleep stages. The proposed methodology achievesan average classification sensitivity, specificity and accuracyof 89.06%, 98.61% and 93.13%, respectively, when thedecision tree classifier is applied. Second, our new method iscompared with those in recently published studies, whichreiterates the high classification accuracy performance.Finally, we propose an effective EEG classification techniquefor detecting sleep to only prove that our algorithm is simpleand works fast in real time in an efficient way using NeuroskyMindwave headset that gathers the user’s brain waves.

Signal Acquisition IIR Butterworth band-pass filters

MM DistanceEnergy-Sis

SVM - ANN – DTLDA - KNN - NB

Post processing

Signal Processing

Feature ExtractionPre-processing

Classification

One-channel

(b) Stage 1 EEG signal

(c) Stage 2 EEG signal

(a) Awake EEG signal (d) Stage 3 EEG signal

(e) Stage 4 EEG signal

(f) REM EEG signal

Because EEG is considered a non-stationary signal, and unlikestationary signals, has no specific patterns, the signal wassegmented in the time domain into sub-windows to apply the firstfeature, Maximum-Minimum (MM)-distance. The second feature,which determines the energy and speed of the EEG signal, isEnergySis. The assumption is that the number of samples (orlength) of a sub-window is considered to be a power of 10, thatshould start from 100. This number is also used as the wavelengthof the EEG waveform. In a generalized form,

𝝀𝝀 = �𝟏𝟏𝟏𝟏𝟏𝟏 𝒊𝒊𝒊𝒊 𝒏𝒏 < 𝟏𝟏𝟏𝟏,𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏𝟏 𝒍𝒍𝒍𝒍𝒍𝒍𝒏𝒏 −𝟏𝟏 𝒊𝒊𝒊𝒊 𝒏𝒏 ≥ 𝟏𝟏𝟏𝟏,𝟏𝟏𝟏𝟏𝟏𝟏

Sleep stages W S1 S2 S3 S4 REM TotalNo. of epochs in stages 5961 3552 7175 4321 1900 897 23,806

MM Distance

𝑴𝑴𝑴𝑴𝑴𝑴 = �𝒊𝒊=𝟏𝟏

𝒘𝒘

𝒅𝒅𝒊𝒊

EnergySis

𝑬𝑬𝑬𝑬𝒊𝒊𝑬𝑬 = �𝒊𝒊=𝟏𝟏

𝑵𝑵

𝑿𝑿𝒊𝒊𝟐𝟐 × 𝒗𝒗

Classification

CONFUSION MATRIX FOR 5-STAGE CLASSIFICATION

TestPercentage

Sleep EEG Classes AccS1 S2 S3+S4 Wake REM

20 Se 92.53 96.34 97.82 97.88 67.23 95.46Sp 98.71 98.33 99.00 99.58 98.71

30 Se 91.18 96.38 97.42 97.28 72.14 95.19Sp 98.87 98.04 98.96 99.47 98.62

50 Se 91.40 95.54 97.49 97.73 66.88 94.87Sp 98.40 98.10 99.01 99.44 98.64

CONFUSION MATRIX FOR 4-STAGE CLASSIFICATION

Testpercentage

Sleep EEG ClassesAccS1+S2 S3+S4 Wake REM

20Se 96.33 98.19 98.13 70.05

96.30Sp 97.11 99.05 99.49 98.93

30Se 95.50 98.52 98.24 68.63

95.98Sp 97.21 98.81 99.30 98.87

50Se 96.41 98.00 97.82 64.85

95.90Sp 96.19 99.32 99.49 98.81

Testpercentage

Sleep EEG ClassesAccS1+REM S2 S3+S4 Wake

20Se 96.22 95.76 98.14 97.92

96.99Sp 99.00 98.52 98.90 99.52

30Se 95.53 96.36 98.32 98.69

97.29Sp 99.12 98.55 99.32 99.34

50Se 94.48 96.64 97.76 98.15

96.89Sp 99.27 97.94 99.13 99.42

CONFUSION MATRIX FOR 6-STAGE CLASSIFICATION

Testpercentage

Sleep EEG Classes AccS1 S2 S3 S4 Wake REM

20 Se 91.19 96.43 91.25 86.88 98.64 66.32 93.29Sp 98.59 98.09 98.10 98.70 99.44 98.94

30 Se 91.06 95.84 90.95 86.15 97.41 76.26 93.18Sp 98.89 97.91 98.13 98.87 99.55 98.40

50 Se 91.46 95.05 90.83 87.60 97.63 72.22 92.92Sp 98.58 98.16 98.11 98.72 99.32 98.58

Comprehensive Comparison

0.00% 10.00% 20.00% 30.00% 40.00% 50.00% 60.00% 70.00% 80.00% 90.00% 100.00%

A. R. Hassan et al 2016C. Huang et al

L. Fraiwan et alY. Hsu et al

S. Gunes et alO. Tsinalis et al

S. R. I. Gabran1 et alProposed method

0.00% 20.00% 40.00% 60.00% 80.00% 100.00% 120.00%

A. R. Hassan et al. 2015A. R. Hassan et al. 2016

C. Huanga, et alY. Li et al

C. Huang et alS. Gudmundsson et al

T. H. Sanders et alL.J. Herrera et alProposed method

0.00% 10.00% 20.00% 30.00% 40.00% 50.00% 60.00% 70.00% 80.00% 90.00% 100.00%

A. R. Hassan et al 2015G. Zhu et al

L. Fraiwan et alA. B. Rossow et al

O. Tsinalis et alS. R. I. Gabran1 et al

Proposed method

The methods that classify the six sleep stages using R&K standard, fivesleep stages based on AASM rules and four sleep stages.

D-BEST LabDigital / Biomedical Embedded Systems & Technology Lab

Future Work and Conclusion

Real Time System FlowchartStart

Establish connection

Write data into file1

Time = 10 sec

Start gathering Mindwave raw data

Read file1 data

Filter data

Extract MMD

Extract Esis

Wait MMDfinish

Read file2 data

Classify EEG signal

Display result

Quit

End

Write data into file2

YES

YES

NO

NO

Neurosky MindwaveAn effective EEG sleepdetection technique hasbeen proposed to provethat our algorithm issimple and works fast inreal time in an efficientway. The presentedapproach uses NeuroskyMindwave which is theobtainable, smallest andaffordable EEG headsetthat gathers the user’sbrain waves.

Adjustable Head Band

Sensor Tip/Arm

Power Switch

Battery Area

Flexible Ear Arm

Ear Clip

Algorithm Time Complexity

Execution TimeThe performance measurement forour algorithm takes to run is 0.7844sec while the response of our systemfrom initial connection betweenMindwave and MATLAB until theEEG classified is approximately15.0697 sec which is the actual time.Essentially, if this time is segmentedand analyzed, the 10 sec is forrecoding the data and the 5.07 is forour algorithm. Thus, approximatelyyielding the actual execution time ofour algorithm.

The new, simple statistical features developed in thiswork, called EnergySis and Maximum-MinimumDistance, provided an effective approach for analyzingthe 10s EEG signal capability for measuring andidentifying brain activity states [1]. The use of 10 s epoch lengths is beneficial for real-timeapplications. Since the MindWave device and most smart phone devices integrate withBluetooth, future work can be extended to build a capable App software that will work on smartphone operating systems (OS) such as IOS and Android devices. Therefore, our simpler,quicker and more feasible scheme makes our approach attractive for easy implementation inany embedded devices to identify certain patterns such as fatigue, drowsiness and/or varioussleep disorders (e.g., sleep apnea) in real-time.

Real Time System Results

Alarm1Sending EEG

Raw data

App is running

Reference: [1] Aboalayon, K.A.I.; Faezipour, M.; Almuhammadi, W.S.; Moslehpour, S. Sleep Stage Classification Using EEG Signal Analysis: A Comprehensive Survey and NewInvestigation. Entropy 2016, 18, 272.

Feature No. Statement Running time Time ComplexityMMD 1 strP=1; T(n) =1 O(1)

2 endP=range; T(n) =1 O(1)

3 for i=1:hSize T(n) = 2n O(n)

4 sgmD=xd(strP:endP); T(n) = 2+n O(1)

5 [Mi,Imi] = min(sgmD); T(n) = n log n O(n log n)6 [Mx,Imx] = max(sgmD); T(n) = n log n O(n log n)7 disD=disD+abs (sqrt((Mx-Mi).^2+(Imx-Imi).^2)); T(n)= 9n O(n)

8 strP=endP+1; T(n)= 2n O(n)

9 endP=endP+range; T(n)=2n O(n)

Esis 10 sgmD=[]; T(n)=n O(n)

11 end T(n)=1 O(n)

12 Dfreq= Fstop/2; T(n) = 2 O(1)

13 vd= Dfreq*range; T(n)=2 O(1)

14 for i=1:el T(n)=2m O(m)

15 Ed=Ed+((abs(xd(i))^2)*vd); T(n) =6m O(m)

16 End T(n) = 1 O(1)