# Detecting Image Forgery over Social Media Using U-NET with Grasshopper Optimization
## 2 Materials and Methods
### Models and Architecture  
Various techniques have been proposed for semantic segmentation based on convolutional layers. One of the most popular architectures for this task is the U-Net, which was introduced by [PERSON] et al. (2015). The U-Net architecture consists of an encoder and a symmetrical decoder. The encoder path contains two convolutional layers in each downward step, followed by a 3 \(\times\) 3 convolution operation. A pooling operation with a 2 \(\times\) 2 size and stride size is also implemented to reduce the size of the feature maps. This process is repeated four times to collect the spatial characteristics of the image. After the UpSample operation, the feature maps are placed in the decoder for feature mapping using 2 \(\times\) 2 transpose convolution. The number of channels is reduced by half, and two convolution layers with the dimensions of 3 \(\times\) 3 are placed after the UpSample operation. The  
Figure 1: Structure of the proposed method.  
feature map of the last decoder block is subjected to the \(1\times 1\) convolution operation, which produces a segmentation map of the same size as the input image. The U-Net architecture uses the ReLU activation function in its convolution layer; however, the last convolution layer uses the sigmoid function. Figure 2 shows the architecture of the proposed method.  
The proposed model is based on the conventional U-Net architecture with several improvements. Firstly, convolution layers are added to each block of the encoder structure, and the same number of convolution layers are also added to each decoder block. Both the contraction and expansion paths have a more extensive set of weights than U-Net. Secondly, the weights in the encoder and decoder that connect the module have been increased from 2 to 3. Thirdly, the improved model uses batch normalization before any nonlinear function, whereas conventional U-Net does not use batch normalization in its network. Finally, the U-Net network's parameters are optimized using the grasshopper optimization algorithm.  
Adding more convolutional layers to each block of the encoder and decoder as well, increasing the set of weights in the encoder and decoder, and using batch normalization before nonlinear functions can improve the performance of the model. The grasshopper optimization algorithm is used to optimize the U-Net network parameters, which can further improve the performance of the model.  
In this research, we increased the number of convolutional layers in each encoder and decoder block to handle the input image dimensions of 512 \(\times\) 512. We used a modified U-Net structure, which adds a convolutional layer to each block of the encoder and decoder pipelines. The proposed model consists of four composite blocks forming the downsampling path, with the fourth block forming the upsampling path. In each encoder and decoder block, we applied two-dimensional (2D) convolutions with a kernel size of 3 \(\times\) 3, followed by batch normalization and the ReLU activation function, repeated three times. The last block uses a 2D convolution with a kernel size of 1 \(\times\) 1. To reduce the spatial dimensions of the feature maps after each block, a max-pooling operation was performed during the downsampling path. In the upsampling path, we used ConvTranspose2d to double the spatial dimensions of the feature maps. In the downsampling path, the number of feature channels increased from 1 to 64, 256, and 512, and then reduced from 512 channels to 1 in the upsampling path. Figure 3 illustrates the flow of the input images in the encoder pipeline, indicating which operation and how many convolutional layers are used in each block.  
Figure 2: U-NET network architecture inspired by [PERSON] et al. [5].