Cotton pest detection and pest resistance evaluation method and system based on YOLO algorithm

The YOLO algorithm-based cotton pest detection method addresses inefficiencies in existing technologies by optimizing YOLOv5, YOLOv7, and YOLOv8 models with specific enhancements for cotton fields, achieving high accuracy and efficiency in pest detection and evaluation, supporting precise agricultural management.

CN119625582AActive Publication Date: 2025-03-14SANYA NATIONAL INSTITUTE OF SOUTHERN BREEDING CHINESE ACADEMY OF AGRICULTURAL SCIENCES

Patent Information

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

AI Technical Summary

Technical Problem

Current methods for detecting cotton pests are inefficient, inaccurate, and unsuitable for large-scale monitoring due to reliance on manual judgment and are not adaptable for cotton fields, as they were developed for similar crops like corn and do not account for the unique characteristics of cotton leaves and pest locations.

Method used

A method using the YOLO algorithm for cotton pest detection involving image collection by drones, preprocessing, and model training with YOLOv5, YOLOv7, and YOLOv8 algorithms, with improvements such as BiFormerBlock, CAFM, and PWconv modules, to create an optimized detection model for cotton leaf images, enabling precise pest identification and evaluation.

Benefits of technology

The method significantly enhances the speed and accuracy of cotton pest detection, achieving an F1 score of 0.947, providing a reliable basis for cotton pest management and reducing environmental impact through precise targeting of pest areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625582A_ABST
    Figure CN119625582A_ABST
Patent Text Reader

Abstract

The invention provides a cotton pest detection and pest resistance evaluation method and system based on a YOLO algorithm, and the method comprises the steps: 11, collecting an image containing a cotton plant above a designated cotton field region through an unmanned plane; 12, preprocessing and labeling the image acquired by the unmanned aerial vehicle to obtain a data set; 13, randomly dividing the data set into a training set, a verification set and a test set; step 14, selecting a YOLO series algorithm including YOLOv5, YOLOv7 and YOLOv8, and respectively training to obtain a detection model corresponding to each algorithm; 15, performing performance evaluation and optimization on the detection model corresponding to each algorithm, and determining a final detection model; and step 16, detecting the cotton pests by adopting the final detection model, and giving out a detection result. The final detection model determined by the method greatly improves the speed and accuracy of cotton pest detection, and especially under the background of a complex cotton field, the F1 score of the 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 in particular to a cotton pest detection and insect resistance evaluation method and system based on a YOLO algorithm. Background Art

[0002] Cotton is an important economic crop in my country. During its growth, it is often attacked by various pests, which leads to a decrease in cotton yield and quality. Traditional methods of pest investigation mainly rely on manual judgment and statistical surveys of the number of larvae. This method is time-consuming and labor-intensive, and has low efficiency, low precision, and large errors. It cannot meet the needs of monitoring and early warning of large-scale crop pests. With the development of intelligent agricultural technology, some new pest monitoring and early warning methods have been proposed, such as combining drone remote sensing technology and deep learning algorithms for pest monitoring.

[0003] The Chinese invention patent with application number 202410566242.0 discloses a method for detecting pests and diseases on corn leaves based on an improved YOLOv7 model, including collecting images of corn fields through drones, annotating images, and performing data enhancement to expand the number of images, dividing the expanded images into training sets and verification sets in a ratio of 4:1, improving YOLOv7 to obtain an improved YOLOv7 target detection model, training the improved YOLOv7 target detection model, and evaluating the trained YOLOv7 target detection model to obtain the best YOLOv7 target detection model, and using the obtained best YOLOv7 target detection model to detect pests and diseases on corn leaf images. The invention is based on a method for detecting pests and diseases on corn leaves based on an improved YOLOv7 model. Under the premise of meeting high efficiency and real-time requirements, it is suitable for identifying small targets with high similarity, and provides a scientific basis and technical support for the prevention and control of corn pests and diseases in agricultural production. However, due to the great differences between corn leaves and cotton leaves, and the locations where pests occur are also very different, 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 cotton pest detection and insect resistance evaluation method and system based on the YOLO algorithm.

