# Performance Analysis for COVID-19 Diagnosis Using Custom and State-of-the-Art Deep Learning Models
## 3 Methodology
### Approach
#### 3.2.1 Custom-Model  
The custom model involves convolution, non-linearity, downsampling (pooling layer), and generic, multi-layer neural network. Before the architectural details at an abstract level are explored, an introduction to the underlying mathematical formations is helpful and is given below.  
The convolution layer deployed in the network allows features to be learnt for images, which activate for edges along different angles. Diving deep into the network, the layers can learn to activate for complex patterns, e.g., shapes represented by a group of edges, while further depth explores features for meaningful objects. Convolution involves computations (summation of dot products) by spanning kernels or filters over the input image [43].  
Let \(H^{l}\), \(W^{l}\), \(D^{l}\), denote the input dimensions to the \(l\)-th convolution layer of order 3.  
Normally, multiple kernels having a spatial span, \(H\times W\). Let \(D\) be the number of kernels, while, for denoting the kernel, \(D^{l}\) represents the number of channels of input. Kernel \(f\) will be an order 4 tensor in \(\mathbb{R}^{H\times W\times D^{l}\times D}\).  
Figure 1: Sample chest X-ray images of normal, COVID-19 and lung opacity cases.  
The kernel spans across the entire image and the sum of products, \(HWD^{l}\), of the corresponding elements ranging in the \(D^{l}\) channels yield the result at a specified spatial location of the output feature map. A stride corresponds to the number of pixels to be skipped while spanning at each convolution operation.  
In terms of mathematical definition, while keeping the subject context, the convolution involves convolution operation of a kernel or filter over the layer of input data, which is defined as follows:  
\[y_{i+1/i+1,d}=\sum_{i=0}^{H}\sum_{j=0}^{W}\sum_{d^{l}=0}^{D^{l}}f_{i,j,d^{l},d} \times x^{l}_{i+1+i,\,j+1+j,\,d^{l}} \tag{1}\]  
where the third dimension \(d^{l}\) ranges across the number of channels, and the first and third dimensions range across the height and width of the kernel, i.e.,  
\[0\ \leq\ i\ <\ H,\,0\ \leq\ j\ <\ W,\,0\ \leq\ d^{l}\!\!<D^{l}\ \text{and}\ 0\ \leq\ d\ <\ D.\]  
and \(y_{i+1/i+1,d}\) represents the output of the \(l\)-th which is the input to the \(l+1\) layer.  
It should be noted that specific values of these index variables refer to a specific point in a kernel and a bias term bd is usually added to \(y_{i+1/i+1,d}\).  
Introducing non-linearity introduces non-linear transformation in the model, helping recognize complex patterns. Nonlinearity was introduced with ReLU, which is used in several fields, such as image processing. It cuts off the inputs before feeding into the next layer. However, it does not involve any downsampling.  
Mathematically, it can be represented as in Equation (2).  
\[y_{i,j,d}=\max\Bigl{\{}0,\ \ x^{l}_{i,\,i,\,d^{l}}\ \Bigr{\}} \tag{2}\]  
\[0\ \leq\ i\ <\ H^{l}\!=H^{l+1},\ 0\ \leq\ j\ <\ W^{l}\!\!=W^{l+1}\ \text{and}\ 0\ \leq\ d^{l}\!\!<D^{l}\!\!=D^{l+1}\]  
A graphical representation is shown in Figure 3.  
Figure 2: Overall system architecture.