# Automatic Boundary Extraction for Photovoltaic Plants Using the Deep Learning U-Net Model
## 2 Materials and Methods
### Deep Learning
#### 2.4.3 Modeling  
In the literature, the semantic segmentation task has many existing models that can be selected for the desired task. In this work, two methods based on deep learning have been selected, taking into account the following criteria: the most competent for the type of task, the amount of data to be processed, the execution time, and the ease of implementation to predict each label for each pixel. The methods were selected according to [11; 46; 47; 48; 49]. The FCN model was the first one selected, which was proposed by [33] and used by [11]. The network architecture is delineated in Figure 2. The second one is the U-Net model, first  
extracts the feature map upon which the rest of the network is based. The second block consists of a series of deconvolutional layers that simply reverses the forward and backward passes of convolution. The last layer uses a softmax function to predict the probability of the category as shown in Figure 2. As a result, the input of FCN model is an RGB image, and the output is the predicted mask of the PV plants. For more details, read [33]. The parameters for the training process were depicted in Table 1.  
(b). The U-net network model: This model has two blocks: a decreasing path and an increasing path, respectively, which gives it the u-shaped architecture or horizontal hourglass shape [51]. The decreasing path is a typical convolutional network that consists of repeated application of convolutions, each followed by a rectified linear unit (ReLU) and a max-pooling operation. During the decrease, the spatial information is reduced whereas feature information is increased. The increasing pathway combines the feature and spatial information through a sequence of upsampling layers followed by two layers of transposed convolution for each step [38; 52], as illustrated in Figure 3. The parameters for the training process were depicted in Table 1. Its architecture is shown in Table 2. The platform used for FCN and Unet models by this work was Tensorflow with Keras backend [53]. The U-net model had never been used for this kind of application so far. The FCN and U-net models additionally have a binary cross-entropy function (\(H_{p}\)) to calculate the loss in the process of training the neuronal network [54]. As the problem at hand is a semantic segmentation task, Equation (1) is used. This function examines each pixel and compares the binary-predicted values vector with the binary-encoded target vector. \[H_{p}(q)=-\frac{1}{N}\sum_{i=1}^{N}y_{i}\cdot\log(p(y_{i}))+(1-y_{i})\cdot\log (1-p(y_{i})) \tag{1}\]  
where \(y\) is the label of each pixel, it takes the value of 1 for the PV plants area and 0 to indicate other areas or elements, and \(p(y)\) is the probability of the pixel belonging to the PV plants area for all \(N\) points. The Adam optimization function is used to optimize the models [55]. Because semantic segmentation is the task at hand, it is essential to implement metrics to ensure the model performs well. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Activation** & **Activation** & **Optimizer** & **Loss Function** & **Metrics** & **Epoch** & **Batch Size** \\ (Last Layers) & **(Inner Layers)** & **Optimizer** & **Loss Function** & **Metrics** & **Epoch** & **Batch Size** \\ \hline Sigmoid & Relu & RMS & Binary\_cross & N/A & 150 & 1 \\ \hline Sigmoid & Elu & Adam & Binary\_cross & IoU,F1 score & 15 & 8 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Summary of the FCN and U-net model parameters for the training process.