## 3 Experiments
### Implementation Details  
All of the research in this paper was conducted on computer devices equipped with NVIDIA GeForce RTX 3080, operating system Windows 10, and software platform PyTorch 1.10.0. In this work, the model is trained separately for each dataset. Each dataset requires a model trained from scratch, as the datasets differ in characteristics, and a single model cannot be applied across all of them. In this study, the Adam optimizer was selected as the optimization algorithm for model training. We use the exponential decay algorithm. The exponential decay algorithm is calculated as follows:  
\[lr=lr_{init}\times(1-\frac{epoch}{\text{max\_epoch}})^{power} \tag{7}\]  
Here, \(lr\) and \(lr\_init\) represent the current and initial learning rates, respectively; \(epoch\) denotes the current number of iterations; \(\text{max\_epoch}\) indicates the total number of iterations; \(power\) is used to control the shape of the curve and is set to 2. In this experiment, the initial learning rate is set to 0.0001, the total number of iterations is set to 200, the number of samples for a training session is set to 16, and the parameter sum of the Adam optimizer is set to 0.9 and 0.999, respectively. Cross-entropy was chosen as the loss function in training. The expression of the cross-entropy loss function is  
\[L=-\frac{1}{N}\sum_{i=1}^{N}\sum_{c=1}^{M}y_{ic}log(P_{ic}) \tag{8}\]  
where \(N\) is the total number of training samples. The final loss function formula is as follows:  
\[L_{f}(\theta)=L_{m}(\theta)+\sum_{i=1}^{4}L_{a_{i}}(\theta)+\frac{\lambda}{2} \|\theta\|^{2} \tag{9}\]  
where \(L_{f}\) denotes the final loss function; \(L_{m}\) represents the main loss from the primary branch; \(L_{a_{i}}\) denotes the loss from the \(i\)-th auxiliary branch; and \(\theta\) refers to the network parameters. The coefficient \(\lambda\) in the L2 regularization term is set to 1 by default, and its effectiveness has been validated through a sensitivity analysis presented in the Section 3.3. To improve feature learning at multiple stages, four auxiliary loss branches are added to the outputs of intermediate layers from the ResNet encoder. Each auxiliary branch  
Figure 9: SPARCS: (**a**) original; (**b**) label diagrams. computes a cross-entropy loss. The final loss is the sum of the main loss and all auxiliary losses, along with an L2 regularization term. All loss terms are equally weighted by default, without additional balancing coefficients. This design encourages consistent optimization across the network and stabilizes training. Some commonly used semantic segmentation evaluation indicators are used to evaluate and compare the prediction results of network models in image segmentation tasks. Pixel Accuracy (PA) is the percentage of all correctly categorized pixels out of the total number of pixels. Precision (P) is the percentage of accurately predicted pixels in each class out of the total number of predicted pixels in that category. Recall (R) is the percentage of accurately predicted pixels in each class out of the total number of pixels in that class. Mean Precision (mP) is the average of the precision (P) of all classes. Mean Recall (mR) is the average of the recall (R) for all classes. These metrics are calculated as follows:  
\[\text{PA}=\sum_{i=1}^{k}\frac{p_{ii}}{\sum_{j=1}^{k}p_{ij}} \tag{10}\]  
\[\text{P}_{\text{i}}=\frac{p_{ii}}{\sum_{j=1}^{k}p_{ij}},i=1,...,k \tag{11}\]  
\[\text{R}_{\text{i}}=\frac{p_{ii}}{\sum_{j=1}^{k}p_{ij}},i=1,...,k \tag{12}\]  
\[\text{mP}=\frac{1}{k}\sum_{i=1}^{k}P_{i} \tag{13}\]  
\[\text{mR}=\frac{1}{k}\sum_{i=1}^{k}R_{i} \tag{14}\]  
The F1 score is the harmonic mean of \(P\) and \(R\). It is calculated as follows:  
\[\text{F1}=\frac{1}{k}\sum_{i=1}^{k}\frac{2\times P_{i}\times R_{i}}{P_{i}+R_{i}} \tag{15}\]  
IoU is the ratio of the intersection and the union of the predicted value and the true value of each category. MIoU is the average of IoU for all classes.