# DWT-Net: Seizure Detection System with Structured EEG Montage and Multiple Feature Extractor in Convolution Neural Network

Authors: Zhe Zhang; Yun Ren; Nabil Sabor; Jing Pan; Xiaona Luo; Yongfu Li; Yucai Chen; Guoxing Wang
Journal: Journal of Sensors
 (2020)

---

## Abstract

Automated seizure detection system based on electroencephalograms (EEG) is an interdisciplinary research problem between computer science and neuroscience. Epileptic seizure affects 1% of the worldwide population and can lead to severe long-term harm to safety and life quality. The automation of seizure detection can greatly improve the treatment of patients. In this work, we propose a neural network model to extract features from EEG signals with a method of arranging the dimension of feature extraction inspired by the traditional method of neurologists. A postprocessor is used to improve the output of the classifier. The result of our seizure detection system on the TUSZ dataset reaches a false alarm rate of 12 per 24 hours with a sensitivity of 59%, which approaches the performance of average human detector based on qEEG tools.


---

## Body

## 1. Introduction

Electroencephalograph (EEG) recording refers to the measurement of electrical activity resulting from postsynaptic potentials within the brain [1]. The EEG analysis is used for diagnosing neural dysfunction, such as epileptic seizure, cerebrovascular disease, and brain tumor. With the fast development in data science and machine/deep learning techniques of past decades, automated EEG analysis has great potential in bringing forward an attractive advancement in accuracy and efficiency of diagnosis and treatment of neural dysfunctions [1].The basic requirement for treatment in different kinds of epilepsy is to identify epileptic seizure features from EEG signals. The equipment for EEG signal acquisition systems is relatively inexpensive; however, the cost for training or hiring a certified neurologist to read and report EEG data is considerably much higher [2]. At the moment, the interpretation of EEG recordings depends heavily on the judgment of neurologists [3]. It is also time-consuming and tedious to perform 24/7 EEG monitoring to avoid missing epileptic cases [4]. Moreover, the nonstationary nature [5] of EEG and artifacts provides both interrater and intrarater disagreements that degrade diagnosis validity [6]. An automated EEG diagnostic system that provides effective, subjective, and accurate seizure detection is thus needed.The problem of automatic seizure detection can be divided into two main steps, feature extraction and classifier training. Considerable amounts of works have been done with this two-step procedure for better detection accuracy, including time-frequency feature map with a support vector machine (SVM) [3, 7], nonlinear features with different types of classifiers [5, 8, 9], and features based on time-frequency image with image recognition methods [10, 11]. These researches have provided different methodologies for seizure detection. However, since these works have only been validated on datasets with less than 25 patients [3], additional verifications are required to validate their methods on a larger dataset. Additional signal processing techniques might be required to fine-tune their methods for practical usage. Recently, an increasing number of researchers start to utilize neural network (NN) methods due to its inherent automatic feature extraction characteristics [12–14]. San-segundo et al. analyzed the use of deep neural network for epileptic EEG signal classification with different inputs and suggested empirical mode decomposition for better performance in focal versus nonfocal classification and Fourier transform for seizure detection [15]. Tsiouris et al. presented the long short-term memory (LSTM) method in seizure detection using EEG signals, expanding the use of traditional deep learning algorithms in this field [16]. However, a common problem of these NN methods is that few of them take advantage of existing neurological knowledge to improve the model’s accuracy and converge speed.Controlling of feature extraction provides us with the method to apply neurological knowledge to the model. ChronoNet [17] introduced the concept of multiple-time-scale feature extraction, where inception layers encode time-series information before fusion of the EEG signal. However, this work treats the EEG channels as feature channels at the beginning of the model, failing to learn signal patterns of individual EEG channels. Eberlein et al. [12] performed convolution on EEG signals with kernels ranging over multiple channels to detect local patterns instead of a single channel. Although the authors tried several topologies over the number of channels to be convoluted together, the accuracy is limited due to insufficient representative features in EEG recordings. Both works introduced the idea of manually adjusting the input domain in the early stage of the neural network in seek of better performance of their model. However, to the best of our knowledge, none of the existing research has conducted feature extraction techniques on both temporal and regional patterns as in the field of seizure detection.To address the aforementioned issues, we propose to use wavelet coefficient packages as input features and introduce the concept of local pattern inception into the neural network model as our seizure detection system. Our model is trained and examined with an up-to-date real clinical EEG dataset [18] that provides a sensitivity of 59.07% at a false alarm rate of 12/24 hours, reaching the average human performance [19].The key contributions of our work are summarized as follows:(1)
Dataset Preparation. We propose a single reference EEG montage for seizure detection to solve the problem of independence and dependence of adjacent electrodes.(2)
Feature Extraction. We propose a feature extraction method inspired by neurologists’ way of reading EEG to improve feature extraction of DWT-Net for seizure detection with efficient computing cost.(3)
Neural Network Optimization. We optimize the kernel size of the convolution layers to deal with different temporal resolutions of various discrete wavelet coefficients.(4)
Postprocessor. We optimize the system by concatenating the classifier with a finite-state-machine postprocessor.The rest of the paper is organized as follows: Section2 presents preliminaries about EEG recording methods and seizure detection datasets with problem definition. In Section 3, we propose our seizure detection system with detailed methods including feature extraction, network structure, and postprocessor. The experimental results and discussion are presented in Section 4, followed by conclusion in Section 5.


## 2. Preliminaries

In this section, we will discuss the present EEG recording techniques and related datasets and define our problem statement based on the evaluation matrices.


### 2.1. EEG Recording Methods

For clinical epilepsy treatment, noninvasive EEG signal recording is a preferable method because of ethical concerns and medical risks [20]. EEG signals are typically acquired with equipment via the potential difference between pairs of recording electrodes placed on the scalp surface. The measurement between any two electrodes is considered an EGG channel.According to the “International 10-20 system” measurement standard, the electrodes are distributed across the brain scalp to ensure the reproducibility of EEG experiment [21]. The notation of “10” and “20” defines that the distances between adjacent electrodes are either 10% or 20% of the total longitudinal or transverse distance of the skull. There are a total of 19 recording electrodes and two referential electrodes. Each electrode has a “positional” code and a number; an odd number represents the left brain position, and an even number represents the right brain. As illustrated in Figure 1, the electrode “T3” is termed as temporal lobe (T) on the left side of the brain.Figure 1
Common EEG recording method used for epileptic seizure detection.EEG signals are presented in the form of either single reference or bipolar montage, as shown in Figure2, where a montage is defined as an ordered list of EEG channels recorded in a regular time interval [22]. Both types of montages are used by the clinicians to understand the origin and location of epileptic seizure signals. A single reference montage is also known as a referential montage with one or two referential electrodes. The referential electrodes can be auricular electrodes or averaged potential of all the electrodes. They are paired with the recording electrodes to form the channels in a single reference montage. A bipolar montage does not have referential electrodes, and it records the potential differences between pairs of recording electrodes [23].Figure 2
Three common EEG montages: (a) the auricular reference montage that uses electrodes on ears as referential electrodes, (b) the common average montage that uses averaged potential of all the electrodes as the referential electrode, and (c) the longitudinal bipolar montage that records the potential difference between pairs of recording electrodes.


### 2.2. EEG Datasets

