Datasets:

Languages:
English
License:
BerkenUtku commited on
Commit
117928e
·
verified ·
1 Parent(s): 957960d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +108 -0
README.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - medical
7
+ size_categories:
8
+ - 100K<n<1M
9
+ ---
10
+ ## [WildPPG](https://siplab.org/projects/WildPPG): A Real-World PPG Dataset of Long Continuous Recordings (NeurIPS 2024 Datasets & Benchmarks)
11
+
12
+ [Manuel Meier](https://scholar.google.com/citations?user=L6f-xg0AAAAJ), [Berken Utku Demirel](https://scholar.google.com/citations?user=zbgxpdIAAAAJ), [Christian Holz](https://www.christianholz.net)<br/>
13
+
14
+ [Sensing, Interaction & Perception Lab](https://siplab.org), Department of Computer Science, ETH Zürich, Switzerland <br/>
15
+
16
+ ___________
17
+
18
+ Quick Links:
19
+ - [Project Website](https://siplab.org/projects/WildPPG)
20
+ - [Paper](https://static.siplab.org/papers/neurips2024-wildppg.pdf)
21
+ ----------
22
+
23
+ # Loading the Dataset
24
+ The dataset is available for download [here](https://huggingface.co/datasets/siplab/WildPPG/tree/main)
25
+ The dataset is split into .mat MATLAB files representing participants and can be loaded with MATLAB.
26
+
27
+ ## Loading the Data
28
+ You can load the `.mat` file using either Python or MATLAB:
29
+
30
+ - **Python**:
31
+ Use [`scipy.io.loadmat`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.loadmat.html):
32
+ ```python
33
+ from scipy.io import loadmat
34
+ data = loadmat('WildPPG.mat')
35
+ ```
36
+
37
+ - **MATLAB**:
38
+ Use the built-in `load` function:
39
+ ```matlab
40
+ data = load('WildPPG.mat');
41
+ ```
42
+
43
+ The `.mat` file contains **14 cell arrays**, each representing a variable (e.g., `data_altitude_values`, `data_bpm_values`, `data_ppg_wrist`).
44
+ Each cell array includes **16 entries**, corresponding to data from 16 individual subjects.
45
+
46
+
47
+
48
+ ### Example loader
49
+
50
+ ```python
51
+ import numpy as np
52
+ import scipy.io
53
+
54
+ def load_domain_data(domain_idx):
55
+ """Loads wrist PPG and heart rate data for a single subject (domain).
56
+
57
+ Args:
58
+ domain_idx (int): Index of the subject (0–15).
59
+
60
+ Returns:
61
+ X (np.ndarray): PPG signal data (n_samples × signal_dim).
62
+ y (np.ndarray): Heart rate values (bpm), adjusted to start from 0.
63
+ d (np.ndarray): Domain labels (same shape as y), equal to domain_idx.
64
+ """
65
+ data_path = 'data/WildPPG/WildPPG.mat'
66
+ data_all = scipy.io.loadmat(data_path)
67
+
68
+ # Load PPG signal and heart rate values
69
+ data = data_all['data_ppg_wrist']
70
+ data_labels = data_all['data_bpm_values']
71
+
72
+ domain_idx = int(domain_idx)
73
+ X = data[domain_idx, 0]
74
+ y = np.squeeze(data_labels[domain_idx][0]).astype(int)
75
+
76
+ # Mask out invalid samples (e.g., NaNs, infs, and HR < 30 bpm)
77
+ mask_Y = y >= 30
78
+ mask_X = ~np.isnan(X).any(axis=1) & ~np.isinf(X).any(axis=1)
79
+ combined_mask = mask_Y & mask_X
80
+
81
+ X = X[combined_mask]
82
+ y = y[combined_mask] - 30 # Normalize HR: min HR is 30 bpm → range starts from 0
83
+ d = np.full(y.shape, domain_idx, dtype=int)
84
+
85
+ return X, y, d
86
+ ```
87
+
88
+
89
+ #### Load PPG & Heart Rate Data for a Single Subject
90
+
91
+ The function `load_domain_data(domain_idx)` loads **wrist PPG signal data** and **heart rate (HR) labels** for a single subject from the `WildPPG.mat` file.
92
+
93
+ - `domain_idx` ranges from `0` to `15`, each corresponding to one of the 16 subjects.
94
+ - The data is preprocessed by:
95
+ - Removing invalid samples (NaNs, infs, and HR < 30 bpm)
96
+ - Normalizing HR values to start from 0 (by subtracting 30 bpm)
97
+ - The function returns:
98
+ - `X`: preprocessed PPG signal (shape: `n_samples × signal_dim`)
99
+ - `y`: adjusted heart rate labels
100
+ - `d`: domain label (same shape as `y`, filled with `domain_idx`)
101
+
102
+ Example usage:
103
+
104
+ ```python
105
+ x, y, d = load_domain_data(3) # Load data for subject 3
106
+ ```
107
+
108
+