Sign inSign up

bspsupsi/sleepyland

By bspsupsi

•Updated 7 months ago

A toolbox to fairly evaluate automatic sleep staging algorithms

Image
Machine learning & AI
Data science
0

7.1K

bspsupsi/sleepyland repository overview

⁠Download & Run SLEEPYLAND

To get started, choose your operating system below. Just follow the step-by-step guideline. This is the recommended method as it allows you to visualize the installation process directly in the shell.

LinuxMacWindows
LinuxMacWindows
Step 1: Download⁠ linux_setup.shStep 1: Download⁠ macos_setup.shStep 1: Download⁠ win_setup.ps1
Step 2: Download docker-compose.yml⁠Step 2: Download docker-compose.yml⁠Step 2: Download docker-compose.yml⁠
Step 3: Place the .sh/.yml files in the same folder.Step 3: Place the .sh/.yml files in the same folder.Step 3: Place the .ps1/.yml files in the same folder.
Step 4: Open a terminal, navigate to the folder, and run:Step 4: Open a terminal, navigate to the folder, and run:Step 4: Open PowerShell as Administrator, navigate to the folder, and run:
chmod +x linux_setup.sh && ./linux_setup.shchmod +x macos_setup.sh && ./macos_setup.sh./win_setup.ps1

❗Windows Users: SLEEPYLAND runs via Docker. Before running the script, ensure Docker Desktop is installed on your system. You can easily download it from Docker's official website⁠.

In the future, this step will be handled automatically.

Once downloaded, check if Docker is installed and running by opening a terminal and typing:

docker --version

If the command returns the Docker version, you are ready to proceed from the step 1.

❗SLEEPYLAND WebApp does not open automatically:

Ensure that all containers are running.
You can check the status of your Docker containers by executing this command in your terminal:

docker ps

Look for a container named gui to confirm the gui service is up.

Access SLEEPYLAND via your browser.
Open your web browser and navigate to:

http://localhost:8887

This will open the SLEEPYLAND GUI where you can perform various tasks interactively.

❗How to Stop/Quit SLEEPYLAND:

SLEEPYLAND runs in the background, even if you close the web window.
To completely stop the application, execute the following command in the terminal from the folder containing docker-compose.yml:

docker-compose down

In the future, we will add a feature to close the app directly from the web UI.


⁠Key Features

Local Processing & PrivacyFair Model Training
All analyses run locally on your device, ensuring complete data privacy. Your data never leaves your laptop.The included deep learning sleep staging models have been fairly trained and validated on consistent public datasets, ensuring robust and reliable performance for accurate sleep analysis and stage classification.

All the exposed sleep staging models run locally on your CPU (GPU support is not yet available). As a result, some models, such as the deepresnet model, may perform slowly when predicting or evaluating multiple combinations of EEG and EOG channels. We are actively working on optimizations and will release enhanced versions soon.


For instructions on navigating the UI and making the most of the analysis tools, check out this Quickstart Tutorial Video⁠.


⁠List of Models for Sleep Staging

⁠Feature-Based Models for Sleep Staging
ModelDescriptionDeveloped ByReferencesAvailable
POPS (Luna)A feature-based model for sleep stage classification using manually engineered features from PSG data.Luna Sleep ToolboxLuna Resource⁠❌
YASAA lightweight, open-source package for sleep staging, offering rapid sleep analysis using EEG/EOG/EMG signals.Raphael Vallat, et alVallat R, Walker MP. An open-source, high-performance tool for automated sleep staging.⁠ Elife. 2021.✅

Note: Feature-based models are used only for predictions and have not been retrained from scratch on datasets within the SLEEPYLAND context.

