Plant pests and diseases are important parts of insect disease control and the high-quality development of agriculture. Traditional methods for identifying plant diseases and pests suffer from low accuracy and slow speed, while the existing machine learning methods are constrained by environmental and technological factors, leading to low recognition efficiency. To address the issue of the above problems, this paper has proposed an intelligent recognition algorithm based on the improved YOLOv8 model, which has high recognition accuracy and speed. Firstly, in the Backbone network, the Global Attention Mechanism (GAM) is adopted to weigh the important feature information, thereby improving the accuracy of the model. Secondly, in the mixed feature part of the Neck network, the Receptive-Field Attention Convolutional (RFA Conv) operation is used instead of standard convolution operations to enhance the processing ability for feature information and to reduce computational complexity and costs, thus improving the network performance. After verifying the rice and cotton datasets, the accuracy indicator mean average precision (mAP) reaches 71.27% and 82.91%, respectively, in the two different datasets. Comparing these indices with those of the Faster R-CNN, YOLOv7, and the original YOLOv8 model, the results fully demonstrate the effectiveness and superiority of the improved model in terms of detection accuracy.