[0005] A first aspect of the present invention provides 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; 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: Use the final detection model to detect cotton pests and give the detection results.

[0006] Preferably, in step 11, an unmanned aerial vehicle is used to collect images containing cotton plants at a set height and at set time intervals, and the images are saved in a specific format.

[0007] Preferably, in any of the above solutions, in step 12, preprocessing the image captured by the drone includes cropping and rotating the image to ensure consistency of image quality.

[0008] Preferably, in any of the above solutions, in step 12, the preprocessed image is manually labeled using the LabelImg tool, and the labeled categories include insect and health, so as to obtain a data set including insect pest samples and healthy samples.

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

[0010] Preferably, in any of the above schemes, in step 14, the YOLOv8 algorithm is improved, including: using the BiFormerBlock module to replace the C2f in the Backbone low-level feature extraction module 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.

[0011] Preferably, in any of the above solutions, in step 14, the YOLOv8 algorithm is improved, further comprising: introducing a CAFM (convolution and attention fusion) module in the Head part of the YOLOv8 model.

[0012] Preferably, in any of the above schemes, in step 14, 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.

[0013] Preferably, in any of the above schemes, in step 14, the YOLOv8 algorithm is improved, further comprising: improving the loss function of the Head part to an ECIOU_Loss loss function, wherein 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 represents the maximum possible altitude, c w represents the maximum possible width, 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, g represents some parameters of the true box, t Represents some parameters of the target.

[0014] Preferably, in any of the above solutions, in step 14, the YOLOv8 algorithm is improved, further comprising: introducing a PWconv (point-by-point convolution) module in the Backbone part to replace C2f in the high-level feature extraction module.

[0015] 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.

[0016] Preferably, in any of the above schemes, in step 14, when training each YOLO algorithm, the training parameters are set as follows: number of training rounds 300, batch size 8, learning rate 0.01, momentum factor 0.937, and weight decay 0.0005.

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

[0018] Preferably, in any of the above schemes, in step 15, the F1 score ,in P is the accuracy, and its calculation formula is ,in TP represents the number of true positive samples (correctly predicted positive samples), FP Represents the number of false positive samples (negative samples incorrectly predicted as positive); R is the recall rate, and its calculation formula is ,in TP represents the number of true positive samples (correctly predicted positive samples), FN Represents the number of false negative samples (positive samples incorrectly predicted as negative).

[0019] Preferably, in any of the above schemes, 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 of the categories with insufficient detection capability are adjusted and optimized to obtain the final detection model.

[0020] A second aspect of the present invention provides a method for evaluating cotton insect resistance, comprising: 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 type 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 to perform pest detection and obtain the 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.

[0021] The third aspect of the present invention provides a cotton pest detection and insect resistance assessment system based on the YOLO algorithm, comprising a processor and a memory, the memory being used to store a computer program, the processor being used to run the computer program to execute the cotton insect resistance assessment method; 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.

[0022] 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: 1. Through comprehensive evaluation and comparison of the detection models obtained by the YOLO series algorithms including YOLOv5, YOLOv7, and YOLOv8, the optimal detection model for cotton pests in complex cotton field backgrounds was determined; 2. By analyzing the differences in the detection capabilities of the optimal detection model for healthy cotton leaves and insect-infested leaves, the model parameters are adjusted and optimized for areas with insufficient detection capabilities to obtain the final detection model; 3. The final detection model greatly improved the speed and accuracy of cotton pest detection, especially in the complex cotton field background. The F1 score of the final detection model reached 0.947; 4. A diverse data set containing healthy and pest samples of multi-material cotton was constructed, laying a data foundation for subsequent research on cotton; 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 impact of insect pests on cotton samples of different materials, and thus provide data support for their insect resistance evaluation; 6. It can realize accurate pest detection in different areas of cotton fields, thus making it possible to spray pesticides in cotton fields, reducing the risk of environmental pollution, providing reliable technical support for precision agriculture, and helping to promote efficient management of cotton production; 7. According to the characteristics of cotton leaves, the YOLOv8 algorithm model is improved to make it more suitable for cotton leaves. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 The figure is a flow chart of a preferred embodiment of a cotton pest detection method based on the YOLO algorithm according to the present invention.

