scieee AI-readable full text Open interactive document viewer

One Dimensional Convolutional Neural Networks for Seizure Onset Detection Using Long-term Scalp and Intracranial EEG

Wang, Xiaoshuang,Wang, Xiulin,Liu, Wenya,Chang, Zheng,Kärkkäinen, Tommi,Cong, Fengyu

Full text

This is a self-archived version of an original article. This version may differ from the original in pagination and typographic details. Author(s): Title: Year: Version: Copyright: Rights: Rights url: Please cite the original version: CC BY 4.0 https://creativecommons.org/licenses/by/4.0/ One Dimensional Convolutional Neural Networks for Seizure Onset Detection Using Long-term Scalp and Intracranial EEG © 2021 the Authors Published version Wang, Xiaoshuang; Wang, Xiulin; Liu, Wenya; Chang, Zheng; Kärkkäinen, Tommi; Cong, Fengyu Wang, X., Wang, X., Liu, W., Chang, Z., Kärkkäinen, T., & Cong, F. (2021). One Dimensional Convolutional Neural Networks for Seizure Onset Detection Using Long-term Scalp and Intracranial EEG. Neurocomputing, 459, 212-222. https://doi.org/10.1016/j.neucom.2021.06.048 2021 One dimensional convolutional neural networks for seizure onset detection using long-term scalp and intracranial EEG Xiaoshuang Wang a,b , Xiulin Wang a,b,c , Wenya Liu a,b , Zheng Chang b , Tommi Kärkkäinen b, ⇑ , Fengyu Cong a,b,d,e, ⇑ a School of Biomedical Engineering, Faculty of Electronic Information and Electrical Engineering, Dalian University of Technology, Dalian 116024, PR China b Faculty of Information Technology, University of Jyvaskyla, Jyvaskyla 40014, Finland c Department of Radiology, Affiliated Zhongshan Hospital of Dalian University, Dalian, PR China d School of Artificial Intelligence, Faculty of Electronic Information and Electrical Engineering, Dalian University of Technology, Dalian, 116024, PR China e Key Laboratory of Integrated Circuit and Biomedical Electronic System, Liaoning Province Dalian University of Technology, Dalian, PR China article info Article history: Received 22 February 2021 Revised 30 April 2021 Accepted 17 June 2021 Available online 20 June 2021 Communicated by Zidong Wang Keywords: Epilepsy Seizure detection Scalp electroencephalogram (sEEG) Intracranial electroencephalogram (iEEG) Convolutional neural networks (CNN) abstract Epileptic seizure detection using scalp electroencephalogram (sEEG) and intracranial electroencephalogram (iEEG) has attracted widespread attention in recent two decades. The accurate and rapid detection of seizures not only reflects the efficiency of the algorithm, but also greatly reduces the burden of manual detection during long-term electroencephalogram (EEG) recording. In this work, a stacked onedimensional convolutional neural network (1D-CNN) model combined with a random selection and data augmentation (RS-DA) strategy is proposed for seizure onset detection. Firstly, we segmented the longterm EEG signals using 2-s sliding windows. Then, the 2-s interictal and ictal segments were classified by the stacked 1D-CNN model. During model training, a RS-DA strategy was applied to solve the problem of sample imbalance, and the patient-specific model was trained with event-based K-fold (Kis the number of seizures per patient) cross validation for detecting all seizures of each patient. Finally, we evaluated the performances of the proposed approach in the two levels: the segment-based level and the event-based level. The proposed method was tested on two long-term EEG datasets: the CHB-MIT sEEG dataset and the SWEC-ETHZ iEEG dataset. For the CHB-MIT sEEG dataset, we achieved 88.14% sensitivity, 99.62% specificity and 99.54% accuracy in the segment-based level. From the perspective of the event-based level, 99.31% sensitivity, 0.2/h false detection rate (FDR) and mean 8.1-s latency were achieved. For the SWEC-ETHZ iEEG dataset, in the segment-based level, 90.09% sensitivity, 99.81% specificity and 99.73% accuracy were obtained. In the event-based level, 97.52% sensitivity, 0.07/h FDR and mean 13.2-s latency were attained. From these results, we can see that our method can effectively use both sEEG and iEEG data to detect epileptic seizures, and this may provide a reference for the clinical application of seizure onset detection. Ó2021 The Authors. Published by Elsevier B.V. This is an open access articleunder the CC BY license (http:// creativecommons.org/licenses/by/4.0/). 1. Introduction Epilepsy is a chronic neurological disease, which results from sudden abnormal and synchronous electrical activities of brain neurons. It has affected nearly 1% of the world’s population, and about 30% of people with epilepsy are resistant to antiepileptic drugs [1]. Electroencephalogram (EEG) has become an effective screening technique in diagnosing epilepsy. Since the manual detection of seizures by reviewing long-term and continuous EEG is a time-consuming and laborious task, the automated and timely detection of seizures can greatly improve diagnostic efficiency and reduce workload. EEG-based analysis for the automated detection of seizures has been widely explored in the last two decades. In the previous researches about EEG-based seizure detection, the short-term Bonn EEG dataset [2] and the long-term CHB-MIT scalp EEG (sEEG) dataset [3] were the two most commonly used datasets [4]. For the short-term Bonn EEG dataset, many conventional machine learning and deep learning methods, including Support Vector Machine (SVM) [5–7], Random Forest (RF) [8], K-Nearest Neighbor (KNN) [9,10], Artificial Neural Network (ANN) [11], Convolutional Neural https://doi.org/10.1016/j.neucom.2021.06.048 0925-2312/Ó2021 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/). ⇑ Corresponding authors at: Faculty of Information Technology, University of Jyvaskyla, Jyvaskyla 40014, Finland (T. Kärkkäinen); School of Biomedical Engineering, Faculty of Electronic Information and Electrical Engineering, Dalian University of Technology, Dalian 116024, PR China (F. Cong). E-mail addresses: [email protected] (T. Kärkkäinen), [email protected] (F. Cong). Neurocomputing 459 (2021) 212–222 Contents lists available at ScienceDirect Neurocomputing journal homepage: www.elsevier.com/locate/neucom Networks (CNN) [12–14] and Long-Short Term Memory (LSTM) [15], have been applied to analyze this dataset for seizure detection and obtained the accuracy ranging from 88.87% to 100%. Although these methods achieved high performances on the short-term Bonn EEG dataset, this benchmark clinical dataset was a small and special-selected dataset. As stated in [2], the short-term Bonn EEG dataset consisted of 500 single-channel EEG segments of 23.6s duration (200 sEEG segments and 300 intracranial EEG (iEEG) segments), and each segment was cut out from continuous EEG recordings after visual inspection. However, in the real world, the EEG recordings of people with epilepsy usually last from several hours to several weeks. Therefore, the analysis of long-term and continuous EEG data for seizure detection may have more practical significance. For the long-term CHB-MIT sEEG dataset (24 patients, about 916 h and 198 seizures), an overview of works is briefly introduced. In conventional machine learning methods, the studies [7,16] used SVM classifiers for seizure detection and achieved the sensitivity ranging from 96.81% to 97.34% and the specificity ranging from 97.26% to 97.50%. In [17], seven classifiers, including SVM, Ensemble, KNN, Linear Discriminant Analysis (LDA), Logistic Regression (LR), Decision Tree (DT) and Naive Bayes (NBs), combined with the strategy of channel selection were used for calssification, and the KNN finally achieved the highest accuracy of 84.8%. In [18], Alickovic et al. applied four classifiers (SVM, RF, Multilayer perceptron (MLP) and KNN) simultaneously to classify the feature samples that were extracted by Discrete Wavelet Transform (DWT), empirical mode decomposition (EMD) and wavelet packet decomposition (WPD), and an overall accuracy of 100% was finally achieved in ictal vs. interictal sEEG. However, only 1000 interictal, 1000 ictal and 1000 preictal 8-s segments were specially selected from the CHB-MIT sEEG dataset for the analysis of seizure detection, which greatly damaged the integrity of the data. Recently, several leading deep learning techniques, including CNN, LSTM and recurrent neural network (RNN), were also applied to the CHB-MIT sEEG dataset. In [19], 1D-CNN was used to classify the 4-s raw sEEG segments, and it achieved 66.76% sensitivity, 99.63% specificity and 99.07% accuracy. Hossain et al. applied a 7-layer two-dimensional convolutional neural network (2D-CNN) to classify the time-channel sEEG matrixes, and this approach obtained an overall sensitivity, specificity and accuracy of 90.00%, 91.65% and 98.05%, respectively [20]. Different from the 2D-CNN used in [20], Liang et al. achieved an accuracy of 99.00% by using a 2D-CNN-LSTM model for seizure detection. In this model, 2DCNN was used as the feature extraction model for learning the high-level representations of inputs. The outputs of 2D-CNN were then fed into LSTM for classification [21].In[22], a bidirectional LSTM (Bi-LSTM) network was utilized for the classification of 4-s sEEG epochs, and the method attained 93.61% sensitivity and 91.85% specificity. The RNN model was applied by Yao et al. for seizure detection, and it achieved the averaged sensitivity, specificity and accuracy of 88.80%, 88.60% and 88.69%, respectively [23]. As mentioned above, many conventional machine learning and deep learning methods have been applied to the CHB-MIT sEEG dataset for seizure detection, but many relevant studies only evaluated the performances in a segment-based level. In the segmentbased level, many studies concatenated all seizures of a patient into one seizure, and then the ictal segments cut from the concatenated seizure were used for classification, ignoring the detection of each seizure (the event-based level). From the perspective of the detection of a seizure or in the event-based level, when detecting seizures during long-term EEG recoding, an excellent system should alarm accurately with short latency and low false detection rate (FDR). Therefore, both levels (the segment-based level and the event-based level) should be evaluated simultaneously in the analysis of long-term EEG recordings for seizure detection. In this paper, the long-term sEEG and iEEG recordings are analyzed for the detection of seizures. In the long-term EEG recordings, most of the EEG recordings are in the interictal stage, while the time duration of a seizure usually ranges from tens of seconds to several minutes. Consequently, the problem of sample imbalance should be considered and properly resolved in the analysis of the long-term EEG recodings. The novelty and main contributions of this paper are summarized as follows: Two long-term datasets, the CHB-MIT sEEG dataset and the SWEC-ETHZ iEEG dataset [24], are analyzed in this paper. Therefore, the effectiveness of the proposed method in seizure detection is tested with two different datasets, sEEG and iEEG. A stacked 1D-CNN model is proposed in this study. Two different parallel 1D-CNNs with different calculation sizes are used to learn the high-level representations simultaneously. Then, the diverse features of these two 1D-CNNs are concatenated for classification. Since sample imbalance is a key problem in the long-term EEG recordings, a random selection and data augmentation (RS-DA) strategy is proposed to balance samples during the model training phase. To better evaluate the performances of the proposed method, we evaluate the classification results for each patient in the two levels: the segment-based level and the event-based level. In the segment-based level, sensitivity, specificity and accuracy are calculated. In the event-based level, we calculate the sensitivity, FDR and latency (time duration from the onset of a seizure to its detection). The remaining of this paper is organized as follows: Section 2 describes the materials and the proposed method. Results are showed in Section 3. Discussion and conclusion are given in Section 4and Section 5, respectively. 2. Materials and methods In this section, we first describe two long-term EEG datasets (the sEEG dataset and the iEEG dataset). Then, we present the proposed method including preprocessing, CNN model, model training and system evaluation. 2.1. Data preparation The CHB-MIT sEEG dataset (https://archive.physionet.org/physiobank/database/chbmit/)[3] and the SWEC-ETHZ iEEG dataset (https://ieeg-swez.ethz.ch)[24] were used for the analysis of seizure detection. The CHB-MIT sEEG dataset consists of 916 h of sEEG and 198 seizures. The sEEG recordings from 24 patients are recorded at a sampling rate of 256 Hz, and most of recordings contain 23 channels [3]. In this study, 24 h of interictal sEEG data (all if less than 24 h) were selected for each patient. The selection criteria of seizures were as follows: (1) If the time interval between two seizures was short (less than 20 min), the two seizures were concatenated into one seizure, (2) A concatenated seizure or a raw seizure lasting more than 10 s was chosen, and so seizures which lasted less than 10 s were not considered. The details of the selected sEEG signals were summarized in Table 1. In the SWEC-ETHZ iEEG dataset, it contains 2565 h of iEEG and 116 leading seizures from 18 patients. The sampling rate is 512 or 1024 Hz, and the number of iEEG channels ranges from 24 to 128. X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 213 More details of this dataset can be found in [24]. For this dataset, we also selected 24 h of interictal iEEG for each patient. The selection criteria for seizures were the same as described in the CHBMIT sEEG dataset. Then, the selected iEEG signals were uniformly down-sampled to 256 Hz (same sampling rate as the CHB-MIT sEEG dataset). We summarized the details of the selected iEEG signals in Table 2. 2.2. Methodology 2.2.1. Preprocessing Before training and testing the proposed model, we need to generate a certain number of samples. In the preprocessing, 2-s sliding windows were applied to segment the long-term EEG signals (as shown in Fig. 1). Since a seizure lasted from tens of seconds to several minutes (as shown in Tables 1 and 2), the size of 2-s ictal segments was very small. In order to generate more ictal segments, 2-s sliding windows with the corresponding overlap ratio were used to segment the raw ictal EEG signals only during the model training phase. The overlap ratio ranged from 0.75 to 0.9 (depending on the number and the time duration of seizures). For example, the ictal segments from patients 6 and 16 in Table 1 and patient 5 in Table 2 were obtained with the overlap ratio of 0.9, while the ictal segments from patient 15 in Table 1 and patient 1 in Table 2 were attained with the overlap ratio of 0.75. In obtaining 2-s interictal segments, we used 2-s sliding windows without overlap. The preprocessing in obtaining the segments of interictal and ictal signals is illustrated in Fig. 1. Due to the sampling rate of 256 Hz, one 2-s EEG segment can be regarded as a matrix of n512, where nis the number of channels of each patient, and 512 is the number of sampling points. In this study, the 2-s EEG segments were used as the direct inputs of the proposed 1D-CNN model. 2.2.2. Convolutional neural networks (CNN) CNN is generally composed of convolutional layers, pooling layers and fully connected layers. A convolutional layer contains a certain number of convolution kernels and performs convolution calculations on the input signals. The convolution results are then nonlinearized by activation functions. In our 1D-CNN model, the rectified linear activation unit (ReLU) was used in convolutional layers. The pooling layer is also called the down-sampling layer, which performs pooling operations on the outputs of the convolutional layer to preserve higher-level representations. Pooling processes including maximum pooling and global average pooling were used in our model. After the signals pass through convolutional layers and pooling layers, the high-level features are usually fed into fully connected layers for the final classification. In this work, a stacked 1D-CNN model was proposed for seizure detection. As shown in Fig. 2, it has two parallel blocks, and the EEG segments are sent to both blocks at the same time. The two blocks are named Block 1 and Block 2, respectively. The Block 1 contains three convolutional blocks. The first convolutional block consists of a convolutional layer (32 kernels with the size of n3 and the stride of 2, where nis the number of channels), a batch normalization (BN) layer and a max-pooling (MP) layer (the pooling size of 3 and the stride of 1). In the second convolutional block, it includes a convolutional layer with 64 kernels (the size of 3 and the stride of 2), a BN layer and a MP layer with the pooling size of 3 and the stride of 1. The third convolutional block also contains a convolutional layer (128 kernels with the size of 3 and stride of 1), a BN layer and a MP layer with the pooling size of 3 and the stride of 1. The structure of the Block 2 is the same as that of the Block 1, and the only difference is the size of convolution kernels in the first and second convolution layers. In the Block 2, the kernel sizes of these two layers are n5 and 5, respectively. At the end of the Block 1 and the Block 2, the learned high-level representations are concatenated. Then, the concatenated features are globally averaged as the inputs of two fully connected layers. The first fully Table 1 Details of the selected sEEG singals from the CHB-MIT sEEG dataset. Patient # Channels Interictal (h) # Seizures mean ± std (s) ⁄ 1 23 24 7 63 ± 30 2 23 24 3 57 ± 41 323 24 7 57±8 4 23 24 4 94 ± 31 5 23 24 5 111 ± 9 623 24 10 15±3 7 23 24 3 108 ± 30 8 23 15 5 184 ± 49 923 24 3 68±9 10 23 24 7 64 ± 17 11 23 24 3 268 ± 418 12 23 12 10 96 ± 69 13 18 24 8 67 ± 55 14 23 19 7 24 ± 12 15 24 24 14 142 ± 98 16 18 13 6 14 ± 9 17 23 18 3 98 ± 15 18 23 24 5 63 ± 13 19 23 24 3 79 ± 2 20 23 23.3 6 49 ± 22 21 23 24 4 50 ± 28 22 23 24 3 68 ± 9 23 23 23 5 85 ± 60 24 23 12.3 14 36 ± 23 Total 518.6 145 ⁄ Mean and standard deviation of the time duration of seizures per patient. Table 2 Details of the selected iEEG signals from the SWEC-ETHZ iEEG dataset. Patient # Channels Interictal (h) # Seizures mean ± std (s) 1 88 24 2 601 ± 17 266 24 2 88±2 364 24 4 64±4 432 24 14 41±14 5 128 24 4 16 ± 1 6 32 24 8 45 ± 33 7 75 24 4 69 ± 38 8 61 24 7 219 ± 176 948 24 17 67±47 10 32 24 16 75 ± 21 11 32 24 2 91 ± 11 12 56 24 9 146 ± 33 13 64 24 7 102 ± 61 14 24 24 16 96 ± 39 15 98 24 2 94 ± 35 16 34 24 5 190 ± 51 17 60 24 2 97 ± 1 18 42 24 5 199 ± 100 Total 432 126 Fig. 1. For interictal EEG signals, we used 2-s sliding windows without overlap. For ictal EEG signals which were selected as the training set, we used 2-s sliding windows with the corresponding overlap ratio (0.75–0.9). X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 214 connected layer has 128 neurons with ReLU function. The second fully connected layer is the output layer with 2 neurons with Softmax function. According to the 1D-CNN model, the number of calculation parameters and the output shape in each layer are summarized in Table 3. For the outputs from the stacked 1D-CNN model, a simple postprocessing was performed for accurately detecting a seizure and sounding an alarm (as shown in Fig. 2). In order to sound an alarm accurately and reliably, it must meet a condition that Lconsecutive detection labels were positive. The value of Lranged from 2 to 5, and the final Lvalue was determined according to the classification results. In theory, when the Lvalue increases, the FDR decreases and the latency of an alarm becomes longer. To avoid unnecessary repeated alarms, we should set the minimum time interval (MTI) between two alarms. In this work, the averaged time duration of seizures of each patient was set as the MTI between two alarms for each patient. Therefore, when the first alarm sounded, in the following MTI, the second alarm was prohibited. 2.2.3. Model training The patient-specific model was trained for each patient. For detecting all seizures of each patient, the approach of eventbased K-fold cross validation was used, where Kwas the number of seizures per patient. If a subject has Kseizures, the model training is performed Krounds. In each round, (K-1) seizures are selected for training, and the remaining one is used for testing (as shown in Fig. 3). Since the time duration of interictal EEG is about 50 to 1300 times longer than that of ictal EEG among different patients (as shown in Tables 1 and 2), the sample imbalance is a key problem in this work. In order to solve the problem during model training, we proposed a RS-DA strategy. As shown in Fig. 3, we augmented (K-1) ictal seizures by using the oversampling technique mentioned in the preprocessing (Section 2.2.1). However, the size of the augmented ictal segments was still much smaller than that of interictal segments. Therefore, the random selection was performed on interictal segments. We first divided interictal segments into Kequal parts. Then, an equal number of interictal segments were randomly selected from (K-1) parts to make the size of the selected interictal segments equal to that of the augmented ictal segments. Finally, the selected interictal segments and the augmented ictal segments were used to train (80%) and monitor (20%) the model during model training. The remaining segments (one interictal part and one seizure) were used to evaluate the trained model. Through this way, all interictal segments and seizures could be tested without repetition after Krounds. During model training, the Early-Stopping technique was also used to prevent overfitting, and the dropout rate of the second fully connected layer was set to 0.25. Based on Keras 2.3.1 with Tensorflow-1.15.0 backend, our model was implemented in Python 3.6, and one Nvidia Tesla P100 GPU was configured to run the proposed model. 2.2.4. System evaluation We evaluated the performances of the proposed method in the two levels: the segment-based level and the event-based level. Segment-based level In the segment-based level, sensitivity, specificity and accuracy were calculated to evaluate the classification of EEG segments. The three metrics can be expressed as follows: Sensiti v ity ¼TP TP þFN ð1Þ Specificity ¼TN TN þFP ð2Þ Table 3 In the proposed 1D-CNN model, the number of calculation parameters and the output shape in each layer are summarized as below. fnis the size of the input matrix, where fis equal to 512, and n(18 to 128) is the number of EEG channels. Layer and type Output shape # Parameters Input fn0 2 * Conv a 2*(f/2 32) 4672–32832 b 2 * (BN + MP) a 2*(f/2 32) 256 2 * Conv 2 * (f/4 64) 16512 2 * (BN + MP) 2 * (f/4 64) 512 2 * Conv 2 * (f/4 128) 49408 2 * (BN + MP) 2 * (f/4 128) 1024 GAP 256 0 Dense 128 32896 Dense 2 258 Total 105538–133698 a Two parallel layers. b The number is related to the value of n(18 to 128). Fig. 2. A stacked 1D-CNN model was proposed for seizure detection. M@nk 1 or M@k 2 :Mis the number of kernels, nk 1 and k 2 are the sizes of convolutional kernels. Abbreviations: Conv, convolution; BN, batch normalization; MP, maxpooling; s 1 , pooling size; s 2 , stride; GAP, global average pooling; FC, fully connected. Lis the number of consecutive detection labels for an alarm. X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 215 Accuracy ¼TP þTN TP þFN þTN þFP ð3Þ where TP is true positive, indicating the number of true detected ictal segments from ictal segments; FN is false negative, indicating the number of ictal segments which are wrongly classified as interictal segments; TN is true negative, indicating the number of true detected interictal segments from interictal segments; FP is false positive, indicating the number of interictal segments which are wrongly classified as ictal segments. Sensitivity is the percentage of true detected ictal segments to total ictal segments, and specificity is the percentage of true detected interictal segments to total interictal segments. An excellent classifier should have high sensitivity and specificity at the same time. Event-based level In the event-based level, we calculated the three metrics: sensitivity, FDR and latency. Sensitivity and FDR can be expressed by the following two formulas: Sensiti v ity ¼number of correctly detected seizures number of all seizures ð4Þ FDR ¼number of incorrect detections hours of interictal EEG :ð5Þ Latency is the time duration between the onset of a seizure and its detection. Fig. 4 shows an example of a false detection, a correct detection and its latency. An outstanding system should have high sensitivity with short latency and low FDR. 3. Results The results from the CHB-MIT sEEG dataset and the SWEC-ETHZ iEEG dataset are given in this section. The performances of the proposed method are evaluated in the two levels at the same time. In the segment-based level, the averaged results (sensitivity, specificity and accuracy) are calculated for each patient. In the eventbased level, the sensitivity, the FDR and the averaged latency of an alarm are calculated. 3.1. Results of CHB-MIT sEEG dataset Table 4 shows the results of each patient in the two levels after event-based K-fold cross validation. As shown in Table 4, in the segment-based level, the overall sensitivity, specificity and accuracy are 88.14%, 99.62% and 99.54%, respectively. The accuracy of most patients (except patients 8, 12, 13 and 24) is higher than 99%, and that of all patients is higher than 98%. In the eventbased level, 144 out of 145 seizures (except one seizure of patient 16) are accurately detected, with a sensitivity of 99.31%. The overFig. 3. Event-based K-fold cross validation combined with a RS-DA strategy is applied during model training. If a subject has Kseizures, the model training is performed K rounds. In each round, one seizure and one interictal part are used as the testing sets, and the remaining (K-1) seizures and (K-1) interictal parts are used as the training sets. After Krounds, all seizures and interictal EEG can be tested without repetition. X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 216 all FDR is 0.2/h, and 7 patients (2, 4, 5, 10, 11, 14 and 19) have a FDR of 0/h. The overall latency is 8.1 s, and the patient 22 has the longest averaged latency of 14.7 s. The value of Lis related to sensitivity, FDR and latency in the event-based level. We also calculate these three metrics under different Lvalues. In this work, the value of Lranges from 2 to 5. As shown in Fig. 5(a), we can see that, as the value of Lincreases, the overall sensitivity and FDR show a decreasing trend, but the overall latency of an alarm shows an increasing trend. When the value of Lis 5, the overall sensitivity and FDR are the lowest (93.53% and 0.04/h, respectively), and the overall latency is the longest, at 13 s. 3.2. Results of SWEC-ETHZ iEEG dataset Based on the analysis of the SWEC-ETHZ iEEG dataset, Table 5 also gives the results of each patient in the two levels after event-based K-fold cross validation. In the segment-based level, the overall sensitivity of 90.09%, specificity of 99.81% and accuracy of 99.73% are achieved. The accuracy of all patients is higher than 99%. In the event-based level, 123 out of 126 seizures (except one seizure in patients 4, 6 and 7) are correctly detected, and its sensitivity is 97.52%. The low overall FDR is 0.07/h, and the FDR of 10 patients (1, 6 and 9 to 16) is 0/h. The overall latency of an alarm is 13.2 s, and the longest averaged latency is 52.3 s for patient 8. The overall sensitivity, FDR and latency with different Lvalues are also calculated in the event-based level. In Fig. 5 (b), as the L value increases from 2 to 5, the sensitivity and FDR also show a general downward trend, but the overall latency has a upward trend. When the Lvalue is equal to 4 or 5, the overall sensitivity and FDR are the lowest, at 96.41% and 0.02/h, respectively. The longest overall latency is 18.1 s when the Lvalue is 5. 4. Discussion In this work, we proposed a stacked 1D-CNN model combined with the RS-DA strategy for seizure detection. The details of previous studies and this work, including the number of patients, processing and the corresponding metrics were summarized in Table 6 (the segment-based level) and Table 7 (the event-based level). Since the long-term SWEC-ETHZ iEEG dataset was available from 2019[24], we compared the results only based on the CHBMIT sEEG dataset. As shown in Table 6, the conventional machine learning methods, including LDA [25], Extreme Learning Machine (ELM) [26], SVM [7,16,27],RF[28], ANN [29] and KNN [17,30], were appiled for seizure detection. The accuracy obtained by these methods ranged from 84.8% to 99.41 %, and the highest accurcy of 99.41% was achived by the RF in [28]. The deep learning methods, such as CNN [19,20,31–33], autoencoders [34–37], LSTM [21,22] and RNN [23], achieved the accuracy ranging from 84.00 % to 99.33%, and the stacked 2D-CNN used in [33] attained the highest accuracy of 99.33%. In this work, the proposed approach achieved the accuracy of 99.54% and 99.73% for the CHB-MIT sEEG dataset and the SWECETHZ iEEG dataset, respectively. Therefore, from the perspective of the accuracy, the performance of our method was better than that of most previous studies in Table 6, and this proved that the proposed stacked 1D-CNN was effective. From the perspective of the sensitivity (in the segment-based level), although the studies [7,16] attained higher sensitivities at 96.81% and 97.34%, respectively, the time-consuming and complex feature extraction and selection engineering was applied. The other three studies [28,30,32] achieved the high sensitivity of 97.91%, 96.66% and 98.84%, respectively, but one reason for the high sensitivity was that it used the oversampling technique to generate more ictal samples for classification. Because of the overlapping information between these augmented ictal samples, in some sense, their classification was a repeated classification of similar samples. Therefore, in [28,32,30], the high sensitivity was overestimated. Different from the studies [28,32,30], in our work, the oversampling technique was only used during the model training phase, and the ictal samples that were selected as the testing set were obtained without oversampling. In fact, the number of raw ictal samples is small (it can be seen from Tables 1 and 2 minimal amount of misclassification can greatly reduce the sensitivity. Hence, as shown in Table 6, the 88.14% sensitivity of our work was relatively high. In the event-based level, the results of this work and previous studies using the CHB-MIT sEEG dataset were summarized in Table 7. The threshold method [38] and the conventional machine learning methods including SVM [3,16,39], Neural Network Classifier based on Improved Particle Swarm Optimization (IPSONN) [40], Relevance Vector Machine (RVM) [41] and Adaptive Distance-based Change-point Detector (ADCD) [42] were applied for the detection of seizures. These methods achieved the sensitivity of 88.5% to 98.47% and the FDR of 0.08/h to 0.63/h, and the highest sensitivity of 98.47% was obtained using an SVM group with ten SVMs in [16]. Deep learning methods, including CNN [31,43], Deep Recurrent Neural Network (DRNN) [44] and AE [45], were used to analyze the same dataset for seizure detection, and the sensitivity ranging from 86.29% to 100% and the FDR ranging from 0.08/h to 0.74/h were achieved. Our method also showed the high performances: (1) the sensitivity of 99.31% and the FDR of 0.2/h for the CHB-MIT sEEG dataset; (2) 97.52% sensitivity and 0.07/h FDR for the SWEC-ETHZ iEEG dataset. Hence, under the event-based level, our method also performed better than most of the methods in Table 7. In [44], a sensitivity of 100% was attained, but only 5 out of 24 patients were used for the detection of seizures. The detection of seizures with short latency (less than 20 s) can early eliminate symptoms of the seizures [46,47]. Although the averaged latencies (8.1 s and 13.2 s) of the CHB-MIT and the ETHZ-SWEC EEG datasets were slightly longer than those in Table 7, they were still in the acceptable range. Fig. 4. Event-based level: the example of a false detection, a correct detection and its latency. X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 217 As the results shown in Tables 6 and 7, our method showed high performances in the two levels, and it performed better than most of the methods in Tables 6 and 7. Moreover, the proposed method was effective for both datasets, the sEEG and the iEEG. According to our work, there are several highlights that need to be emphasized. Firstly, a 1D-CNN model is used in this study, which can be directly applied for the classification of raw EEG signals without additional preprocessing of EEG signals, such as frequency domain analysis and time–frequency domain analysis. Secondly, in order to obtain more different high-level representations for a better classification, we proposed a stacked 1D-CNN model consisting of two parallel 1D-CNN blocks. The two parallel 1D-CNN blocks with different calculation sizes can learn different high-level representations at the same time, and the diverse features of these two 1D-CNN blocks are then concatenated for the further analysis. Thirdly, the RS-DA strategy is first utilized to solve the problem of sample imbalance during model training. Table 4 In the CHB-MIT sEEG dataset, results of each patient are given in the two levels. L= 3 is finally selected for the event-based level. Patient # Seizures K-Fold Segment-based level Event-based level Sen 1 (%) Spe (%) Acc (%) Sen 2 (%) FDR (/h) Lat (s) 1 7 98.00 99.82 99.81 100 0.04 6.3 2 3 91.73 99.90 99.88 100 0 8.7 3 7 99.00 99.84 99.84 100 0.08 6.3 4 4 85.89 99.78 99.73 100 0 8 5 5 97.05 99.91 99.89 100 0 7.2 6 10 86.46 99.73 99.71 100 0.04 8 7 3 92.65 99.93 99.89 100 0.04 7.3 8 5 91.99 98.91 98.77 100 0.6 7.6 9 3 95.10 99.91 99.90 100 0.08 8 10 7 92.45 99.88 99.84 100 0 6.3 11 3 99.02 99.92 99.90 100 0 6 12 10 81.06 98.69 98.17 100 1.42 10 13 8 76.41 99.09 98.92 100 0.79 9.8 14 7 70.16 99.46 99.39 100 0 8.6 15 14 94.98 99.36 99.25 100 0.33 7.7 16 6 69.96 99.56 99.50 83.33 0.08 7.6 17 3 85.02 99.61 99.55 100 0.17 8 18 5 81.15 99.65 99.58 100 0.17 7.6 19 3 92.31 99.91 99.89 100 0 6 20 6 82.58 99.64 99.59 100 0.17 9.7 21 4 97.48 99.66 99.65 100 0.17 6 22 3 89.94 99.95 99.93 100 0.04 14.7 23 5 96.53 99.62 99.59 100 0.61 6 24 14 68.43 99.19 98.82 100 0.08 12.6 Total 145 88.14 99.62 99.54 99.31 0.20 8.1 Abbreviations: Sen 1 , segment-based sensitivity; Spe, specificity; Acc, accuracy; Sen 2 , event-based sensitivity; FDR, false detection rate; Lat, latency. Fig. 5. In the event-based level, the value of Lranges from 2 to 5. (a) For the CHB-MIT sEEG dataset, the overall sensitivity, FDR and latency are showed. (b) For the SWECETHZ iEEG dataset, the overall sensitivity, FDR and latency are showed. L= 3 is finally selected for the event-based level in this work. X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 218 However, one limitation of this study is that only a 1D-CNN model is applied. Other deep learning models, such as 2D-CNN and LSTM, combined with the RS-DA strategy can also be applied to the same datasets for more detailed comparisons. Another limitation is that we ignore the use of epilepsy-related EEG features for seizure detection. The EEG features, including statistical parameters, frequency or time–frequency domain features, entropies, etc., can be extracted and incorporated as the input to the 1DCNN model. By this method, it may improve the results of seizure detection. In the future work, this highlight can be further analyzed and discussed. 5. Conclusion In this paper, we presented a stacked 1D-CNN model for the detection of seizure onset. In this model, two parallel 1D-CNN blocks with different calculation sizes were used to learn the high-level representations of the EEG inputs simultaneously. The outputs of these two parallel 1D-CNN blocks were then concatenated for the final classification. Since the sample imbalance was a key issue in the long-term epileptic EEG recordings, a RS-DA strategy combined with the event-based K-fold cross validation was proposed for balancing samples during model training. In this Table 5 In the SWEC-ETHZ iEEG dataset, results of each patient are given in the two levels. L= 3 is finally selected for the event-based level. Patient # Seizures K-Fold Segment-based level Event-based level Sen 1 (%) Spe (%) Acc (%) Sen 2 (%) FDR (/h) Lat (s) 1 2 93.59 99.94 99.85 100 0 10 2 2 97.67 99.86 99.85 100 0.13 9 3 4 100 99.88 99.88 100 0.17 6 4 14 75.56 99.31 99.19 92.86 0.13 12.8 5 4 100 99.67 99.67 100 0.33 6 6 8 81.61 99.96 99.80 87.50 0 6.6 7 4 70.53 99.89 99.84 75.00 0.04 14 8 7 78.93 99.53 99.04 100 0.04 52.3 9 17 98.64 99.84 99.83 100 0 7.3 10 16 96.44 99.95 99.89 100 0 6.9 11 2 100 99.99 99.99 100 0 6 12 9 97.04 99.80 99.77 100 0 9.6 13 7 86.55 99.85 99.78 100 0 11.4 14 16 94.87 99.61 99.49 100 0 6.8 15 2 94.52 99.98 99.97 100 0 14 16 5 96.44 99.94 99.90 100 0 13.2 17 2 85.57 99.81 99.78 100 0.17 22 18 5 73.70 99.68 99.53 100 0.21 24.4 Total 126 90.09 99.81 99.73 97.52 0.07 13.2 Table 6 Segment-based level: list of previous studies and this work using the CHB-MIT sEEG dataset for seizure detection. Author Year Dataset Processing # Patients Sen (%) Spe (%) Acc (%) Khan et al. [25] 2012 CHB-MIT Multiple wavelet scales + LDA 5 83.6 100.0 91.8 Ammar et al. [26] 2016 CHB-MIT DWT + ELM 3 – – 94.85 Janjarasjitt et al. [27] 2017 CHB-MIT Wavelet based features + SVM 24 72.99 98.13 96.87 Yuan et al. [34] 2017 CHB-MIT STFT + SSDA 9 – – 93.82 Bhattacharyya et al. [28] 2017 CHB-MIT Channel selection, EWT + RF 23 (177 h) 97.91 99.57 99.41 Yuan et al. [35] 2018 CHB-MIT STFT, ChannelAtt + SSDA 9 – – 96.61 Wen et al. [36] 2018 CHB-MIT Channel selection + CNN-AE 24 – – 92 Boonyakitanont et al. [19] 2019 CHB-MIT DWT, feature extraction, normalization + 1D-CNN 24 records + 66.76 99.63 99.07 Yuan et al. [37] 2019 CHB-MIT Data augmentation, STFT + CNN-AE 24 – – 94.37 Hossain et al. [20] 2019 CHB-MIT 2D array (time * channels) + 2D-CNN 23 90.00 91.65 98.05 Liang et al. [21] 2019 CHB-MIT 2D array (time * channels) + 2D-CNN-LSTM 24 84.00 99.00 99.00 Wei et al. [31] 2019 CHB-MIT MIDS, WGANs + 1D-CNN 24 72.11 95.89 84.00 Tian et al. [32] 2019 CHB-MIT Oversampling, FFT, WPD + 2D-CNN, 3D-CNN 24 96.66 99.14 98.33 Yao et al. [23] 2019 CHB-MIT Windowing + IndRNN 24 88.80 88.60 88.69 Cao et al. [33] 2019 CHB-MIT STFT, MAS, AWF + S-2D-CNN 24 – – 99.33 Zabihi et al. [29] 2020 CHB-MIT Phase space, nullcline + LDA-ANN 23 (171 h) 91.15 95.16 95.11 Li et al. [30] 2020 CHB-MIT Channel selection, NMD, FCM, + KNN 24 98.40 99.01 98.61 Hu et al. [22] 2020 CHB-MIT LMD, statistical feature extraction + Bi-LSTM 24 93.61 91.85 – Zarei et al. [7] 2021 CHB-MIT OMP, DWT, Non-linear features + SVM 23 96.81 97.26 97.09 Li et al. [16] 2021 CHB-MIT EMD, CSP + an SVM group consisting of ten SVMs 24 97.34 97.50 97.49 Shoka et al. [17] 2021 CHB-MIT Variance channel selection + KNN 23 – – 84.8 This work 2021 CHB-MIT 2D array (time * channels), RS-DA strategy + S-1D-CNN 24 88.14 99.62 99.54 This work 2021 SWEC-ETHZ 2D array (time * channels), RS-DA strategy + S-1D-CNN 18 90.09 99.81 99.73 STFT, short-time Fourier transform; SSDA, stacked sparse denoising autoencoders; EWT, empirical wavelet transform; ChannelAtt, channel-aware attention mechanism; CNN-AE, convolutional autoencoder; MIDS, merger of the increasing and decreasing sequences; WAGNs, wasserstein generative adversarial nets; FFT, fast Fourier transform; 3D-CNN, three-dimensional CNN; IndRNN, independently RNN; MAS, mean amplitude of spectrum map; AWF, adaptive and discriminative feature weighting fusion; S-2DCNN, stacked 2D-CNN; S-1D-CNN, stacked 1D-CNN; NMD, nonlinear mode decomposition; FCM, fractional central moment; LMD, local mean decomposition; OMP, orthogonal matching pursuit; CSP, common spatial pattern. + The CHB-MIT sEEG dataset contains a total of 686 records, while one record of each patient is selected. X. Wang, X. Wang, W. Liu et al. Neurocomputing 459 (2021) 212–222 219