EEG-CLIP is a contrastive learning framework that aligns EEG time series data with their corresponding clinical text descriptions in a shared embedding space. Inspired by CLIP (Contrastive Language-Image Pretraining), EEG-CLIP enables versatile EEG representation learning for improved pathology detection and other downstream tasks in low-data regimes.
# Clone the repository
git clone https://github.com/tidiane-camaret/EEGClip.git
cd EEGClip
# Install dependencies
pip install -r requirements.txt
pip install -e .
Note: You may need to modify paths to datasets and pretrained models in configs/preprocess_config.py
Generate text embeddings using the ClinicalBERT model:
python scripts/text_preprocessing/text_embedding.py
Train the EEGClip model on the TUH EEG Abnormal Corpus:
python scripts/eegclip_train_eval.py
Train and evaluate a classifier using the frozen EEG encoder:
python scripts/classif/classification_tuh.py
Options:
--task_name: Classification task (pathological, age, gender, etc.)--train_frac: Control size of training data for few-shot experiments--weights: Select pretrained weights--freeze_encoder: Toggle EEG encoder freezingEvaluate the model's ability to classify EEG recordings using only text prompts without additional training:
python scripts/classif/classification_zero_shot_tuh.py
If you use EEG-CLIP in your research, please cite our paper:
@ARTICLE{10.3389/frobt.2025.1625731,
AUTHOR={Camaret Ndir, Tidiane and Schirrmeister , Robin T. and Ball , Tonio },
TITLE={EEG-CLIP: learning EEG representations from natural language descriptions},
JOURNAL={Frontiers in Robotics and AI},
VOLUME={Volume 12 - 2025},
YEAR={2025},
URL={https://www.frontiersin.org/journals/robotics-and-ai/articles/10.3389/frobt.2025.1625731},
DOI={10.3389/frobt.2025.1625731},
ISSN={2296-9144}]
This work uses the Temple University Hospital (TUH) EEG Corpus:
@article{obeid_temple_2016,
title={The Temple University Hospital EEG Data Corpus},
volume={10},
journal={Frontiers in Neuroscience},
author={Obeid, Iyad and Picone, Joseph},
year={2016},
pages={196}
}
This project is licensed under the MIT License - see the LICENSE file for details.
194 commits
3 commits
Jupyter Notebook
99.4%
EEG-CLIP is a contrastive learning framework that aligns EEG time series data with their corresponding clinical text descriptions in a shared embedding space. Inspired by CLIP (Contrastive Language-Image Pretraining), EEG-CLIP enables versatile EEG representation learning for improved pathology detection and other downstream tasks in low-data regimes.
# Clone the repository
git clone https://github.com/tidiane-camaret/EEGClip.git
cd EEGClip
# Install dependencies
pip install -r requirements.txt
pip install -e .
Note: You may need to modify paths to datasets and pretrained models in configs/preprocess_config.py
Generate text embeddings using the ClinicalBERT model:
python scripts/text_preprocessing/text_embedding.py
Train the EEGClip model on the TUH EEG Abnormal Corpus:
python scripts/eegclip_train_eval.py
Train and evaluate a classifier using the frozen EEG encoder:
python scripts/classif/classification_tuh.py
Options:
--task_name: Classification task (pathological, age, gender, etc.)--train_frac: Control size of training data for few-shot experiments--weights: Select pretrained weights--freeze_encoder: Toggle EEG encoder freezingEvaluate the model's ability to classify EEG recordings using only text prompts without additional training:
python scripts/classif/classification_zero_shot_tuh.py
If you use EEG-CLIP in your research, please cite our paper:
@ARTICLE{10.3389/frobt.2025.1625731,
AUTHOR={Camaret Ndir, Tidiane and Schirrmeister , Robin T. and Ball , Tonio },
TITLE={EEG-CLIP: learning EEG representations from natural language descriptions},
JOURNAL={Frontiers in Robotics and AI},
VOLUME={Volume 12 - 2025},
YEAR={2025},
URL={https://www.frontiersin.org/journals/robotics-and-ai/articles/10.3389/frobt.2025.1625731},
DOI={10.3389/frobt.2025.1625731},
ISSN={2296-9144}]
This work uses the Temple University Hospital (TUH) EEG Corpus:
@article{obeid_temple_2016,
title={The Temple University Hospital EEG Data Corpus},
volume={10},
journal={Frontiers in Neuroscience},
author={Obeid, Iyad and Picone, Joseph},
year={2016},
pages={196}
}
This project is licensed under the MIT License - see the LICENSE file for details.
194 commits
3 commits
Jupyter Notebook
99.4%