Architecture (Approach A primary — dual-path late fusion)¶
Flow¶
flowchart LR
SIG["signal\nraw ECG, 360 Hz"] --> F1["features A\n1D conv over waveform"] --> M1["Model Mamba SSM"]
SCAL["scalogram\nCWT heatmap, PQRST annotated"] --> F2["features B\n2D conv, pooled to time axis"] --> M2["Model Mamba SSM"]
M1 --> OUT["output\nN / V / S / F / Q"]
M2 --> OUT
Path 1 — signal branch¶
Raw single-lead ECG window (e.g. 1 x 216 samples at 360 Hz, R-peak centered, z-score normalized). Features A: 1D conv stack over the waveform. Its own Mamba SSM and 5-logit head. Trains and evaluates standalone.
Path 2 — scalogram branch¶
CWT (Morlet) magnitude of the same window, roughly scales x time (e.g. 32 x 216), log-magnitude, per-window normalized. P, QRS, T regions appear as distinct energy bands. Features B: small 2D conv stack over the heatmap, pooled over scale back to the time axis. Its own Mamba SSM and 5-logit head. Trains and evaluates standalone.
Output fusion¶
Default: average the two logit vectors, then per-class threshold tuning (threshold 0.5 start, V recall prioritized — life-threatening misses cost more than false alarms). Learned per-class gate only if averaging underperforms. Majority vote kept as a fallback comparison.
Outputs¶
Five independent logits with sigmoid: N / V / S / F / Q.
Key decisions (locked unless revisited)¶
- Single lead (MLII) first; add V1 later only if scores demand it.
- CWT Morlet, fixed scale range documented in data.md.
- Patient-wise splits, never random beat splits (leakage).
- Approach B (early fusion, one shared model) is the ablation, not the primary — see approaches.md.