Cotton Pest Detection and Insect Resistance Evaluation Method and System Based on YOLO Algorithm

Through the cotton pest detection method based on the YOLO algorithm, the problem of low efficiency and accuracy of cotton field pest detection in the existing technology is solved, efficient and accurate cotton pest detection is achieved, and efficient management of precise agriculture is supported.

CN119625582BActive Publication Date: 2025-05-30SANYA NATIONAL INSTITUTE OF SOUTHERN BREEDING CHINESE ACADEMY OF AGRICULTURAL SCIENCES
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510146893.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-05-30
Estimated Expiration
2045-02-11

AI Technical Summary

Technical Problem

The existing pest detection methods are inefficient and accurate when applied in cotton fields, and cannot meet the needs of large-scale crop pest monitoring and early warning.

Method used

The cotton pest detection method based on the YOLO algorithm is adopted to collect cotton field images through drones, pre-process and label, divide the data sets, train the YOLOv5, YOLOv7, and YOLOv8 models, and determine the final detection model through performance evaluation and optimization.

Benefits of technology

The speed and accuracy of cotton pest detection have been improved, especially in the context of complex cotton fields, the F1 score of the detection model reaches 0.947, realizing precise pest detection in different areas of cotton fields, and supporting efficient management of precision agriculture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625582B_ABST
    Figure CN119625582B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for cotton pest detection and insect resistance evaluation based on the YOLO algorithm. The cotton pest detection method based on the YOLO algorithm includes: Step 11: Using a drone to collect images containing cotton plants over a specified cotton field area; Step 12: Preprocessing and annotating the images collected by the drone to obtain a data set; Step 13: Randomly dividing the data set into a training set, a validation set, and a test set; Step 14: Selecting YOLO series algorithms including YOLOv5, YOLOv7, and YOLOv8, and training them respectively to obtain detection models corresponding to each algorithm; Step 15: Conducting performance evaluation and optimization on the detection models corresponding to each algorithm to determine the final detection model; Step 16: Using the final detection model to detect cotton pests and give detection results. The final detection model determined by the present invention greatly improves the speed and accuracy of cotton pest detection. Especially in the complex cotton field background, the F1 score of the obtained final detection model reaches 0.947.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural intelligence, and particularly relates to a method and system for cotton pest detection and insect resistance evaluation based on the YOLO algorithm. Background Art

[0002] Cotton is an important cash crop in China. During its growth process, it is often invaded by various pests, which in turn leads to a decrease in cotton yield and quality. For pest investigation, traditional methods mainly rely on manual judgment and statistical investigation of the number of larvae. This method is time-consuming and laborious, and has low efficiency, low accuracy, and large errors, and cannot meet the needs of monitoring and early warning of large-scale crop pests. With the development of agricultural intelligence technology, some new pest monitoring and early warning methods have been proposed, such as combining unmanned aerial vehicle (UAV) remote sensing technology and deep learning algorithms for pest monitoring.

[0003] The Chinese invention patent with the application number 202410566242.0 discloses a method for detecting corn leaf diseases and pests based on an improved YOLOv7 model, including collecting images of corn fields by UAVs, annotating the images, and performing data augmentation to expand the number of images. The expanded images are divided into a training set and a validation set in a ratio of 4:1, improving YOLOv7 to obtain an improved YOLOv7 object detection model, training the improved YOLOv7 object detection model, and evaluating the trained YOLOv7 object detection model to obtain the best YOLOv7 object detection model. Using the obtained best YOLOv7 object detection model to detect diseases and pests in corn leaf images. The method for detecting corn leaf diseases and pests based on the improved YOLOv7 model of the invention is applicable to the recognition of small targets with high similarity on the premise of meeting high efficiency and real-time performance, providing a scientific basis and technical support for the prevention and control of corn diseases and pests in agricultural production. However, due to the great differences between corn leaves and cotton leaves, and the great differences in the locations where pests occur, this method cannot be fully applied to the detection of cotton pests. Summary of the Invention

