Automated Classification of Seizures against Nonseizures: A Deep Learning Approach
In current clinical practice, electroencephalograms (EEG) are reviewed and analyzed by well-trained neurologists to provide supports for therapeutic decisions. The way of manual reviewing is labor-intensive and error prone. Automatic and accurate seizure/nonseizure classification methods are needed. One major problem is that the EEG signals for seizure state and nonseizure state exhibit considerable variations. In order to capture essential seizure features, this paper integrates an emerging deep learning model, the independently recurrent neural network (IndRNN), with a dense structure and an attention mechanism to exploit temporal and spatial discriminating features and overcome seizure variabilities. The dense structure is to ensure maximum information flow between layers. The attention mechanism is to capture spatial features. Evaluations are performed in cross-validation experiments over the noisy CHB-MIT data set. The obtained average sensitivity, specificity and precision of 88.80%, 88.60% and 88.69% are better than using the current state-of-the-art methods. In addition, we explore how the segment length affects the classification performance. Thirteen different segment lengths are assessed, showing that the classification performance varies over the segment lengths, and the maximal fluctuating margin is more than 4%. Thus, the segment length is an important factor influencing the classification performance.
Epilepsy is a chronic neurological disorder, in which brain activity becomes abnormal, leading to sensations and sometimes impaired consciousness. It is characterized by recurrent, unprovoked seizures. A seizure is a transient symptom of synchronous neuronal activity in the brain. In the world, more than 50 million people suffer from epilepsy. The patients with epilepsy are subjected to lifestyle limitations, such as acquiring and using a driving licence, and the social stigmatisation that often accompanies epilepsy. In current clinical practices, electroencephalography (EEG), which records the electrical activities generated by neurons in the brain, is commonly used for the epilepsy diagnosis. Long-term EEG records are reviewed and analyzed by well-trained neurologists in order to identify the occurrence of seizures and localize their zones in the brain. The seizure information is critical for physicians making therapeutical decisions, especially before any surgical operation in the cortex. However, this manual way of reviewing and analyzing is labor-intensive and time-consuming, because it usually takes several hours for a well-trained neurologist to analyze one-day recordings from one patient[4, 5, 6, 7, 8, 9]. This limitation motivates research of automatic seizure detection. In this paper, we will focus on developing an automatic approach to classify seizure segments and nonseizure segments from off-line EEG data records. The automatically classified seizure segments are provided to neurologists to make further analyses.
One major problem in the seizure/nonseizure classification is the significant variations of EEG signals for seizure states and nonseizure states across individuals. Also, it is a problem that the signal properties of seizures may resemble the characteristics of normal EEG signals. Furthermore, EEG signals usually contain physiologic artifacts from involuntary body or organ movements and non-physiologic noise. Machine learning techniques and signal processing technologies have been applied to address the problems. Patient-specific detectors are developed to detect seizure onsets[7, 8, 11, 12, 13, 14]. These studies convert the problem of seizure detection into the seizure/nonseizure classification problem but more of a real-time flavor. Using traditional machine learning methods, hand-crafted features are usually needed to capture characteristics of seizure manifestations in EEG. Recently, epilepsy researchers have focused on developing seizure detection approaches based on deep learning techniques[5, 14, 15, 16, 17, 10]. Most of these deep learning-based approaches are developed based on classical neural network models, like convolutional neural network (CNN), recurrent neural network (RNN), long short-term memory (LSTM) and gated recurrent unit (GRU). Their architectures are shallow. And they process data on different channels in the same way. A shallow neural network usually has limited capability of extracting seizure features. Different brain regions have different contributions to seizures. EEG data from different brain regions need be differentiated. Thus, we center on developing a deep neural network, which can directly process raw EEG data, differentiate data on different channels, and automatically classify seizures and nonseizures.
EEG data are one-dimensional, dynamic and non-linear. RNN is better at processing one dimensional sequence data than CNN. However, RNN usually suffers from the gradient vanishing or exploding problem, and its two variants, i.e., LSTM and GRU, do not effectively support stacking multiple layers because of the gradient decay over layers. An emerging variant of RNN, independently recurrent neural network (IndRNN), addresses the above limitations. By taking the Hadamard product (i.e., element-wise product) over the recurrent inputs, it overcomes the gradient vanishing or exploding problems, and supports computations over multiple layers efficiently. Multiple layers help to address considerable variations of seizure morphologies. IndRNN is also able to process longer sequence data than LSTM. On the other hand, as information passes through many layers in a deep neural network architecture, it may possibly decay. A densely connected structure, in brief, dense structure, in which one layer connects with all preceding layers, can help preserve maximum information flow between layers. Additionally, EEG signals from different brain regions have different strengths of signifying seizures. Based on the above observations and analyses, we integrate IndRNN with the dense structure and an attention mechanism to design a deep learning approach with multiple layers for the seizure/nonseizure classification. Firstly, an attention layer is designed to differentiate data from different brain regions. It adaptively generates weights on channels and outputs weighted data. A group of IndRNN layers and batch normalization layers are organized according to the dense structure, and they constitute a dense block. Batch normalization layers are used to help reduce the over-fitting risk in deep neural network. The dense block extracts temporal spatial features from the weighted data. Predominant features at a specific temporal scale are extracted from the outputs of a dense block by deploying a max-pooling layer. After several runs of feature computations in dense blocks and max-pooling layers, the overall features within the whole temporal duration are calculated by an average pooling layer. Lastly, two fully connected (FC) layers are deployed for further integrating features and for final classification. We perform cross-validation (CV) experiments over the noisy EEG data set of CHB-MIT to evaluate our proposed approach. In our experiments, we obtain the average sensitivity, specificity and precision of 88.80%, 88.60% and 88.69%, respectively, and the corresponding standard deviations of 0.0252, 0.0250, and 0.0215, respectively. The results exceed the performance of current state-of-art approaches  . Besides, we explore how the segment length affects the performance of seizure/nonseizure classification. Our experimental results with different segment lengths show that the performance of seizure classification fluctuates over the segment lengths, and the maximal fluctuating margin is more than 4%.
The main contributions of our paper include the following:
An emerging deep learning model, IndRNN, is applied to seizure/nonseizure classification for the first time, and temporal spatial features are extracted with a deep architecture;
Dense structure and attention mechanism are integrated with IndRNN for a deep neural network, and they help improve the capability of discriminating seizures from nonseizures;
The relationship between the segment length and the performance of seizure/nonseizure classification is investigated.
The rest of this paper is organized as follows. Section II describes related research about automatic seizure/nonseizure classification. Section III illustrates our proposed approach of dense IndRNN with attention. The proposed approach is evaluated in CV experiments in Section IV. Section V explains the attention mechanism and validates main modules in our designed approach. In Section VI, how the segment lengths affect the performance of classifying seizure/nonseizure is explored. Section VII discussed the approach of dense IndRNN with attention. And conclusions and future work are described in Section VIII.
Ii Related Work
Seizure/nonseizure classification distinguishes seizure segments from nonseizure segments, which can be used to detect whether a data segment contains a seizure or not. For this task, extensive studies have been performed. Because seizure detection, which is often of a real-time flavor, is often treated as the seizure/nonseizure classification problem, many machine learning methods have been developed [8, 11, 12, 13, 14, 22, 23, 24, 25]. Recently, deep learning techniques have been applied to the seizure detection problem[5, 15, 16, 17, 21, 10, 26].
Esbroeck et al. developed a multi-task learning framework to detect patient-specific seizure onset. In the framework, distinguishing the windows of each seizure from nonseizure data was treated as a separate task, and discriminating individual-seizures as another task. Evaluation results over the CHB-MIT data set indicated that the framework performed better in most cases compared to the standard SVM.
Kiranyaz et al. presented a systematic approach for patient-specific classification of long-term EEG. The approach can be divided into three main steps. The first step is to process data through band-pass filtering, feature extraction, epileptic seizures aggregation and morphologic filtering. The second step is to classify signal from each channel of the processed data by using a collective network. The third step is to integrate the initial classification results over each channel and make final classification decision for each EEG data segment. Over the data set of CHB-MIT, the obtained average sensitivity and specificity were 89.01% and 94.71%, respectively. In the approach, the many classifiers increased the computational complexity.
Based on signal processing techniques, Zandi et al. decomposed EEGs from each channel by wavelet packet transform, and separated the seizure and nonseizure states by developing a patient-specific measure. Using the measure, a combined seizure index was derived for each epoch of every EEG channel. The combined seizure index was inspected and it triggered alarms.
Acharya et al. proposed a method to automatically detect the normal, pre-ictal, and ictal conditions from EEG signals. The method firstly extracted four entropy features, including approximate entropy, sample entropy and two phase entropies, then fed the four features to classifier to do classification.
Zhou et al. designed a seizure detection algorithm based on lacunarity and Bayesian linear discriminant analysis (BLDA). The critical step in the algorithm was feature extraction. Firstly, EEGs were performed wavelet decomposition with five scales, and the wavelet coefficients at scales 3, 4, and 5 were selected. At the three scales, features including lacunarity and fluctuation index were extracted. Then they were passed on to the BLDA for training and classification. Over intracranial EEG data from the Epilepsy Center of the University Hospital of Freiburg, the obtained average sensitivity was 96.25%, with an average false detection rate of 0.13 per hour and a mean delay time of 13.8s. The obtained precision results for eleven patients were less than 50%.
Fan and Chou leveraged a complex network model to represent EEG signals, and integrated it with spectral graph theory to extract spectral graph theoretic features for detecting seizure onsets in real-time. The method was evaluated over the CHB-MIT data set. The resulting patient-specific average sensitivity was 98%, and the latency was 6s.
Shoeb and Guttag leveraged the support vector machine (SVM) to develop a patient-specific detection method. Filters were applied to extract spectral features over channels. The feature vectors were concatenated according to a fixed time length and then taken as inputs to train the SVM model. The method achieved a sensitivity of 96%, a median detection delay of 3 seconds and a median false detection rate of 2 per 24 hour. The results are often used as a benchmark for patient-specific seizure detection on the data set CHB-MIT. The authors observed that the identity of channels could help differentiate between the seizure and the nonseizure activity.
Amin and Kamboh designed an algorithm RUSBoost to process imbalanced seizure/nonseizure data, and combined RUSBoost with the decision tree classifier to do patient-specific seizure detection. The algorithm extracts spectral, spatial and temporal features from each channel. Over the CHB-MIT data set, the obtained average accuracy, sensitivity and false detection rate were 97%, 88%, and 0.08 per hour, respectively. Using the method, the training was fast.
Hunyadi et al. presented a nuclear norm regularization to convey multichannel information of ictal patterns. The regularization integrating with extracted features helped reach a median sensitivity of 100%, false detection rate of 0.11 per hour and alarm delay of 7.8s over the CHB-MIT data set. The proposed method processed spatial information in the same way.
In , Fergus et al. developed a seizure detection method based on selected features from special brain regions. Over the data set of CHB-MIT, an average sensitivity of 88% and specificity of 88% were achieved.
Truong et al. designed an automatic seizure detection method, in which one important step is to select channels that contribute the most to seizures. Features, such as spectral power and correlations between channel pairs, were extracted. The classifier of Random Forest was used for classification. Over an intracranial electroencephalography (iEEG) data set, the method reached the state-of-the-art computational efficiency while maintaining the accuracy. In the method, the step of selecting channels was to reduce the number of channels, thereby improving the computational efficiency.
Thodoroff et al. presented a recurrent convolutional neural network to capture spectral, spatial and temporal features of seizures. EEG signals were firstly transformed into images. Created images were fed to CNN. Output vectors of the CNN were organized to be sequences in the chronological order. The sequences were passed on to the bidirectional RNN to make classification. Both patient-specific experiments and cross-patient experiments were performed. In the cross-patient testing, the obtained average sensitivity was 85% with the false positive rate of 0.8 per hour. Transfer learning technique was utilized to overcome the problem of small amount of data in the patient-specific experiments.
Vidyaratne et al. proposed a deep recurrent architecture by combining cellular neural network with bidirectional RNN. The bidirectional RNN was deployed into each cell of the cellular neural network to extract temporal features in the forward and the backward directions. Each cell interacts with its neighboring cells to extract local spatial-temporal features. The method was evaluated in patient-specific experiments over five patients from CHB-MIT. The obtained sensitivities are 100%. The experiments were limited, because that only five patients were tested.
Golmohammadi et al. explored two kinds of neural networks over TUH EEG Corpus. Their experimental results showed that convolutional LSTM network outperformed convolutional GRU network. Different initialization and regularization methods were also tested.
Hussein et al. designed a deep neural network for seizure/nonseizure classification by using LSTM. The neural network extracted temporal features by using LSTM. Acharya et al. presented a 13-layers deep neural network for seizure/nonseizure classification by using CNN. The two approaches were evaluated over the same EEG data set provided by University of Bonn. The LSTM approach achieved performances of 100%. The CNN approach obtained a sensitivity of 95% and specificity of 90%. Each record in the Bonn EEG data set contains only one channel and has no artifacts. And thus the Bonn data set is regarded as an easy data set.
Ansari et al. aimed to automatically optimize feature selection for seizure detection. They utilized deep CNN to extract optimal features, and then fed the features to random forest to do classification. In evaluation experiments, EEG recordings of 26 and 22 neonates were taken as training data and testing data, respectively. A false alarm rate of 0.9 per hour and a sensitivity of 77% were achieved. The proposed method needed no predefined features, and surpassed three classic feature-based approaches.
The deep learning approaches developed in  are based on classic neural network models, including CNN, RNN, LSTM, and GRU. The four models have limitations for processing EEG data. CNN is good at processing two or more dimensional data but not suited to one dimensional sequence data. RNN suffers from the gradient vanishing or exploding problem. Even though LSTM and GRU improved on RNN, the two variants still have the gradient decay problem when multiple layers are deployed. We aim to build a deep neural network architecture to overcome the variability of seizure morphologies well.
Iii-a Model Design
EEG signals are dynamic one-dimensional data. The data at one time point in an EEG signal correlate with the past data. RNN and its variants are good at processing such kind of one-dimensional data. Additionally, EEG signals for seizure and nonseizure states across individuals manifest considerable variations, and the signal properties of one patient’s seizure may closely resemble the characteristics of a normal EEG signal from the same patient or other patients. In deep learning methods for classification, deep architecture is generally helpful to extract discriminative features. A variant of RNN, IndRNN, supports stacking multiple layers. And it can address the gradient vanishing and exploding problems, which restrict the effectiveness of RNN. The two variants, LSTM and GRU, suffer from the gradient decaying problem over layers. IndRNN can also process longer sequences than LSTM. Therefore, we choose to use IndRNN as the main module to construct a deep architecture for classifying seizures against nonseizures.
In a deep neural network, as information about inputs or extracted features passes through many layers, it may vanish by the time it reaches the end of the network. A densely connected structure can maximize information flow between layers in a network. We will leverage a densely connected structure to inter-connect IndRNN layers to preserve information.
A brain activity state is jointly described by EEG signals from different brain regions. Different brain regions have different contributions to a seizure state. The EEG signals at different brain regions can be differentiated when identifying seizures and nonseizures. We will introduce an attention mechanism to generate weights for channels. The weight describes the importance of EEG signal on a channel in discriminating seizures against nonseizures.
Based on the above observations, we will integrate IndRNN with a dense structure and attention mechanism to design a new approach for the seizure/nonseizure classification. The inputs are firstly passed on to an attention layer, in which attention weights are generated and multiplied with signal data. The outputs of the attention layer are weighted signals. The weighted signals are fed to the first dense block. A dense block consists of multiple IndRNN layers and is to extract temporal-spatial features in signals. In a dense block, each IndRNN layer passes its outputs to all subsequent layers; the inputs of the first IndRNN layer are also fed to all the other layers; and the outputs of the last IndRNN layer is taken as the outputs of the dense block. Each dense block is followed by a max-pooling layer. The max-pooling layer extracts predominant features at a specific time scale, and its processed results are passed on to the next dense block. The outputs of the last max-pooling layer, which follows the last dense block, are fed to an average pooling layer. In the average pooling layer, the overall features over time steps are extracted. Two FC layers follow the average layer in order to extract further features and make predictions.
Iii-B Model Architecture
The proposed integrated IndRNN with a dense structure and attention mechanism is called dense IndRNN with attention (ADIndRNN). It consists of an attention layer, dense blocks, max-pooling layers, an average pooling layer, and two FC layers. Each dense block further comprises of IndRNN layers and bach normalization layers. The architecture of the ADIndRNN is presented in Fig. 1.
Iii-B1 Attention Layer
The attention layer adaptively generates weights for channels and executes element-wise multiplication between data segments and weights. It outputs weighted signals. Its work flow is given in Fig. 2, and its computation is described in (1)(6). The attention weights are generated according to an attention mechanism. Each data segment executes one linear transformation based on a kernel matrix and a bias matrix. After the linear transformation, the function is applied to each time step separately. The activation function outputs weights on channels at each time step. In order to diminish differences of channel weights among time steps, the weights over time steps are averaged. And the averages are taken as weights on channels at these time steps. The attention mechanism is illustrated in (1)(5).
Here, denotes an input tensor of size . Symbols , , represent the numbers of samples, time steps, and signal channels, respectively. is a matrix of size , , a weight matrix of size , a bias matrix of size , and with size . is a normalized exponential function. is a matrix of size , of size , of size , and an output matrix of attention layer with shape . Functions and are to reshape a matrix, is a function of computing averages along with the second axis of matrix, and is an copying operation to share the averages over all the time steps. The symbol means an element-wise multiplication between matrices.
Iii-B2 Dense Block
A dense block organizes its components in a densely connected fashion to ensure maximum information flow between layers. Each component consists of one IndRNN layer and one batch normalization (BN) layer, and the IndRNN layer is followed by the BN layer. Outputs of one component are passed on to all subsequent components. And the inputs of the first component are fed to other each component. The structure of a dense block is shown in Fig. 3.
An IndRNN layer processes input sequences in forward order, and extracts time-dependent features. Its computation is as follows:
Here, is a matrix of size , which represents an input of IndRNN layer at the time step . is the number of features. is a matrix of size , and it means hidden outputs at the time step of in IndRNN layer. represents the number of hidden states. is a input weight matrix with shape , for a recurrent weight matrix of size . and are two bias matrices of size . is an output weight matrix of size . is a matrix of size , which means an output at the time step in the IndRNN layer. and are activation functions such as ReLU.
For the first IndRNN layer in the first dense block, its input at the time step is the output of the attention layer at the time step , i.e., consists of all the elements at the entry of along the axis of 1 in the matrix .
BN layer is inserted after each IndRNN layer. It is used to speed up training and reduce overfitting.
Iii-B3 Max-pooling Layer
Each dense block is followed by a max-pooling layer. The max-pooling layer extracts predominant features from output sequences of dense block at a specific temporal scale.
Iii-B4 Average Pooling Layer
Average pooling layer is designed to extract overall features across time scales for the final classification. Its output is a two-dimensional matrix, in which each row corresponds to one segment sample and elements in columns are features. It is inserted after the last max-pooling layer.
Iii-B5 FC Layers
Two FC layers are deployed behind the average pooling layer. The first FC layer aims to integrate features from the outputs of the average pooling layer and make further extractions. The second is to perform final classification of seizure/nonseizure.
In order to evaluate our proposed approach of ADIndRNN, we conduct CV experiments over the noisy EEG data set of CHB-MIT, and measure its performance in five metrics. The five metrics are sensitivity, specificity, F1 score, precision and accuracy, respectively. The proposed approach is compared with two current state-of-the-art approaches, including one LSTM-based approach and one CNN-based approach. The CV is that, data segments from all the patients are put into a pool, then the segments in the pool are randomly split into three disjoint sets according to a ratio, including training dada set, validation data set and testing data set. The training data are to train a model, the validation data are to tune parameters in the model based on validation performance, and the testing data are to test the generalization capability of trained model. To reduce the variability of testing results, ten rounds of CVs are performed for each approach, then averages and standard deviations for the ten CV results are calculated as the performance of seizure/nonseizure classification approach.
Iv-a Data Set
The data set of CHB-MIT contains 686 EEG recordings from 23 subjects of different ages ranging from 1.5 years to 22 years. The recordings include 198 seizures. The sampling frequency is 256 Hz. Most recordings are one hour long, and others are two-hour long or four-hour long. The EEG recordings are grouped into 24 cases. In each case, the data recordings are from a single subject. Case Chb21 was obtained 1.5 years after Case Chb01 from the same subject. Each data file contains data on 23 or more channels. There exist channels on which data are missing. Thus, we only consider those channels containing all the original data. Three data files, including Chb12_27.edf, Chb12_28.edf, and Chb12_29.edf, have different channel montages from other data files. In our experiments, we remove these three data files.
Iv-B Data Segmentation
In order to extract effective seizure features, 17 common channels are chosen. According to a segment length of 23 seconds, each data record in each case is split into data segments from the beginning to the end. Data segments except for the last one of a data record have no overlap. If the duration of a data record is not divided by the segment length and there is a seizure happening in the remaining part, we will ensure that the last segment will have the same length but will overlap with its prior segment. If the remaindering part contains no seizure, then it is dropped. Using annotation files for this data set, we determine whether a data segment contains a seizure or not. In our experiments, if a segment contains any seizure data, it is considered as a seizure segment; otherwise, it is a nonseizure segment.
Using the above segmentation method, 665 seizure segments are obtained. In these seizure segments, the lengths of seizures vary from 1s to 23s, with the average length being 16.9s. Among all seizure segments, segments containing seizure data of less than 7s comprise 14.7%, those containing more than 17s comprise 59.8%, and those containing more than 10s comprise 76.1%. All the seizure segments are taken as a part of our experiment data. We randomly choose 665 nonseizure segments in each experiment. The 1330 seizure/nonseizure segments are randomly split into training set, validation set and testing set with a ratio of 70:15:15 in each experiment, and we adopt the repeated random sub-sampling validation as a strategy for CV.
Iv-C CV Results for the Proposed Approach
Based on the architecture in Fig. 1, we build a model by stacking three dense blocks, each dense block consisting of three IndRNN layers and three BN layers. The constructed model is denoted by ADIndRNN-(3,3). In our CV experiments using the model ADIndRNN-(3,3), the total loss contains two parts. One part is losses produced by predicted labels of the model and ground truth labels. The other part is L2 losses of all the trainable variables. For the second loss part, we set a coefficient of weight decay to take its specific percentage into the total loss. The main parameters in the model are set as follows: A kernel initializer in the attention layer is a truncated normal initializer with mean value of 0 and standard deviation of 0.1, a bias initializer in the attention layer initializes tensor to 0; the state size of each IndRNN layer in the first dense block is 80, that in the second dense block is 120, that in the third dense block is 160; each max-pooling layer has a window size of 2 and stride of 2; weight initializers in the two FC layers are Xavier initializers, two bias initializers in the two FC layers are constant initializers with value of 0.001, the number of output units in the two FC layers are 100 and 2, respectively; the weight decay for the trainable variables loss is 0.01; the optimizer is Adam, the learning rate is 0.0004; the batch size for training is 30, the epochs is 60. Overall, ten rounds of CVs are performed. The obtained results of these ten experiments over 23s segments using ADIndRNN-(3,3) are given in Table I. The averages (abbrev. Ave.) in Sensitivity (abbrev. Sens.), Specificity (abbrev. Spec.), F1 score, Precision (abbrev. Prec.) and Accuracy (abbrev. Acc.) are 88.80%, 88.60%, 88.71%, 88.69%, and 88.70%, respectively; and the standard deviations (abbrev. Std.) are 0.0252, 0.0250, 0.0134, 0.0215, and 0.0133, respectively.
Iv-D Comparison with the LSTM and CNN Approaches
LSTM as a main module has been used to detect seizures. The LSTM approach is evaluated through CV experiments over an EEG data set from University of Bonn, showing state-of-the-art performance. A CNN-based approach has been proposed for seizure/nonseizure classification, which also demonstrates state-of-the-art performance over the Bonn data set. Because the Bonn data set is heavily processed and contains no artifacts, and its size is small, we compare the proposed approach with the LSTM approach and the CNN approach over the noisy EEG data set of CHB-MIT.
For the LSTM approach and the CNN approach, we implement them according to the descriptions in the related literature. And the implementations are tested. Our obtained testing results reach the reported performances. Using the two implementations, CV experiments are performed for the LSTM approach and the CNN approach separately. The LSTM approach consists of one LSTM layer, one time-distributed computing layer, one average pooling layer and one FC layer. In the experiments using the LSTM approach, our parameter setting is as follows: The number of hidden states is 120 in the LSTM layer, that in the time-distributed computing layer is 60, the optimizer is RMSprop, the learning rate is 0.0007, the batch size is 30, and the number of epochs is 30. For the CNN approach, it contains five convolutional layers, five max pooling layers, and three FC layers. The parameters are set as follows: the number of hidden states in the first two convolutional layers is 100, that in each of the second two convolutional layers is 200, that in the fifth convolutional layer is 260, that in the first FC layer is 100, that in the second FC layer is 50, the parameter alpha is 0.01 in the LeakyReLU activation function, the optimizer is Adam, the learning rate is 0.001, the batch size is 30, and the number of epochs is 50. Using the LSTM approach, ten rounds of CVs over 23s segments from CHB-MIT are performed, and their obtained results are shown in Table II. The obtained average sensitivity is 84.40%, the average specificity is 84.30%, and the average precision is 84.70%. For the CNN approach, ten rounds of CV experiments over 23s segments are also conducted, and the results are given in Table III. The achieved average sensitivity, the average specificity and the average precision are 84.80%, 81.00%, and 82.56%, respectively.
Comparing CV results in Tables I-III, we can conclude that the average performance, in either one of the metrics of sensitivity, specificity, F1 score, precision, and accuracy, using the proposed approach is at least 4% greater than that using the LSTM approach or the CNN approach, and the obtained standard deviation over each metric using our approach is smaller. The above comparisons show that the proposed approach outperforms the LSTM approach and the CNN approach in seizure/nonseizure classification.
V Model Analyses
Our designed architecture in Fig. 1 contains the attention layer, the dense structure, and the IndRNN layer. In this section, we will explain attention weights by taking examples of segments in CHB-MIT, validate separately the attention layer and the dense structure, and evaluate models with more IndRNN layers.
V-a Interpretations of Attention Mechanism
Our attention mechanism differentiates information on different channels, and assigns different weights to them. The attention mechanism contains a kernel matrix and a bias matrix, which are trained together with the whole model of ADIndRNN. A data segment is combined with the two trained matrices to do multiplying and adding operations. Then, the function and an averaging operation are applied to calculate weights on channels. The obtained attention weights depend on the trained kernel matrix, the trained bias matrix, and data segment. Based on a well-trained model ADIndRNN-(3,3), Fig. 4 shows attention weights over channels for a 23s seizure segment from Chb04, and Fig. 5 presents weights over channels for a 23s seizure segment from Chb10. The weights in Fig. 4 and Fig. 5 are based on the same well-trained kernel matrix and bias matrix, but on different data segments. The two weights distributions in the two figures are different, and their differences indicate that the attention mechanism can adaptively calculate weights over channels. The magnitude of an attention weight manifests the size of differences between seizure signals and nonseizure signals on a channel. The larger an attention weight is, the better the signals on the corresponding channel can distinguish seizures from nonseizures.
Fig. 6 is a visualization of nonseizure signals on five channels from the patient Chb04, and Fig. 6 for seizure signals on the same five channels from the same patient. The five channels in Fig. 6 are FP1-F3, P8-O2, P7-O1, P3-O1, and F4-C4, respectively. The visualized seizure segment in Fig. 6 is the one whose channel weights are shown in Fig. 4. In Fig. 4, weights on channels P7-O1 and FP1-F3 are the first two largest, and weights on channels P3-O1 and P8-O2 are the two smallest. Comparing seizure signals in Fig. 6 with nonseizure signals in Fig. 6, signals on the channel P7-O1 (i.e., signals with the magenta color) change the most. The magenta seizure signal in Fig. 6 oscillates with the largest magnitude range and the largest frequency. Its magnitude ranges in five zones. The seizure signal on Channel FP1-F3 in Fig. 6 (i.e., the blue seizure signal) fluctuates more frequently than the seizure signals on channels F4-C4 and P8-O2 (i.e., the black seizure signal and the green seizure signal). The seizure signal on Channel P3-O1 (i.e., the olive green seizure signal) oscillates in a range of two zones, which is smaller than the blue seizure signal and the black seizure signal. So, the weight values in Fig. 4 mostly characterize the sizes of differences between seizure signals and nonseizure signals in Fig. 6.
Fig. 7 visualizes the seizure segment that the channel weights are presented in Fig. 5. Fig. 7 shows nonseizure signals and seizure signals on five channels from the patient Chb10. The five channels are CZ-PZ, F8-T8, P8-O2, P7-O1, and P3-O1, respectively. The seizure signal on Channel P7-O1 (i.e., the magenta seizure signal) in Fig. 7 oscillates in six zones, and fluctuates faster than the magenta nonseizure signal in Fig. 7. Magnitudes of the other four seizure signals range in at the most five zones. The magenta signals change the most from a nonseizure state to a seizure state. It is just why the weight on Channel P7-O1 in Fig. 5 is the largest. The seizure signals on channel F8-T8 and CZ-PZ (i.e., the blue seizure signal and the brown seizure signal, respectively) in Fig. 7 oscillate mostly in four zones, and the blue seizure signal fluctuates a little more frequently than the brown seizure signal. The magnitude in the seizure signal on Channel P8-O2 (i.e., the green signal) in Fig. 7 changes more slowly than the magnitude in the blue seizure signal, although the green signal oscillates a little more frequently than the blue seizure signal. The seizure signal on Channel P3-O1 (i.e., the olive seizure signal) in Fig. 7 oscillates mostly in three zones and less frequently than the blue seizure signal. So, the weight on Channel P3-O1 is smaller than weights on channels CZ-PZ and F8-T8 in Fig. 5.
V-B Validation of Modules
In order to validate modules in our architecture of Fig. 1, we take the model ADIndRNN-(3,3) as a representative and conduct CV experiments over 23s segments. The model ADIndRNN-(3,3) contains an attention layer and three dense blocks, each block including three IndRNN layers. So, we evaluate a model IndRNN-9. In this model, nine IndRNN layers are used; each IndRNN layer is followed by one BN layer and one max-pooling layer orderly; the last max-pooling layer is followed by one average pooling layer and two FC layers. A model AIndRNN-9 is constructed by inserting one attention layer before IndRNN-9 in order to test the contributions of attention mechanism. And also a model DIndRNN-(3,3), which is obtained by removing the attention layer in the model ADIndRNN-(3,3), is evaluated. The three models, including IndRNN-9, AIndRNN-9, and DIndRNN-(3,3), are separately performed ten rounds of CVs based on their tuned parameters. For each model, the averages and standard deviations over its achieved ten testing results are presented in Table IV.
Comparing results in Table IV with results in Table I, we can see that, using IndRNN only, or the combination of IndRNN and attention mechanism, or the combination of IndRNN and dense structure does not reach the performance of the model ADIndRNN-(3,3). After adding the attention layer, the model AIndRNN-9 is a little better than IndRNN-9, and ADIndRNN-(3,3) outperforms DIndRNN-(3,3) by at least 1%. By using dense structure, DIndRNN-(3,3) is better than IndRNN-9, and the model ADIndRNN-(3,3) improves 4% in the sensitivity compared with AIndRNN-9. Thus, the attention layer and the dense structure in our architecture of Fig. 1 provide positive contributions for seizure/nonseizure classification.
V-C Analyses for deeper IndRNN-related models
The model ADIndRNN-(3,3), as a representative of the architecture in Fig. 1, shows good performance in Table I, which is better than the LSTM approach and the CNN approach. It uses nine IndRNN layers. A natural question is what are the performances for models containing more IndRNN layers. We evaluate six models, including IndRNN-12, IndRNN-15, AIndRNN-12, AIndRNN-15, DIndRNN-(4,3), and ADIndRNN-(4,3). The models IndRNN-12 and IndRNN-15 stack layers in the similar way as IndRNN-9. Their difference is the number of IndRNN layers. IndRNN-12 uses 12 IndRNN layers, IndRNN-15 contains 15 IndRNN layers, and IndRNN-9 includes 9 IndRNN layers. The models AIndRNN-12 and AIndRNN-15 are achieved by inserting an attention layer separately before IndRNN-12 and IndRNN-15. The model ADIndRNN-(4,3) is constructed according to the architecture in Fig. 1 by using four dense blocks, each block containing three IndRNN layers. The model DIndRNN-(4,3), which contains four dense blocks with three IndRNN layers per block, is obtained by removing an attention layer from the model ADIndRNN-(4,3). Using the data segmentation method in Section IV-B, each one of the above six models is performed for ten rounds of CV tests based on their tuning-parameters feed backs. And then the average and standard deviation of ten testing results for each model are calculated and shown in Table V.
Compared to the results in Table IV, the accuracy for IndRNN-12 in Table V is a little better than that for IndRNN-9, and the accuracy for IndRNN-15 better than that for IndRNN-12; the performance of AIndRNN-12 is better than that of AIndRNN-9, and AIndRNN-15 better than AIndRNN-12. The accuracy of DIndRNN-(4,3) is close to that of DIndRNN-(3,3). The accuracy for ADIndRNN-(4,3) is a little better than that for AIndRNN-12, and equals to that of DIndRNN-(4,3). The comparisons indicate that, using more IndRNN layers can help improve the performance. However, the performances for the six models are not as good as the performance of the model ADIndRNN-(3,3). The reasons may be possibly two folds: One is that the data size of 1330 segments is not big enough to train a deeper neural network well; The other is that, the dense structure and the attention mechanism are more effective than using more layers for the seizure/nonseizure classification.
Vi Effects of Segment Lengths on Seizure/Nonseizure Classification
In this section, we will explore relationship between the segment length and the performance of classifying seizures/nonseizures.
Generally, seizures last for less than two minutes. We select 13 temporal lengths less than 2 min and separately use each length to segment EEG signals in CHB-MIT. Besides the length of 23s, other 12 lengths are 30s, 35s, 40s, 45s, 50s, 55s, 60s, 70s, 80s, 90s, 100s, and 110s, respectively. Their segmentation methods are similar to the case of 23s in Section IV-B. For each length, ten CV experiments are performed based on a group of tuned optimal parameters by using the model IndRNN-12. In the experiments for these 12 lengths, the tuned parameters mainly include the learning rate and the number of epochs, and the numbers of hidden states are set the same as in the case of 23s. The obtained CV results over the 12 different segment lengths are listed in Table VI. Visualizations of these experiment results are shown in Fig. 8. The abbreviation of Seg. Len. means segment length.
|Seg. Len.||Sens.||Spec.||F1 Score||Prec.||Acc.|
Fig. 8 shows that the relationship between the data segment lengths and the performances of seizure/nonseizure classification is not clear-cut. The classification performance does not always go up or go down as the segment length increases, and it fluctuates over the segment lengths. With six lengths, including 60s, 70s, 80s, 90s, 100s, and 110s, the performances manifest wide fluctuating margins. With six lengths of 23s, 30s, 35s, 40s, 45s, and 50s, the differences of performances are relatively small. The best performance is obtained with the segment length of 90s. For the three metrics of Sensitivity, Specificity and Precision, their maximal gaps are all more than 4%. For the F1 Score and Accuracy, the maximal differences are more than 3%. It can be seen that the influence of the segment length can not be overlooked for the seizue/nonseizure classification.
Different segment lengths result in different numbers of seizure segments and different amounts of seizure data in seizure segments. The amount of seizure data can be characterized by statistics, such as the average temporal length of seizure data per seizure segment and the percentage of segments with special seizure duration in all the seizure segments. The abbreviation of Num. Sei. Seg is for the number of seizure segments, Avg. Sei. Len. is for an average seizure duration per seizure segment, and Perc. Seg. Type- is for a percentage of Type- segments in all the seizure segments, . A Type-1 segment is a seizure segment in which the seizure duration is less than or equal to one quarter of segment length. A Type-2 segment is a seizure segment that its seizure duration is more than or equal to one half of segment length. A Type-3 segment is a seizure segment such that the seizure duration is more than or equal to three quarters of segment length. Generally, the four statistic values, including the number of seizure segments (abbrev., Num. Sei. Seg.), the average of seizure duration per seizure segment (abbrev., Avg. Sei. Len.), the percentage of Type-2 segments (abbrev., Perc. Seg. Type-2) and the percentage of Type-3 segments (abbrev., Perc. Seg. Type-3), are the greater, the performance of seizure/nonseizure classification is the better. And the percentage of Type-1 segments (abbrev., Perc. Seg. Type-1) is the smaller, the performance is the better. Actually, as the segment length increases, seizure segments decrease and the average of seizure duration per seizure segment increases. For our selected 13 segment lengths, the statistics of seizure data are presented in Table VII. Besides the changes in the number of seizure segments and the average of seizure length in Table VII, the percentage of Type-2 segments and that of Type-3 segments mostly decrease, and that of Type-1 segments increases in most cases. According to Fig. 8, the best trade-off is achieved with the segment length of 90s for the seizure/nonseizure classification. For the segment length of 90s, the average seizure duration is the largest, and the percentage of Type-1 segments is not large relatively, around one third of seizure segments.
|Seg. Len.||Num. Sei. Seg.||Avg. Sei. Len.||Perc. Seg. Type-1||Perc. Seg. Type-2||Perc. Seg. Type-3|
Keeping in mind a labor-intensive clinical practice that neurologists manually review off-line EEG data records for diagnosing epilepsy, we have developed an automatic approach of ADIndRNN to identify seizure segments and nonseizure segments. Each EEG data record is segmented into segments, and then the obtained segments are classified into two categories, seizure versus nonseizure. The classified seizure segments are provided to neurologists to make further analyses. For the task of classifying seizures/nonseizures to aid neurologists with off-line annotations, the metrics such as sensitivity, specificity and precision are more relevant than the metrics of false alarm rate and latency. So, we evaluate our proposed approach with five metrics, including sensitivity, specificity, F1 score, precision, and accuracy.
By integrating IndRNN with a dense structure and an attention mechanism, we propose the deep learning approach of ADIndRNN for the seizure/nonseizure classification. Our proposed approach outperforms the LSTM approach and the CNN approach with the improvements of at least 4%. IndRNN is a variant of RNN. It supports stacking multiple layers and can handle longer sequences than LSTM and RNN. The IndRNN layer extracts features from the forward direction. The dense structure is to ensure maximum information flow between layers, and the attention mechanism is used to extract spatial features. The validation results in Section V-B demonstrate that the dense structure and the attention mechanism have positive effects on the performance of our approach. In the development of the approach, a bidirectional structure of IndRNN layers is constructed in order to extract features in two directions. Our experiments show that the bidirectional structure of IndRNN is time-consuming in computation while the performance gain is marginal.
We utilize the attention mechanism to generate attention weights over channels instead of adopting direct training method. For the directly training way, parameters representing weights on channels are learned. After training, the learned weights are the same for all the data segments. In fact, one patient possibly experiences different seizure types. Seizures with different types may originate in different brain regions. And different patients may have different seizure patterns. The weights on channels, which describe the strengths of signifying seizures, need to change with seizure types and seizure patterns. So, without dwelling on the directly training method we choose to use the attention mechanism. In the attention mechanism, a kernel matrix and a bias matrix are obtained by training. The two trained matrices are combined with data segments to adaptively generate weights through transformations.
When segmenting EEG records, we attempt to ensure that the obtained data segments are close to a real-world scenario. A seizure segment could contain seizure data and nonseizure data. It is unrealistic in the real world that all the seizure segments only contain seizure data. As the LSTM approach and the CNN approach were evaluated over signals with duration of 23.6 seconds from Bonn EEG data set[17, 21], a segment length of 23s was selected for evaluating the proposed approach against the LSTM and CNN approaches.
In the exploration of relations between segment lengths and performances of classifying seizure/nonseizure, we adopt the model IndRNN-12. The choice is based on the following three considerations: (1) For models containing more IndRNN layers or attention layer or dense structure, more parameters need to be trained, while the number of seizure segments decreases as the segment length increases, which increases the over-fitting risk. (2) The model IndRNN-12 has relatively good results over the 23s segments, as shown in Table V. (3) The used model in the exploration needs to be kept the same for the 13 segment lengths.
This paper considers automatical classification of seizures/nonseizures for assisting neurologists in making epilepsy diagnosis. We propose a new approach of dense IndRNN with attention by integrating an emerging neural network model, IndRNN, with a densely connected structure and an attention mechanism. The IndRNN supports stacking multiple layers to capture seizure patterns, the dense structure ensures maximum information flow between layers, and the attention mechanism helps extract spatial features. Evaluations of our proposed approach are performed in CV experiments over the noisy data set of CHB-MIT. The obtained average sensitivity, specificity, F1 score, precision and accuracy are 88.80%, 88.60%, 88.71%, 88.69%, and 88.70%, respectively. These results exceed the LSTM approach and the CNN approach with an improvement of at least 4%. Additionally, we explore how the segment length affects the performance of seizure/nonseizure classification. Our CV experiments over 13 segment lengths indicate that the classification performance fluctuates over the segment lengths, with the maximal fluctuating margin being more than 4%. The segment length is thus an important factor influencing the seizure/nonseizure classification performance. As a future research line, we will further investigate how to use the dense IndRNN with attention for real-time seizure detection.
-  R. S. Fisher, W. V. E. Boas, W. Blume, C. Elger, P. Genton, P. Lee, et al., “Epileptic seizures and epilepsy: Definitions proposed by the international league against epilepsy (ILAE) and the international bureau for epilepsy (IBE),” Epilepsia, vol. 46, no. 4, pp. 470-472, 2005.
-  I. Megiddo, A. Colson, D. Chisholm, T. Dua, A. Nandi, R. Laxminarayan, “Health and economic benefits of public financing of epilepsy treatment in India: An agent-based simulation model,” Epilepsia, vol. 57, no. 3, pp. 464-474, Jan, 2016.
-  C. E. Elger, C. Hoppe, “Diagnostic challenges in epilepsy: Seizure under-reporting and seizure detection,” Lancet Neurol, vol. 17, no. 3, pp. 279-288, Mar. 2018.
-  J. Gotman, “Automatic recognition of epileptic seizures in the EEG,” Electroencephalography and Clinical Neurophysiology, vol. 54, no. 5, pp. 530-540, Nov. 1982.
-  P. Thodoroff, J. Pineau, A. Lim, “Learning robust features using deep learning for automatic seizure detection,” Journal of Machine Learning Research, vol. 56, pp. 178-190, 2016.
-  F. Fürbass, P. Ossenblok, M. Hartmann, et al., “Prospective multi-center study of an automatic online seizure detection system for epilepsy monitoring units,” Clinical Neurophysiology, vol. 126, no. 6, pp. 1124-1131, 2015.
-  A. S. Zandi, M. Javidan, G. A. Dumont, R. Tafreshi, “Automated real-time epileptic seizure detection in scalp EEG recordings using an algorithm based on wavelet packet transform,” IEEE Trans. Biomed. Eng., vol. 57, no. 7, pp. 1639-1651, Jun. 2010.
-  A. Shoeb, J. Guttag, “Application of machine learning to epileptic seizure detection,” in Proc. ICML2010, Haifa, Israel, 2010, pp. 975-982.
-  A. Shoeb, “Application of machine learning to epileptic seizure onset detection and treatment,” Ph. D. dissertation, Harward-MIT Division of Health Sciences and Technology, Massachusetts Institute of Technology, Cambridge, MA, USA, 2009.
-  S. Kiranyaz, T. Ince, M. Zabihi, D. Ince, “Automated patient-specific classification of long-term Electoencephalography,” Journal of Biomedical Informatics, vol. 49, pp. 16-31, Feb. 2014.
-  S. Amin, A. M. Kamboh, “A robust approach towards epileptic seizure detection,” in Proc. MLSP2016, Salerno, Italy, 2016, pp. 1-6.
-  B. Hunyadi, M. Signoretto, W. V. Paesschen, J. A. K. Suykens, S. V. Huffel, M. D. Vos, “Incorporating structural information from the multichannel EEG improves patient-specific seizure detection,” Clinical Neurophysiology, vol. 123, no. 12, pp. 2352-2361, Dec. 2012.
-  A. V. Esbroeck, L. Smith, Z. Syed, S. Singh, Z. Karam, “Multitask seizure detection: Addressing intra-patient variation in seizure morphologies,” Machine Learning, vol. 102, no. 3, pp. 309-321, Mar. 2016.
-  L. Vidyaratne, A. Glandon, M. Alam, K. M. Iftekharuddin, “Deep recurrent neural network for seizure detection,” in Proc. IJCNN2016, Vancouver, BC, Canada, 2016, pp. 1202-1207.
-  N. D. Truong, A. Nguyen, L. Kuhlmann, et al., “Integer convolutional neural network for seizure detection,” IEEE Journal on Emerging and Selected Topics in Circuits and Systems, vol. 8, no. 4, pp. 849-857, Dec. 2018.
-  M. Golmohammadi, S. Ziyabari, V. Shah, et al., “Gated recurrent networks for seizure detection,” in Proc. SPMB17, Philadelphia, PA, USA, 2017, pp. 1-5.
-  U. R. Acharya, S. L. Oh, Y. Hagiwara, J. H. Tan, H. Adeli, “Deep convolutional neural network for the automated detection and diagnosis of seizure using EEG signals,” Computers in Biology and Medicine, vol. 100, no. 1, pp. 270-278, Sep. 2018.
-  R. G. Andrzejak, K. Lehnertz, F. Mormann, C. Rieke, P. David, C. E. Elger, “Indications of nonlinear deterministic and finite-dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state,” Physical Review E, vol. 64, 061907, Nov. 2001.
-  S. Li, W. Li, C. Cook, C. Zhu, Y. Gao, “Independent recurrent neural network: Building a longer and deeper RNN,” in Proc. CVPR2018, Salt Lake City, UT, USA, 2018, pp. 5457-5466.
-  G. Huang, Z. Liu, L. Maaten, K. Q. Weinberger, “Densely connected convolutional networks,” in Proc. CVPR2017, Honolulu, HI, USA, 2017, pp.2261-2269.
-  R. Hussein, H. Palangi, R. Ward, Z. J. Wang, “Epileptic seizure detection: A deep learning approach,” 2018, arXiv:1803.09848.
-  P. Fergus, A. Hussain, D. Hignett, D. A. Jumeily, K. A. Aziz, H. Hamdan, “A machine learning system for automated whole-brain seizure detection,” Applied Computing and Informatics, vol. 12, no. 1, pp. 70-89, Jan. 2016.
-  N. Nicalaou, J. Georgiou, “Detection of epileptic electroencephalogram based on permutation entropy and support vector machines,” Expert Systems with Applications, vol. 39, no. 1, pp. 202-209, Jan. 2012.
-  A. Kharbouch, A. Shoeb, J. Guttag, S. S. Cash, “An algorithm for seizure onset detection using intracranial EEG,” Epilepsy & Behavior, vol. 22, no. 1, pp. S29-S35, Dec. 2011.
-  S. N. G. Bolagh, G. D. Clifford, “Subject selection on a Riemannian manifold for unsupervised cross-subject seizure detection,” 2017, arXiv:1712.00465.
-  A. H. Ansari, P. J. Cherian, A. Caicedo, G. Naulaers, M. Vos, S. V. Huffel, “Neonatal seizure detection using deep convolutional neural networks,” International Journal of Neural Systems, vol. 28, no. 0, 1850011, 2018.
-  U. R. Acharya, F. Molinari, S. V. Sree, S. Chattopadhyay, K.-H. Ng, J. S. Suri, “Automated diagnosis of epileptic EEG using entropies,” Biomedical Signal Processing and Control, vol. 7, no. 4, pp. 401-408, 2012.
-  W. Zhou, Y. Liu, Q. Yuan, X. Li, “Epileptic seizure detection using lacunarity and Bayesian linear discriminant analysis in intracranial EEG,” IEEE Trans. Biomed. Eng., vol. 60, no. 12, pp. 3375-3381, 2013.
-  M. Fan, C. Chou, “Detecting abnormal pattern of epileptic seizures via temporal synchronization of EEG signals,” IEEE Trans. Biomed. Eng., vol. 66, no. 3, pp. 601-608, 2019.
-  N. D. Truong, L. Kuhlmann, M. R. Bonyadi, J. Yang, “Supervised learning in automatic channel selection for epileptic seizure detection,” Expert Systems with Applications, vol. 86, pp. 199-207, 2017.
-  S. Ioffe, C. Szegedy, “Batch normalization: Accelerating deep network training by reducing internal covariate shift,” in Proc. ICML2015, Lille, France, 2015, pp. 448-456.