Seizure detection using hierarchical temporal trend integration and self-supervised learning

Machine Learning


A consistent increase in the accuracy of seizure detection over time is shown for successive deep learning performance evaluations. Moderate results have been obtained by early CNN and RNN based approaches, and later architectures with attention, graph learning and multi-scale feature extraction have brought high gain in performance. The proposed models showed good generalization in the accuracy, precision, recall and F1-scores on all datasets. Collectively, the findings validate the reliability of classifications involving advanced feature fusion and the use of adaptive learning strategies compared with the current state-of-the-art. The term “proposed model” is used throughout the report for consistency, and signifies the Federated Temporal Learning (FTL) framework discussed in the methodology section.

To prevent data leakage, the data was split using patient-wise splitting method to decrease the chance of learning outcomes to some extent.To avoid data leakage, data splitting was done in three sections, namely 70% training, 10% validation, and 20% testing. The EEG signals were subdivided into one-second epochs. To overcome the issue of class imbalance, all the seizure samples were used and number of samples representing non-seizure (norm) samples was randomly selected during the training phase. The model was trained with Adam optimizer and learning rate 0.001, 100 epochs and a batch size of 32. The mixing coefficient δ was set to 0.7, and the split ratio τ was set to 0.5. Ablation studies were performed by removing HTTIM, TSCLM, and the joint training mechanism to evaluate their individual contributions.

Dataset details

TUSZ19

In this study, the EEG data set archived at Temple University Hospital (TUSZ v2.0.1) is used, which contains 675 patients’ recordings. Of these, more than 280 people had at least one seizure – totaling over 3,500 recorded seizures. The total recording time is over 5 million seconds of which the seizure portion typically accounts for 4–6% of the data set. TUSZ is one of the largest and widest available publicly available EEG repositories focused on epilepsy research. It contains a wide range of clinical information such as patient attributes (age, gender), medical history, frequency of seizures and drug details. The dataset encompasses eight types of seizures: FNSZ, GNSZ, ABSZ, CPSZ, TCSZ, TNSZ, SPSZ, and MYSZ, along with BCKG annotations denoting background activity. Because of the rarity of MYSZ events, only the other seven classes, the majority, were included in the present study.

Zenodo20

The Zenodo dataset includes multi-channel EEG recordings from 79 term neonates admitted to Neonatal Intensive Care Unit (NICU) at Helsinki University Hospital, averaged 74 min in length. Three expert clinicians rated each recording independently and on average about 460 seizures per clinician. Consensus led to 39 neonates being identified as having seizures, 22 as seizure-free, and the rest were inconclusive. All of the EEG signals were segmented in to 1-second epochs to facilitate consistent preprocessing. Non-seizure segments were temporally divided by non-overlapping windows and seizure segments were temporally divided by overlapping windows to achieve capturing the brief and rare segment of seizure. Specifically, seizure segments from the CHB-MIT and Zenodo datasets were filtered by 50% overlap, and those from the TUSZ and AUBMC datasets by 75% overlap due to the lesser number of specific seizure types. Any time period that covered a period of time during which seizures occurred was classified as seizure and the remainder as non-seizure. To overcome the inherent class imbalance of the seizure detection task, training dataset was created by keeping all of seizure segments and randomly sampling equal number of non-seizure segments. The proposed strategy improves the model’s power to learn discriminative features to robustly detect seizure from heterogeneous clinical datasets.

