## 3 The U2-Net Architecture
We reprocess each input image by reducing the dimension to 256 \(\times\) 256 \(\times\) 3 with RGB color channels using a bi-cubic interpolation algorithm. Resizing plays a major role to train any Machine Learning (ML) or Deep Learning (DL) models. 2. _Convolutional layer_. We use the typical convolutional layer in the U-net architecture generated by applying the convolution operation using a kernel of different sizes, number of filters, stride, padding, and activation function. This layer contains all the vital topographies of an image, such as color and gradient orientation. The input to the convolution layer is a matrix containing image information, while the output is a map full of image features. We used nested convolution operation along with the ReLU as an activation function. It is the most used initiation task in DL replicas that proposes supplementing and strengthening the nonlinearity properties of the neural system. Each image has a set of channels. We start with 16 different channels as an initial step and then duplicate it for each next layer in the encoding path, as described in Figure 1 to reach out to 1024 channels. while in the decoding path, we start with 1024 and reduce this number by dividing it by 2 for each level to reach out to the original number 16. We use the _Conv2D_ function provided by _tensorflow.Keras_ to perform the convolution step. For any given input \(x\), the ReLU is defined as follows [35; 36]:  
\[RelU(x)= \begin{cases}x,&\text{if x}>0\\ 0,&\text{otherwise}\end{cases}  \tag{1}\]  
3. _Max pooling layer_. The down-sampling layer is another name for this layer. It is the layer handled after the convolution layer in the CNN design. The feature maps' height and breadth are reduced while maintaining the same depth by the max pooling layer. To prevent model overfitting, reducing the map's size, the amount of computation required, and the number of factors, is helpful. The down-sampling operation can be performed by using either maximum pooling or average pooling. Maximum pooling extracts the maximum value of the elements within a receptive field, and average pooling calculates  
Figure 2: The architecture for the U2-net model, starting from the top-left layer. the mean value. We used the maximum pooling as a pooling layer because it preserves the features in the input feature map in a better way in terms of object representation during the down-sampling process [31; 37]. We use the _MaxPooling2D_ function provided by _tensorflow.Keras_ to perform the max pooling step. 4. _Transpose convolution layer_. This layer is also known as the up-sampling or deconvolutional layer. We use this layer in the decoding path to precisely restore and locate features. It represents standard convolutions defined by the padding and stride and is usually carried out for up-sampling to generate an output feature map that has a spatial dimension greater than that of the input feature map. We use the _Conv2 DTranspose_ function provided by _tensorflow.Keras_ to perform the transpose convolution step. For a given size of the input \(i\), kernel \(k\), padding \(p\), and stride \(s\), the size of the output feature map \(o\) generated is given by:  
\[o=(i-1)s+k-2p \tag{2}\]  
5. _Dropout layer_. The dropout layer randomly deletes inputs based on the rate (we use 10%) at each update during training time, which helps prevent overfitting. We used the dropout operation after each first convolution when the max pooling, or up-sample operation, is completed. We use the _Dropout_ function provided by _tensorflow.Keras_ to perform the dropout step. 6. _Dense layer (fully connected layer)_. In any neural network, a dense layer is a layer that is fully connected with its preceding layer. It analyses the features obtained from the fully connected preceding layers and predicts the output result that is formed by a weighted average function of its input. The weighted average is passed through an activation function that generates the output score of that neuron.