To develop an automatic seizure detection system, an EEG database with well-defined epileptic recordings is required. Table1 provides a list of open-source seizure detection datasets (corpora).Table 1
Open source EEG corpus for seizure detection.
BonnCHB-MITTUSZNumber of subjects1023315Number of seizure occurrence1001631791Total seizure time0.6 hours2.8 hours36 hoursTotal record time3.2 hours175 hours797 hours% of seizure time/total time1.88%1.6%4.5%Number of seizure type117Number of channels11919The “Bonn” corpus, from the University of Bonn [24], has been widely used for research on seizure detection [8, 11, 25]. It includes single-channel EEG recordings with a total number of 10 subjects and 100 seizure occurrences. All the EEG signals in the corpus were manually reviewed by professional clinicians to pick the representative epileptic channel and to remove recordings with artifacts. Hence, each session retains only one EEG channel measurement.The “CHB-MIT” scalp EEG corpus [3, 26] is another widely used dataset for seizure detection [11, 27, 28]. It consists of continuous scalp EEG recordings from 23 pediatric patients undergoing medication withdrawal for epilepsy surgery evaluation at Children’s Hospital, Boston. The corpus includes 19-channel EEG recordings with a total number of 163 seizure occurrences and a total record time of 175 hours.The Temple University Hospital Seizure Detection Corpus (TUSZ) [29] is the largest open-source EEG corpus for seizure detection and provides an accurate representation of actual clinical conditions. This corpus is still undergoing updates, and the version used in this paper is v1.5.0. Currently, this corpus includes 19-channel EEG recordings with a total number of 315 subjects, 1791 seizure occurrences, and a total record time of 797 hours. In particular, this corpus is the only dataset that provides different types of epileptic seizure signal. Ref. [30, 31] completed a benchmark on the classification of different types of seizures in TUSZ.Since “Bonn” and “CHB-MIT” corpuses lack sufficient subjects and data, both corpus might not be a good representative of the real-world clinical situations [32]. Hence, we have adopted the “TUSZ” corpus for our study to develop a seizure detection system.


### 2.3. Problem Formulation and Definitions

We define the following evaluation matrices used to evaluate the performance of a seizure detection system against the “TUSZ” corpus.Definition 1.
(seizure density function). An ideal seizure detection system or human marker is expected to label each seizure in the recordings with an accurate start time and end time. An evaluation method [6] is considered to describe the EEG signals by a seizure density function, which varies between 0 and 1 throughout the record. An ideal density function of a detection system is a function of time with the value 1 during the detections and 0 elsewhere.Definition 2.
(sensitivity (Sen)). Sensitivity is defined as the ratio between the total number of detected seizure events and the total number of all labelled seizure events in the EEG record,
(1)Sen=TotalnumberofcorrectlyrecognizedseizureeventsTotalnumberoflabelledseizureevents,where a detected seizure event is defined if the average value of seizure density function over the event duration exceeds the threshold p.Definition 3.
(specificity (Sp)). Specificity is defined as the ratio between the number of detected normal event and the total number of all labelled normal events in the EEG record,
(2)Sen=TotalnumberofrecognizednormaleventsTotalnumberoflabellednormalevents,where a normal event is defined if the average value of seizure density function over the event duration falls below the threshold p.Definition 4.
(true positive rate (TPR)). The true positive rate is defined as the ratio between the number of detected seizure events and the total number of events recognized as seizure events,
(3)TPR=TotalnumberofcorrectlyrecognizedseizureeventsTotalnumberofdetectedseizureevents.Definition 5.
(false alarm rate (FAR)). A false alarm occurs if the integral of seizure density function over a nonseizure event exceeds seizure density threshold p. The false alarm rate over a period of 24 hours is defined as the ratio between the number of false alarm events and the duration of the EEG recorded in the unit of 24 hours.
(4)FAR=TotalnumberoffalsealarmeventsTotalduration.
With the above definitions, the epileptic seizure detection problem is formulated as follows.Problem 1.
(epileptic seizure detection). Given a corpus that contains EEG channels with normal and seizure events, train a seizure detection system based on sliding window method. For each sliding window, the sensitivity and specificity of whether it contains a seizure event should be maximized. For the final output of the system, the false alarm rate of seizure events detection should be minimized.


## 2.1. EEG Recording Methods

For clinical epilepsy treatment, noninvasive EEG signal recording is a preferable method because of ethical concerns and medical risks [20]. EEG signals are typically acquired with equipment via the potential difference between pairs of recording electrodes placed on the scalp surface. The measurement between any two electrodes is considered an EGG channel.According to the “International 10-20 system” measurement standard, the electrodes are distributed across the brain scalp to ensure the reproducibility of EEG experiment [21]. The notation of “10” and “20” defines that the distances between adjacent electrodes are either 10% or 20% of the total longitudinal or transverse distance of the skull. There are a total of 19 recording electrodes and two referential electrodes. Each electrode has a “positional” code and a number; an odd number represents the left brain position, and an even number represents the right brain. As illustrated in Figure 1, the electrode “T3” is termed as temporal lobe (T) on the left side of the brain.Figure 1
Common EEG recording method used for epileptic seizure detection.EEG signals are presented in the form of either single reference or bipolar montage, as shown in Figure2, where a montage is defined as an ordered list of EEG channels recorded in a regular time interval [22]. Both types of montages are used by the clinicians to understand the origin and location of epileptic seizure signals. A single reference montage is also known as a referential montage with one or two referential electrodes. The referential electrodes can be auricular electrodes or averaged potential of all the electrodes. They are paired with the recording electrodes to form the channels in a single reference montage. A bipolar montage does not have referential electrodes, and it records the potential differences between pairs of recording electrodes [23].Figure 2
Three common EEG montages: (a) the auricular reference montage that uses electrodes on ears as referential electrodes, (b) the common average montage that uses averaged potential of all the electrodes as the referential electrode, and (c) the longitudinal bipolar montage that records the potential difference between pairs of recording electrodes.


## 2.2. EEG Datasets

To develop an automatic seizure detection system, an EEG database with well-defined epileptic recordings is required. Table1 provides a list of open-source seizure detection datasets (corpora).Table 1
Open source EEG corpus for seizure detection.
BonnCHB-MITTUSZNumber of subjects1023315Number of seizure occurrence1001631791Total seizure time0.6 hours2.8 hours36 hoursTotal record time3.2 hours175 hours797 hours% of seizure time/total time1.88%1.6%4.5%Number of seizure type117Number of channels11919The “Bonn” corpus, from the University of Bonn [24], has been widely used for research on seizure detection [8, 11, 25]. It includes single-channel EEG recordings with a total number of 10 subjects and 100 seizure occurrences. All the EEG signals in the corpus were manually reviewed by professional clinicians to pick the representative epileptic channel and to remove recordings with artifacts. Hence, each session retains only one EEG channel measurement.The “CHB-MIT” scalp EEG corpus [3, 26] is another widely used dataset for seizure detection [11, 27, 28]. It consists of continuous scalp EEG recordings from 23 pediatric patients undergoing medication withdrawal for epilepsy surgery evaluation at Children’s Hospital, Boston. The corpus includes 19-channel EEG recordings with a total number of 163 seizure occurrences and a total record time of 175 hours.The Temple University Hospital Seizure Detection Corpus (TUSZ) [29] is the largest open-source EEG corpus for seizure detection and provides an accurate representation of actual clinical conditions. This corpus is still undergoing updates, and the version used in this paper is v1.5.0. Currently, this corpus includes 19-channel EEG recordings with a total number of 315 subjects, 1791 seizure occurrences, and a total record time of 797 hours. In particular, this corpus is the only dataset that provides different types of epileptic seizure signal. Ref. [30, 31] completed a benchmark on the classification of different types of seizures in TUSZ.Since “Bonn” and “CHB-MIT” corpuses lack sufficient subjects and data, both corpus might not be a good representative of the real-world clinical situations [32]. Hence, we have adopted the “TUSZ” corpus for our study to develop a seizure detection system.


