# GAN-Based Image Dehazing for Intelligent Weld Shape Classification and Tracing Using Deep Learning
## 4 Results and Discussion
### Coordinate Transformation Using the Artificial Neural Network  
In every machine vision application, camera calibration is necessary to establish the relationship between three-dimensional world coordinates \((X,~{}Y,~{}Z)\) and two-dimensional camera coordinates \((u,v)\), as well as determine the internal and external parameters of the camera [46]. In real-world scenarios, many factors can affect the process of robot vision caused by radial and tangential distortion, the position of the camera, the robot environment, and other dynamic objects, which in turn affects the experimental procedure. In general, camera calibration involves mathematical model formulation between the camera and the world, from which camera to base transformations or camera to robot end effector transformations are found out [47]. This involves the need to know the kinematics of the robot, which becomes tedious when the number of DOF increases, thereby increasing the complexity of the camera calibration. Additionally, when the camera setup is disturbed, the overall process has to be repeated, which becomes cumbersome. To eliminate such difficulties, the pixel coordinates of the calibration sheet \(T_{c}^{w}\) are mapped directly to robot coordinates \(T_{b}^{w}\) using neural networks; this does not need camera geometry information or complex mathematical equations, as shown in Figure 16. Using this approach, the coordinates of any object placed in robot workspace can be determined easily and efficiently. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**S. No** & **Modules** & **Total Time (s)** & **Validation Accuracy (\%)** \\ \hline
1 & Pre-processing + Scaled YOLOv4 + Contour detection & 4.387 & 81 \\
2 & Pre-processing + Scaled YOLOv4 + GAN dehazing + Contour detection & 10.717 & 85 \\
3 & Pre-processing + YOLOv5 + Contour detection & **0.0967** & 82 \\
4 & Pre-processing + YOLOv5 + GAN dehazing + Contour detection & **6.426** & 89 \\
5 & Pre-processing + YOLOv4 DarkNet + Contour detection & 20.828 & 70 \\
6 & Pre-processing + YOLOv4 DarkNet + GAN dehazing + Contour detection & 27.158 & 76 \\
7 & Pre-processing + Faster RCNN + Contour detection & 38.296 & 53 \\
8 & Pre-processing + Faster RCNN + GAN dehazing + Contour detection & 44.626 & 61 \\
9 & Pre-processing + EfficientDet + Contour detection & **0.855** & 89 \\
10 & Pre-processing + EfficientDet + GAN dehazing + Contour detection & **7.185** & 93 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Ablation study of weld shape detection. In this work, the artificial neural network (ANN) model was developed to find the transformation between the camera and the world. The pixel coordinates (\(x_{p}\), \(y_{p}\)) were taken as input and robot coordinates (\(x_{i}\), \(y_{i}\)) as output, with one hidden layer having 100 neurons. Initially, pixel input to the neural network model is given by  
\[X_{i}(t)=\left\{x_{pi},\:y_{pi}\right\}\:\text{where}=1,2,\ldots\ldots,N(\text {\emph{size of input}}) \tag{24}\]  
The output of each neuron is given by  
\[Y_{i}(t)=f(W_{i}\:(t)X_{i}(t)+b) \tag{25}\]  
where  
\[W_{i}\:(t)=\sum_{j=1}^{N}W_{ij}(t) \tag{26}\]  
Here, activation function is chosen as _purelin_, and it is given by \(f(x)=x\). Based on the initial weights, pixel inputs are updated at every time instant \(t\). \[X_{pi}(t+1)=X_{pi}(t)+\sum_{j=1}^{N}W_{ij}(t) \tag{27}\]  
Once the inputs are updated, the weights are updated in next stage, which is given by  
\[W_{i}\:(t+1)=\:W_{i}\:(t)+\Delta W \tag{28}\]  
Finally, the robot coordinates for the corresponding predicted robot coordinates are obtained, which is given by  
\[Y_{r}(t)=\left\{x_{r},y_{r}\right\} \tag{29}\]  
The size of the input (contour pixel coordinates) is 41 \(\times\) 2 and the output size (robot coordinates) is 2 \(\times\) 1. The Z value of the robot was fixed at the height of 230 mm for the safe operation of the robot and testing was performed in a planar environment.