## 2 Methods
### Mixed Loss Function  
Unlike natural imagery tasks such as semantic segmentation on the Pascal VOC2012 dataset, the percentage of target pixels in the existing publicly available pavement distress segmentation datasets is generally small (Figure 4). In the ISTD-PDS7 training set used in this study, the percentage of pavement distress pixels is only 3.17%. It can also be seen that the real pavement distress belongs to a few classes in the image, which leads to an imbalance in their classification and segmentation, and this makes it difficult for the model to effectively learn the features of the distressed regions. [PERSON] et al. [5] found that, if the loss weight of cracks is directly increased, it leads to more false-positive predictions. [PERSON] et al. [2] solved the problem of the imbalance in the percentage of crack pixels in the CRACK500 dataset by using a hybrid loss function combining focal loss [55] and dice loss [56], but the coefficient ratios of the two were not provided. As the training dataset used in this study includes multi-scale pavement lesions and the complexity of the scenes is high, to solve the problems of the class imbalance and segmentation accuracy, we combined the focal loss and dice loss and investigated the optimal coefficient ratios of the two to make this mixed loss function take into account the imbalanced classes and difficult sample challenges, while also improving the segmentation accuracy. We adopted the focal loss function to alleviate the category imbalance between the distress pixels and background pixels. Specifically, it can improve the prediction ability of the model for a small number of samples by introducing an adjustable parameter to adjust the weight of the loss value for negative samples, which is calculated as follows:  
\[L_{fl}=-\alpha(1-p_{t})^{\gamma}\log p_{t} \tag{4}\]  
\[\alpha= \begin{cases}\alpha_{t}&\text{The current sample is a distress}\\ 1-\alpha_{t}&\text{The current sample is the background}\end{cases}  \tag{5}\]  
where \(p_{t}\) represents the probability of a pixel being correctly classified, and \(p_{t}\) also reflects the difficulty of classification, where the larger the value of \(p_{t}\), the higher the confidence of the classification, indicating that it is easier to classify the sample. The smaller the value of \(p_{t}\), the lower the confidence of the classification, indicating that it is more difficult to classify the sample. \(\alpha\) is the positive-negative sample balancing factor, \(\alpha_{t}\) is the pre-set hyperparameter, and \(\alpha_{t}=0.5\). \(\gamma\) is the control-focusing parameter to make the loss more focused on difficult samples, which generally takes the value of 2 [56]. \((1-p_{t})^{\gamma}\) is the dynamic-modulating factor. The smaller the \(p_{t}\) value of the predicted distress pixel, the more inaccurate the prediction is, and the more the focal loss tends to regard this distress  
Figure 4: Target pixel proportion of different pavement distress segmentation datasets. as difficult to classify. At the same time, the larger the value of \((1-p_{t})^{7}\), the greater the contribution of the difficulty of classifying the distress type to the loss. The dice loss is derived from the dice similarity coefficient, which is a metric function used to assess the similarity of samples, and it is a loss function based on segmentation modeling, which evaluates how good a model is by measuring the similarity between the model predictions and the true labels [56]. Specifically, the dice loss calculates the ratio of the intersecting part of the predicted label and the true label to the sum of its two parts as the accuracy of the model prediction. Therefore, the dice loss can solve the problem of the class imbalance and improve the prediction accuracy of the model for data with insignificant class boundaries, and it is calculated as follows:  
\[L_{Dice}=1-\frac{2|X\cap Y|}{|X|+|Y|} \tag{6}\]  
where \(X\) and \(Y\) denote the set of points contained in the real and predicted contour regions, respectively.