# An Enhanced pix2 pix Dehazing Network with Guided Filter Layer
## 3 Proposed Method
### Pix2 pix Dehazing Network with Guided Filter Layer
#### 3.1.1 Transfer and Guide Module  
In the input hazy image, due to the presence of haze, the recovery of contour information was affected during the entire process of image restoration, often causing a halo-like phenomenon. Therefore, we designed a transfer module to obtain the background of the hazy image, then used the background, as shown in Figure 3, to guide the training of the guide filter layer. We obtained the reference image (called the residual image) by subtracting the minimum channel value from the maximum channel value of each point in the RGB (Red Green Blue) image.  
Inspired by [24], we created a separable CNN layer as shown in Figure 4 that could be distinguished during training. Also, we obtained a hazy image with high resolution (\(I_{H}\)) and downsampled it to obtain a hazy image of low resolution (\(I_{L}\)). Next, we produced a guided image (\(I_{R}\)) with our transferring operator. Finally, we fed the three images into the guided filtering layer to obtain the high-frequency component.  
The principle of the guided filtering layer is as follows:  
\[I_{R}^{i}=a_{L}^{k}I_{L}^{i}+b_{L}^{k},i\in w_{k} \tag{2}\]  
\[O_{L}=a_{H}*I_{H}+b_{H} \tag{3}\]  
where \(i\) is the pixel position. Suppose that in the filtering window \(w_{k}\) with a radius of \(r\) (\(k\) is the label of the window), there is a linear relationship shown in Equation (2). \(a_{H}\) and \(b_{H}\) are obtained by upsampling \(a_{L}\) and \(b_{L}\). These parameters are obtained by training the guided filtering layer [24]. Specifically, first send \(I_{L}\) into the convolutional layer, then send its output and \(I_{R}\) into the mean filter  
Figure 2: The architecture of the entire network.  
and local linear model (Equation (2)), and get the \(a_{L}\) and \(b_{L}\) by minimizing the loss of input and output. Therefore, two parameters need to be set before training, i.e., the radius r of the mean filter window (smoothing kernel) and the regularization coefficient \(\varepsilon\). Finally, the low-frequency component \(O_{L}\) is output by Equation (3). Specifically, we first smoothed the image. Starting with input (\(I_{H}\),\(I_{L}\),\(I_{R}\)), the smoothed image was the low-frequency component \(O_{L}\), and we obtained the high-frequency component \(O_{H}\) by means of the following subtraction: \(O_{H}=I_{H}-O_{L}\).  
Figure 4: Intermediate results of the decomposition process.  
Figure 3: Intermediate results of the decomposition process.  
The most important thing in this module is that we used the residual image [25] as the guide image to guide the filter in our low-pass smoothing process. Such guided filtering resulted in a small amount of high-frequency information in the low-frequency components. Therefore, only the contour information of the background was included in the high frequency information, which greatly facilitated our subsequent restoration of the contour details.  
In order to obtain more details of the contour, as shown in Figure 2, we took some columns of smoothing kernels. In particular, by guiding the filter layer, we connected all the high-frequency components and mapped them to higher dimensions through a feature-mapping channel, providing feature information for subsequent image reconstruction.  
The high-frequency components were obtained by setting different smoothing kernels and regularization coefficients, as shown in Figure 5. The main influence on the results was the smoothing kernel. The larger the kernel, the more textures and details it captured, while the regularization coefficient was mainly used to prevent parameters from getting too large. Different smoothing kernels could help us capture more details and may solve the problem regarding the haze concentration, which often changes significantly in different regions of the hazy image.