# Research on ECG Signal Classification Based on Hybrid Residual Network
## 2 Method
### Data Preprocessing  
This work involved the extensive preprocessing of ECG signals to enhance the signal quality and classification accuracy. The preprocessing workflow includes heartbeat segmentation and classification, baseline drift elimination, and noise reduction. Initially, adhering to the AAMI classification standards, which were established by the Association for the Advancement of Medical Instrumentation (AAMI) to provide a unified framework for the evaluation and classification of arrhythmias in clinical and research settings, we grouped the 19 types of signals in the MIT-BIH Arrhythmia Database into 5 major categories: N (normal beats), S (supraventricular arrhythmia), V (ventricular arrhythmia), F (fusion beats), and Q (unclassified beats). These standards are widely adopted in the field of electrocardiography to ensure consistency and reliability in the classification of heartbeat types, serving as a foundation for developing automated arrhythmia detection systems and facilitating the comparison of different algorithms [8]. Table 1 provides a detailed enumeration of heartbeat types. We extracted the types of heartbeats and the spatial information of the R-points by analyzing the signal data and annotation data from each record file. For each pulse, we picked 70 sampling points preceding the R-point and 210 sample points following it to extract a signal segment containing the entire heartbeat cycle. Subsequently, to eradicate baseline drift in the ECG signals, we applied a high-pass Butterworth filter. The transfer function of this filter is:  
\[H(s)=\frac{s^{n}}{s^{n}+\omega_{c}^{n}} \tag{1}\]  
where \(\omega_{c}\) denotes the cutoff frequency, and \(n\) represents the order of the filter. In this study, we selected a 5 th-order Butterworth filter with a cutoff frequency of 0.5 Hz to eliminate low-frequency components caused by respiration and body movement. The baseline drift in the signal was successfully mitigated following filtration. \begin{table}
\begin{tabular}{c c} \hline
**AAMI Classes** & **Hearbeat Types** \\ \hline Normal beats (N) & \(\bullet\) Normal beat \\ \(\bullet\) Left bundle branch block beat (LBB) \\ \(\bullet\) Right bundle branch block beat (RBB) \\ \(\bullet\) Atrial escape & \(\bullet\) Atrial escape \\ \(\bullet\) Nodal (junctional) escape \\ Ventricular ectopic (V) & \(\bullet\) Premature ventricular contraction beat (PVC) \\ \(\bullet\) Ventricular escape & \(\bullet\) Ventricular escape \\ Supraventricular ectopic (S) & \(\bullet\) Atrial premature contraction beat (APC) \\ Supraventricular ectopic (S) & \(\bullet\) Supraventricular premature beat \\  & \(\bullet\) Nodal (junctional) premature beat \\ Fusion beats (F) & \(\bullet\) Fusion of ventricular normal beat (F) \\ Unclassifiable beats (Q) & \(\bullet\) A fusion of paced and normal beat (f) \\ \(\bullet\) Unclassified beat (Q) & \\ \hline \end{tabular}
\end{table} 
Table 1: MIT-BIH verses AAMI 5 heartbeat class groupings. Afterwards, we applied discrete wavelet transform (DWT) for signal denoising. The Daubechies 8 (db8) wavelet was selected, and the decomposition levels were configured to the maximum permissible level. The formula for discrete wavelet transform is:  
\[W_{j}(k)=\sum_{n=0}^{N-1}x[n]\psi_{j,k}[n] \tag{2}\]  
where \(W_{j}(k)\) denotes the wavelet coefficient, \(x[n]\) represents the input discrete signal, and \(\psi_{j,k}[n]\) is the discrete wavelet basis function. We implemented hard thresholding on the high-frequency coefficients of each decomposition layer, establishing the threshold at 10% of the maximum wavelet coefficient in each layer. The specific formula for hard thresholding is:  
\[\omega_{i}= \begin{cases}\omega_{i},&if|\omega_{i}|\geq\lambda\\ 0,&if|\omega_{i}|<\lambda\end{cases}  \tag{3}\]  
where \(\omega_{i}\) is the wavelet coefficient derived from the \(i\)-th decomposition, and \(\lambda\) denotes the set threshold value.