## 2 Materials and Methods
### Evaluation Metrics
#### 2.4.2 Evaluation Metrics for Image Segmentation Tasks  
IoU, Recall, and pixel accuracy (PA) are common metrics for evaluating image segmentation tasks. IoU provides a quantitative measure to assess the consistency between the predicted segmentation area and the true segmentation area. Recall represents the proportion of the actual segmented area that is correctly identified, and PA measures the proportion of pixels in the image that are correctly classified out of the total number of pixels. Their calculation formulas are shown as follows:  
\[IoU=\frac{\textit{TP}}{\textit{TP}+\textit{FP}+\textit{FN}} \tag{10}\]  
Figure 5: LPIPS feature extraction and perceptual judgment prediction flowchart.F represents the network for feature extraction. G represents the small network for predicting human perceptual judgments based on the two sets of global distance measurements.  
\[Recall=\frac{TP}{TP+FN} \tag{11}\]  
\[PA=\frac{TP+TN}{TP+TN+FP+FN} \tag{12}\]  
Among them, \(TP\) refers to the pixels or areas that the model correctly identifies as belonging to a certain category, \(FP\) refers to the pixels or areas that the model incorrectly identifies as belonging to a certain category when they do not, \(FN\) refers to the pixels or areas that the model fails to identify as belonging to a certain category, and \(TN\) refers to the pixels or areas that the model predicts as the background or other categories, which are also actually the background or other non-target categories.  
To comprehensively evaluate the performance of segmentation models, we have also introduced the Local Consistency metric, which is a concept in Constraint Satisfaction Problems (CSPs). It refers to a strategy for advancing problem-solving by ensuring that a part of the problem (such as a single variable or a pair of variables) satisfies all the relevant constraints during the problem-solving process. For example, in Path Consistency, it is required that for any path of length k, if the variable x is on the path and \(y\) and z are the previous and next variables of x, respectively, the following must be satisfied:  
\[C_{\text{x,z}}\subseteq C_{\text{x,y}}oC_{\text{y,z}} \tag{13}\]  
In the given context, \(C_{\text{x,y}}\) represents the constraint between the variables x and y, \(C_{\text{x,z}}\) represents the constraint between the variables x and z, and \(C_{\text{y,z}}\) represents the constraint between the variables \(y\) and z. \(o\) denotes the combination of constraints. Local Consistency focuses on the consistency of the segmentation results within a local area, that is, whether the segmentation results are smooth within a small neighborhood, without obvious jumps or noise. This metric reflects the smoothness and continuity of the segmentation results, supplementing the pixel accuracy.  
In conjunction with specific segmentation tasks, we also use porosity difference as an evaluation metric. Here is its mathematical expression:  
\[\Delta P=\left|\frac{C_{0,1}-C_{0,2}}{N}\right| \tag{14}\]  
The total number of pixels in the segmented result image is \(N\), \(C_{0,1}\) represents the total number of pixels indicating the pore area in the labeled image, \(C_{0,2}\) represents the total number of pixels indicating the pore area in the segmented image using the model, and \(\Delta P\) is the porosity difference calculated in the end.