Next Article in Journal
MultiSec: A Multi-Protocol Security Forwarding Mechanism Based on Programmable Data Plane
Previous Article in Journal
MobileUNetV3—A Combined UNet and MobileNetV3 Architecture for Spinal Cord Gray Matter Segmentation
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Emotion Recognition from EEG Signals Using Recurrent Neural Networks

1
Department of CSE, Marri Laxman Reddy Institute of Technology, Dundigal, Hyderabad 500043, India
2
Department of ECE, Karunya Institute of Technology and Sciences, Coimbatore 641114, India
*
Author to whom correspondence should be addressed.
Electronics 2022, 11(15), 2387; https://doi.org/10.3390/electronics11152387
Submission received: 1 July 2022 / Revised: 21 July 2022 / Accepted: 26 July 2022 / Published: 30 July 2022
(This article belongs to the Section Industrial Electronics)

Abstract

:
The application of electroencephalogram (EEG)-based emotion recognition (ER) to the brain–computer interface (BCI) has become increasingly popular over the past decade. Emotion recognition systems involve pre-processing and feature extraction, followed by classification. Deep learning has recently been used to classify emotions in BCI systems, and the results have been improved when compared to classic classification approaches. The main objective of this study is to classify the emotions from electroencephalogram signals using variant recurrent neural network architectures. Three architectures are used in this work for the recognition of emotions using EEG signals: RNN (recurrent neural network), LSTM (long short-term memory network), and GRU (gated recurrent unit). The efficiency of these networks, in terms of performance measures was confirmed by experimental data. The experiment was conducted by using the EEG Brain Wave Dataset: Feeling Emotions, and achieved an average accuracy of 95% for RNN, 97% for LSTM, and 96% for GRU for emotion detection problems.

1. Introduction

An important subfield of human-computer interaction is the brain–computer interface (BCI) [1]. In brain–computer interface systems, people with disabilities can operate devices using mental activities. In BCI techniques, electroencephalogram recordings from the brain are acquired, and the signals are analyzed to infer the subject’s purpose. The application of EEG-based emotion recognition (ER) to the brain-computer interface (BCI) has become increasingly popular over the past decade. BCI works by acquiring electroencephalogram signals from a subject’s brain and uses them to extract knowledge of the subject’s intention. Every day, emotions affect the way we interact, make decisions, and think. The cognitive brain–computer interface (BCI) is developed and improved through emotion classification. Many areas, such as e-health care, EEG-based music playing, e-learning, EEG-based music therapy [2] and marketing, etc., can be enhanced by EEG-based emotion recognition in real-time. Various disorders such as stroke, brain tumors, and sleep disorders can be diagnosed or treated by monitoring EEG activity. From a psychological viewpoint, emotional states can be modeled using either discrete (joy, fear, anger, happiness, sadness, surprise) or dimensional (valence and arousal) models.
EEG signals can be analyzed using machine learning (ML) algorithms and deep learning (DL) algorithms. Traditional ML algorithms generally involve the steps of pre-processing and feature extraction, followed by classification. Even so, manual extraction does not cover all hidden features, and the formulas used to extract time and frequency domain features are often extremely complex [3]. Furthermore, EEG signals can be contaminated by electromyography artifacts, causing serious interference in the traditional machine learning techniques. Based on all these problems, our main purpose is to build a low-complexity emotion recognition system with a low error rate and a high classification rate. Because of the aforementioned circumstances, certain deep learning methods are employed to overcome these issues. Machine learning allows a system to automatically learn and improve based on its previous experiences. Deep learning is a type of machine learning that involves the use of sophisticated algorithms and deep neural networks to train a model. The importance of deep learning is that it works with both structured and unstructured data, whereas machine learning only works with organized and semi-structured data. As the volume of data increases, the performance of machine learning algorithms declines; therefore, we need a deep learning method to retain the model’s performance.
Deep learning has a wide range of applications in several industries. Although automating self-driving cars is a risky endeavor, it has lately come a step closer to being a reality. Deep learning-based models are trained and tested in simulated situations to evaluate progress on everything from recognizing a stop sign to identifying a pedestrian on the road. One very familiar deep learning application is virtual assistants. In our daily lives, we all use virtual assistants, such as Alexa, Microsoft’s Cortana, Apple’s Siri, and Google Assistant [4]. Deep learning is extremely valuable in pharmaceutical and medical firms for a variety of reasons, including quick diagnosis and image segmentation [5]. For example, MRI data, X-rays, and other images can be analyzed using a conventional neural network (CNN). Deep learning has risen to prominence in practically every industry. It is employed in a variety of industries, including e-commerce, advertising, chatbots, robotics, visual recognition, natural language processing, fraud detection, and manufacturing, etc. [6]. The performance of convolutional and recurrent neural networks for emotion recognition is implemented and analyzed in this study. The motivation to choose deep learning techniques, which is not possible with conventional ML techniques, is the advantage of automatic feature extraction. In this study, we investigate the possibility of improving the performance of convolution and recurrent neural networks with a focus on emotion recognition.
A list of nomenclature used throughout this paper is provided in Table 1 as follows.
This paper is further subdivided into sections. Section 2 explains the methodology and the database; Section 3 explains the architecture of recurrent neural networks; Section 4 and Section 5 explain the architecture of long short-term memory networks and gated recurrent neural networks; Section 6 describes the models used in this work for EEG-based emotion recognition: RNN, LSTM, and GRU; Section 7 discusses the experimental results; Section 8 is the comparative analysis; and Section 9 is the conclusion.

