智慧农业 (Sep 2024)

Lightweight Apple Leaf Disease Detection Algorithm Based on Improved YOLOv8

  • LUO Youlu,
  • PAN Yonghao,
  • XIA Shunxing,
  • TAO Youzhi

DOI
https://doi.org/10.12133/j.smartag.SA202406012
Journal volume & issue
Vol. 6, no. 5
pp. 128 – 138

Abstract

Read online

[Objective]As one of China's most important agricultural products, apples hold a significant position in cultivation area and yield. However, during the growth process, apples are prone to various diseases that not only affect the quality of the fruit but also significantly reduce the yield, impacting farmers' economic benefits and the stability of market supply. To reduce the incidence of apple diseases and increase fruit yield, developing efficient and fast apple leaf disease detection technology is of great significance. An improved YOLOv8 algorithm was proposed to identify the leaf diseases that occurred during the growth of apples.[Methods]YOLOv8n model was selected to detect various leaf diseases such as brown rot, rust, apple scab, and sooty blotch that apples might encounter during growth. SPD-Conv was introduced to replace the original convolutional layers to retain fine-grained information and reduce model parameters and computational costs, thereby improving the accuracy of disease detection. The multi-scale dilated attention (MSDA) attention mechanism was added at appropriate positions in the Neck layer to enhance the model's feature representation capability, which allowed the model to learn the receptive field dynamically and adaptively focus on the most representative regions and features in the image, thereby enhancing the ability to extract disease-related features. Finally, inspired by the RepVGG architecture, the original detection head was optimized to achieve a separation of detection and inference architecture, which not only accelerated the model's inference speed but also enhanced feature learning capability. Additionally, a dataset of apple leaf diseases containing the aforementioned diseases was constructed, and experiments were conducted.[Results and Discussions]Compared to the original model, the improved model showed significant improvements in various performance metrics. The mAP50 and mAP50:95 achieved 88.2% and 37.0% respectively, which were 2.7% and 1.3% higher than the original model. In terms of precision and recall, the improved model increased to 83.1% and 80.2%, respectively, representing an improvement of 0.9% and 1.1% over the original model. Additionally, the size of the improved model was only 7.8 MB, and the computational cost was reduced by 0.1 G FLOPs. The impact of the MSDA placement on model performance was analyzed by adding it at different positions in the Neck layer, and relevant experiments were designed to verify this. The experimental results showed that adding MSDA at the small target layer in the Neck layer achieved the best effect, not only improving model performance but also maintaining low computational cost and model size, providing important references for the optimization of the MSDA mechanism. To further verify the effectiveness of the improved model, various mainstream models such as YOLOv7-tiny, YOLOv9-c, RetinaNet, and Faster-RCNN were compared with the propoed model. The experimental results showed that the improved model outperformed these models by 1.4%, 1.3%, 7.8%, and 11.6% in mAP50, 2.8%, 0.2%, 3.4%, and 5.6% in mAP50:95. Moreover, the improved model showed significant advantages in terms of floating-point operations, model size, and parameter count, with a parameter count of only 3.7 MB, making it more suitable for deployment on hardware-constrained devices such as drones. In addition, to assess the model's generalization ability, a stratified sampling method was used, selecting 20% of the images from the dataset as the test set. The results showed that the improved model could maintain a high detection accuracy in complex and variable scenes, with mAP50 and mAP50:95 increasing by 1.7% and 1.2%, respectively, compared to the original model. Considering the differences in the number of samples for each disease in the dataset, a class balance experiment was also designed. Synthetic samples were generated using oversampling techniques to increase the number of minority-class samples. The experimental results showed that the class-balanced dataset significantly improved the model's detection performance, with overall accuracy increasing from 83.1% to 85.8%, recall from 80.2% to 83.6%, mAP50 from 88.2% to 88.9%, and mAP50:95 from 37.0% to 39.4%. The class-balanced dataset significantly enhanced the model's performance in detecting minority diseases, thereby improving the overall performance of the model.[Conclusions]The improved model demonstrated significant advantages in apple leaf disease detection. By introducing SPD-Conv and MSDA attention mechanisms, the model achieved noticeable improvements in both precision and recall while effectively reducing computational costs, leading to more efficient detection capabilities. The improved model could provide continuous health monitoring throughout the apple growth process and offer robust data support for farmers' scientific decision-making before fruit harvesting.

Keywords