State-of-art techniques

  • CNN-RNN (2020)21: CNNs extract spatial EEG features while RNNs model temporal dynamics, capturing short- and long-term dependencies for seizure recognition.

  • GASF-CNN (2021)22: Converts EEG time series to GASF images and applies CNNs to learn spatial correlations, improving classification accuracy.

  • SincNet-Conv1D (2021)23: Uses parameterized sinc filters to learn frequency-selective features directly from raw EEG, boosting efficiency and interpretability.

  • GGN (2022)24: Represents EEG as a channel–connectivity graph; graph convolutions capture spatial dependencies for robust, cross-subject detection.

  • LightSeizureNet (2022)25: Lightweight depthwise‑separable CNN with residual shortcuts for real-time seizure detection on constrained hardware.

  • EEGNet (2023)26: Compact CNN combining temporal filtering with depthwise spatial convolutions; effective on limited data and remains interpretable.

  • Meta-GNN (2023)27: Meta-learning within a GNN adapts to inter‑patient variability, enhancing cross-subject generalization with few labels.

  • 3D-CBAMNet (2023)28: 3D convolutions plus channel/spatial attention emphasize seizure‑relevant spatiotemporal regions.

  • RNN (2023)29: Models temporal correlations in EEG but can suffer vanishing gradients compared with gated variants.

  • CNN and RNNs (2024)30: Hybrid pipeline where CNN features are temporally contextualized by RNN layers, balancing spatial and temporal cues.

  • ResBiLSTM (2024)31: Residual connections with BiLSTM capture bidirectional dependencies while mitigating gradient issues.

  • Stacked LSTM (2024)32: Multi-layer LSTMs learn higher‑order temporal structure for long-record seizure detection.

  • PCC-CNN (2024)33: Integrates Pearson-correlation features with CNNs to exploit inter‑channel synchronization changes.

  • Two-Layer LSTM (2024)34: Stacked two-layer LSTM strengthens long‑term dependency learning and temporal coherence.

  • GGN-BiGRU (2024)35: Graph-based spatial encoding combined with bidirectional GRUs for stronger spatiotemporal modeling.

  • MultiSincNet (2024)36: Parallel sinc-filter paths learn multi-band spectral features, improving noise robustness.

  • DistilCLIP-EEG Teacher [37] [ES]: High‑capacity contrastive/distillation model aligning multimodal EEG embeddings to supervise student networks.

  • DistilCLIP-EEG Student [37][ES]: Distilled, lightweight model that retains the teacher’s discriminative power for real‑time deployment.

Results

Results on TUSZ dataset

Table 1 shows a relative improvement in accuracy (%) over time for the different models of seizures detected across the different accuracy units. A few of the previous frameworks had their accuracy as 89.04% (RNN 2023), 89.96% (GASF-CNN 2021) and 90.61% (CNN-RNN 2020), respectively. The following models achieve moderate improvements over this range (PCC-CNN in 2024 at 90.94% and CNN and RNNs in 2024 at 91.37%, as well as Two-Layer LSTM in 2024 at 91.37%). SincNet-Conv1D (2021), ResBiLSTM (2024), and Stacked LSTM (2024) further refined performance with accuracies of 91.48%, 91.63%, and 91.96%, respectively. Further, more modern versions brought radical enhancements, achieving a score of 93.84% in the case of EEGNet (2023), and 97% for Meta-GNN (2023). The accuracy for the proposed DistilCLIP-EEG Student [ES] Model and Teacher [ES] Model were 97.12% and 97.75%, respectively, which is a good generalization result. State-of-the-art architectures such as GGN-BiGRU (2024), MultiSincNet (2024), LightSeizureNet (2022), and GGN (2022) delivered near-saturated performance, ranging from 98.19% to 98.64%. McCann (2023) further advanced accuracy to 98.93%, while the proposed PS model achieved the highest accuracy of 99.16%, underscoring its superior capability in accurate seizure classification. Comparison on state-of-art techniques for accuracy on TUSZ dataset are in Fig. 3.

Fig. 3
Fig. 3

Comparison on state-of-art techniques for accuracy on TUSZ dataset.

When the seizure detection models are compared based on precision (%), it can be observed that the classification accuracy of the models improves with time. The early works such as RNN (2023) and GASF-CNN (2021) had a precision of 88.93% and 90.67%, respectively; whereas CNN-RNN (2020), PCC-CNN (2024) and CNN and RNNs (2024) brought modest enhancements in the ranges of 90.15% to 90.78% precision. Two-Layer LSTM (2024), SincNet-Conv1D (2021), ResBiLSTM (2024), and Stacked LSTM (2024) were found with values of 91.22% to 91.97%. EEGNet (2023) achieved a precision of 93.56%, and the advanced models, like 3D-CBAMNet (2023) and Meta-GNN (2023), recorded a precision of 96.4% and 97.38% respectively. The proposed models Student [ES] and Teacher [ES] achieved highly accurate precision with values of 97.21% and 97.81% respectively, showing the high accuracy of the models with respect to keeping precise across seizure classes. In comparison to this, state-of-the-art models like GGN-BiGRU (2024), MultiSincNet (2024), LightSeizureNet (2022), GGN (2022) and McCann (2023) produced outstanding precision between 98.14% and 98.62%. However, the PS model produced a peak precision of 99.19%, demonstrating its greatest reliability for seizure identification. Results across state of the art techniques in terms of comparison is available on TUSZ dataset in Fig. 4.

Fig. 4
Fig. 4

Comparison on state-of-art techniques for Precision on TUSZ dataset.

