DeepEpilepsy: Deep Learning Models for Epilepsy Diagnosis from Routine EEG

ViT_architecture

Model Description

DeepEpilepsy is a collection of deep learning models trained to identify epilepsy from routine EEG recordings. These models complement traditional interpretation based on interictal epileptiform discharges by detecting novel EEG patterns relevant to epilepsy diagnosis.

Paper: Improving diagnostic accuracy of routine EEG for epilepsy using deep learning (Brain Communications, 2025)

Repository: GitLab Repository - See README for full documentation and preprocessing code

Model Variants

  • DeepEpilepsy-Large: ViT1d_Conv1d_large_50 (flagship model, 50-point patches)
  • DeepEpilepsy-Small: ViT1d_Conv1d_small_200 (200-point patches)
  • Variants available for 10s and 30s EEG segments

Additional architectures: SimpleViT1d, ConvNeXt, InceptionTime, ShallowConvNet

Usage

import torch
from epileptology.ml.models.transformers import ViT1d
from epileptology.utils.parsers import parse_config

# Load configuration
config = parse_config("proj_config.yaml")
training_config = parse_config(config["data"]["sweep_config"])

# Initialize model (example: DeepEpilepsy-Large-30s)
model_name = "ViT1d_Conv1d_large_50"
SFREQ = 200
SEGMENT_DURATION = 30
model_config = training_config[model_name]["model"]
model_config.update({
    "n_class": 2,
    "n_timepoints": int(SFREQ * SEGMENT_DURATION)
})

model = ViT1d(**model_config)
model.load_state_dict(torch.load("path/to/model.pt"))
model.eval()

# Preprocess EEG (shape: n_channels, n_timepoints)
def standard_scale(eeg, eps=1e-20):
    means = eeg.mean(dim=-1, keepdim=True)
    stds = eeg.std(dim=-1, keepdim=True) + eps
    return (eeg - means) / stds

# Crop to segment duration and normalize
eeg_segment = eeg_segment[..., :int(SFREQ * SEGMENT_DURATION)]
eeg_segment = standard_scale(eeg_segment).unsqueeze(0)  # Add batch dimension

# Inference
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
with torch.no_grad():
    predictions = model(eeg_segment.to(device))
    probabilities = torch.softmax(predictions, dim=1)

Note: See the GitLab repository README for complete preprocessing pipeline, BIDS format requirements, and dataloader examples.

Training Data

  • 948 routine EEG recordings from 846 patients
  • Tertiary care center (CHUM, Montreal)
  • Temporal split: Training/validation (Jan 2018 - Jul 2019), Testing (Jul - Sep 2019)
  • Median follow-up: 2.2 years (training), 1.7 years (testing)

Performance

DeepEpilepsy (flagship model):

  • AUROC: 0.76 (95% CI: 0.69–0.83)
  • Combined with interictal discharges: 0.83 (95% CI: 0.77–0.89)
  • Outperforms interictal discharge-based interpretation (AUROC: 0.69)

Citation

@article{10.1093/braincomms/fcaf319,
    author = {Lemoine, Émile and Toffa, Denahin and Xu, An Qi and Tessier, Jean-Daniel and Jemel, Mezen and Lesage, Frédéric and Nguyen, Dang K and Bou Assi, Elie},
    title = {Improving diagnostic accuracy of routine EEG for epilepsy using deep learning},
    journal = {Brain Communications},
    pages = {fcaf319},
    year = {2025},
    doi = {10.1093/braincomms/fcaf319},
    url = {https://doi.org/10.1093/braincomms/fcaf319}
}

Authors

Émile Lemoine, Denahin Toffa, An Qi Xu, Jean-Daniel Tessier, Mezen Jemel, Frédéric Lesage, Dang Khoa Nguyen, Elie Bou Assi

Contact

For questions, please contact the corresponding author or submit an issue on the GitLab repository.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support