[0024] Figure 2 According to the cotton pest detection method based on the YOLO algorithm of the present invention, Figure 1 Schematic diagram of the overall structure of the improved YOLOv8 algorithm in the illustrated embodiment.

[0025] Figure 3 According to the cotton pest detection method based on the YOLO algorithm of the present invention, Figure 1 A schematic diagram of the BiFormerBlock module structure used in the improved YOLOv8 algorithm in the illustrated embodiment.

[0026] Figure 4 According to the cotton pest detection method based on the YOLO algorithm of the present invention, Figure 1 A schematic diagram of the CAFM module structure used in the improved YOLOv8 algorithm in the illustrated embodiment.

[0027] Figure 5 According to the cotton pest detection method based on the YOLO algorithm of the present invention, Figure 1 A schematic diagram of the structure of the PWconv module used in the improved YOLOv8 algorithm in the illustrated embodiment.

[0028] Figure 6 The figure is a schematic diagram of the working process of a preferred embodiment of the method for evaluating cotton insect resistance according to the present invention.

[0029] Figure 7 For example, the method for evaluating cotton insect resistance of the present invention is as follows: Figure 6 The illustrated embodiment outputs a cotton leaf detection result graph of the first material cotton at a certain time point.

[0030] Figure 8 For example, the method for evaluating cotton insect resistance of the present invention is as follows: Figure 6 The illustrated embodiment outputs a cotton leaf detection result graph of the second material cotton at a certain time point.

[0031] Fig. 9 For example, the method for evaluating cotton insect resistance of the present invention is as follows: Figure 6 The illustrated embodiment outputs a cotton leaf detection result diagram of the third material cotton at a certain time point.

[0032] Fig.10 For example, the method for evaluating cotton insect resistance of the present invention is as follows: Figure 6 The illustrated embodiment outputs a cotton leaf detection result diagram of the fourth material cotton at a certain time point.

[0033] Fig.11 For example, the method for evaluating cotton insect resistance of the present invention is as follows: Figure 6 The illustrated embodiment outputs a cotton leaf detection result diagram of the fifth material cotton at a certain time point. DETAILED DESCRIPTION

[0034] In order to better understand the present invention, the present invention is described in detail below in conjunction with specific embodiments.

[0035] Example 1 like Figure 1 As shown, a cotton pest detection method based on the YOLO algorithm includes: 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; 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: Use the final detection model to detect cotton pests and give the detection results.

[0036] In step 11, an unmanned aerial vehicle is used to collect images containing cotton plants at a set height and at a set time interval, and the images are saved in a specific format. In this embodiment, preferably, a DJI Mavic 3M unmanned aerial vehicle is used to collect images containing cotton plants, the flight height of the unmanned aerial vehicle is set to 6 meters, the shooting interval is set to 2 seconds, and the image is saved in PNG format. It should be noted that the parameters for collecting images by the above-mentioned unmanned aerial vehicle are only listed for example, not for limitation, and in actual applications, adaptive adjustments can be made.

[0037] In step 12, the images collected by the drone are preprocessed, including cropping and rotating the images, to ensure the consistency of image quality. The preprocessed images are manually labeled using the LabelImg tool, and the labeled categories include insect and health, to obtain a data set including insect pest samples and health samples. In this embodiment, a data set including 32,994 insect pest samples and 16,575 health samples is obtained.

[0038] In step 13, the data set is randomly divided into training set, validation set and test set in a ratio of 6:2:2.

[0039] In order to be more suitable for cotton leaf pest detection, the YOLOv8 algorithm is improved in step 14. The overall structure of the improved YOLOv8 algorithm is as follows: Figure 2 As shown, the specific improvements include the following aspects.

[0040] The first improvement is to use the BiFormerBlock module to replace the C2f in the Backbone low-level feature extraction module 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 follows Figure 3 The input image is divided into multiple small blocks through the Patch Embedding module and embedded into a feature space. Then, features are extracted step by step through multiple stages. After each stage, the image resolution decreases and the number of channels increases. For the specific structure of the BiFormerBlock module, see Figure 3 As shown on the right side of the dotted line, it combines dual-level routing attention and deep 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 modeling ability of global features can be enhanced. In this embodiment, it is preferred that Figure 2As shown, the BiFormerBlock module is used to replace the C2f in the first and second stage feature extraction modules in the Backbone part of YOLOv8.