2. Methodology

The complete emotion recognition process involves data pre-processing, automatic feature extraction, and finally, classification using deep learning models. Figure 1 depicts the overall structure of this study.

Database (EEG Brain Wave Data Set: Feeling Emotions)

The data were collected for 3 min from two members, one male and one female, in each state—positive, neutral, and negative. Dry electrodes were used to record the TP9, AF7, AF8, and TP10 EEG placements using a Muse EEG headgear. Six minutes of resting data were also taken. This dataset was resampled through statistical extraction since waves must be defined mathematically in a temporal manner [7]. The web link of the database is below.

3. Recurrent Neural Networks (RNN)

The feed-forward neural network (FFNN) has a few flaws, which led to the development of RNN: sequential data cannot be handled, only the current input is considered, and prior inputs are not remembered. The RNN is the solution to these difficulties. An RNN can deal with sequential data by considering both present and the past inputs. Because of the internal memory, RNNs can memorize past inputs. The variation in the flow of information between an RNN and an FFNN is depicted in the Figure 2.
Some of the applications of RNN are image captioning [8], time series prediction [9], machine translation [10], and NLP [11,12], etc. RNNs are divided into four categories: one to one, many to one, one to many, and many to many [13]. Figure 3 shows the categories of RNN, and Figure 4 explains simple RNN.
One to One: This type of neural network is used to solve general machine learning problems that have only one input and output.
Many to One: One single output is generated by this RNN based on the sequence of inputs. This type of network is used for sentiment analysis, in which a given sentence can be categorized as positive or negative based on its emotional content.
One to Many: This type of neural network has one input and several outputs. Image captions are a good example of this.
Many to Many: A series of inputs produce a series of outputs using this RNN. An example is the machine translation process.
In the above diagram, x is the input state, s is the hidden state, and O is the output [14,15]. The network’s weights are U, V, and W. The internal architecture of the RNN cell is explained in Figure 5.
The formula for calculating the current state is
h t = f ( h t 1 , X t )
where x t is the input state, h t is the current state, and h t 1 denotes the previous state.
The formula for calculating the activation function is
h t = tan h ( W hh   h t 1 + W Xh   X t )
where W hh stands for the recurrent neuron weights, and W Xh stands for the input neuron weights.
The calculation formula for the output is
Y t = W hy   h t
Here, Y t denotes the output and W hy denotes the output layer weights.
Recurrent neural networks have problems with vanishing gradients and exploding gradients during back-propagation. An example of vanishing gradients is when a gradient is too small, so the model stops learning, or takes a long time to learn, because of it. Exploding gradients occur when the method assigns an absurdly high value to the weights for no apparent reason. A slightly modified version of RNNs with gated recurrent units and long short-term memory networks can resolve this issue. The architecture and working functionality of the LSTM network and GRU networks are explained in the next section.

4. Long Short-Term Memory Networks (LSTM)

