# A Triple Deep Image Prior Model for Image Denoising Based on Mixed Priors and Noise Learning
## 3 Methodology
### Loss Function  
In model training, the loss function constrains the direction of model optimization. To prompt internal and external mixed priors and two-branch noise learning to operate on the denoising process, we designed five MSE losses as compound loss function. The MSE computes the square value of the pixel-wise distances between input images, which can enhance the smoothness and contrast of the output image. The definition is as follows:  
\[MSE(I_{1},I_{2})=\frac{1}{M\times N}\sum_{i=0}^{M-1}\sum_{j=0}^{N-1}\left[I_{1} (i,j)-I_{2}(i,j)\right]^{2} \tag{15}\]  
where \(I_{1}(i,j)\), \(I_{2}(i,j)\) denote the input images, and \(M\), \(N\) represent the size of input images. As shown in Figure 4, the five loss functions are: \(Loss_{DIP}\), \(Loss_{External}\), \(Loss_{Internal}\), \(Loss_{Mixed}\) and \(Loss_{Stability}\). **DIP Loss:** The DIP loss which is similar to the loss function in the original DIP, evaluates the difference between the generated content \(I_{Content}\) from the DIP1 branch and the noisy image \(I_{Noisy}\). This is crucial as it enables the model to perform denoising utilizing internal image priors. The expression is as follows:  
\[Loss_{DIP}=MSE(f_{content}(z_{1}),I_{Noisy}) \tag{16}\]  
where \(f_{content}(*)\) denotes the DIP1 generator, \(z_{1}\) represents random noise. **External prior Loss:** The external prior loss measures the distance between the generated content \(I_{Content}\) and the pre-processed image \(I_{External}\). The introduction of the external prior constrains the range of generated solutions and causes DIP1 to converge to a position closer to the clear image in the image space, thus effectively preventing the model from overfitting. It can be defined as:  
\[Loss_{External}=MSE(f_{content}(z_{1}),I_{External}) \tag{17}\]  
**Internal prior Loss:** To ensure the effectiveness of noise learning and content learning, we proposed internal prior loss to control the difference between the sum of the learned  
Figure 4: The network architecture of TripleDIP. DIP1 is the standard DIP network for learning image content \(I_{Content}\). DIP2, DIP3 are variants of DIP for independently learning image noise \(I_{Noisy}\), \(I_{Noisy2}\). Note that DIP1 uses random noise \(z_{1}\) as input, while DIP2 and DIP3 use noisy images \(I_{Noisy}\) as input to reduce the difficulty of noise learning. Three DIP branches cooperate with each other to perform denoising. Moreover, the \(I_{External}\) is the pre-denoised image generated by Restormer and the loss function represents the MSE loss between the parts indicated by the arrows. noise generated by DIP2 and the image content generated by DIP1 and internal prior image, which requires observation of the constraint of Equation (12) and can be defined as:  
\[Loss_{Internal}=MSE(f_{noise1}(I_{Noisy})+f_{content}(z_{1}),I_{Noisy}) \tag{18}\]  
where \(f_{noise1}(*)\) denotes the DIP2 generator and the noisy image \(I_{Noisy}\) as its input. **Mixed prior Loss:** To make the noise learning results of DIP3 sufficiently constrain the content learning branch, we proposed the mixed prior loss. This requires the image content learned by DIP1 to be close to the external prior image, and the noise learning results of the two branches to be consistent. The mixed prior loss makes the internal and external mixed priors and two-branch noise learning constrain the optimization of the network in a coupling manner, which further enhances the model's stability and makes the model optimize in the preset direction. This requires that Equation (14) is obeyed, and is defined as:  
\[Loss_{Mixed}=MSE(f_{content}(z_{1})+f_{noise1}(I_{Noisy})-f_{noise2}(I_{ Noisy}),I_{External}) \tag{19}\]  
where \(f_{noise2}(I_{Noisy})\) represents the learned noise generated by the DIP3 and the \(I_{Noisy}\) as input. **Stability Loss:** The output of the DIP model is often inconsistent even under the same input conditions due to the random initialization of the network parameters.