Skip to main content

Time-ResNeXt for epilepsy recognition based on EEG signals in wireless networks


To automatically detect dynamic EEG signals to reduce the time cost of epilepsy diagnosis. In the signal recognition of electroencephalogram (EEG) of epilepsy, traditional machine learning and statistical methods require manual feature labeling engineering in order to show excellent results on a single data set. And the artificially selected features may carry a bias, and cannot guarantee the validity and expansibility in real-world data. In practical applications, deep learning methods can release people from feature engineering to a certain extent. As long as the focus is on the expansion of data quality and quantity, the algorithm model can learn automatically to get better improvements. In addition, the deep learning method can also extract many features that are difficult for humans to perceive, thereby making the algorithm more robust. Based on the design idea of ResNeXt deep neural network, this paper designs a Time-ResNeXt network structure suitable for time series EEG epilepsy detection to identify EEG signals. The accuracy rate of Time-ResNeXt in the detection of EEG epilepsy can reach 91.50%. The Time-ResNeXt network structure produces extremely advanced performance on the benchmark dataset (Berne-Barcelona dataset) and has great potential for improving clinical practice.


Epilepsy is a brain disease that is caused by persistent susceptibility to recurrent seizures and the neurobiological, cognitive, psychological, and social consequences that result. According to estimates by the World Health Organization (WHO), about 2.4 million people worldwide are diagnosed with epilepsy every year [1]. Prolonged, frequent, or severe seizures can lead to further brain damage and even persistent neuropsychiatric disorders. Sudden epilepsy (SUDEP) is a serious complication of epilepsy and is one of the most common causes of death in younger patients with epilepsy. The timely diagnosis of the presence and type of epilepsy is critical to its prognosis and choice of treatment options [2]. However, the diagnosis of epilepsy is relatively difficult, especially for the detection of seizures in newborns [3, 4]. The usual clinical experience is judged by observing the behavior and other seizures of the newborn, but this is easily confused with other normal behaviors [5].

Epilepsy is often attributed to excessive abnormal discharges of neurons in the brain [6, 7]. Electroencephalogram signals provide a powerful tool for the diagnosis of epilepsy. Experienced neuropathologists interpret EEG signals by observing the patterns of seizures and the period of seizures, and have formulated certain international standards to find specific signal characteristics in multi-channel electroencephalography [8, 9]. Then, the condition of the patient is judged by the EEG signal rule that is manually explained. This method is relatively time-consuming and subjective, and it is objectively prone to errors [10, 11]. Therefore, a suitable mechanism is needed to automatically interpret and classify EEG signals in patients with epilepsy.

EEG signal automatic classification methods usually use traditional manual feature machine learning and statistical methods, such as time-frequency analysis using wavelet transform [12], detection method using entropy estimator [13], and discrete wavelet transform and approximate entropy method [14]. In addition, there are also methods for detecting using shallow neural networks using artificial features, such as Elman and probabilistic neural networks [15], which use approximate entropy as input features of the network, artificial neural networks [16]. The method uses Volterra system and cellular nonlinear network [17] and so on.

With the development of the field of machine learning in recent years, a large number of excellent machine learning classification algorithms have emerged, the most representative of which is the deep neural network algorithm. Especially in the field of image classification, deep learning methods, such as VGG [18] network, Google Inception [19] network, and ResNet [20] network, have powerful automatic feature extraction capabilities [21], which have been completely completed in some fields Beyond traditional machine learning and statistical methods and shallow artificial neural network methods, it can even identify targets that are difficult to distinguish with the naked eye, surpassing humans. In addition, many large companies have also adopted the method of deep learning as one of their core competitiveness [22,23,24].

This paper draws on the excellent deep neural network structure in the image field and designs an excellent end-to-end network structure based on ResNeXt [25] and suitable for EEG signal epileptic detection. And the performance of the network is verified on a public standard dataset (Berne Barcelona EEG dataset [26]) and compared with traditional algorithms [27,28,29,30] using this dataset, for us the performance of the algorithm is evaluated.

Data preparation

Data description

