TF-TransUNet1D: ECG Denoising for Cardiac Digital Twins
- The paper introduces TF-TransUNet1D, a model combining U-Net and Transformer architectures that preserves key ECG morphology during denoising.
- It employs a dual-domain training objective to enforce both time-domain waveform accuracy and frequency-domain spectral fidelity, effectively suppressing artifacts.
- Quantitative results show a 24.3% reduction in MAE and improved PCC, demonstrating significant performance gains over CNN-LSTM and U-Net 1D under mixed-noise conditions.
Searching arXiv for the specified paper and closely related work to ground the article. TF-TransUNet1D is a lightweight one-dimensional deep neural network for electrocardiogram (ECG) denoising in cardiac digital twin pipelines. It combines a U-Net-style convolutional encoder-decoder with a Transformer encoder at the bottleneck and is trained with a dual-domain objective that constrains both time-domain waveform reconstruction and frequency-domain spectral fidelity. The method is intended to preserve physiologically meaningful morphology, including P-wave shape, QRS sharpness, ST-segment slope, and T-wave structure, while removing artifacts such as baseline wander, muscle artifact, electrode motion artifacts, and powerline interference. The model was introduced in “TF-TransUNet1D: Time-Frequency Guided Transformer U-Net for Robust ECG Denoising in Digital Twin” (Wang et al., 28 Aug 2025).
1. Problem setting in ECG denoising and cardiac digital twins
In cardiac digital twins, ECG serves as a foundational input for personalized modeling, monitoring, and simulation. The stated motivation for TF-TransUNet1D is that ECG signals used in such pipelines must be not merely generically denoised, but physiologically faithful, because contamination can corrupt downstream tasks such as arrhythmia characterization, inverse inference, and patient-specific prediction (Wang et al., 28 Aug 2025).
The target corruption setting includes realistic noise and artifact types drawn from the Noise Stress Test Database (NSTDB): baseline wander, muscle artifact or EMG noise, electrode motion artifacts, and powerline interference. The reported experiments also include mixed or composite noisy conditions and varying signal-to-noise ratio (SNR) levels. The clinical rationale is explicit: methods that oversmooth or alter morphology can distort P-wave duration, ST-segment slope, QRS frequency content, and other diagnostically relevant features. The paper further notes that such distortions can propagate into “cascading errors” in physiological modeling and simulation (Wang et al., 28 Aug 2025).
A central premise of the model is therefore that denoising quality should be assessed not only by generic reconstruction error but also by preservation of clinically relevant waveform structure and correct spectral content. This suggests a denoiser designed for digital twin applications must balance artifact suppression with morphology preservation more carefully than a purely signal-processing-oriented baseline.
2. Architectural composition
TF-TransUNet1D follows a 1D U-Net encoder-decoder backbone with a Transformer encoder inserted at the bottleneck. The input is a single-lead ECG segment of shape (batch size, 1, 3600), corresponding to a 10-second window, and the output has the same shape (batch size, 1, 3600) (Wang et al., 28 Aug 2025).
The encoder is a convolutional U-Net-style encoder comprising an initial convolution block INC and downsampling stages D1–D4. Each block uses 1D convolutions, ReLU, max pooling, and batch normalization. At the deepest level, the feature map after D4 is flattened or reshaped into a sequence, positional encoding is added, and N stacked Transformer encoder layers process the sequence. Each Transformer layer contains multi-head self-attention, a feedforward network, residual connections, and layer normalization. The decoder then applies four upsampling stages U1–U4 using transposed convolutions, with each upsampling stage followed by a double convolution block. Skip connections link encoder and decoder stages at matching resolutions, and a final 1×1 convolution OutConv maps the representation back to one output channel (Wang et al., 28 Aug 2025).
The roles assigned to the main modules are sharply differentiated. The CNN/U-Net encoder extracts local morphological features such as edges and waveform shapes and compresses the signal into a compact representation. Skip connections preserve high-frequency and fine-grained details that could otherwise be lost during downsampling. The Transformer encoder models long-range temporal dependencies across the full ECG segment, including relationships among P waves, QRS complexes, and T waves across distant cardiac cycles. The decoder reconstructs the denoised waveform by combining the Transformer’s global context with local detail preserved through the skip pathways (Wang et al., 28 Aug 2025).
The paper’s principal architectural claim is that CNNs are effective for local feature extraction, whereas Transformers are effective for global context aggregation; TF-TransUNet1D combines both to preserve morphology and long-range temporal structure within a single 1D denoising network.
3. Time-frequency guided training objective
The defining training mechanism is a dual-domain loss that combines a time-domain reconstruction term with a frequency-domain spectral term. Let denote the clean ECG signal and the denoised output from the model, for (Wang et al., 28 Aug 2025).
The time-domain term is Smooth L1 loss, selected for stability and robustness. With error , the loss is given as
$L_{\text{time} = \frac{1}{N}\sum_{n=1}^{N} \begin{cases} \frac{1}{2} e_n^2 / \beta, & |e_n| < \beta \ |e_n| - \frac{1}{2}\beta, & \text{otherwise} \end{cases}$
Its stated behavior is MSE-like when , yielding smooth gradients and precise convergence, and MAE-like when , reducing sensitivity to outliers and residual noise. The paper characterizes this as helping reconstruct ECG morphology accurately without overreacting to extreme noise (Wang et al., 28 Aug 2025).
The frequency-domain term compares the FFT magnitudes of the clean and reconstructed signals:
$L_{\text{spectral} = \frac{1}{K}\sum_{k=1}^{K}\left(|Y[k]| - |\hat{Y}[k]|\right)^2$
where is the discrete Fourier magnitude of the clean signal, is the discrete Fourier magnitude of the denoised signal, and 0 is the number of frequency bins. This term is described as encouraging the model to match the power spectrum of the clean ECG, thereby helping preserve correct frequency content of clinically relevant components, especially the QRS band, while suppressing spurious high-frequency noise. The paper explicitly emphasizes that this prevents the network from merely “smoothing” the signal in a way that may reduce MSE but also attenuate useful high-frequency waveform information (Wang et al., 28 Aug 2025).
The total objective is a weighted sum,
1
with weights tuned during validation. The excerpt does not provide explicit numeric values for 2 and 3. A plausible implication is that the method’s robustness under heavy noise is intended to arise from joint enforcement of waveform-level accuracy and spectral consistency rather than from either constraint alone.
4. Data sources, corruption protocol, and optimization
The clean ECG data source is the MIT-BIH Arrhythmia Database, while the noise sources are drawn from NSTDB (Wang et al., 28 Aug 2025). The synthetic corruption pipeline is described in four steps: taking clean ECG records from MIT-BIH, segmenting them with a sliding window, adding NSTDB noise instances at specified SNR levels, and forming paired noisy/clean segments.
Several implementation details are explicit. The segment length is 3600 samples, corresponding to 10 seconds. Signals are z-normalized to zero mean and unit variance. The same random noise instance is added to the corresponding clean segment to create paired samples. The reported experiments involve baseline wander, EMG or muscle noise, electrode motion artifacts, powerline interference, and combinations of these noises. Multiple target SNRs are used, explicitly including 0 dB, 5 dB, and 10 dB (Wang et al., 28 Aug 2025).
The data split design includes a validation portion for hyperparameter tuning and early stopping, and the test set contains subjects not seen during training, supporting generalization assessment. Exact split ratios are not given in the provided text (Wang et al., 28 Aug 2025).
Optimization and runtime configuration are also specified. The implementation framework is PyTorch, the optimizer is AdamW, and the learning-rate schedule is cosine annealing with 4 and 5. Training is performed for 100 epochs with batch size 16 on an NVIDIA GeForce RTX 4090 (Wang et al., 28 Aug 2025).
These details place TF-TransUNet1D within a standard modern supervised denoising regime built from synthetic noisy-clean pairs. At the same time, the paper’s emphasis on unseen-subject testing indicates that subject-level generalization, rather than only in-sample denoising accuracy, is part of the intended evaluation setting.
5. Evaluation methodology and quantitative results
The denoising quality is evaluated using SNR, SNRI, PRD, PCC, and MAE. Their stated roles are differentiated: SNRI measures noise suppression capability, PCC captures waveform or morphological similarity, MAE captures point-wise amplitude reconstruction error, and PRD quantifies normalized reconstruction error (Wang et al., 28 Aug 2025).
Standard definitions provided in the excerpt include
6
7
8
9
The main comparative evaluation at 0 dB mixed noise reports results against CNN-LSTM, U-Net 1D, and FastRNN (Wang et al., 28 Aug 2025).
| Model | MAE | PCC | SNRI |
|---|---|---|---|
| CNN-LSTM | 0.1819 | 0.9160 | 10.61 |
| U-Net 1D | 0.1697 | 0.9195 | 10.85 |
| FastRNN | 0.2057 | 0.9138 | 9.74 |
| TF-TransUNet1D | 0.1285 | 0.9540 | 13.36 |
The reported interpretation is that MAE = 0.1285 indicates very small average amplitude error relative to the clean signal, PCC = 0.9540 indicates that the denoised waveform shape is highly correlated with the ground truth, and SNRI = 13.36 indicates substantial improvement in signal-to-noise ratio over the corrupted input. The paper also states that TF-TransUNet1D reduces MAE by about 24.3% compared with the second-best model, which it presents as evidence of improved reconstruction fidelity (Wang et al., 28 Aug 2025).
Across noise and SNR conditions, the figure-based analysis reports strong robustness in both single-noise and mixed-noise cases. At 0 dB, the model achieved the lowest MAE of 0.0819 against motion artifact noise and the highest PCC of 0.981 against burst noise; at 10 dB, PCC further improved to 0.992. Performance also remains strong under composite noise such as BW + EM + MA, though this setting is described as somewhat more challenging. Qualitatively, the denoised ECGs show suppression of high-frequency myoelectric noise, attenuation of motion artifacts, and restoration of clear P waves, sharp QRS complexes, and well-defined T waves (Wang et al., 28 Aug 2025).
6. Component contributions, significance, and limitations
The excerpt does not present a formal ablation table, but it assigns specific contributions to each architectural and objective component. The U-Net encoder-decoder with skip connections preserves local morphology and high-frequency detail. The Transformer bottleneck adds long-range temporal context and helps distinguish physiological structure from nonstationary noise. The dual-domain loss improves robustness by enforcing both accurate waveform reconstruction and correct spectral content. The authors explicitly argue that the frequency-domain term is especially beneficial under heavy noise because it prevents the network from minimizing error through excessive smoothing (Wang et al., 28 Aug 2025).
Within the application framing, TF-TransUNet1D is positioned as a preprocessing module for cardiac digital twins rather than solely as a stand-alone denoiser. Clean, artifact-free ECG is described as crucial for real-time monitoring, personalized modeling, arrhythmia prediction, more reliable inverse inference and simulation, and ambulatory and wearable deployment. By improving waveform fidelity, the model is intended to ensure that downstream digital-twin models operate on signals that better reflect true cardiac physiology rather than corrupted measurements (Wang et al., 28 Aug 2025).
Several limitations are implicit in the provided description. The evaluation is based on synthetic noise injection rather than fully real-world noisy clinical recordings. The study focuses on single-lead ECG. Exact split ratios and detailed hyperparameter values beyond optimizer and schedule are not fully specified in the excerpt. The frequency loss is defined on FFT magnitudes, which may not fully capture phase-sensitive structure. These points are presented as inference-supported limitations rather than as an explicit limitations section in the excerpt. Correspondingly, possible future directions suggested by the work include testing on more diverse real-world datasets, extending to multi-lead ECG, exploring more advanced time-frequency objectives, integrating the denoiser directly into end-to-end digital twin pipelines, and further reducing architectural overhead for edge and wearable deployment (Wang et al., 28 Aug 2025).
Taken together, TF-TransUNet1D is characterized by three coupled design commitments: convolutional local feature extraction, Transformer-based global temporal modeling, and a dual-domain time-frequency loss. In the reported synthetic MIT-BIH + NSTDB benchmark setting, this combination outperforms CNN-LSTM, U-Net 1D, and FastRNN, with MAE = 0.1285, PCC = 0.9540, and SNRI = 13.36 at 0 dB mixed-noise conditions. This suggests that the method’s distinctive contribution lies not only in denoising efficacy but in explicitly aligning denoising objectives with the morphology-preservation requirements of cardiac digital twin pipelines (Wang et al., 28 Aug 2025).