A long short-term memory network, also known as LSTM, is an advanced RNN that can store information for a long period of time. It can handle the vanishing gradient problem encountered by RNNs. Depending on the data, the network may or may not retain the memory. Through its gating mechanisms, the network maintains its long-term dependencies. In the network, the memory can be released or stored on demand based on the gating mechanism. Gates are the basic three components of an LSTM cell [16,17]. The forget gate is the first section, the input gate is the second, and the output gate is the third, as shown in Figure 6.
An LSTM, like a simple RNN, contains a hidden state, with Ht−1 representing the previous timestamp’s hidden state, and Ht representing the current timestamp’s hidden state. LSTMs also contain a cell state, which is represented by Ct−1 and Ct, respectively, for past and current timestamps [18,19], as shown in Figure 7.
Here, hidden state refers to the short-term memory, whereas cell state refers to the long-term memory. An overview of how LSTM works is shown in Figure 8.
Forget gate: The forget gate is the first of the gates. If you close it, no previous memories will be saved. All old memories will pass through if you fully open this gate. It is actually an element-by-element multiplication. The forget gate equation is as follows:
f t = σ ( X t U f + H t 1 W f )
If you multiply the old memory with a vector close to 0, you are attempting to erase the majority of the old memory. If you want to allow the old memory to pass, set the forget gate to 1.
C t 1 f t = 0 i f f t = 0
C t 1 f t = C t 1 i f f t = 1
where X t and H t 1 are the current timestamp’s input and the previous timestamp’s hidden state. U f and W f are the weights associated with the input and hidden states.
Input gate: The input gate is the second gate. The second gate determines how much new input should be allowed in. By adjusting this gate, new and old memories should be differently affected. The input gate is used to measure the significance of new data carried by the input. The input gate’s equation is as follows:
i t = σ ( X t U i + H t 1 W i )
where, U i and W i are the weights associated with the current input and previous hidden states.
Cell state: The + operator comes next. Piecewise summation is the meaning of this operator. This action will blend the current input and the old memory. To form St., the element-wise summation of the old memory and present input are used.
C ¯ t = t a n h   ( X t U c + H t 1 W c )   ( New   information )
C t = f t C t 1 + I t C ¯ t   ( Updating   cell   state )
Output gate: The output for this LSTM unit must be generated. The new memory, previous output, and current input all control the output gate in this stage. This gate regulates the amount of new memory that should be sent to the following LSTM unit.
O t = σ ( X t U O + H t 1 W O )
Because of the sigmoid function, its value will also be between 0 and 1. We will now utilize the modified cell states O t and tanh to determine the current hidden state, as indicated in the equation below.
H t = O t t a n h   ( C t )
The hidden state turns out to be a function of long-term memory (Ct) and current output. Apply the SoftMax activation to the hidden state Ht if you need to obtain the output of the current timestamp.
Output = Softmax   ( Ht )

5. Gated Recurrent Network (GRU)

GRUs are variants of RNN architecture that utilize gating mechanisms to control information flow between the cells of a neural network. LSTMs and GRUs operate on the same concept. In comparison to LSTM, they are quite new. This is why GRUs outperform LSTMs and have a more straightforward architecture. LSTMs are composed of two very different states, the cell state and the hidden state, which provide long- and short-term storage [20].
In GRUs, only one hidden state is transferred from one time step to another. As a result of the gating mechanisms and computations that the hidden state and input data undergo, it can simultaneously maintain both long- and short-term dependencies. Some of the applications of GRU are speech recognition, stock price prediction, machine translation, and sentiment analysis, etc. Figure 9 shows the structure of the GRU cell. At each timestamp t, it takes an input Xt and the hidden state Ht−1 from the previous timestamp t − 1. Later on, it outputs a new hidden state Ht, which is again passed along to the next timestamp.

GRU Architecture

The gated recurrent unit, in short GRU, has the same workflow as the RNN, but the gate operations are different. GRU addresses the problem of standard RNN by integrating two gates: the update gate and the reset gate, which are explained [21]. The internal architecture of the GRU cell is explained in Figure 10.
Update gate: The update gate functions similarly to an LSTM’s input and forget gate. It determines the information that should be discarded or included. Below is the equation for the update gate that manages long-term memory.
U t = σ ( X t U u + h t 1 W u )
The update gate’s weight matrices are Uu and Wu.
Further, this value is compressed using the sigmoid function to maintain the range from 0 to 1. In this way, the update gate alleviates the problem of vanishing gradients.
Reset gate: Using the reset gate, we can decide how much past data must be ignored; in simple terms, it decides whether or not the previous cell state is relevant. Below is the equation for the reset gate that manages the short-term memory.
r t = σ ( X t U r + h t 1 W r )
The reset gate’s weight matrices are Ur and Wr.
The sigmoid function transforms values in the range of 0 to 1, with values closer to zero being ignored, and those closer to 1 are further processed.
Candidate hidden state: As a first step, the Hadmard product between the reset gate and hidden state from the previous timestamp was calculated. This was then fed into the tanh function to determine the candidate’s hidden state. The formula for the candidate hidden state is shown below.
h ¯ = tan h ( X t   U h + r t h t 1   W h )
Current hidden state: Compute the Hadmard product between the update gate and the hidden state vector from the previous timestamp. Subtract the update gate from one to create a new vector, and then calculate the Hadmard product of the new vector with the candidate hidden state. Finally, sum the two vectors to generate the currently hidden state vector.
h t = U t h t 1 + ( 1 U t ) h ¯
where h t indicates the current hidden state.

