China holds the top position globally in apple production and consumption. Detecting diseases during the planting process is crucial for increasing yields and promoting the rapid development of the apple industry. This study proposes a lightweight algorithm for apple leaf disease detection in natural environments, which is conducive to application on mobile and embedded devices. Our approach modifies the YOLOv8n framework to improve accuracy and efficiency. Key improvements include replacing conventional Conv layers with GhostConv and parts of the C2f structure with C3Ghost, reducing the model’s parameter count, and enhancing performance. Additionally, we integrate a Global attention mechanism (GAM) to improve lesion detection by more accurately identifying affected areas. An improved Bi-Directional Feature Pyramid Network (BiFPN) is also incorporated for better feature fusion, enabling more effective detection of small lesions in complex environments. Experimental results show a 32.9% reduction in computational complexity and a 39.7% reduction in model size to 3.8 M, with performance metrics improving by 3.4% to a mAP@0.5 of 86.9%. Comparisons with popular models like YOLOv7-Tiny, YOLOv6, YOLOv5s, and YOLOv3-Tiny demonstrate that our YOLOv8n–GGi model offers superior detection accuracy, the smallest size, and the best overall performance for identifying critical apple diseases. It can serve as a guide for implementing real-time crop disease detection on mobile and embedded devices.
An enhanced YOLOv8-based network was developed to accurately and efficiently detect the ripeness of strawberries in complex environments. Firstly, a CA (channel attention) mechanism was integrated into the backbone and head of the YOLOv8 model to improve its ability to identify key features of strawberries. Secondly, the bilinear interpolation operator was replaced with DySample (dynamic sampling), which optimized data processing, reduced computational load, accelerated upsampling, and improved the model’s sensitivity to fine strawberry details. Finally, the Wise-IoU (Wise Intersection over Union) loss function optimized the IoU (Intersection over Union) through intelligent weighting and adaptive tuning, enhancing the bounding box accuracy. The experimental results show that the improved YOLOv8-CDW model has a precision of 0.969, a recall of 0.936, and a mAP@0.5 of 0.975 in complex environments, which are 8.39%, 18.63%, and 12.75% better than those of the original YOLOv8, respectively. The enhanced model demonstrates higher accuracy and faster detection of strawberry ripeness, offering valuable technical support for advancing deep learning applications in smart agriculture and automated harvesting.