# The Multi-Branch Deep-Learning-Based Approach to Heart Dysfunction Classification
## 2 Proposed Approach  
### Multi-Branch Architecture  
This paper follows the approach from [18], where a concept consisting of core networks with two blended sub-networks and wavelet analysis was introduced. Here, we propose a novel architecture model. Instead of combining domain knowledge or other information with the ECG signal into a single input, multiple inputs are prepared individually (as shown in Figure 1), and a complex network architecture with six independent branches is proposed, each containing a core network and dedicated input (as shown in Figure 2). The branches of the model are denoted further in this paper as \(\alpha,\beta,\gamma,\delta,\epsilon,\zeta\). Popular solutions from state-of-the-art publications were used as inputs for individual architectural branches. The raw ECG signal used as input on every branch was subject to denoising, which was performed using wavelet thresholding. The wavelet of choice is Daubechies, the most popular choice for denoising ECG signals [21]. In order to denoise the signal, we apply the _uwavedec_ method from the Pywt library to extract wavelet coefficients. Later, a robust median estimator of standard Gaussian noise is calculated and used to establish the Bayesian Shrink threshold [22]. Threshold is applied to the detail coefficients obtained during the initial wavelet decomposition. The signal is then reconstructed based on the modified coefficients. Signals from different datasets were resampled to a common target frequency of 500 Hz (more on the process in Section 3.1). To equalize sampling frequencies, linear interpolation was applied to the signal when the upsampling from 257 Hz  
Figure 1: Scheme of ECG Signal preprocessing to form branch input. to 500 Hz was needed, and selecting every other sample was selected when downsampling from 1000 Hz to 500 Hz was required. As the region surrounding the R peak is critical for diagnosing cardiovascular diseases (CVDs) [17], an R peak detection algorithm is employed for signal segmentation. In this study, we utilized the commonly used Pan-Tompkins algorithm [23] to facilitate both R peak detection and the subsequent segmentation process. Digital ECG recordings were divided into 3 s long windows surrounding detected peaks, with exactly 1s of the signal prior to peak appearance and 2 s afterwards. As shown in Figure 1 for computing inputs to \(\beta,\gamma,\delta,\epsilon\) branches, baseline drift was removed from a denoised signal. Baseline was identified using the SNIP algorithm, and all the signals were readjusted by subtracting the baseline value, effectively equalizing at the new baseline of the signal at 0 line. In order to compute the input to the \(\zeta\) branch, nonlinear baseline wandering was removed from the denoised signal by applying wavelet-based baseline cancellation [24]. The inputs are presented in more detail later in this section. The individually preprocessed data make the input for dedicated branches consisting of one or more core network blocks with FC (fully connected) layers. Dropouts are added in order to prevent overfitting and improve generalization [25]. Branch outputs are concatenated and form the input for a fully connected (FC) layer to produce probabilities of all output classes. The model of the multi-branch architecture is shown in Figure 2.  
Different modalities of the original signal, obtained by the preprocessing described above, extend the information resource used to identify the particular signal sample. The details concerning the branches are given below. * The \(\alpha\) branch contains the processed ECG signal. * The \(\beta\) branch contains information that encapsulates both time and frequency domain information. Fourth-level wavelet decomposition using the type second Daubechies wavelet [26] was performed on the downsampled (by a factor of 2) ECG signal. Obtained approximation and detail coefficients are concatenated to form an input  
Figure 2: Scheme of Multibranch network architecture.