Datasets:
|
Download README.md from dronefreak/Sleep-Accel: direct link, hf CLI and curl.
- Browser
- Download file 10.8 kB
-
https://huggingface.co/datasets/dronefreak/Sleep-Accel/resolve/main/README.md
- Command line
-
hf download hf://datasets/dronefreak/Sleep-Accel/README.md
-
curl -L -o README.md https://huggingface.co/datasets/dronefreak/Sleep-Accel/resolve/main/README.md
10.8 kB
| language: | |
| - en | |
| license: odc-by | |
| size_categories: | |
| - 10K<n<100K | |
| task_categories: | |
| - other | |
| pretty_name: Sleep-Accel (Apple Watch motion and heart rate with PSG sleep stages) | |
| tags: | |
| - sleep | |
| - sleep-staging | |
| - polysomnography | |
| - accelerometer | |
| - heart-rate | |
| - ppg | |
| - wearables | |
| - apple-watch | |
| - biosignals | |
| - time-series | |
| - physionet | |
| configs: | |
| - config_name: default | |
| data_files: | |
| - split: train | |
| path: data/train-* | |
| - config_name: subjects | |
| data_files: | |
| - split: train | |
| path: subjects/train-* | |
| <h1 align="center">Sleep-Accel: Apple Watch Motion and Heart Rate with Labeled Sleep</h1> | |
| <p align="center"><video controls autoplay loop muted playsinline width="900" poster="https://huggingface.co/datasets/dronefreak/Sleep-Accel/resolve/main/assets/demo_banner_poster.jpg" src="https://huggingface.co/datasets/dronefreak/Sleep-Accel/resolve/main/assets/demo_banner.mp4"><img src="https://huggingface.co/datasets/dronefreak/Sleep-Accel/resolve/main/assets/demo_banner_poster.jpg" alt="Six full nights: the sleep stages scored from polysomnography, with the Apple Watch heart rate and motion under them" width="900"></video></p> | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| > **Unofficial mirror of the PhysioNet database "Motion and heart rate from a wrist-worn wearable and labeled sleep from polysomnography" v1.0.0 (sleep-accel, Walch et al. 2019): raw Apple Watch acceleration and heart rate from 31 people during a night of polysomnography, with sleep stages in 30 s epochs and the week's step counts, in a viewer-ready Parquet layout with exact values.** | |
| ## Dataset Description | |
| - **Homepage:** https://physionet.org/content/sleep-accel/1.0.0/ | |
| - **Paper:** https://doi.org/10.1093/sleep/zsz180 | |
| - **Dataset DOI:** https://doi.org/10.13026/hmhs-py35 | |
| - **Code:** https://github.com/ojwalch/sleep_classifiers | |
| - **License:** ODC-By 1.0 | |
| ## Disclaimer | |
| This repository is **not** an official release of the sleep-accel database. | |
| The data were collected at the University of Michigan by Olivia Walch, Yitong Huang, Daniel Forger and Cathy Goldstein, with the University of Michigan Sleep and Circadian Research Laboratory, and are published by PhysioNet. This repository does **not** claim ownership of the data. **If you are an author or rights holder and want this repository changed or removed, please open a discussion and it will be addressed promptly.** | |
| These are recordings from real people. Do not attempt to identify anyone in them. This dataset is for research and is not a medical device or a basis for clinical decisions. | |
| **Source and verification:** built from the official PhysioNet package `sleep-accel-1.0.0.zip`. Every file in it matched the published `SHA256SUMS.txt`. Every file was parsed twice (my own parser and `pandas.read_csv`) with identical results. Every acceleration sample and every label line is in exactly one row, and every row was read back from Parquet and compared with the source files. | |
| --- | |
| # Dataset Overview | |
| Subjects wore an Apple Watch for 7 to 14 days to record their steps, then spent one night in the sleep lab with an eight-hour sleep opportunity. During that night an app recorded the watch's raw acceleration and its heart rate (from photoplethysmography) while the subjects underwent polysomnography (PSG). Sleep was scored from the PSG in 30 s epochs. Of 39 recruited subjects, the authors excluded four for data transmission errors, three for sleep apnea and one for REM sleep behavior disorder. Where the watch's battery ran out during the night, the authors cropped the data to the valid window. | |
| All times are seconds since the start of the PSG, so negative times are before the night. Each subject has a random numeric identifier. | |
| | File | Content | | |
| |---|---| | |
| | `motion/<id>_acceleration.txt` | time, x, y, z acceleration in g | | |
| | `heart_rate/<id>_heartrate.txt` | time, heart rate in bpm | | |
| | `steps/<id>_steps.txt` | time, steps from this time to the next (600 s bins) | | |
| | `labels/<id>_labeled_sleep.txt` | time, stage: 0 wake, 1 N1, 2 N2, 3 N3, 4 N4, 5 REM, -1 unscored | | |
| --- | |
| # Changes from the Official Release | |
| - Packed into Parquet so the Dataset Viewer and `datasets` work directly. The `default` config has one row per 30 s epoch with the label and the acceleration and heart rate measured in that epoch. The `subjects` config has one row per subject. | |
| - Within each subject the samples are put in time order. `acc_line` and `hr_line` give each sample's line number in its file, so the file order can be restored. | |
| - Three heart-rate files hold the same export two or three times. Only the last, longest copy goes into the `default` rows; `subjects` keeps the files as written. | |
| - `stage_name` is added from the stage codes in the authors' code. `preview` is a plot of each night. | |
| - The official zip is included unchanged in `original/`. | |
| - No values were changed. | |
| --- | |
| # Dataset Structure | |
| ## `default`: one row per 30 s epoch (37,312 rows) | |
| Epoch `k` covers `[30k, 30k + 30)` seconds after PSG start. There is a row for every epoch with a label line or at least one acceleration sample, so the rows also cover the watch data recorded before and after the night. | |
| | Column | Content | | |
| |---|---| | |
| | `subject`, `epoch`, `start_s` | subject id, epoch index, epoch start in seconds since PSG start | | |
| | `in_psg` | true if the labels file has a line for this epoch | | |
| | `stage`, `stage_name` | stage code as in the labels file and its name; null outside the PSG | | |
| | `acc_t`, `acc_x`, `acc_y`, `acc_z`, `acc_line`, `n_acc` | acceleration samples in the epoch: time (s), x, y, z (g), 0-based line number in the file | | |
| | `hr_t`, `hr_bpm`, `hr_line`, `n_hr` | heart-rate samples in the epoch: time (s), bpm, 0-based line number in the file | | |
| ## `subjects`: one row per subject (31 rows) | |
| Stage counts and the PSG length, all labels, the acceleration span, sample count and median rate, heart rate and steps exactly as in the files, the number of heart-rate exports in the file, and a `preview` of the night (hypnogram, heart rate and motion). | |
| ### Read before using the data | |
| - **Stage codes.** The PhysioNet page lists 0 to 3 and 5. The files also use `-1` (438 epochs) and `4` (356 epochs). The authors' code (`source/sleep_stage.py`) names them unscored and N4. Only three subjects (5383425, 8258170 and 9618981) use 4, which suggests those nights were scored with separate N3 and N4 as in the older Rechtschaffen & Kales rules. Merge N3 and N4 for AASM-style staging. 431 of the 438 unscored epochs are at the start or end of the night, most of them at the start. | |
| - **Different sampling rates.** The acceleration is irregularly sampled at about 50 Hz for most subjects, but about 66 Hz for four subjects (759667, 3509524, 4018081, 5132496), 33 Hz for 9618981 and 10 Hz for 5383425 and 8258170 (median sample spacing). Resample if a model needs one rate. | |
| - **Out-of-order samples.** In 11 of the 31 motion files, blocks of samples come after samples recorded later: time steps back at 293 places, and sorting moves 457,320 of the 51,819,151 samples. No sample is duplicated. `default` rows hold the samples in time order; `acc_line` restores the file order. (The authors' loader also sorts by time, after dropping exact duplicate rows.) | |
| - **Repeated heart-rate exports.** The heart-rate files of 1066528, 781756 and 9961348 hold the export three times (5,539 + 5,539 + 5,539 lines; 5,997 + 6,009 + 6,009; 5,220 + 5,220 + 5,553), each copy a prefix of the next. `default` uses only the last copy; `subjects` keeps all lines. Separately, 3509524 and 759667 each have one time with two different values; both are kept. | |
| - **Heart rate is irregular.** The median spacing is 5 s during the night in every subject; in the days before it is a few minutes for most subjects. 82 heart-rate values have decimals; the rest are whole numbers. | |
| - **The watch data extend beyond the night.** Acceleration starts up to 6 days before the PSG for some subjects, and for 9618981 it continues for about 2.5 days after. Heart rate and steps cover days. Rows with `in_psg` false hold these samples; filter on `in_psg` for the labelled night. The 57,233 heart-rate samples in epochs with neither a label nor acceleration are only in `subjects`. | |
| - **Some scored epochs have no watch data** (1,240 scored epochs have no acceleration sample), and the acceleration has 286 gaps longer than 1 s. | |
| - **No demographics** (age, sex, BMI) are given. | |
| ## Usage | |
| ```python | |
| # pip install datasets numpy | |
| import numpy as np | |
| from datasets import load_dataset | |
| ds = load_dataset("dronefreak/Sleep-Accel", split="train") | |
| night = ds.filter(lambda r: r["in_psg"] and r["stage"] >= 0) # scored epochs only | |
| row = night[0] | |
| acc = np.stack([row["acc_x"], row["acc_y"], row["acc_z"]]) # 3 x n, in g | |
| print(row["subject"], row["epoch"], row["stage_name"], acc.shape, row["hr_bpm"]) | |
| # wake / NREM / REM, as in the paper (N1-N4 merged) | |
| three = {0: "wake", 1: "NREM", 2: "NREM", 3: "NREM", 4: "NREM", 5: "REM"} | |
| ``` | |
| Keep each subject on one side of a split. | |
| --- | |
| # Dataset Sources | |
| ## Citation | |
| Please cite the paper and the PhysioNet release: | |
| ```bibtex | |
| @article{walch2019sleep, | |
| author = {Walch, Olivia and Huang, Yitong and Forger, Daniel and Goldstein, Cathy}, | |
| title = {Sleep stage prediction with raw acceleration and photoplethysmography heart rate data derived from a consumer wearable device}, | |
| journal = {Sleep}, | |
| volume = {42}, | |
| number = {12}, | |
| pages = {zsz180}, | |
| year = {2019}, | |
| doi = {10.1093/sleep/zsz180} | |
| } | |
| @misc{PhysioNet-sleep-accel-1.0.0, | |
| author = {Walch, Olivia}, | |
| title = {{Motion and heart rate from a wrist-worn wearable and labeled sleep from polysomnography}}, | |
| note = {Version 1.0.0, PhysioNet}, | |
| year = {2019}, | |
| doi = {10.13026/hmhs-py35} | |
| } | |
| ``` | |
| Pollard, T., Moody, B. E., Lehman, L., Gow, B., Fernandes, C., Xie, C., Johnson, A., Mark, R. G., & Heldt, T. (2026). PhysioNet as a global platform for biomedical research. Nature Health. https://doi.org/10.1038/s44360-026-00096-z | |
| --- | |
| # License | |
| The sleep-accel database is made available under the **Open Data Commons Attribution License v1.0 (ODC-By)**: https://physionet.org/content/sleep-accel/view-license/1.0.0/. This repository contains information from that database, published on PhysioNet. If you publicly use or redistribute this data or a work produced from it, keep this attribution and the license notice. | |