# Extracting Weld Bead Shapes from Radiographic Testing Images with U-Net
## 4 Results  
### Experimental Results  
To evaluate the performance of the image segmentation model, this study used the intersection over union (IoU), mean intersection over union (mIoU), and pixel accuracy [23], which are evaluation methods from the PASCAL visual object classes (PASCAL VOC) [24]. The values of each of these parameters were obtained for each pixel. Table 2 depicts a comparison of the actual and predicted values to measure the performance of the trained model. The IoU is an evaluation index that measures how well the predicted bead shape and location in the weld image match the actual bead shape and location. Specifically,  
Figure 7: Loss function in training and testing: (**a**) 500 raw images model; (**b**) 500 images model in which CLAEH is performed; (**c**) 2500 images model in which CLAHE and data augmentation are performed. the IoU measures how well the areas with a pixel intensity of 1 match when comparing the mask image and the predicted image, as shown in Equation (1). The mIoU is the average of how well each of the bead areas and base metal areas match, as shown in Equation (2). The pixel accuracy is a number that expresses the accuracy of the prediction with respect to the entire base metal in the weld image, as shown in Equation (3). Table 3 presents the results for the training and test data. In Table 3, (a) is the result of training with 500 raw images, (b) is the result of training with 500 images in which CLAEH is performed, and (c) is the result of training with 2500 images in which CLAHE and data augmentation are performed. \[IoU=\frac{TP}{TP+FP+FN} \tag{1}\]  
\[mIoU=\left(\frac{TP}{TP+FP+FN}+\frac{TN}{TN+FP+FN}\right)/2 \tag{2}\]  
\[\text{{Pixel accuracy}}=\frac{TP+TN}{TP+TN+FP+FN} \tag{3}\]  
Figure 8 shows the predicted mask image results when only the weld images were input to the trained model without the mask images. Figure 8a shows the image that was input to the trained model, and Figure 8b shows the predicted shape and location of the bead in the input image. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Predicted Positive** & **Predicted Negative** \\ \hline Actually Positive & True positive (TP) & False negative (FN) \\ Actually Negative & False positive (FP) & True negative (TN) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Confusion matrix. Figure 8: Results of entering only weld images in 2500 images model in which CLAHE and data augmentation are performed: (**a**) input images; (**b**) predicted mask images. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & & **IoU** & **mIoU** & **Accuracy** \\ \hline \multirow{2}{*}{(a)} & Train & 83.00\% & 89.10\% & 97.48\% \\  & Test & 73.58\% & 83.47\% & 95.53\% \\ \hline \multirow{2}{*}{(b)} & Train & 83.24\% & 89.93\% & 97.58\% \\  & Test & 75.01\% & 84.88\% & 95.61\% \\ \hline \multirow{2}{*}{(c)} & Train & 83.78\% & 90.58\% & 98.01\% \\  & Test & 76.01\% & 85.44\% & 95.90\% \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Results of experiment: (**a**) the result of 500 raw images; (**b**) the result of 500 images in which CLAHE is performed; (**c**) the result of 2500 images in which CLAHE and data augmentation are performed. To extract only the weld bead from the predicted bead shape image as a post-processing operation, only the area with a pixel intensity of one was used; however, when detecting the bead, problems can occur owing to noise in the image. To resolve these problems, the algorithm shown in Algorithm 2 was used to find the largest area among the areas with a pixel intensity of one and perform a bounding box labeling operation on the weld image, as shown in Figure 9. The coordinates of the four edges of the bounding box were determined, and the image was cropped to extract only the weld bead, as shown in Figure 10.  
```
Input: Raw image, mask area coordinates: \(M=\left(x_{1}^{1},y_{1}^{1},x_{2}^{2},y_{2}^{2}\right)\) Output: bead image
1.