⁠Deep Learning Models for Sleep Staging
ModelDescriptionDeveloped ByReferencesAvailable
U-SleepA robust deep learning model designed to handle various PSG setups and mixed-cohort datasets for automated sleep staging.Perslev, et alPerslev M, Darkner S, et al. U-Sleep: resilient high-frequency sleep staging.⁠ NPJ Digital Medicine. 2021.✅
DeepResNetA deep residual network model for high-frequency sleep stage classification using PSG data.Olesen, et alOlesen AN, Jennum PJ, et al. Automatic sleep stage classification with deep residual networks in a mixed-cohort setting.⁠ Sleep. 2021.✅
SleepTransformerA transformer-based model that provides sleep staging with interpretability and uncertainty quantification.Phan, et alPhan H, Mikkelsen K, et al. Sleeptransformer: Automatic sleep staging with interpretability and uncertainty quantification.⁠ IEEE Transactions on Biomedical Engineering. 2022.✅
L-SeqSleepNetL-SeqSleepNet: Whole-cycle Long Sequence Modeling for Automatic Sleep Staging.Phan, et alPhan H, Lorenzen KP, et al. L-SeqSleepNet: Whole-cycle Long Sequence Modeling for Automatic Sleep Staging.⁠ IEEE Journal of Biomedical and Health Informatics. 2023.❌

All models have been implemented to ensure consistency and fairness in their evaluation on the NSRR datasets. Additionally, all models are now available in a single-channel configuration (EEG or EOG) and in the multi-channel configuration (EEG+EOG), offering flexibility to match user data and requirements.


Need additional help? Click the Quickstart Tutorial⁠ button for detailed step-by-step instructions.


⁠Technical Section

Datasets

NSRR Datasets Included for Model Train/Valid/Test

DatasetSubject CountPSG CountAge (µ ± σ)Sex %MBMI (µ ± σ)Sleep DisordersAnnotation FormatIncluded
ABC⁠4913248.8 ± 9.957.138.9 ± 3.0OSA.xml✅
APOE⁠71271245.7 ± 13.659.127.2 ± 6.5SDB.STA✅
APPLES⁠1094109450.1 ± 12.963.232.1 ± 7.8OSA.annot✅
CCSHS⁠51551517.7 ± 0.450.525.1 ± 5.9SRMD.xml✅
CFS⁠14473041.4 ± 19.344.832.4 ± 9.5OSA.xml✅
CHAT⁠123216387.0 ± 1.448.319.0 ± 4.9OSA.xml✅
HOMEPAP⁠24624646.5 ± 11.960.337.2 ± 8.9OSA.xml✅
MESA⁠2056205669.9 ± 9.246.428.7 ± 5.6SDB.xml✅
MNC_CNC⁠787828.5 ± 16.951.323.2 ± 11.5NT1, NT2, IH.xml✅
MNC_DHC⁠838333.4 ± 14.850.024.8 ± 4.9-.xml✅
MNC_SSC⁠76776745.4 ± 13.859.423.9 ± 6.5-.xml✅
MROS⁠2905393076.4 ± 5.510027.2 ± 3.9SDB.xml✅
MSP⁠10510526.8 ± 5.9042.4 ± 6.6SDB.annot✅
NCHSDB⁠365139508.8 ± 5.956.322.7 ± 9.9-.tsv✅
SHHS⁠5797844463.1 ± 11.247.628.2 ± 5.1OSA, SDB.xml✅
SOF⁠45345382.9 ± 3.2027.7 ± 4.6SDB.xml✅
WSC⁠1123256956.4 ± 8.154.131.7 ± 7.1SDB.txt✅

Open Access Datasets Included for Model Testing

DatasetSubject CountPSG CountAge (µ ± σ)Sex %MBMI (µ ± σ)Sleep DisordersAnnotation FormatIncluded
DCSM⁠255255----.ids☑️
DOD-H⁠2525----.h5☑️
DOD-O⁠5555----.h5☑️
PHYS⁠99499455.2 ± 14.367-SDB.ids☑️
SEDF_SC⁠7815358.8 ± 22.047--.edf☑️
SEDF_ST⁠224440.2 ± 17.732--.edf☑️
ISRUC⁠10010051.1 ± 13.735.225.0 ± 5.8-.xml❌

Note: All the deep learning-based models for sleep staging have been trained, validated, and tested on in-domain (ID) training datasets - datasets included marked with a ✅. We assess the generalizability of the multiple models on the largest out-of-domain set of data - datasets included marked with a ☑️.

Architecture

Model Architecture

Ensemble Metrics


Tag summary

Content type

Image

Digest

sha256:5522f1ab1…

Size

472.8 MB

Last updated

7 months ago

docker pull bspsupsi/sleepyland:manager-api