# Improved CycleGAN for Mixed Noise Removal in Infrared Images
## 2 Methods
### Loss Functions  
**Adversarial loss:** In CycleGAN, the role of adversarial loss is to guide the generator to produce better images in the style of the target domain, and at the same time help to train the discriminator in distinguishing the difference between the generated image and the ground truth image. During the training process of the network, the computation of the respective adversarial loss functions for \(\mathbf{G}\) and \(\mathbf{D_{N}}\) as well as \(\mathbf{F}\) and \(\mathbf{D_{C}}\) are expressed in Equations (5) and (6), respectively:  
\[\begin{array}{ll}L_{GAN}(G,D_{N},X,Y)&=E_{y\sim Pdata(y)}[\log D_{N}(y)]\\ &+E_{x\sim Pdata(x)}[\log(1-D_{N}(G(x))]\\ \end{array} \tag{5}\]  
\[\begin{array}{ll}L_{GAN}(F,D_{C},Y,X)&=E_{x\sim Pdata(x)}[\log D_{C}(x)]\\ &+E_{y\sim Pdata(y)}[\log(1-D_{C}(F(y))]\\ \end{array} \tag{6}\]  
where \(X\) and \(Y\) denote the clean and noisy image and \(x\) and \(y\) are the respective data distributions of the input of each of the two to the network. The total adversarial loss can be expressed as follows:  
\[L_{adv}=L_{GAN}(G,D_{N},X,Y)+L_{GAN}(F,D_{C},Y,X) \tag{7}\]  
**Cycle consistency loss**: In order to make the generator able to transform the input image into the desired output image appropriately, the original CycleGAN adopts the \(\mathbf{L_{1}}\) loss as the cycle consistency loss to reduce the feasibility space of the mapping function during the transformation process, so as to ensure that the generated image can maintain the real feature information of the original input image as much as possible. The specific representation is as in Equation (8):  
\[\begin{array}{ll}L_{cyc}(G,F)&=E_{x\sim Pdata(x)}[\|(F(G(x))-x)\|]\\ &+E_{y\sim Pdata(y)}[\|(G(F(y))-y)\|]\\ \end{array} \tag{8}\]  
Although the original cycle consistency loss ensures the bidirectional consistency of unpaired images during the conversion process to a certain extent, in the denoising task, the image quality is generally low due to the existence of noise, and at this time, only considering the \(\mathbf{L_{1}}\) loss cannot ensure that the network pays full attention to the texture details and other key information. To address this problem, we chose to add the PSNR loss into the calculation of cycle consistency loss. PSNR is based on the mean square error to compare the difference between the pixel values of two images, thus providing a measure of the degree of correlation between different images. For generator \(G\): \(X\to Y\), the PSNR loss is as follows:  
\[L_{PSNR}(G,F)=1-\eta PSNR(F(G(x))-x) \tag{9}\]  
For generator \(F\): \(Y\to X\), the PSNR loss is as follows:  
\[L_{PSNR}(F,G)=1-\eta PSNR(G(F(y))-y) \tag{10}\]  
Figure 3: Illustration of the improved discriminator, where \(s\) denotes the step size of the convolution operation and \(\mathbf{h}\) and \(\mathbf{w}\) represent the height and width of the input image respectively.  
where \(\eta\) is a non-negative hyperparameter that is used to ensure the calculated value of the PSNR loss is always greater than zero. Therefore, the total PSNR loss can be expressed as follows:  
\[L_{PSNR}=L_{PSNR}(F,G)+L_{PSNR}(G,F) \tag{11}\]  
The cycle consistency loss of the improved network can be expressed as in Equation (12):  
\[L_{cycle}=\
u_{1}L_{cycle}(G,F)+\
u_{2}L_{PSNR} \tag{12}\]  
where \(v_{1}\) and \(v_{2}\) are hyperparameters that take values between 0 and 1 and are used to regulate the weight share of \(L_{cycle}\) and \(L_{PSNR}\) in \(L_{cycle}\).  
**Total objective loss function**: Combining all of the above loss calculation terms, the final target loss of the improved network can be derived as shown in Equation (13):  
\[L_{total}=L_{adv}+\mu L_{cycle} \tag{13}\]  
where \(\mu\) is a non-negative hyperparameter that moderates the relative importance between the adversarial loss and the cycle consistency loss.