DeepSleepNet / README.md
bruAristimunha's picture
Replace with clean markdown card
18ff1be verified
metadata
license: bsd-3-clause
library_name: braindecode
pipeline_tag: feature-extraction
tags:
  - eeg
  - biosignal
  - pytorch
  - neuroscience
  - braindecode
  - convolutional
  - sleep-staging

DeepSleepNet

DeepSleepNet from Supratak et al (2017) [Supratak2017].

Architecture-only repository. Documents the braindecode.models.DeepSleepNet class. No pretrained weights are distributed here. Instantiate the model and train it on your own data.

Quick start

pip install braindecode
from braindecode.models import DeepSleepNet

model = DeepSleepNet(
    n_chans=2,
    sfreq=100,
    input_window_seconds=30.0,
    n_outputs=5,
)

The signal-shape arguments above are illustrative defaults — adjust to match your recording.

Documentation

Architecture

DeepSleepNet architecture

Parameters

Parameter Type Description
activation_large type[nn.Module], default=nn.ELU Activation class for the large-filter CNN path.
activation_small type[nn.Module], default=nn.ReLU Activation class for the small-filter CNN path.
return_feats bool, default=False If True, return features before the final linear layer.
drop_prob float, default=0.5 Dropout probability applied throughout the network.
bilstm_hidden_size int, default=512 Hidden size of the BiLSTM. The residual FC output dimension is 2 * bilstm_hidden_size to match the concatenated directions.
bilstm_num_layers int, default=2 Number of stacked BiLSTM layers.
small_n_filters_1 int, default=64 First-conv output channels for the small-filter path.
small_n_filters_2 int, default=128 Deep-conv (conv2--conv4) output channels for the small-filter path.
small_first_kernel_size int, default=50 First-conv kernel size for the small path (paper: Fs/2).
small_first_stride int, default=6 First-conv stride for the small path (paper: Fs/16).
small_first_padding int, default=22 First-conv padding for the small path.
small_pool1_kernel_size int, default=8 First max-pool kernel for the small path.
small_pool1_stride int, default=8 First max-pool stride for the small path.
small_pool1_padding int, default=2 First max-pool padding for the small path.
small_deep_kernel_size int, default=8 Deep-conv kernel size for the small path.
small_pool2_kernel_size int, default=4 Second max-pool kernel for the small path.
small_pool2_stride int, default=4 Second max-pool stride for the small path.
small_pool2_padding int, default=1 Second max-pool padding for the small path.
large_n_filters_1 int, default=64 First-conv output channels for the large-filter path.
large_n_filters_2 int, default=128 Deep-conv (conv2--conv4) output channels for the large-filter path.
large_first_kernel_size int, default=400 First-conv kernel size for the large path (paper: 4*Fs).
large_first_stride int, default=50 First-conv stride for the large path (paper: Fs/2).
large_first_padding int, default=175 First-conv padding for the large path.
large_pool1_kernel_size int, default=4 First max-pool kernel for the large path.
large_pool1_stride int, default=4 First max-pool stride for the large path.
large_pool1_padding int, default=0 First max-pool padding for the large path.
large_deep_kernel_size int, default=6 Deep-conv kernel size for the large path.
large_pool2_kernel_size int, default=2 Second max-pool kernel for the large path.
large_pool2_stride int, default=2 Second max-pool stride for the large path.
large_pool2_padding int, default=1 Second max-pool padding for the large path.

References

  1. Supratak, A., Dong, H., Wu, C., & Guo, Y. (2017). DeepSleepNet: A model for automatic sleep stage scoring based on raw single-channel EEG. IEEE Transactions on Neural Systems and Rehabilitation Engineering, 25(11), 1998-2008.

Citation

Cite the original architecture paper (see References above) and braindecode:

@article{aristimunha2025braindecode,
  title   = {Braindecode: a deep learning library for raw electrophysiological data},
  author  = {Aristimunha, Bruno and others},
  journal = {Zenodo},
  year    = {2025},
  doi     = {10.5281/zenodo.17699192},
}

License

BSD-3-Clause for the model code (matching braindecode). Pretraining-derived weights, if you fine-tune from a checkpoint, inherit the licence of that checkpoint and its training corpus.