## 2 Materials and Methods
### Framework of HM-YOLO
#### 2.3.3 Multi-Scale Progressive Feature Fusion Network (MS-FPN)  
In the strawberry dataset, the strawberry ripeness detection task faces numerous challenges, particularly regarding the detection of strawberries at different scales under variable environmental conditions. For example, strawberries exhibit significant size differences at various ripeness stages, and the detailed features of small strawberries are prone to being confused with the environment in complex backgrounds. These factors collectively increase the difficulty of accurately recognizing strawberry ripeness, necessitating advanced and flexible feature fusion methods to enhance detection performance. Although the original YOLOv8 model employs the PAN-FPN structure in the neck network to facilitate fusion across different feature layers, its upsampling module may lead to the loss of critical image details when processing feature maps. To address these limitations, the MS-FPN has been developed, with the specific feature fusion process illustrated in Figure 7. Specifically, the MS-FPN replaces the traditional upsampling module with an efficient DySample module, effectively improving the detection efficiency of the model. Subsequently, the ASFF module is used to merge two adjacent low-level features, allowing the model to effectively capture feature details at different scales and dynamically adjust the weights of each feature layer to enhance the transmission of fundamental feature information. Finally, these low-level features are efficiently fused with high-level features, which have been processed by PHAM to possess multi-dimensional spatial information and positional sensitivity. This fusion method not only incorporates rich semantic information but also significantly enhances the capability of the model to detect fine-grained features in strawberry images, thereby improving the overall detection performance. Figure 7: Workflow diagram of feature fusion through MS-FPN. To address potential multi-object information conflicts during the feature fusion process of the PAN-FPN feature pyramid, the original YOLOv8 model structure was improved by integrating the ASFF unit to enhance feature fusion effectiveness. The ASFF unit allows for adaptive, selective fusion across different feature scales, reducing interference from information conflicts and improving the model's adaptability and detection accuracy in multi-object scenarios. The fusion process is illustrated in Figure 8. Specifically, \(x_{ij}^{n\to l}\) represents the feature vector at position \((i,j)\) from layer \(n\) to layer \(l\). Through the adaptive spatial fusion technique of multi-level features, the final feature vector \(y_{ij}^{l}\) can be obtained as a linear combination of feature vectors \(x_{ij}^{1\to l}\) and \(x_{ij}^{2\to l}\), with the specific relationship outlined as follows:  
\[y_{ij}^{l}=\alpha_{ij}^{l}\cdot x_{ij}^{1\to l}+\beta_{ij}^{l}\cdot x_{ij}^{2 \to l} \tag{9}\]  
where \(\alpha_{ij}^{l}\) and \(\beta_{ij}^{l}\) represent the spatial weights of two different feature levels on layer \(l\), and these weights are constrained by the following:  
\[\alpha_{ij}^{l}+\beta_{ij}^{l}=1 \tag{10}\]  
To align feature dimensions, \(1\times 1\) convolutions were used to reduce the number of channels in the features. Subsequently, features were upsampled using the DySample technique. Conversely, during downsampling, a \(3\times 3\) convolution with a stride of 2 was employed, which not only reduced the resolution but also adjusted the number of channels. ASFF enhanced the importance of critical layers by assigning different spatial weights to features at various levels, thereby enabling effective feature fusion by the model. Although the YOLOv8 model utilizes nearest-neighbor interpolation for upsampling, several dynamic upsampling techniques such as content-aware reassembly of features (CARAFE), feature aggregation and decoding (FADE), and similarity-aware point association (SAPA) have been developed, which have significantly improved detection performance.