TLDR: TF-TransUNet1D is a novel deep learning model designed to accurately denoise electrocardiogram (ECG) signals, crucial for cardiac digital twin systems. It combines a U-Net architecture for local feature extraction with a Transformer encoder for capturing long-range dependencies, guided by a unique dual time-frequency domain loss function. This approach significantly improves signal-to-noise ratio and preserves vital ECG waveform details, outperforming existing methods and enabling more reliable real-time cardiac monitoring and personalized health modeling.
Electrocardiogram (ECG) signals are vital for understanding heart health and are a cornerstone for advanced cardiac digital twin systems. These digital twins are personalized computer models of a patient’s heart, used for real-time monitoring and predicting responses to treatments. However, the diagnostic value of ECG signals is often compromised by various types of noise and artifacts, making accurate analysis challenging.
Traditional methods for denoising ECG signals, such as simple filters or wavelet transforms, often fall short. They can be too rigid, distorting crucial morphological features like P-wave duration or ST-segment slope, which are critical for accurate digital twin simulations. More advanced techniques, while better at adapting to non-stationary noise, can still fail to preserve the spectral integrity of the signal, leading to errors in predictive models.
In recent years, deep learning has shown promise in ECG denoising. Models like Autoencoders and Recurrent Neural Networks (RNNs) have been used, but they face a fundamental challenge: how to preserve fine local signal features while simultaneously capturing the broader, global context of the ECG waveform. Conventional Convolutional Neural Networks (CNNs) and autoencoders typically have limited receptive fields, struggling with long-range dependencies. Transformer-based models, while excellent at global modeling, can sometimes lose critical local details if not properly integrated with multi-scale feature pathways. Furthermore, many neural networks overlook the importance of preserving spectral information, which can lead to distortions in the recovered ECG signal.
Addressing these challenges, researchers Shijie Wang and Lei Li from the National University of Singapore have introduced TF-TransUNet1D, a novel and lightweight deep neural network. This architecture is specifically designed to meet the stringent signal fidelity requirements of cardiac digital twin systems. TF-TransUNet1D combines the strengths of local feature representation and global context aggregation through two key innovations.
First, it features a hybrid architecture that integrates a U-Net-based encoder-decoder with a Transformer encoder. The U-Net part is excellent at capturing local morphological features and multi-scale details, while the Transformer encoder excels at modeling long-range temporal dependencies across the entire ECG segment. This combination ensures that both the fine details (like P-waves, QRS complexes, and T-waves) and the overall rhythm and dynamics are accurately processed. Skip connections within the U-Net structure help retain high-frequency details that might otherwise be lost during compression.
Second, TF-TransUNet1D employs a unique dual-domain loss function. This function jointly optimizes waveform reconstruction in the time domain and spectral fidelity in the frequency domain. The time-domain component uses a Smooth L1 loss, which provides precise convergence for small errors and robust handling of outliers for larger errors. The frequency-domain component, based on the Fast Fourier Transform (FFT), penalizes discrepancies in the power spectra of the clean and denoised signals. This is crucial for suppressing high-frequency noise while maintaining the signal’s true spectral structure, preventing over-smoothing and ensuring that clinically significant waveform components are recovered accurately.
The model was rigorously evaluated using synthetically corrupted ECG signals from the MIT-BIH Arrhythmia Database and the Noise Stress Test Database (NSTDB), covering various noise types like baseline wander, muscle noise, electrode motion artifacts, and powerline interference. Comparative experiments against state-of-the-art baselines, including CNN-LSTM, U-Net 1D, and FastRNN, demonstrated TF-TransUNet1D’s consistent superiority. It achieved the best results across all evaluation metrics, including Mean Absolute Error (MAE), Pearson Correlation Coefficient (PCC), and Signal-to-Noise Ratio Improvement (SNRI).
For instance, under mixed noise conditions at 0 dB SNR, TF-TransUNet1D reduced the MAE by approximately 24.3% compared to the next best model, indicating minimal average amplitude difference between the reconstructed and clean signals. Its high PCC further confirmed its ability to preserve signal fidelity and spectral characteristics. The model also showed strong robustness and generalization across diverse single and combined noise types and varying SNR levels, even performing exceptionally well under extreme low SNR conditions.
Qualitative analysis further highlighted the model’s effectiveness, showing marked improvements in waveform morphology preservation and noise suppression. It successfully smoothed high-frequency artifacts and attenuated substantial motion artifacts, restoring normal cardiac rhythm while maintaining diagnostically critical features with exceptional fidelity. This success is largely attributed to the frequency-domain loss, which ensures spectral consistency, particularly within powerline interference bands, preserving the integrity of important waveforms.
Also Read:
- Early Atrial Fibrillation Prediction with a Compact AI Model
- EEGDM: A Diffusion Model for Enhanced Brain Signal Analysis
In conclusion, TF-TransUNet1D offers an efficient and scalable strategy for enhancing ECG signal quality, making it a valuable component for building high-fidelity cardiac digital twins. By delivering high-precision denoising, this work bridges a critical gap in pre-processing pipelines for cardiac digital twins, enabling more reliable real-time monitoring and personalized modeling for cardiovascular care. You can read the full research paper here.