[0041] The second improvement is to introduce a 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 submodule, a channel shuffle submodule, and a first extraction submodule that are set 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 that are set in sequence; the output of the local branch and the output of the global branch are fused as the output of the CAFM module.

[0042] Specifically, if Figure 4 As shown in the figure, in the local branch, the input is first reduced in dimension by 1×1 convolution (i.e., the first dimension reduction submodule is implemented by 1×1 convolution), and then the information interaction between different channels is enhanced by the channel shuffle submodule, and then the features are further extracted by 3×3 convolution (i.e., the first extraction submodule is implemented by 3×3 convolution). In the global branch, the input is first reduced in dimension by 1×1 convolution (i.e., the second dimension reduction submodule is also implemented by 1×1 convolution), and then the query vector Q, key vector K and value vector V are generated respectively by three 3×3 deconvolutions (i.e., deconvolution submodule); then, the query vector Q and key vector K are used to calculate the attention map, and then the normalization submodule (using Softmax) is used to normalize the normalized attention map, and the normalized attention map and the value vector V are weighted summed by the weighted summation submodule to obtain the global features; finally, the dimension is restored by 1×1 convolution (i.e., the dimension recovery submodule uses 1×1 convolution). After completing a series of operations of the local branch and the global branch, the features obtained by the local branch and the global branch are fused through residual connection to obtain the final output features of the CAFM module.

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

[0044] The third aspect 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: , 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, crepresents the minimum diagonal length of the enclosing box, c h represents the maximum possible altitude, c w represents the maximum possible width, 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, g represents some parameters of the true box, t Represents some parameters of the target.

[0045] 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 to improve the accuracy of bounding box regression.

[0046] The fourth improvement is to introduce the PWconv (point-by-point convolution) module in the Backbone part of the YOLOv8 algorithm to replace the C2f in the high-level feature extraction module. The structure of the PWconv module is as follows Figure 5 As shown in FIG. 1 , through this improvement, a more lightweight cotton pest detection model based on YOLOv8 can be obtained, while the feature extraction efficiency and global modeling ability of the model are improved, and the computational complexity is also reduced. In this embodiment, it is preferred that Figure 2 As shown in Figure 2, the C2f in the third and fourth stage feature extraction modules in the Backbone part of the YOLOv8 algorithm is replaced by the PWconv module. It should be noted that in Figure 2 The PWconv module is denoted as PW-COTT.

[0047] The computational FLOPs and memory access of the input feature map operated by the PWconv module can be expressed as: FLOPs = H × W × C in ×C out; Memory Access = H×W×C in + H×W×C out + C in ×C out .

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

[0049] In step 14, when training each YOLO algorithm, the size of the input image is 640×640 pixels, and 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. Specifically, by setting the above training parameters for YOLOv5, YOLOv7, and YOLOv8, and using the same training set for training, the detection models corresponding to YOLOv5, YOLOv7, and YOLOv8 are obtained respectively.

