Simonlee711 commited on
Commit
43676a3
·
verified ·
1 Parent(s): ca3cb87

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +311 -0
README.md CHANGED
@@ -1,3 +1,314 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ library_name: pytorch
4
+ pipeline_tag: feature-extraction
5
+ tags:
6
+ - photoplethysmography
7
+ - ppg
8
+ - wearables
9
+ - smartwatch
10
+ - biosignals
11
+ - time-series
12
+ - self-supervised-learning
13
+ - masked-autoencoder
14
+ - foundation-model
15
+ - on-device
16
+ - health
17
+ - medical
18
+ - arrhythmia
19
+ - hypertension
20
+ model-index:
21
+ - name: HiMAE (1.2M)
22
+ results:
23
+ - task:
24
+ type: binary-classification
25
+ name: PVC detection (frozen encoder, linear probe)
26
+ dataset:
27
+ name: PVC detection cohort (private; 139 participants)
28
+ type: private
29
+ split: test
30
+ metrics:
31
+ - type: roc_auc
32
+ value: 0.8023
33
+ name: AUROC
34
+ - task:
35
+ type: binary-classification
36
+ name: PVC detection (fine-tuned)
37
+ dataset:
38
+ name: PVC detection cohort (private; 139 participants)
39
+ type: private
40
+ split: test
41
+ metrics:
42
+ - type: roc_auc
43
+ value: 0.9165
44
+ name: AUROC
45
+ - task:
46
+ type: binary-classification
47
+ name: Stage I hypertension (frozen encoder, linear probe)
48
+ dataset:
49
+ name: My Heart Lab Study hypertension cohort (private; 135 participants)
50
+ type: private
51
+ split: test
52
+ metrics:
53
+ - type: roc_auc
54
+ value: 0.6624
55
+ name: AUROC
56
+ - task:
57
+ type: binary-classification
58
+ name: Stage I hypertension (fine-tuned)
59
+ dataset:
60
+ name: My Heart Lab Study hypertension cohort (private; 135 participants)
61
+ type: private
62
+ split: test
63
+ metrics:
64
+ - type: roc_auc
65
+ value: 0.8969
66
+ name: AUROC
67
  ---
