# Removal of Color-Document Image Show-Through Based on Self-Supervised Learning
## 3 Proposed Methods
### Loss Functions
 \tag{5}\]  
Simultaneously, the cycle consistency loss from domain \(Y\) to domain \(X\) is defined as follows:  
\[ \begin{array}{l}\mathcal{L}_{cycle\_re}(Re,S,De)\\ =\mathbb{E}_{Y\sim P_{non-show-through}(Y)}\left[\left|\left|De(Re(Y))-Y\right| \right|_{1}\right]\\ +\mathbb{E}_{Y\sim P_{non-show-through}(Y)}\left[\left|\left|De(S(Re(X)))-Y \right|\right|_{1}\right]\end{array}  \tag{6}\]  
The overall definition of the cycle consistency loss is the sum of the losses from both directions and is shown in Equation (7), as follows:  
\[\mathcal{L}_{cycle}(Re,S,De)=\mathcal{L}_{cycle\_de}(De,S,Re)+\mathcal{L}_{ cycle\_re}(Re,S,De) \tag{7}\]  
1. Identity loss \(\mathcal{L}_{id}\)  
The identity loss function for show-through images plays a pivotal role in CycleGAN, as it ensures color consistency between the input and output bleeding images. This prevents the generator from arbitrarily altering the color tone of the images and ensures that the generated results align with our expectations. The identity loss is defined as shown in Equation (8):  
\[ \begin{array}{l}\mathcal{L}_{id}(Re,De)\\ =\mathbb{E}_{X\sim P_{show-through}(X)}\left[\left|\left|Re(X)-X\right|\right| _{1}\right]\\ +\mathbb{E}_{Y\sim P_{non-show-through}(Y)}\left[\left|\left|De(Y)-Y\right| \right|_{1}\right]\end{array}  \tag{8}\]  
1. Pseudo-similarity loss \(\mathcal{L}_{ps}\)  
Due to the lack of label supervision during the training process of CycleGAN, we introduced a similarity network to generate pseudo-labels and calculate the similarity loss between the generated images. This helps the generator produce more realistic non-show-through and show-through images, thereby improving the quality and realism of the generated results. Because the similarity loss is minimized, the generated images become more similar to the real images, leading to better transformation outcomes. The pseudo-similarity loss is defined as shown in Equation (9):  
\[ \begin{array}{l}\mathcal{L}_{ps}(De,S,Re)\\ =\mathbb{E}_{X\sim p_{\textit{sharp}}-\textit{through}(X)}[||S(De(X))-De(X)||_{1} ]\\ +\mathbb{E}_{Y\sim p_{\textit{span}-\textit{show}-\textit{through}(Y)}}[||S(Re(Y) )-Re(Y)||_{1}]\end{array}  \tag{9}\]  
Perceptual loss \(\mathcal{L}_{perceptual}\)  
To generate images that are more semantically and visually similar, we introduced a pre-trained VGG19 [25] perceptual loss to constrain the generator. The perceptual loss preserves the structure of the original images by combining features extracted from the second and fifth pooling layers of VGG19. Under the constraints of the generators _De_: \(X\to Y\) and _Re_: \(Y\to X\), the expression of the perceptual loss is shown in Equation (10), as follows:  
\[\mathcal{L}_{perceptual}=\|\delta(X)-\delta(Re(De(X)))\|_{2}^{2}+\|\delta(Y)- \delta(Re(De(Y)))\|_{2}^{2} \tag{10}\]  
Here, \((X,Y)\) represents the non-paired image sets of show-through and non-show-through images, respectively, and \(\delta\) is the feature extractor of VGG19. Total loss \(\mathcal{L}_{total}\)  
Combining the above loss terms, the final total loss function can be represented as follows, in Equation (11):  
\[\mathcal{L}_{total}=\lambda_{1}\mathcal{L}_{re\_adv}+\lambda_{2}\mathcal{L}_{ de\_adv}+\lambda_{3}\mathcal{L}_{cycle}+\lambda_{4}\mathcal{L}_{id}+\lambda_{5} \mathcal{L}_{ps}+\lambda_{6}\mathcal{L}_{perceptual} \tag{11}\]  
Here, \(\lambda_{1}=\lambda_{2}=1\), \(\lambda_{3}=10\), \(\lambda_{4}=5\), \(\lambda_{5}=0.5\), and \(\lambda_{6}=0.7\)[24] are the weights corresponding to each loss term. To optimize the networks in this paper, the objective is shown as follows, in Equation (12):  
\[De^{*},Re^{*}=\arg\min_{De,Re,SD_{\textit{sharp}-\textit{through}},D_{ \textit{fan}-\textit{show}-\textit{through}}}\mathcal{L}_{\text{total}} \tag{12}\]