6. Architectures Used in This Study

In this study of EEG-based emotion recognition, three architectures are used: RNN (recurrent neural network), LSTM (long short-term memory network), and GRU (gated recurrent unit). The experiments were conducted using the EEG Brain Wave Dataset: Feeling Emotions.

6.1. RNN Architecture

The RNN algorithm used in this work consists of an RNN layer with 128 units, a flatten layer, and finally a dense layer with softmax activation.
Learning features are determined using the RNN layers, and a dense layer is used to classify them into emotions from raw EEG signals. Simple RNN is used in this study. It is a simplified version of the real RNN in Keras. The loss function is a sparse categorical cross-entropy, and the optimizer used is an Adam optimizer. Figure 11 shows the RNN model used in this work for EEG-based emotion recognition.
Table 2 shows the Keras implementation of the RNN architecture and a detailed explanation of the RNN model with input and output vector shapes, as shown in Figure 12.

6.2. LSTM Architecture

The LSTM algorithm used in this work consists of an LSTM layer with 128 units, a flatten layer, and finally, a dense layer with softmax activation.
Learning features are determined using the LSTM layers, and a dense layer is used to classify them into emotions from raw EEG signals. Figure 13 shows the LSTM model for EEG-based emotion recognition. From the Keras API layers, the LSTM layer and dense layers are imported. Here, we used the LSTM layer with 128 internal units, and the return sequence is kept true. For each input time step, return sequences generate the hidden state output. The loss function is sparse categorical cross-entropy and the optimizer used is an Adam optimizer.
Table 3 shows the Keras implementation of the LSTM architecture and the detailed explanation of the LSTM model with input and output vector shapes, as shown in Figure 14.

6.3. GRU Architecture

The GRU algorithm used in this study consists of a GRU layer with 128 units, a flatten layer, and finally, a dense layer with softmax activation. Learning features are determined using the GRU layers, and a dense layer is used to classify them into emotions from raw EEG signals. Figure 15 shows the GRU model used in this study for EEG-based emotion recognition.
Table 4 shows the Keras implementation of the GRU architecture and the detailed explanation of the GRU model with input and output vector shapes, as shown in Figure 16.
With less training data, GRUs perform better than LSTMs, particularly when applied to language modeling tasks. In cases where additional inputs are needed for the network, GRUs are easier to modify, and thus are simpler with less code. The GRUs also have fewer parameters than the LSTM, as evidenced by the model summaries. With 128 internal units, the total number of parameters for the LSTM model is 1,044,995, and for the GRU model, it is 1,028,739.

7. Experimental Results and Discussions

This database has a total of 2132 samples for three emotions: positive (708 samples), negative (708 samples), and neutral (716 samples). The data were collected for 3 min durations per state. In this dataset, 1492 samples were used for training purposes and 640 were used for testing purposes. All the implementations use the Keras library with Tensor flow backend.

7.1. Results of RNN Architecture

Figure 17 shows the data fitting results using the RNN architecture.
Figure 18 shows the accuracy and loss of the RNN model. When the number of epochs changes, the loss and accuracy values also change. Table 5 displays the confusion matrix for the test data of 640 samples, and Table 6 shows the performance metrics of the model calculated by using the confusion matrix.
The metrics of the model accuracy, specificity, and sensitivity are calculated by using true positive (TP), false positive (FP), false negative (FN), and true negative (TN) values.
From the above calculations, the F1 score is 0.92 and the accuracy of the model by using RNN is 95%.

7.2. Results of LSTM Architecture

