A method and device for detecting mung bean leaf spot disease based on LS-YOLOv5 network

Through the mung bean leaf spot disease detection method based on the LS-YOLOv5 network, using the improved structure of B-CSP, D-SPP and ECA modules, the problem of inability to accurately and quickly detect minute features of different disease levels in traditional detection technology has been achieved, and high-level detection has been achieved. Accurate and rapid spot detection, suitable for online detection of mung bean leaf spot disease, has robustness and wide application value.

CN116030348BActive Publication Date: 2024-10-25HUAIYIN INSTITUTE OF TECHNOLOGY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310033251.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2024-10-25
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

Traditional mung bean leaf spot detection technology cannot accurately and quickly detect minute features of different disease levels, and requires professional operations, which is inefficient and difficult to achieve online detection.

Method used

The mung bean leaf spot detection method based on the LS-YOLOv5 network is adopted, the original leaf images are annotated through the labelimg annotation tool, and the Mosaic data enhancement algorithm is used for data preprocessing to construct the LS-YOLOv5 leaf spot detection network, including B- The CSP module, D-SPP module and ECA attention module train and obtain pre-trained weights for high-precision detection.

Benefits of technology

It achieves high-precision detection of different levels of disease spots and has a fast detection speed, solving the balance problem of detection accuracy and speed in traditional methods. It is suitable for online detection of mung bean leaf spot disease, and has robustness and wide application value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116030348B_ABST
    Figure CN116030348B_ABST
Patent Text Reader

Abstract

The invention provides a mung bean leaf spot disease detection method and device based on an LS-YOLOv5 network. The method comprises the following steps: using a labelimg annotation tool to annotate a pre-acquired original leaf image; using a Mosaic data enhancement algorithm to perform data preprocessing on the original leaf image; and dividing the original leaf image into a training set, a validation set and a test set; constructing an LS-YOLOv5 leaf spot disease detection network, wherein a B-CSP module is used in a Backbone; adding a D-SPP module after the last CBL module in the Backbone; adding an ECA attention module before the D-SPP module in the Backbone; using a Neck construction method in the same manner as an original YOLOv5 algorithm model; training the LS-YOLOv5 leaf spot disease detection network, passing a pre-processed leaf spot disease training set through the constructed LS-YOLOv5 leaf spot disease detection network, and obtaining a LS-YOLOv5 model pre-training weight for leaf spot disease detection; and inputting a leaf spot disease picture to be detected into an optimal weight model for leaf spot disease detection. The present invention can be used for mung bean leaf spot disease detection, has a small network volume, high detection efficiency, good robustness and wide application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of agricultural plant protection, and specifically relates to a mung bean leaf spot disease detection method and device based on an LS-YOLOv5 network. Background Art

[0002] Crops are various plants cultivated by humans in agricultural production activities. They are divided into two categories: food crops and cash crops. No matter which type of crops, they are easily affected by various aspects such as water, soil, diseases and pests during the planting process. This requires the use of effective cultivation techniques to reduce the impact of these factors on crop planting.

[0003] Detecting crop diseases is a critical step in the agricultural sector because it affects the planting and harvesting of crops. The detection of these crop diseases requires a lot of time and resources, and often requires expert knowledge. Farmers will have to manually detect symptoms of large areas of crops, a process that is repetitive and inefficient. Mung bean leaf spot is a common disease in the mung bean planting process. In severe cases, a large number of leaves of the plant will die, perforate, fall off, and prematurely age, leading to the death of the entire plant, which has a great impact on the growth of mung beans. Leaf spot disease harms the leaves, and is most serious during the flowering and pod-setting period. In the early stage of the disease, small brown spots with water stains appear on the leaves, and after expansion, they form nearly circular lesions with reddish brown to reddish brown edges and light gray to light brown in the middle. In severe cases, the lesions merge into pieces and dry up quickly. In mild cases, the yield is reduced by 20% to 50%, and in severe cases, it is as high as 90%. Traditional mung bean leaf spot disease lesion detection technology has many shortcomings in actual agricultural production. Human eye observation cannot accurately and objectively evaluate the degree of mung bean leaf spot disease lesions. Although optical microscopy, bioassay, and PCR technologies are capable of accurate detection, they require professional operation, are time-consuming and laborious, and are difficult to apply to online detection of mung bean leaf spot disease lesions. Using deep learning technology, disease detection and grading have been greatly improved, and today, smart agriculture focuses on providing infrastructure to leverage advanced technologies such as the Internet of Things and big data. With the recent advent of deep learning, it is now possible to automatically detect these diseases with extremely high accuracy.

