# An Improved GAN-Based Image Restoration Method for Imaging Logging Images
## 2 Preparatory Knowledge
### Image Evaluation Indicators  
Often we need to evaluate the results of image restoration as a way of verifying the effectiveness of the model. There are generally two types of evaluation, subjective and objective. The subjective evaluation is based on human vision, i.e., the observer scores the image according to their perception of the image, but this method relies heavily on the observer's subjective emotions, knowledge, and understanding of the image being evaluated, and is therefore not universal [13], so an objective evaluation of the restored image is meaningful and necessary. Objective evaluations such as peak signal-to-noise ratio (PSNR) [14] and mean structural similarity index measurement (MSSIM) are useful.  
The PSNR is defined by calculating the mean square error (MSE) between the restored image and the original image, and the value of the PSNR decreases as the MSE of the image increases. The PSNR involves the calculation of the formula expressed as follows.  
\[MSE=\frac{1}{H\times W}\sum_{i=0}^{H-1}\sum_{j=0}^{W-1}||I(i,j)-O(i,j)||^{2} \tag{5}\]  
\[PSNR=10\times\log_{10}\frac{(2^{n}-1)}{MSE} \tag{6}\]  
In Equation (10), \(H\times W\) denotes a monochrome image with height \(H\) and width \(W\), \(I\) denotes an image with a missing region, and \(O\) denotes the restored image. In Equation (11), \(n\) denotes the number of bits of image pixels, which is generally taken as 8 bits, and since the restored imaging logging image is a colour image, it is necessary to average the MSE of the three channels when calculating the MSE.  
The structural similarity metric (SSIM) [15] is a numerical representation that calculates the structural similarity between the original image and the restored image, in which a Gaussian template is used as a probability value for a pixel region, and in turn the pixel mean, variance, and covariance of a region are calculated. SSIM compares the similarity of two images in terms of luminance \(l\), contrast \(c\), and structure \(s\), respectively. The relevant calculation formulae are as follows.  
\[l(I,O)=\frac{2\mu_{I}\mu_{O}+C_{1}}{\mu_{I}^{2}+\mu_{O}{}^{2}+C_{1}} \tag{7}\]\[c(I,O)=\frac{2\sigma_{I}\sigma_{O}+C_{2}}{\sigma_{I}^{2}+\sigma_{O}^{2}+C_{2}} \tag{8}\]  
\[s(I,O)=\frac{2\sigma_{IO}+C_{3}}{\sigma_{I}\sigma_{O}+C_{3}} \tag{9}\]  
\[SSIM(I,O)=I(I,O)\bullet c(I,O)\bullet s(I,O) \tag{10}\]  
In the above formulae, the means of images \(I\) and \(O\) are denoted by \(\mu_{I}\) and \(\mu_{O}\), respectively, the variances by \(\sigma_{I}\) and \(\sigma_{O}\), and the covariances by \(\sigma_{IO}\). \(C_{1}\), \(C_{2}\), and \(C_{3}\) are denoted by constants in the formulae in order to avoid the possibility of having a denominator of 0 when there is a fraction, usually taking \(C_{1}=\lambda_{1}{}^{2}L^{2}\), \(C_{2}=\lambda_{2}{}^{2}L^{2}\), \(C_{3}=\lambda_{3}{}^{2}L^{2}\), \(\lambda_{1}=0.01\), \(\lambda_{2}=0.03\), and \(L=255\).  
\[MSSIM(I,O)=\frac{1}{N}\sum_{i=1}^{N}SSIM(I_{i},O_{i}) \tag{11}\]  
From the above equation, the average structural similarity measure can be calculated based on the structural similarity measure, i.e., the image is divided into \(N\) chunks using a sliding window, and the window is moved in pixels each time to calculate the \(SSIM\) value of each chunk, and finally, the average value is taken as the average structural similarity measure of the two images. The value range is [0, 1]; the more similar the structure of the two images is, the closer the \(MSSIM\) value is to 1.