Figure 19 shows the data fitting results of the LSTM architecture.
Figure 20 shows the accuracy and loss of the graphs using the LSTM network.
Table 7 displays the confusion matrix for the test data of 640 samples for the three emotions of negative, neutral, and positive.
Table 8 shows the performance measures of the LSTM model used in this study. The performance measures are calculated by using TP, TN, FP, and FN values that are taken from the confusion matrix.
From the above calculations, the F1 score is 0.95, and the accuracy of the model by using LSTM is 97%.

7.3. Results of GRU Architecture

Figure 21 shows the data fitting results by using the GRU architecture.
Figure 22 shows the accuracy and loss of the graphs by using GRU network.
Table 9 displays the confusion matrix for the test data of 640 samples for the three emotions of negative, neutral, and positive.
The sensitivity, specificity, precision, F1 score, and accuracy are calculated by using TP, TN, FP and FN. Table 10 shows the performance measures of the GRU model.
From the above calculations, the F1 score is 0.95 and the accuracy of the model by using GRU is 96%.

8. Comparative Analysis of Recurrent Neural Networks Based Emotion Recognition with EEG Signals

For EEG emotion detection, the EEG Brain Wave Dataset is used in this work. The dataset contains a total of 2134 samples for three emotions: positive (708 samples), negative (708 samples), and neutral (716 samples). In this dataset, 1492 samples are used for training purposes and 640 are used for testing purposes. Table 11 shows the performance metrics of RNN, LSTM, and GRU models. The performance measures of sensitivity, specificity, precision, F1 score, and accuracy are calculated for every model. Performance measures are calculated using TP, TN, FP, and FN values that are obtained from the confusion matrix.
RNN has the drawbacks of vanishing and exploding gradients, so compared to the RNN network, both LSTM and GRU networks achieved a high accuracy. GRU uses fewer parameters than LSTM [22], so it uses less memory and is faster. However, LSTM is more accurate in a larger dataset. When dealing with large sequences, the LSTM algorithm is chosen, but when less memory is required and faster results are desired, the GRU algorithm may be used. In this study, LSTM achieved 1% more accuracy than GRU. Table 12 shows a comparative analysis of other existing works for EEG-based emotion recognition.

9. Conclusions and Future Scope

Three models are developed for EEG signal-based emotion recognition: RNN, LSTM, and GRU models. The experiments were conducted using the EEG Brain Wave Database. The accuracy achieved is 95% using the RNN model, 97% using the LSTM model, and 96% using the GRU model. Compared to the RNN model, both LSTM and GRU models achieved a high accuracy. In this study, LSTM achieved 1% more accuracy than GRU. A limitation of this study was a lack of datasets, as most of the EEG datasets are not publicly available. If a greater number of samples is available, it is possible to recognize a higher number of emotions. In the future, these networks will be implemented for multimodal datasets and real time data to recognize emotions.

Author Contributions

Literature Search, Figures, Study Design and Data Analysis, M.K.C.; Data Interpretation and Data Validation, J.A.; Data Interpretation, Data Validation and Supervision, D.J.H. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