[0004] To solve at least one of the above technical problems, the present invention provides a method and system for cotton pest detection and insect resistance evaluation based on the YOLO algorithm.

[0005] The first aspect of the present invention provides a method for detecting cotton pests based on the YOLO algorithm, including:

[0006] Step 11: Using a UAV to collect images containing cotton plants over a specified cotton field area;

[0007] Step 12: Preprocessing and annotating the images collected by the UAV to obtain a data set;

[0008] Step 13: Randomly divide the dataset into a training set, a validation set, and a test set;

[0009] Step 14: Select YOLO series algorithms including YOLOv5, YOLOv7, and YOLOv8, and train them respectively to obtain the detection models corresponding to each algorithm;

[0010] Step 15: Perform performance evaluation and optimization on the detection models corresponding to each algorithm to determine the final detection model;

[0011] Step 16: Use the final detection model to detect cotton pests and give the detection results.

[0012] Preferably, in Step 11, a drone is used to collect images containing cotton plants at a set height at set time intervals, and the images are saved in a specific format.

[0013] Preferably, in any of the above solutions, in Step 12, the preprocessing of the images collected by the drone includes cropping and rotating the images to ensure the consistency of the image quality.

[0014] Preferably, in any of the above solutions, in Step 12, the preprocessed images are manually labeled using the LabelImg tool, and the labeled categories include two categories: insect and health, to obtain a dataset including pest samples and healthy samples.

[0015] Preferably, in any of the above solutions, in Step 13, the dataset is randomly divided into a training set, a validation set, and a test set in a ratio of 6:2:2.

[0016] Preferably, in any of the above solutions, in Step 14, the YOLOv8 algorithm is improved, including: using the BiFormerBlock module to replace the C2f in the low-level feature extraction module of the Backbone part in YOLOv8, and setting a Patch Embedding module before the BiFormerBlock module in the first stage, and setting a Patch Merging module before the BiFormerBlock module in other stages.

[0017] Preferably, in any of the above solutions, in Step 14, the improvement of the YOLOv8 algorithm further includes: introducing a CAFM (Convolution and Attention Fusion) module in the Head part of the YOLOv8 model.

[0018] Preferably, in any of the above solutions, in step 14, the CAFM module includes a local branch and a global branch. The local branch includes a first dimensionality reduction sub-module, a channel shuffle sub-module, and a first extraction sub-module arranged in sequence. The global branch includes a second dimensionality reduction sub-module, a transposed convolution sub-module, a normalization sub-module, a weighted summation sub-module, and a dimensionality recovery sub-module arranged in sequence. The outputs of the local branch and the global branch are fused and used as the output of the CAFM module.

[0019] Preferably, in any of the above solutions, in step 14, when improving the YOLOv8 algorithm, it further includes: improving the loss function of the Head part to the ECIOU_Loss loss function. The formula of the ECIOU_Loss loss function is:

[0020] ,

[0021] where θ represents the aspect ratio consistency loss, and α represents a weight factor used to adjust the influence of the aspect ratio loss. ρ represents the Euclidean distance between two points. c represents the length of the diagonal of the smallest enclosing box. c h represents the maximum possible height. c w represents the maximum possible width. b represents the center point position of the predicted bounding box. h represents the height of the predicted bounding box. w represents the width of the predicted bounding box. g represents certain parameters of the ground truth bounding box. t represents certain parameters of the target.

[0022] Preferably, in any of the above solutions, in step 14, when improving the YOLOv8 algorithm, it further includes: introducing a PWconv (pointwise convolution) module in the Backbone part to replace the C2f in the high-level feature extraction module.

[0023] Preferably, in any of the above solutions, in step 14, when training each YOLO algorithm, the size of the input image is 640×640 pixels.

[0024] Preferably, in any of the above solutions, in step 14, when training each YOLO algorithm, set each training parameter as follows: the number of training epochs is 300, the batch size is 8, the learning rate is 0.01, the momentum factor is 0.937, and the weight decay is 0.0005.

[0025] Preferably, in any of the above solutions, in step 15, use the F1 score to evaluate the performance of the detection model corresponding to each algorithm, and select the detection model with the highest F1 score as the optimal detection model.

[0026] Preferably, in any of the above solutions, in step 15, the F1 score , where P is the precision, and its calculation formula is , where TP represents the number of true positive samples (correctly predicted positive samples), FP represents the number of false positive samples (wrongly predicted negative samples as positive); R is the recall rate, and its calculation formula is , where TP represents the number of true positive samples (correctly predicted positive samples), FN represents the number of false negative samples (wrongly predicted positive samples as negative).

[0027] Preferably, in any of the above solutions, in step 15, analyze the detection capabilities of the optimal detection model for healthy leaves and pest-infected leaves, identify the differences in the detection capabilities for healthy leaves and pest-infected leaves, and adjust and optimize the model parameters for the category with insufficient detection capabilities to obtain the final detection model.

[0028] The second aspect of the present invention provides a method for evaluating cotton insect resistance, including:

[0029] Step 21: Plant cottons of different materials separately;

[0030] Step 22: For each cotton plant of each material, collect pictures containing the cotton plants at the same time series respectively, and preprocess the pictures;

[0031] Step 23: For each cotton of each material, input the preprocessed pictures at different time points into the final detection model obtained by the cotton pest detection method based on the YOLO algorithm for pest detection to obtain the detection results;

[0032] Step 24: For each cotton of each material, according to its pest detection results, according to the formula

[0033] ,

[0034] calculate the pest degree;

[0035] Step 25: Evaluate the insect resistance of each cotton material according to the pest degree of each cotton material.

[0036] The third aspect of the present invention provides a cotton pest detection and insect resistance evaluation system based on the YOLO algorithm, including a processor and a memory. The memory is used to store computer programs, and the processor is used to run the computer programs to execute the cotton insect resistance evaluation method; the processor is also used to run the computer programs to execute the cotton pest detection method based on the YOLO algorithm in step 23.

[0037] The cotton pest detection and insect resistance evaluation method and system based on the YOLO algorithm of the present invention have the following beneficial effects:

[0038] 1. By comprehensively evaluating and comparing the detection models obtained by the YOLO series algorithms including YOLOv5, YOLOv7, and YOLOv8, the optimal detection model suitable for cotton pests in the complex cotton field background is determined;

[0039] 2. By analyzing the differences in the detection capabilities of the optimal detection model for healthy cotton leaves and pest-infected leaves, the model parameters are adjusted and optimized for the areas with insufficient detection capabilities to obtain the final detection model;

[0040] 3. The final detection model significantly improves the speed and accuracy of cotton pest detection. Especially in the complex cotton field background, the F1 score of the obtained final detection model reaches 0.947;

[0041] 4. A diverse dataset including healthy samples and pest samples of multi-material cotton is constructed, laying a data foundation for subsequent other cotton-related research;

[0042] 5. The final detection model established by the cotton pest detection method based on the YOLO algorithm is used to evaluate the insect resistance of multi-material cotton, which can accurately reflect the severity of the pest damage to different material cotton samples, and thus provide data support for its insect resistance evaluation;

[0043] 6. It can achieve precise pest detection for different areas of the cotton field, thus providing the possibility for area spraying in the cotton field, reducing the risk of environmental pollution, providing reliable technical support for precision agriculture, and helping to promote the efficient management of cotton production;

[0044] 7. According to the characteristics of cotton leaves, the YOLOv8 algorithm model is improved to make it more suitable for cotton leaves. Description of the Drawings

[0045] Figure 1 It is a schematic flowchart of a preferred embodiment of the cotton pest detection method based on the YOLO algorithm according to the present invention.

[0046] Figure 2The overall structural schematic diagram of the improved YOLOv8 algorithm in the embodiment as shown in the cotton pest detection method based on the YOLO algorithm according to the present invention. Figure 1 As shown.

[0047] Figure 3 The overall structural schematic diagram of the improved YOLOv8 algorithm in the embodiment as shown in the cotton pest detection method based on the YOLO algorithm according to the present invention. Figure 1 The structural schematic diagram of the BiFormerBlock module used in the improved YOLOv8 algorithm in the embodiment as shown.

