# Automatic Boundary Extraction for Photovoltaic Plants Using the Deep Learning U-Net Model
## 2 Materials and Methods
### Deep Learning
#### 2.4.4 Metrics  
The metrics evaluate the similarities between the predicted mask (N) and the original mask (S). Such similarity assessment can be performed by considering spatial overlapping information, that is, by computing the true positives (TP), false positives (FP) and false negatives (FN) given by \(TP=\left|N\cap S\right|\), \(FP=\left|N\setminus S\right|\), and \(FN=\left|S\setminus N\right|\), respectively.  
There are three standard metrics commonly employed to evaluate the effectiveness of the proposed semantic segmentation technique [29, 48, 49, 56]. The three metrics, namely, pixel accuracy (Acc), region Intersection over Union (_IoU_), and Dice Coefficient (_DC_).  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer (Type)** & **Output Shape** & **Parameters** \\ \hline MaxPooling2D & \((None,60,80,32)\) & 0 \\ \hline Conv2D & \((None,60,80,64)\) & 18,496 \\ \hline Dropout & \((None,60,80,64)\) & 0 \\ \hline Conv2D & \((None,60,80,64)\) & 36,928 \\ \hline MaxPooling2D & \((None,30,40,64)\) & 0 \\ \hline Conv2D & \((None,30,40,128)\) & 73,856 \\ \hline Dropout & \((None,30,40,128)\) & 0 \\ \hline Conv2D & \((None,30,40,128)\) & 147,584 \\ \hline MaxPooling2D & \((None,15,20,128)\) & 0 \\ \hline Conv2D & \((None,15,20,256)\) & 295,168 \\ \hline Dropout & \((None,15,20,256)\) & 0 \\ \hline Conv2D & \((None,15,20,256)\) & 590,080 \\ \hline Conv2D\_Transpose & \((None,30,40,128)\) & 131,200 \\ \hline Concatenate & \((None,30,40,128)\) & 73,856 \\ \hline Conv2D & \((None,30,40,128)\) & 295,040 \\ \hline Dropout & \((None,30,40,128)\) & 0 \\ \hline Conv2D & \((None,30,40,128)\) & 147,584 \\ \hline Conv2D\_Transpose & \((None,60,80,64)\) & 32,832 \\ \hline Concatenate & \((None,60,80,128)\) & 0 \\ \hline Conv2D & \((None,60,80,64)\) & 73,792 \\ \hline Dropout & \((None,60,80,64)\) & 0 \\ \hline Conv2D & \((None,60,80,64)\) & 36,928 \\ \hline Conv2D\_Transpose & \((None,120,160,32)\) & 8224 \\ \hline Concatenate & \((None,120,160,64)\) & 0 \\ \hline Conv2D & \((None,120,160,32)\) & 18,464 \\ \hline Dropout & \((None,120,160,32)\) & 0 \\ \hline Conv2D & \((None,120,160,32)\) & 9248 \\ \hline Conv2D\_Transpose & \((None,240,320,16)\) & 2064 \\ \hline Concatenate & \((None,240,320,32)\) & 0 \\ \hline Conv2D & \((None,240,320,16)\) & 4624 \\ \hline Dropout & \((None,240,320,16)\) & 0 \\ \hline Conv2D & \((None,240,320,16)\) & 2320 \\ \hline Conv2D & \((None,240,320,1)\) & 17 \\ \hline \hline \end{tabular}
\end{table}
Table 2: _Cont._Pixel accuracy is the ratio of correctly classified PV plants pixels to the total number of PV plants pixels in the original mask image [57], which can be mathematically represented as Equation (2).  
\[Accuracy=\frac{TP}{TP+FN} \tag{2}\]  
The \(IoU\) metric (the Jaccard index) is defined by Equation (3). This equation is a ratio between the intersection of the predicted mask \(N\), and the original mask \(S\) and the union of both. More details can be found in [58].  
\[IoU(N,S)=\frac{|N\cap S|}{|N\cup S|}=\frac{TP}{TP+FP+FN} \tag{3}\]  
The \(DC\) metric [56; 58; 59] is expressed as Equation (4). This equation divides the intersection of the predicted mask \(N\), and the original mask \(S\) times two by the sum of \(N\) and \(S\).  
\[DC(N,S)=\frac{2|N\cap S|}{|N|+|S|}=\frac{2.TP}{2.TP+FP+FN} \tag{4}\]  
To validate the results of the techniques described above, the FCN and U-net models were trained and their performance was evaluated by validating and testing samples of the Amir dataset [43]. The next section describes such results and compares the models in detail.