# Research on Identification Technology of Field Pests with Protective Color Characteristics
## 2 Materials and Methods
### Pest Identification Model  
There are many kinds of target detection algorithms based on deep learning, and YOLO (You Only Look Once) is one of the most advanced target detection methods [41]. Different from the target detection algorithm based on region prediction, YOLO directly extracts features from the network to predict object classification and location. In this study, the prediction size of a fixed format was obtained to make the convolutional neural network traverse the whole image. Firstly, the image was adjusted to a fixed size of 416 \(\times\) 416 and then divided into 13 \(\times\) 13 nonoverlapping grid cells. Next, B possible bounding boxes and confidence were detected for each cell, including 5 prediction parameters: x, y, w, h, and confidence. Among them, (x, y) represents the coordinates of the target, (w, h) indicates the width and height of the outer rectangle of the target, and the confidence is used to trade off the prediction results through the threshold [42].  
Compared with YOLOv1, YOLOv2 improves the performance of the model by referring to anchors [43]. In YOLOv3, multi-dimensional anchors and residual networks are  
Figure 4: Pest images in different states. (**a**) Crouching pests, (**b**) Extended pest, (**c**) A pest, (**d**) Multiple pests, (**e**) Unobstructed pests, (**f**) Sheltered pests, (**g**) Pest on the left side of the image, (**h**) Pest in the middle of the image.  
Figure 5: Data enhanced pest image. (**a**) Image rotation, (**b**) image flip, (**c**) image translation, and (**d**) change the brightness of the image.  
used to further improve the performance of the model [44]. In YOLOv4, the Backbone network adopts CSPDarknet53 (Cross Stage Partial), while PANet (Path Aggregation Network) and SPP-Net (Spatial Pyramid Pooling Network) are introduced to adapt to the input of different sizes [45]. In YOLOv5, Mosaic data enhancement, adaptive anchor, and adaptive picture scaling are employed in the input. The Backbone network can quickly extract the features of the target adopts through Focus and CSPNet (Cross Stage Partial Network). In the Neck network, FPN (Feature Pyramid Network) and PANet are used for multi-scale fusion of the extracted features. Besides, GIoU_Loss (Generalized Intersection over Union) is used as the loss function of the target detection frame in the output. The NMS (Non-maximum suppression) is introduced to filter out the overlapping candidate frames and obtain the best prediction output. These improvements ensure the accuracy and speed of YOLOv5 on small targets. Additionally, YOLOv5 has advantages such as shallow structure, small weight file, and relatively low requirements for equipment configuration [46]. The structure of YOLOv5 is illustrated in Figure 6. The CBL module is composed of Convolution layer, BN (Batch Norm) layer and Leaky_relu activation function, and it is a basic convolution module. The BottleneckCSP module mainly performs feature extraction on the feature map and extracts rich information from the image [47].  
YOLOv5 forms different models with different parameters by adjusting the depth and width of the BottleneckCSP module: YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x. With the deepening and widening of the network, the ability of the network to feature extraction and feature fusion is enhanced by sacrificing speed. In YOLOv5, the detection speed of YOLOv5s is the fastest, and the precision of YOLOv5x is the highest. Comprehensively considering the complexity and variability of field pest identification and the needs of practical application scenarios, the requirements for the detection speed of YOLOv5 are relatively higher than the requirements for identification accuracy. Therefore, YOLOv5l guaranteeing both speed and identification accuracy is selected to achieve pest identification with protective color characteristics.  
Figure 6: YOLOv5 structure.