Shortcuts

USleep

class torcheeg.models.USleep(num_electrodes: int = 1, patch_size: int = 100, depth: int = 12, num_filters: int = 5, complexity_factor: float = 1.67, with_skip_connection: bool = True, num_classes: int = 5, num_patchs: int = 30, filter_size: int = 9)[source][source]

A publicly available, ready-to-use deep-learning-based system for automated sleep staging. For more details, please refer to the following information.

Below is a quick start example:

from torcheeg.models import USleep

model = USleep(num_electrodes=1,
              patch_size=100,
              num_patchs=30,
              num_classes=5)

# batch_size, num_electrodes, num_patchs * patch_size
x = torch.randn(32, 1, 3000)
model(x)
Parameters:
  • num_electrodes (int) – The number of EEG channels. (default: 1)

  • patch_size (int) – The size of each patch that the signal will be divided into. (default: 100)

  • depth (int) – The depth of the U-Net architecture, determining the number of encoder and decoder blocks. (default: 12)

  • num_filters (int) – The initial number of filters, which will be increased through the network. (default: 5)

  • complexity_factor (float) – Factor controlling the growth of filter numbers across layers. (default: 1.67)

  • with_skip_connection (bool) – Whether to use skip connections between encoder and decoder. (default: True)

  • num_classes (int) – The number of sleep stages to classify. (default: 5)

  • num_patchs (int) – The number of patches to divide the input signal into. (default: 30)

  • filter_size (int) – The size of convolutional filters, must be odd. (default: 9)

forward(x)[source][source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources