# A Raisin Foreign Object Target Detection Method Based on Improved YOLOv8
## 3 Results
### Comparison Experiments with Different Object Detection Algorithms  
To more intuitively demonstrate the performance of the improved YOLOv8 model, comparative experiments were conducted using Faster R-CNN, SSD, YOLOv5m, YOLOv5s, YOLOv7, YOLOv7-tiny, YOLOv8x, YOLOv8l, YOLOv8m, YOLOv8s, and YOLOv8n, all based on deep learning models, using the same raisin dataset. The comparative experimental results of different models are shown in Table 2, and the experimental results of different models for different foreign matter classification accuracy are shown in Table 3. \begin{table}
\begin{tabular}{c c c c c c c c} \hline
**Model** & **P/\%** & **R/\%** & **F1-Score** & **mAP0.5/\%** & **mAP0.5: 0.95/\%** & **Params** & **FLOPs/G** & **Time/ms** \\ \hline Faster R-CNN & 96.4 & 78.3 & 0.864 & 92.4 & 79.0 & 41,367,656 & 269.0 & 23.5 \\ SSD & 83.7 & 60.9 & 0.705 & 73.7 & 51.9 & 13,437,006 & 30.5 & 6.3 \\ YOLOv5m & 94.2 & 90.7 & 0.924 & 94.4 & 79.8 & 20,865,057 & 47.9 & 9.1 \\ YOLOv5s & 94.4 & 88.0 & 0.911 & 93.5 & 75.1 & 7,020,913 & 14.4 & 6.5 \\ YOLOv7 & 94.9 & 92.7 & 0.938 & 96.1 & 82.7 & 36,497,654 & 103.2 & 9.3 \\ YOLOv7-tiny & 92.6 & 89.5 & 0.910 & 94.8 & 74.4 & 6,015,714 & 13.0 & 8.8 \\ YOLOv8x & 92.8 & 93.3 & 0.931 & 96.6 & 84.8 & 68,127,420 & 257.4 & 10.3 \\ YOLOv8l & 94.3 & 91.9 & 0.931 & 96.0 & 84.6 & 43,609,692 & 165.4 & 9.5 \\ YOLOv8m & 93.1 & 91.4 & 0.922 & 95.9 & 83.8 & 25,842,076 & 78.7 & 8.0 \\ YOLOv8s & 92.7 & 89.4 & 0.910 & 94.8 & 81.2 & 11,127,132 & 28.4 & 7.2 \\ YOLOv8n & 93.2 & 86.8 & 0.898 & 93.7 & 77.7 & 3,006,428 & 8.1 & 6.3 \\ Ours & 94.5 & 89.9 & 0.921 & 96.2 & 81.5 & 13,177,692 & 33.1 & 7.8 \\ \hline \end{tabular}
\end{table} 
Table 2: Comparison of experimental results of different models. Figure 12: Visualization of training results. The blue arrows highlight the improvements in the improved model compared to the original model. The detection performance of various models is illustrated in Figure 13. The comparative experimental outcomes indicate that the refined YOLOv8 model exhibits superior performance in precision, recall, and the composite metric F1-score, particularly excelling in precision, with a marginal decrease compared to the YOLOv7 model. In terms of the average precision at a 0.5 IoU threshold, it is only slightly lower than the YOLOv8x model by 0.4 percentage points and is 4.1, 30.3, 1.9, 2.9, 0.1, 1.5, 0.2, 0.3, 1.5, and 2.7 percentage points higher than other models, respectively. In terms of the average precision at a 0.50.95 IoU threshold, it is lower than the larger YOLOv8 models and the YOLOv7 model. In terms of the number of parameters, FLOPs, and detection time, the improved model has a good performance. From the experimental results of different models for different foreign matter classification accuracy, the improved model has achieved a more significant improvement in detecting fruit stalk foreign matter, only slightly lower than the YOLOv8x model by 0.7 percentage points and is 9.0, 43.4, 5.0, 5.8, 2.8, 5.1, 1.7, 1.4, 3.1, and 6.9 percentage points higher than other models, respectively. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Fruit Stem** & **Branch and Truck** & **Stone** & **Plastic** \\ \hline Faster R-CNN & 84.3 & 90.6 & 95.4 & 97.3 \\ SSD & 49.9 & 70.5 & 86.9 & 87.6 \\ YOLOv5m & 88.3 & 94.5 & 96.4 & 98.3 \\ YOLOv5s & 87.5 & 93.7 & 95.5 & 97.3 \\ YOLOv7 & 90.5 & 96.7 & 98.1 & 99.2 \\ YOLOv7-tiny & 88.2 & 95.6 & 97.4 & 98.1 \\ YOLOv8x & 94.0 & 95.5 & 98.0 & 98.7 \\ YOLOv81 & 91.6 & 95.0 & 98.3 & 98.9 \\ YOLOv8m & 91.9 & 94.8 & 97.8 & 98.8 \\ YOLOv8s & 90.2 & 93.1 & 97.6 & 98.3 \\ YOLOv8n & 86.4 & 93.8 & 96.7 & 98.0 \\ Ours & 93.3 & 94.7 & 98.1 & 98.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Experimental results of different models for different foreign matter classification accuracy (%). Figure 13: The detection effects of different models.