## 2 Materials and Methods
### The Improved YOLOv8 Model
#### 2.2.1 Shuffle Attention Module  
Changes in flight altitude result in variations in the size of strawberry targets in captured images. The shuffle attention module utilizes channel attention and spatial attention calculations to extract feature maps of different scales. It was added to the backbone part of the original YOLOv8 model, and the feature mapping was divided into multiple groups to input into the shuffle attention module. Channel attention and spatial attention were calculated, respectively. All sub-features were aggregated to enhance feature extraction ability [21]. The specific structure of the shuffle attention module is shown in Figure 2.  
Figure 1: Drone dataset images captured under different conditions. (**a**) Sunny at a height of 2 m; (**b**) Sunny at a height of 3 mm; (**c**) Cloudy at a height of 2 m; (**d**) Cloudy at a height of 3 m. \begin{table}
\begin{tabular}{c c c c c} \hline
**Item** & **Training Set** & **Validation Set** & **Testing Set** & **Total** \\ \hline Number of images & 1483 & 247 & 123 & 1853 \\ \hline \end{tabular}
\end{table} 
Table 3: Dataset information table. In step 1, feature maps of strawberry field images, \(\mathrm{X}\in\mathrm{R}^{\mathrm{C\times H\times W}}\), were input into the shuffle attention module, which were divided into g groups of feature maps along the depth direction, where X was [\(\mathrm{X}_{1}\), \(\mathrm{X}_{2}\), \(\ldots\), \(\mathrm{X}_{k}\)]. In step 2, for each group of feature maps \(\mathrm{X}_{k}\), they were divided into \(\mathrm{X}_{k1}\) and \(\mathrm{X}_{k2}\) along two channel directions. In step 3, \(\mathrm{X}_{k1}\) was shrunk by the spatial dimension H \(\times\) W. Channel statistical information \(\mathrm{s}\) was generated. \(\mathrm{s}\) was further scaled and moved to ultimately generate channel attention \(\mathrm{X}^{\prime}_{k1}\). The specific calculation process of channel attention is shown in Equations (1) and (2). \[\mathrm{s}=\frac{1}{\mathrm{H}\times\mathrm{W}}\mathrm{\sum}_{i=1}^{\mathrm{H} }\mathrm{\sum}_{j=1}^{\mathrm{W}}\mathrm{X}_{k1}\left(i,j\right) \tag{1}\]  
\[\mathrm{X}^{\prime}_{k1}=\sigma(\mathrm{W}_{1}\mathrm{s}+\mathrm{b}_{1}) \times\mathrm{X}_{k1} \tag{2}\]  
where \(\mathrm{s}\) represented channel information, H and W were feature map size, \(\sigma\epsilon\) [0, 1], \(\mathrm{W}_{1},\mathrm{b}_{1}\in\mathrm{R}^{\frac{\mathrm{s}}{\mathrm{s}} \times 1\times 1}\) represented the parameter of channel information \(\mathrm{s}\) for scaling and moving, and \(\mathrm{X}^{\prime}_{k1}\) represented channel attention. In step 4, \(\mathrm{X}_{k2}\) was processed by GroupNorm and spatial statistical information \(\mathrm{y}\) was generated. After linear transformation processing, the spatial attention \(\mathrm{X}^{\prime}_{k2}\) was generated, and the specific calculation process of spatial attention is shown in Equations (3) and (4). \[\mathrm{y}=\mathrm{GroupNorm}\left(\mathrm{x}^{\prime}_{\mathrm{c},\mathrm{i}j }\right)=\frac{\mathrm{x}_{\mathrm{c},\mathrm{i}j}-\mathrm{\mu}_{\mathrm{g}}} {\sqrt{\sigma_{\mathrm{g}}^{2}}+\alpha} \tag{3}\]  
\[\mathrm{X}^{\prime}_{k2}=\sigma(\mathrm{W}_{2}\times\mathrm{GroupNorm}( \mathrm{X}_{k2})+\mathrm{b}_{2})\times\mathrm{X}_{k2} \tag{4}\]  
where \(\mathrm{X}_{\mathrm{c},\mathrm{i},\mathrm{j}}\) represented the feature values of the \(\mathrm{c}\)-th channel, \(\mathrm{i}\)-th row, and \(\mathrm{j}\)-th column in the feature map, \(\mathrm{\mu}_{\mathrm{g}}\) was the mean of the g-th group, \(\mathrm{\sigma}_{\mathrm{g}}^{2}\) represented the variance of the g-th group, \(\alpha\) was stability constant, \(\mathrm{W}_{2},\mathrm{b}_{2}\in\mathrm{R}^{\frac{\mathrm{s}}{\mathrm{s}} \times 1\times 1}\) was the parameter of transforming spatial information \(\mathrm{y}\), and \(\mathrm{X}^{\prime}_{k2}\) was spatial attention. In step 5, the channel Attention \(\mathrm{X}^{\prime}_{k1}\) and the spatial attention \(\mathrm{X}^{\prime}_{k2}\) were concatenated to generate the aggregated comprehensive attention \(\mathrm{X}^{\prime}_{k}\).