Sensitivities and detection reliability (recall (%) for different detection methods shows a reliable and consistent increase as time progressed. The CNN-RNN (2020) model achieved a recall of 85.11%, followed by GASF-CNN (2021) and RNN (2023) with 86.45% and 88.11%, respectively. The hybrid CNN and RNN-based architectures including CNN and RNNs (2024), PCC-CNN (2024) showed moderate improvements of 91.11%–91.83%.CNN and RNNs (2024) and PCC-CNN (2024) witnessed moderate improvements of 91.11%–91.83%. Significantly, DistilCLIP-EEG Teacher (ES) and Student (PS) models performed well with 96.26% and 96.56% recall respectively, indicating their improved capability of detection. The near-optimal recall value of 98.17% to 98.36% was accomplished by more recent frameworks, including 3D-CBAMNet (2023) and Meta-GNN (2023), as well as LLark (2022), MultiSincNet (2024), and GGN (2022). The McCann (2023) model used 98.81% whereas the PS model generated highest recall of 99.65%, showing its better capacity of detecting the seizure events with high sensitivity. Comparison on state-of-art techniques for Recall on TUSZ dataset are in Fig. 5.

Fig. 5
Fig. 5

Comparison on state-of-art techniques for Recall on TUSZ dataset.

The F1-score (%) comparison across different seizure detection methods highlights a steady progression in balanced classification performance over successive model generations. Early architectures such as CNN-RNN (2020), GASF-CNN (2021), and RNN (2023) achieved moderate F1-scores of 88.17%, 88.51%, and 88.52%, respectively. Following these hybrid models, PCC-CNN (2024) achieved a precision 90.63% and recall 77.50% while CNN+RNNs (2024) had a precision 90.94% and recall 84.08%. The sequential architectures such as Two-Layer LSTM (2024), ResBiLSTM (2024), Stacked LSTM (2024) and SincNet-Conv1D (2021) further improved the stability and temporal feature extraction, achieving F1-scores ranging from 91.28% to 91.65%. EEGNet (2023) showed better generalization performance with 92.69%, and “meta” architectures, including Meta-GNN (2023), DistilCLIP-EEG Student [ES] (96.8%), 3D-CBAMNet (2023) and DistilCLIP-EEG Teacher [ES] (97.77%), demonstrated better consistency. Among state-of-the-art frameworks, GGN-BiGRU (2024), MultiSincNet (2024), LightSeizureNet (2022), and GGN (2022) demonstrated excellent class discrimination, delivering F1-scores between 98.16% and 98.42%. The McCann (2023) model slightly surpassed them with 98.72%, while the proposed PS model attained the highest F1-score of 99.15%, reflecting its exceptional capability in achieving both high precision and recall for accurate seizure detection. Comparison on state-of-art techniques for F1-score on TUSZ dataset are in Fig. 6.

Fig. 6
Fig. 6

Comparison on state-of-art techniques for F1-score on TUSZ dataset.

Multiclass

We evaluate seizure classification on the TUH EEG Seizure Corpus (TUSZ) over eight labels: ABSZ (absence), BCKG (background/non-seizure), CPSZ (complex partial), FNSZ (focal non-specific), GNSZ (generalized), SPSZ (simple partial), TCSZ (tonic–clonic), and TNSZ (tonic). multiclass seizure detection is in Fig. 7. The proposed model yields uniform improvements over the existing model, raising macro-accuracy from 95.87% to 97.17% (+ 1.30 pp), macro-precision from 94.20% to 95.10% (+ 0.90 pp), and macro-recall from 95.87% to 96.98% (+ 1.11 pp). The largest per-class gains are observed for ABSZ (+ 3.5 pp accuracy, + 2.0 pp precision, + 2.5 pp recall) and FNSZ (+ 2.0, + 0.5, + 2.2 pp), with consistent ~ 0.5–1.0 pp gains elsewhere, indicating better detection of both focal and generalized events without sacrificing background discrimination.

Fig. 7
Fig. 7

Multiclass seizure detection.

Results on Zenodo dataset

The accuracy (%) comparison across various seizure detection methods demonstrates a clear and consistent improvement over time, reflecting the evolution of deep learning architectures for EEG-based analysis. Early frameworks such as CNN-RNN (2020), GASF-CNN (2021), and SincNet-Conv1D (2021) achieved moderate accuracies of 71.9%, 79.39%, and 81.84%, respectively. Subsequent models like GGN (2022) and LightSeizureNet (2022) enhanced classification performance to 83.53% and 84.03%, while EEGNet (2023) and McCann (2023) further improved accuracy to 84.42% and 85.87%. Advanced graph and attention-driven models, including Meta-GNN (2023) and 3D-CBAMNet (2023), achieved accuracies of 87.21% and 87.61%, respectively, indicating notable progress in feature representation.

More recent architectures, such as RNN (2023), CNN and RNNs (2024), ResBiLSTM (2024), and Stacked LSTM (2024), demonstrated accuracies ranging from 90.39% to 91.9%, showing the benefits of temporal modeling and deeper recurrent structures. The PCC-CNN (2024), Two-Layer LSTM (2024), GGN-BiGRU (2024), and MultiSincNet (2024) models achieved further refinement, with accuracies between 93.53% and 93.95%. The proposed DistilCLIP-EEG models showed strong generalization, with the Teacher [ES] and Student [ES] versions attaining 94.1% and 94.61%, respectively. Finally, the PS model achieved the highest accuracy of 95.61%, marking a significant advancement and underscoring its superior capability for precise seizure classification. comparison on state-of-art techniques for accuracy on Zenodo dataset are in Fig. 8.

Fig. 8
Fig. 8

Comparison on state-of-art techniques for accuracy on Zenodo dataset.

The precision (%) analysis across different seizure detection models reveals a steady and substantial enhancement in prediction reliability and model discrimination over the years. Early deep learning architectures have shown satisfactory results like CNN-RNN (2020, 0.7597 precision), GASF-CNN (2021, 0.7996 precision) and SincNet-Conv1D (2021, 0.8308 precision). The following models such as GGN (2022) and LightSeizureNet (2022) made minor improvements to precision of 83.76% and 83.82% respectively, and EEGNet (2023) and McCann (2023) achieved Precisiions 84.22% and 86.21% respectively, with improved feature extraction and the temporal representation, respectively.

Advanced Graph-based and Hybrid models, such as Meta-GNN (2023) and 3D-CBAMNet (2023), achieved a precision score of 85.31% and 85.96% respectively, which emphasized noteworthy precisions for classification. The next generation of RNN (2023) and CNN and RNNs (2024), ResBiLSTM (2024), and Stacked LSTM (2024) further boosted accuracy to between 91.18% and 91.63%. More recent frameworks such as PCC-CNN (2024), Two-Layer LSTM (2024), MultiSincNet (2024), and GGN-BiGRU (2024) exhibited enhanced performance with precision values from 93.37% to 93.91%. There was high consistency in seizure classification between both proposed for both the models: the DistilCLIP-EEG Teacher model had a precision of 95% while the DistilCLIP-EEG Student model had a precision of 95.78%. The best results for the classification were obtained in the PS model with the precision of 96.78%, which represents a marked improvement in terms of the accuracy of the classification, as the other models achieved values between 85% and 87%. comparison of the state-of-the-art techniques are shown in Fig. 9.

Fig. 9
Fig. 9

Comparison on state-of-art techniques for Precision on Zenodo dataset.

The recall (%) comparison is presented for different seizure detection models, showcasing the progressively improved sensitivity and the capacity to correctly detect seizure moments for different data sets. CNN-RNN (2020), GASF-CNN (2021), SincNet-Conv1D (2021) were the first deep learning models that achieved the recall score of 64.04%, 79.59%, and 79.95%, respectively, for detecting all seizure occurances. A gradual improvement in architectures such as GGN (2022) with 83.93% recall, LightSeizureNet (2022) with recall of 84.33% and then EEGNet(2023) with 84.33% and McCann (2023) with 85.41% achieved better results respectively.Advanced hybrid and graph-based models like Meta-GNN (2023), CNN and RNNs (2024), and 3D-CBAMNet (2023) showed significantly better performance with a recall of 89.9% − 90.49%. The RNN (2023), ResBiLSTM (2024), and Stacked LSTM (2024) models exhibited improvements in recall (90.91% to 91.54%), which indicates its learning from time. The proposed frameworks in DistilCLIP-EEG showed substantial improvement, obtaining recall of 93.1% for the Teacher [ES] model and 93.33% for the Student [ES] model, respectively, indicating that the model has high sensitivity and good generalization.

Other progresses were made by MultiSincNet (2024) achieved 93.41% up to 93.99% in terms of recall rate, demonstrating strong performance in seizure event detection under a range of clinical setting, PCCCNN (2024) with 93.96%, Two-Layer LSTM (2024) with 93.99% and GGN-BiGRU (2024) with 93.99%, respectively. Fewer false negatives were obtained with the PS model compared to other existing models, as seen in Figure 10, which indicates the model Recall on Zenodo dataset of great sensitivity and reliability among the current models.

Fig. 10
Fig. 10

Comparison on state-of-art techniques for Recall on Zenodo dataset.

The F1-score (%) comparison across different seizure detection architectures highlights a continuous and significant improvement in balanced classification capability—reflecting the effective trade-off between precision and recall achieved by successive models. Early approaches such as CNN-RNN (2020), GASF-CNN (2021), and SincNet-Conv1D (2021) demonstrated foundational performance with F1-scores of 69.5%, 79.47%, and 81.49%, respectively. This performance improved moderately in the GGN (2022) and LightSeizureNet (2022) models, which achieved 83.54% and 84.07%, while EEGNet (2023) and McCann (2023) pushed the boundary further to 84.47% and 85.81%, indicating enhanced feature extraction and temporal consistency.

More advanced models, including Meta-GNN (2023) and 3D-CBAMNet (2023), achieved F1-scores of 87.54% and 87.88%, respectively, showing greater reliability in handling complex EEG signal variations. The RNN (2023), CNN and RNNs (2024) models further improved performance up to 91% while ResBiLSTM (2024), Stacked LSTM (2024), and Two-Layer LSTM (2024) showed stable and consistent performances from 91.51% to 93.8%. In particular, PCC-CNN (2024) produced good results between 93.37% and 93.91%, indicating its ability to decrease discrimination and enhance generalization in the patient variations.Notably, PCC-CNN (2024) got a score of 93.37% and79.91% indicating improved patient variations sensitivity and generalization.

With the proposed DistilCLIP-EEG Teacher [ES] and Student [ES] models, the performances were improved to 94.04% and 94.54% respectively, indicating that good feature distillation and domain adaptation was achieved. Finally, the PS model achieved the highest F1-score of 96.87%, clearly outperforming all previous architectures and establishing itself as the most balanced and efficient framework for accurate and reliable seizure detection. comparison on state-of-art techniques F1-score on Zenodo dataset are in Fig. 11.

Fig. 11
Fig. 11

Comparison on state-of-art techniques F1-score on Zenodo dataset.

Generalization across diverse clinical populations

The proposed framework was evaluated on multiple publicly available EEG datasets encompassing neonatal, pediatric, and adult seizure recordings. These datasets provide significant variability in seizure morphology and recording conditions.

However, it is acknowledged that real-world clinical deployment may involve substantially larger populations with greater diversity in age, ethnicity, comorbidities, medication histories, and neurological conditions.

Future work will investigate large-scale validation using multi-institutional clinical datasets containing tens of thousands of patients to further assess model robustness and generalizability.

Although the proposed NSS framework demonstrated strong performance across multiple benchmark datasets, the current evaluation remains limited by the availability of publicly accessible annotated seizure datasets.

Consequently, further validation on larger clinical repositories and prospective patient cohorts is required before widespread clinical adoption.

Comparison with traditional time-series models

Traditional time-series approaches such as ARIMA are effective for stationary temporal processes but often struggle to model the complex non-linear dynamics and abrupt temporal variations present in EEG seizure activity.

In contrast, the proposed HTTIM module captures hierarchical temporal relationships across multiple time scales, enabling more effective representation of seizure evolution patterns.

Future work will include direct empirical comparisons with ARIMA and related statistical forecasting approaches.

Comparison with conventional deep learning models

Convolutional Neural Networks (CNNs) primarily focus on extracting spatial patterns, while Recurrent Neural Networks (RNNs) emphasize sequential temporal dependencies.

The proposed NSS framework combines hierarchical temporal representation learning, federated optimization, self-supervised learning, and swarm-based adaptation within a unified architecture. This integration enables more robust seizure detection under limited labeled data conditions compared with standalone CNN- or RNN-based approaches.

Robustness to missing and corrupted data

In practical healthcare environments, EEG recordings may contain missing segments, noisy channels, or corrupted measurements caused by sensor displacement or communication failures.

The federated architecture of NSS naturally supports distributed data processing and reduces dependence on complete centralized datasets. However, severe data corruption may still affect detection performance.

Future research will investigate adaptive imputation mechanisms, uncertainty-aware learning, and multimodal redundancy strategies to improve robustness against missing or corrupted EEG signals.



Source link