[0048] Figure 4 The overall structural schematic diagram of the improved YOLOv8 algorithm in the embodiment as shown in the cotton pest detection method based on the YOLO algorithm according to the present invention. Figure 1 The structural schematic diagram of the CAFM module used in the improved YOLOv8 algorithm in the embodiment as shown.

[0049] Figure 5 The overall structural schematic diagram of the improved YOLOv8 algorithm in the embodiment as shown in the cotton pest detection method based on the YOLO algorithm according to the present invention. Figure 1 The structural schematic diagram of the PWconv module used in the improved YOLOv8 algorithm in the embodiment as shown.

[0050] Figure 6 The schematic diagram of the work flow of a preferred embodiment of the cotton insect resistance evaluation method according to the present invention.

[0051] Figure 7 The cotton leaf detection result diagram of the first material cotton at a certain time point output by the embodiment as shown in the cotton insect resistance evaluation method using the present invention. Figure 6 As shown.

[0052] Figure 8 The cotton leaf detection result diagram of the second material cotton at a certain time point output by the embodiment as shown in the cotton insect resistance evaluation method using the present invention. Figure 6 As shown.

[0053] Figure 9 The cotton leaf detection result diagram of the third material cotton at a certain time point output by the embodiment as shown in the cotton insect resistance evaluation method using the present invention. Figure 6 As shown.

[0054] Figure 10 The cotton leaf detection result diagram of the fourth material cotton at a certain time point output by the embodiment as shown in the cotton insect resistance evaluation method using the present invention. Figure 6 As shown.

[0055] Figure 11 The cotton leaf detection result diagram of the fifth material cotton at a certain time point output by the embodiment as shown in the cotton insect resistance evaluation method using the present invention. Figure 6 As shown. Detailed implementation manners

[0056] To better understand the present invention, the following will describe the present invention in detail with reference to specific embodiments.

[0057] Embodiment 1

[0058] As Figure 1 shown, a cotton pest detection method based on the YOLO algorithm includes:

[0059] Step 11: Use a drone to collect images containing cotton plants over a designated cotton field area;

[0060] Step 12: Preprocess and annotate the images collected by the drone to obtain a dataset;

[0061] Step 13: Randomly divide the dataset into a training set, a validation set, and a test set;

[0062] Step 14: Select YOLO series algorithms including YOLOv5, YOLOv7, and YOLOv8, and train them respectively to obtain detection models corresponding to each algorithm;

[0063] Step 15: Evaluate and optimize the performance of the detection models corresponding to each algorithm to determine the final detection model;

[0064] Step 16: Use the final detection model to detect cotton pests and give the detection results.

[0065] In Step 11, use a drone to collect images containing cotton plants at a set height at a set time interval, and save the images in a specific format. In this embodiment, preferably, a DJI Mavic 3M drone is used to collect images containing cotton plants. The flight height of the drone is set to 6 meters, the photo-taking interval is set to 2 seconds, and the image saving format is PNG format. It should be noted that the above parameters for the drone to collect images are only listed exemplarily and are not restrictive. In actual applications, adaptive adjustments can be made.

[0066] In Step 12, preprocessing the images collected by the drone includes cropping and rotating the images to ensure the consistency of image quality. The preprocessed images are manually annotated using the LabelImg tool. The annotation categories include insect (pest) and health (healthy), and a dataset including pest samples and healthy samples is obtained. In this embodiment, a dataset including 32,994 pest samples and 16,575 healthy samples is obtained.

[0067] In Step 13, the dataset is randomly divided into a training set, a validation set, and a test set according to a ratio of 6:2:2.

[0068] To better adapt to the detection of cotton leaf pests, in step 14, the YOLOv8 algorithm was specifically improved. The overall structure of the improved YOLOv8 algorithm is as Figure 2 shown, and the specific improvements include the following aspects.