68
+
69
+ # HiMAE: Hierarchical Masked Autoencoder for wrist PPG
70
+
71
+ HiMAE is a compact (1.2M-parameter) self-supervised foundation model for wrist photoplethysmography (PPG), designed to run directly on commercial smartwatches. It was pretrained with masked reconstruction on about 80,000 hours of unlabeled wrist PPG from 47,644 participants. Its encoder produces representations that transfer to downstream screening tasks, such as detecting premature ventricular contractions (PVC) and stage I hypertension, through a linear probe or fine-tuning.
72
+
73
+ > **No weights are distributed in this repository.** The pretrained HiMAE weights, the clinical checkpoints and the training data are proprietary. This card documents the model described in the papers below. The architecture, training code, evaluation code and a synthetic example are open source on [GitHub](https://github.com/Simonlee711/On-Device-FM).
74
+
75
+ ## Model Details
76
+
77
+ ### Model Description
78
+
79
+ HiMAE is a hierarchical one-dimensional convolutional encoder–decoder with a U-Net-style design. The encoder compresses temporal resolution through stride-2 convolutions while increasing channel depth. Shallow stages capture local pulse morphology, while deeper stages aggregate longer-range rhythm dynamics. Residual blocks use GELU activations and batch normalization. Encoder–decoder skip connections are used only for reconstruction during pretraining; downstream prediction uses the pretrained encoder alone.
80
+
81
+ - **Developed by:** Simon A. Lee, Hao Zhou, Minji Han, Md Sazzad Hissain Khan, Rachel Choi, Cyrus Tanade, Juhyeon Lee, Minghui Sun, Young Sang Choi, Jiaqi Ding, Li Zhu, Md Mahbubur Rahman, Viswam Nathan, Mehrab Bin Morshed, Migyeong Gwak, Keum San Chun, Jeffrey N. Chiang, Sharanya Arcot Desai
82
+ - **Affiliations:** Digital Health Team, Samsung Research America; University of California, Los Angeles
83
+ - **Model type:** Self-supervised masked autoencoder (1-D CNN) for physiological time series
84
+ - **Input modality:** Single-channel wrist PPG, 10-second windows at 100 Hz (1,000 samples)
85
+ - **License:** MIT (code)
86
+ - **Weights:** Not released
87
+
88
+ ### Model Sources
89
+
90
+ - **Repository:** https://github.com/Simonlee711/On-Device-FM
91
+ - **Paper (method):** [HiMAE: Hierarchical Masked Autoencoders Discover Resolution-Specific Structure in Wearable Time Series](https://arxiv.org/abs/2510.25785), ICLR 2026
92
+ - **Paper (on-device clinical evaluation):** *A compact on-device foundation model enables real-time physiological screening on wearable devices* (manuscript in submission)
93
+
94
+ ## Uses
95
+
96
+ ### Direct Use
97
+
98
+ HiMAE is intended for research on representation learning from wearable PPG. The pretrained encoder maps a normalized 10-second PPG window to latent representations, which can serve as features for downstream tasks.
99
+
100
+ ### Downstream Use
101
+
102
+ Task-specific heads are trained on top of the encoder to produce continuous risk scores, either with a frozen encoder (linear probe) or by fine-tuning the whole encoder. The papers evaluate:
103
+
104
+ - premature ventricular contraction detection (PPG with an ECG reference);
105
+ - stage I hypertension classification;
106
+ - exploratory laboratory-abnormality screening (HbA1c, hemoglobin, platelet count, serum sodium) with frozen linear probes.
107
+
108
+ The model is small enough to run on smartwatch hardware without quantization or pruning, which supports screening-oriented inference in resource-constrained, on-device settings.
109
+
110
+ ### Out-of-Scope Use
111
+
112
+ - Use as a stand-alone diagnostic device or for autonomous clinical decision-making.
113
+ - Clinical deployment without prospective validation, calibration, and alert-burden assessment in the target population.
114
+ - Inputs that differ from the pretraining format (other body sites, sensors, sampling rates or window lengths) without revalidation.
115
+ - Claims of equivalent performance across demographic subgroups; this has not been established.
116
+
117
+ ## Bias, Risks, and Limitations
118
+
119
+ - **No established clinical utility.** The studies show cross-cohort predictive validity and technical feasibility on commercial hardware. They are not prospective clinical validation and do not show clinical utility, safety, or patient benefit.
120
+ - **Pretraining population imbalance.** The pretraining cohort is 77.6% male, 57.1% aged 30–49, and 65.1% White (see [Training Data](#training-data)). Performance in under-represented groups, including adults aged 65 and older (2.8%), may differ.
121
+ - **Subgroup performance not assessed.** Demographic variables were not uniformly available across downstream cohorts, and those cohorts were not sized for powered subgroup analyses.
122
+ - **Device and data provenance.** All data come from Samsung Galaxy smartwatches. Generalization to other devices, optical sensors or firmware is untested.
123
+ - **Small downstream cohorts.** The PVC (139 participants) and hypertension (135 participants) cohorts are modest. Laboratory tasks (19–39 participants each) are exploratory.
124
+ - **Energy use not measured.** On-device latency and throughput were measured, but model-attributable energy consumption and battery discharge under sustained operation were not.
125
+ - **Operational risk.** On-device execution reduces raw-signal transmission but does not remove privacy, calibration, security, or alert-management requirements. False-positive alerts carry real costs.
126
+
127
+ ### Recommendations
128
+
129
+ Before any deployment, users should evaluate the model prospectively in the target population and setting, including discrimination, calibration, subgroup performance, alert burden, and drift. Ongoing monitoring should track discrimination, calibration, subgroup performance, drift, and software and hardware versions. Operating thresholds should be selected on independent validation data, never on the evaluation set.
130
+
131
+ ## How to Get Started with the Model
132
+
133
+ Because the weights are not released, this repository cannot be loaded with `from_pretrained`. The architecture and a checkpoint trained on synthetic data are available on GitHub:
134
+
135
+ ```bash
136
+ git clone https://github.com/Simonlee711/On-Device-FM
137
+ cd On-Device-FM
138
+ pip install -r requirements.txt
139
+ ```
140
+
141
+ ```python
142
+ from pvc.utils.model_arch.himae import HiMAE, PAPER_CONFIG
143
+
144
+ model = HiMAE({"source": "ppg", "sampling_freq": PAPER_CONFIG["sampling_freq"],
145
+ "seg_len": PAPER_CONFIG["seg_len"], "model_params": {}})
146
+ # Per-stage feature maps for a batch of normalized windows x with shape (B, 1, 1000):
147
+ stage_features = model.encode(x)
148
+ ```
149
+
150
+ The repository's `HiMAE_PVC_Detection.ipynb` notebook runs an end-to-end linear probe on the synthetic PVC example.
151
+
152
+ ## Training Details
153
+
154
+ ### Training Data
155
+
156
+ Pretraining used free-living wrist PPG from **47,644 participants** across seven independent studies and multiple generations of Samsung Galaxy smartwatches. Participants opted into the Samsung Galaxy Watch research platform. The recordings total about 80,000 hours, or 28.8 million non-overlapping 10-second windows. No clinical labels were used, and the data are not publicly available.
157
+
158
+ | Category | Subgroup | N | % |
159
+ |---|---|---:|---:|
160
+ | Sex | Male | 36,990 | 77.6 |
161
+ | | Female | 10,532 | 22.1 |
162
+ | | Another gender identity | 122 | 0.3 |
163
+ | Age (years) | 18–29 | 12,019 | 25.2 |
164
+ | | 30–49 | 27,207 | 57.1 |
165
+ | | 50–64 | 7,067 | 14.8 |
166
+ | | ≥65 | 1,351 | 2.8 |
167
+ | Race | White | 31,029 | 65.1 |
168
+ | | Asian or Pacific Islander | 7,630 | 16.0 |
169
+ | | Black or African American | 3,414 | 7.2 |
170
+ | | American Indian or Alaska Native | 592 | 1.2 |
171
+ | | Another race | 4,979 | 10.5 |
172
+ | Body mass index (kg m⁻²) | Underweight (<18.5) | 823 | 1.7 |
173
+ | | Normal (18.5–24.9) | 13,626 | 28.6 |
174
+ | | Overweight (25–29.9) | 16,634 | 34.9 |
175
+ | | Obese I (30–34.9) | 8,745 | 18.4 |
176
+ | | Obese II–III (≥35) | 7,816 | 16.4 |
177
+
178
+ Sex, age, race and BMI are complete for all participants.
179
+
180
+ ### Training Procedure
181
+
182
+ #### Preprocessing
183
+
184
+ Recordings sampled at 100 Hz were segmented into non-overlapping 10-second windows (1,000 samples), and each window was normalized independently. Each window is split into contiguous patches of 5 samples, and 80% of the patches are masked. Masks are either uniformly random (to encourage recovery of fine morphology) or contiguous blocks (to simulate motion artifacts and sensor dropout).
185
+
186
+ #### Architecture
187
+
188
+ | Setting | Value |
189
+ |---|---|
190
+ | Input | 1 × 1,000 (10 s at 100 Hz) |
191
+ | Encoder channel hierarchy | 16, 32, 64, 128, 256 |
192
+ | Convolution kernel / stride | 5 / 2 |
193
+ | Patch size | 5 samples |
194
+ | Masking ratio | 0.8 |
195
+ | Activation / normalization | GELU / batch normalization |
196
+ | Parameters (full autoencoder) | 1,245,953 |
197
+ | Parameters (encoder + linear head used downstream) | 700,929 |
198
+
199
+ The configuration was chosen through controlled ablations of channel depth, patch size, kernel size, stride, and masking ratio, compared by validation reconstruction error. No neural architecture search was used.
200
+
201
+ #### Training Hyperparameters
202
+
203
+ - **Objective:** mean squared reconstruction error, computed on masked samples only
204
+ - **Optimizer:** AdamW with linear warmup (10% of steps) followed by cosine learning-rate decay
205
+ - **Early stopping:** on validation reconstruction loss
206
+ - **Released-code defaults (`pretrain/himae.py`):** batch size 1,024; learning rate 1e-3; weight decay 1e-3; up to 300 epochs; early-stopping patience 3; block-masking probability 0.5 with 4 masked blocks; 80/10/10 train/validation/test split of pretraining windows
207
+
208
+ #### Speeds, Sizes, Times
209
+
210
+ - **Pretraining:** converged in about 12 hours on four NVIDIA Tesla T4 GPUs with PyTorch Lightning.
211
+ - **Model-weight memory:** 4.8 MiB (fp32).
212
+ - **On-device inference:** see [Results](#results).
213
+
214
+ ## Evaluation
215
+
216
+ ### Testing Data, Factors & Metrics
217
+
218
+ #### Testing Data
219
+
220
+ All downstream cohorts are disjoint from pretraining in participants, device generations, firmware versions, and collection protocols. Training, validation, and test partitions are disjoint at the participant level and were fixed before evaluation. Counts are 10-second windows.
221
+
222
+ | Task | Participants | Test windows (positive %) | Reference standard |
223
+ |---|---:|---:|---|
224
+ | PVC detection | 139 | 77,899 (10.3%) | Concurrent ambulatory ECG; automated beat annotations reviewed by trained personnel |
225
+ | Stage I hypertension | 135 | 823 (23.3%) | Continuous non-invasive finger-cuff blood pressure with dual auscultation (My Heart Lab Study, NCT04314947) |
226
+ | HbA1c / platelet / hemoglobin / sodium abnormality (exploratory) | 19 / 33 / 39 / 36 | 202 / 401 / 256 / 271 | Contemporaneous clinical laboratory panels (Tulane University) |
227
+
228
+ #### Factors
229
+
230
+ Results are reported separately by task and by adaptation regime: a frozen encoder with a linear probe, and full fine-tuning. Few-shot fine-tuning was also evaluated with 256, 512, 1,024, 2,048, or all training examples.
231
+
232
+ #### Metrics
233
+
234
+ - **AUROC** is the primary measure of discrimination. 95% confidence intervals come from 1,000 participant-level bootstrap resamples of the test set, with all windows of a sampled participant kept together.
235
+ - **Paired AUROC differences** between models are tested with the two-sided paired DeLong test.
236
+ - **Threshold-dependent metrics** (true-positive counts, sensitivity, specificity, PPV, NPV, balanced accuracy, Youden index) are computed at thresholds selected on the validation split only to target 95%, 90%, or 80% specificity, then applied unchanged to the test set.
237
+
238
+ ### Results
239
+
240
+ **Discrimination (test AUROC, 95% CI).** Both regimes use the same held-out test participants.
241
+
242
+ | Task | Regime | HiMAE (1.2M) | ResNet (11.2M, supervised) | PaPaGei (5.7M) | EfficientNet (7.8M) | MAE1D (6.7M) | MAE1D (110M) |
243
+ |---|---|---|---|---|---|---|---|
244
+ | PVC | Frozen | **0.8023** [0.7822, 0.8217] | 0.7320 [0.7122, 0.7534] | 0.7892 [0.7697, 0.8095] | 0.7478 [0.7277, 0.7674] | 0.7834 [0.7634, 0.8045] | 0.7129 [0.6946, 0.7326] |
245
+ | PVC | Fine-tuned | **0.9165** [0.9063, 0.9277] | 0.7320 [0.7122, 0.7534] | 0.8692 [0.8533, 0.8864] | 0.8536 [0.8385, 0.8690] | 0.8341 [0.8159, 0.8511] | 0.9155 [0.9040, 0.9261] |
246
+ | Hypertension | Frozen | **0.6624** [0.6274, 0.6958] | 0.4930 [0.4574, 0.5278] | 0.6611 [0.6193, 0.7021] | 0.6415 [0.5993, 0.6857] | 0.5471 [0.5025, 0.5924] | 0.6614 [0.6220, 0.7018] |
247
+ | Hypertension | Fine-tuned | **0.8969** [0.8656, 0.9252] | 0.4930 [0.4574, 0.5278] | 0.8376 [0.7988, 0.8734] | 0.8428 [0.8067, 0.8784] | 0.6275 [0.5829, 0.6704] | 0.8959 [0.8695, 0.9202] |
248
+
249
+ ResNet was trained once with full supervision, so its result is the same in both regimes. After fine-tuning, HiMAE and the 110M-parameter MAE1D showed no statistically significant difference (PVC ΔAUROC 0.001, P = 0.69; hypertension ΔAUROC 0.001, P = 0.77), despite an approximately 92-fold difference in parameter count.
250
+
251
+ **Operating point (fine-tuned, validation-selected 95% specificity target).**
252
+
253
+ | Task | True-positive windows | Sensitivity [95% CI] | Achieved specificity [95% CI] | ΔTP vs. ResNet [95% CI] |
254
+ |---|---:|---|---|---|
255
+ | PVC | 4,921 | 0.614 [0.575, 0.654] | 0.948 [0.943, 0.952] | +3,186 [+2,524, +3,878] |
256
+ | Hypertension | 104 | 0.542 [0.452, 0.635] | 0.948 [0.924, 0.969] | +95 [+66, +121] |
257
+
258
+ **On-device performance (Samsung Galaxy Watch 8, Exynos W1000, 2 GB RAM; full precision; batch size 1; mean [95% CI] across repeated timed passes).**
259
+
260
+ | Model | Parameters | Model-weight memory | CPU latency (s/window) | Throughput (windows/s) |
261
+ |---|---:|---:|---|---|
262
+ | **HiMAE** | **1.2M** | **4.8 MiB** | **0.900** [0.887, 0.913] | **1.200** [1.184, 1.216] |
263
+ | PaPaGei | 5.7M | 22.3 MiB | 0.976 [0.960, 0.992] | 1.069 [1.054, 1.084] |
264
+ | EfficientNet | 7.8M | 31.1 MiB | 1.420 [1.398, 1.442] | 0.704 [0.693, 0.715] |
265
+ | MAE1D | 6.7M | 26.8 MiB | 1.576 [1.552, 1.600] | 0.620 [0.610, 0.630] |
266
+ | MAE1D | 110M | 441.3 MiB | 3.360 [3.318, 3.402] | 0.298 [0.292, 0.304] |
267
+
268
+ All models were converted to TorchScript and run with PyTorch Mobile inside a native Wear OS application, under identical conditions and without quantization, pruning, operator fusion, or accelerator offloading.
269
+
270
+ #### Summary
271
+
272
+ HiMAE gave the highest frozen-encoder AUROC on both primary tasks. After fine-tuning, it matched a model about 92 times larger, and it had the lowest memory footprint and latency on a commercial smartwatch. In few-shot experiments, it achieved the strongest discrimination across low-label regimes for both tasks.
273
+
274
+ ## Environmental Impact
275
+
276
+ - **Hardware type:** 4 × NVIDIA Tesla T4
277
+ - **Hours used:** about 12 (pretraining)
278
+ - **Cloud provider / compute region / carbon emitted:** not reported
279
+
280
+ ## Technical Specifications
281
+
282
+ ### Model Architecture and Objective
283
+
284
+ HiMAE is a U-Net-style hierarchical 1-D CNN masked autoencoder. The encoder has five residual stages with stride-2 downsampling; stage *k* has a temporal step of 2^k samples, and receptive fields range from about 130 ms to 3.73 s. A mirrored decoder with skip connections reconstructs the masked input. The objective is mean squared error on masked samples.
285
+
286
+ ### Compute Infrastructure
287
+
288
+ - **Training hardware:** four NVIDIA Tesla T4 GPUs
289
+ - **Deployment hardware:** Samsung Galaxy Watch 8 (5-core Exynos W1000, 2 GB LPDDR5)
290
+ - **Software:** PyTorch, PyTorch Lightning; TorchScript and PyTorch Mobile for on-device inference
291
+
292
+ ## Citation
293
+
294
+ **BibTeX:**
295
+
296
+ ```bibtex
297
+ @inproceedings{lee2026himae,
298
+ title = {HiMAE: Hierarchical Masked Autoencoders Discover Resolution-Specific Structure in Wearable Time Series},
299
+ author = {Lee, Simon A. and Tanade, Cyrus and Zhou, Hao and others and Arcot Desai, Sharanya},
300
+ booktitle = {The Fourteenth International Conference on Learning Representations},
301
+ year = {2026},
302
+ url = {https://arxiv.org/abs/2510.25785}
303
+ }
304
+ ```
305
+
306
+ The on-device clinical evaluation, *A compact on-device foundation model enables real-time physiological screening on wearable devices*, is in submission. Citation details will be added on publication.
307
+
308
+ ## Model Card Authors
309
+
310
+ Simon A. Lee, Jeffrey N. Chiang, Sharanya Arcot Desai
311
+
312
+ ## Model Card Contact
313
+
314
+ Simon A. Lee (simonlee711@g.ucla.edu), Jeffrey N. Chiang (njchiang@g.ucla.edu), Sharanya Arcot Desai (s.desai1@samsung.com), or open an issue on [GitHub](https://github.com/Simonlee711/On-Device-FM/issues).