Real time stress detection system based on EEG signals
- *Corresponding Author:
- Vanitha V
National Centre for Sustainable Coastal Management
Accepted date: August 31, 2016
Stress has become a common emotion that students experience in day to day life. Several factors contribute to their stress and proven to have a detrimental effect on their performance. Hence, stress becomes ubiquitous in academic environment due to higher expectations in academic achievement, poor time management, and financial concerns. It has an adverse effect on the quality of their life affecting both physical and mental health. It is a guarantor for depression and suicidal risks if left unnoticed over a longer period. The traditional stress detection system is based on physiological signals and facial expression techniques. The major drawback is the uncertainty that arises due to numerous external factors like sweating, room temperature, anxiety. Some methods like hormone analysis have a drawback of invasive procedure. There is a need for a method that is non-invasive, precise, accurate and reliable. Electroencephalography (EEG) is a perfect tool as it is a non-invasive procedure. Also, it receives feedback from stress hormones; it can serve as reliable tool to measure stress. This research work aims to detect stress for students based on EEG as EEG displays a good correlation with stress. The EEG signal is pre-processed to remove artefacts and relevant time-frequency features are extracted using Hilbert-Huang Transform (HHT). The extracted features are manipulated to detect stress levels using hierarchical Support Vector Machine (SVM) classifier. The results revealed the efficiency of the system to detect stress in real time using their brain wave.
Stress detection, Electroencephalography, Hilbert-Huang transform, Support vector machine, Machine learning.
Students undergo stress in their everyday life. It is a necessary evil that is triggered by demanding physiological activity. It is not a negative process at all times. However under certain circumstances, it becomes a threat to mental health. Stress may arise due to physical or emotional demands. The physical demands may be due lifting heavy weights or intense training for sports. The body faces physical stressors, invokes sympathetic nervous system to maintain the balance . The stress hormones are released and regulate energy stores leading to rise in blood pressure, increase in heart rate. The physical stressors are temporary and can be controlled. Emotional stress arises due to work pressure, meeting up deadline, exams etc. These occupational stressors are difficult to adapt and deal with. If they persist, chronic stress sets in, which is a major concern for serious disease like heart attack.
Stress can have a positive or negative effect on students. Positive stress called eustress provides opportunity for growth like improvement in academic performance. If students continue to have stress, it reaches an optimal point and becomes distress. It will have a negative impact on the body and mind causing insomnia, suppressed immunity, frequent infections, and migraine .
Studies [3-5] have shown the high prevalence of stress in academic circle. It affects students irrespective of their background, culture, ethnic origin . They experience stress due to the demands and expectations placed on them. It becomes worse when they perceive the situation is overwhelming and find it difficult to cope up. It even makes them to drop out from college .
There are several contributors to academic stress among students [8-12]. Firstly, College life is different from school life and place more responsibilities on their shoulder. They may have to move away from family and hence, they have to make significant changes and adjustments in their personal life. Secondly, they face academic workloads like exam, assignment, meeting up deadline, compete with other students. Thirdly, they may have financial concerns and may feel burdened to pay tuition fees. Stress mainly arises due to three factors, namely academic, interpersonal and intrapersonal skills. Table 1 shows the category of stress and their stimuli.
|Interpersonal||Quarrel with friends and parents|
|Split up with partner|
|Crisis in family|
|Conflict with room mate|
|Personal health issues|
|Academic||Workload, meeting deadlines|
|Poor performance, inadequate resources|
|Fear of failure, poor time management|
|Unclear contents, competition with peers|
Table 1: Stress category and stimuli.
Several approaches with different methods have been recorded in the literature for detecting stress. Stress is detected based on the way an individual uses key strokes in keyboard . Face expressions are analysed to detect stress .
Some approaches use the temperature of the finger , human gestures  and eye blink  as a modality to detect stress. Recent techniques employ thermal imaging , physiological signals [19,20] for stress detection.
The problem of stress in students has become a concern for people across several disciplines. As the stress can cause various serious illnesses, an early assessment could significantly reduce the individual risk. In this view, we propose a new Student Health System (SHS), which could detect stress at early stages. Furthermore, it can improve the assessment of distress to provide therapies and counselling to tackle their negative feelings. This research work advances towards this objective and detects stress in students. We have identified two primary stress factors among students, namely academic performance and time pressure. So we have designed stress stimuli that include these two factors and elucidate three levels of stress. Arithmetic questions with a time limit are designed to induce stress as naturally as possible . As the brain is central for all emotions, we chose EEG as a window to detect stress. Also, due its high temporal resolution, it serves as an excellent tool to serve the purpose.
Materials and Methods
We conducted experiments on 6 healthy subjects who have no history of psychiatric problems or neuro disorders. The purpose was clearly explained to them and consent was obtained from them. A wireless EEG device, Emotiv Epoch head set was placed according to international 10-20 system. The electrodes were attached to the scalp at position AF3, F7, F3, FC5, T7, P7, O1, O2, P8, T8, FC6, F4, F8 and AF4 as shown in Figure 1.
Limited mathematical questions with varying difficulty were given and they were requested to solve within a specific time limit. The EEG was recorded while attempting to solve them. They self-report stress level according to National Aeronautics and Space Administration Task Load Index (NASA-TLX) rating scale. The entire process took 20 minutes and repeated 5 times to make a session as shown in Figure 2. The acquired EEG signals were processed at 512 Hz and impedance was kept as low as 7 kΩ.
This work was implemented in MATLAB 8.4 and the proposed methodology is depicted in Figure 3.
Raw EEG is contaminated with noise from different form and sources. As EEG has very small amplitude, filtering out unwanted noise is a critical step to extract useful information. We eliminated two primary noises (artifacts), namely power line noise and ocular artifacts that arise due to body movement.
• Power line noise removal: A combination of 0.75 Hz high pass and 45 Hz Finite impulse Response (FIR) filter was used to filter out the noise.
• Ocular artefact removal: The EEG rhythms lie in the frequency range of 0.3 Hz to 44 Hz. The ocular artefact occurs at 0.1-16 Hz. In order to preserve the natural properties of the signal, wavelet decomposition approach using bi-orthogonal wavelet bior 3.9 was employed.
The purpose of this stage is to map EEG into the consequent stress state. An adaptive feature extraction technique Hilbert Huang Transform (HHT) was applied to extract relevant features in time-frequency domain. It is the relevant approach to unearth information hidden in the signal considering the non-stationary nature of the signal.
It is performed in two steps .
• Decomposition: The pre-processed EEG signal is decomposed into Intrinsic Mode Functions (IMF).
• Hilbert transform: Instantaneous frequency is obtained by applying Hilbert transform to each IMF obtained through decomposition process.
Instantaneous frequency is rate of change of phase and computed as given below
ω (t)=1/2π ∂ θj (t)/∂ t and θj (t)=arctan (H (cj (t))/cj (t))
Where H [.] is Hilbert transform.
The classification is user independent which means data acquired from all participants are used for training the classifier. The feature vector obtained through HTT is classified into neutral or three levels of stress (stress-low, stress-medium and stress-high). We chose Support Vector Machine (SVM) over other algorithms for classification for two reasons. Firstly, it is insensitive to over fitting problem. Secondly, its ability for high generalization and accuracy with smaller training sample. It is the most robust classification algorithm for real world scenarios and successfully applied in many problems like face recognition, handwritten character detection, intrusion detection etc. It is originally designed as binary classification algorithm, but later it is improvised to multiclass problems.
For stress detection, we implemented hierarchical SVM. It utilizes a decision tree structure with a SVM at each node to construct a hyper plane decision boundary. The tree is created such that the classes at each parent node are divided into two classes, representing child nodes. The process iterates until the leaf nodes contain only a single class. Following a path from the root node to a leaf node leads to a classification of a new pattern. The instantaneous frequency value obtained for all five rhythms of EEG is used as feature vector to train the classifier. Figure 4 illustrates the training process of algorithm for stress level classification.
Due to smaller training dataset D, a 10-fold cross validation was adopted. The dataset D is divided into 10 subsets D1, D2… D10. Out of which one set is randomly chosen as teat dataset and remaining subsets are used for training. The entire cross validation procedure is repeated 10 times to improve classification accuracy.
The performance of the stress detection system was evaluated through Classification Accuracy (CA). It is computed as
Overall performance is calculated as
The performance of SVM is higher than other three classifier algorithms. The accuracy rate of SVM is 89.07%, the accuracy rate of LDA is 70.166%, QDA is 76.833% and KNN is 72.667%. The accuracy rate for four classifiers is depicted in Figure 5.
The performance for each subject across five rhythms of EEG is shown in Table 2.
|EEG Rhythms accuracy (%)|
Table 2: Classification accuracy across five rhythms.
The highest accuracy is obtained in alpha band and the average classification accuracy is 89.07%.
This study proposed an EEG-based stress detection system for students. Determining stress level for students studying in higher academic institution is crucial to prevent from major health risks. In a study with 6 subjects, we have shown that EEG is a reliable tool to detect stress levels. We applied timefrequency analysis to extract useful information from EEG and implemented hierarchical SVM as classifier and obtained accuracy of 89.07%. The results reported the feasibility of using EEG for stress detection, which important for clinical intervention and prevention of physical and mental health problems.
- Selye H. The stress of life. New York McGraw Hill Comp (2nd edn.) 1978.
- Ursin H, Eriksen HR. The cognitive activation theory of stress. Psycho neuroendocrinol 2004; 30: 567-592.
- Garret JB. Gender differences in college related stress. Undergr J psychol 2001;14: 5-9.
- Ross SE, Niebling BC, Heckert TM. Sources of stress among college students. Socpsychol 1999; 61: 841-846.
- Dunkel SC, Lobel M. Stress among students. NDir Student Serv 1990.
- Abouserie R. Sources and levels of stress in relation to locus of control and self-esteem in university students. Edupsychol 1994; 14:323-330.
- Hunt J, Eisenberg D. Mental health problems and help-seeking behaviour among college students. J Adol H 2010; 46: 3-10.
- Koolhaas JM, Bartolomucci A, Buwalda BD, De Boer SF, Flugge G, Korte SM, Meerlo P, Murison R, Olivier B, Palanza P, Richter LG. Stress revisited: a critical evaluation of the stress concept. NeurosciBiobehav Rev 2011; 35:1291-1301.
- Ross SE, Niebling BC, Heckert TM. Sources of stress among college students. Social psychol 1999; 61:841-846.
- Khanna JL, Khanna P. Stress as experienced by medical students. Coll Student J 1990; 24: 20-26.
- Linn BS, Zeppa R. Stress in junior medical students: relationship to personality and performance. J Med Educ 1984; 59: 7-12.
- Saipanish R. Stress among medical students in a Thai medical school. Med Teach 2003; 25: 502-506.
- Andren J, Funk P. A case-based approach using behavioural biometrics to determine a user’s stress level. InICCBR Workshops 2005; 9-17.
- Dinges DF, Venkataraman S, McGlinchey EL, Metaxas DN. Monitoring of facial stress during space flight: Optical computer recognition combining discriminative and generative methods. ActaAstronautica 2007; 60:341-350.
- Begum S, Ahmed MU, Funk P, Xiong N, Scheele BV. Using calibration and fuzzification of cases for improved diagnosis and treatment of stress. Proc European workshop 2006; 113-122.
- Healey JA, Picard RW. Detecting stress during real-world driving tasks using physiological sensors. IEEE Trans Intel Transp Sys 2005; 6:156-166.
- Haak M, Bos S, Panic S, Rothkrantz LJ. Detecting stress using eye blinks and brain activity from EEG signals. Proc Interact Interf 2009:35-60.
- Pavlidis I, Dowdall J, Sun N, Puri C, Fei J, Garbey M. Interacting with human physiology. Comp Vis ImagUnders 2007; 108:150-170.
- Poh MZ, McDuff DJ, Picard RW. Non-contact, automated cardiac pulse measurements using video imaging and blind source separation. Optics Express 2010; 18:10762-10774.
- Fei J, Pavlidis I. Thermistor at a distance: unobtrusive measurement of breathing. IEEE Trans Biomed Eng 2010; 57: 988-998.
- Dedovic K, Renwick R, Mahani NK, Engert V. The Montreal imaging stress task: using functional imaging to investigate the effects of perceiving and processing psychosocial stress in the human brain. J Psych Neurosci 2005; 30: 319.
- Huang NE, Wu ML, Qu W, Long SR, Shen SS. Applications of Hilbert-Huang transform to non-stationary financial time series analysis. ApplStochast Mod BussinessIndust 2003; 19:245-268.