## 2.3. Problem Formulation and Definitions

We define the following evaluation matrices used to evaluate the performance of a seizure detection system against the “TUSZ” corpus.Definition 1.
(seizure density function). An ideal seizure detection system or human marker is expected to label each seizure in the recordings with an accurate start time and end time. An evaluation method [6] is considered to describe the EEG signals by a seizure density function, which varies between 0 and 1 throughout the record. An ideal density function of a detection system is a function of time with the value 1 during the detections and 0 elsewhere.Definition 2.
(sensitivity (Sen)). Sensitivity is defined as the ratio between the total number of detected seizure events and the total number of all labelled seizure events in the EEG record,
(1)Sen=TotalnumberofcorrectlyrecognizedseizureeventsTotalnumberoflabelledseizureevents,where a detected seizure event is defined if the average value of seizure density function over the event duration exceeds the threshold p.Definition 3.
(specificity (Sp)). Specificity is defined as the ratio between the number of detected normal event and the total number of all labelled normal events in the EEG record,
(2)Sen=TotalnumberofrecognizednormaleventsTotalnumberoflabellednormalevents,where a normal event is defined if the average value of seizure density function over the event duration falls below the threshold p.Definition 4.
(true positive rate (TPR)). The true positive rate is defined as the ratio between the number of detected seizure events and the total number of events recognized as seizure events,
(3)TPR=TotalnumberofcorrectlyrecognizedseizureeventsTotalnumberofdetectedseizureevents.Definition 5.
(false alarm rate (FAR)). A false alarm occurs if the integral of seizure density function over a nonseizure event exceeds seizure density threshold p. The false alarm rate over a period of 24 hours is defined as the ratio between the number of false alarm events and the duration of the EEG recorded in the unit of 24 hours.
(4)FAR=TotalnumberoffalsealarmeventsTotalduration.
With the above definitions, the epileptic seizure detection problem is formulated as follows.Problem 1.
(epileptic seizure detection). Given a corpus that contains EEG channels with normal and seizure events, train a seizure detection system based on sliding window method. For each sliding window, the sensitivity and specificity of whether it contains a seizure event should be maximized. For the final output of the system, the false alarm rate of seizure events detection should be minimized.


## 3. Feature Extraction Methods and Neural Network Model

### 3.1. Feature Extraction

#### 3.1.1. Montage Selection

The number of channels and the selection of EEG montage have a direct impact on the performance of the classification system [33]. In the TUSZ corpus, it contains more than 40 different channel configurations and 4 different types of reference points. As shown in Figure 3, after our preliminary study on channel selection based on [34, 35], we have decided to use 19 channels from single reference montage based on the “International 10-20 system” to ensure the generality of our model.Figure 3
Channel sequence of the proposed single reference montage. The sequence is derived from the longitudinal bipolar montage and presented with numbers.In this work, we have arranged the single reference EEG channels in a new montage to extract the spatial information of the EEG signals. The order of the channels is derived from the longitudinal bipolar montage recommended by standard neurophysiology guidelines [36]. In this montage, each pair of recording electrodes from neighboring channels corresponds to a channel in the longitudinal bipolar montage. For example, the pair of channel Fp1-reference and F7-reference corresponds to Fp1-F7 in the bipolar montage. A bipolar montage can be derived from single reference montages, because the subtraction of two channels with the same referential electrode would cancel the effects of the reference point [37]. Hence, this single reference montage that maintains the bipolar sequence enables the neural network not only to detect features from the single reference electrodes but also make it possible to draw information from the difference between two neighboring electrodes, which mimics the bipolar montage. Compared with other montages, the proposed single reference montage provides the classifier with more information than only using traditional single reference or bipolar montages as the input signal. The related experimental results will be discussed in Section 4.


#### 3.1.2. Window Length Selection

To derive the seizure density function from continuous EEG recordings, the EEG signals need to be processed with moving-window analysis. Neurologists typically evaluate the symptom based on 10-second windows of EEG signals [14]. However, a large proportion of the events in the “TUSZ” corpus are shorter than 10 seconds. Thus, we have selected two shorter windows, 1-second and 5-second windows. With the 250 Hz sampling rate of the TUSZ corpus, the 1-second and 5-second windows contain 19 single reference EEG channels with 250 and 1250 sampling points per channel, respectively.


#### 3.1.3. EEG Noise Removal and Normalization

An eighth-order Butterworth filter of 49 to 51 Hz was applied to each window to filter out power-line noise. Each signal was further normalized withZ-score normalization [38], obeying the following equation:
(5)X=x−xmeanσx,where xmean and σx represent the mean value and the standard deviation of this EEG within the window duration. The result of Z-score normalization is a signal with zero mean and a standard deviation of 1.


#### 3.1.4. Discrete Wavelet Transformation

Discrete wavelet transformation (DWT) is a wavelet decomposition method [39]. This method decomposes a discrete signal into packages of coefficients that represent approximate and detailed information by calculating the inner product of the signal and mother wavelet functions. EEG signals can be seen as a time sequence signal consisting of different frequency components. Thus, the packages of coefficients correspond to the lower and higher frequency component of the signal, respectively. As shown in Figure 4, a detailed package represents a frequency component Dn,m, which corresponds to the frequency range of [fs/2m+1 Hz, fs/2m Hz], where fs is the sampling rate (250 Hz), m=1,2,⋯n, and n is the total level of decomposition.Figure 4
An illustration of discrete wavelet transformation used in 5-second window.n is chosen as 6. For 1-second window, the maximum decomposition level is limited to 5 due to fewer sampling points.Most of the related studies use inverse-DWT after DWT to reconstruct EEG into time-sequence signals of different frequency components [5, 25, 28]. In our study, we use the coefficients directly as input features. This method has been tested in other fields such as fault diagnosis [40].The fourth Daubechies mother wavelet function (db4) is a widely used mother wavelet function in the field of EEG analysis [10, 35, 41]. The morphological characteristic of this mother wavelet function resembles EEG signals. From our preliminary study, we have identified four wavelet coefficient packages decomposed by db4 that represent the lowest frequency components of the EEG, as those frequency components are more related to epileptic signals. The length of the db4 wavelet filter is 8. We can get the length of the decomposed coefficient package, by the following equation
(6)Lencoeff=floorlendata+lenfilter−12.The wavelet decomposition stops when the signal becomes shorter than the db4 filter length. Based on the origin signal length 1250 and 250, the maximum decomposition level for 5-second window and 1-second window are 7 and 5, respectively. We take the middle of 1024 sampling points from 1250 sampling points for 5-second windows and 260 sampling points with overlapping of 10 sampling points for 1-second windows. With this method, the length of the coefficient packages representing the lowest frequency components for both 1-second and 5-second windows will be 14, 22, 38, and 70, making our model suitable for both window sizes. The proposed feature extraction method is summarized and illustrated in Figure5.Figure 5
Systematic flow of the proposed feature extraction method with 5-second window. Firstly, the EEG signals from TUSZ dataset are restructured into the proposed montage of 19 channels. Secondly, 5-second windows of epileptic and normal EEG are extracted according to the labeling file of the sessions. The windows then go through a Butterworth filter to eliminate power-line interference. AfterZ-score normalization, the signal is decomposed into discrete wavelet coefficients. Four coefficient packages representing information of lower frequency bands are used as input of the classifier.


### 3.2. DWT-Net Structure