[0004] The development of target detection can be divided into two periods: the traditional target detection algorithm period (1998-2014) and the target detection algorithm period based on deep learning (2014-present). The target detection algorithm based on deep learning has developed into two technical routes: Anchorbased method (stage one, stage two) and Anchor free method. Due to the high accuracy and excellent inference speed of the YOLO algorithm, most of the current crop pest and disease detection algorithms are improved based on the first-stage YOLO algorithm. Summary of the invention

[0005] Purpose of the invention: In order to solve the problem of difficulty in detecting tiny features of mung bean leaf spot lesions of different disease levels, the present invention proposes a mung bean leaf spot lesion detection method and device based on the LS-YOLOv5 network, which can detect lesions of different levels with high precision and have a faster detection speed, thereby achieving a balance between detection accuracy and detection speed.

[0006] Technical solution: The present invention provides a method for detecting mung bean leaf spot disease based on LS-YOLOv5 network, which specifically includes the following steps:

[0007] (1) Use the labelimg annotation tool to annotate the original leaf image acquired in advance;

[0008] (2) The original leaf images are preprocessed using the Mosaic data enhancement algorithm and divided into training set, validation set and test set;

[0009] (3) Constructing an LS-YOLOv5 leaf spot disease detection network; using the B-CSP module in the Backbone of the LS-YOLOv5 leaf spot disease detection network; adding a D-SPP module after the last CBL module in the Backbone; adding an ECA attention module before the D-SPP module in the Backbone; and constructing the Neck in the same way as the original YOLOv5 algorithm model;

[0010] (4) Training the LS-YOLOv5 leaf spot disease detection network, passing the preprocessed leaf spot disease training set through the built LS-YOLOv5 leaf spot disease detection network to obtain the LS-YOLOv5 model pre-training weights for leaf spot disease detection;

[0011] (5) The preprocessed leaf spot disease images to be detected are input into the optimal weight model for leaf spot disease detection.

[0012] Furthermore, the implementation process of step (1) is as follows:

[0013] The labelimg annotation tool was used to annotate the lesions in each image. There are five types of labels, which are graded according to the size of the lesions, namely level 0, level 1, level 2, level 3, and level 4. Level 0 means no visible infection on the leaves; level 1 means only small dot-like lesions on the leaves, accounting for less than 2% of the leaf area; level 2 means smaller lesions, with a diameter of 1 to 2 mm, without chlorotic halos, accounting for 3% to 25% of the leaf area; level 3 means larger lesions, with a diameter of 2.1 to 5 mm, with chlorotic halos, accounting for 26% to 50% of the leaf area; level 4 means large lesions, with a diameter of more than 5.1 mm, accounting for 51% to 75% of the leaf area, and some leaves are dead.

[0014] Furthermore, the structure of the B-CSP module in step (3) includes two branches, namely branch a and branch b. Branch a is a BBL module, and the number of input channels of the BBL module is half of the number of output channels of the CBL module in the previous layer; branch b is a BBL module connected to a Bottleneck module, and the Bottleneck module includes a 1×1 BBL convolution and a 3×3 BBL convolution and a far jump connection between the two convolutions. The number of input channels of branch b is also half of the number of output channels of the CBL module in the previous layer; the output feature maps of the two branches continue to perform a Concatenate operation to restore the number of channels before the B-CSP operation, and finally a BBL convolution operation is performed after the Concatenate operation.