[0069] The first aspect of the improvement is to use the BiFormerBlock module to replace the C2f in the low-level feature extraction module of the Backbone part in YOLOv8, and set the Patch Embedding module before the BiFormerBlock module in the first stage, and set the Patch Merging module before the BiFormerBlock module in other stages. The theoretical structure of the BiFormerBlock module is as Figure 3 shown on the left side of the dotted line. The input image is divided into multiple small blocks by the Patch Embedding module and embedded into a feature space, and then features are gradually extracted through multiple stages. After each stage, the resolution of the image decreases and the number of channels increases. The specific structure of the BiFormerBlock module is shown in Figure 3 the right side of the dotted line. It combines double-level routing attention and depth convolution, and the residual link and MLP also improve the performance of the neural network. Through this improvement, the accuracy of local feature extraction of the image can be maintained, and the global feature modeling ability can be enhanced. In this embodiment, preferably, as Figure 2 shown, the BiFormerBlock module is used to replace the C2f in the feature extraction modules of the first and second stages in the Backbone part of YOLOv8.

[0070] The second aspect of the improvement is to introduce the CAFM (Convolution and Attention Fusion) module into the Head part of the YOLOv8 algorithm. The CAFM module includes a local branch and a global branch. The local branch includes a first dimensionality reduction sub-module, a channel shuffle sub-module, and a first extraction sub-module arranged in sequence; the global branch includes a second dimensionality reduction sub-module, a transposed convolution sub-module, a normalization sub-module, a weighted sum sub-module, and a dimensionality recovery sub-module arranged in sequence; the outputs of the local branch and the global branch are fused and used as the output of the CAFM module.

[0071] Specifically, as Figure 4As shown in the figure, in the local branch, the input first undergoes dimensionality reduction through a 1×1 convolution (i.e., the first dimensionality reduction sub-module is implemented using a 1×1 convolution), then enhances the information interaction between different channels through the channel shuffle sub-module, and further extracts features through a 3×3 convolution (i.e., the first feature extraction sub-module is implemented using a 3×3 convolution). In the global branch, first, after the input undergoes dimensionality reduction through a 1×1 convolution (i.e., the second dimensionality reduction sub-module is also implemented using a 1×1 convolution), query vector Q, key vector K, and value vector V are respectively generated through three 3×3 transposed convolutions (i.e., the transposed convolution sub-module); then, after calculating the attention map using the query vector Q and the key vector K, the normalization sub-module (using Softmax) is used for normalization to obtain the normalized attention map, and the normalized attention map and the value vector V are weighted and summed through the weighted sum sub-module to obtain the global feature; finally, a 1×1 convolution (i.e., the dimensionality restoration sub-module is implemented using a 1×1 convolution) is used to restore the dimension. After completing a series of operations on the local branch and the global branch, the features obtained from the local branch and the global branch are fused through a residual connection to obtain the final output feature of the CAFM module.

[0072] This improvement combines the advantages of convolutional neural networks and attention mechanisms, can simultaneously capture the local details and global context information of the input image, effectively model the local and global features of the image, and improve the detection effect.

[0073] The third aspect of the improvement is to improve the loss function of the Head part of the YOLOv8 algorithm to the ECIOU_Loss loss function. The formula of the ECIOU_Loss loss function is:

[0074] ,

[0075] Among them, θ represents the aspect ratio consistency loss, and α represents the weight factor used to adjust the influence of the aspect ratio loss. ρ represents the Euclidean distance between two points. c represents the diagonal length of the smallest enclosing box. c h represents the maximum possible height. c w represents the maximum possible width. b represents the center point position of the predicted bounding box. h represents the height of the predicted bounding box. w represents the width of the predicted bounding box. g represents some parameters of the ground truth bounding box. t represents some parameters of the target.

[0076] The ECIOU_Loss loss function combines the CIOU and EIOU loss functions. On the basis of the CIOU loss function, it further considers the direct regression of the aspect ratio, improving the accuracy of bounding box regression.