Neurologists read EEG signals and recognize abnormal waveforms in the individual channels as well as the correlations between adjacent EEG channels [1]. Their method seeks features from both the time-frequency domain and the spatial domain to ensure that epileptic signals that are unclear in a single domain can be detected.In this work, we designed a CNN structure called DWT-Net to mimic the above feature extraction methodology. The model has 9 layers and generates the seizure density of each EEG window. The input of our model is four coefficient packages with sizes ofC∗Lii=0,1,2,3, where C represents the number of preprocessed input EEG channels and Li represents the length of ith coefficient package. According to the preprocessed data, C is 19 and Li equals to 14, 22, 38, and 70, respectively.After the input layer, we implemented multiple feature extractors to process the wavelet packages separately. The method of multiple feature extractors has been used to model local pairwise feature interactions for image recognition [42]. To mimic the abnormal signal identification methodology of neurologists, we extended the concept and implemented a 4-way feature extractor to guide the model. As a result, the model will extract features along different domains in a predefined order. The second dimension of the feature maps refers to the time steps in the wavelet coefficient packages. It is illustrated in Figure 6 that by adjusting the second dimension of the kernel sizes, strides, and paddings of our convolution layers, we can normalize the temporal resolutions of different DWT coefficient packages. As shown in Figure 7, the details of the model with multiple feature extractors are described as follows:
(1)
4 wavelet coefficient packages are fed to the 4-input feature extractors(2)
Each package undergoes the first convolution layer with a kernel size of (3, 6) and stride of 2 for the inception of local temporal and spatial features. The first dimension of the kernel size refers to the number of channels involved in the convolution and is chosen to be 3. With a stride of 2, it ensures that each EEG channel has a chance to interact with neighboring 2 channels. Note that the first convolution layer halves feature dimension along the number of channels(3)
Two 1d convolution layers are used to extract features along with the temporal dimension of each channel. Different sizes of kernels are used in these two layers between feature extractors for different input coefficient packages. The kernels in size of (1,N) with larger N are used for longer coefficient packages, as shown in Figure 6. The sizes of N, strides, and paddings are carefully chosen to ensure that the shape of output feature maps is normalized correctly(4)
The output of the third convolution layer is convolved using a kernel size of (3, 3)(5)
A max-pooling layer is applied to the product of the last kernel, reducing the feature map size to5×3(6)
The feature map then goes through a dropout layer with a 50% dropout proportion to achieve the effect of auto denoising and prevent overfitting(7)
The results of 4 feature extractors are stacked by the first dimension into a 3D feature space of4×5×3. The first dimension now represents the frequency-domain of the signal(8)
The last convolution layer with a kernel size of 3 is applied to the 3D feature map. This layer fuse features from different frequency bands together(9)
Another max-pooling layer is used to reduce the size of the feature map to2×3×2(10)
The resulting 768 features are fully connected to the output of 2 neurons after two fully connected layersFigure 6
Using larger 1D convolution kernel for feature map with larger temporal resolution to normalize the feature maps of the multiple feature extractor.Figure 7
Structure of DWT-Net. The upper part illustrates the structure of multiple feature extractor proposed for better feature extraction performance with regard to epileptic EEG signal. In the bottom part, outputs of the multiple feature extractor are stacked into a 3D feature map, which goes through common convolution layers for classification.


### 3.3. Designing of the Real-Time System

The softmax output from the classifier is a probability vector of a dimension two, including the probability of thenth EEG window to be epileptic EEG Pseizure and the probability of the nth EEG window to be normal EEG Pnormal. As illustrated in Algorithm 1, the postprocessor processes the EEG signal windows by sequence. Starting with state=negative, once the nth window is detected as epileptic, the result of the nth EEG window Resultn will be set to Epileptic and the state is changed to Positive (lines 8-9). Under this condition, the system raises the possibility of the next two windows to be epileptic by Pup, which is set to 0.1 in this work. If the next 2 consecutive windows Resultn+1 and Resultn+2 failed to be detected as Epileptic. The nth window will be regarded as a false alarm and Resultn will be revised to Normal (line 25). Likewise, a single Normal window between two Epileptic windows will be revised to Epileptic. Although such postprocessor brings about a latency of 10 seconds, the proposed postprocessor smooths the sequential hypotheses of the classifiers and provides a moderate effect in suppressing FAR and increasing Sen.Algorithm 1. Algorithm for state machine post-processor
Require:Pseizure, Pnormal, PupOutput:Resultn, n =1,2,…1: Initialize System StateState ⇐ Negative2:while New EEG window do3:ifState == Negativethen4:ifPseizure < Pnormalthen5:    nextState ⇐ Negative6:Resultn ⇐ Normal7:else8:    nextState ⇐ Positive9:Resultn ⇐ Epileptic10:end if11:end if12:ifState == Positivethen13:ifPseizure + Pup < Pnormalthen14:    nextState ⇐ Smooth15:Resultn ⇐ Normal16:else17:    nextState ⇐ Positive18:Resultn ⇐ Epileptic19:end if20:end if21:ifState == Smooththen22:ifPseizure + Pup < Pnormalthen23:    nextState ⇐ Negative24:Resultn ⇐ Normal25:Resultn−2 ⇐ Normal26:else27:    nextState ⇐ Positive28:Resultn ⇐ Positive29:Resultn−1 ⇐ Positive30:end if31:end if32:end while


## 3.1. Feature Extraction

### 3.1.1. Montage Selection

The number of channels and the selection of EEG montage have a direct impact on the performance of the classification system [33]. In the TUSZ corpus, it contains more than 40 different channel configurations and 4 different types of reference points. As shown in Figure 3, after our preliminary study on channel selection based on [34, 35], we have decided to use 19 channels from single reference montage based on the “International 10-20 system” to ensure the generality of our model.Figure 3
Channel sequence of the proposed single reference montage. The sequence is derived from the longitudinal bipolar montage and presented with numbers.In this work, we have arranged the single reference EEG channels in a new montage to extract the spatial information of the EEG signals. The order of the channels is derived from the longitudinal bipolar montage recommended by standard neurophysiology guidelines [36]. In this montage, each pair of recording electrodes from neighboring channels corresponds to a channel in the longitudinal bipolar montage. For example, the pair of channel Fp1-reference and F7-reference corresponds to Fp1-F7 in the bipolar montage. A bipolar montage can be derived from single reference montages, because the subtraction of two channels with the same referential electrode would cancel the effects of the reference point [37]. Hence, this single reference montage that maintains the bipolar sequence enables the neural network not only to detect features from the single reference electrodes but also make it possible to draw information from the difference between two neighboring electrodes, which mimics the bipolar montage. Compared with other montages, the proposed single reference montage provides the classifier with more information than only using traditional single reference or bipolar montages as the input signal. The related experimental results will be discussed in Section 4.


### 3.1.2. Window Length Selection

To derive the seizure density function from continuous EEG recordings, the EEG signals need to be processed with moving-window analysis. Neurologists typically evaluate the symptom based on 10-second windows of EEG signals [14]. However, a large proportion of the events in the “TUSZ” corpus are shorter than 10 seconds. Thus, we have selected two shorter windows, 1-second and 5-second windows. With the 250 Hz sampling rate of the TUSZ corpus, the 1-second and 5-second windows contain 19 single reference EEG channels with 250 and 1250 sampling points per channel, respectively.


### 3.1.3. EEG Noise Removal and Normalization