[0015] Furthermore, in step (3), after the Backbone of the LS-YOLOv5 network performs the last CBL operation, a spatial pyramid pooling operation of a D-SPP module is performed; the D-SPP is composed of an m branch and an n branch, the m branch includes two MaxPool operations, namely a 5×5 MaxPool operation and a 7×7 MaxPool operation, the number of output channels of each MaxPool operation is consistent with the number of channels of the CBL, which is 1 / 2 of the number of input channels, denoted as c / 2, where c represents the number of channels; the n branch includes two AvgPool operations, namely a 5×5 AvgPool operation and a 7×7 AvgPool operation, the number of output channels of each AvgPool operation is also consistent with the number of channels of the CBL, which is 1 / 2 of the number of input channels, denoted as c / 2; the output feature maps of the last two branches are concatenated with the output feature map of the CBL, and the output feature map is 2.5c before the D-SPP module.

[0016] Furthermore, in the Backbone of the LS-YOLOv5 network in step (3), a lightweight channel attention module ECA is added before D-SPP; the lightweight channel attention module ECA first inputs a feature map with a dimension of H×W×C; then the input feature map is spatially compressed, and in the spatial dimension, global average pooling GAP is used to obtain a feature map of 1×1×C; channel feature learning is performed on the compressed feature map, and the importance of different channels is learned through 1×1 convolution, and the output dimension is still 1×1×C; finally, channel attention is combined to combine the features of the channel attention Figure 1 ×1×C and the original input feature map H×W×C are multiplied channel by channel, and finally a feature map with channel attention is output.

[0017] Based on the same inventive concept, the present invention also provides a mung bean leaf spot disease spot detection device based on the LS-YOLOv5 network, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is loaded into the processor, the mung bean leaf spot disease spot detection method based on the LS-YOLOv5 network is implemented.

[0018] Beneficial effects: Compared with the prior art, the beneficial effects of the present invention are as follows: Based on the original YOLOv5 network model, the present invention improves the CSP module and the SPP module of Backbone respectively, and adds an ECA attention module. The above improvements to the target detection network model are all to adapt to the subtle feature differences of mung bean leaf spot disease spots of different levels; the present invention can be used for mung bean leaf spot disease detection, has a small network size, high detection efficiency, good robustness and wide application value. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flow chart of the present invention;

[0020] Figure 2 Some images of the dataset used in this invention;

[0021] Figure 3 This is a schematic diagram of the original YOLOv5 network model structure;

[0022] Figure 4 Improvements to the Backbone part of the original YOLOv5;

[0023] Figure 5 A schematic diagram of the structure of a B-CSP module provided by the present invention;

[0024] Figure 6 A schematic diagram of the BSConv structure in the B-CSP module provided by the present invention;

[0025] Figure 7 A schematic diagram of the structure of a D-SPP module provided by the present invention;

[0026] Figure 8 A schematic diagram of the structure of the ECA attention module added to the Backbone part of the LS-YOLOv5 network model of the present invention;

[0027] Fig. 9 This is the detection effect of the original YOLOv5 network model on mung bean leaf spot disease;

[0028] Fig.10 This is a diagram showing the detection effect of the LS-YOLOv5 network model of the present invention on mung bean leaf spot disease spots. DETAILED DESCRIPTION

[0029] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0030] The present invention proposes a mung bean leaf spot disease detection method based on LS-YOLOv5 (LeafSpot-YOLOv5) network. Figure 1 As shown, the specific steps include:

[0031] Step 1: Use the labelimg annotation tool to annotate the original leaf image.