[0050] In step 15, the F1 score is used to evaluate the performance of the detection model corresponding to each algorithm, and the detection model with the highest F1 score is selected as the optimal detection model. ,in P is the accuracy, and its calculation formula is ,in TP represents the number of true positive samples (correctly predicted positive samples), FP Represents the number of false positive samples (negative samples incorrectly predicted as positive); R is the recall rate, and its calculation formula is ,in TP represents the number of true positive samples (correctly predicted positive samples), FN Represents the number of false negative samples (incorrectly 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, so the detection model obtained by the YOLOv8 algorithm is selected as the optimal detection model. The detection ability of the optimal detection model for healthy leaves and insect-infested leaves is analyzed, the difference in detection ability for healthy leaves and insect-infested leaves is identified, and the model parameters are adjusted and optimized for the categories with insufficient detection ability to obtain the final detection model. In this embodiment, since the characteristics of healthy leaves are relatively unobvious compared to the characteristics of insect-infested leaves, the optimal detection model has a slightly poorer detection ability for healthy leaves. Through parameter adjustment and optimization, the detection ability for healthy leaves is improved while ensuring the detection ability for insect-infested leaves.

[0051] In step 16, the final detection model is used to detect cotton pests and give the detection results. Specifically, when detecting cotton pests, the labeling results of "insect" and "health" and the corresponding confidence levels can be output for the input image, and then the number of pest leaves and the number of healthy leaves in the input image can be obtained, and then the formula can be used: , calculate the pest level of the input image.

[0052] Through this method, the collected images of various areas of a cotton field can be input into the final detection model to obtain the degree of insect pests in each area of ​​the cotton field, and then accurate insect pest detection can be achieved in different areas of the cotton field. Furthermore, only areas with high insect pest levels can be sprayed, which reduces the risk of environmental pollution, provides reliable technical support for precision agriculture, and helps promote efficient management of cotton production.

[0053] Example 2 like Figure 6 As shown, a method for evaluating cotton insect resistance comprises: 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 type 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 to perform pest detection and obtain the 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.

[0054] Specifically, in step 22, N (N≥10) pictures of cotton plants of each material may be collected every 7 days from the time when the cotton plants emerge to the time when the cotton plants open, and the collected pictures may be processed.

[0055] In step 23, a corresponding detection result is obtained according to each image. Figure 7 , Figure 8 , Fig. 9 , Fig.10 , Fig.11 These are the cotton leaf test results of cotton of different materials (first to fifth materials) at a certain point in time.

[0056] In step 24, for each material of cotton, the sum of the number of insect-infested leaves and the total number of leaves detected in all images collected at the same time point can be first determined, and the insect infestation degree at each time point can be calculated according to the insect infestation degree calculation formula, and finally a time series of the insect infestation degree can be obtained as the insect infestation degree data of the material cotton; it is also possible to obtain the insect infestation degree data of each image at the same time point for the images collected at each time point, and then perform corresponding operations (such as maximum value operation, mean operation, weighted mean operation, median operation, etc.) to determine the insect infestation degree at each time point, and finally obtain a time series of the insect infestation degree as the insect infestation degree data of the material cotton; it is also possible to use other operation methods to determine the insect infestation degree data of each material cotton according to the insect infestation degree obtained for each image as needed, and this application does not make specific restrictions.

[0057] In step 25, based on the finally determined insect pest degree data of 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 cotton of each material is consistent during the growth cycle of cotton.

[0058] In this embodiment, after testing cotton of five materials, it was found that the insect pest degree of cotton of most materials was between 0.6-0.9, reflecting the ubiquitous existence of insect pests. However, for cotton of a certain material, the value of its insect pest degree varied slightly around 0.4, indicating that the cotton of this material had excellent insect resistance and good consistency of insect resistance throughout the entire evaluation period.

[0059] Example 3 A cotton pest detection and insect resistance evaluation system based on the YOLO algorithm comprises a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to run the computer program to execute the cotton insect resistance evaluation method described in Example 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.

[0060] 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 above embodiments describe the present invention in detail, those skilled in the art should understand that they may modify the technical solutions recorded in the above embodiments, or replace some or all of the technical features therein with equivalents, and these replacements do not make the essence of the corresponding technical solutions 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 low-level feature extraction module of the Backbone part of YOLOv8, and setting the Patch Embedding module before the BiFormerBlock module in the first stage, and setting the Patch Merging module before the BiFormerBlock module in other stages; introducing the PWconv module in the Backbone part to replace the C2f in the high-level feature extraction module.

2. The cotton pest detection method based on the YOLO algorithm as claimed in claim 1, characterized in that: In step 14, the YOLOv8 algorithm is improved, and also includes: introducing a CAFM module in the Head part of the YOLOv8 model; 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 represents the maximum possible altitude, c w represents the maximum possible width, 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, g represents some parameters of the true box, t Represents some parameters of the target.

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

Cited By

  • HCG test paper concentration detection and pregnancy risk result judgment method based on YOLO algorithm

    CN120613133A