An eighth-order Butterworth filter of 49 to 51 Hz was applied to each window to filter out power-line noise. Each signal was further normalized withZ-score normalization [38], obeying the following equation:
(5)X=x−xmeanσx,where xmean and σx represent the mean value and the standard deviation of this EEG within the window duration. The result of Z-score normalization is a signal with zero mean and a standard deviation of 1.


### 3.1.4. Discrete Wavelet Transformation

Discrete wavelet transformation (DWT) is a wavelet decomposition method [39]. This method decomposes a discrete signal into packages of coefficients that represent approximate and detailed information by calculating the inner product of the signal and mother wavelet functions. EEG signals can be seen as a time sequence signal consisting of different frequency components. Thus, the packages of coefficients correspond to the lower and higher frequency component of the signal, respectively. As shown in Figure 4, a detailed package represents a frequency component Dn,m, which corresponds to the frequency range of [fs/2m+1 Hz, fs/2m Hz], where fs is the sampling rate (250 Hz), m=1,2,⋯n, and n is the total level of decomposition.Figure 4
An illustration of discrete wavelet transformation used in 5-second window.n is chosen as 6. For 1-second window, the maximum decomposition level is limited to 5 due to fewer sampling points.Most of the related studies use inverse-DWT after DWT to reconstruct EEG into time-sequence signals of different frequency components [5, 25, 28]. In our study, we use the coefficients directly as input features. This method has been tested in other fields such as fault diagnosis [40].The fourth Daubechies mother wavelet function (db4) is a widely used mother wavelet function in the field of EEG analysis [10, 35, 41]. The morphological characteristic of this mother wavelet function resembles EEG signals. From our preliminary study, we have identified four wavelet coefficient packages decomposed by db4 that represent the lowest frequency components of the EEG, as those frequency components are more related to epileptic signals. The length of the db4 wavelet filter is 8. We can get the length of the decomposed coefficient package, by the following equation
(6)Lencoeff=floorlendata+lenfilter−12.The wavelet decomposition stops when the signal becomes shorter than the db4 filter length. Based on the origin signal length 1250 and 250, the maximum decomposition level for 5-second window and 1-second window are 7 and 5, respectively. We take the middle of 1024 sampling points from 1250 sampling points for 5-second windows and 260 sampling points with overlapping of 10 sampling points for 1-second windows. With this method, the length of the coefficient packages representing the lowest frequency components for both 1-second and 5-second windows will be 14, 22, 38, and 70, making our model suitable for both window sizes. The proposed feature extraction method is summarized and illustrated in Figure5.Figure 5
Systematic flow of the proposed feature extraction method with 5-second window. Firstly, the EEG signals from TUSZ dataset are restructured into the proposed montage of 19 channels. Secondly, 5-second windows of epileptic and normal EEG are extracted according to the labeling file of the sessions. The windows then go through a Butterworth filter to eliminate power-line interference. AfterZ-score normalization, the signal is decomposed into discrete wavelet coefficients. Four coefficient packages representing information of lower frequency bands are used as input of the classifier.


## 3.1.1. Montage Selection

The number of channels and the selection of EEG montage have a direct impact on the performance of the classification system [33]. In the TUSZ corpus, it contains more than 40 different channel configurations and 4 different types of reference points. As shown in Figure 3, after our preliminary study on channel selection based on [34, 35], we have decided to use 19 channels from single reference montage based on the “International 10-20 system” to ensure the generality of our model.Figure 3
Channel sequence of the proposed single reference montage. The sequence is derived from the longitudinal bipolar montage and presented with numbers.In this work, we have arranged the single reference EEG channels in a new montage to extract the spatial information of the EEG signals. The order of the channels is derived from the longitudinal bipolar montage recommended by standard neurophysiology guidelines [36]. In this montage, each pair of recording electrodes from neighboring channels corresponds to a channel in the longitudinal bipolar montage. For example, the pair of channel Fp1-reference and F7-reference corresponds to Fp1-F7 in the bipolar montage. A bipolar montage can be derived from single reference montages, because the subtraction of two channels with the same referential electrode would cancel the effects of the reference point [37]. Hence, this single reference montage that maintains the bipolar sequence enables the neural network not only to detect features from the single reference electrodes but also make it possible to draw information from the difference between two neighboring electrodes, which mimics the bipolar montage. Compared with other montages, the proposed single reference montage provides the classifier with more information than only using traditional single reference or bipolar montages as the input signal. The related experimental results will be discussed in Section 4.


## 3.1.2. Window Length Selection

To derive the seizure density function from continuous EEG recordings, the EEG signals need to be processed with moving-window analysis. Neurologists typically evaluate the symptom based on 10-second windows of EEG signals [14]. However, a large proportion of the events in the “TUSZ” corpus are shorter than 10 seconds. Thus, we have selected two shorter windows, 1-second and 5-second windows. With the 250 Hz sampling rate of the TUSZ corpus, the 1-second and 5-second windows contain 19 single reference EEG channels with 250 and 1250 sampling points per channel, respectively.


## 3.1.3. EEG Noise Removal and Normalization

An eighth-order Butterworth filter of 49 to 51 Hz was applied to each window to filter out power-line noise. Each signal was further normalized withZ-score normalization [38], obeying the following equation:
(5)X=x−xmeanσx,where xmean and σx represent the mean value and the standard deviation of this EEG within the window duration. The result of Z-score normalization is a signal with zero mean and a standard deviation of 1.


## 3.1.4. Discrete Wavelet Transformation

Discrete wavelet transformation (DWT) is a wavelet decomposition method [39]. This method decomposes a discrete signal into packages of coefficients that represent approximate and detailed information by calculating the inner product of the signal and mother wavelet functions. EEG signals can be seen as a time sequence signal consisting of different frequency components. Thus, the packages of coefficients correspond to the lower and higher frequency component of the signal, respectively. As shown in Figure 4, a detailed package represents a frequency component Dn,m, which corresponds to the frequency range of [fs/2m+1 Hz, fs/2m Hz], where fs is the sampling rate (250 Hz), m=1,2,⋯n, and n is the total level of decomposition.Figure 4
An illustration of discrete wavelet transformation used in 5-second window.n is chosen as 6. For 1-second window, the maximum decomposition level is limited to 5 due to fewer sampling points.Most of the related studies use inverse-DWT after DWT to reconstruct EEG into time-sequence signals of different frequency components [5, 25, 28]. In our study, we use the coefficients directly as input features. This method has been tested in other fields such as fault diagnosis [40].The fourth Daubechies mother wavelet function (db4) is a widely used mother wavelet function in the field of EEG analysis [10, 35, 41]. The morphological characteristic of this mother wavelet function resembles EEG signals. From our preliminary study, we have identified four wavelet coefficient packages decomposed by db4 that represent the lowest frequency components of the EEG, as those frequency components are more related to epileptic signals. The length of the db4 wavelet filter is 8. We can get the length of the decomposed coefficient package, by the following equation
(6)Lencoeff=floorlendata+lenfilter−12.The wavelet decomposition stops when the signal becomes shorter than the db4 filter length. Based on the origin signal length 1250 and 250, the maximum decomposition level for 5-second window and 1-second window are 7 and 5, respectively. We take the middle of 1024 sampling points from 1250 sampling points for 5-second windows and 260 sampling points with overlapping of 10 sampling points for 1-second windows. With this method, the length of the coefficient packages representing the lowest frequency components for both 1-second and 5-second windows will be 14, 22, 38, and 70, making our model suitable for both window sizes. The proposed feature extraction method is summarized and illustrated in Figure5.Figure 5
Systematic flow of the proposed feature extraction method with 5-second window. Firstly, the EEG signals from TUSZ dataset are restructured into the proposed montage of 19 channels. Secondly, 5-second windows of epileptic and normal EEG are extracted according to the labeling file of the sessions. The windows then go through a Butterworth filter to eliminate power-line interference. AfterZ-score normalization, the signal is decomposed into discrete wavelet coefficients. Four coefficient packages representing information of lower frequency bands are used as input of the classifier.