[0032] The dataset used in this paper comes from the Institute of Economic Crops, Jiangsu Academy of Agricultural Sciences. Some of the datasets are as follows: Figure 2 As shown. Use the labelimg annotation tool to annotate the lesions in each image. The labels are divided into five types, which are graded according to the size of the lesions, namely 0, 1, 2, 3, and 4. 0 is represented by HR, which means no visible infection on the leaves; 1 is represented by R, which means there are only small dot-like lesions on the leaves, accounting for less than 2% of the leaf area; 2 is represented by MR, which means the lesions are small, with a diameter of 1 to 2 mm, without chlorotic halos, and accounting for 3% to 25% of the leaf area; 3 is represented by MS, which means the lesions are large, with a diameter of 2.1 to 5 mm, with chlorotic halos, and accounting for 26% to 50% of the leaf area; 4 is represented by S, which means the lesions are large, with a diameter of more than 5.1 mm, accounting for 51% to 75% of the leaf area, and some leaves are dead. The same type of leaf spot disease is annotated as the same category. After all the images are annotated, export the data set in VOC format.

[0033] Step 2: Use the Mosaic data enhancement algorithm to preprocess the original leaf image.

[0034] Four leaf spot disease images are randomly cropped and then spliced ​​into one image as training data. The advantage of this is that the image background is enriched, and the four images are spliced ​​together to increase the batch_size in disguise. Four images are also calculated during batchnormalization, so the batch_size itself is not very dependent. A single GPU can train the built LS-YOLOv5 network model. The acquired leaf images are divided into a training set, a validation set, and a test set. The ratio of the training set, validation set, and test set is 8:1:1.

[0035] Step 3: Construct the LS-YOLOv5 target detection network for mung bean leaf spot detection.

[0036] like Figure 3The figure shows the original YOLOv5 network structure before improvement. It mainly includes input image, Backbone, Neck, Prediction and output detection results. The image is input at the input end, the input image size is 608×608 pixels, and the image preprocessing operation is performed, that is, the input image is scaled to the input size of the network and normalized; in the network training stage, YOLOv5 uses Mosaic data enhancement operation to improve the training speed of the model and the accuracy of the network, and uses adaptive anchor box calculation and adaptive image scaling. The Backbone part is used to extract some common feature representations. YOLOv5 not only uses the CSPDarknet53 structure, but also uses the Focus structure as the Backbone. The Neck network is usually located in the middle of the Backbone network and the Prediction network. The use of the Neck network can further improve the diversity and robustness of the features. YOLOv5 uses the SPP module and the FPN+PAN module to further extract features. The Prediction network is used to complete the output of the target detection results, usually including a classification branch and a regression branch. Finally, YOLOv5 uses GIOU Loss to replace the Smooth L1 Loss function to further improve the detection accuracy of the algorithm.

[0037] Figure 4 The present invention improves the original YOLOv5 network structure Backbone by replacing the CSP module of Backbone with the B-CSP module, the SPP module with the D-SPP module, and adding the ECA attention module. Figure 5 As shown in the figure, the B-CSP module structure includes two branches, namely branch a and branch b. Branch a is a BBL module, and the number of input channels of the BBL module is half of the number of output channels of the previous CBL module; branch b is a BBL module connected to a Bottleneck module. The Bottleneck module consists of a 1×1 BBL convolution and a 3×3 BBL convolution and a far jump connection between the two convolutions. The number of input channels of this branch is also half of the number of output channels of the previous CBL module; the output feature maps of the two branches continue to undergo the Concatenate operation and are restored to the number of channels before the B-CSP operation. Finally, a BBL convolution operation is performed after the Concatenate operation. The BBL module consists of BSConv, BatchNormalization, and L-Relu. BSConv is as follows: Figure 6 As shown in the figure, it consists of a 1×1 convolution and a 3×3 convolution. The difference from the ordinary depth-separable convolution is that the BSConv convolution performs point convolution first and then depth convolution.

[0038] Figure 7 It is the D-SPP module used in the Backbone of the LS-YOLOv5 network structure. D-SPP consists of m branches and n branches. The m branch includes two MaxPool operations, namely a 5×5 MaxPool operation and a 7×7 MaxPool operation. The number of output channels of each MaxPool operation is consistent with the number of channels of CBL, which is 1 / 2 of the number of input channels, denoted as c / 2, where c represents the number of channels; the n branch includes two AvgPool operations, namely a 5×5 AvgPool operation and a 7×7 AvgPool operation. The number of output channels of each AvgPool operation is also consistent with the number of channels of CBL, which is 1 / 2 of the number of input channels, denoted as c / 2; the output feature maps of the last two branches are concatenated with the output feature maps of CBL, and the output feature map is 2.5c before the D-SPP module.

