# Target Detection for Coloring and Ripening Potted Dwarf Apple Fruits Based on Improved YOLOv7-RSEs
## 4 Discussion  
To further validate the advantages and efficacy of the proposed improved YOLOv7 model for potted dwarf apple detection tasks in orchards, we meticulously adjusted the model parameters, and a series of comparative experiments were conducted. These experiments used the industry-representative target detection models, namely YOLOv7, YOLOv5, and YOLOX. The experimental results demonstrated the performance differences between the algorithms in the dwarf apple recognition detection task, as shown in Figure 13, by comparing the performance of YOLOX, YOLOv5, YOLOv7, and the improved YOLOv7 model in key metrics such as recognition accuracy, recall rate, and average precision.  
Figure 12: YOLOv7: comparative analysis before and after improvement. (**a**) Coloring period; (**b**) maturity period; (**c**) backlight; (**d**) smooth light; (**e**) close distance; (**f**) long distance.  
Figure 13: _Cont._After comparing the close-up detection effect images, we observed that all four detection models exhibited certain detection capabilities. Among them, YOLOv7 stood out in improving the precision of the bounding boxes, with both the completeness and accuracy of its bounding boxes surpassing the other models. All models showed varying degrees of deficiencies in the completeness of detection annotations.  
In the long-range small target detection effect images, by introducing the SE attention mechanism, our method significantly enhanced the feature extraction capability. Under these circumstances, YOLOX and YOLOv5 failed to detect all targets completely, while YOLOv7 successfully detected all targets but made misjudgments in the recognition during the coloring and maturation periods. This indicates that the improved YOLOv7 not only effectively prevents the omission of small targets in long-range images but also enhances detection accuracy. Moreover, the improved algorithm demonstrated optimal detection performance when processing dense images. In summary, the improved YOLOv7 exhibited outstanding precise recognition capabilities in various environments, including long-range, close-up, and dense scenes.  
As shown in Table 3, the detection accuracy of the YOLOX model for potted dwarf apples was 81.91%, the recall rate was 86.35%, and the average precision was 89.65%; the YOLOv5 model had a detection accuracy of 79.50%, a recall rate of 81.83%, and an average precision of 86.65%; the YOLOv7 model had a detection accuracy of 82.34%, a recall rate of 88.84%, and an average precision of 90.04%; the improved YOLOv7 model had a detection accuracy of 87.22%, a recall rate of 90.02%, and an average precision of 96.65%. The harmonic means of the precision and recall rates for the YOLOX, YOLOv5, YOLOv7, and improved YOLOv7 models were 0.84, 0.83, 0.84, and 0.89, respectively. The experimental data were plotted into a PR curve, as shown in Figure 14.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Model**} & **Average** & **Precision** & **Recall** & \multirow{2}{*}{**F1 Spec**} \\  & **Precision (\%)** & **(\%)** & **(\%)** & **(\%)** \\ \hline YOLOv7-SE- & 95.65 & 87.22 & 90.02 & 0.89 \\ SloU & 93.86 & 85.98 & 89.73 & 0.88 \\ YOLOv7-SE & 92.54 & 83.63 & 88.85 & 0.87 \\ YOLOv7 & 90.04 & 82.34 & 88.84 & 0.74 \\ YOLOX & 89.65 & 81.91 & 86.35 & 0.64 \\ YOLOv5 & 86.65 & 79.50 & 81.83 & 0.83 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Research of precision.  
Figure 13: Detection results of different models with various conditions. (**a**) Near distance; (**b**) long distance; (**c**) coloring stage; (**d**) maturity stage.