## 3 Method
### Context-Enhanced Spatial Sparse Convolution  
As displayed in Figure 1, global contextual information \(\mathbf{G}_{i}\) from the SAUs is introduced to compensate for the degradation of recognition accuracy due to sparse convolution. Then, CESSC is performed, which takes the feature map \(\mathbf{X}_{i,j}\), the mask matrix \(\mathbf{H}_{i}\), and the global feature \(\mathbf{G}_{i}\) as input, where \(j\) indicates the \(j\)-th SSC layer. \(\mathbf{H}_{i}\in\{0,1\}^{1\times H\times W}\) is generated and formulated according to Equation (5):  
\[\mathbf{H}_{i}\Bigg{\{}\begin{array}{cc}\mathit{Sigmoid}(\frac{\mathbf{S}_{i }+\mathbf{\epsilon}_{1}-\mathbf{\epsilon}_{2}}{\gamma})>0.5,&\text{For training}\\ \mathbf{S}_{i}>0,&\text{For inference}\end{array} \tag{5}\]  
where \(\mathbf{S}_{i}\in R^{1\times H\times W}\) is a soft feature generated by convolving \(\mathbf{X}_{i}\), and \(\mathbf{\epsilon}_{1},~{}\mathbf{\epsilon}_{2}\in R^{1\times H\times W}\) refer to two Gaussian random noises. As shown in Equation (5), only the region with a mask value of 1 is involved in convolutions, thereby lowering the total computational expense. During inference, the sparsity of Hi is determined by a mask ratio \(\gamma\in[0,1]\), which has often been manually set to be higher than 0.9 in recent studies. Considering the different flight altitudes and application scenarios of UAVs, the percentage of meaningful foregrounds in the image varies greatly, and the fixed mask ratio leads to an increase in floating-point operations, while dynamic mask ratios can optimize computational resources. Therefore, Equation (6) is employed to estimate the optimal mask ratio.  
\[\gamma=\frac{Fpx(C_{i})}{Allpx(C_{i})} \tag{6}\]  
where \(C\in R^{h_{i}\times w_{i}\times c}\) is the ground-truth classification result; \(Fpx(C_{i})\) and \(Allpx(C_{i})\) indicate the number of pixels belonging to the foreground and that of all pixels, respectively.  
The mean value and standard deviation of \(\mathbf{G}_{i}\) are introduced to normalize the feature map after applying SSC to \(\mathbf{X}_{i,j}\). The context-enhanced feature \(\mathbf{M}_{i,j}\) is defined by context-enhanced group normalization (CE-GN), as expressed in Equation (7).  
\[\mathbf{M}_{i,j}=k\times\frac{\mathbf{L}_{i,j}-mean[\mathbf{G}_{i}]}{std[ \mathbf{G}_{i}]}+b \tag{7}\]  
where \(\mathbf{L}_{i,j}\) denotes the output after applying SSC; \(mean[.]\) and \(std[.]\) denote the mean and standard deviation, respectively; and \(k\) and \(b\) are learnable parameters. By incorporating the global feature \(\mathbf{G}_{i}\), CESSC can better understand the spatial relationships and interactions between objects, leading to improved performance.  
In response to the high proportion of small objects in UAV images, \((1-p)^{\gamma}\) is further added to the cross-entropy, and focal loss (Equation (8)) is defined to guide the algorithm to focus more on positive targets than on backgrounds.  
\[FL(p)=-\alpha(1-p)^{\gamma}\log(p) \tag{8}\]  
where \(p\) denotes the predicted probability, \(\gamma\in[0,5]\) is the focusing parameter used to adjust the rate of change in the weighting factors \((1-p)^{\gamma}\), and \(\alpha\in[0,1]\) is a hyperparameter balancing the contribution of positive and negative samples to the loss.