“EEG Brain wave Data Set: Feeling emotions” at https://www.kaggle.com/datasets/birdy654/eeg-brainwave-dataset-feeling-emotions (accessed on 1 May 2022).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Ortiz-Echeverri, C.J.; Salazar-Colores, S.; Rodríguez-Reséndiz, J.; Gómez-Loenzo, R.A. A new approach for motor imagery classification based on sorted blind source separation, continuous wavelet transform, and convolutional neural network. Sensors 2019, 19, 4541. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. Liu, Y.; Sourina, O.; Nguyen, M.K. Real-time EEG-based emotion recognition and its applications. In Transactions on Computational Science XII; Springer: Berlin/Heidelberg, Germany, 2011; pp. 256–277. [Google Scholar]
  3. Sánchez-Reyes, L.M.; Rodríguez-Reséndiz, J.; Avecilla-Ramírez, G.N.; García-Gomar, M.L.; Robles-Ocampo, J.B. Impact of eeg parameters detecting dementia diseases: A systematic review. IEEE Access 2021, 9, 78060–78074. [Google Scholar] [CrossRef]
  4. Hoy, M.B. Alexa, Siri, Cortana, and more: An introduction to voice assistants. Med. Ref. Serv. Q. 2018, 37, 81–88. [Google Scholar] [CrossRef] [PubMed]
  5. Lundervold, A.S.; Lundervold, A. An overview of deep learning in medical imaging focusing on MRI. Z. Med. Phys. 2019, 29, 102–127. [Google Scholar] [CrossRef] [PubMed]
  6. Sarker, I.H. Ai-based modeling: Techniques, applications and research issues towards automation, intelligent and smart systems. SN Comput. Sci. 2022, 3, 158. [Google Scholar] [CrossRef] [PubMed]
  7. Bird, J.J.; Ekart, A.; Buckingham, C.D.; Faria, D.R. Mental emotional sentiment classification with an eeg-based brain-machine interface. In Proceedings of the International Conference on Digital Image and Signal Processing (DISP’19), Oxford, UK, 23–30 April 2019. [Google Scholar]
  8. Liu, X.; Xu, Q.; Wang, N. A survey on deep neural network-based image captioning. Vis. Comput. 2019, 35, 445–470. [Google Scholar] [CrossRef]
  9. Giles, C.L.; Lawrence, S.; Tsoi, A.C. Noisy time series prediction using recurrent neural networks and grammatical inference. Mach. Learn. 2001, 44, 161–183. [Google Scholar] [CrossRef] [Green Version]
  10. Singh, S.P.; Kumar, A.; Darbari, H.; Singh, L.; Rastogi, A.; Jain, S. Machine translation using deep learning: An overview. In Proceedings of the 2017 International Conference on Computer, Communications and Electronics (Comptelix), Jaipur, India, 1–2 July 2017; pp. 162–167. [Google Scholar]
  11. Pattanayak, S. Natural language processing using recurrent neural networks. In Pro Deep Learning with TensorFlow; Apress: Berkeley, CA, USA, 2017; pp. 223–278. [Google Scholar]
  12. Yin, W.; Kann, K.; Yu, M.; Schütze, H. Comparative study of CNN and RNN for natural language processing. arXiv 2017, arXiv:1702.01923. [Google Scholar]
  13. Medsker, L.; Jain, L.C. (Eds.) Recurrent Neural Networks: Design and Applications; CRC Press: Boca Raton, FL, USA, 1999. [Google Scholar]
  14. Graves, A. Generating sequences with recurrent neural networks. arXiv 2013, arXiv:1308.0850. [Google Scholar]
  15. Ebrahimi Kahou, S.; Michalski, V.; Konda, K.; Memisevic, R.; Pal, C. Recurrent neural networks for emotion recognition in video. In Proceedings of the 2015 ACM on International Conference on Multimodal Interaction, Seattle, WA, USA, 9–13 November 2015; pp. 467–474. [Google Scholar]
  16. Graves, A. Long short-term memory. In Supervised Sequence Labelling with Recurrent Neural Networks; Springer: Berlin/Heidelberg, Germany, 2012; pp. 37–45. [Google Scholar]
  17. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [PubMed]
  18. Sainath, T.N.; Vinyals, O.; Senior, A.; Sak, H. Convolutional, long short-term memory, fully connected deep neural networks. In Proceedings of the 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), South Brisbane, QLD, Australia, 19–24 April 2015; pp. 4580–4584. [Google Scholar]
  19. Malhotra, P.; Vig, L.; Shroff, G.; Agarwal, P. Long short term memory networks for anomaly detection in time series. In Proceedings of the European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, Bruges, Belgium, 22–24 April 2015; Volume 89, pp. 89–94. [Google Scholar]
  20. Chung, J.; Gulcehre, C.; Cho, K.; Bengio, Y. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv 2014, arXiv:1412.3555. [Google Scholar]
  21. Rana, R. Gated recurrent unit (GRU) for emotion classification from noisy speech. arXiv 2016, arXiv:1612.07778. [Google Scholar]
  22. Yang, S.; Yu, X.; Zhou, Y. Lstm and gru neural network performance comparison study: Taking yelp review dataset as an example. In Proceedings of the 2020 International Workshop on Electronic Communication and Artificial Intelligence (IWECAI), Shanghai, China, 12–14 June 2020; pp. 98–101. [Google Scholar]
  23. Liu, J.; Wu, G.; Luo, Y.; Qiu, S.; Yang, S.; Li, W.; Bi, Y. EEG-based emotion classification using a deep neural network and sparse autoencoder. Front. Syst. Neurosci. 2020, 14, 43. [Google Scholar] [CrossRef] [PubMed]
  24. Shao, H.-M.; Wang, J.-G.; Wang, Y.; Yao, Y.; Liu, J. EEG-Based Emotion Recognition with Deep Convolution Neural Network. In Proceedings of the 2019 IEEE 8th Data Driven Control and Learning Systems Conference (DDCLS), Dali, China, 24–27 May 2019; pp. 1225–1229. [Google Scholar]
  25. Yang, H.; Han, J.; Min, K. A multi-column CNN model for emotion recognition from EEG signals. Sensors 2019, 19, 4736. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  26. Salama, E.S.; El-Khoribi, R.A.; Shoman, M.E.; Shalaby, M.A.W. EEG-based emotion recognition using 3D convolutional neural networks. Int. J. Adv. Comput. Sci. Appl. 2018, 9, 329–337. [Google Scholar] [CrossRef]
