# Flowering Index Intelligent Detection of Spray Rose Cut Flowers Using an Improved YOLOv5s Model
## 2 Materials and Methods
### Improved YOLOv5s Network Model  
The YOLO series of models is a fast and efficient object detection algorithm that treats the object detection task as a regression problem. Unlike traditional object detection algorithms, YOLO uses a single neural network to simultaneously predict the bounding boxes and classes of multiple objects within an image. Compared to its predecessors, YOLOv5 maintains high accuracy while offering smaller weight files and faster training and inference speeds. In addition, [PERSON] et al. conducted a comparative analysis of the \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Spray Rose** & **Fi-1** & **Fi-2** & **Fi-3** & **Fi-4** & **Fi-5** \\ \hline Yellow Bubbles & 416 & 314 & 238 & 152 & 98 \\ Orange Bubbles & 322 & 230 & 183 & 124 & 76 \\ Total & 734 & 540 & 421 & 276 & 174 \\ Proportion (\%) & 34.2 & 25.2 & 19.6 & 12.9 & 8.1 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Quantity and distribution of the spray rose dataset. Figure 1: Manual labeling of the different flowering index. detection performance among four YOLO models: YOLOv5, YOLOv6, YOLOv7, and YOLOv8, specifically in grading single fresh-cut roses. The Average Precision (AP) for these models was recorded at 99.98%, 96.87%, 100%, and 99.99%, respectively; however, their processing speeds (measured in Frames Per Second or FPS) were noted as 76.49, 56.47, 23.55, and 60.85 correspondingly. In terms of complexity, the number of parameters for YOLOv5, YOLOv6, YOLOv7, and YOLOv8 was 7.02M, 18.50M, 36.50M, and 11.13M, respectively. It was evident that the YOLOv5 model was the simplest among them. Although the precision of YOLOv8 exceeded that of the YOLOv5 model by 0.01%, it came at a cost--its parameter scale was 58.55% higher. This outcome indicated that while the precision of the YOLOv5 model was comparable to that of the other three models, its complexity and speed were significantly superior [30]. The results obtained indicated that the inference times for YOLOv5s and YOLOv8s were 5.9 ms and 15.6 ms, respectively, when applied to the same scene. This suggested that the detection speed of YOLOv5s was more than three times faster than that of the YOLOv8s model [31]. The YOLOv5 model offered advantages in terms of speed and simplicity, which align well with the requirements of this research. Therefore, we selected the construction of the YOLOv5 model for grading the flowering index of spray rose cut flowers. YOLOv5 is primarily composed of four parts: Input, Backbone, Neck, and Head. The Input layer uses the mosaic method for data augmentation, performs adaptive anchor box calculations, and applies mirror normalization to the input images. The Backbone layer extracts features at different scales from the images for use in subsequent network layers. The Neck layer fuses the multi-scale features extracted by the Backbone and passes the fused feature maps to the Head layer for prediction. The Head layer employs the CIoU loss function for bounding box regression and uses Non-Maximum Suppression (NMS) to eliminate redundant detection boxes. Considering the trade-off between detection accuracy, computational cost, and model complexity, YOLOv5s was selected as the baseline framework for optimization and improvement, with the network structure shown in Figure 3. The specific improvement strategies included the following four aspects: (1) In addition to the three-scale feature maps output by the detection head in YOLOv5s, an additional small-scale detection output was added to improve the detection accuracy of the flowering index of small, occluded flowers within the bouquet; (2) a spatial and channel attention mechanism was incorporated to enhance the feature extraction capability for the flowering index; (3) the WIoU  
Figure 2: Images after data augmentation. (**a**) Original; (**b**) Cutout and Add Noise; (**c**) Change Light; (**d**) Translate and Rotate; (**e**) Translate; (**f**) Translate and Cutout; (**g**) Add Noise; (**h**) Mirror and Add Noise.