# GAN-Based Image Dehazing for Intelligent Weld Shape Classification and Tracing Using Deep Learning
## 2 Methods
### Dehazing Techniques for Weld Fume Removal
#### 2.2.3 Knowledge Adaption Branch Using ImageNet and Res2 Net  
In second stage, the knowledge adaptation branch uses the ImageNet [28] pre-trained Res2 Net [29] as the backbone of the encoder, making DW-GAN more robust with better generalization ability. The Res2 Net architecture with the squeeze and excitation networks (SE) is shown in Figure 4. \begin{table}
\begin{tabular}{l l l l l l} \hline \hline \multicolumn{4}{c}{**Contracting Path**} & \multicolumn{4}{c}{**Expansive Path**} \\ \hline
**Layer** & **Details** & **Output Size** & **Layer** & **Details** & **Output Size** \\ \hline Conv3\_1 & \(3\times 3\times 256\); Linear ReLU & \(138\times 138\) & Conv8\_1 & \(3\times 3\times 128\); Linear ReLU & \(198\times 198\) \\ Conv3\_2 & \(3\times 3\times 256\); Linear ReLU & \(136\times 136\) & Conv8\_2 & \(3\times 3\times 128\); Linear ReLU & \(196\times 196\) \\  & \(2\times 2\) Max Pool & & DWT & \(2\times 2\times 128\) up sample of & \\ Pool 3 & Stride 2 & & UpSampling\_4 & Conv1\_2; & \(392\times 392\) \\  & & & & &
\begin{tabular}{l} Concat with Conv2\_2 \\ \end{tabular} & \\ Conv4\_1 & \(3\times 3\times 512\); Linear ReLU & \(66\times 66\) & Conv9\_1 & \(3\times 3\times 64\); Linear ReLU & \(390\times 390\) \\ Conv4\_2 & \(3\times 3\times 512\); Linear ReLU & \(64\times 64\) & Conv9\_2 & \(3\times 3\times 64\); Linear ReLU & \(388\times 388\) \\ Pool 4 & \(2\times 2\) Max Pool & \(32\times 32\) & Conv10 & \(1\times 1\times 2\); Linear ReLU & \(388\times 388\) \\  & & & & \\ Conv5\_1 & \(3\times 3\times 1024\); Linear ReLU & \(30\times 30\) & & \\ Conv5\_2 & \(3\times 3\times 1024\); Linear ReLU & \(28\times 28\) & & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: _Cont._  
Figure 4: Res2 Net architecture used in knowledge adaption branch [28]. In Res2 Net architecture, after \(1\times 1\) convolution features of Image I, \(X_{i}\) is evenly split into \(s\) subsets with \(i\in\ \{1,2,\ldots,s\}\). To reduce the number of parameters, \(3\times 3\) group filters are omitted for \(X_{1}\) and smaller filters are used for \(X_{i-1}\). The output \(Y_{i}\) can be written as:  
\[Y_{i}=\left\{ \begin{array}{cc}X_{i},&i=1\\ K_{i}(X_{i}),&i=2\\ K_{i}(X_{i}+Y_{i-1},&2<i\leq s\end{array} \right. \tag{2}\]  
Furthermore, we concatenate all the subset features into single ones by using \(1\times 1\) convolution, and at the end the SE network is added to adaptively recalibrate the channel-wise responses \(y\). The detailed knowledge adaption architecture used is described in Table 3.  
In addition to Res2 Net, attention modules are added to detect dynamic hazy patterns, whereas pixel shuffle layers are added before the attention module to upscale the image, thereby reducing the computational cost. Finally, a simple \(7\times 7\) convolution layer with tanh activation layer is added for fusing the combined features from the above two stages to produce weld-fume-free images. Discriminator  
The discriminator uses real data as positive examples and dehazed images as negative examples, and image-to-image translation takes place during training. The discriminator tries to identify between dehazed images and ground truth. It then penalises if it misclassifies. The detailed architecture for the discriminator is described in Table 4. \begin{table}
\begin{tabular}{l l l} \hline \hline
**Layer** & **Details** & **Output Size** \\ \hline Conv\_1 & \(3\times 3\times 3\); padding = 1 & 64 \(\times\) 64 \\ Conv\_2 & \(3\times 3\times 64\); padding = 1 & 64 \(\times\) 64 \\ Conv\_3 & \(3\times 3\times 64\); padding = 1 & 128 \(\times\) 128 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Layers of discriminator architecture.