Vetnuus | October 2025 17 corresponding mask are processed. After each training loop, a check is performed to evaluate the convergence of the model. If the loss converges or reaches a satisfactory level, the training process is terminated. Otherwise, the loop continues until the model reaches optimal performance as described in Algorithm 1. Once the model is trained, it can be used to predict segmentation masks for new images. The prediction involves passing the input image through the encoder and decoder, generating a probability map for each pixel in the image. The class with the highest probability is assigned to each pixel, resulting in the final segmentation output. This process ensures that the U-Net model learns to accurately segment images based on the features extracted during the training phase, providing robust pixel-wise predictions for medical imaging tasks. 3.2.1.3 Loss function In deep learning, loss functions are essential components that assess the disparity between a model’s predicted output and the actual ground truth values. A higher loss indicates greater error in the model’s predictions, while a lower loss suggests improved accuracy. The principal objective of loss functions is to guide the model toward minimising prediction errors by adjusting its trainable parameters, such as weights and biases. There are numerous loss functions available, each designed to reward or penalise a model differently, depending on the nature of the task. The choice of the most appropriate loss function is critical for achieving optimal performance. In this research, two primary loss functions were used: Dice loss (DL) and Cross Entropy (CE) loss, both of which are highly relevant for segmentation tasks in medical imaging. Dice Loss is directly derived from the Dice Similarity Coefficient (DSC), which measures the overlap between the predicted segmentation and the ground truth mask. The formula for Dice loss, which ranges between 0 and 1, is expressed as (1): 1 DL = 1 - DSC where DL tends toward 1 in cases of poor overlap and 0 when the model’s predictions are perfect. Since Dice loss emphasises the similarity between the predicted and actual segmentation areas, it is particularly effective when working with small, imbalanced regions of interest. It calculates both precision—the accuracy of positive predictions—and recall, which measures the coverage of actual positive samples. Both precision and recall are integral to the effectiveness of the classifier and are expressed as follows (2): Using these definitions, the Dice Similarity Coefficient is equivalent to the F1score, which is a harmonic mean of precision and recall. This harmonic mean ensures that the model penalizes low values of either precision or recall, thereby encouraging a balance between the two. The F1-score is calculated as (3): In this research, Dice loss was used to transform this metric into a continuous, differentiable function that can be applied during the training of the model. The formula for Dice loss (4), when applied to predictions and ground truth, is: Here, γ represents the ground truth values, and y accent represents the predictions made by the model. Dice loss performs well when applied to image-level predictions rather than individual pixels, as it accounts for the overlap between the predicted and true segmentation masks. Another loss function used in this study is the Cross-Entropy (CE) loss, which is widely regarded for its simplicity and effectiveness in training classification models. Unlike Dice loss, which focuses on the overlap between areas, CE measures the divergence between two probability distributions: the predicted probability and the actual label. CE is particularly useful when working with multi-class classification problems, and it can be adapted for binary tasks. The Binary Cross Entropy (BCE) loss is used for binary classification tasks and is given by formula (5): In cases where multiple classes are present, Categorical CrossEntropy (CCE) is used. CCE extends BCE to multiple classes, and the formula for CCE (6) is: Where FF represents the total number of pixels, DD is the number of classes, and γγii,cc refers to the ground truth label for class ρρ at pixel ρρ. Similarly, γγii,cc represents the predicted probability for each class at each pixel. CCE focuses on minimising pixel-level errors but can struggle in imbalanced class distributions where larger objects dominate the scene, affecting the segmentation performance of smaller objects. To address this imbalance, Focal Loss (FL) was introduced. Focal Loss builds upon Cross-Entropy by focusing more on hard-toclassify objects, particularly those incorrectly classified or with low confidence. This is achieved by down-weighting well-classified objects and focusing the learning process on challenging examples. Focal Loss is defined as (7): Here, αα controls the weighting of different classes, and γγ is the focusing parameter, which determines the degree to which the model focuses on difficult-to-classify examples. γγ = 0 Focal Loss behaves like Binary Cross-Entropy. For multi-class classification tasks, BCE is replaced with CCE, and the parameter αα becomes a vector of class weights, while γγ is expressed as a matrix of probabilities for each class. 3.2.1.4 Activation Functions Activation functions are an essential component of neural networks, determining the output of each neuron and introducing non-linearity into the network. This nonlinearity enables the network to learn complex patterns and make accurate predictions. In U-Net and similar convolutional neural networks, common activation functions include ReLU, Sigmoid, and Softmax [76]. Leading Article 2 3 4 5 6 7 >>>18
RkJQdWJsaXNoZXIy OTc5MDU=