Figure 1. EEG-based emotion recognition.
Figure 1. EEG-based emotion recognition.
Electronics 11 02387 g001
Figure 2. Recurrent neural network and feed-forward neural network.
Figure 2. Recurrent neural network and feed-forward neural network.
Electronics 11 02387 g002
Figure 3. Different types of RNN.
Figure 3. Different types of RNN.
Electronics 11 02387 g003
Figure 4. The simple RNN (recurrent neural network) model.
Figure 4. The simple RNN (recurrent neural network) model.
Electronics 11 02387 g004
Figure 5. Working of the recurrent neural network.
Figure 5. Working of the recurrent neural network.
Electronics 11 02387 g005
Figure 6. LSTM cell with gates.
Figure 6. LSTM cell with gates.
Electronics 11 02387 g006
Figure 7. LSTM cell with hidden and cell states.
Figure 7. LSTM cell with hidden and cell states.
Electronics 11 02387 g007
Figure 8. Internal Working of LSTM cell.
Figure 8. Internal Working of LSTM cell.
Electronics 11 02387 g008
Figure 9. GRU cell.
Figure 9. GRU cell.
Electronics 11 02387 g009
Figure 10. Function of gated recurrent network.
Figure 10. Function of gated recurrent network.
Electronics 11 02387 g010
Figure 11. Detailed RNN model.
Figure 11. Detailed RNN model.
Electronics 11 02387 g011
Figure 12. Detailed RNN architecture with input and output vector shapes.
Figure 12. Detailed RNN architecture with input and output vector shapes.
Electronics 11 02387 g012
Figure 13. Detailed LSTM model.
Figure 13. Detailed LSTM model.
Electronics 11 02387 g013
Figure 14. Detailed LSTM architecture with input and output vector shapes.
Figure 14. Detailed LSTM architecture with input and output vector shapes.
Electronics 11 02387 g014
Figure 15. Detailed GRU model.
Figure 15. Detailed GRU model.
Electronics 11 02387 g015
Figure 16. Detailed GRU architecture with input and output vector shapes.
Figure 16. Detailed GRU architecture with input and output vector shapes.
Electronics 11 02387 g016
Figure 17. Fitting results by using the RNN architecture.
Figure 17. Fitting results by using the RNN architecture.
Electronics 11 02387 g017
Figure 18. Accuracy and loss curves by using RNN.
Figure 18. Accuracy and loss curves by using RNN.
Electronics 11 02387 g018
Figure 19. Fitting results of the LSTM architecture.
Figure 19. Fitting results of the LSTM architecture.
Electronics 11 02387 g019
Figure 20. Accuracy and loss curves using the LSTM model.
Figure 20. Accuracy and loss curves using the LSTM model.
Electronics 11 02387 g020
Figure 21. Fitting results by using the GRU architecture.
Figure 21. Fitting results by using the GRU architecture.
Electronics 11 02387 g021
Figure 22. Accuracy and loss curves by using the GRU model.
Figure 22. Accuracy and loss curves by using the GRU model.
Electronics 11 02387 g022
Table 1. List of nomenclature used in this paper.
Table 1. List of nomenclature used in this paper.
NomenclatureReferred to
EEGElectroencephalogram
BCIBrain–Computer Interface
CNNConvolutional Neural Network
RNNRecurrent Neural Network
LSTM Long Short-term Memory Network
GRUGated Recurrent Unit
DLDeep Learning
MLMachine Learning
FFNNFeed Forward Neural Network
NLPNatural Language Processing
TPTrue Positive
TNTrue Negative
FPFalse Positive
FNFalse Negative
Table 2. Keras implementation of the RNN model.
Table 2. Keras implementation of the RNN model.
Model: “model”
Layer (type)Output ShapeParam #
input_1 (InputLayer)(None, 2548) 0
tf.expand dims (TFOpLambda)(None, 2548, 1) 0
simple rnn (SimpleRNN)(None, 2548, 128) 16,640
flatten (Flatten) (None, 326144)0
dense (Dense) (None, 3)978,435
Total params: 995,075
Trainable param: 995,075
Non-trainable params: 0
Table 3. Keras implementation of the LSTM model.
Table 3. Keras implementation of the LSTM model.
Model: “model_1”
Layer (type)Output ShapeParam #
input_2 (InputLayer)(None, 2548) 0
tf.expand_dims_1 (TFOpLambda)(None, 2548, 1) 0
lstm_1 (LSTM)(None, 2548, 128) 66,560
flatten 1 (Flatten) (None, 326144)0
dense_1 (Dense) (None, 3)978,435
Total params: 1,044,995
Trainable param: 1,044,995
Non-trainable params: 0
Table 4. Keras implementation of the GRU model.
Table 4. Keras implementation of the GRU model.
Model: “model_3”
Layer (type)Output ShapeParam #
input_4 (InputLayer)(None, 2548)0
tf.expand_dims_3 (TFOpLambda)(None, 2548, 1) 0
gru_1 (GRU)(None, 2548, 128) 50,304
flatten 3 (Flatten)(None, 326144)0
dense_3 (Dense)(None, 3)978,435
Total params: 1,028,739
Trainable param: 1,028,739
Non-trainable params: 0
Table 5. Confusion matrix by using RNN model.
Table 5. Confusion matrix by using RNN model.
NegativeNeutralPositive
Negative181119
Neutral02229
Positive92197
Table 6. Performance measures by using the RNN model.
Table 6. Performance measures by using the RNN model.
TPTNFPFNSensitivity/RecallSpecificityPrecisionF1 ScoreAccuracy
Negative1814309200.900.970.950.920.95
Neutral222406390.960.970.980.960.98
Positive19740428110.940.970.870.890.93
Average results0.930.970.930.920.95
Table 7. Confusion matrix of LSTM model.
Table 7. Confusion matrix of LSTM model.
NegativeNeutralPositive
Negative19407
Neutral02274
Positive82198
Table 8. Performance measures of the LSTM model.
Table 8. Performance measures of the LSTM model.
TPTNFPFNSensitivity/RecallSpecificityPrecisionF1 ScoreAccuracy
Negative194431870.960.980.960.950.97
Neutral227407240.980.990.990.980.99
Positive19842111100.950.970.940.940.96
Average results0.960.980.960.950.97
Table 9. Confusion matrix of the GRU model.
Table 9. Confusion matrix of the GRU model.
NegativeNeutralPositive
Negative19407
Neutral02283
Positive124192
Table 10. Performance measures of the GRU model.
Table 10. Performance measures of the GRU model.
TPTNFPFNSensitivity/RecallSpecificityPrecisionF1 ScoreAccuracy
Negative1944271270.960.970.940.940.97
Neutral228405430.980.990.980.980.98
Positive19242210160.920.970.950.930.95
Average results0.950.970.950.950.96
Table 11. Performance metrics of RNN, LSTM and GRU models.
Table 11. Performance metrics of RNN, LSTM and GRU models.
S. No.NetworkSensitivitySpecificityPrecisionF1 ScoreAccuracy
1RNN0.930.970.930.920.95
2LSTM0.960.980.960.950.97
3GRU0.950.970.950.950.96
Table 12. Comparative analysis with other existing works for EEG emotion detection.
Table 12. Comparative analysis with other existing works for EEG emotion detection.
Method/AuthorAverage Accuracy Rate (%)
DNN+ Sparse Auto encoder/[23]96
DCNN/[24]85
Multi column CNN/[25]90
3D CNN/[26]88
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Chowdary, M.K.; Anitha, J.; Hemanth, D.J. Emotion Recognition from EEG Signals Using Recurrent Neural Networks. Electronics 2022, 11, 2387. https://doi.org/10.3390/electronics11152387

AMA Style

Chowdary MK, Anitha J, Hemanth DJ. Emotion Recognition from EEG Signals Using Recurrent Neural Networks. Electronics. 2022; 11(15):2387. https://doi.org/10.3390/electronics11152387

Chicago/Turabian Style

Chowdary, M. Kalpana, J. Anitha, and D. Jude Hemanth. 2022. "Emotion Recognition from EEG Signals Using Recurrent Neural Networks" Electronics 11, no. 15: 2387. https://doi.org/10.3390/electronics11152387

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop