BeatFlow-ECG: Rectified Flow for ECG Reconstruction from Indirect Wearable Signals
Organizations: Department of Computer Science, Virginia Commonwealth University, Richmond, VA, USA · School of Information Technology and Computer Science, Nile University, Giza, Egypt
Abstract
Continuous cardiac monitoring outside clinical settings requires signals that are both informative and practical to collect during daily life. Electrocardiography (ECG) provides rich information about cardiac rhythm and waveform morphology, while wearable photoplethysmography (PPG) is easier to acquire continuously but is only an indirect cardiovascular measurement and is highly sensitive to motion. We present BeatFlow-ECG, a conditional rectified-flow model for reconstructing single-channel ECG from synchronized PPG and inertial measurements. BeatFlow-ECG models reconstruction as conditional transport from noise to ECG using a convolutional encoder-decoder with a transformer bottleneck and explicit flow-time conditioning. Motion information is incorporated through IMU-derived conditioning features, motion-dependent loss weighting, and an easy-to-hard training curriculum. We evaluate the model under leave-one-subject-out protocols on PPG-DaLiA and WESAD. BeatFlow-ECG achieves the best results among the evaluated deterministic, adversarial, and diffusion-based baselines across all reported waveform and beat-timing metrics, with Pearson correlations of 0.983 and 0.986 and R-peak F1 scores of 0.946 and 0.955, respectively. Compared with Conditional DDPM-1D, L1 error decreases from 0.085 to 0.062 on PPG-DaLiA and from 0.074 to 0.055 on WESAD. Additional analyses on PPG-DaLiA show higher correlation in fixed R-peak-relative waveform regions and lower reconstruction error across low-, medium-, and high-motion subsets.
Figures & tables
| Dataset | Model | Params | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|---|---|
| PPG-DaLiA | AttnSeq | 8.5M | 0.285 [0.258, 0.312] | 0.412 [0.375, 0.449] | 0.815 [0.791, 0.839] | 0.742 [0.717, 0.767] | 10.45 [9.47, 11.43] |
| AttnSeq-Large | 12.3M | 0.258 [0.231, 0.285] | 0.381 [0.342, 0.420] | 0.835 [0.810, 0.860] | 0.768 [0.740, 0.796] | 9.31 [8.40, 10.22] | |
| UNet1D | 4.2M | 0.124 [0.114, 0.134] | 0.185 [0.172, 0.198] | 0.931 [0.918, 0.944] | 0.885 [0.873, 0.897] | 6.72 [6.14, 7.30] | |
| UNet1D-Large | 13.2M | 0.138 [0.086, 0.190] | 0.210 [0.138, 0.282] | 0.925 [0.872, 0.978] | 0.875 [0.832, 0.918] | 6.95 [5.68, 8.22] | |
| Conditional DDPM-1D | 12.6M | 0.085 [0.067, 0.103] | 0.132 [0.111, 0.153] | 0.962 [0.946, 0.979] | 0.905 [0.882, 0.928] | 6.12 [5.42, 6.82] | |
| CardioGAN | 28.24M | 0.377 [0.332, 0.422] | 0.465 [0.413, 0.517] | 0.810 [0.772, 0.848] | 0.755 [0.720, 0.790] | 10.20 [8.95, 11.45] |
| Model | P-wave | QRS | T-wave |
|---|---|---|---|
| UNet1D | 0.742 | 0.951 | 0.865 |
| UNet1D-Large | 0.712 | 0.935 | 0.838 |
| Conditional DDPM-1D | 0.825 | 0.978 | 0.908 |
| BeatFlow-ECG | 0.882 | 0.992 | 0.945 |
| Motion level | UNet1D-Large | Conditional DDPM-1D | BeatFlow-ECG |
|---|---|---|---|
| Low | 0.070 | 0.045 | 0.032 |
| Medium | 0.127 | 0.075 | 0.054 |
| High | 0.217 | 0.135 | 0.100 |
| Configuration | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| w/o Motion Conditioning | 0.078 | 0.125 | 0.965 | 0.920 | 5.60 |
| w/o Curriculum | 0.071 | 0.118 | 0.974 | 0.932 | 5.35 |
| w/o STFT Loss | 0.069 | 0.116 | 0.975 | 0.926 | 5.21 |
| w/o Motion Weighting + STFT Loss | 0.084 | 0.132 | 0.960 | 0.912 | 5.85 |
| BeatFlow-ECG (Full) | 0.062 | 0.102 | 0.983 | 0.946 | 4.89 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Parameters (M) | Function Evaluations | Inference Time (ms) |
|---|---|---|---|
| UNet1D | 4.2 | 1 | 8 |
| AttnSeq | 8.5 | 1 | 14 |
| UNet1D-Large | 13.2 | 1 | 18 |
| AttnSeq-Large | 12.3 | 1 | 22 |
| Conditional DDPM-1D | 12.6 | 1000 | 3520 |
| BeatFlow-ECG | 12.5 | 120 | 425 |
| Subject | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| S1 | 0.063 | 0.106 | 0.986 | 0.943 | 5.14 |
| S2 | 0.041 | 0.075 | 0.996 | 0.965 | 4.15 |
| S3 | 0.065 | 0.102 | 0.989 | 0.947 | 6.46 |
| S4 | 0.044 | 0.080 | 0.995 | 0.958 | 4.37 |
| S5 | 0.045 | 0.081 | 0.995 | 0.975 | 3.85 |
| S6 | 0.097 | 0.143 | 0.915 | 0.885 | 6.55 |
| Subject | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| S1 | 0.086 | 0.132 | 0.967 | 0.912 | 6.20 |
| S2 | 0.052 | 0.092 | 0.988 | 0.942 | 4.90 |
| S3 | 0.088 | 0.130 | 0.972 | 0.920 | 7.30 |
| S4 | 0.055 | 0.098 | 0.985 | 0.935 | 5.10 |
| S5 | 0.058 | 0.101 | 0.985 | 0.948 | 4.70 |
| S6 | 0.142 | 0.202 | 0.880 | 0.805 | 8.20 |
| Subject | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| S1 | 0.175 | 0.279 | 0.925 | 0.840 | 7.05 |
| S2 | 0.035 | 0.057 | 0.998 | 0.950 | 5.75 |
| S3 | 0.155 | 0.220 | 0.948 | 0.865 | 8.20 |
| S4 | 0.048 | 0.079 | 0.995 | 0.930 | 5.50 |
| S5 | 0.056 | 0.096 | 0.993 | 0.980 | 2.98 |
| S6 | 0.282 | 0.396 | 0.655 | 0.685 | 10.65 |
| Subject | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| S1 | 0.056 | 0.091 | 0.988 | 0.952 | 4.25 |
| S2 | 0.038 | 0.068 | 0.997 | 0.971 | 3.50 |
| S3 | 0.058 | 0.094 | 0.990 | 0.958 | 5.10 |
| S4 | 0.040 | 0.072 | 0.996 | 0.965 | 3.75 |
| S5 | 0.042 | 0.075 | 0.996 | 0.980 | 3.20 |
| S6 | 0.082 | 0.125 | 0.935 | 0.905 | 5.50 |
| Subject | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| S1 | 0.076 | 0.114 | 0.974 | 0.915 | 5.40 |
| S2 | 0.048 | 0.082 | 0.991 | 0.952 | 4.20 |
| S3 | 0.078 | 0.118 | 0.977 | 0.922 | 6.10 |
| S4 | 0.052 | 0.088 | 0.988 | 0.940 | 4.50 |
| S5 | 0.054 | 0.091 | 0.989 | 0.955 | 3.90 |
| S6 | 0.112 | 0.160 | 0.907 | 0.835 | 6.80 |
| Subject | L1 | RMSE | Pearson | R-peak F1 | HR error (bpm) |
|---|---|---|---|---|---|
| S1 | 0.163 | 0.258 | 0.918 | 0.862 | 6.55 |
| S2 | 0.038 | 0.058 | 0.998 | 0.955 | 5.35 |
| S3 | 0.142 | 0.205 | 0.952 | 0.888 | 7.60 |
| S4 | 0.048 | 0.078 | 0.995 | 0.932 | 5.10 |
| S5 | 0.055 | 0.092 | 0.994 | 0.981 | 2.80 |
| S6 | 0.260 | 0.355 | 0.550 | 0.655 | 9.85 |
| Learning rate | Validation L1 |
|---|---|
| 0.148 | |
| 0.165 | |
| 0.192 |
| Hyperparameter | Value |
|---|---|
| Window length | 1250 samples (10 s) |
| Stride | 625 samples (5 s) |
| Sampling rate | 125 Hz |
| BeatFlow-ECG transformer depth | 8 |
| Hidden dimension | 320 |
| Feedforward dimension | 1280 |