A crop leaf disease recognition method and device based on multi-resolution dual-path features
By constructing a crop leaf disease identification model with multi-resolution dual-path features, the problem of inaccurate disease severity identification in existing technologies has been solved, enabling early and accurate identification and timely prevention and control, thus improving the accuracy and efficiency of crop disease identification.
Patent Information
- Application Number
- CN202311498982.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-09
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-11-09
AI Technical Summary
Existing technologies struggle to accurately identify the severity of crop leaf diseases, and there is limited research on early disease identification using deep learning models, leading to misjudgments and resource waste during prevention and control.
A crop leaf disease identification method based on multi-resolution dual-path features is adopted. By constructing a multi-resolution dual-path feature identification model, shallow features are extracted using L-channel and ab-channel images respectively. Channel and spatial attention mechanisms are introduced into the multi-scale attention residual module, and training is carried out in combination with data augmentation and class weight cross-entropy loss function.
It enables early and accurate identification of diseases of varying degrees in leaf images of various crops, improving the accuracy rate and facilitating timely disease prevention and control, while reducing misjudgments and resource waste.
Smart Images

Figure CN117689931B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of crop disease identification, specifically relating to a method and apparatus for identifying crop leaf diseases based on multi-resolution dual-path features. Background Technology
[0002] Agriculture is the source of human food and clothing, the foundation of survival, and the primary condition for all production. Effective prevention and control of crop diseases is crucial for improving crop quality and yield. In agricultural production, farmers often infer crop diseases based on planting experience, which can easily lead to misjudgment of disease types, resulting in the overuse of pesticides and delaying control efforts. Compared to other parts of crops, leaves are easier to obtain, and disease characteristics are more obvious on leaves. Therefore, researching a crop leaf disease identification model that meets the needs of agricultural production is of great significance.
[0003] With the rapid development of deep learning technology, many scholars have begun to use it to identify crop leaf diseases. Compared with traditional methods based on manually designed features, deep learning can automatically extract features from crop leaf images, significantly reducing the labor costs required for manual feature design and improving the accuracy of crop leaf disease identification. However, most current research focuses on identifying the types of crop diseases, with relatively little research on disease severity identification. Leaves exhibit different characteristics at different stages of the same disease; accurate identification and appropriate control measures in the early stages of disease development can greatly reduce losses caused by the disease. Summary of the Invention
[0004] This invention aims to overcome the aforementioned shortcomings of existing technologies by providing a method and apparatus for identifying crop leaf diseases based on multi-resolution dual-path features. This invention can identify diseases of varying degrees in images of various crop leaves.
[0005] The first aspect of this invention provides a method for identifying crop leaf diseases based on multi-resolution dual-path features, comprising the following steps:
[0006] (1) Obtain a crop leaf disease dataset, process the label crossover and labeling errors in the dataset to obtain an experimental dataset, and then divide the experimental dataset into training set, validation set and test set according to the proportion;
[0007] (2) Preprocess the crop leaf images in the experimental dataset to obtain the processed image data;
[0008] (3) Construct a crop leaf disease identification model based on multi-resolution dual-path features, and use the training set images obtained in step (2) to train the model, and obtain a trained crop leaf disease identification model.
[0009] (4) Obtain crop leaf images, process the crop leaf images and input them into the crop leaf disease identification model obtained in step (3) to obtain crop leaf disease identification results.
[0010] Furthermore, the crop leaf disease dataset mentioned in step (1) is the crop disease dataset from the 2018 Global AI Challenge, which contains data on different types and degrees of diseases in various crops.
[0011] Furthermore, the processing of the dataset described in step (1) includes selecting data from some categories in the original dataset and deleting images that are obviously mislabeled in the dataset.
[0012] Furthermore, the crop leaf image preprocessing process described in step (2) specifically includes:
[0013] (2.1) Adjust the size of all images in the dataset to 256×256 by upsampling and subsampling;
[0014] (2.2) Online data augmentation is used to augment the images in the training set. The main data augmentation methods used include image flipping, Gaussian noise, image blurring, random lighting, and contrast.
[0015] (2.3) Convert the crop leaf image from RGB color space to Lab color space and perform normalization processing.
[0016] Furthermore, the construction of the crop leaf disease identification model based on multi-resolution dual-path features described in step (3) specifically includes:
[0017] (3.1) Two feature extraction branches are used to extract shallow features from the L-channel image and the ab-channel image respectively. The input image of each branch is obtained by adaptive average pooling to obtain images with resolutions of 128×128, 64×64, 32×32 and 16×16. The images of different resolutions are processed by 1×1 convolution, BatchNorm and ReLU activation function in sequence. In order to facilitate the calculation of subsequent networks, bilinear interpolation is used to upsample the processed feature map to restore it to the size of the input image and concatenate it with the input image. The concatenated result is input into three 3×3 convolutions for shallow feature extraction.
[0018] (3.2) The shallow features extracted from the two branches are concatenated and then input into a 1×1 convolution for feature fusion. The fused result is then downsampled by max pooling.
[0019] (3.3) After downsampling, the feature map is sequentially input into multiple multi-scale attention residual modules for deep feature extraction. In the multi-scale attention residual module, the input feature map is split into four parts in the channel dimension. The split feature map is then input into 1×1 convolution, 3×3 convolution, 5×5 convolution and max pooling for feature extraction at different scales. The 5×5 convolution is replaced by two 3×3 convolutions. The extracted features at different scales are then fused through channel attention, 1×1 convolution and spatial attention. The fused features are added to the input features and used as the output of the multi-scale attention residual module. Channel attention is used to analyze the relationships between feature map channels, assigning a weight to each channel to obtain information about key features. Specifically, it uses the ECA module, which involves using global average pooling to obtain the global average value of the input feature map in the spatial dimension, then performing a 3×3 one-dimensional convolution in the channel direction. The result of the convolution is then processed by the Sigmoid function to obtain the attention score of the feature map in the channel direction. Multiplying the attention score by the input feature map gives the result of channel attention processing. Spatial attention is used to analyze the relationships between different regions of the feature map, assigning a weight to each pixel to obtain information about key regions. Specifically, it uses the spatial attention part of the CBAM module, which involves calculating the maximum and average values of the input feature map in the channel dimension, concatenating the calculated results and inputting them into a 7×7 convolution. The result of the convolution is then processed by the Sigmoid function to obtain the attention score of the feature map in the spatial dimension. Multiplying the attention score by the input feature map gives the result of spatial attention processing. Specifically, the multi-scale attention residual module in some parts of the model downsamples the input feature map. At this time, an average pooling is added after the 1×1 convolution to downsample the feature map. The input features are downsampled by a 3×3 convolution before being added to the fused features.
[0020] (3.4) The feature map output by the last multi-scale attention residual module is input into a 1×1 convolution for further feature fusion. The fused features are then processed by global average pooling, fully connected layers and LogSoftmax to obtain the prediction results for each category.
[0021] (3.5) To address the class imbalance problem in the experimental dataset, the model is trained using a cross-entropy loss function with class weights.
[0022] (3.6) After training, a crop leaf disease identification model can be obtained.
[0023] Furthermore, the crop leaf disease identification process described in step (4) specifically includes:
[0024] (4.1) Adjust the size of the crop leaf image to 256×256 by upsampling and downsampling;
[0025] (4.2) Convert the adjusted image from the RGB color space to the Lab color space and normalize the image data.
[0026] (4.3) Input the normalized image data into the crop leaf disease identification model for processing to obtain the prediction results of the crop leaf images belonging to each category.
[0027] (4.4) Extract the index of the maximum value in the prediction results. The corresponding category name is the identification result of crop leaf diseases.
[0028] A second aspect of the present invention relates to a crop leaf disease identification device based on multi-resolution dual-path features, comprising a memory and one or more processors, wherein the memory stores executable code, and the one or more processors execute the executable code to implement a crop leaf disease identification method based on multi-resolution dual-path features of the present invention.
[0029] A third aspect of the present invention relates to a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements a method for identifying crop leaf diseases based on multi-resolution dual-path features.
[0030] Compared with the prior art, the advantages of the present invention are:
[0031] (1) It has realized the identification of diseases of different degrees in leaf images of various crops, and can accurately identify diseases in the early stage, which is conducive to timely disease prevention and control in actual agricultural production.
[0032] (2) The model achieves higher recognition accuracy. Two branches are used in the shallow network to extract features from color-independent information in the L channel and color-related information in the ab channels, respectively. Furthermore, an image pyramid is constructed at the input to obtain image information at different resolutions, increasing the diversity of features extracted by the shallow network. Channel attention and spatial attention mechanisms are introduced into the multi-scale residual module, improving the attention paid to important information during multi-scale feature fusion. Attached Figure Description
[0033] Figure 1 This is a flowchart illustrating the crop leaf disease identification method based on multi-resolution dual-path features as described in this invention.
[0034] Figure 2This is a schematic diagram of the structure of the crop leaf disease identification model based on multi-resolution dual-path features described in this invention. Detailed Implementation
[0035] The technical solutions in the embodiments of the present invention will be fully described below. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0036] Example 1
[0037] One embodiment of the present invention, such as Figure 1 As shown, a method for identifying crop leaf diseases based on multi-resolution dual-path features is provided, including the following steps:
[0038] (1) Obtain a crop leaf disease dataset, process the label crossover and labeling errors in the dataset to obtain an experimental dataset, and then divide the experimental dataset into training set, validation set and test set according to the proportion;
[0039] The obtained crop leaf disease dataset is the crop disease dataset from the 2018 Global AI Challenge. This dataset contains 31,718 training images and 4,540 validation images, including data on different severity levels of 27 disease types in 10 crops.
[0040] To facilitate model training and evaluation, the images in the dataset are first stored in corresponding folders according to their label categories, with the folder name being the category label name of the image. Then, the training images and validation images are merged. After processing the dataset, stratified sampling is used to re-divide the training set, validation set, and test set in a 6:2:2 ratio.
[0041] Due to label overlap and annotation errors in the original dataset, data on the severity of 10 disease types from 7 crops were selected as the experimental dataset. The selected categories include: apple healthy, apple black spot disease (moderate), apple black spot disease (severe), apple cedar rust disease (moderate), apple cedar rust disease (severe), cherry healthy, cherry powdery mildew (moderate), cherry powdery mildew (severe), grape healthy, grape ring spot disease (moderate), grape ring spot disease (severe), grape black rot disease (moderate), grape black rot (severe), peach healthy, peach scab disease (moderate), peach scab disease (severe), pepper healthy, pepper scab disease (moderate), pepper scab disease (severe), potato healthy, potato early blight disease (moderate), potato early blight disease (severe), potato late blight disease (moderate), potato late blight disease (severe), strawberry healthy, strawberry leaf blight disease (moderate), strawberry leaf blight disease (severe). To address the issue of partially mislabeled images in the dataset, since labeling crop disease severity levels requires labelers to have relevant professional background knowledge, this embodiment employs a simple method of deleting obviously mislabeled images. Specifically, deleted images include those where the crop type does not match the label, those showing disease but incorrectly labeled, those without disease but incorrectly labeled, and images with the same image appearing in different categories. The final processed experimental dataset contains a total of 13,307 crop leaf images.
[0042] (2) Preprocess the crop leaf images in the experimental dataset to obtain the processed image data;
[0043] Since the images in the dataset have different resolutions, in order to better train the model, all images were resized to 256×256 by upsampling and subsampling to match the model input.
[0044] To improve the robustness of the model, online data augmentation is used to expand the images in the training set during the model training process. The data augmentation methods used in this embodiment mainly include image flipping, Gaussian noise, image blurring, random lighting, and contrast.
[0045] Before training the image input model, color space conversion and normalization are required. In this embodiment, the rgb2lab method of the color module in the skimage library is used to convert the crop leaf image from the RGB color space to the Lab color space. The normalization method used is as follows: divide the image data of the L channel by 100 and add 0.5, and divide the image data of the ab channels by 200 and add 0.5.
[0046] (3) Construct a crop leaf disease identification model based on multi-resolution dual-path features, and use the training set images obtained in step (2) to train the model, and obtain a trained crop leaf disease identification model.
[0047] The constructed network model is as follows Figure 2 As shown, the preprocessed L-channel image and ab-channel image are respectively input into two feature extraction branches for shallow feature extraction. The input image of each branch is downsampled through adaptive average pooling to obtain images with resolutions of 128×128, 64×64, 32×32, and 16×16. Images of different resolutions are processed sequentially through 1×1 convolution, BatchNorm, and ReLU activation functions. To facilitate subsequent network computation, bilinear interpolation is used to upsample the processed feature map to restore it to the size of the input image and concatenate it with the input image. The concatenated result is input into three 3×3 convolutions for shallow feature extraction.
[0048] The shallow features extracted from the two branches are concatenated and then input into a 1×1 convolution for feature fusion. The fused result is then downsampled by max pooling.
[0049] After downsampling, the feature map is sequentially input into nine multi-scale attention residual modules for deep feature extraction. In the multi-scale attention residual module, the input feature map is divided into four parts in the channel dimension. The split feature map is then processed by 1×1 convolution, 3×3 convolution, 5×5 convolution and max pooling to extract features at different scales. The 5×5 convolution is replaced by two 3×3 convolutions. The extracted features at different scales are then fused by channel attention, 1×1 convolution and spatial attention. The fused features are added to the input features and used as the output of the multi-scale attention residual module. Channel attention is used to analyze the relationships between feature map channels, assigning a weight to each channel to obtain information about key features. Specifically, it uses the ECA module, which involves using global average pooling to obtain the global average value of the input feature map in the spatial dimension, then performing a 3×3 one-dimensional convolution in the channel direction. The result of the convolution is then processed by the Sigmoid function to obtain the attention score of the feature map in the channel direction. Multiplying the attention score by the input feature map gives the result of channel attention processing. Spatial attention is used to analyze the relationships between different regions of the feature map, assigning a weight to each pixel to obtain information about key regions. Specifically, it uses the spatial attention part of the CBAM module, which involves calculating the maximum and average values of the input feature map in the channel dimension, concatenating the calculated results and inputting them into a 7×7 convolution. The result of the convolution is then processed by the Sigmoid function to obtain the attention score of the feature map in the spatial dimension. Multiplying the attention score by the input feature map gives the result of spatial attention processing. Specifically, the input feature maps are downsampled in the first, fifth, and eighth multi-scale attention residual modules of the model. At this time, an average pooling is added after the 1×1 convolution to downsample the feature maps. The input features are downsampled by a 3×3 convolution before being added to the fused features.
[0050] The feature map output from the last multi-scale attention residual module is input into a 1×1 convolution for further feature fusion. The fused features are then processed by global average pooling, a fully connected layer, and LogSoftmax to obtain the prediction results for each category.
[0051] To address the class imbalance issue in the experimental dataset, the model was trained using a cross-entropy loss function with class weights.
[0052] The training details of the model are as follows: the Adam optimizer is used, with an initial learning rate of 0.001, weight decay of 0.00005, batas of (0.5, 0.999), and Amsgrad set to True. The batch size during training is 64, the maximum number of iterations is 300, and the learning rate is dynamically adjusted using the Warmup strategy and CosineLRScheduler. Early stopping is used to avoid overfitting. The recognition accuracy on the validation set is used as the metric. If the recognition accuracy on the validation set does not improve in the last 50 iterations, the model training process is stopped and the optimal model parameters are saved.
[0053] (4) Obtain crop leaf images, process the crop leaf images and input them into the crop leaf disease identification model obtained in step (3) to obtain crop leaf disease identification results.
[0054] Select crop leaf images from the local database and resize them to 256×256 using upsampling and subsampling to match the model input.
[0055] The rgb2lab method of the color module in the skimage library is used to convert the adjusted image from the RGB color space to the Lab color space, and the image data is normalized. The normalization method used is: divide the image data of the L channel by 100 and add 0.5, and divide the image data of the ab channel by 200 and add 0.5.
[0056] The normalized image data is input into the crop leaf disease identification model for processing to obtain the prediction results of the crop leaf image belonging to each category. Specifically, it is represented as a one-dimensional vector with a length equal to the number of types that the model can identify. Each value in the vector corresponds to the result of the model predicting the specified category.
[0057] Extract the index of the maximum value in the model prediction results; the corresponding category name is the identification result of crop leaf diseases.
[0058] This invention enables the identification of diseases at different stages in leaf images of various crops. It can accurately identify diseases in the early stages and has a good recognition accuracy, which is beneficial for timely disease prevention and control in actual agricultural production.
[0059] Example 2
[0060] This embodiment relates to a crop leaf disease identification device based on multi-resolution dual-path features, including a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they are used to implement a crop leaf disease identification method based on multi-resolution dual-path features according to Embodiment 1.
[0061] Example 3
[0062] This embodiment relates to a computer-readable storage medium storing a program that, when executed by a processor, implements a crop leaf disease identification method based on multi-resolution dual-path features as described in Embodiment 1.
[0063] The above are preferred embodiments of the present invention. Any changes made to the technical solution of the present invention that do not exceed the scope of the technical solution of the present invention shall fall within the protection scope of the present invention.
Claims
1. A method for identifying crop leaf diseases based on multi-resolution dual-path features, characterized in that, Includes the following steps: S1: Obtain a crop leaf disease dataset, process the label crossover and labeling errors in the dataset to obtain an experimental dataset, and then divide the experimental dataset into training set, validation set and test set according to the proportion; S2: Preprocess the crop leaf images in the experimental dataset to obtain processed image data; S3: Construct a crop leaf disease identification model based on multi-resolution dual-path features, and train the model using the training set images obtained in step S2 to obtain a trained crop leaf disease identification model; the construction of the crop leaf disease identification model based on multi-resolution dual-path features specifically includes: S31: Two feature extraction branches are used to extract shallow features from the L-channel image and the ab-channel image respectively. The input image of each branch is obtained by adaptive average pooling to obtain images with resolutions of 128×128, 64×64, 32×32 and 16×16. The images of different resolutions are processed by 1×1 convolution, BatchNorm and ReLU activation function in sequence. In order to facilitate the calculation of subsequent networks, bilinear interpolation is used to upsample the processed feature map to restore it to the size of the input image and concatenate it with the input image. The concatenated result is input into three 3×3 convolutions for shallow feature extraction. S32: The shallow features extracted from the two branches are concatenated and then input into a 1×1 convolution for feature fusion. The fused result is then downsampled by max pooling. S33: After downsampling, the feature map is sequentially input into multiple multi-scale attention residual modules for deep feature extraction. In the multi-scale attention residual module, the input feature map is evenly split into four parts along the channel dimension. The split feature maps are then input into 1×1 convolution, 3×3 convolution, 5×5 convolution, and max pooling for feature extraction at different scales. The 5×5 convolution is replaced by two 3×3 convolutions. The extracted features at different scales are then fused using channel attention, 1×1 convolution, and spatial attention. The fused features are added to the input features and used as the output of the multi-scale attention residual module. Channel attention is used to analyze the relationship between the channels of the feature map, assigning a weight to each channel to obtain information about key features. Specifically, the ECA module is used, including using global average pooling to obtain the global average value of the input feature map in the spatial dimension, and then performing a 3×3 one-dimensional convolution along the channel direction. The result after convolution is processed by Sigmoid. After function calculation, the attention score of the feature map in the channel direction is obtained. Multiplying the attention score with the input feature map yields the result after channel attention processing. Spatial attention is used to analyze the relationship between different regions of the feature map, assigning a weight to each pixel and obtaining information about key regions. It uses the spatial attention part of the CBAM module, which includes calculating the maximum and average values of the input feature map in the channel dimension, concatenating the calculated results and inputting them into a 7×7 convolution. The result after convolution is calculated by the Sigmoid function to obtain the attention score of the feature map in the spatial dimension. Multiplying the attention score with the input feature map yields the result after spatial attention processing. The multi-scale attention residual module in the model part downsamples the input feature map. At this time, an average pooling is added after the 1×1 convolution to downsample the feature map. Before the input features are added with the fused features, they are downsampled by a 3×3 convolution. S34: The feature map output from the last multi-scale attention residual module is input into a 1×1 convolution for further feature fusion. The fused features are then processed by global average pooling, a fully connected layer, and LogSoftmax to obtain the prediction results for each category. S35: To address the class imbalance issue in the experimental dataset, the model is trained using a cross-entropy loss function with class weights; S36: After training, a crop leaf disease identification model can be obtained; S4: Obtain crop leaf images, process the crop leaf images, and input them into the crop leaf disease identification model obtained in step S3 to obtain crop leaf disease identification results.
2. The method for identifying crop leaf diseases based on multi-resolution dual-path features as described in claim 1, characterized in that, The crop leaf disease dataset mentioned in step S1 is the crop disease dataset from the 2018 Global AI Challenge. This dataset contains data on different types and degrees of diseases in various crops.
3. The method for identifying crop leaf diseases based on multi-resolution dual-path features as described in claim 1, characterized in that, The data processing method described in step S1 includes selecting some categories of data from the original dataset and deleting images that are obviously mislabeled in the dataset.
4. The method for identifying crop leaf diseases based on multi-resolution dual-path features as described in claim 1, characterized in that, Step S2, the preprocessing of crop leaf images, specifically includes: S21: Adjust the size of all images in the dataset to 256×256 by upsampling and subsampling; S22: Online data augmentation is used to augment the images in the training set. The data augmentation methods used include image flipping, Gaussian noise, image blurring, random lighting, and contrast. S23: Convert the crop leaf image from RGB color space to Lab color space and perform normalization processing.
5. The method for identifying crop leaf diseases based on multi-resolution dual-path features as described in claim 1, characterized in that, Step S4, the process of identifying crop leaf diseases, specifically includes: S41: Adjust the size of the crop leaf image to 256×256 by upsampling and subsampling; S42: Convert the adjusted image from the RGB color space to the Lab color space and normalize the image data; S43: Input the normalized image data into the crop leaf disease identification model for processing to obtain the prediction results of the crop leaf image belonging to each category; S44: Extract the index of the maximum value in the predicted results; the corresponding category name is the identification result of crop leaf diseases.
6. A crop leaf disease identification device based on multi-resolution dual-path features, characterized in that, The device includes a memory and one or more processors, wherein the memory stores executable code, and the one or more processors execute the executable code to implement the crop leaf disease identification method based on multi-resolution dual-path features as described in any one of claims 1-5.
7. A computer-readable storage medium, characterized in that, It stores a program that, when executed by a processor, implements a method for identifying crop leaf diseases based on multi-resolution dual-path features, as described in any one of claims 1-5.
Citation Information
Patent Citations
CNN and transfer learning based disease intelligent identification method and system
AU2020103613A4
Remote sensing image classification method of double-branch fusion multi-scale attention neural network
CN111523521A
