## 3 Related Methodologies
### The Structure Similarity Index Measure Loss Function  
In order to measure the structure similarity index measure (_SSIM_) [22] of the perceptual distance between two images, we try to construct the structural similarity loss function \(L_{ssim}\) between the downsampled sample images \(g_{1}(y),g_{2}(y),g_{3}(y),g_{4}(y)\). The _SSIM_ index considers the similarity of luminance \(l(x,y)\), contrast \(c(x,y)\), and structure \(s(x,y)\) information structure of images \(x\) and \(y\) to measure the perceptual distance of two images. From the similarity function for \(x\) and \(y\)  
\[S(x,y)=f(l(x,y),c(x,y),s(x,y)) \tag{9}\]  
Figure 1: Illustration of the strategy for generating sub-images by downsampling \(G=(g_{1},g_{2},g_{3},g_{4})\), where \(k=2\); in every \(2\times 2\) cell, the pixels in the top left, top right, bottom left, and bottom right of the pixel matrix are filled with red, blue, orange, and green, respectively. The pixels padding red, blue, orange, and green are the pixels of the subsampled images \(g_{1}(y),g_{2}(y),g_{3}(y),\) and \(g_{4}(y)\), respectively. The subsampled paired images \((g_{1}(y),g_{2}(y),g_{3}(y),\)\(g_{4}(y))\) are shown as red patches, blue patches, orange patches, and green plaques on the right. the luminance similarity \(l(x,y)\) between image \(x\) and \(y\) is given by  
\[l(x,y)=\frac{2\mu_{x}\mu_{y}+\epsilon_{1}}{\mu_{x}^{2}+\mu_{y}^{2}+\epsilon_{1}} \tag{10}\]  
where \(\epsilon_{1}\) is the constant that goes to 0 to avoid a zero denominator, where \(\epsilon_{1}=(K_{1}L)^{2}\), and \(K_{1}=0.01\) is used as a hyperparameter, and \(L\) is viewed as the actual range with respect to the y pixel values of the target image. Let and denote the luminance value representing the maximum number of pixels in the histograms of the \(x\) and \(y\) images, respectively. Figure 2 shows a histogram of an image, where the abscissa represents the pixels of the image and the ordinate represents the number of pixels. Commonly, the content information of ultrasound images is concentrated in the image numerical area corresponding to the area with more pixels in the histogram, and these areas often contain important diagnostic information. Therefore, the brightness similarity used in this paper is to take the pixel value corresponding to the high point in the histogram as the image brightness value in \(L_{sim}\), instead of the brightness average value in the original \(L_{sim}\). This improvement is very important to improve the diagnostic accuracy and image quality of ultrasound images, especially in addressing complex images with uneven brightness distribution. Assuming the value of every pixel is \(x_{i}\), the expression is as follows:  
\[\mu_{x}=\max(num(x_{i})) \tag{11}\]  
where \(num()\) is the number of pixels. The contrastive similarity \(c(x,y)\) function between image \(x\) and \(y\) is given by:  
\[c(x,y)=\frac{2\sigma_{x}\sigma_{y}+\epsilon_{2}}{\delta_{x}^{2}+\delta_{y}^{2 }+\epsilon_{2}} \tag{12}\]  
\(\epsilon_{2}\) is the small constant to avoid zeros in the denominator, where \(\epsilon_{2}=(K_{2}L)^{2}\), \(K_{2}=0.03\) as hyperparameters. Let \(\delta_{x}\) and \(\delta_{y}\) denote the standard deviation representing the pixel values of the \(x\) and \(y\) images, respectively. The structural similarity \(s(x,y)\) function between image \(x\) and \(y\) is denoted by:  
\[s(x,y)=\frac{\delta_{xy}+\epsilon_{3}}{\delta_{x}\delta_{y}+\epsilon_{3}} \tag{13}\]  
\(\epsilon_{3}\) is the tiny constant to avoid zeros in the denominator. Denote by \(\delta_{xy}\) the standard deviation of the pixel values of \(x\) and \(y\) images. Setting \(\epsilon_{3}=\epsilon_{2}/2\), the numerator of \(c(x,y)\)  
Figure 2: Flowchart of LTLM compensation.