[0077] The fourth aspect is improved by introducing a PWconv (pointwise convolution) module in the Backbone part of the YOLOv8 algorithm to replace C2f in the high-level feature extraction module. The structure of the PWconv module is as Figure 5 shown. Through this improvement, a more lightweight cotton pest detection model based on YOLOv8 can be obtained. At the same time, the feature extraction efficiency and global modeling ability of the obtained model are improved, and the computational complexity is also reduced. Preferably, in this embodiment, as Figure 2 shown, C2f in the feature extraction modules of the third and fourth stages in the Backbone part of the YOLOv8 algorithm is replaced with a PWconv module. It should be noted that in Figure 2 the PWconv module is denoted as PW-COTT.

[0078] The computational amount FLOPs and memory access amount Memory Access of the input feature map through the operation of the PWconv module can be respectively expressed as:

[0079] FLOPs = H × W × C in × C out;

[0080] Memory Access = H × W × C in + H × W × C out + C in × C out .

[0081] After the improvement, compared with the 3×3 convolution, the computational amount FLOPs of the PWconv module operation is reduced by 3 2 = 9 times; and the memory access amount no longer depends on the computational amount factor, thereby significantly reducing the access amount of the convolution kernel weights.

[0082] In step 14, when training each YOLO algorithm, the size of the input image is 640×640 pixels, and each training parameter is set as follows: the number of training epochs is 300, the batch size is 8, the learning rate is 0.01, the momentum factor is 0.937, and the weight decay is 0.0005. Specifically, by setting the above training parameters for YOLOv5, YOLOv7, and YOLOv8, and training with the same training set, the detection models corresponding to YOLOv5, YOLOv7, and YOLOv8 are respectively obtained.

[0083] In step 15, the F1 score is used to evaluate the performance of the detection models corresponding to each algorithm, and the detection model with the highest F1 score is selected as the optimal detection model. The F1 score , where PFor precision, its calculation formula is , where TP represents the number of true positive samples (correctly predicted positive samples), FP represents the number of false positive samples (wrongly predicted negative samples as positive); R For recall rate, its calculation formula is , where TP represents the number of true positive samples (correctly predicted positive samples), FN represents the number of false negative samples (wrongly predicted positive samples as negative). In this embodiment, after evaluation, the detection model obtained by the YOLOv8 algorithm has the highest F1 score of 0.947. Therefore, the detection model obtained by the YOLOv8 algorithm is selected as the optimal detection model. Analyze the detection capabilities of the optimal detection model for healthy leaves and pest-infected leaves, identify the differences in the detection capabilities for healthy leaves and pest-infected leaves, and adjust and optimize the model parameters for the categories with insufficient detection capabilities to obtain the final detection model. In this embodiment, since the characteristics of healthy leaves are relatively less obvious compared to those of pest-infected leaves, the detection ability of the optimal detection model for healthy leaves is slightly worse. Through parameter adjustment and optimization, while ensuring the detection ability for pest-infected leaves, the detection ability for healthy leaves is improved.

[0084] In step 16, use the final detection model to detect cotton pests and give the detection results. Specifically, when detecting cotton pests, it can respectively output the annotation results of "insect" and "health" and the corresponding confidence levels for the input pictures, and then the number of pest-infected leaves and healthy leaves in the input pictures can be obtained. Furthermore, according to the formula: , calculate the pest degree of the input picture.

[0085] Through this method, the images of each region of a certain cotton field collected can be input into the final detection model, and then the pest degrees of each region of the cotton field can be obtained. Furthermore, precise pest detection for different regions of the cotton field can be achieved. Further, spraying can be carried out only for the regions with a high pest degree, reducing the risk of environmental pollution and providing reliable technical support for precision agriculture, which helps to promote the efficient management of cotton production.

[0086] Embodiment 2

[0087] As Figure 6 shown, a method for evaluating cotton insect resistance includes:

[0088] Step 21: Plant cottons of different materials separately;

[0089] Step 22: For each cotton plant of each material, collect pictures containing the cotton plants at the same time series respectively and preprocess the pictures;

