# A New Method for Detecting Weld Stability Based on Color Digital Holography
## 2 Methods
### Denoising Algorithms Based on Deep Learning  
Deep learning is a machine learning method, whose core is convolutional neural networks. It can automatically extract image features and is widely used in fields such as computer vision, image recognition, speech recognition, and medical image analysis. The research uses the Cycle Generative Adversarial Network (CycleGAN) [29] and 4-f optical simulation integrated cycle-consistent generative adversarial network (4f-CycleGAN) algorithms [30] of deep learning techniques to reduce speckle noise in wrapped phases. Compared to the original Generative Adversarial Network (GAN), CycleGAN is an unsupervised deep learning denoising method that does not require data pairing. Its network structure is a dual loop, which uses two generators (G, F) and two discriminators (D\({}_{\text{x}}\), D\({}_{\text{y}}\)) to form a loop-generated network structure. Unlike CycleGAN, 4f-CycleGAN replaces the generator F in deep neural networks with a physically driven speckle simulation system (4F).  
The 4f-CycleGAN algorithm fundamentally simulates the generation mechanism of speckle noise in digital holographic interferometry (DHI), thereby providing targeted guidance for the training process of the 4f-CycleGAN network. This method effectively suppresses artifacts and unexpected elements, significantly enhancing denoising performance. Figure 3 illustrates the network architecture of 4f-CycleGAN, which comprises two generators (G and 4F) and two discriminators (D\({}_{\text{x}}\) and D\({}_{\text{y}}\)). During the algorithm's execution, firstly, the original domain image X is transformed into an approximate representation of the target domain image Y by the generator G. Subsequently, the generator 4F is utilized to transform the target domain image Y back to the original domain, resulting in a reconstructed version \(\hat{\text{X}}\) that closely resembles the original image X. This step aims to compute the loss function, which is based on the difference between the real input image X and the reconstructed image \(\hat{\text{X}}\). During the \(\text{X}\rightarrow\text{Y}\rightarrow\hat{\text{X}}\) transformation process, the discriminator D\({}_{\text{y}}\) engages in adversarial training with the generator G to ensure that the generated image \(Y\) looks sufficiently realistic in the target domain. However, considering the reverse process from the target domain image Y back to the original domain image \(\hat{\text{X}}\),  
Figure 2: The tested samples: (**a**) lap-jointed plate (**b**) butt-jointed plate; (**c**) defective butt-jointed plate.  
another discriminator \(\rm D_{x}\) is introduced to engage in adversarial training with the generator 4F, which ensures that the reconstructed image \(\rm\hat{X}\) maintains consistency in the original domain. During the training process, the loss functions \(\rm L_{cyc}\) and \(\rm L_{GAN}\) are used to constrain the consistency between the input and output images. \(\rm L_{cyc}\) ensures the preservation of content integrity during image transformation, while \(\rm L_{GAN}\) ensures that the generated images are visually more realistic and believable. The 4f-CycleGAN algorithm demonstrates outstanding performance in denoising and image transformation tasks.  
The pre-trained weights were obtained on the RTX 3090 TI GPU (NVIDIA, Santa Clara, CA, USA) [29]. The training set consists of 10,000 simulated phase differences containing speckle noise and 10,000 simulated clean phase differences without speckle noise. The training objective of deep learning is to map the network between the noisy image domain \(\rm X\) and the noise-free image domain \(\rm Y\). The entire training process lasted for 70 rounds. In the paper, pre-trained weights with certified performance were used for denoising the phase differences.