This repository contains a research-project implementation for Contactless Radar Heart Rate and Variability Monitoring via a Spectro-Temporal Transformer with Curriculum Learning.
SpectroTransNet estimates frame-wise instantaneous heart rate (IHR) from FMCW radar time-frequency maps, then reconstructs beat timing with an IPFM-style procedure to compute heart-rate variability (HRV) metrics such as RMSSD, SDNN, and SD2.
- Contactless HR and HRV estimation from FMCW mmWave radar.
- CWT-based radar spectrogram input aligned with ECG-derived IHR labels.
- CNN local encoding plus Transformer temporal modeling for long-range rhythm consistency.
- Curriculum objective that shifts training from coarse rhythm tracking to beat-level dynamics.
- IPFM beat reconstruction for RR intervals and HRV metrics.
The pipeline first extracts and filters radar phase signals, converts each 10-second window into a CWT time-frequency representation, and uses ECG R-peaks to construct frame-wise IHR labels. SpectroTransNet then maps each CWT window to an IHR trajectory. During inference, predicted IHR is integrated as instantaneous frequency; integer phase crossings define reconstructed beat times, from which RR intervals and HRV metrics are computed.
This project evaluates subject-independent generalization on the public clinical radar vital-sign dataset from Schellenberger et al., using Resting and Valsalva maneuver recordings.
| Condition | HR MAE (bpm) | RMSSD MAE (ms) | SDNN MAE (ms) | SD2 MAE (ms) |
|---|---|---|---|---|
| Resting | 1.0261 | 10.6859 | 13.1819 | 17.6093 |
| Valsalva | 1.6790 | 12.1079 | 14.1657 | 18.5728 |
Overall comparison on pooled test segments:
| Method | HR MAE | HR RMSE | HR r | RMSSD MAE | RMSSD RMSE | RMSSD r |
|---|---|---|---|---|---|---|
| CWT + Viterbi | 3.33 | 4.71 | 0.73 | 37.86 | 53.08 | 0.37 |
| ResNet-18 | 2.34 | 4.08 | 0.88 | 16.69 | 25.30 | 0.58 |
| No-Curriculum | 2.16 | 6.37 | 0.74 | 12.93 | 19.56 | 0.64 |
| SpectroTransNet | 1.44 | 4.68 | 0.84 | 11.58 | 19.01 | 0.65 |
assets/ Figures prepared for GitHub presentation
docs/report/ Technical report draft and project notes
src/hrv/ Reusable data, model, loss, metric, and baseline modules
scripts/ Dataset preparation, training, evaluation, and plotting entrypoints
archive/ Legacy signal-processing utilities and exploratory experiments
tests/ Lightweight project-structure smoke checks
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtRun scripts with the source package on PYTHONPATH:
export PYTHONPATH=srcDownload the public clinical radar vital-sign dataset and place the .mat recordings under a local directory, for example data_nature/.
PYTHONPATH=src python scripts/prepare_dataset.py \
--mat-root data_nature \
--out-dir results/nature_dataset_cleanedThe generated dataset contains compressed .npz windows with:
spectrogram: CWT radar time-frequency map, shape[64, 1200]ihr_curve: ECG-derived IHR label, shape[1200]
Train SpectroTransNet:
PYTHONPATH=src python scripts/train.pyTrain comparison models:
PYTHONPATH=src python scripts/train_baseline_cnn.py
PYTHONPATH=src python scripts/train_no_curriculum.pyEvaluate the proposed model with IPFM HRV reconstruction:
PYTHONPATH=src python scripts/evaluate.py \
--data-dir results/nature_dataset_cleaned \
--checkpoint checkpoints_trans/best_model.pth \
--output-file results/spectrotransnet_metrics_ipfm.csvEvaluate baselines:
PYTHONPATH=src python scripts/evaluate_cnn.py
PYTHONPATH=src python scripts/evaluate_no_curriculum.py
PYTHONPATH=src python scripts/evaluate_viterbi.pyGenerate report-style result figures from CSV outputs:
PYTHONPATH=src python scripts/make_figures.py --output-dir results/figuresThe project report draft is included at docs/report/technical_report_draft.docx. It is an internal project document, not a published paper. The README figures are extracted from this draft and renamed for stable GitHub rendering.



