# A Lightweight YOLOv8 Model for Apple Leaf Disease Detection
## 4 Discussion  
The primary motivations for enhancing the model to boost detection performance include the following:  
1. Lightweight improvement: This study introduces GhostConv to replace Conv in the original YOLOv8n structure, forming the main part of the backbone. Additionally, we utilize the C3 Ghost module to replace the original C2f structure. This replacement results in a 22.2% reduction in module size, a 3.1% decrease in precision, a 24.4% decrease in floating-point computation, a 28.1% reduction in the number of network model parameters, and a 4.8% reduction in recall. However, the mean average precision (mAP) at the IoU threshold of 0.5 is only reduced by 2.8%. The findings from the experiments indicate that the advanced network architecture, based on the Ghost module, significantly mitigates the parameter count and complexity of the model. This optimization prioritizes enhanced speed at the expense of sacrificing precision and recall. Nevertheless, the refined model maintains relatively efficient detection performance while embodying a streamlined framework.
2. Introducing the attention mechanism: Implementing lightweight improvements significantly reduces the size of the algorithmic model. However, we introduce the global attention mechanism (GAM) into the backbone network to address the decline in detection performance resulting from insufficient effective feature extraction. This addition results in noteworthy enhancements in precision, recall, and [EMAIL_ADDRESS], with improvements of 4.9%, 4.8%, and 2.7%, respectively, compared to YOLOv8-GhostNet. Despite a 3.9% increase in model size, the computational overhead remains minimal. This efficiency is attributed to the coordinate attention mechanism, which captures cross-channel relationships and direction-aware and location-aware information. Introducing the global attention mechanism improves the model's emphasis on pertinent features, improving its performance across various tasks. By dynamically adjusting attention weights, the global attention mechanism (GAM) adapts to different scenarios, enhancing the model's robustness and performance while maintaining low computational costs.
3. Adding the improved BiFPN bidirectional feature pyramid network: This study addresses the challenge posed by the morphological diversity of diseases at various developmental stages and the variations in shape and size within the same disease class. We investigate the necessity of feature fusion at different scales to tackle this issue. To this end, we replaced the original PAFPN with an improved BiFPN in the multi-scale feature fusion network of YOLOv8 while augmenting the P2 large-scale feature layer. Our approach yielded notable improvements compared to YOLOv8-GhostNet-C3 Ghost-GAM, including a 1.4% increase in precision, a 2.3% increase in recall, and a 3.5% increase in the mean average precision calculated at an IoU threshold of 0.5 ([EMAIL_ADDRESS]). We also reduced the model size by 25.5% and FLOPs by 17.9%. Notably, our method demonstrated significant enhancements in fusing features from distant targets, such as small lesions on apple trees, as evidenced by the substantial results observed on the test map images.  
In the future, we will apply the improved YOLOv8-GGi model to experiments on crops such as pear trees and cotton. Techniques such as pruning and distillation will further reduce the model's parameters and computational overhead, and a lightweight accelerated apple leaf disease detection system will be deployed on embedded devices such as the Raspberry Pi and realized in practice.