Systematic Evaluation of Deep Learning Architectures for Epilepsy Detection with Patient-Based Validation
Keywords:
EEG, Epileptic Seizure Detection, Deep Learning, 1D-CNN, Attention Mechanism, Model Calibration, STFT RepresentationAbstract
EEG signal processing is crucial for diagnosing neurological diseases, such as epilepsy. This
study systematically compares the performance of time-domain and time-frequency domain
representations in detecting epilepsy seizures. The data were divided into four-second windows at a
sampling frequency of 256 Hz, and data leakage was prevented by applying a patient-based
discrimination protocol. The training, validation, and test sets were separated by patient IDs, and
windows from the same patient were not included in more than one partition. Six deep learning models,
including BiLSTM, 1D-CNN, STFT-CNN, STFT-CNN with attention mechanism, ResSTFT-CNN, and
ResSTFT-CNN with attention mechanism, were evaluated under the same training conditions. AdamW
optimization, label smoothing, and early stopping algorithms were applied to all models. The models
were compared in terms of accuracy, F1-Macro, AUROC, AUPRC, calibration metrics, and inference
rate. Results showed that the 1D-CNN model exhibited significant superiority. The model offered the
most balanced performance with an accuracy of 0.957, an AUROC of 0.993, and an inference time per
sample of 0.09 milliseconds. BiLSTM came in second with 0.936 accuracy. For STFT-based models, the
addition of an attention mechanism significantly improved performance, with STFT-CNN accuracy
increasing from 0.78 to 0.91. Model complexity analyses revealed that 1D-CNN strikes a balance
between high performance and a low parameter count. Working in the time-domain representation, 1D
CNN offers an optimal solution for epilepsy detection, striking a balance between accuracy, speed, and
clinical applicability. The patient-based discrimination strategy allows for the realistic generalization
capacity of the models to be evaluated.
Downloads
References
A. F. Almurshedi, “Envelope analysis and short time Fourier transform of EEG for epilepsy diagnosis enhancement,” Romanian Journal of Neurology Revista Romana De Neurologie, 2025, doi: https://doi.org/10.37897/RJN.2025.1.12.
Y. K. L. C. W. N. F. C. W. F. A. Zabidi W. Mansor, “Short-time Fourier Transform analysis of EEG signal generated during imagined writing,” 2012 International Conference on System Engineering and Technology (ICSET), 2012, doi: https://doi.org/10.1109/icsengt.2012.6339284.
M. S. Badreddine Mandhouj Mohamed Ali Cherni, “An automated classification of EEG signals based on spectrogram and CNN for epilepsy diagnosis,” Analog Integr Circuits Signal Process, vol. 108, no. 1, pp. 101–110, 2021, doi: https://doi.org/10.1007/s10470-021-01805-2.
P. D. P. B. M. N. S. R. P. Nagabushanam S. Thomas George, “Artifact Removal using Elliptic Filter and Classification using 1D-CNN for EEG signals,” 2020 6th International Conference on Advanced Computing and Communication Systems (ICACCS), pp. 551–556, 2020, doi: https://doi.org/10.1109/icaccs48705.2020.9074287.
W. U. Oscar Flores-Palermo Christian Espiritu-Cueva, “Development of 1D-CNN Methods for Classifying Pediatric Epilepsy Through EEG Signals,” Communications in Computer and Information Science, pp. 401–415, 2025, doi: https://doi.org/10.1007/978-3-031-91428-7_28.
A. T. Anuradha Chaudhary, “A 2D-CNN-Scalogram based Approach to Classify the Mental Tasks using EEG Signals,” 2022 6th International Conference on Intelligent Computing and Control Systems (ICICCS), pp. 106–112, 2022, doi: https://doi.org/10.1109/iciccs53718.2022.9787994.
Y. Z. Wuqiao Liu, “Motor Imagery Tasks EEG Signals Classification Using ResNet with Multi-Time-Frequency Representation,” 2022 7th International Conference on Intelligent Computing and Signal Processing (ICSP), pp. 2026–2029, 2022, doi: https://doi.org/10.1109/icsp54964.2022.9778786.
D. D. ANTARA GHOSH, “Digital Twin for EEG seizure prediction using time reassigned Multisynchrosqueezing transform-based CNN-BiLSTM-Attention mechanism model,” Biomed Phys Eng Express, 2025, doi: https://doi.org/10.1088/2057-1976/ad992c.
Z. W. H. C. Yandong Ru Gaoyang An, “Epilepsy detection based on multi-head self-attention mechanism,” PLoS One, vol. 19, no. 6, pp. e0305166–e0305166, 2024, doi: https://doi.org/10.1371/journal.pone.0305166.
H. W. Boyang Lu Sheng Ge, “EEG-Based Classification of Lower Limb Motor Imagery with STFT and CNN,” Communications in Computer and Information Science, pp. 397–404, 2021, doi: https://doi.org/10.1007/978-3-030-92310-5_46.
A. C. Jiacheng Wu Yi Zhong, “Radio Modulation Classification Using STFT Spectrogram and CNN,” 2021 7th International Conference on Computer and Communications (ICCC), pp. 178–182, 2021, doi: https://doi.org/10.1109/iccc54389.2021.9674714.
[12] R. K. M. G. Dhouha Sagga Amira Echtioui, “Epileptic Seizure Detection using EEG Signals based on 1D-CNN Approach,” 2020 20th International Conference on Sciences and Techniques of Automatic Control and Computer Engineering (STA), pp. 51–56, 2020, doi: https://doi.org/10.1109/sta50679.2020.9329321.
S. S. T. K. Anurag Singh Nalini Pusarla, “CNN-based Epilepsy detection using image like features of EEG signals,” 2020 International Conference on Electrical and Electronics Engineering (ICE3), pp. 280–284, 2020, doi: https://doi.org/10.1109/ice348803.2020.9122874.
S. C. Tabassum Islam Toma, “A Comparative Analysis of 2D Deep CNN Models for Arrhythmia Detection Using STFT-Based Long Duration ECG Spectrogram,” 2022 Thirteenth International Conference on Ubiquitous and Future Networks (ICUFN), pp. 483–488, 2022, doi: https://doi.org/10.1109/icufn55119.2022.9829574.
J. Guttag, “CHB-MIT Scalp EEG Database (version 1.0.0),” 2010, PhysioNet. doi: 10.13026/C2K01R.
A. Shoeb, “Application of Machine Learning to Epileptic Seizure Onset Detection and Treatment,” Massachusetts Institute of Technology, Cambridge, MA, USA, 2009.
A. L. Goldberger et al., “PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals,” Circulation, vol. 101, no. 23, pp. e215–e220, 2000, doi: 10.1161/01.CIR.101.23.e215.
R. Saemaldahr and M. Ilyas, “Patient-Specific Preictal Pattern-Aware Epileptic Seizure Prediction with Federated Learning,” Sensors, vol. 23, no. 14, 2023, doi: 10.3390/s23146578.