SPERA_EEG / README.md
sees4321's picture
Update README.md
c405aa5 verified
|
Raw History Blame Contribute Delete
8.85 kB
metadata
license: cc-by-nc-4.0
library_name: transformers
tags:
  - eeg
  - biosignal
  - time-series
  - foundation-model
  - self-supervised-learning
  - representation-learning
  - transformer
  - jepa
  - neuroscience
  - brain-computer-interface
  - neurips-2026
  - arxiv:2610.10571
metrics:
  - balanced_accuracy
model-index:
  - name: SPERA-Base
    results:
      - task:
          type: time-series-classification
          name: Imagined Speech Classification
        dataset:
          type: BCIC2020-3
          name: BCIC2020-3
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.6504
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.502
      - task:
          type: time-series-classification
          name: Motor Imagery Classification
        dataset:
          type: BCIC-IV-2a
          name: BCIC-IV-2a
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.6816
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.56
      - task:
          type: time-series-classification
          name: Motor Imagery Classification
        dataset:
          type: PhysioNet-MI
          name: PhysioNet-MI
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.6726
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.551
      - task:
          type: time-series-classification
          name: Emotion Recognition
        dataset:
          type: FACED
          name: FACED
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.5754
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.478
      - task:
          type: time-series-classification
          name: Mental Stress Detection
        dataset:
          type: MAT
          name: Mental Arithmetic (MAT)
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.7778
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.672
      - task:
          type: time-series-classification
          name: Sleep Staging
        dataset:
          type: ISRUC
          name: ISRUC
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.8137
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.772
      - task:
          type: time-series-classification
          name: Mental Disorder Diagnosis
        dataset:
          type: Mumtaz
          name: Mumtaz
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.9637
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.944
      - task:
          type: time-series-classification
          name: EEG Abnormality Detection
        dataset:
          type: TUAB
          name: TUAB
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.8488
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.821
      - task:
          type: time-series-classification
          name: Event Type Classification
        dataset:
          type: TUEV
          name: TUEV
        metrics:
          - type: balanced_accuracy
            name: Balanced Accuracy - LPFT
            value: 0.7684
          - type: balanced_accuracy
            name: Balanced Accuracy - LP
            value: 0.651

SPERA: Spherical Prior EEG Foundation Model with Geometry- and Frequency-Aware Latent Prediction

Paper GitHub NeurIPS 2026: Accepted Model License

Minsu Kim, Ye-Sung Kim, Hyeseong Jeon, Wooseok Hyung, Joshua Lee, and Chang-Hwan Im

Hanyang University, Republic of Korea

Model Overview

SPERA (Spherical Prior EEG Representation Architecture) is a self-supervised EEG foundation model designed to learn transferable representations across diverse EEG datasets, subjects, and electrode montages. SPERA adopts a joint-embedding predictive architecture (JEPA) to learn EEG representations through latent-space prediction rather than raw signal reconstruction. Its central contribution is a learnable Legendre-polynomial spherical prior that explicitly incorporates scalp electrode geometry into attention.

This repository provides the pretrained weights of SPERA-Base (194M parameters).

Pretraining Data

SPERA was pretrained on a large-scale, multi-domain EEG corpus covering clinical, cognitive, and brain-computer interface (BCI) applications.

Statistic Value
Total recording hours ~80,000
Number of subjects 29,048
Number of datasets 106
Total channel-hours 2.67 million
Total EEG tokens 9.60 billion

The corpus covers a wide range of electrode configurations and recording conditions.

The complete list of pretraining datasets and their associated licenses is provided in Appendix B of the paper.

How to Use

EEG preprocessing should follow the pipeline used during pretraining:

  • Notch filtering at 50 or 60 Hz
  • Bandpass filtering between 0.5 and 75 Hz
  • Resampling to 200 Hz
  • Channel-wise z-score normalization
  • Clipping to ±15 standard deviations

SPERA processes non-overlapping 1-second patches (200 samples per patch).

pip install -r requirements.txt
import torch
from transformers import AutoModel

model = AutoModel.from_pretrained(
    "sees4321/SPERA_EEG", trust_remote_code=True,
).eval()

# eeg: float32 [B, C, T], sampled at 200 Hz.
# coords: float32 [B, C, 3], in the matching channel order and coordinate frame.
with torch.inference_mode():
    outputs = model(eeg=eeg, coords=coords)
    tokens = outputs.last_hidden_state  # [B, C*P, 896]
    features = outputs.pooler_output    # [B, 896], token mean

Electrode coordinates

Use channel names in the same order as the EEG tensor. With spatial_bias_use_unit_sphere=True, the encoder normalizes coordinates internally; manual unit normalization or multiplication by 10 is unnecessary. Install mne only for this example (pip install mne).

import mne
import numpy as np
import torch

# channel_names must match eeg[:, channels, :].
kind = "colin27_1005" if "colin27_1005" in mne.channels.get_builtin_montages() else "standard_1005"
pos = mne.channels.make_standard_montage(kind).get_positions()["ch_pos"]
pos = {name.lower(): xyz for name, xyz in pos.items()}
xyz = np.stack([pos[name.strip().lower()] for name in channel_names])
coords = torch.tensor(xyz, dtype=torch.float32, device=eeg.device)
coords = coords.unsqueeze(0).expand(eeg.shape[0], -1, -1)  # [B, C, 3]
assert coords.shape[1] == eeg.shape[1]

Keep the montage's original coordinate frame and origin; do not subtract the channel mean. For bipolar channels, use the midpoint of the two original electrode coordinates before the model's normalization; the example above handles ordinary electrodes.

Evaluation

SPERA was evaluated on nine downstream EEG classification datasets under two protocols: linear probing (LP) and linear probing followed by fine-tuning (LPFT).

The evaluation results shown on this page are mean balanced accuracies (%) over five random seeds. Please refer to the paper for detailed experimental results and evaluation protocols.

Citation

If you find SPERA useful in your research, please cite our paper:

@article{kim2026spera,
  title={SPERA: Spherical Prior EEG Foundation Model with Geometry- and Frequency-Aware Latent Prediction},
  author={Kim, Minsu and Kim, Ye-Sung and Jeon, Hyeseong and Hyung, Wooseok and Lee, Joshua and Im, Chang-Hwan},
  journal={arXiv preprint arXiv:2610.10571},
  year={2026}
}

Contact