Cotton pest identification method, system and equipment based on YOLOv5-tin-coton model
By introducing lightweight backbone network, SimAM attention mechanism, BiFPN module and WIOU bounding box loss function in the YOLOv5-tiny-cotton model, and using the EagleEye pruning algorithm, the cotton pest recognition model is optimized, solving the large amount of parameters and scale The difference problem achieves rapid and accurate identification of cotton pests, meeting the real-time needs of field detection.
Patent Information
- Application Number
- CN202311019549.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2024-12-20
AI Technical Summary
The existing target detection model has too large parameters in cotton pest recognition, resulting in poor real-time performance, ignoring the difference in pest scale, reducing the accuracy of small target recognition, and unable to meet the actual field cotton pest recognition needs.
Using cotton pest recognition method based on YOLOv5-tiny-cotton model, the model is optimized to reduce the parameter quantity and the number of parameters and Computation complexity, improve detection accuracy and real-timeness.
It realizes fast and accurate cotton pest identification, significantly improves detection accuracy and real-time performance, and meets the cotton pest target detection needs in actual scenarios.
Smart Images

Figure CN119169597A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of pest detection and relates to a cotton pest identification method, system and equipment based on a YOLOv5-tiny-cotton model. Background Art
[0002] During the entire growth cycle of cotton, it is attacked by many types of pests, which leads to reduced production and even total crop failure, affecting its high quality and high yield development. Traditional pest identification relies heavily on expert knowledge, and cotton pests have a short occurrence cycle and a fast outbreak time. This method is time-consuming and labor-intensive, which seriously affects the production efficiency of cotton. Therefore, understanding the pest types and occurrence scale as early as possible is the key to integrated cotton pest control.
[0003] With the vigorous development of computer software and hardware, deep learning technologies represented by convolutional neural networks have been successfully applied to the field of agricultural pest detection. When performing agricultural pest identification tasks, by finding all pest targets in the image, determining their categories and locations, it plays a decisive role in the subsequent integrated prevention and control of cotton pests.
[0004] The existing target detection model has certain limitations in cotton pest identification. For example, the model structure parameters are too large, resulting in poor real-time target detection and failure to meet the requirements of embedded platform deployment. It also ignores the scale differences of cotton pests, reducing the accuracy of small target pest identification. Therefore, the current target detection model can no longer fully meet the actual cotton pest identification needs in the field. Summary of the invention
[0005] The first purpose of the present invention is to address the above-mentioned problems in the existing technology and propose a cotton pest identification method based on the YOLOv5-tiny-cotton model, which has the function of realizing fast and accurate cotton pest identification.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] The cotton pest identification method based on the YOLOv5-tiny-cotton model is characterized in that it includes:
[0008] Collect cotton pest images, build an initial dataset of cotton pests, annotate the types and locations of cotton pests in the images, and generate a corresponding XML file for each annotated image;
[0009] The annotated initial dataset was divided into training set, validation set and test set in a ratio of 7:2:1 to obtain the cotton pest dataset for subsequent experiments.
[0010] Build a basic YOLOv5 target detection model, including the input end, backbone network, neck network, detection end, and output end:
[0011] The input end includes three modules: Mosaic data enhancement, adaptive anchor box calculation, and adaptive image scaling;
[0012] The backbone network is used to extract image features, mainly including C3 and SPPF modules;
[0013] Based on the extracted cotton pest features, the neck network adopts the FPN+PAN structure, and the fusion module fuses features of different scales to generate feature maps of three different sizes containing multi-scale information;
[0014] The detection end uses three prediction feature layers of different sizes to perform target detection on the input feature map and obtains the prediction results of three feature maps for detecting targets of different scales.
[0015] The output end evaluates the position loss of the prediction box through the output loss function, removes redundant prediction boxes through the NMS algorithm, and completes the target detection.
[0016] The detection performance is improved by combining multiple model optimization strategies, including: using GhostNet to replace the feature extraction part, introducing the SimAM parameter-free attention mechanism in the backbone network, evaluating the importance of neurons through energy functions, increasing the weights of important features, using the BiFPN module to fuse multi-scale features, and using WIOU as the bounding box loss function to build an optimized target detection model.
[0017] Based on the optimized YOLOv5 model, the EagleEye pruning algorithm is used to delete redundant model parameters and establish the YOLOv5-tiny-cotton model to output cotton pest detection results. The EagleEye pruning algorithm process mainly includes three steps: pruning strategy generation, filter pruning, and candidate evaluation module based on adaptive batch normalization.
[0018] The second object of the present invention is to address the above-mentioned problems in the existing technology and propose a cotton pest identification system based on the YOLOv5-tiny-cotton model, which has steps capable of executing the cotton pest identification method.
[0019] The second object of the present invention can be achieved by the following technical scheme: a cotton pest identification system based on the YOLOv5-tiny-cotton model, the system is characterized by comprising:
[0020] A cotton pest image transmission module is used to automatically collect and transmit cotton pest images and construct corresponding data sets based on the collected images;
[0021] The target detection model building module builds a target detection model suitable for pest detection tasks in actual cotton field environments based on the characteristics of the cotton pest dataset;
[0022] The cotton pest identification module is based on the established target detection model, inputs the data set, updates the model parameters through the gradient descent algorithm, determines the optimal configuration parameters of the improved YOLOv5 model, and outputs the final cotton pest category and identification results.
[0023] The third purpose of the present invention is to address the above-mentioned problems in the existing technology and propose a cotton pest identification device based on the YOLOv5-tiny-cotton model, which provides theoretical research and technical support for cotton pest target detection in actual scenarios.
[0024] The third object of the present invention can be achieved by the following technical solutions:
[0025] A cotton pest identification device based on the YOLOv5-tiny-cotton model is characterized by comprising: a memory, a processor, a memory storing computer program instructions, and a non-transitory computer-readable storage medium.
[0026] In the cotton pest identification method, system and device based on the YOLOv5-tiny-cotton model provided by the present invention, a lightweight backbone network is designed for feature extraction, and a SimAM attention mechanism module is added to the backbone network, which greatly reduces the number of parameters while ensuring good detection performance of the model, and ensures the real-time performance of cotton pest detection; further, the BiFPN module is used in the neck structure to enhance the multi-scale cotton pest feature fusion effect, and reduce the probability of missed detection and false detection caused by excessive size differences of cotton pests; in particular, by introducing the WIoU bounding box loss function, the cotton pest target positioning accuracy is effectively improved. The present invention fully considers the problems of difficulty in cotton pest identification and weak real-time performance in actual field environments, and can significantly reduce the model calculation amount while ensuring the excellent detection performance of the model, effectively improve the model detection accuracy and real-time performance, and provide theoretical research and technical support for cotton pest target detection in actual scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a schematic diagram of a process of a cotton pest identification method based on a YOLOv5-tiny-cotton model provided by the present invention;
[0028] Figure 2 It is a diagram of the GhostConv and C3Ghost modules provided by the embodiment of the present invention;
[0029] Figure 3is a diagram of a BiFPN module provided by an embodiment of the present invention;
[0030] Figure 4 It is a diagram of the principle of the bounding box loss function WIOU provided by an embodiment of the present invention;
[0031] Figure 5 is a flow chart of the EagleEye pruning algorithm provided by an embodiment of the present invention;
[0032] Figure 6 is a schematic diagram comparing the cotton pest detection effects of the method provided by an embodiment of the present invention and the existing method;
[0033] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] like Figure 1-5 As shown, the cotton pest identification method based on the YOLOv5-tiny-cotton model is characterized in that it includes:
[0036] S1. Constructing cotton pest dataset
[0037] S101, collecting cotton pest images, including three major cotton pests: cotton aphid, cotton bollworm, and thrips, with an image resolution of 3000*4000 pixels. A total of 6420 cotton pest images were collected, and 4095 usable cotton pest images were obtained after screening.
[0038] S102, labeling the types and positions of cotton pests contained in the image by using Labelmg software, and generating an XML file for each labeled image, which contains information such as image width, height, cotton pest type, labeling frame coordinates, etc.
[0039] S103, dividing the labeled data set into a training set, a validation set, and a test set in a ratio of 7:2:1.
[0040] S2. Build a basic YOLOv5 target detection model
[0041] The basic YOLOv5 target detection model includes the input end, backbone network, neck structure, detection end, and output end.
[0042] The input end includes three modules: Mosaic data enhancement, adaptive anchor box calculation, and adaptive image scaling. Specifically:
[0043] The steps of Mosaic data enhancement include:
[0044] Randomly select four pictures and the coordinates of the picture stitching reference point (x m ,y m );
[0045] Adjust the size and proportion of the four images according to the reference point and place them at the upper left, lower left, upper right, and lower right positions of the large image of the specified size;
[0046] According to the size transformation method of each picture, the mapping relationship is mapped to the picture detection frame;
[0047] Stitch large images and process detection boxes that exceed the boundaries.
[0048] The steps of adaptively calculating anchor boxes include:
[0049] Get the width and height of all images in the cotton pest dataset;
[0050] Scale each image proportionally to the specified size, ensuring that the maximum value of width and height meets the specified image size;
[0051] Change the bounding box from relative coordinates to absolute coordinates according to the width and height of the scaled image;
[0052] Filter bounding boxes and keep those whose width and height are greater than or equal to two pixels;
[0053] Obtain n anchor boxes through the k-means clustering algorithm;
[0054] The width and height of the anchor box are randomly mutated through a genetic algorithm. If the mutation effect is excellent, the anchor box is assigned a value, otherwise it is skipped. The default mutation is 1000 times.
[0055] The steps to adaptively scale an image include:
[0056] Calculate the shrinkage ratio of the original image, take the value with the smallest width and height variation range, and scale the image;
[0057] Calculate the gray pixels that need to be filled, and fill the pixels to the edge with a larger shrinkage ratio.
[0058] The backbone network is used to extract image features and mainly includes C3 and SPPF modules.
[0059] The neck network adopts FPN+PAN structure. The fusion module fuses features of different scales to generate feature maps of three different sizes containing multi-scale information. The FPN structure transmits strong semantic information from top to bottom to enrich image feature information. The PAN structure transmits strong position information from bottom to top to improve positioning accuracy.
[0060] The detection end uses three prediction feature layers of different sizes to perform target detection on the input feature map and obtains the prediction results of three feature maps for detecting targets of different scales.
[0061] The output end evaluates the position loss of the prediction box through the output loss function, removes redundant prediction boxes through the NMS algorithm, and completes the target detection.
[0062] The steps for decoding the prediction results are as follows: based on the first two regression parameters in the prediction results, calculate the central prediction points of the three prior boxes; based on the last two regression parameters in the prediction results, perform exponential operations on the parameters to obtain the width and height of the prediction box.
[0063] The steps of scoring and NMS algorithm for prediction results are as follows: filter prediction frames with scores greater than the confidence value in cotton pest images; perform loop operations on the types to filter out the frames with the largest scores of the same type in a certain area; sort the prediction frames of the type from large to small according to the scores; take the frame with the largest score in each cycle, calculate the degree of overlap with other prediction frames, and remove them if they are too large; obtain the final result to draw the prediction frame.
[0064] The steps to calculate the model loss are as follows:
[0065] Calculate the classification loss L cls , according to the prediction results of the real box and the type of the prior box in the prediction result, the cross entropy loss is calculated as the classification loss result. The cross entropy loss calculation is shown in the second formula:
[0066]
[0067] Where y is the label corresponding to the input sample, and p is the probability that the model predicts that the input sample is a positive sample.
[0068] Calculate the confidence loss L obj , the cross entropy loss is calculated based on the prediction result of whether the feature point contains the object, as the confidence loss. The cross entropy loss calculation is the same as the second formula. At the same time, different weights are given to the prediction feature layers of different sizes, see the third formula:
[0069]
[0070] Calculate the bounding box loss L loc, the WIoU loss function is used to calculate the loss of the real box and the predicted box as the bounding box loss. The definition of the WIoU bounding box loss function is shown in the fourth formula:
[0071] L WIOU =R WIOU L IoU
[0072] in:
[0073]
[0074]
[0075] S u =wh+w gt h gt -W i H i
[0076] Among them, W g ,H g is the width and height of the minimum bounding box. The * operation separates the two values from the calculation graph. x, y, w, h are the center coordinates and width and height of the predicted box. x gt ,y gt ,w gt ,h gt W is the center coordinates, width and height of the real frame. i ,H i Indicates the width of the overlapping area between the bounding box and the ground-truth box. u Indicates the area where the predicted box and the true box do not intersect.
[0077] S3. Optimize based on the established YOLOv5 model
[0078] The detection performance is improved by combining multiple model optimization strategies, including: using GhostNet to replace the feature extraction part, introducing the SimAM parameter-free attention mechanism in the backbone network, using the BiFPN module to fuse multi-scale features, and using WIOU as the bounding box loss function to build an optimized target detection model.
[0079] The steps for lightweight GhostNet network replacement include:
[0080] Use the GhostConv module to replace the CBS module of the original YOLOv5 model backbone network;
[0081] The C3Ghost module is designed to replace the C3 module of the original YOLOv5 model backbone network.
[0082] The SimAM attention mechanism calculation steps include:
[0083] The SimAM attention mechanism evaluates the importance of each neuron by measuring the linear separability between neurons, and uses the energy function according to the first formula. To conduct an assessment:
[0084]
[0085] in:
[0086]
[0087]
[0088] Where t is a neuron; λ is a hyperparameter; x is the neighboring neuron of neuron t; the importance of each neuron is
[0089] The neck structure combined with the BiFPN module information transmission method is as follows:
[0090] Delete nodes that have only one input terminal;
[0091] A set of feature fusion paths are repeatedly adopted from top to bottom and bottom to top;
[0092] Add skip connections to integrate the features extracted by the backbone network into the feature map to be detected;
[0093] A weighting strategy is proposed to learn the importance of different input features.
[0094] S4. Build the YOLOv5-tiny-cotton model
[0095] Based on the optimized YOLOv5 model, the EagleEye pruning algorithm is used to delete redundant model parameters and establish the YOLOv5-tiny-cotton model to output cotton pest detection results. A model compression method based on the EagleEye pruning algorithm is designed to further achieve a balance between model detection accuracy and speed. Considering the application of the YOLOv5-tiny-cotton model in actual cotton pest detection scenarios, the model is further compressed by reducing the number of model parameters and computational complexity while maintaining good model detection performance to meet the needs of resource-constrained hardware devices.
[0096] Specifically,
[0097] The EagleEye pruning algorithm steps are as follows:
[0098] Generates the output pruning strategy in the form of a vector of layer-wise pruning ratios for an L-layer model, L real numbers randomly drawn from a given range [0, R]. R is the maximum pruning rate applied to a layer.
[0099] Prune the YOLOv5-tiny-cotton model according to the pruning strategy generated in the previous step. Sort the filters by their L1 norm values and remove the least important filters.
[0100] Given a pruned network, freeze all learnable parameters and iterate over a small amount of data in the training set to compute μ and σ for the adaptive BN. 2 , the adaptive BN evaluation calculation is shown in the fifth formula:
[0101]
[0102] Among them, β and γ are trainable values, and ε is a decimal to avoid the denominator being 0. For a batch size of N, μ and σ 2 See the sixth formula for the calculation:
[0103]
[0104] During training, μ and σ of Adaptive BN are 2 See the seventh formula for the calculation:
[0105] μ t =mμ t-1 +(1-m)μ B ,
[0106] Where m is the momentum coefficient and the subscript t represents the number of training iterations.
[0107] The following paragraphs provide details of the experimental parameter settings and results of this embodiment.
[0108] The experiments in this invention are all carried out on the same device. The device experimental environment is mainly configured as the operating system Linux, the CPU is Intel (R) Xeon (R) Platinum 8350C, the GPU is RTX 3090 (24GB), the RAM is 43GB, the environment is set to PyCharm2021.2.3, the language is Python 3.8.10, the framework is PyTorch 1.11.0, and the operating platform is CUDA11.3, CUDNN 8.1.1. According to the hardware device configuration, the hyperparameters in the experiment are set as follows: the number of iterations epochs is 100, the batch size banch_size is 32, the optimizer is SGD, the initial learning rate lr0 is 0.01, the learning rate momentum momentum is 0.937, the weight decay coefficient weight_decay is 0.0005, and a single GPU is used to train the model.
[0109] In order to verify the advantages of the pruned YOLOv5-tiny-cotton model in the cotton pest detection task, a comparative experiment was conducted with the advanced target detection model based on a self-built cotton pest dataset, and the model's target detection and positioning capabilities on different cotton pest categories were demonstrated. The following is a summary:
[0110]
[0111] Table 1 Performance comparison of different target detection models
[0112] Specifically, the size of the pruned YOLOv5-tiny-cotton model is 3.4MB, and the mAP is 88.2%, which ensures that the model has good detection performance while reducing the model size. Secondly, 30FPS is generally used as the minimum standard to meet real-time performance. The detection speed of the model proposed in the present invention is 102.0FPS, which exceeds the standard by 240.0%, meeting the real-time requirements of cotton pest detection. The classic target detection network Faster RCNN-ResNet50 is a two-stage network with the ResNet50 network as the backbone network. The overall model has a large weight, slow detection speed, and slightly inferior accuracy to the YOLOv5-tiny-cotton model. Among the remaining single-stage target detection models, the YOLOv4 model has the worst detection performance, especially for small target detection tasks under complex backgrounds. The mAP of this model when detecting cotton aphids is only 47.3%. Furthermore, the present invention uses a Gradient-weighted Class Activation Map (Grad-CAM) to demonstrate the model's attention to different targets and positioning accuracy in complex field scenes. Grad-CAM marks the areas related to the detection results with bright colors. The brighter the color, the higher the correlation with the cotton pest category, providing a visual basis for the model's detection results. Figure 6 It is a comparison chart of pest recognition effects of the method of the embodiment of the present invention and an advanced target detection model.
[0113] In summary, the method described in the present invention can improve the detection speed and accuracy of the cotton pest identification model, and has a good promotion prospect. The proposed method solves the problems of high missed detection and false detection rate of cotton pests, large number of detection model parameters, and weak real-time detection. The practical application of this method is of great significance for farmers to adopt effective pest control strategies in a timely manner, and promote the high-quality development of the cotton industry.
[0114] The cotton pest identification system based on the YOLOv5-tiny-cotton model provided by the present invention is described below, including:
[0115] A cotton pest image transmission module is used to automatically collect and transmit cotton pest images and construct corresponding data sets based on the collected images;
[0116] The target detection model building module builds a target detection model suitable for pest detection tasks in actual cotton field environments based on the characteristics of the cotton pest dataset;
[0117] The cotton pest identification module is based on the established target detection model, inputs the data set, updates the model parameters through the gradient descent algorithm, determines the optimal configuration parameters of the improved YOLOv5 model, and outputs the final cotton pest category and identification results.
[0118] Figure 7 The physical structure diagram of the cotton pest identification device based on the YOLOv5-tiny-cotton model is illustrated, and the device includes: a processor (processor) 710, a communication interface (Communications Interface) 720, a memory (memory) 730 and a communication bus 740. Among them, the processor 710, the communication interface 720, and the memory 730 complete mutual communication through the communication bus 740, and the processor 710 can call the logic instructions in the memory 730 to execute the cotton pest identification method based on the YOLOv5-tiny-cotton model.
[0119] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0120] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the cotton pest identification method based on the YOLOv5-tiny-cotton model provided by the above methods.
[0121] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.
[0122] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A cotton pest identification method based on the YOLOv5-tiny-cotton model is characterized in that: include: S1. Build cotton pest dataset: Collect cotton pest images, build an initial dataset of cotton pests, annotate the types and locations of cotton pests in the images, and generate a corresponding XML file for each annotated image; The annotated initial dataset is divided into training set, validation set and test set in a ratio of 7:2:1; S2. Build the basic YOLOv5 target detection model: The basic YOLOv5 target detection model includes the input end, backbone network, neck network, detection end, and output end: The input end includes three modules: Mosaic data enhancement, adaptive anchor box calculation, and adaptive image scaling; The backbone network is used to extract image features, mainly including C3 and SPPF modules; The neck network adopts FPN+PAN structure, and the fusion module fuses features of different scales to generate feature maps of three different sizes containing multi-scale information; The detection end uses three prediction feature layers of different sizes to perform target detection on the input feature map and obtains the prediction results of three feature maps for detecting targets of different scales. The output end evaluates the position loss of the prediction box through the output loss function, calculates the model output loss, including classification loss, confidence loss and bounding box loss, removes redundant prediction boxes through the NMS algorithm, and completes target detection; S3. Optimize based on the established YOLOv5 model: GhostNet is used to replace the feature extraction part, the SimAM parameter-free attention mechanism is introduced into the backbone network, the BiFPN module is used to fuse multi-scale features, and WIOU is used as the bounding box loss function to build an optimized object detection model; S4. Build the YOLOv5-tiny-cotton model: Based on the optimized YOLOv5 model, the EagleEye pruning algorithm is used to delete redundant model parameters, and the YOLOv5-tiny-cotton model is established to output cotton pest detection results.
2. The cotton pest identification method based on the YOLOv5-tiny-cotton model according to claim 1, characterized in that: In S2, the steps of Mosaic data enhancement include: Randomly select four pictures and the coordinates of the picture stitching reference points; Adjust the size and proportion of the four images according to the reference point and place them at the upper left, lower left, upper right, and lower right positions of the large image of the specified size; According to the size transformation method of each picture, the mapping relationship is mapped to the picture detection frame; Stitch large images and process detection boxes that exceed the boundaries.
3. The cotton pest identification method based on the YOLOv5-tiny-cotton model according to claim 1, characterized in that: In S2, the step of adaptively calculating the anchor frame includes: Get the width and height of all images in the cotton pest dataset; Scale each image proportionally to the specified size, ensuring that the maximum value of width and height meets the specified image size; Change the bounding box from relative coordinates to absolute coordinates according to the width and height of the scaled image; Filter bounding boxes and keep those whose width and height are greater than or equal to two pixels; Obtain n anchor boxes through the k-means clustering algorithm; The width and height of the anchor box are randomly mutated through a genetic algorithm. If the mutation effect is excellent, the anchor box is assigned a value, otherwise it is skipped. The default mutation is 1000 times.
4. The cotton pest identification method based on the YOLOv5-tiny-cotton model according to claim 1, characterized in that: In S2, the step of adaptively scaling the image includes: Calculate the shrinkage ratio of the original image, take the value with the smallest width and height variation range, and scale the image; Calculate the gray pixels that need to be filled, and fill the pixels to the edge with a larger shrinkage ratio.
5. The cotton pest identification method based on the YOLOv5-tiny-cotton model according to claim 1, characterized in that: In S2, the prediction result is decoded as follows: Based on the first two regression parameters in the prediction results, calculate the central prediction points of the three prior boxes; Based on the last two regression parameters in the prediction result, the parameters are exponentially operated to obtain the width and height of the prediction box.
6. The cotton pest identification method based on the YOLOv5-tiny-cotton model according to claim 1, characterized in that: In S2, the steps of scoring and NMS algorithm for predicting results are as follows: Filter the prediction boxes in cotton pest images whose scores are greater than the confidence value; Perform a loop operation on the categories to filter out the boxes with the largest scores for the same category in a certain area; sort the prediction boxes of the category from large to small according to the scores; Take the frame with the largest score in each cycle, calculate the degree of overlap with other predicted frames, and remove it if it is too large; The final result is used to draw the prediction box.
7. The cotton pest identification method based on the YOLOv5-tiny-cotton model according to claim 1, characterized in that: In S4, the EagleEye pruning algorithm steps are as follows: S401, generating an output pruning strategy in the form of a layered pruning ratio vector of an L-layer model, randomly extracting L real numbers from a given range [0, R], where R is the maximum pruning rate applied to a layer; S402, pruning the YOLOv5-tiny-cotton model according to the pruning strategy generated in the previous step, sorting the filters according to their L1 norm values, and deleting the filters with the lowest importance; S403, given a pruned network, freeze all learnable parameters and traverse a small amount of data in the training set.
8. A cotton pest identification system based on the YOLOv5-tiny-cotton model, the system is characterized by: include: A cotton pest image transmission module is used to automatically collect and transmit cotton pest images and construct corresponding data sets based on the collected images; The target detection model building module builds a target detection model suitable for pest detection tasks in actual cotton field environments based on the characteristics of the cotton pest dataset; The cotton pest identification module is based on the established target detection model, inputs the data set, updates the model parameters through the gradient descent algorithm, determines the optimal configuration parameters of the improved YOLOv5 model, and outputs the final cotton pest category and identification results.
9. Cotton pest identification device based on YOLOv5-tiny-cotton model, characterized in that: include: Includes a memory, a processor, a communication interface, and a non-transitory computer-readable storage medium.
Citation Information
Patent Citations
Litchi late autumn shoot detection method based on improved YOLOV5 algorithm and processing terminal
CN115546195A
Fruit tree papilidae pest detection method
CN116012655A
Deep learning-based plant leaf disease detection method, computer equipment and storage medium
CN116030341A
Pest target detection method, system and equipment based on YOLOv5 model
CN116310718A
Agricultural pest image recognition method based on convolutional neural network
CN116543386A
Cited By
Intelligent agricultural management and disease identification method and system
CN122530828A
