# GAN-Based Image Dehazing for Intelligent Weld Shape Classification and Tracing Using Deep Learning
## 4 Results and Discussion
### Training Phase of Weld Seam Detection using YOLO Algorithms  
The weld datasets of the different shapes, as shown in Figure 12, were trained using different versions of the YOLO algorithm with GA-evolved parameters. The total dataset comprised 2286 samples, of which YOLO was trained with 1866 training weld images using pretrained weights of CSPDarknet53 to avoid training from scratch and save training time. The input size was 640 \(\times\) 480 which was resized to 416 \(\times\) 416, as well as augmented to increase the dataset. The model was trained on Tesla P-100 with the 11.2 CUDA version. The main purpose of the YOLO training was to minimize the loss function. The optimization equation for YOLO is as follows:  
\[ \begin{split} J=\min\ \backslash_{coord}\sum_{i=0}^{z^{2}}\sum_{j =0}^{B}1_{ij}^{obj}\Big{[}\big{(}x_{i}-\hat{x_{i}}\big{)}^{2}+\big{(}y_{i}- \hat{y_{i}}\big{)}^{2}\ \Big{]}\\ +\backslash_{coord}\sum_{i=0}^{z}\sum_{j=0}^{B}1_{ij}^{obj} \Big{[}\Big{(}\sqrt{w_{i}}-\sqrt{\hat{w_{i}}}\big{)}^{2}+\Big{(}\sqrt{h_{i}} -\sqrt{\hat{h_{i}}}\Big{)}^{2}\Big{]}\\ +\sum_{i=0}^{z^{2}}\sum_{j=0}^{B}1_{ij}^{obj}\Big{[}\big{(}c_{i}- \hat{c_{i}}\big{)}^{2}\Big{]}+\backslash_{mobj}\sum_{i=0}^{z^{2}}\sum_{j=0}^{ B}1_{ij}^{obj}\Big{[}\big{(}c_{i}-\hat{c_{i}}\big{)}^{2}\Big{]}\\ +\sum_{i=0}^{z^{2}}\ 1_{ij}^{obj}\sum\limits_{c\in classes}\big{(}p_{i }(c)-\hat{p_{i}}(c)\big{)}^{2}\end{split}  \tag{23}\]  
where \((x_{i},y_{i})\) represents the centroid of the bounding box; \((w_{i},h_{i})\) denotes the width and height of the bounding box; \(c_{i}\) represents the confidence score; \(\backslash_{coord}\) and \(\backslash_{nobj}\) are constants which describe the important term to account for; \(p_{i}(c)\) is the classification loss; \(1_{ij}^{obj}\) is 1 if the object appears in the cell, or else 0; and \(1_{ij}^{nobj}\) is 0 if the object appears in the cell, or else 1. Next, the GA was used to optimise the training parameters where the number of generations was chosen as 100. The highest fitness was selected for mutation based on a normal distribution of 20%. The confident score was calculated based on the weighted intersection of union (IoU) and the probability of objects present within the grids. The overall batch size was chosen as 16, which was made to run for 200 epochs with an SGD optimiser. The learning rate was kept constant with the value of 0.01. Hence, the genetic algorithm ran for 100 generations, producing efficient optimal values. The hardware and deep learning parameters are listed in Table 5. The initial and optimised training parameters of YOLO were manually adjusted, and are listed in Table 6. \begin{table}
\begin{tabular}{l l l} \hline \hline
**S. No** & **Environment** & **Values/Version** \\ \hline
1 & Operating System & Windows 11 \\
2 & CPU & Intel(R) Core(TM) i7-9750H \\  & CPU @ 2.60 GHz 2.59 GHz \\
3 & GPU & Tesla P100-PCIE-16 GB \\
4 & RAM/ROM & 2666 MHz DDR4 16 GB \\
5 & CUDA & 11.2 \\
6 & cuDNN & 7.6.5 \\
7 & IDE & Colab Pro Plus \\
8 & Framework & pytorch \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Hardware configuration and deep learning environment. The performance metrics for Scaled YOLOv4, YOLOv5, Faster RCNN, EfficientDet and YOLOv4 DarkNet are listed in Table 7, which was obtained after training the network with optimized training parameters. The performance of the single-stage detector was compared with the two-stage detector Faster RCNN with the Inception v2 model. It can be inferred from the above table that the _Precision_ and _Recall_ values of YOLOv5 were better than Scaled YOLOv4, YOLOv4 DarkNet and Faster RCNN, with the values of 96.7% and 96%, respectively. However, the performance of YOLOv5 and EfficientDet was similar, and the model was fast and accurate. Additionally, the total loss of YOLOv5 was