## 3 Efficient Dynamic Perception Net
### Image Segmentation
#### 3.2.3 Dynamic Loss Function  
During the EDPNet training process, we use a dynamic loss function. This loss function consists of two parts. The first half is the cross-entropy and Dice loss functions, which are used for rapid convergence of the model. The second half is the boundary refinement loss function, which is used to refine the output ice-covered area. Figure 4: Schematic diagram of the LDFM. Figure 3: Schematic diagram of the ECA-Net. The loss function in the first half is composed of the cross entropy loss function and the Dice loss function. The cross entropy loss function is used to calculate the pixel-level loss, and the Dice loss function calculates the overall global loss. The calculation formula of the cross entropy loss function is  
\[L_{BCE}=-[ylog\hat{y}+(1-y)log(1-\hat{y})] \tag{6}\]  
where \(y\) represents the true pixel value, taking the value of 0 or 1. \(\hat{y}\) represents the predicted probability of the label. During model training, the cross-entropy loss function compares the difference between the true value and the predicted value of a single pixel, so it can be seen as optimizing the model from a microscopic perspective. The Dice coefficient is a function used to measure the similarity of a set, which can calculate the similarity between two different samples. The calculation formula for the Dice coefficient is  
\[Dice=\frac{2|X\cap Y|}{|X|+|Y|} \tag{7}\]  
where \(X\) and \(Y\), respectively, represent the set of real pixels and the set of predicted pixels for image segmentation. \(|X\cap Y|\) represents the intersection of the predicted and actual segmentation images, which is the set of correctly predicted pixels. \(|X|+|Y|\) represents the total set of pixels in the predicted and actual segmentation images. The Dice coefficient focuses on the degree of overlap between the real segmentation image and the predicted segmentation image, emphasizing the optimization of the model from a holistic perspective. The Dice loss function is derived from the Dice coefficient, and its calculation formula is  
\[L_{Dice}=1-\frac{2|X\cap Y|}{|X|+|Y|} \tag{8}\]  
Therefore, we combine the cross-entropy loss function with the Dice loss function for the early training of the model and quickly optimize the model from both local and global levels. The cross-entropy loss function focuses on the difference between a single pixel prediction and the true value, while the Dice loss function measures the overall similarity between the predicted segmentation image and the true segmentation image. When the model is trained to a certain extent, the overall difference between the predicted image and the real label gradually decreases, but there is still a considerable gap in the details of the ice boundary. In the second half of model training, we introduce the boundary refinement loss function DouLoss [40]. This loss function optimizes the model by comparing the boundary difference between the real label of the ice-covered image and the predicted mask, guiding the model to generate a more refined ice-covered segmentation image. The calculation formula of DouLoss is as follows:  
\[L_{DolI}=\frac{G\cup P-G\cap P}{G\cup P-\alpha\times G\cap P} \tag{9}\]  
\(G\) represents the true value, \(P\) represents the predicted value, and \(\alpha\) is the adjustment factor. \(G\cup P\) represents the union of the true value and the predicted value, \(G\cup P\) represents the intersection of the true value and the predicted value, and \(G\cup P-G\cap P\) is the difference set between the true label and the predicted value, which includes all misclassified pixels. \(G\cup P-\alpha\times G\cap P\) is a part of the area where the boundary between the true value and the predicted value overlaps. By calculating the difference set and the ratio of this part, the closeness between the predicted boundary and the true boundary is represented. DouLoss encourages the model to fine tune the boundary regions, thereby improving the overall segmentation performance.