TL;DR
The proposed Mamba-based ECG Enhancer (MECG-E) introduces a highly efficient, time-frequency domain framework for removing baseline wander noise from electrocardiogram (ECG) signals. By leveraging the selective state space mechanism of the Mamba architecture, MECG-E outperforms state-of-the-art diffusion models in denoising accuracy while drastically reducing inference latency, making it a strong candidate for real-time clinical deployment.
What Problem Does This Paper Address?
Electrocardiogram (ECG) signals are vital for diagnosing cardiovascular diseases, yet they are highly susceptible to noise contamination during acquisition. A particularly challenging artifact is baseline wander, caused by patient respiration, body movement, or poor electrode contact, which shifts the signal's baseline and obscures critical diagnostic features like ST-segments.
While traditional filtering methods (like FIR or IIR filters) struggle in highly non-linear or severely noisy environments, deep learning approaches have stepped in to fill the gap. Recently, score-based diffusion models achieved state-of-the-art (SOTA) denoising performance. However, diffusion models rely on iterative sampling steps during inference, making them computationally heavy and far too slow for online, real-time clinical monitoring. The authors address this critical trade-off between denoising quality and inference speed.
Methods
MECG-E shifts the denoising paradigm by processing ECG signals in the time-frequency (TF) domain rather than the raw time domain.
The pipeline consists of the following key stages:
- Time-Frequency Transformation & Compression: A Short-Time Fourier Transform (STFT) converts the 1D ECG signal into a 2D complex spectrum. The authors apply power-law compression to this spectrum to better handle variations in signal amplitude.
- Feature Representation: The model evaluates two input types: "Complex" (Real and Imaginary components) and "Mag.+Phase" (Magnitude and Phase spectra).
- Encoder: Comprising convolutional blocks and a dilated DenseNet, the encoder expands the feature dimensions and aggregates multi-level contextual features along the time axis.
- TF-Bi-Mamba Block: The core of the model utilizes Bidirectional Mamba layers. It splits processing into a Time Bi-Mamba block to capture temporal dependencies and a Frequency Bi-Mamba block to capture spectral relationships. Mamba's selective state space mechanism allows it to model these long-range dependencies linearly with respect to sequence length.
- Decoders: A Magnitude Mask Decoder estimates a mask to clean the magnitude spectrum, while a parallel Phase Decoder reconstructs the phase. An inverse STFT (iSTFT) maps the cleaned components back to a 1D time-domain ECG signal.
- Composite Loss Function: The model is optimized using a joint loss function combining time-domain loss ($L_{time}$), complex TF-domain loss ($L_{cpx}$), and an STFT/iSTFT consistency loss ($L_{con}$).
Datasets
The model was trained and evaluated using standard benchmark datasets:
- Clean ECG Records: Sourced from the QT Database, providing high-quality reference physiological signals.
- Noise Profiles: Sourced from the MIT-BIH Noise Stress Test Database (NSTDB), specifically utilizing baseline wander noise.
- Synthesis: To simulate realistic clinical environments, clean signals were corrupted by scaling the noise profiles with a random factor ranging from 0.2 to 2.0, ensuring a comprehensive evaluation across diverse signal-to-noise ratios (SNRs).
Key Insights and Ideas
- Mamba Transcends NLP: Originally designed for discrete sequence modeling in natural language processing, this paper demonstrates that Mamba's selective state space mechanism is exceptionally potent for continuous, multi-dimensional physiological signal processing when mapped to the TF domain.
- Magnitude + Phase Superiority: The authors found that explicitly separating Magnitude and Phase ("Mag.+Phase") as input features yields slightly better reconstruction metrics than treating them as raw Complex numbers.
- The Power of Compression: Applying power-law compression to the spectrum significantly impacts performance. The authors systematically proved that a compression exponent ($c$) between 0.3 and 0.7 yields optimal results, outperforming uncompressed baselines.
Key Results
MECG-E was benchmarked against traditional filters, deep recurrent networks (DRNN), fully convolutional autoencoders (FCN-DAE), DeepFilter, and the SOTA diffusion model (DeScoD-ECG).
Quantitative Performance
MECG-E consistently achieved the best or second-best scores across all evaluated metrics: Sum of Squares of Distances (SSD), Absolute Maximum Distance (MAD), Percentage Root-Mean-Square Difference (PRD), and Cosine Similarity (CosSim). Notably, it maintained this superiority across all tested noise magnitudes ($0.2 \le n < 2.0$).
Inference Speedup
The most striking result is the efficiency gain over diffusion models. As shown below, MECG-E achieves lower distortion (SSD) while operating orders of magnitude faster than DeScoD-ECG (even when the diffusion model is restricted to a fast 1-shot setup).
Qualitative Artifact Elimination
Visually, MECG-E preserves the true morphology of the ECG waves (P, QRS, and T waves) remarkably well under severe noise. Furthermore, under extreme noise conditions ($noise = 1.99$), SOTA diffusion models tend to generate hallucinated "phantom" artifacts in flat, signal-free regions, whereas MECG-E suppresses noise cleanly without introducing artificial distortions.
Limitations and Future Work
While MECG-E demonstrates exceptional speed and accuracy, the authors note a few areas for expansion:
- Downstream Integration: The model's performance was evaluated purely on signal reconstruction metrics. Future work needs to validate whether this enhancement directly improves downstream tasks like automated arrhythmia classification.
- Real-Time Edge Deployment: Although the inference time is mathematically low enough to support real-time processing, the framework has yet to be stress-tested on hardware-constrained edge devices (e.g., wearable holter monitors).
Summary updated