Abstract:Rice diseases and pests have posed a serious threat to agricultural production in recent years. Particularly, false and missed detections have been caused by the diversity, scale, and complex growth environments of these pests. This study aims to enhance the detection accuracy of rice diseases and pests, in order to facilitate the deployment of detection models on edge devices. An improved YOLOv8-based model was developed to detect rice diseases and pests. Several innovations were also incorporated to optimize the performance of the model. Firstly, partial convolution (PConv) was introduced to design the PCBlock structure and then integrated into the feature extraction module of YOLOv8. As such, the module of lightweight feature extraction known as C2f-PCBlock significantly reduced the number of model parameters, thereby enhancing the detection speed without compromising accuracy. The complexity of the model was then reduced to deploy on the resource-constrained edge devices. Secondly, the semantic information was diluted to cause the feature fusion across non-adjacent layers. A balanced Feature fusion layer was then added to the neck network. feature pyramid networks (FPN) was restructured into balanced feature pyramid (BFP). The preservation of critical features was improved during fusion. Additionally, the embedded Gaussian non-local attention (EGNA) mechanism was incorporated to mitigate the aliasing behavior from the multi-layer feature fusion. The important features were retained to reduce the loss of information, leading to more accurate detections. The loss function of the model was also enhanced to replace the standard IoU-based loss with MPDIoU. The distortions were avoided in the detection bounding boxes, due to the significant variations in sample sizes. MPDIoU was used to reduce these distortions for less computational burden, indicating more efficient training. Extensive experiments were conducted on a rice pest and disease dataset. The results demonstrate that the improved model, named PBM-YOLOv8, outperformed the rest. Specifically, PBM-YOLOv8 was achieved in the precision rate of 6.1, 8.0, 4.2, 1.3, and 1.9 percentage points higher than Fast R-CNN, SSD, YOLOv5n, YOLOv8n, and YOLOv9t, respectively. The recall rates were also significantly improved, with an increase of 7.1, 8.4, 5.6, 2.8, and 3.2 percentage points, respectively. Furthermore, the mean average precision (mAP) values were 5.7, 7.3, 3.8, 1.1, and 1.5 percentage points higher than those of the compared models, respectively. PBM-YOLOv8 was selected as a leading model, in terms of detection accuracy. Moreover, the PBM-YOLOv8 model was highly efficient with only 4.8M parameters, which was far less than the 41.3M of Fast R-CNN and the 15.6 M of SSD. A high processing speed was maintained with an FPS of about 92, in order to balance the accuracy with computational efficiency. The effectiveness of the improved model was further validated. PBM-YOLOv8 was deployed on the RK3588 embedded board. The deployment showed an accelerated detection speed of 71.4 frames per second, with an average accuracy of 95.1%. This performance can fully meet the demands of practical applications, thus enabling real-time and accurate detection of rice pests and diseases. The multi-thread optimization was adopted in the deployment. The parallel acceleration of multi-core NPU was also realized for the model inference and CPU for post-processing. The model has further enhanced the efficiency and feasibility for real-world use.