The data are from the EEG database of Berne Barcelona and are divided into two categories: EEG signal data during the onset of epilepsy patients and EEG signal data during the onset of epilepsy patients. Each category has 3750 pieces of data, each piece of data has 2 signal channels with a length of 10240 and a sampling frequency of 512 Hz (the time length of each piece of data is 20 s). Part of the original EEG image is shown in Fig. 1.

Fig. 1

Part of the EEG image

Training data preparation

Due to the balanced data classification, there is no data deviation. So there is no data enhancement for a single category. Only the data set is divided to prepare for model training. The method is shown in Table 1. The original data set is randomly divided into a training set (3000 items/category), a validation set (250 items/category), and a test set (500 items/category).

Table 1 Data allocation

Network model design

Model design ideas

ResNeXt’s deep learning network model structure design idea is followed. According to the data characteristics of EEG signals, a network structure Time-ResNeXt is designed for EEG time series classification.

According to the traditional idea of designing network structures to improve the accuracy of the model, most of them are to deepen or widen the structure of the network, but as the number of hyperparameters (such as the number of channels, the size of the convolution kernel) increases, neural network design and the difficulty and computational overhead also increase greatly. The algorithm in this paper benefits from the repeated topology of the ResNeXt network sub-modules, which enables it to have a very high accuracy rate while slightly increasing the amount of network calculations, while also greatly reducing the number of hyperparameters.

First, I have to mention the classic VGG network and Inception network. The design idea of VGG network is modularize the neural network to increase the depth, but such a deep network will cause network degradation due to gradients. The structure of VGG network key modules is shown in Fig. 2.

Fig. 2

Structure of key modules of VGG network

The design philosophy of the Inception network is exactly the opposite: the width of the network is increased by the split-transform-merge method, but the settings of the various hyperparameters of this Inception network are more targeted and need to be performed when applied to other data sets. There are many modifications, so scalability is average. The structure of the key modules of the Inception network is shown in Fig. 3.

Fig. 3

The structure of the key modules of the Inception network

The ResNeXt network is based on the design idea of ResNet’s cross-layer connection, and combines the VGG and Inception networks. And through the structure of ResNet cross-layer connection to improve the shortcomings of VGG network too deep degradation, the cross-layer connection structure is shown in Fig. 4.

Fig. 4

Cross-layer connection structure

The transformation set structure is shown in Fig. 5.

Fig. 5

Transform set structure

The convolution modules of the transform set are all the same. ResNeXt uses a transformation set to replace the transformation structure of the Inception network. Because each aggregated topology is the same, the network no longer needs to modify too many hyperparameters on different data sets, which has better robustness.

Model design process

The original ResNeXt-50 has five stages and a large number of parameters, as shown in Fig. 6.

Fig. 6

ResNeXt-50 module

During training, it is found that the results are difficult to converge and tend to be completely random. Therefore, it was determined that the network structure was too complicated. Starting from the complexity of the network, the network was tailored to try to find a suitable structure. The test results are shown in Table 2.

Table 2 Model optimization

Through the above experiments, the layers and depth of the network are continuously explored to train the model. Finally, it is concluded that a ResNeXt network with two stages and a depth of 2 in the second stage has the best performance, namely the final structure of Time-ResNeXt.

Time-ResNeXt network structure

The structure of Time-ResNeXt neural network is shown in Table 3.

Table 3 Time-ResNeXt neural network structure

It has two phases in total. The detailed network structure of the first phase is shown in Fig. 7.

Fig. 7

Detailed network structure of the first phase of Time-ResNeXt

The depth of the second phase of the network structure is 2, that is, two network structure sub-modules, each of which contains cross-layer connections, activation layers, convolutional layers, batch normalization layers, and transform set modules. The main structure is the transformation set module, which uses a network design structure in a network, is a module for forming a convolution transformation set by connecting 32 convolutional structural blocks as shown in Fig. 8 in parallel, which is the main feature extraction module.

Fig 8

Time-ResNeXt detailed network structure in the second stage

Model training


