## 3 Methodology
### Segmentation  
Segmentation of the diseased region was performed using the U-Net model. U-Net is a CNN-based segmentation model that was proposed in 2015 for biomedical images [23]. It has one encoder module and another decoder module. Figure 3 depicts the U-Net model's architecture. In the encoder module, two convolutional (3 \(\times\) 3) layers are applied repeatedly with one stride. The Relu layer and a 2 \(\times\) 2 Maxpooling layer with two and four strides follow each convolutional layer. A dropout layer is applied following the first convolutional layer. The bottom layers consist of 3 \(\times\) 3 convolutional layers. The decoding part up-samples the dimensions of the image to its original by applying two convolutional (3 \(\times\) 3) layers. The first layer is stacked by Relu; the dropout layer and the next convolutional layer are stacked by the Relu layer only. The top layer, which is also the last layer, is a convolutional (1 \(\times\) 1) layer. The first encoder part is used for the extraction of features, and is similar to the VGG-16 model [34]. The up-sampling operation combines both low-resolution as well as high-resolution information, which is the provision of object-based recognition, as well as accurate positioning and segmentation, which is useful for medical image segmentation [34]. As the foundational model for U-Net, we utilized the ResNet-34 model, which was observed to outperform other segmentation models [35]. The U-Net model outputs the black-and-white image mask, which was then used to draw contours around the diseased area of an image. Figure 2: Polyp images after applying data augmentation. During model training, the Adam optimizer was applied. Due to its outstanding outcomes and adaptable learning gain, the Adam optimizer is frequently used by researchers for CNNs [37], and root mean squared error (RMSE) is used as a loss function. The model was trained for a total of 250 epochs with a batch size of 50. The Adam optimizer is used to control the gradient descent rate in such a way that there is minimum fluctuation near to global optima, and it takes large steps near to local optima to avoid it and reach global minima efficiently. Adam combines the features of two gradient descent techniques, namely, momentum and root mean squared propagation (RMSP). Mathematical equations of momentum and RMSP are expressed as follows:  
\[R_{t}=\sigma_{1}*\ R_{t}+(1-\sigma_{1})*(\frac{\delta S}{\delta\psi_{t}}) \tag{1}\]  
\[\varphi_{t}=\sigma_{2}*\ \varphi_{t}+(1-\sigma_{2})*(\frac{\delta S}{\delta\psi_{t}} )^{2} \tag{2}\]  
where \(R_{t}\) is the gradient aggregate at t, \(\delta S\) is a derivative of a loss function, \(\delta\psi_{t}\) is a derivate of weights at t, \(\sigma\) is an average parameter that is moving, and \(\varphi_{t}\) is the sum of the square of past gradients. Initially, both \(R_{t}\) and \(\varphi_{t}\) are set to zero, and it is observed that both tend to be biased towards zero as \(\sigma_{1}\) and \(\sigma_{2}\) are set to one. The Adam optimizer solved this problem by calculating bias-corrected \(\widehat{R_{t}}\) as well as \(\widehat{\varphi_{t}}\). Mathematical equations of these biased corrected values are expressed as follows:  
\[\widehat{R_{t}}=\frac{R_{t}}{1-\sigma_{1}^{t}} \tag{3}\]  
Figure 3: U-Net architecture diagram with ResNet-34 as the backbone model [36]. \[\widehat{\varphi}_{t}=\frac{\varphi_{t}}{1-\sigma_{2}^{t}} \tag{4}\]  
After each iteration, new positions of weights by substituting the updated values are given as follows:  
\[\forall_{t}=\forall(t-1)-\exists*(\frac{\widehat{R}_{t}}{\sqrt{(\widehat{ \varphi}_{t})}}+\mu) \tag{5}\]  
where \(\forall_{t}\) is a weight at time t, \(\exists\) is a learning rate, and \(\mu\) is a constant. Mean squared error (MSE) is called an average of squares of errors. It is the square of the difference between the actual attribute and estimator.