Train your own real-time sleep spindle detector
A hands-on course for neuroscientists. You will learn how the Portiloop turns raw EEG into a closed-loop stimulation decision in a fraction of a second, how its neural network is trained on expert-annotated sleep recordings, and how to train, evaluate and deploy a model of your own. Every concept comes with a simulation you can play with directly in this page.
Choose your path
I want to understand how it works
Physiology, signal processing and the network, without installing anything.
I want to detect spindles in my recordings
Use the pre-trained model offline on your own EEG.
All tutorials
How these tutorials work
- Interactive widgets (boxes marked ▶) run entirely in your browser. Nothing is uploaded: even when you load your own file in tutorial 09, it stays on your computer.
- The network in the widgets is the real one. Its weights were exported from the published PyTorch checkpoint and checked against PyTorch to within 10-6 (see
docs/tools/in the repository). - The EEG in the widgets is synthetic: a didactic signal with planted spindles, so that the ground truth is known exactly. It is not a physiological model, and numbers measured on it (F1 scores, delays) are illustrations, not results.
- Code blocks are taken from the repository or tested against it. Commands assume you are at the root of a clone of Portiloop/portiloop-training.
- Callouts marked On the hard drive tell you which files are read and written, and where.
Citing the Portiloop
If these tutorials or the Portiloop software help your research, please cite:
Valenchon N, Bouteiller Y, Jourde HR, L’Heureux X, Sobral M, Coffey EBJ, Beltrame G (2022). The Portiloop: A deep learning-based open science tool for closed-loop brain stimulation. PLOS ONE 17(8): e0270696. doi:10.1371/journal.pone.0270696
@article{valenchon2022portiloop,
title = {The Portiloop: A deep learning-based open science tool for closed-loop brain stimulation},
author = {Valenchon, Nicolas and Bouteiller, Yann and Jourde, Hugo R. and L'Heureux, Xavier and
Sobral, Milo and Coffey, Emily B. J. and Beltrame, Giovanni},
journal = {PLOS ONE},
volume = {17},
number = {8},
pages = {e0270696},
year = {2022},
doi = {10.1371/journal.pone.0270696}
}