Use Adam’s algorithm as the optimizer. The Adam algorithm is an algorithm that performs a stepwise optimization on a random objective function. This algorithm is based on adaptive low-order moment estimation, has high computational efficiency and low memory requirements. The adaptive learning rate of different parameters can be calculated by estimating the first and second gradients. In addition, the gradient rescaling of Adam’s algorithm is invariant, so it is very suitable for solving problems with large-scale data or parameters.

The advantages are as follows: easy to implement, efficient calculation, less memory required, invariance of gradient diagonal scaling, and only minimal tuning. The parameter settings of the Adam optimizer are shown in Table 4.

Table 4 Adam optimizer parameters

Among them, lr refers to the step size, that is, the step size of each gradient descent. Decay is a weight decay factor, which avoids overfitting by adding a regular term to the loss function.

Loss function and evaluation index

The loss function uses the cross-entropy function of L2 regularization attenuation. The cross-entropy function is calculated as follows.

$$ L=-{\sum}_{i=1}^N{y}^{(i)}\log {\hat{y}}^{(i)}+\left(1-{y}^{(i)}\right)\log \left(1-{\hat{y}}^{(i)}\right) $$

In which, y(i)is the true label of each instance, and \( {\hat{y}}^{(i)} \)is the predicted probability value of each instance. Then, add regularized attenuation to the loss function to avoid overfitting. The method is shown in the following formula.

$$ C={C}_0+\frac{\lambda }{2n}{\sum}_{\omega }{\omega}^2 $$

In which, C0 is the original loss function, which is the cross-entropy function. The second term λ is a regular term coefficient, n is the number of training samples, and w is a parameter of the network. Weight decay (L2 regularization) can effectively prevent overfitting.

The evaluation index adopts the correct rate index. Here, the concepts of TP (true), TN (true negative), FP (false positive), and FN (false negative) are introduced first.

The accuracy calculation method is:

$$ \mathrm{Accuracy}=\frac{\mathrm{TP}+\mathrm{TN}}{\mathrm{TP}+\mathrm{TN}+\mathrm{FP}+\mathrm{FN}} $$

Early stop

In order to further avoid overfitting, an early stopping training strategy is adopted. When the model exceeds 30 consecutive generations of evaluation indicators and does not improve on the validation set, training is stopped. This can prevent the model from over-learning on the training set, avoid excessive bias, and reduce the generalization performance of the model.

Training process records

The results of the training set are shown in Fig. 9, the X-axis is the training algebra, and the Y-axis is the training evaluation index.

Fig. 9

Training set results

The results of the validation set are shown in Fig. 10.

Fig. 10

Validation set results

The results show that at 74th generation, the model performs best on the validation data, with a correct rate of 0.9150.

Results and discussion

Through continuous training of the model, the accuracy rate finally reached 0.9050, achieving an extremely advanced performance. Its pair is shown in Table 5.

Table 5 Model comparison

Other related evaluation indicators are shown in Table 6.

Table 6 Time-ResNeXt network evaluation

In addition, there are many areas in this mission where you can continue to improve. For example, you can use hard example mining to train difficult samples. Increasing the amount of data is also an extremely good method. The causes of epilepsy are complex. Trying more detailed multi-classification will help decouple the data and further reduce the difficulty of model training.

All in all, our classifier has achieved an extremely good performance and has excellent scalability on the Bern dataset in Barcelona. As the amount of data in real business scenarios increases, it will show even better performance.


Automatically detect dynamic EEG signals to reduce the time cost of epilepsy diagnosis. In the signal recognition of epilepsy electroencephalogram (EEG), traditional machine learning and statistical methods require manual feature labeling engineering in order to show excellent results on a single data set. Based on the design idea of ResNeXt deep neural network, this paper designs a Time-ResNeXt network structure suitable for time series EEG epilepsy detection to identify EEG signals. The accuracy of Time-ResNeXt in EEG epilepsy detection can reach 91.50%. The Time-ResNeXt network structure produces extremely advanced performance on a benchmark dataset, with great potential to improve clinical practice.

Availability of data and materials

Data sharing is not applicable to this article as no datasets were generated or analyzed during the current study.



World Health Organization


False negative


