Frequency-aware transformer networks for robust and generalizable EEG-based seizure detection
Mostafa Gamal1,2, Mustafa Abdel-Wanes3
1Department of Artificial Intelligence, Faculty of Computers and Artificial Intelligence, Benha University, Benha, 13518, Egypt. mostafa-gamal@eru.edu.eg.
Abstract:
Automated epileptic seizure detection from electroencephalogram (EEG) signals remains a critical challenge for real-world clinical deployment due to the complex, nonstationary, and multi-scale nature of neural dynamics. Existing deep learning approaches, including convolutional and transformer-based models, often fail to jointly capture spectral-temporal dependencies while maintaining robustness across heterogeneous datasets and noisy clinical environments. In this work, we propose BrainXNet, a novel multi-scale spectro-temporal attention framework that unifies local feature extraction, frequency-aware representation learning, and global temporal modeling within a single architecture. The proposed model integrates (i) multi-scale convolutional pathways to capture transient and long-duration EEG patterns, (ii) a spectral attention module that dynamically emphasizes clinically relevant frequency bands, and (iii) a temporal transformer encoder for modeling long-range dependencies across EEG sequences. Extensive evaluations on two large-scale benchmark datasets, CHB-MIT and TUH Seizure Corpus, demonstrate that BrainXNet achieves state-of-the-art performance, reaching accuracies of 99.1% and 98.4%, respectively. Beyond in-dataset performance, the proposed framework exhibits strong cross-dataset generalization, maintaining over 94% accuracy in transfer settings, and demonstrates high robustness under noisy conditions. Ablation studies further confirm the complementary contributions of each architectural component. These results highlight the effectiveness of explicitly modeling multi-scale spectro-temporal dynamics for EEG analysis and position BrainXNet as a promising candidate for reliable, real-time clinical seizure detection systems. This work bridges the gap between high-performance experimental models and practical deployment in diverse healthcare environments.

