Skip to main content

AI driven sleep monitoring kit for ultra low-power wearables.

Project description

sleepKIT

An AI Development Kit for real-time sleep-monitoring on ultra-low power Ambiq SoCs.

CI Docs Release


Documentation: https://ambiqai.github.io/sleepkit

Source Code: https://github.com/AmbiqAI/sleepkit


sleepKIT is an AI Development Kit (ADK) that enables developers to easily build and deploy real-time sleep-monitoring models on Ambiq's family of ultra-low power SoCs. sleepKIT explores a number of sleep related tasks including sleep staging, and sleep apnea detection. The kit includes a variety of datasets, efficient model architectures, and a number of pre-trained models. The objective of the models is to outperform conventional, hand-crafted algorithms with efficient AI models that still fit within the stringent resource constraints of embedded devices. Furthermore, the included models are trainined using a large variety datasets- using a subset of biological signals that can be captured from a single body location such as head, chest, or wrist/hand. The goal is to enable models that can be deployed in real-world commercial and consumer applications that are viable for long-term use.

Key Features:

  • Real-time: Inference is performed in real-time on battery-powered, edge devices.
  • Efficient: Leverage modern AI techniques coupled with Ambiq's ultra-low power SoCs
  • Extensible: Easily add new tasks, models, and datasets to the framework.
  • Accurate: Achieve SoTA results with stringent resource constraints

Requirements

The following are also required to compile/flash the binary for the EVB demo:

!!! note A VSCode Dev Container is also available and defined in ./.devcontainer.

Installation

To get started, first install the local python package sleepkit along with its dependencies via PyPi:

$ pip install sleepkit

Alternatively, you can install the package from source by cloning the repository and running the following command:

git clone https://github.com/AmbiqAI/sleepkit.git
cd sleepkit
uv sync

Usage

sleepKIT can be used as either a CLI-based app or as a python package to perform advanced experimentation. In both forms, sleepKIT exposes a number of modes and tasks discussed below. Refer to the Overview Guide to learn more about available options and configurations.


Tasks

sleepKIT includes a number of built-in tasks. Each task provides reference routines for training, evaluating, and exporting the model. The routines can be customized by providing a configuration file or by setting the parameters directly in the code. Additional tasks can be easily added to the sleepKIT framework by creating a new task class and registering it to the task factory.

  • Detect: Detect sustained sleep/inactivity bouts
  • Stage: Perform advanced 2, 3, 4, or 5 stage sleep assessment
  • Apnea: Detect hypopnea/apnea events

Modes

sleepKIT provides a number of modes that can be invoked for a given task. These modes can be accessed via the CLI or directly from the task within the Python package.

  • Download: Download specified datasets
  • Feature: Generate features for given dataset(s)
  • Train: Train a model for specified task and features
  • Evaluate: Evaluate a model for specified task and features
  • Export: Export a trained model to TF Lite and TFLM
  • Demo: Run task-level demo on PC or EVB

Datasets

sleepKIT includes several open-source datasets for training each of the sleepKIT tasks via a dataset factory. For certain tasks, we also provide synthetic data provided by physioKIT to help improve model generalization. Each dataset has a corresponding Python class to aid in downloading and generating data for the given task. Additional datasets can be easily added to the sleepKIT framework by creating a new dataset class and registering it to the dataset factory.

  • MESA: A large-scale polysomnography dataset with 6,814 subjects collected from 6 field centers.
  • CMIDSS: A dataset of 300 subjects with over 500 multi-day recordings of wrist-worn accelerometer data annotated with two event types: onset, the beginning of sleep, and wakeup, the end of sleep.
  • YSYW: A dataset of 1,983 polysomnography recordings provided by the Massachusetts General Hospital’s (MGH) Sleep Lab.
  • STAGES: A dataset from the Stanford Technology Analytics and Genomics in Sleep (STAGES) study involving 20 data collection sites from six centers.

Models

sleepKIT provides a model factory that allows you to easily create and train customized models. The model factory includes a number of modern networks well suited for efficient, real-time edge applications. Each model architecture exposes a number of high-level parameters that can be used to customize the network for a given application. These parameters can be set as part of the configuration accessible via the CLI and Python package.


Model Zoo

A number of pre-trained models are available for each task. These models are trained on a variety of datasets and are optimized for deployment on Ambiq's ultra-low power SoCs. In addition to providing links to download the models, sleepKIT provides the corresponding configuration files and performance metrics. The configuration files allow you to easily retrain the models or use them as a starting point for a custom model. Furthermore, the performance metrics provide insights into the model's accuracy, precision, recall, and F1 score. For a number of the models, we provide experimental and ablation studies to showcase the impact of various design choices. Check out the Model Zoo to learn more about the available models and their corresponding performance metrics.


Guides

Checkout the Guides to see detailed examples and tutorials on how to use sleepKIT for a variety of tasks. The guides provide step-by-step instructions on how to train, evaluate, and deploy models for a given task. In addition, the guides provide insights into the design choices and performance metrics for the models. The guides are designed to help you get up and running quickly and to provide a deeper understanding of the models and tasks available in sleepKIT.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sleepkit-0.10.0.tar.gz (64.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sleepkit-0.10.0-py3-none-any.whl (97.4 kB view details)

Uploaded Python 3

File details

Details for the file sleepkit-0.10.0.tar.gz.

File metadata

  • Download URL: sleepkit-0.10.0.tar.gz
  • Upload date:
  • Size: 64.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sleepkit-0.10.0.tar.gz
Algorithm Hash digest
SHA256 3bca3a495ae6885d21fec23bb12a785258cf021342831a428ffad6a749014d28
MD5 9a366c6c8ced76ee0ffcabdb6d98864a
BLAKE2b-256 58cb8aa0d330f49a0ab2fba7952294419441de3d339255ed8f1a3898752b5fdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleepkit-0.10.0.tar.gz:

Publisher: release.yaml on AmbiqAI/sleepkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sleepkit-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: sleepkit-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 97.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sleepkit-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0084391c614901f71f8f3b9326ac5085fe164c67a163e946a24078d35550227
MD5 40b3b45ffae3cc174fb2157612f3200b
BLAKE2b-256 4bc29e0b2d155a0754d26a1a3d8f890bcf5d49de9cc2c2e0f70818af16e10366

See more details on using hashes here.

Provenance

The following attestation bundles were made for sleepkit-0.10.0-py3-none-any.whl:

Publisher: release.yaml on AmbiqAI/sleepkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page