# A Lightweight YOLOv8 Model for Apple Leaf Disease Detection
## 3 Results  
### Enhancing Model Detection Efficiency  
To assess the effectiveness of the proposed YOLOv8n-GGi method in identifying different apple leaf diseases (Alternaria leaf spot, rust, grey leaf spot, and frog leaf disease), A comparative analysis was performed with the original YOLOv8n model. The specific results can be found in Table 4.  
The findings from the table above indicate that our method improved significantly in detecting various diseases on apple leaves. Specifically, the mean average precision calculated at an IoU threshold of 0.5 ([EMAIL_ADDRESS]) scores for identifying Alternaria leaf spots, rust, grey spots, and frog eye leaf spots increased by 2.4%, 3.1%, 6.2%, and 1.1%, respectively. It resulted in scores of 88.5%, 86.8%, 84.5%, and 87.7%, outperforming the YOLOv8n model. Overall, [EMAIL_ADDRESS] improved by 3.5% compared to the original model. These results underscore the effectiveness of our method in accurately recognizing various apple leaf diseases. The confusion matrix serves as a method to assess the effectiveness of classification models. It displays the relationship between the predicted classes by the model and the actual classes. In the confusion matrix, each column corresponds to the class predicted by the model, with the total count indicating the number of predictions for that class by the model. Each row corresponds to the actual class of the data, with the sum in each row indicating how many data instances belong to that class. A comparison of the confusion matrix before and after the improvement is shown in Figure 11.  
The recognition of grey and frog eye leaf spots was improved by 4.0% and 2.0%, respectively, over the original model. Notably, the recognition of spotted leaf drop disease was enhanced by 11.0%. These improvements can be attributed to the implementation of the GAM attention mechanism and the improved BiFPN, which collectively enhanced the model's ability to predict different classes of diseases accurately. The experiments demonstrate that the improved model correctly predicts most samples. Figure 12 shows the model's performance before and after the improvement. Before the improvement, the bounding box loss (box_loss) of training and verification dropped to about 1.5, and after the improvement, it dropped to about 1.2; classification loss (cls_loss) dropped from 1.5 to 1.2; and defocus loss (df_loss) dropped from 1.2 to 1.0. The improved model has obvious improvements in accuracy, recall, and average precision, showing better convergence and generalization capabilities. \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{**Apple Leaf Disease Category**} & \multicolumn{2}{c}{**[EMAIL_ADDRESS] (\%)**} \\ \cline{2-3}  & **YOLOv8n–GGi** & **YOLOv8n** \\ \hline Alternaria leaf spot & 88.5 & 86.1 \\ Rus & 86.8 & 83.1 \\ Grey spot & 84.5 & 78 \\ Frogeye leaf spot & 87.7 & 86.1 \\ All diseases & 86.9 & 83.4 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparison of the mean average precision results for different target classes. Figure 11: Comparison of confusion matrices before and after improvement: (a) YOLOv8n and (b) YOLOv8n–GGi. Figure 13 illustrates the comparison plots for precision, recall, mean average precision at IoU 0.5 ([EMAIL_ADDRESS]), and mean average precision at IoU from 0.5 to 0.95 ([EMAIL_ADDRESS]:0.95) before and after the method enhancement. The YOLOv8n-GGi model is better than the YOLOv8n model in four indicators: precision, recall, [EMAIL_ADDRESS], and [EMAIL_ADDRESS]:0.95. The YOLOv8n-GGi model performed well in recognition accuracy and disease sample detection capabilities. The effectiveness and superiority of the improved method were verified, and it is suitable for practical application in apple leaf disease detection. Figure 14 shows our proposed model's detection performance on a test set to highlight its benefits. The first through fourth columns show the results of tests for Alternaria leaf spot, rust, grey spot, and frog eye leaf spot.