## 3.2. DWT-Net Structure

Neurologists read EEG signals and recognize abnormal waveforms in the individual channels as well as the correlations between adjacent EEG channels [1]. Their method seeks features from both the time-frequency domain and the spatial domain to ensure that epileptic signals that are unclear in a single domain can be detected.In this work, we designed a CNN structure called DWT-Net to mimic the above feature extraction methodology. The model has 9 layers and generates the seizure density of each EEG window. The input of our model is four coefficient packages with sizes ofC∗Lii=0,1,2,3, where C represents the number of preprocessed input EEG channels and Li represents the length of ith coefficient package. According to the preprocessed data, C is 19 and Li equals to 14, 22, 38, and 70, respectively.After the input layer, we implemented multiple feature extractors to process the wavelet packages separately. The method of multiple feature extractors has been used to model local pairwise feature interactions for image recognition [42]. To mimic the abnormal signal identification methodology of neurologists, we extended the concept and implemented a 4-way feature extractor to guide the model. As a result, the model will extract features along different domains in a predefined order. The second dimension of the feature maps refers to the time steps in the wavelet coefficient packages. It is illustrated in Figure 6 that by adjusting the second dimension of the kernel sizes, strides, and paddings of our convolution layers, we can normalize the temporal resolutions of different DWT coefficient packages. As shown in Figure 7, the details of the model with multiple feature extractors are described as follows:
(1)
4 wavelet coefficient packages are fed to the 4-input feature extractors(2)
Each package undergoes the first convolution layer with a kernel size of (3, 6) and stride of 2 for the inception of local temporal and spatial features. The first dimension of the kernel size refers to the number of channels involved in the convolution and is chosen to be 3. With a stride of 2, it ensures that each EEG channel has a chance to interact with neighboring 2 channels. Note that the first convolution layer halves feature dimension along the number of channels(3)
Two 1d convolution layers are used to extract features along with the temporal dimension of each channel. Different sizes of kernels are used in these two layers between feature extractors for different input coefficient packages. The kernels in size of (1,N) with larger N are used for longer coefficient packages, as shown in Figure 6. The sizes of N, strides, and paddings are carefully chosen to ensure that the shape of output feature maps is normalized correctly(4)
The output of the third convolution layer is convolved using a kernel size of (3, 3)(5)
A max-pooling layer is applied to the product of the last kernel, reducing the feature map size to5×3(6)
The feature map then goes through a dropout layer with a 50% dropout proportion to achieve the effect of auto denoising and prevent overfitting(7)
The results of 4 feature extractors are stacked by the first dimension into a 3D feature space of4×5×3. The first dimension now represents the frequency-domain of the signal(8)
The last convolution layer with a kernel size of 3 is applied to the 3D feature map. This layer fuse features from different frequency bands together(9)
Another max-pooling layer is used to reduce the size of the feature map to2×3×2(10)
The resulting 768 features are fully connected to the output of 2 neurons after two fully connected layersFigure 6
Using larger 1D convolution kernel for feature map with larger temporal resolution to normalize the feature maps of the multiple feature extractor.Figure 7
Structure of DWT-Net. The upper part illustrates the structure of multiple feature extractor proposed for better feature extraction performance with regard to epileptic EEG signal. In the bottom part, outputs of the multiple feature extractor are stacked into a 3D feature map, which goes through common convolution layers for classification.


## 3.3. Designing of the Real-Time System

The softmax output from the classifier is a probability vector of a dimension two, including the probability of thenth EEG window to be epileptic EEG Pseizure and the probability of the nth EEG window to be normal EEG Pnormal. As illustrated in Algorithm 1, the postprocessor processes the EEG signal windows by sequence. Starting with state=negative, once the nth window is detected as epileptic, the result of the nth EEG window Resultn will be set to Epileptic and the state is changed to Positive (lines 8-9). Under this condition, the system raises the possibility of the next two windows to be epileptic by Pup, which is set to 0.1 in this work. If the next 2 consecutive windows Resultn+1 and Resultn+2 failed to be detected as Epileptic. The nth window will be regarded as a false alarm and Resultn will be revised to Normal (line 25). Likewise, a single Normal window between two Epileptic windows will be revised to Epileptic. Although such postprocessor brings about a latency of 10 seconds, the proposed postprocessor smooths the sequential hypotheses of the classifiers and provides a moderate effect in suppressing FAR and increasing Sen.Algorithm 1. Algorithm for state machine post-processor
Require:Pseizure, Pnormal, PupOutput:Resultn, n =1,2,…1: Initialize System StateState ⇐ Negative2:while New EEG window do3:ifState == Negativethen4:ifPseizure < Pnormalthen5:    nextState ⇐ Negative6:Resultn ⇐ Normal7:else8:    nextState ⇐ Positive9:Resultn ⇐ Epileptic10:end if11:end if12:ifState == Positivethen13:ifPseizure + Pup < Pnormalthen14:    nextState ⇐ Smooth15:Resultn ⇐ Normal16:else17:    nextState ⇐ Positive18:Resultn ⇐ Epileptic19:end if20:end if21:ifState == Smooththen22:ifPseizure + Pup < Pnormalthen23:    nextState ⇐ Negative24:Resultn ⇐ Normal25:Resultn−2 ⇐ Normal26:else27:    nextState ⇐ Positive28:Resultn ⇐ Positive29:Resultn−1 ⇐ Positive30:end if31:end if32:end while


## 4. Experiment Results and Discussion

### 4.1. Dataset Preparation

In this work, we have chosen the latest version v1.5.0 of the “TUSZ” corpus. In TUSZ, the EEG labels are given with a start time and an end time for each EEG recording. The resolution of the labels in the TUSZ dataset is 0.0001 second. We can define an event with its start time and end time. The sessions of the corpus that includes eight classes of events (“background” event and 7 “epileptic” events) are listed in Table2. As we are not going to include seizure classification in our system, all the epileptic classes are considered “positive” events and the background class “negative” events in the experiment, respectively. Because the window length of our seizure detection system is only 5 seconds, we regard seizure events with short breaks as separate events to make the best use of the labels.Table 2
Number of sessions for classes in TUSZ v1.5.0.
ClassTrain setTest setBackground53131597Focal nonspecific seizure1015283Generalized nonspecific seizure342175Complex partial seizure14759Tonic seizure1851Simple partial seizure493Tonic clonic seizure3721Absence seizure5049The first minute of an EEG recording provides tale-tail signs whether the signal is epileptic or not because the epileptic signal is strongest at the beginning of a seizure [17]. Hence, limiting the length of the events can provide better classification performance. However, extracting only 60 seconds of signal from the events will result in shortage of training data required for training a deep learning model and make the classifier less adaptable. To balance the amount of training data and classifier performance, for events greater than 400 seconds, only the first 400 seconds are included.A total number of 6971 and 2238 sessions were used as the train and test sets predefined by TUSZ. After feature extraction, 119,491 5-second windows were generated with details showed in Table3. Correspondingly, the 1-second windows were derived from the 5-second windows.Table 3
Number of 5-second windows in the experiment.
NegativePositiveTrain set7167415542Test set260586217


### 4.2. Training of Window-Based Classifier

