# GAN-Based Image Dehazing for Intelligent Weld Shape Classification and Tracing Using Deep Learning
## 5 Conclusions  
To perform real-time intelligent robotic welding, weld seam detection using different algorithms such as Scaled YOLOv4, YOLOv5 and YOLOv4 DarkNet was proposed in this study. The problem of weld fumes was addressed in this work by performing image-to-image translation using DW-GAN. To extract the weld seam shape, binary thresholding-based contour detection was implemented; finally, to remove the difficulties of camera calibration and complex mathematical transformation, a neural network model was created to map the contour pixels into the robot coordinates and the robot was able to trace the weld seam accurately and precisely with less than a 1 mm tracking error. The main conclusions drawn from this experimental study are as follows:  
1. Real-time weld datasets were collected, and were made of actual weld plates of mild steel. The total dataset for training the model comprised 2286 images with an image size of 416 \(\times\) 416;
2. The weld fumes generally affected the detection performance; hence, DW-GAN was implemented to remove the weld fumes. The performance was compared with the conventional DCP method, and it was found that DW-GAN performed better for removing the fumes with PSNR 15.95 dB and SSIM 0.407. The inference time of DW-GAN was faster by 9.6 ms compared to DCP;
3. With the help of the YOLOv5 algorithm, the accurate and fast detection of weld seam shapes was realized with an overall inference speed of 0.0096 s, which was faster than Scaled YOLOv4 and YOLOv4 DarkNet. Additionally, the detection accuracy of YOLOv5 was 95%, with 96.7% precision, 96% recall, and 98.7% F1 score. The total loss of YOLOv5 was 0.043, whereas this was high for YOLOv4 DarkNet with the value of 0.959;
4. The YOLO algorithms were compared with Faster RCNN and EfficientDet and it was inferred that EfficientDet's performance was similar to YOLOv5, and they outperformed other deep learning algorithms. The performance of the deep learning models was tested with different image sizes to validate the generalization ability, and weld plate detection was experimentally verified using live 2D camera images. The total processing time taken for YOLOv5 was just 6.426 s, which was less than that of the other deep learning methods;
5. An ablation study was performed to show the contribution of modules used in this work. The performance was analyzed in terms of validation accuracy and total time for the entire process. It was found that GAN played a major contribution in weld fume removal because accuracy was improved after dehazing;
6. The optimal combination of training parameters for NN was analyzed in terms of MSE, regression value, and RMSE, and it was found that the 50-25-25 training-validation-testing ratio with _trainscg_ was optimal for the efficient mapping of pixels into robot coordinates. The NN model made the coordinate transformation between the camera and the robot simpler, and this technique could be used in any machine vision application effectively and efficiently;
7. The contours present in the weld images were detected successfully and were sent to the robot using the trained NN model for simulated robotic welding via MATLAB. It was inferred that the accurate robot coordinates were obtained from the NN, which was helpful for accurate real-time weld shape tracing. The average tracking error was found to be less than 0.3 mm for all of the shapes. Potential future works include the detection of weld seams with different brightness conditions, e.g., addressing arc lights and flash conditions. Additionally, segmentation-based detection could be implemented. Deep learning models could be further modified with different convolution layers, and their performance with weld datasets should be analyzed. **Author Contributions:** Writing--original draft, A.S.; data curation, A.S. and A.D.; conceptualization, R.K.; formal analysis, V.K. and R.K.; methodology, A.S. and V.K. ; software, A.S. and A.D.; supervision, V.K. and R.K.; validation, A.S. and A.D.; visualization, R.K.; writing--review and editing, V.K.