## 3 Methodology  
Our methodology seeks to develop a neural network capable of denoising severely corrupted ECG signals through the utilization of a dual dataset [19]. One dataset comprises ECG signals, while the other encompasses the artifact sources, specifically the EMG signals, which serve as the noise component in our investigation. Given a paired signal training dataset c and n, where n represented the noisy version of the clean ECG signal c for a given sample, our goal is to learn the right parameter values of a neural network so that the network can map the noisy signal N to the clean signal C. With these optimized parameters, the neural network can be used to denoise all ECG signals, including those not available in the training database. The overall framework shown in Figure 2 illustrated the overview of the proposed approach at training and inference time. The inference section of the figure illustrates the workflow of ECGNet, a model designed to denoise ECG signals by removing noise such as EMG interference. The process starts with two inputs: the clean ECG signal \((\hat{x})\) and the noise signal \((\hat{n})\), the degradation process of acquired ECG can be represented as mentioned in Equation (1). This noisy signal is fed into ECGDNet, which processes it to produce a denoised output signal \((\hat{d})\). The objective of the model is to accurately reconstruct the clean ECG signal \((\hat{x})\) by separating it from the noise, ensuring the output is a noise-free representation of the original signal. The training part outlines the training process of a transformer based model \(M(d;\theta)\) for denoising signals by leveraging both training and validation datasets. The process begins by initializing the model parameters \(\theta\) with random values. The training dataset consists of noisy signals \(C_{s}=\{c_{s}^{i}\}_{i=1}^{n}\) and their corresponding ground-truth clean signals \(X_{s}=\{x_{s}^{i}\}_{i=1}^{n}\), while the validation dataset comprises \(C_{t}=\{C_{t}^{i}\}_{i=1}^{m}\) and \(X_{t}=\{x_{t}^{i}\}_{i=1}^{m}\). During each training iteration, the model processes the noisy training signals \(C_{s}\) to estimate the corresponding noise-free output \(\widehat{x_{s}}=M(d_{s};\theta)\). The quality of this estimation is evaluated using a loss function \(\Delta(x_{s},\widehat{x_{s}})\), which computes the difference between the estimated output \(\widehat{x_{s}}\) and the ground-truth signal \(x_{s}\). The parameters \(\theta\) are then updated using the Adam optimization algorithm to minimize this training loss. In parallel, the model's performance on the validation dataset is monitored to assess generalization. The noisy validation signals \(C_{t}\) are fed into the model to generate estimated noise-free outputs \(\widehat{x}_{t}=M(d_{t};\theta)\), and the validation loss \(\Delta(x_{t},\hat{x}_{t})\) is computed by comparing these outputs to the ground-truth clean signals \(X_{t}\). It is important to emphasize that the validation data is never used for updating the model parameters \(\theta\) and plays no role in the optimization process. Instead, the validation loss serves exclusively as an early stopping criterion: the training continues until the validation loss plateaus or increases for a specified number of epochs, indicating that further training may lead to overfitting. Upon convergence, the final set of optimized parameters \(\theta\) defines the trained model \(M(d;\theta)\), which is then ready for deployment in denoising tasks. This approach ensures that the model generalizes well to unseen data while avoiding overfitting through independent validation monitoring. In the proposed _ECGDnet_ architecture as shown in Figure 3, the input ECG signal is reshaped into a two-dimensional representation of shape \((k,q)\), where \(k=32\) denotes the number of temporal segments (or tokens) and \(q=16\) represents the dimensionality of each token.