# Automatic Segmentation of Gas Metal Arc Welding for Cleaner Productions
## 4 Results and Discussion
### Assessment of Segmentation Methods
#### 4.2.2 Quantitative Comparison  
The similarities between human segmentation and the results of traditional segmentation (Contours method) and segmentation based on neural networks (Rembg) were quantified. The quantification consisted of using the Structural Similarity Index Measure (SSIM), which helps to observe the similarity between two images [39]. The SSIM measure is computed as follows:  
\[SSIM(x,y)=\frac{\left(2\mu_{x}\mu_{y}+C_{1}\right)\left(2\sigma_{xy}+C_{2} \right)}{\left(\mu_{x}^{2}+\mu_{y}^{2}+C_{1}\right)\left(\sigma_{x}^{2}+\sigma _{y}^{2}+C_{1}\right)} \tag{1}\]  
where \(x,y\) represent the images to be compared, \(\mu_{x}\) and \(\mu_{y}\) are the pixel intensity averages of the images \(x\) and \(y\), respectively; \(\sigma_{xy}\) is the covariance between \(x\) and \(y\) (which measures how much the pixel intensities in the images vary together), \(\sigma_{x}^{2}\) and \(\sigma_{y}^{2}\) are the variances of \(x\) and \(y\), respectively (which measures how much the pixel intensities in the images vary together), and \(C_{1}\) and \(C_{2}\) are stabilization constants to avoid divisions by zero when variances or means are close to zero. Thus, the similarity is calculated in the following way:  
\[Similarity=SSIM\times 100 \tag{2}\]  
Table 6 shows the similarity between the segmentation methods and the segmentation made by the human expert.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Category** & **Binary + Contours** & **Rembg** \\ \hline Good & 24.86\% & 85.89\% \\ Human & 26.03\% & 85.77\% \\ Robot & 25.23\% & 85.59\% \\ Scrap & 24.08\% & 87.71\% \\ \hline \hline \end{tabular}
\end{table}
Table 6: Similarity (in percentage) between human segmentation (ground truth) and the compared segmentation methods (Contour Method and Rembg Method).  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Segmentation Method** & **Thresholding** & **ROI** \\ \hline Triangular segmentation & & \\ Rembg & & \\ \hline \hline \end{tabular}
\end{table}
Table 5: _Cont._It can be seen that the similarity between binary segmentation based on the Contours method and segmentation based on neural networks such as Rembg are pretty far from each other compared to human segmentation. The similarity obtained by applying a traditional segmentation does not exceed 30%, which indicates that these methods are far from fulfilling the function of manual segmentation. On the other hand, segmentation based on neural networks has a similarity that is above 80%. This indicates that the selected method recognizes the ROI area of interest and is competitive with human segmentation.  
The image segmentation results show Rembg has a high level of accuracy in identifying regions of interest. However, further optimization is required to improve the detection of specific defects. Compared to traditional visual inspection, the automated segmentation methodology significantly enhanced efficiency and consistency in results. These findings suggest that automating weld bead inspection through image segmentation techniques can revolutionize the quality assurance process in the industry, reducing both time and operation costs.  
Despite these promising results, challenges remain regarding the precision and robustness of the methods under varying lighting conditions and image quality. Addressing these limitations will be a key focus of future research.