The proposed model was constructed with the open-source framework Pytorch [43]. The weights of the neural network were initialized with Kaiming normalization [44] to improve weight convergence during the training of our model with ReLu activation layers. The weighted cross-entropy was selected as the loss function of the classifier. We have used the Adam optimization method [45] with β1 of 0.9, β2 of 0.999, learning rate of 0.0005, and weight decay (L2 penalty regularization) of 0.005. The Adam method combines the advantages of AdaGrad [46] and RMSprop [47], and it automatically adjusts the learning rate during training to accelerate the convergence of the model. The learning rate is adjusted according to TPR result between the default value 0.001 [43] and 0.0005, which is a similar technique reported in [14]. Similarly, the weight decay is adjusted from the default value 0 to 0.005 which is a similar technique reported in [17] to achieve better performance. We use default settings given by Pytorch for other parameters (e.g., β1 and β2) as these parameters have a negligible effect on the learning speed or the accuracy based on our experimental trials.The synthetic minority oversampling technique (SMOTE) [48] is adopted to deal with the imbalanced dataset problem between positive and negative classes. SMOTE generates samples in a minority class by calculating an interpolation between a randomly selected minority class sample and one of its k-nearest minority class neighbors. With a batch size of 64, 56 samples were taken from the dataset and eight minor class samples were generated. This method decreases the ratio between negative and positive samples from 2.25 to 1.6.Each classifier in our experiment undergoes 180 epochs during the training. The performance comparison between different classifiers is shown in Table4. TUSZ provides an original segmentation of the training and validation datasets. We shuffled the dataset to create a random dataset for k-fold evaluation. The results based on the original dataset and k-fold evaluation were both examined, and k was chosen to be 5 so that the number of samples in the training phase and the validation phase is similar to the original dataset. The result of the k-fold evaluation is remarkably better than the result of the original dataset on Sen and TPR. This phenomenon can be explained through the k-fold dataset is shuffled to balance the proportion of different classes of epileptic events in the training and validation sets, which improve the intrinsic performance of the dataset. Thus, the rest of the results discussed in the paper were all obtained with k-fold evaluation.Table 4
Classifier performance on TUSZ.
ClassifierSensitivitySpecificityTPR5 sec window origin dataset45.69%76.06%23.11%1 sec window origin dataset35.86%83.25%28.59%5 sec window 5-fold77.23%83.41%37.78%1 sec window 5-fold79.10%81.38%34.61%5 sec window with +1 conv layers76.28%80.91%34.90%5 sec window with +2 conv layers77.82%81.33%34.35%5 sec window without SMOTE67.89%82.45%33.49%5 sec window double banana montage70.98%73.17%33.34%The best overall result was obtained by the 5-second window classifier with the SMOTE technique, whose performance versus epoch is shown in Figure8. The sensitivity of the 5-second window classifier without SMOTE will drop by 9% with similar specificity performance. Deeper models based on DWT-Net were constructed by increasing the number of convolution layers by 1 to 2 in the network after the inception layers of the multiple feature extractor. According to the experimental results shown in Table 4, the additional convolution layers cannot provide any improvement in the classifier’s performance. It can be concluded that our proposed model can effectively learn features from the input and thus reduce the complicity of a neural network model.Figure 8
The loss and sensitivity values during training and validation of our proposed 5-second-window DWT-Net classifier.The classifier’s ability to learn spatial information from our proposed montage is tested by another trial using the double banana montage. The TPR result without our proposed montage drops by 4.4%. Hence, with the combined techniques (our proposed montage and the classifier), we can improve the Sen of the classifier by 16%.


### 4.3. Evaluation of Seizure Detection System

An epileptic event is defined when the average seizure density function value over its duration is higher than the thresholdp. This output is compared with labeled ground truth for the calculation of Sen and FAR. The results based on 1-second and 5-second detection windows are shown in Table 5. Different values of the threshold p were examined to characterize the system. Given the same p, the performance of the system based on the 5-second window classifier performs better than 1-second system by an average increase of 7% in sensitivity. The specificity of the 1-second system drops sharply when the threshold decreases, while the 5-second system still holds a specificity of 89.72% with a 0.35 threshold. We conclude that our model can obtain better features from a 5-second window classifier, whose input wavelet coefficients represent more information at the lower frequency band of 2 to 32 Hz. This result agrees with clinical knowledge that the representative frequency band of seizure is below 30 Hz, proving the model’s ability to learn meaningful representative features of EEG signals with the proposed method.Table 5
Results of the proposed seizure detection system in comparison with results reported in other work.
System/p valueSensitivitySpecificityFARDeep learning methods in [14]HMM30.32%80.07%244HMM/SdA35.35%73.35%77HMM/LSTM30.05%80.53%60IPCA/LSTM32.97%77.57%73CNN/MLP39.09%76.84%77CNN/LSTM30.83%96.86%7Our DWT-Net system based on 5-second DWT-Netp=80%25.44%97.05%3p= 76%30.25%96.64%4p=70%33.45%96.10%5p=60%42.35%94.93%6p= 35%59.07%89.72%12Our DWT-Net system based on 1-second DWT-Netp=90%19.40%95.01%6p= 83.2%30.07%93.83%7p=80%33.45%96.10%5p=70%42.35%94.93%6p= 62.6%49.29%72%12Comparing with the state-of-the-art works [14], we have provided a figure of FAR versus sensitivity in Figure 9 to illustrate the advantage of our proposed system. The system based on 5-second DWT-Net classifier achieves the best FAR of 4/24 hours with the same sensitivity level of 30.25%, exceeding the CNN/LSTM model by 43% decrease in FAR. It is reported by [19] that for similar tasks, the average human performance based on qEEG tools is within the range of 65% sensitivity with a FAR of 12 per 24 hours. To compare the system with human performance, the FAR is fixed to 12/24 hours by adjusting the density threshold p, and our system can detect seizure events with a sensitivity of 59.07%. The proposed system is almost reaching the performance of an expert clinician with a diagnostic tool.Figure 9
FAR versus Sen. Our system based on 5-second DWT-Net classifier achieves the best FAR of 4/24 hours with the sensitivity level of 30%, exceeding the CNN/LSTM model by a 43% decrease inFAR. The method also approaches average human-level detector based on the qEEG tool with a Sen of 59.07% at FAR of 12/24 hours.


## 4.1. Dataset Preparation

In this work, we have chosen the latest version v1.5.0 of the “TUSZ” corpus. In TUSZ, the EEG labels are given with a start time and an end time for each EEG recording. The resolution of the labels in the TUSZ dataset is 0.0001 second. We can define an event with its start time and end time. The sessions of the corpus that includes eight classes of events (“background” event and 7 “epileptic” events) are listed in Table2. As we are not going to include seizure classification in our system, all the epileptic classes are considered “positive” events and the background class “negative” events in the experiment, respectively. Because the window length of our seizure detection system is only 5 seconds, we regard seizure events with short breaks as separate events to make the best use of the labels.Table 2
Number of sessions for classes in TUSZ v1.5.0.
ClassTrain setTest setBackground53131597Focal nonspecific seizure1015283Generalized nonspecific seizure342175Complex partial seizure14759Tonic seizure1851Simple partial seizure493Tonic clonic seizure3721Absence seizure5049The first minute of an EEG recording provides tale-tail signs whether the signal is epileptic or not because the epileptic signal is strongest at the beginning of a seizure [17]. Hence, limiting the length of the events can provide better classification performance. However, extracting only 60 seconds of signal from the events will result in shortage of training data required for training a deep learning model and make the classifier less adaptable. To balance the amount of training data and classifier performance, for events greater than 400 seconds, only the first 400 seconds are included.A total number of 6971 and 2238 sessions were used as the train and test sets predefined by TUSZ. After feature extraction, 119,491 5-second windows were generated with details showed in Table3. Correspondingly, the 1-second windows were derived from the 5-second windows.Table 3
Number of 5-second windows in the experiment.
NegativePositiveTrain set7167415542Test set260586217