[0039] Finally, an ECA attention module is used in Backbone. The ECA module is added before the D-SPP module, such as Figure 8 As shown in the figure, the ECA module first inputs a feature map with a dimension of H×W×C; then the input feature map is spatially compressed, and global average pooling GAP is used in the spatial dimension to obtain a feature map of 1×1×C; channel feature learning is performed on the compressed feature map, and the importance of different channels is learned through 1×1 convolution, and the output dimension is still 1×1×C; finally, channel attention is combined to combine the features of channel attention Figure 1 ×1×C and the original input feature map H×W×C are multiplied channel by channel, and finally a feature map with channel attention is output.

[0040] Step 4: Train the LS-YOLOv5 leaf spot disease detection network. Input the preprocessed leaf spot disease training set into the built LS-YOLOv5 leaf spot disease detection network for training. Train 300 times, set the iteration batch size to 32, set the initial learning rate to 0.001, use the small batch gradient descent method, and use the Adam optimizer to calculate the adaptive learning rate of each parameter, and then obtain the optimal pre-trained weight of the LS-YOLOv5 model for leaf spot disease detection. In the process of training the optimal weight model, it is necessary to repeat the network training process and continuously correct the parameters of the mung bean leaf spot disease lesion detection network until the lesion detection network learns to find the lesions in the image and can correctly judge the type of lesions. Save the parameters obtained by training. That is, after completing the training, save the optimal weight model and test it on the test set.

[0041] Step 5: Input the preprocessed leaf spot disease images to be detected into the optimal weight model for leaf spot disease detection, output the detection results and calculate the mean average precision (mAP), recall rate (Recall), and precision (Precision). It should be noted that the mean average precision (mAP), that is, the sum of the average precision of all categories divided by the average precision of all classes in the data set, is shown in the following formula, where the AP value is the area of ​​the PR curve.

[0042]

[0043] The recall rate, that is, the probability that the correct category in the sample is predicted correctly by the model, is shown below, where TP represents the number of positive categories predicted as positive categories, and FN represents the number of positive categories predicted as negative categories.

[0044]

[0045] Accuracy is the number of correctly predicted positive samples in the prediction data set divided by the actual number of positive samples, as shown in the following formula, where FP represents the number of negative classes predicted as positive classes.

[0046]

[0047] Based on the same inventive concept, the present invention also proposes a mung bean leaf spot disease spot detection device based on the LS-YOLOv5 network, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is loaded into the processor, the mung bean leaf spot disease spot detection method based on the LS-YOLOv5 network is implemented.

[0048] The detection results of the original YOLOv5 network model for mung bean leaf spot disease are as follows Fig. 9 As shown in FIG. 1 , the detection results of the mung bean leaf spot disease spots by the improved LS-YOLOv5 network model in the present invention are as follows: Fig.10 As shown. Fig. 9 It can be seen that the original YOLOv5 network model has certain detection bias and misdetection in the process of detecting lesions. Fig.10 The LS-YOLOv5 network model can accurately detect the leaf spot disease. The present invention can be used for mung bean leaf spot disease detection, with a small network size, high detection efficiency, good robustness and wide application value.

Claims

