A wheat disease detection method of a lightweight multi-scale CNN model
By using a lightweight multi-scale CNN model, combined with the Inception-Resnet-CN network and attention module, the problem of wheat disease identification on resource-constrained devices was solved, achieving fast and accurate wheat disease detection while reducing costs and resource requirements.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HENAN UNIVERSITY OF TECHNOLOGY
- Filing Date
- 2023-04-27
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, wheat disease identification methods rely on cumbersome manual feature extraction or resource- and time-intensive deep learning, making it difficult to efficiently identify wheat diseases on resource-constrained mobile devices, and the identification accuracy is not high.
We employ a lightweight multi-scale CNN model, including the Inception-Resnet-CN network architecture, combined with CBAM and NAM attention modules, and expand the dataset through rotation, flipping, and contrast adjustments to design a wheat disease detection method suitable for mobile devices.
It enables rapid and accurate identification of wheat diseases in complex environments, reduces resource requirements, is suitable for mobile devices, improves identification speed and accuracy, and reduces deployment costs.
Smart Images

Figure CN116645599B_ABST
Abstract
Description
A lightweight multi-scale CNN model for wheat disease detection Technical Field
[0001] This invention relates to the field of wheat disease detection technology, and in particular to a method for wheat disease detection using a lightweight multi-scale CNN model. Background Technology
[0002] Wheat yield and quality are influenced by a variety of factors, with wheat diseases being not only a crucial one but also a major factor restricting the efficient production of high-quality wheat. There are numerous types of wheat diseases; over 200 can be identified worldwide. In China, approximately 20 wheat diseases are considered severe, with powdery mildew, wheat rust, and wheat leaf blight being typical and serious examples. In China, wheat yields are reduced by nearly one-third due to disease, posing a significant threat to grain production.
[0003] Machine learning-based wheat disease identification methods rely on explicit feature extraction from images. These feature extraction strategies are developed based on prior knowledge, which is cumbersome and inefficient, as feature extraction depends on the knowledge and experience of researchers. Furthermore, these manually extracted features often exist in the shallow layers of the image and have a narrow applicability.
[0004] Deep learning-based wheat disease identification methods are resource and time-intensive, have high deployment costs, are difficult to apply to resource-constrained scenarios such as mobile and embedded devices, and their accuracy is difficult to guarantee.
[0005] In rural areas, farmers often lack access to disease experts or expensive equipment for disease identification, relying instead on experience to determine crop disease status. Therefore, developing a simple, computationally efficient, widely applicable wheat disease identification method that can be integrated into mobile devices is crucial for helping farmers identify wheat diseases and improving wheat yield and quality. Summary of the Invention
[0006] The purpose of this invention is to overcome the problems of cumbersome manual detection steps, low accuracy of machine learning methods in disease identification, and high deployment and usage costs of classic deep learning methods, which are difficult to apply to resource-constrained mobile and embedded devices. Instead, this invention provides a lightweight multi-scale CNN model for wheat disease detection. This invention has a simple structure, low computational load, and wide applicability.
[0007] The objective of this invention is achieved through the following measures: a lightweight multi-scale CNN model for wheat disease detection, comprising the following steps:
[0008] S1. Collect images of wheat diseases using imaging equipment, standardize the size of the wheat disease images, and classify and label each type of disease.
[0009] S2. Wheat disease data were expanded to 8495 images by rotation, symmetrical flipping, and increased contrast; the dataset was divided according to the ratio of training set:validation set:test set = 6:2:2.
[0010] S3. Design a network model for wheat disease image detection; the network model used is Inception-Resnet-CN, and the specific process is as follows:
[0011] The model takes a 224×224×3 RGB image as input. The model architecture includes three different Inception modules, two max pooling layers, six Residual-CN modules, an average pooling layer, and a fully connected layer. The Inception modules can reduce the complex matrix dimensions and aggregate visual information at different sizes. The Residual-CN modules enhance the representation of disease features and reduce the impact of complex backgrounds in the image on the model's recognition performance.
[0012] S4. Train the wheat disease training samples obtained in S2 in the network model designed in S3 and test them on the test set.
[0013] S5. Validate the trained model on the validation set to quickly and accurately identify various wheat diseases.
[0014] Preferably, step S1 specifically involves: saving the collected wheat disease images in the same image format and ensuring uniform image size; and classifying and labeling the collected images.
[0015] Preferably, in step S2, the collected wheat disease samples are taken from actual wheat fields, and the dataset consists of 3003 images. The wheat disease data is expanded to 8495 images through operations such as rotation, symmetrical flipping, and increasing contrast. The data is then divided into a training set of 5097 images, a validation set of 1699 images, and a test set of 1699 images according to the ratio of training set:validation set:test set = 6:2:2.
[0016] Preferably, in step S3, CBAM and NAM attention modules are added to each residual module; the overall attention process of CBAM can be summarized as follows:
[0017]
[0018]
[0019] Where Y∈C×W×H is the input feature map, C represents the number of channels in the feature map, W represents the width of the feature map, H represents the height of the feature map; Mc represents the channel attention mechanism. Ms represents element-wise multiplication; Y' and Y'' are the output feature maps.
[0020] The overall attention process of NAM can be summarized as follows:
[0021] Channel attention module:
[0022]
[0023]
[0024]
[0025]
[0026]
[0027] ⊙
[0028] Where x is the input feature map, C is the number of channels, GlobalAvgPool and GlobalStdPool are global average pooling and global standard deviation pooling, respectively, ScaleFactor is the scaling factor, and w c is the channel weight vector, Threshold is the threshold function, ⊙ is the element-wise multiplication, and x′ is the output feature map;
[0029] Spatial attention module:
[0030]
[0031]
[0032]
[0033]
[0034]
[0035] ⊙
[0036] Where x is the input feature map, H and W are the height and width respectively, Conv1 and Conv2 are two convolutional layers, ScaleFactor is the scaling factor, and w s is the spatial weight matrix, Threshold is the threshold function, ⊙ is the element-wise multiplication, and x′ is the output feature map.
[0037] Preferably, the training method of the network model in step S4 is as follows: during training, the image is scaled to 224 × 224, and the learning rate is adjusted by Adam-optimized gradient descent, with the number of images processed in each iteration set to 64, the number of iterations set to 70, and the learning rate set to 0.001.
[0038] Preferably, in step S4, cross-entropy is used to calculate the classification loss, and L2 regularization is added to penalize the weight parameters. The mathematical formula is: J(θ) = -∑ p(x) log2q(x) + λ‖ θ ‖ 2 In the formula: p(x) is the target probability distribution; q(x) is the prediction distribution; θ is the weight parameter; λ is the regularization coefficient; ||θ|| 2 It is a regularization term.
[0039] Preferably, the acquisition of wheat disease images in step S1 specifically involves: taking batch images of wheat in farmland using an acquisition device, and then performing image preprocessing.
[0040] The beneficial effects of this invention are as follows: Compared with traditional machine learning methods for wheat disease detection, this invention is faster, more accurate, and more robust; compared with existing deep learning methods for wheat disease detection, this invention can efficiently and quickly identify wheat diseases in complex backgrounds, has lower resource requirements, saves costs, and can be deployed on mobile devices; compared with wheat disease detection based on spectral images, this invention reduces the cost of experimental equipment; this invention is reasonably designed, realizes wheat disease detection in real environments, accurately identifies disease categories, and has the advantage of high speed. Attached Figure Description
[0041] Figure 1 is a flowchart of wheat disease detection;
[0042] Figure 2 shows the categories of wheat diseases;
[0043] Figure 3 shows the structure of the Inception-Resnet-CN model;
[0044] Figure 4 shows the training results of the seven models on the dataset. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] Example 1: As shown in Figures 1-4, a lightweight multi-scale CNN model for wheat disease detection includes the following steps:
[0047] S1. Collect images of wheat diseases using imaging equipment, standardize the size of the wheat disease images, and classify and label each type of disease.
[0048] S2. Wheat disease data were expanded to 8495 images by rotation, symmetrical flipping, and increased contrast; the dataset was divided according to the ratio of training set:validation set:test set = 6:2:2.
[0049] S3. Design a network model for wheat disease image detection;
[0050] S4. Train the wheat disease training samples obtained in S2 in the network model designed in S3 and test them on the test set.
[0051] S5. Validate the trained model on the validation set to quickly and accurately identify various wheat diseases.
[0052] Step S1 specifically involves: saving the collected wheat disease images in the same image format and ensuring uniform image size; classifying and labeling the collected images; the collection of wheat disease images in step S1 specifically involves: taking batch photos of farmland wheat images using a data acquisition device, and then performing image preprocessing.
[0053] As shown in Figure 2, in step S2, the collected wheat disease samples were photographed in actual wheat fields, resulting in a dataset of 3003 images. The dataset was expanded to 8495 images through operations such as rotation, symmetrical flipping, and contrast enhancement (1156 images for leaf rust, 1380 images for powdery mildew, 1342 images for wheat smut, 1096 images for root rot, 1161 images for Fusarium head blight, 1272 images for tar spot, and 1086 images for healthy wheat). The data was then divided into a training set of 5097 images, a validation set of 1699 images, and a test set of 1699 images, with each category allocated in a 6:2:2 ratio.
[0054] As shown in Figure 3, the network model used in step S3 is Inception-Resnet-CN, and the specific process is as follows:
[0055] The model takes a 224×224×3 RGB image as input. The model architecture includes three different Inception modules, two max-pooling layers, six Residual-CN modules, an average pooling layer, and a fully connected layer. The Inception modules reduce the complexity of matrix dimensions and aggregate visual information from different sizes. The Residual-CN modules enhance the representation of disease features and reduce the impact of complex backgrounds on the model's recognition performance. The Inception-A module uses 1×1 and 3×3 convolutions, with two 3×3 convolutions replacing 5×5 convolutions in parallel combination. The number of kernels in branches 1 through 4 are 8, 12, 24, 8, 12, 24, and 24, respectively. The Residual-CN-A module includes two 3×3 convolutional layers, a CBAM module, a NAM module, and an identity mapping. The number of kernels in Residual-CN-A1 through A4 are 64, 128, 128, and 256, respectively. The Residual-CN-B module, building upon the Residual-CN-A module, achieves channel matching between the two pathways through 1×1 convolutions at the identity mapping. The number of convolutional kernels in Residual-CN-B1 to B2 are 128 and 256, respectively. The Inception-B module uses a combination of 1×1 convolutions, asymmetric 1×7 convolutions, and 7×1 convolutions in a cascaded manner. The number of convolutional kernels in branch1 to branch4 are 32, 32, 64, 64, 32, 64, 64, 64, 64, 32, respectively. The Inception-C module uses a combination of 1×1 convolutions, asymmetric 1×3 convolutions, and 3×1 convolutions in a cascaded-parallel manner. The number of convolutional kernels in branch1 to branch4 are 64, 64, 128, 96, 96, 256, 256, 256, 96, 96, respectively.
[0056] In step S3, CBAM and NAM attention modules are added to each residual module; the overall attention process of CBAM can be summarized as follows:
[0057]
[0058]
[0059] in, C represents the number of channels in the input feature map, W represents the width of the feature map, and H represents the height of the feature map; Mc represents the channel attention mechanism. Ms represents element-wise multiplication; Y' and Y'' are the output feature maps.
[0060] The overall attention process of NAM can be summarized as follows:
[0061] Channel attention module:
[0062]
[0063]
[0064]
[0065]
[0066]
[0067] ⊙
[0068] Where x is the input feature map, C is the number of channels, GlobalAvgPool and GlobalStdPool are global average pooling and global standard deviation pooling, respectively, ScaleFactor is the scaling factor, and w c is the channel weight vector, Threshold is the threshold function, ⊙ is the element-wise multiplication, and x′ is the output feature map.
[0069] Spatial attention module:
[0070]
[0071]
[0072]
[0073]
[0074]
[0075] ⊙
[0076] Where x is the input feature map, H and W are the height and width respectively, Conv1 and Conv2 are two convolutional layers, ScaleFactor is the scaling factor, and w sis the spatial weight matrix, Threshold is the threshold function, ⊙ is the element-wise multiplication, and x′ is the output feature map.
[0077] The specific training method for the network model in step S4 is as follows: during training, the image is scaled to 224 × 224, and the learning rate is adjusted by Adam-optimized gradient descent, with the number of images processed in each iteration set to 64, the number of iterations set to 70, and the learning rate set to 0.001.
[0078] In step S4, cross-entropy is used to calculate the classification loss, and L2 regularization is added to penalize the weight parameters. The mathematical formula is: J(θ) = -∑ p(x) log2q(x) + λ‖ θ ‖ 2 In the formula: p(x) is the target probability distribution; q(x) is the prediction distribution; θ is the weight parameter; λ is the regularization coefficient; ||θ|| 2 It is a regularization term.
[0079] Model performance evaluation metrics
[0080]
[0081]
[0082] Precision refers to the proportion of correctly predicted positive samples. Accuracy is the percentage of correctly predicted positive samples. Recall is the percentage of correctly predicted positive samples. The F1 score is a weighted average of precision and recall. TP represents the number of samples predicted as positive when the actual value is true, TN represents the number of samples predicted as negative when the actual value is true, FP represents the number of samples predicted as positive when the actual value is false, and FN represents the number of samples predicted as negative when the actual value is false.
[0083] Referring to Figure 4, the obtained data was used to train various models, and the performance of different algorithms was compared.
[0084] The InceptionResnet-CN model achieved the highest accuracy of 98.76%, demonstrating excellent performance. After evaluation, the model detected wheat diseases in images and output disease categories with a high detection rate, making a significant contribution to food security and agricultural development.
[0085] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for wheat disease detection using a lightweight multi-scale CNN model, characterized in that: The process includes the following steps: S1. Acquire wheat disease images using imaging equipment, standardize the image size, and classify and label each type of disease; S2. Expand the wheat disease data by rotation, symmetrical flipping, and increasing contrast, increasing the original dataset to 8495 images; divide the dataset according to a training set:validation set:test set ratio of 6:2:2; S3. Design a network model for wheat disease image detection; the network model used is Inception-Resnet-CN, and the specific process is as follows: the model input is a 224×224×3 RGB image, and the model architecture includes three different Inception modules, two max pooling layers, and six Resnet layers. The system consists of a dual-CN module, an average pooling layer, and a fully connected layer. The Inception module reduces the complexity of matrix dimensions and aggregates visual information at different sizes. The Residual-CN module enhances the representation of disease features and reduces the impact of complex backgrounds on model recognition performance. The Residual-CN module includes two types: Residual-CN-A and Residual-CN-B. The Residual-CN-A module consists of two 3×3 convolutional layers, a CBAM module, a NAM module, and an identity mapping. The Residual-CN-A1 to A4 modules have 64 convolutional kernels each. 128, 128, 256; The Residual-CN-B module, based on the Residual-CN-A module, achieves the matching of the number of channels in the two pathways through 1×1 convolution at the identity mapping. The number of convolution kernels in Residual-CN-B1~B2 is 128 and 256 respectively; S4, Train the wheat disease training samples obtained in S2 in the network model designed in S3 and test it on the test set; S5, Validate the trained model on the validation set to quickly and accurately identify various wheat diseases.
2. The method for wheat disease detection using a lightweight multi-scale CNN model according to claim 1, characterized in that: Step S1 specifically involves: saving the collected wheat disease images in the same image format and ensuring uniform image size; and classifying and labeling the collected images.
3. The method for wheat disease detection using a lightweight multi-scale CNN model according to claim 1, characterized in that: In step S2, the collected wheat disease samples were taken from actual wheat fields, and the dataset consisted of 3003 images. The wheat disease data was expanded to 8495 images by rotating, symmetrically flipping, and increasing contrast. The data was then divided into a training set of 5097 images, a validation set of 1699 images, and a test set of 1699 images according to the ratio of training set:validation set:test set = 6:2:
2.
4. The method for wheat disease detection using a lightweight multi-scale CNN model according to claim 3, characterized in that: In step S3, CBAM and NAM attention modules are added to each layer of residual modules; The overall attention process of CBAM is as follows: , Where Y∈C×W×H is the input feature map, C represents the number of channels in the feature map, W represents the width of the feature map, H represents the height of the feature map; Mc represents the channel attention mechanism. represents element-wise multiplication; Ms represents spatial attention mechanism; Y' and Y'' are output feature maps; the overall attention process of NAM is: Channel attention module: , , , , , ⊙ Where x is the input feature map, C is the number of channels, GlobalAvgPool and GlobalStdPool are global average pooling and global standard deviation pooling, respectively, ScaleFactor is the scaling factor, and w c Here, is the channel weight vector, Threshold is the threshold function, ⊙ is element-wise multiplication, and x′ is the output feature map; Spatial attention module: , , , , , ⊙ Where x is the input feature map, H and W are the height and width respectively, Conv1 and Conv2 are two convolutional layers, ScaleFactor is the scaling factor, and w s is the spatial weight matrix, Threshold is the threshold function, ⊙ is the element-wise multiplication, and x′ is the output feature map.
5. The method for wheat disease detection using a lightweight multi-scale CNN model according to claim 1, characterized in that: The specific training method for the network model in step S4 is as follows: during training, the image is scaled to 224 × 224, and the learning rate is adjusted by Adam-optimized gradient descent, with the number of images processed in each iteration set to 64, the number of iterations set to 70, and the learning rate set to 0.
001.
6. The method for wheat disease detection using a lightweight multi-scale CNN model according to claim 1, characterized in that: In step S4, cross-entropy is used to calculate the classification loss, and L2 regularization is added to penalize the weight parameters. The mathematical formula is: J(θ) = -∑ p(x) log2q(x) + λ‖ θ ‖ 2 In the formula: p(x) is the target probability distribution; q(x) is the prediction distribution; θ is the weight parameter; λ is the regularization coefficient; ||θ|| 2 It is a regularization term.
7. The method for wheat disease detection using a lightweight multi-scale CNN model according to claim 1, characterized in that: The acquisition of wheat disease images in step S1 specifically involves: taking batch images of wheat in farmland using acquisition equipment, and then performing image preprocessing.
Citation Information
Patent Citations
Lightweight wheat scab detection method based on YOLOv4
CN114972208A