Abstract
OBJECTIVE: Manually distinguishing between seizure and non-seizure events in intracranial electroencephalography (iEEG) recordings is highly time-consuming. In this study, we explored AI-based approaches for electrographic seizure classification (ESC) and seizure onset detection (SOD) in treatment-resistant epilepsy patients. ESC involves distinguishing seizure events from non-seizure activity, while SOD focuses on pinpointing the exact moment a seizure begins. METHODS: We assessed several image-based and time-series-based model architectures for ESC and SOD, including convolutional neural networks (CNNs), vision transformers (ViTs), and time-series transformers. We used a dataset of approximately 560,000 iEEG traces from 291 focal epilepsy patients implanted with the NeuroPace RNS system. We conducted extensive experimentation, varying the number of trainable parameters, input formats, and weight initializations to assess performance. RESULTS: ViTs showed superior performance across both ESC and SOD, outperforming other models. For ESC, ViTs achieved a mean seizure classification accuracy of 97$\%$ across five folds of data, and an accuracy of 96$\%$ on a separate clinician-annotated test dataset. In the SOD task, ViTs showed an average median absolute error (MAE) of 1.4 seconds between model-predicted and human-labeled seizure onsets across five folds, and an MAE of 0.8 s on the separate clinician-annotated test dataset. CONCLUSION: These findings highlight the advantage of image-based AI approaches, particularly ViTs, in capturing nuanced seizure patterns from iEEG data. SIGNIFICANCE: AI-driven ESC and SOD could support the development of more personalized treatment strategies for epilepsy patients while reducing the time required for manual review.