# Research on Intelligent Recognition for Plant Pests and Diseases Based on Improved YOLOv8 Model
## 3 Algorithm Optimization  
To solve the problem of the YOLOv8 model in the application of plant pests and diseases recognition, this paper proposes the improved YOLOv8 model to enhance the comprehensive performance in the recognition of plant pests and diseases. The improved YOLOv8 model is shown in Figure 4. In the original YOLOv8 model, this paper introduces improvements in the following areas. Firstly, in the Backbone network, after the SPPF module and before the output feature, the GAM is adopted to weigh the important feature information, improving the accuracy of the model. Secondly, in the mixed feature part  
Figure 3: C2f module network structure. Figure 2: SPPF module. of the Neck, the RFA Conv method is used instead of standard convolution operations to enhance the processing ability of feature information. Thirdly, in terms of datasets, a comprehensive dataset containing various representative plant diseases and pests is constructed to enhance the applicability of the model. (1) GAM  
In tasks such as target detection and image classification, the attention mechanism can improve the ability of the model to locate and recognize important features in images of the model, thereby enhancing detection accuracy. Inspired by human attention, the attention mechanism aims to mimic how the human brain processes key areas in images. Its primary goal is to select target information crucial for the current task from a plethora of information, focus on it, and ignore the background areas that do not match the target features, thereby saving computational resources and improving computational efficiency [25]. At present, the attention mechanism is mainly divided into spatial attention and channel attention. Space attention can improve the accuracy of model positioning and identification in the important areas. Channel attention can enhance the speed and accuracy and the relationship between different channels. In the target detection task, applying spatial attention and channel attention to the outputs of the convolution layer can yield more precise feature information representations. Traditional SE attention mechanisms [26], through learning adaptive channel weights, pay more attention to crucial channel information. Nevertheless, they only consider the attention of the channel dimension, thus they are unable to capture the attention in the spatial dimension, limiting their applicability. The CBAM [27], combining with the convolution and attention mechanism, can pay attention to images from both dimensions of space and channel, but it comes with higher computational complexity. The GAM improves the performance of deep neural networks by reducing information and amplifying overall interaction representations. The introduction of this optimization  
Figure 4: Improved YOLOv8 network structure. algorithm is based on the proposal of the first-order smoothness theory. Compared to zero-order smoothness, first-order smoothness focuses on the norm of the maximum gradient within the parameter neighborhood, making it more capable of capturing the trend of loss changes. Therefore, the GAM optimizes both prediction errors and the norm of the maximum gradient within the neighborhood during training in Figure 5. Like CBAM, GAM uses space attention and channel attention but handles these dimensions differently. In terms of channel attention, first, it transforms the input feature diagram, passes it through an MLP, and then restores it to the original dimension, and finally performs a Sigmoid function for output. In terms of spatial attention, the GAM first reduces the number of channels by using a convolutional kernel of size 7 to reduce the calculation amount. Then, it undergoes another convolutional operation with a kernel size of 7 to increase the number of channels, maintaining the consistency of the number of channels.