1. A method for detecting mung bean leaf spot disease based on LS-YOLOv5 network, characterized in that: The following steps are involved: (1) Use the labelimg annotation tool to annotate the original leaf image acquired in advance; (2) The original leaf images are preprocessed using the Mosaic data enhancement algorithm and divided into training set, validation set and test set; (3) Constructing an LS-YOLOv5 leaf spot disease detection network; using the B-CSP module in the backbone of the LS-YOLOv5 leaf spot disease detection network; adding a D-SPP module after the last CBL module in the backbone; and adding an ECA attention module before the D-SPP module in the backbone; The Neck construction method is built in the same way as the original YOLOv5 algorithm model; the structure of the B-CSP module includes two branches, namely branch a and branch b, branch a is a BBL module, and the number of input channels of the BBL module is half of the number of output channels of the previous CBL module; branch b is a BBL module connected to a Bottleneck module, the Bottleneck module includes a 1×1 BBL convolution and a 3×3 BBL convolution and a far jump connection between the two convolutions, and the number of input channels of the b branch is also half of the number of output channels of the previous CBL module; the output feature maps of the two branches continue to perform the Concatenate operation to restore the number of channels before the B-CSP operation, and finally perform a BBL convolution operation after the Concatenate operation; after the Backbone completes the last CBL operation, a D-S The spatial pyramid pooling operation of the PP module; D-SPP consists of an m branch and an n branch, the m branch includes two MaxPool operations, namely a 5×5 MaxPool operation and a 7×7 MaxPool operation, the number of output channels of each MaxPool operation is consistent with the number of channels of CBL, which is 1 / 2 of the number of input channels, denoted as c / 2, where c represents the number of channels; the n branch includes two AvgPool operations, namely a 5×5 AvgPool operation and a 7×7 AvgPool operation, the number of output channels of each AvgPool operation is also consistent with the number of channels of CBL, which is 1 / 2 of the number of input channels, denoted as c / 2; the output feature maps of the last two branches are concatenated with the output feature maps of CBL, and the output feature maps are 2.5c before the D-SPP module; the BBL module consists of BSConv, Batch Normalization and L-Relu; BSConv consists of a 1×1 convolution and a 3×3 convolution, and the BSConv convolution first performs point convolution and then depth convolution; (4) Training the LS-YOLOv5 leaf spot disease detection network, passing the preprocessed leaf spot disease training set through the built LS-YOLOv5 leaf spot disease detection network to obtain the LS-YOLOv5 model pre-training weights for leaf spot disease detection; (5) The preprocessed leaf spot disease images to be detected are input into the optimal weight model for leaf spot disease detection.

2. The mung bean leaf spot detection method based on LS-YOLOv5 network according to claim 1, characterized in that: The implementation process of step (1) is as follows: The labelimg annotation tool was used to annotate the lesions in each image. There are five types of labels, which are graded according to the size of the lesions, namely level 0, level 1, level 2, level 3, and level 4. Level 0 means no visible infection on the leaves; level 1 means only small dot-like lesions on the leaves, accounting for less than 2% of the leaf area; level 2 means smaller lesions, with a diameter of 1 to 2 mm, without chlorotic halos, accounting for 3% to 25% of the leaf area; level 3 means larger lesions, with a diameter of 2.1 to 5 mm, with chlorotic halos, accounting for 26% to 50% of the leaf area; level 4 means large lesions, with a diameter of more than 5.1 mm, accounting for 51% to 75% of the leaf area, and some leaves are dead.

3. The mung bean leaf spot detection method based on LS-YOLOv5 network according to claim 1, characterized in that: In step (3), a lightweight channel attention module ECA is added before D-SPP in the Backbone of the LS-YOLOv5 network; the lightweight channel attention module ECA first inputs a feature map with a dimension of H×W×C; then the input feature map is spatially compressed, and in the spatial dimension, global average pooling GAP is used to obtain a feature map of 1×1×C; channel feature learning is performed on the compressed feature map, and the importance of different channels is learned through 1×1 convolution, and the output dimension is still 1×1×C; finally, channel attention is combined, and the channel attention feature map 1×1×C and the original input feature map H×W×C are multiplied channel by channel, and finally a feature map with channel attention is output.

4. A mung bean leaf spot detection device based on LS-YOLOv5 network, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into a processor, the method for detecting mung bean leaf spot disease based on the LS-YOLOv5 network according to any one of claims 1 to 3 is implemented.