## 2 Proposed ECG Authentication Algorithm Using Residual Depthwise Separable CNN
The Depthwise Separable can be explained using Equation (5) to (8), as follows:  
\[Conv1D(\omega,y)_{(i)}=\sum_{k.m}^{K,M}\omega_{(k.m)}\cdot y_{(i+k,m)} \tag{5}\]  
\[PointwiseConv1D(\omega,y)_{(i)}=\sum_{m}^{M}\omega_{m}.y_{(i,m)} \tag{6}\]  
\[DepthwiseConv1D(\omega,y)_{(i)}=\sum_{k}^{K}\omega_{(k)}\odot y_{(i+k)} \tag{7}\]  
\[SepConv1D\Big{(}\omega_{p},\omega_{d},y\Big{)}_{(i)}=PointwiseConv1D_{(i)} \left(\omega_{p},DepthwiseConv1D_{(i)}(\omega_{d},y)\right) \tag{8}\]  
where \(i\) is the element index in layer \(y\). \(\omega_{p}\) and \(\omega_{d}\) are the filters calculated from Equations (6) and (7). The calculation in Equation (5) can be replaced with Equation (8) through calculations of Equations (6) and (7). Although the output layer from Equation (5) is similar to Equations (6) to (8), the total number of parameters and the training time were decreased, as can be seen in \[x_{k}^{l}=\beta_{k}^{l}+\sum_{i=1}^{N_{l-1}}conv1D\Big{(}\alpha_{ik}^{l-1},s_{ i}^{l-1}\Big{)} \tag{1}\]0 Note that the depthwise separable technique will reduce the training time and reduce the accuracy as well. To compensate for the slight decrease in performance, the residual technique can be applied. Therefore, combining these two techniques, i.e., Depthwise Separable and Residual, not only reduces the number of parameters for training but also improves the accuracy. Residual is a technique in CNN, in which one of the branches is a shortcut bypassing one or several other branch layers. Initially, this technique was intended to overcome the saturation of the increasing number of layers. Too many layers will lead to longer training iteration, lower speed, and lower accuracy. With the residual technique, the training iteration can be shorter, and the accuracy will increase. The general formulas for the identity function related to the residual shortcut are as follows [15]:  
\[x_{k}^{l}=\beta_{k}^{l}+\sum_{i=1}^{N_{l-1}}conv1D\Big{(}\alpha_{ik}^{l-1},s_{ i}^{l-1}\Big{)} \tag{1}\]1  
\[x_{k}^{l}=\beta_{k}^{l}+\sum_{i=1}^{N_{l-1}}conv1D\Big{(}\alpha_{ik}^{l-1},s_{ i}^{l-1}\Big{)} \tag{1}\]2  
where \(x\) is the input, \(y\) is the output layer and \(\mathcal{F}(x,\{W_{i}\})\) is a filter or residual mapping which can be optimized. \(W_{i}\) is a collection of overlapped layers. \(W_{s}\) is a linear projection to adjust the \(x\) and \(y\) dimensions when a shortcut is performed. There is almost no change in the number of parameters and arithmetic operations, except for the addition operation which has a little computational load. Therefore, the application of this residual technique can minimize the training iteration while improving accuracy. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Profile** & **Beat Detection** & **Depthwise Separable Convolution** & **Residual** \\ \hline
1 & Manual & No & Yes \\
2 & Manual & Yes & No \\
3 & Manual & Yes & Yes \\
4 & Hamilton’s method & Yes & Yes \\
5 & Hybrid & Yes & Yes \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Experimental scenarios using ECG-ID and MIT-BIH databases with various CNN configurations. Generally, this residual technique is applied to CNN models with millions of training data, hundreds of layers, and tens of thousands of iteration epochs. However, in this paper, the residual technique can be applied to a smaller number of training data (between 900 and 4800), fewer layers (less than 30), and less iteration (100 epochs). As the number of biometric data to be authenticated increases, the number of layers, the number and size of filters, and the number of iterations can be increased as well.