False positive


True negative


True positive


False positive rate


  1. 1.

    B. Wu, T.T. Cheng, T.L. Yip, Y. Wang, Fuzzy logic based dynamic decision-making system for intelligent navigation strategy within inland traffic separation schemes. Ocean Eng. 197, 106909 (2020)

    Article  Google Scholar 

  2. 2.

    Z. Huang, X. Xu, J. Ni, H. Zhu, W. Cheng, Multimodal representation learning for recommendation in Internet of Things. IEEE Internet Things J. 6(6), 10675–10685 (2019)

    Article  Google Scholar 

  3. 3.

    G.B. Boylan, N.J. Stevenson, S. Vanhatalo, Monitoring neonatal seizures. Semin. Fetal Neonat. M 18, 202–208 (2013)

    Article  Google Scholar 

  4. 4.

    R.O. Lloyd, J.M. O’Toole, E. Pavlidis, P.M. Filan, G.B. Boylan, Electrographic seizures during the early postnatal period in preterm infants. J. Pediatr. 187, 18–25 (2017)

    Article  Google Scholar 

  5. 5.

    D.M. Murray et al., Defining the gap between electrographic seizure burden, clinical expression, and staff recognition of neonatal seizures. Arch. Dis. Child-Fetal 93, F187–F191 (2008)

    Article  Google Scholar 

  6. 6.

    American Epilepsy Society, Facts and figures.

  7. 7.

    Zhenhua Huang, Xin Xu, Honghao Zhu, Meng Chu Zhou. An efficient group recommendation model with multiattention-based neural networks. IEEE Transactions on Neural Networks and Learning Systems (2020). doi:

  8. 8.

    T.N. Tsuchida et al., American Clinical Neurophysiology Society standardized EEG terminology and categorization for the description of continuous EEG monitoring in neonates: report of the American Clinical Neurophysiology Society critical care monitoring committee. J. Clin. Neurophysiol. 30, 161–173 (2013)

    MathSciNet  Article  Google Scholar 

  9. 9.

    P. Srinivasakumar et al., Treating EEG seizures in hypoxic ischemic encephalopathy: a randomized controlled trial. Pediatrics. 136, e1302–e1309 (2015)

    Article  Google Scholar 

  10. 10.

    A. Krumholz, S. Wiebe, G. Gronseth, S. Shinnar, P. Levisohn, T. Ting, J. Hopp, P. Shafer, H. Morris, L. Seiden, G. Barkley, J. French, Quality Standards Subcommittee of the American Academy of Neurology, Practice parameter: evaluating an apparent unprovoked first seizure in adults (an evidence-based review): report of the Quality Standards Subcommittee of the American Academy of Neurology and the American Epilepsy Society, American Epilepsy Society. Neurology 69, 21 (2007)

    Article  Google Scholar 

  11. 11.

    J.M. Rennie et al., Non-expert use of the cerebral function monitor for neonatal seizure detection. Arch. Dis. Child-Fetal 89, F37–F40 (2004)

    Article  Google Scholar 

  12. 12.

    A.T. Tzallas, M.G. Tsipouras, D.I. Fotiadis, Epileptic seizure detection in EEGs using time–frequency analysis. IEEE Trans. Inf. Technol. Biomed. 13(5), 703–710 (2009)

    Article  Google Scholar 

  13. 13.

    N. Kannathal, M.L. Choo, U.R. Acharya, et al., Entropies for detection of epilepsy in EEG. Comput. Methods Prog. Biomed. 80(3), 187–194 (2005)

    Article  Google Scholar 

  14. 14.

    H. Ocak, Automatic detection of epileptic seizures in EEG using discrete wavelet transform and approximate entropy. Expert Syst. Appl. 36(2), 2027–2036 (2009)

    Article  Google Scholar 

  15. 15.

    V. Srinivasan, C. Eswaran, N. Sriraam, Approximate entropy-based epileptic EEG detection using artificial neural networks. IEEE Trans. Inf. Technol. Biomed. 11(3), 288–295 (2007)

    Article  Google Scholar 

  16. 16.

    L. Guo, D. Rivero, J. Dorado, et al., Automatic epileptic seizure detection in EEGs based on line length feature and artificial neural networks. J. Neurosci. Methods 191(1), 101–109 (2010)

    Article  Google Scholar 

  17. 17.

    R. Tetzlaff, C. Niederhöfer, P. Fischer, Automated detection of a preseizure state: non-linear EEG analysis in epilepsy by cellular nonlinear networks and Volterra systems. International journal of circuit theory and applications 34(1), 89–108 (2006)

    Article  Google Scholar 

  18. 18.

    Simonyan K, Zisserman A. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.

  19. 19.

    Szegedy C, Liu W, Jia Y, et al. Going deeper with convolutions//Proceedings of the IEEE conference on computer vision and pattern recognition. 2015: 1-9.

  20. 20.

    He K, Zhang X, Ren S, et al. Deep residual learning for image recognition//Proceedings of the IEEE conference on computer vision and pattern recognition. 2016: 770-778.

  21. 21.

    Y. LeCun, Y. Bengio, G. Hinton, Deep learning. Nature 521, 436–444 (2015)

    Article  Google Scholar 

  22. 22.

    Glorot. X., Bordes. A., Bengio. Y., 2010. Deep sparse rectifier neural networks, Journal of Machine Learning Research, 15.

  23. 23.

    Goodfellow. I., Bengio. Y., Courville. A., 2016. Deep Learning. MIT Press,

  24. 24.

    J.G. Lee, S.H. Jun, Y.W. Cho, H. Lee, G.B. Kim, J.B. Seo, N. Kim, Deep learning in medical imaging: General overview. Korean J. Radiol. 18(4), 570–584 (2017)

    Article  Google Scholar 

  25. 25.

    Xie S, Girshick R, Dollár P, et al. Aggregated residual transformations for deep neural networks//Proceedings of the IEEE conference on computer vision and pattern recognition. 2017: 1492-1500.

  26. 26.

    R.G. Andrzejak, K. Schindler, C. Rummel, Nonrandomness, nonlinear dependence, and nonstationarity of electroencephalographic recordings from epilepsy patients. Phys. Rev. E 86(4), 046206 (2012)

    Article  Google Scholar 

  27. 27.

    Sharma, R., Pachori, R.B., Gautam, S.: Empirical mode decomposition based classification of focal and non-focal seizure EEG signals. In: Medical Biometrics, 2014 International Conference on. pp. 135–140. IEEE (2014).

  28. 28.

    R. Sharma, R.B. Pachori, U.R. Acharya, An integrated index for the identification of focal electroencephalogram signals using discrete wavelet transform and entropy measures. Entropy 17(8), 5218–5240 (2015)

    Article  Google Scholar 

  29. 29.

    A.B. Das, M.I.H. Bhuiyan, Discrimination and classification of focal and non-focal eeg signals using entropy-based features in the emd-dwt domain. Biomedical Signal Processing and Control 29, 11–21 (2016)

    Article  Google Scholar 

  30. 30.

    A. Bhattacharyya, M. Sharma, R.B. Pachori, P. Sircar, U.R. Acharya, A novel approach for automated detection of focal EEG signals using empirical wavelet transform. Neural Comput. & Applic. 29(8), 47–57 (2018)

    Article  Google Scholar 

Download references


The authors acknowledged the anonymous reviewers and editors for their efforts in valuable comments and suggestions.


This work was supported by the National Natural Science Foundation of China (61873281, 61572522, 61502535, 61972416, and 61672248).

Author information




S.Q. Wang proposes the innovation ideas and theoretical analysis, and S.D. Wang carries out experiments and data analysis. Z. Song and Y.F. Wang conceived of the study, participated in its design and coordination, and helped to draft the manuscript. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Shudong Wang.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Wang, S., Wang, S., Zhang, S. et al. Time-ResNeXt for epilepsy recognition based on EEG signals in wireless networks. J Wireless Com Network 2020, 195 (2020).

Download citation


  • Artificial intelligence
  • Deep learning
  • Epilepsy detection
  • Time-ResNeXt