## 4.2. Training of Window-Based Classifier

The proposed model was constructed with the open-source framework Pytorch [43]. The weights of the neural network were initialized with Kaiming normalization [44] to improve weight convergence during the training of our model with ReLu activation layers. The weighted cross-entropy was selected as the loss function of the classifier. We have used the Adam optimization method [45] with β1 of 0.9, β2 of 0.999, learning rate of 0.0005, and weight decay (L2 penalty regularization) of 0.005. The Adam method combines the advantages of AdaGrad [46] and RMSprop [47], and it automatically adjusts the learning rate during training to accelerate the convergence of the model. The learning rate is adjusted according to TPR result between the default value 0.001 [43] and 0.0005, which is a similar technique reported in [14]. Similarly, the weight decay is adjusted from the default value 0 to 0.005 which is a similar technique reported in [17] to achieve better performance. We use default settings given by Pytorch for other parameters (e.g., β1 and β2) as these parameters have a negligible effect on the learning speed or the accuracy based on our experimental trials.The synthetic minority oversampling technique (SMOTE) [48] is adopted to deal with the imbalanced dataset problem between positive and negative classes. SMOTE generates samples in a minority class by calculating an interpolation between a randomly selected minority class sample and one of its k-nearest minority class neighbors. With a batch size of 64, 56 samples were taken from the dataset and eight minor class samples were generated. This method decreases the ratio between negative and positive samples from 2.25 to 1.6.Each classifier in our experiment undergoes 180 epochs during the training. The performance comparison between different classifiers is shown in Table4. TUSZ provides an original segmentation of the training and validation datasets. We shuffled the dataset to create a random dataset for k-fold evaluation. The results based on the original dataset and k-fold evaluation were both examined, and k was chosen to be 5 so that the number of samples in the training phase and the validation phase is similar to the original dataset. The result of the k-fold evaluation is remarkably better than the result of the original dataset on Sen and TPR. This phenomenon can be explained through the k-fold dataset is shuffled to balance the proportion of different classes of epileptic events in the training and validation sets, which improve the intrinsic performance of the dataset. Thus, the rest of the results discussed in the paper were all obtained with k-fold evaluation.Table 4
Classifier performance on TUSZ.
ClassifierSensitivitySpecificityTPR5 sec window origin dataset45.69%76.06%23.11%1 sec window origin dataset35.86%83.25%28.59%5 sec window 5-fold77.23%83.41%37.78%1 sec window 5-fold79.10%81.38%34.61%5 sec window with +1 conv layers76.28%80.91%34.90%5 sec window with +2 conv layers77.82%81.33%34.35%5 sec window without SMOTE67.89%82.45%33.49%5 sec window double banana montage70.98%73.17%33.34%The best overall result was obtained by the 5-second window classifier with the SMOTE technique, whose performance versus epoch is shown in Figure8. The sensitivity of the 5-second window classifier without SMOTE will drop by 9% with similar specificity performance. Deeper models based on DWT-Net were constructed by increasing the number of convolution layers by 1 to 2 in the network after the inception layers of the multiple feature extractor. According to the experimental results shown in Table 4, the additional convolution layers cannot provide any improvement in the classifier’s performance. It can be concluded that our proposed model can effectively learn features from the input and thus reduce the complicity of a neural network model.Figure 8
The loss and sensitivity values during training and validation of our proposed 5-second-window DWT-Net classifier.The classifier’s ability to learn spatial information from our proposed montage is tested by another trial using the double banana montage. The TPR result without our proposed montage drops by 4.4%. Hence, with the combined techniques (our proposed montage and the classifier), we can improve the Sen of the classifier by 16%.


## 4.3. Evaluation of Seizure Detection System

An epileptic event is defined when the average seizure density function value over its duration is higher than the thresholdp. This output is compared with labeled ground truth for the calculation of Sen and FAR. The results based on 1-second and 5-second detection windows are shown in Table 5. Different values of the threshold p were examined to characterize the system. Given the same p, the performance of the system based on the 5-second window classifier performs better than 1-second system by an average increase of 7% in sensitivity. The specificity of the 1-second system drops sharply when the threshold decreases, while the 5-second system still holds a specificity of 89.72% with a 0.35 threshold. We conclude that our model can obtain better features from a 5-second window classifier, whose input wavelet coefficients represent more information at the lower frequency band of 2 to 32 Hz. This result agrees with clinical knowledge that the representative frequency band of seizure is below 30 Hz, proving the model’s ability to learn meaningful representative features of EEG signals with the proposed method.Table 5
Results of the proposed seizure detection system in comparison with results reported in other work.
System/p valueSensitivitySpecificityFARDeep learning methods in [14]HMM30.32%80.07%244HMM/SdA35.35%73.35%77HMM/LSTM30.05%80.53%60IPCA/LSTM32.97%77.57%73CNN/MLP39.09%76.84%77CNN/LSTM30.83%96.86%7Our DWT-Net system based on 5-second DWT-Netp=80%25.44%97.05%3p= 76%30.25%96.64%4p=70%33.45%96.10%5p=60%42.35%94.93%6p= 35%59.07%89.72%12Our DWT-Net system based on 1-second DWT-Netp=90%19.40%95.01%6p= 83.2%30.07%93.83%7p=80%33.45%96.10%5p=70%42.35%94.93%6p= 62.6%49.29%72%12Comparing with the state-of-the-art works [14], we have provided a figure of FAR versus sensitivity in Figure 9 to illustrate the advantage of our proposed system. The system based on 5-second DWT-Net classifier achieves the best FAR of 4/24 hours with the same sensitivity level of 30.25%, exceeding the CNN/LSTM model by 43% decrease in FAR. It is reported by [19] that for similar tasks, the average human performance based on qEEG tools is within the range of 65% sensitivity with a FAR of 12 per 24 hours. To compare the system with human performance, the FAR is fixed to 12/24 hours by adjusting the density threshold p, and our system can detect seizure events with a sensitivity of 59.07%. The proposed system is almost reaching the performance of an expert clinician with a diagnostic tool.Figure 9
FAR versus Sen. Our system based on 5-second DWT-Net classifier achieves the best FAR of 4/24 hours with the sensitivity level of 30%, exceeding the CNN/LSTM model by a 43% decrease inFAR. The method also approaches average human-level detector based on the qEEG tool with a Sen of 59.07% at FAR of 12/24 hours.


## 5. Conclusion

In this work, the cooperative design of a multiple feature extractor CNN structure with wavelet coefficient packages as input is derived from the proposed EEG montage. We introduced a system for automatic real-time detection of epileptic EEG events. Multiple feature extractors are used in our proposed DWT-Net to guide the feature extraction behavior of the model and improve its ability to incept local temporal and spatial features. A sensitivity of 59% is obtained with a FAR of 12/24 hours. While the system improves the state-of-the-art result of the automatic seizure detector to nearly a human level, it does not require an additional computation cost or more neural network layers. Our proposed method achieves similar performance compared to the human-level detector with qEEG tools. In practice, however, the combination of qEEG tools and raw EEG used by neurologists provides better accuracy. Our system can be more robust with additional verification done by the neurologists.



---

*Source: 3083910-2020-08-25.xml*