[0090] Step 23: For the cotton of each material, input the preprocessed pictures at different time points into the final detection model obtained by the cotton pest detection method based on the YOLO algorithm for pest detection to obtain the detection results;

[0091] Step 24: For the cotton of each material, according to its pest detection results, according to the formula

[0092] ,

[0093] calculate the pest degree;

[0094] Step 25: Evaluate the insect resistance of the cotton of each material according to the pest degree of the cotton of each material.

[0095] Specifically, in Step 22, N (N≥10) pictures of the cotton plants of each material can be collected every 7 days from the emergence of the cotton plants to before boll opening, and the collected pictures can be processed.

[0096] In Step 23, the corresponding detection results are obtained according to each picture. Figure 7 , Figure 8 , Figure 9 , Figure 10 , Figure 11 are the detection result diagrams of cotton leaves of different materials (the first to the fifth materials) at a certain time point.

[0097] In Step 24, for the cotton of each material, the sum of the number of pest-infected leaves and the total number of leaves detected in all pictures collected at the same time point can be determined first. According to the pest degree calculation formula, the pest degree at each time point can be calculated, and finally the time series of the pest degree is used as the pest degree data of the cotton of this material; it is also possible to obtain the pest degree data of each picture at the same time point for each picture collected at each time point, and then perform corresponding operations (such as taking the maximum value operation, taking the average value operation, taking the weighted average value operation, taking the median operation, etc.) to determine the pest degree at each time point, and finally the time series of the pest degree is used as the pest degree data of the cotton of this material; it is also possible to determine the pest degree data of the cotton of each material by other operation methods according to the pest degree obtained from each picture as needed. This application does not make specific restrictions.

[0098] In Step 25, according to the finally determined pest degree data of the cotton of each material, it can be generally determined which material of cotton has the best insect resistance, and it can also be evaluated whether the insect resistance of the cotton of each material is consistent during the growth period of the cotton, etc.

[0099] In this embodiment, after detecting cotton of five materials, it is found that for most of the cotton materials, the value of the pest damage degree ranges between 0.6 and 0.9, reflecting the widespread existence of pests. However, for the cotton of a certain material, the value of the pest damage degree changes slightly around 0.4, indicating that the cotton of this material has excellent pest resistance and good consistency of pest resistance during the entire evaluation period.

[0100] Embodiment 3

[0101] A cotton pest detection and pest resistance evaluation system based on the YOLO algorithm includes a processor and a memory. The memory is used to store a computer program, and the processor is used to run the computer program to execute the cotton pest resistance evaluation method described in Embodiment 2. The processor is also used to run the computer program to execute the cotton pest detection method based on the YOLO algorithm in step 23.

[0102] 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 foregoing embodiments have described the present invention in detail, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features, and these replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present invention.

Claims

1. A cotton pest detection method based on the YOLO algorithm, comprising: Step 11: Use a drone to collect images containing cotton plants over the designated cotton field area; Step 12: Preprocess and annotate the images collected by the drone to obtain a data set; Step 13: Randomly divide the data set into training set, validation set and test set; It is characterized by further comprising: Step 14: Select the YOLO series algorithms including YOLOv5, YOLOv7, and YOLOv8, and train them respectively to obtain the detection models corresponding to each algorithm; Step 15: Evaluate and optimize the performance of the detection model corresponding to each algorithm to determine the final detection model; Step 16: Using the final detection model, detect cotton pests and give the detection results; In step 14, the YOLOv8 algorithm is improved, including: using the BiFormerBlock module to replace the C2f in the feature extraction module of the first and second stages in the Backbone part of YOLOv8, and setting the Patch Embedding module before the BiFormerBlock module of the first stage, and setting the Patch Merging module before the BiFormerBlock modules of other stages; introducing the PWconv module to replace the C2f in the feature extraction module of the third and fourth stages in the Backbone part; introducing the CAFM module in the Head part of the YOLOv8 model, and the CAFM module is set between the Conv layer and the Conv2d layer in the Head part.

2. The cotton pest detection method based on the YOLO algorithm as claimed in claim 1, characterized in that: The CAFM module includes a local branch and a global branch. The local branch includes a first dimensionality reduction submodule, a channel shuffling submodule and a first extraction submodule which are arranged in sequence; the global branch includes a second dimensionality reduction submodule, a deconvolution submodule, a normalization submodule, a weighted summation submodule and a dimension recovery submodule which are arranged in sequence; the output of the local branch and the output of the global branch are fused as the output of the CAFM module.

3. The cotton pest detection method based on the YOLO algorithm as claimed in claim 2, characterized in that: In step 14, the YOLOv8 algorithm is improved, and the improvement also includes: improving the loss function of the Head part to the ECIOU_Loss loss function, and the formula of the ECIOU_Loss loss function is: , Among them, θ represents the aspect ratio consistency loss, α represents the weight factor, which is used to adjust the influence of the aspect ratio loss. ρ represents the Euclidean distance between two points, c represents the minimum diagonal length of the enclosing box, c h Indicates the height of the minimum bounding box covering the predicted box and the true box. c w Indicates the width of the minimum bounding box covering the predicted box and the true box. b Indicates the center point position of the prediction box, h Represents the height of the prediction box, w Indicates the width of the prediction box, b gt Indicates the center point position of the real frame, h gt Indicates the height of the real frame, w gt Indicates the width of the real box.

4. The cotton pest detection method based on the YOLO algorithm as claimed in claim 1, characterized in that: In step 14, when training each YOLO algorithm, the size of the input image is 640×640 pixels; the training parameters are set as follows: 300 training rounds, 8 batch size, 0.01 learning rate, 0.937 momentum factor, and 0.0005 weight decay.

5. The cotton pest detection method based on the YOLO algorithm as claimed in claim 1, characterized in that: In step 15, the F1 score is used to evaluate the performance of the detection models corresponding to each YOLO algorithm, and the detection model with the highest F1 score is selected as the optimal detection model; the F1 score ,in P is the accuracy, and its calculation formula is ,in TP represents the number of true positive samples, FP represents the number of false positive samples; R is the recall rate, and its calculation formula is ,in TP represents the number of true positive samples, FN Represents the number of false negative samples.

6. The cotton pest detection method based on the YOLO algorithm as claimed in claim 5, characterized in that: In step 15, the detection capability of the optimal detection model for healthy leaves and insect-infested leaves is analyzed, the difference in detection capability for healthy leaves and insect-infested leaves is identified, and the model parameters are adjusted and optimized for the categories with insufficient detection capability to obtain the final detection model.

7. A method for evaluating insect resistance of cotton, characterized in that: include: Step 21: Plant cotton of different materials separately; Step 22: for each material of cotton plants, collect pictures containing cotton plants according to the same time sequence, and pre-process the pictures; Step 23: for each material of cotton, the preprocessed images at different time points are respectively input into the final detection model obtained in the cotton pest detection method based on the YOLO algorithm as described in any one of claims 1 to 6 to perform pest detection and obtain detection results; Step 24: For each type of cotton, according to its pest detection results, follow the formula Calculate the extent of pest infestation; Step 25: Evaluate the insect resistance of each material of cotton based on the degree of insect infestation of each material of cotton.

8. A cotton pest detection and insect resistance evaluation system based on the YOLO algorithm, comprising a processor and a memory, wherein the memory is used to store a computer program, characterized in that: The processor is used to run the computer program to execute the cotton insect resistance evaluation method as claimed in claim 7.

9. The cotton pest detection and insect resistance evaluation system based on the YOLO algorithm as claimed in claim 8, characterized in that: The processor is also used to run the computer program to execute the cotton pest detection method based on the YOLO algorithm in step 23.

Citation Information

Patent Citations

  • A corn leaf disease and insect pest detection method based on improved YOLOv7 model

    CN118172690B

  • Target detection method for YOLOv8 partial convolutional network

    CN117173395A

  • Improved insulator spontaneous explosion detection method based on YOLOv8

    CN117456380A

  • Visual identification method for pipe gallery bolt missing under condition of mobile shooting of robot

    CN118918364A