Crop disease image recognition method and system
By combining a lightweight convolutional neural network LW-EfficientNet with a meta-learner, the real-time and computational resource problems of traditional crop disease identification are solved, achieving fast and accurate disease identification. It is suitable for mobile terminals such as smartphones and field operations.
Patent Information
- Application Number
- CN202310524546.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-05-10
AI Technical Summary
Traditional crop disease identification relies on manual diagnosis, which is characterized by poor real-time performance, low efficiency, and strong subjectivity. Deep learning technology faces challenges in crop disease image recognition due to network complexity and high computational resource requirements.
A method combining a lightweight convolutional neural network LW-EfficientNet and a meta-learner is adopted. By processing crop disease images through image segmentation, enhancement and normalization, and training sub-classifiers using multiple base classifiers and K-fold cross-validation, fast and accurate disease identification is achieved.
It enables rapid, accurate, and reliable identification of crop diseases, improves the accuracy and generalizability of the identification system, is suitable for field operations, and broadens the scope of application.
Smart Images

Figure CN116758412B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital image processing technology, and in particular to a method and system for recognizing crop disease images. Background Technology
[0002] Traditional crop disease identification relies primarily on on-site diagnosis by professional plant protection personnel, which suffers from poor real-time performance, low efficiency, and strong subjectivity in identification results, making it difficult to achieve precise disease control. In recent years, deep learning technology has achieved great success in image classification applications, providing an effective technique for accurate identification of crop disease images. However, in practical applications, it still faces challenges such as complex network structures, difficulty in training network models, and the need for substantial hardware computing resources.
[0003] Therefore, researching a lightweight method for identifying crop disease images to achieve rapid, accurate, and reliable identification of crop disease images, and providing technical support for the precise prevention and control of crop diseases, is a technical problem that the industry urgently needs to solve. Summary of the Invention
[0004] The present invention provides a method and system for identifying crop disease images, which solves the problem in the prior art of making it difficult to quickly, accurately and reliably identify the types of diseases in crop images.
[0005] The present invention provides a method for recognizing crop disease images, comprising:
[0006] Acquire images of crop diseases to be identified;
[0007] The image of the crop disease to be identified is input into n pre-trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each pre-trained base classifier is obtained by training the same base classifier with different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n pre-trained base classifiers.
[0008] The target feature set is input into the trained meta-learner to obtain the recognition result of the crop disease image to be identified, where n is a positive integer greater than 1.
[0009] According to the method for recognizing crop disease images provided by the present invention, the method for acquiring the trained meta-learner includes:
[0010] The new training sample set is input into the meta-learner for training, and the trained meta-learner is obtained.
[0011] The method for obtaining the new training sample set includes:
[0012] From the set of n pre-constructed base classifiers, one base classifier is selected sequentially as the base classifier to be trained, until all base classifiers in the set have been selected;
[0013] For any of the base classifiers to be trained, K sub-classifiers corresponding to the base classifiers to be trained are generated based on the K-fold cross-validation method, and the sub-classifiers are trained using the training set corresponding to each sub-classifier to obtain trained sub-classifiers, where K is a positive integer greater than 1.
[0014] The test set corresponding to each sub-classifier is input into the trained sub-classifier to obtain the prediction result of the sub-classifier;
[0015] Based on the prediction results of the K sub-classifiers, the prediction result of each trained base classifier is obtained;
[0016] The new training sample set is obtained based on the prediction results of n trained base classifiers and the labels of the training sample set;
[0017] The training and test sets for each sub-classifier are obtained as follows:
[0018] The training sample set is divided into K sub-training sample sets, each sub-training sample set containing the same number of samples;
[0019] K-1 sub-training sample sets are randomly selected as the training set, and the remaining 1 set is used as the test set.
[0020] According to the present invention, a method for recognizing crop disease images is provided.
[0021] The step of obtaining the prediction result of each trained base classifier based on the prediction results of K sub-classifiers includes:
[0022] Obtain the K sub-classifiers corresponding to each trained base classifier, and determine the recognition accuracy of the prediction results of any test sample in the test dataset. Determine the weight of each sub-classifier for any test sample. The recognition accuracy is determined based on the probability value of each sub-classifier correctly recognizing the disease category of any test sample. The test dataset is determined based on the training sample set and includes multiple test samples.
[0023] Based on the weight of each sub-classifier for each test sample, determine the average weight of each sub-classifier for multiple test samples;
[0024] The prediction results of each sub-classifier are weighted according to the average weight of each sub-classifier to obtain the prediction results of each trained base classifier.
[0025] According to the crop disease image recognition method provided by the present invention, the acquisition method of the lightweight convolutional neural network recognition model LW-EfficientNet includes:
[0026] EfficientNet-B0 is used as the base network of LW-EfficientNet; the bottleneck convolutional kernel MBConv in the main module of EfficientNet-B0 is lightly flipped by using the lightweight convolutional attention module CBAM, and the first convolutional layer in EfficientNet-B0 is replaced by the Ghost layer to obtain LW-EfficientNet.
[0027] According to a method for identifying crop disease images provided by the present invention, the step of acquiring the crop disease image to be identified includes:
[0028] Acquire the first image of the crop to be identified;
[0029] The first image is segmented to extract the region where the lesions are located in the first image, thus obtaining the second image;
[0030] The second image is preprocessed to obtain the image of the crop disease to be identified.
[0031] According to a method for recognizing crop disease images provided by the present invention, the method involves image segmentation of a first image, extraction of the region containing lesions from the first image, and obtaining a second image, comprising:
[0032] The largest region in the first image, including lesions, is marked to obtain the first sub-image;
[0033] Repeat the following steps:
[0034] The locations of lesions and background in the first sub-image are identified, and the locations of the lesions and background are used as the initial values for the GrabCut algorithm.
[0035] The first sub-image is segmented based on the GrabCut algorithm to obtain the second sub-image;
[0036] If the second sub-image includes the background, then the second sub-image is used as the first sub-image;
[0037] If the background is not included in the second sub-image, then the second sub-image is used as the second image.
[0038] According to a method for identifying crop disease images provided by the present invention, the second image is preprocessed to obtain the crop disease image to be identified, including:
[0039] The second image is enhanced using a guided filtering method to obtain the third image;
[0040] The third image is normalized to obtain the image of the crop disease to be identified;
[0041] The step of enhancing the second image using a guided filtering method to obtain the third image includes:
[0042] The second image is smoothed based on the guided filtering algorithm, and the second image is divided into a detail image and a base image.
[0043] Based on the brightness distribution features of the second image, the enhancement weights of the detail image are obtained. The brightness distribution features are determined by converting the second image from RGB color space to CIELAB color space, and the brightness space is determined based on the perceived brightness.
[0044] The detailed image and the base image are fused based on the enhancement weights to obtain the third image.
[0045] The present invention also provides a system for recognizing crop disease images, comprising: a first acquisition module, a second acquisition module, and an image recognition module;
[0046] The first acquisition module is used to acquire images of crop diseases to be identified;
[0047] The second acquisition module is used to input the image of the crop disease to be identified into n trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each trained base classifier is obtained by training the same base classifier using different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n trained base classifiers, where n is a positive integer greater than 1.
[0048] The image recognition module is used to input the target feature set into a trained meta-learner to obtain the recognition result of the crop disease image to be identified.
[0049] The present invention also provides an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the crop disease image recognition method as described above.
[0050] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the crop disease image recognition method as described above.
[0051] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the crop disease image recognition method as described above.
[0052] The crop disease image recognition method and system provided by this invention utilizes image processing, deep learning and other technologies to automatically analyze the acquired crop disease images to be identified, and quickly, accurately and reliably identify the types of diseases in the crop disease images to be identified, providing technical support for taking correct disease control measures. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0054] Figure 1 This is one of the flowcharts illustrating the crop disease image recognition method provided by the present invention;
[0055] Figure 2 This is a schematic diagram of the structure of LW-EfficientNet provided by the present invention;
[0056] Figure 3 This is a schematic diagram of the identification process of crop disease images to be identified provided by the present invention;
[0057] Figure 4 This is the second flowchart illustrating the crop disease image recognition method provided by the present invention;
[0058] Figure 5 This is a schematic diagram of the structure of the crop disease image recognition system provided by the present invention;
[0059] Figure 6 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0061] The crop disease image recognition method provided by this invention includes: acquiring a color image of the crop from an image acquisition device; segmenting the image using the GrabCut image segmentation method to accurately extract the lesion region; preprocessing the image using a guided filtering-based image enhancement method; normalizing the color image; constructing a lightweight EfficientNet convolutional neural network recognition model; outputting the recognition result (or prediction result); and taking appropriate disease control measures. The crop disease image recognition method provided by this invention overcomes the problems of inaccurate crop disease image recognition results and inconvenient operation in existing technologies. It combines the advantages of deep convolutional neural networks and ensemble learning techniques, improving not only the accuracy of the recognition system but also its generalization ability. It features high speed, strong continuity, and ease of small-area crop diagnosis. Furthermore, it can be applied to mobile terminals such as smartphones, making it suitable for field operations and broadening its application scope. The specific implementation is as follows:
[0062] Figure 1 This is one of the flowcharts illustrating the crop disease image recognition method provided by the present invention, such as... Figure 1 As shown, the method includes:
[0063] Step 110: Obtain images of crop diseases to be identified;
[0064] Step 120: Input the image of the crop disease to be identified into n trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each trained base classifier is obtained by training the same base classifier using different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n trained base classifiers, where n is a positive integer greater than 1.
[0065] Step 130: Input the target feature set into the trained meta-learner to obtain the recognition result of the crop disease image to be identified.
[0066] It should be noted that the above method can be implemented by computer equipment.
[0067] Optionally, obtaining the image of the crop disease to be identified can be specifically achieved by preprocessing the disease images of crops such as rice, wheat, and corn collected by the image acquisition device. The image of the crop disease to be identified can consist of one or more images, and the image of the crop disease to be identified can specifically be a color image.
[0068] Each trained base classifier is obtained by training different training sample sets into a pre-built base classifier. Each base classifier is built based on the lightweight convolutional neural network recognition model LW-EfficientNet.
[0069] The image of the crop disease to be identified is input into multiple trained base classifiers. Based on the prediction results of the crop disease to be identified output by each trained base classifier, the target feature set of the crop disease to be identified is obtained.
[0070] The target feature set of the obtained crop disease image to be identified is input into the trained meta-learner to obtain the identification result of the disease type of the crop disease image to be identified.
[0071] The crop disease image recognition method provided by this invention uses image processing, deep learning and other technologies to automatically analyze the acquired crop disease images to be identified, and quickly, accurately and reliably identifies the types of diseases in the crop disease images to be identified, providing technical support for taking the correct disease control measures.
[0072] Furthermore, in one embodiment, the method for obtaining the lightweight convolutional neural network recognition model LW-EfficientNet may specifically include:
[0073] EfficientNet-B0 is used as the base network of LW-EfficientNet; the bottleneck convolutional kernel MBConv in the main module of EfficientNet-B0 is lightly flipped by using the lightweight convolutional attention module CBAM, and the first convolutional layer in EfficientNet-B0 is replaced by the Ghost layer to obtain LW-EfficientNet.
[0074] Optionally, Figure 2 Figure 2 shows a schematic diagram of the structure of LW-EfficientNet provided by this invention. The main construction steps of this lightweight convolutional neural network recognition model LW-EfficientNet are as follows:
[0075] Step 1-1: Select EfficientNet-B0 as the base network;
[0076] Steps 1-2: The lightweight convolutional block attention module (CBAM) is used to improve the lightweight inverted bottleneck convolution (MBConv) kernel of the main module in Efficientnet-B0, so as to enhance the learning of spatial information that plays an important role in the identification of crop diseases.
[0077] Steps 1-3 replace the first convolutional layer in EfficientNet-B0 with the Ghost layer to reduce the number of network parameters and computational cost.
[0078] Alternatively, the LW-EfficientNet can be constructed in the following manner:
[0079] First, the input crop disease image (e.g., size: 224×224×3) is processed by a 3×3×32 Ghost convolution;
[0080] Then, after 7 layers of repeated stacking of MBConv, there is a 3×3×16 MBConv1 layer, a 3×3×24 MBConv6 layer, a 5×5×40 MBConv6 layer, a 3×3×80 MBConv6 layer, a 5×5×112 MBConv6 layer, a 5×5×192 MBConv6 layer, and a 3×3×320 MBConv6 layer.
[0081] Finally, the Softmax classification layer is used, and the number of disease categories output is set according to the actual situation, for example, 5 categories.
[0082] LW-EfficientNet is trained using a pre-constructed set of crop disease image samples to form multiple differential base classifiers (i.e., pre-trained base classifiers). The crop disease image sample set includes at least 10,000 images.
[0083] Specifically, the process of training a base classifier using a K-fold cross-validation method (e.g., K=10) to generate multiple differentially differentiated sub-classifiers includes:
[0084] Step 2-1: Use the constructed LW-EfficientNet as the base classifier network model;
[0085] Step 2-2: Construct n different base classifiers using different network optimizers and different network parameters;
[0086] For example, by setting parameters such as optimizer, learning rate, and batch size, n=7 different base classifiers can be set, as follows:
[0087] LW-EfficientNet-1: Optimizer Adam, learning rate 0.001, batch size 32;
[0088] LW-EfficientNet-2: Optimizer Adamax, learning rate 0.002, batch size 16;
[0089] LW-EfficientNet-3: Optimizer SGD, learning rate 0.001, batch size 64;
[0090] LW-EfficientNet-4: Optimizer RMSProp, learning rate 0.002, batch size 32;
[0091] LW-EfficientNet-5: Optimizer AdaGrad, learning rate 0.001, batch size 16;
[0092] LW-EfficientNet-6: Optimizer Nadam, learning rate 0.002, batch size 64;
[0093] LW-EfficientNet-7: Optimizer Adadelta, learning rate 0.001, batch size 32.
[0094] Steps 2-3 involve training the same base classifier using different training sample sets to generate multiple (e.g., K) well-trained sub-classifiers with different characteristics. The different training sample sets are obtained by randomly selecting different numbers of crop image samples from the crop disease image sample set.
[0095] Furthermore, in one embodiment, the method for obtaining the trained meta-learner may specifically include:
[0096] The new training sample set is input into the meta-learner for training, and the trained meta-learner is obtained.
[0097] The method for obtaining the new training sample set includes:
[0098] From the set of n pre-constructed base classifiers, one base classifier is selected sequentially as the base classifier to be trained, until all base classifiers in the set have been selected;
[0099] For any of the base classifiers to be trained, K sub-classifiers corresponding to the base classifiers to be trained are generated based on the K-fold cross-validation method, and the sub-classifiers are trained using the training set corresponding to each sub-classifier to obtain trained sub-classifiers, where K is a positive integer greater than 1.
[0100] The test set corresponding to each sub-classifier is input into the trained sub-classifier to obtain the prediction result of the sub-classifier;
[0101] Based on the prediction results of the K sub-classifiers, the prediction result of each trained base classifier is obtained;
[0102] The new training sample set is obtained based on the prediction results of n trained base classifiers and the labels of the training sample set;
[0103] The training and test sets for each sub-classifier are obtained as follows:
[0104] The training sample set is divided into K sub-training sample sets, each sub-training sample set containing the same number of samples;
[0105] K-1 sub-training sample sets are randomly selected as the training set, and the remaining 1 set is used as the test set.
[0106] Optionally, Figure 3 This is a schematic diagram illustrating the recognition process of crop disease images provided by the present invention, such as... Figure 3 As shown, the training process for a meta-learner can specifically include:
[0107] Step 3-1: Divide the training sample set into multiple groups (e.g., K groups) of sub-training sample sets, with each sub-training sample set containing the same number of samples.
[0108] Step 3-2, from the constructed multiple base classifiers (e.g., n, represented by E1, E2, ..., E...), n From the set consisting of (representations), select one of the pre-defined base classifiers in order and use it as the base classifier to be trained;
[0109] Step 3-3: Randomly select K-1 sub-training sample sets to train the pre-defined base classifier, and use the remaining 1 sub-training sample set as the test set to input into the trained base classifier to obtain the prediction results as the new training sample feature set.
[0110] Step 3-4: Repeat step 3-3 K times to obtain K sets of prediction results for the test set. Combine the K sets of prediction results by weight according to example to obtain a column vector of the same length as the labels of the training sample set. The labels of the training sample set are used to characterize the disease category of each training sample in the training sample set.
[0111] Step 3-5: Select other pre-defined base classifiers from the set of base classifiers. Repeat steps 3-3 and 3-4 until all base classifiers have been selected.
[0112] Steps 3-6: Merge the column vectors corresponding to the prediction results output by all base classifiers and the sample class labels of the training sample set to obtain a new sample training set.
[0113] Steps 3-7 involve inputting the newly obtained sample training set into the meta-learner for training, thereby integrating all the generated base classifiers to obtain the trained meta-learner.
[0114] The image of the crop disease to be identified is input into each of the pre-trained base classifiers, and the column vectors of the prediction results of each base classifier are merged to obtain a new feature set of the image of the crop disease to be identified, namely the target feature set.
[0115] The trained meta-learner is used to identify the target feature set of the crop disease image to be identified, and the identification result is obtained.
[0116] For example, such as Figure 3 As shown, the set contains n base classifiers, namely E1, E2, ..., E... n E1 is selected and K-fold cross-validation is used to form K sub-classifiers: C1, C2, ..., C1. K The prediction result output by subclassifier C1 is A1;
[0117] For any base classifier, such as E1, randomly select K-1 sub-training sample sets as its training set to train the base classifier E1, and obtain the trained sub-classifier C1.
[0118] The remaining set of training samples is used as the test set and input into the trained sub-classifier C1. Based on the output of the trained sub-classifier C1, the prediction result A1 of the trained sub-classifier C1 is obtained.
[0119] Repeat the training process K times to obtain K sub-classifiers: C1, C2, ..., C K And its corresponding K prediction results, A1, A2, ..., A K ;
[0120] For A1, A2..., A K Weighted ensemble is performed to form feature 1, which is the prediction result of the trained base classifier E1 on the test set.
[0121] It should be noted that the remaining base classifiers E2..., E nThe method for obtaining the prediction results is the same as the method for obtaining the prediction results of the trained base classifier E1, and will not be described in detail here.
[0122] A new training sample set is obtained based on the prediction results of n trained base classifiers and the labels of the training sample set.
[0123] Meta-learners can employ algorithms such as multilayer perceptron, stochastic gradient descent classifier, random forest, and logistic regression. For example, this invention uses the Logistic regression algorithm as the meta-learner.
[0124] Furthermore, in one embodiment, obtaining the prediction result of each trained base classifier based on the prediction results of the K sub-classifiers may specifically include:
[0125] Obtain the K sub-classifiers corresponding to each trained base classifier, and determine the recognition accuracy of the prediction results of any test sample in the test dataset. Determine the weight of each sub-classifier for any test sample. The recognition accuracy is determined based on the probability value of each sub-classifier correctly recognizing the disease category of any test sample. The test dataset is determined based on the training sample set and includes multiple test samples.
[0126] Based on the weight of each sub-classifier for each test sample, determine the average weight of each sub-classifier for multiple test samples;
[0127] The prediction results of each sub-classifier are weighted according to the average weight of each sub-classifier to obtain the prediction results of each trained base classifier.
[0128] Optionally, the column vector obtained by weighting and merging the K prediction results is combined with the labels of the training sample set to obtain the new training sample, specifically including:
[0129] Step 4-1: Select a test dataset containing M test samples from the sample training set;
[0130] Step 4-2: After each base classifier is trained on different training sample sets, K differential sub-classifiers are obtained.
[0131] Step 4-3: Select any one of the K differential subclassifiers to identify any test sample in the test dataset. Select the probability value λ (i.e., the identification accuracy) from the identification results that correctly represents the disease category corresponding to the sample.
[0132] Step 4-4: Based on step 4-3, the weight of the nth (1≤n≤K) sub-classifier for any test sample is... The calculation formula is:
[0133]
[0134] Where λ1 represents the recognition accuracy of the first sub-classifier for the test sample, λ n λ represents the recognition accuracy of the nth sub-classifier for this test sample. K This represents the recognition accuracy of the Kth sub-classifier for this test sample.
[0135] Step 4-5: Repeat steps 4-3 and 4-4 until all test samples in the test dataset have been identified, and calculate the average weight of the nth (1≤n≤K) sub-classifier on the M test samples. The calculation formula is as follows:
[0136]
[0137] in, The weight of the nth sub-classifier for test sample i
[0138] Steps 4-6: Following the weight calculation method in Step 4-6, the K sets of prediction results obtained by any base classifier are weighted and merged to obtain the training sample feature set, i.e., the prediction result B of any base classifier.
[0139]
[0140] Among them, A′1,A′2...,A′ K Output K sets of prediction results for any base classifier.
[0141] Optionally, the value of M can be set according to the actual application, for example, M = 1000.
[0142] The training sample feature set and the training sample set labels are merged to obtain new training samples.
[0143] The crop disease image recognition method provided by this invention enables rapid and accurate identification of crop diseases, overcoming the problems of inaccurate disease identification results, inconvenient operation, and high labor intensity in existing technologies. It also combines the advantages of deep convolutional neural networks and ensemble learning technologies, which not only improves the accuracy of the recognition system but also enhances its generalization. Based on the identification results of crop disease images, it can realize prevention and control measures such as online diagnosis, precision application of pesticides, online early warning of diseases, and field investigation of diseases.
[0144] Furthermore, in one embodiment, acquiring the image of the crop disease to be identified may specifically include:
[0145] Acquire the first image of the crop to be identified;
[0146] The first image is segmented to extract the region where the lesions are located in the first image, thus obtaining the second image;
[0147] The second image is preprocessed to obtain the image of the crop disease to be identified.
[0148] Optionally, the first image may specifically be an image of the crop to be identified captured by an image acquisition device.
[0149] By performing image segmentation on the first image, the region containing the lesions in the first image is extracted, and a second image is formed.
[0150] By preprocessing the second image, an image of the crop disease to be identified is obtained. The preprocessing of the second image may specifically include image enhancement and normalization.
[0151] Furthermore, in one embodiment, performing image segmentation on the first image to extract the region where the lesion is located in the first image to obtain a second image may specifically include:
[0152] The largest region in the first image, including lesions, is marked to obtain the first sub-image;
[0153] Repeat the following steps:
[0154] The locations of lesions and background in the first sub-image are identified, and the locations of the lesions and background are used as the initial values for the GrabCut algorithm.
[0155] The first sub-image is segmented based on the GrabCut algorithm to obtain the second sub-image;
[0156] If the second sub-image includes the background, then the second sub-image is used as the first sub-image;
[0157] If the background is not included in the second sub-image, then the second sub-image is used as the second image.
[0158] Optionally, the first image is segmented based on the GrabCut image segmentation algorithm to obtain the second image, specifically:
[0159] Step 5-1: Manually mark the largest area, including the lesion, in the color image Img1 (i.e., the first image), for example, the largest rectangular area, to form the color image Img. 1-1 That is, the first sub-image;
[0160] Step 5-2, in the first sub-image (color image Img)1-1 In the process, the location of the lesion and the background are manually marked and set as the initial values for the GrabCut algorithm;
[0161] Step 5-3: Use the GrabCut algorithm to process the first sub-image Img. 1-1 Segmentation is performed to form a color image Img 1-2 That is, the second sub-image;
[0162] Step 5-4: If the second sub-image Img 1-2 Since the second sub-image Img no longer contains a background region (i.e., there is no background region to identify), it is considered a sub-image. 1-2 That is, the color image Img2, i.e., the second image; conversely, the second sub-image Img is... 1-2 Replace the first sub-image Img 1-1 Repeat steps 5-2 to 5-4, and so on for other processes.
[0163] Furthermore, in one embodiment, preprocessing the second image to obtain the image of the crop disease to be identified may specifically include:
[0164] The second image is enhanced using a guided filtering method to obtain the third image;
[0165] The third image is normalized to obtain the image of the crop disease to be identified;
[0166] Specifically, the process of enhancing the second image using a guided filtering method to obtain the third image may include:
[0167] The second image is smoothed based on the guided filtering algorithm, and the second image is divided into a detail image and a base image.
[0168] Based on the brightness distribution features of the second image, the enhancement weights of the detail image are obtained. The brightness distribution features are determined by converting the second image from RGB color space to CIELAB color space, and the brightness space is determined based on the perceived brightness.
[0169] The detailed image and the base image are fused based on the enhancement weights to obtain the third image.
[0170] Optionally, image enhancement is performed on the second image based on a guided filtering method to obtain a third image, which may specifically include:
[0171] Step 6-1: Convert the color image Img2 from the RGB color space to the CIEL*a*b* (i.e., CIELAB) color space;
[0172] Step 6-2: Calculate the enhancement weight w of the detail image using the brightness distribution features. The calculation formula is as follows:
[0173]
[0174] in, and These are the brightness space L * The maximum and average values of the brightness values of all pixels are defined by δ, which is a fixed constant that can be determined experimentally. This brightness distribution characteristic is determined by converting the second image from the RGB color space to the CIELAB color space. This brightness space is determined based on the perceived brightness. In this invention, δ = 10 is preferred.
[0175] Step 6-3: Smooth the color image Img2 using the guided filtering algorithm, and divide it into detail image d and base image q;
[0176] Step 6-4: The weighted detail image is fused with the base image using the following fusion formula to enhance the color image Img2, forming the color image Img3:
[0177] Img3=w×d+q.
[0178] Normalizing the third image yields the image of the crop disease to be identified, which may specifically include:
[0179] The third image Img3 is normalized to an image Img4 of size L×H using bilinear interpolation, and this image is used as the image of the crop disease to be identified. L and H are the width and height of the scaled image, respectively, in pixels. Their values can be set according to the actual application, for example, the original image can be scaled to 224×224.
[0180] Figure 4 This is a second schematic flowchart of the crop disease image recognition method provided by the present invention, as shown below. Figure 4 As shown, it includes:
[0181] (1.1) Acquire a color image of the crop, Img1, from the image acquisition device;
[0182] (1.2) The GrabCut algorithm is used to segment the color image Img1, extract the area where the lesion is located, and form the color image Img2;
[0183] (1.3) The color image Img2 is preprocessed using an image enhancement method based on guided filtering to form a color image Img3;
[0184] (1.4) Normalize the color image Img3 to form a color image Img4;
[0185] (1.5) Construct a lightweight EfficientNet convolutional neural network recognition model;
[0186] (1.6) The improved EfficientNet convolutional neural network is trained using the constructed crop disease image sample set to form multiple differential base classifiers.
[0187] (1.7) Train the meta-learner, integrate the constructed base classifiers to obtain the trained meta-learner, and achieve accurate recognition of the color image Img4 based on the trained meta-learner.
[0188] (1.8) Output the recognition results of the color image Img4, output the types of crop diseases, and take appropriate prevention and control measures.
[0189] The crop disease image recognition method provided by this invention is fast, continuous, and easy to identify crop diseases in small areas. It can also be applied to mobile terminals such as smartphones, making it suitable for field operations and broadening the application scope of crop disease image recognition. The method further improves the accuracy of identifying the type of crop disease by performing image segmentation, image enhancement, and normalization processing on the acquired crop image to obtain the image of the crop disease to be identified.
[0190] The crop disease image recognition system provided by the present invention will be described below. The crop disease image recognition system described below can be referred to in correspondence with the crop disease image recognition method described above.
[0191] Figure 5 This is a schematic diagram of the structure of the crop disease image recognition system provided by the present invention, as shown below. Figure 5 As shown, it includes:
[0192] The first acquisition module 510, the second acquisition module 511, and the image recognition module 512;
[0193] The first acquisition module 510 is used to acquire images of crop diseases to be identified;
[0194] The second acquisition module 511 is used to input the image of the crop disease to be identified into n trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each trained base classifier is obtained by training the same base classifier using different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n trained base classifiers, where n is a positive integer greater than 1.
[0195] The image recognition module 512 is used to input the target feature set into the trained meta-learner to obtain the recognition result of the crop disease image to be identified.
[0196] The crop disease image recognition system provided by this invention uses image processing, deep learning and other technologies to automatically analyze the acquired crop disease images to be identified, and quickly, accurately and reliably identify the types of diseases in the crop disease images to be identified, providing technical support for taking the correct disease control measures.
[0197] Figure 6 This is a schematic diagram of the physical structure of an electronic device provided by the present invention, such as... Figure 6 As shown, the electronic device may include a processor 610, a communication interface 611, a memory 612, and a bus 613. The processor 610, communication interface 611, and memory 612 communicate with each other via the bus 613. The processor 610 can call logical instructions from the memory 612 to execute the following methods:
[0198] Acquire images of crop diseases to be identified;
[0199] The image of the crop disease to be identified is input into n trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each trained base classifier is obtained by training the same base classifier with different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n trained base classifiers, where n is a positive integer greater than 1.
[0200] The target feature set is input into the trained meta-learner to obtain the recognition result of the crop disease image to be identified.
[0201] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer power supply (which may be a personal computer, server, or network power supply, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0202] Furthermore, this invention discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when these instructions are executed by a computer, the computer can perform the crop disease image recognition method provided in the above-described method embodiments, for example including:
[0203] Acquire images of crop diseases to be identified;
[0204] The image of the crop disease to be identified is input into n trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each trained base classifier is obtained by training the same base classifier with different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n trained base classifiers, where n is a positive integer greater than 1.
[0205] The target feature set is input into the trained meta-learner to obtain the recognition result of the crop disease image to be identified.
[0206] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the crop disease image recognition method provided in the above embodiments, including, for example:
[0207] Acquire images of crop diseases to be identified;
[0208] The image of the crop disease to be identified is input into n trained base classifiers to obtain the target feature set of the image of the crop disease to be identified. Each trained base classifier is obtained by training the same base classifier with different training sample sets. The same base classifier is constructed based on the lightweight convolutional neural network recognition model LW-EfficientNet. The target feature set is obtained based on the prediction results of the image of the crop to be identified output by the n trained base classifiers, where n is a positive integer greater than 1.
[0209] The target feature set is input into the trained meta-learner to obtain the recognition result of the crop disease image to be identified.
[0210] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0211] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer power supply (which may be a personal computer, server, or network power supply, etc.) to execute the methods described in various embodiments or some parts of the embodiments.
[0212] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method of identifying a crop disease image, characterized by, The method comprises: acquiring a to-be-identified crop disease image; inputting the to-be-identified crop disease image into n trained base classifiers to obtain a target feature set of the to-be-identified crop disease image, each trained base classifier being obtained by training a same base classifier by using different training sample sets, the same base classifier being constructed according to a lightweight convolutional neural network recognition model LW-EfficientNet, the target feature set being obtained according to predicted results of the to-be-identified crop disease image output by the n trained base classifiers, n being a positive integer greater than 1; inputting the target feature set into a trained meta-learner to obtain an identification result of the to-be-identified crop disease image; the acquisition method of the lightweight convolutional neural network recognition model LW-EfficientNet comprises: taking EfficientNet-B0 as a base network of the LW-EfficientNet, improving a main body module lightweight flip bottleneck convolution kernel MBConv in Efficientnet-B0 by using a lightweight convolution attention module CBAM, and replacing a convolution layer in a first layer of EfficientNet-B0 by using a Ghost layer to obtain the LW-EfficientNet.
2. The method of claim 1, wherein the acquisition method of the trained meta-learner comprises: inputting a new training sample set into the meta-learner to obtain the trained meta-learner; wherein, the acquisition method of the new training sample set comprises: selecting a base classifier from a set composed of n base classifiers as a to-be-trained base classifier in turn until all base classifiers in the set are selected; for any to-be-trained base classifier, generating K sub-classifiers corresponding to the to-be-trained base classifier based on a K-fold cross-validation method, and training a trained sub-classifier by using a training set corresponding to each sub-classifier, K being a positive integer greater than 1; inputting a test set corresponding to each sub-classifier into the trained sub-classifier to obtain a predicted result of the sub-classifier; obtaining a predicted result of each trained base classifier according to the predicted results of the K sub-classifiers; obtaining the new training sample set according to the predicted results of the n trained base classifiers and labels of the training sample set; wherein, the training set and the test set corresponding to each sub-classifier are obtained by the following method: dividing the training sample set into K groups of sub-training sample sets, each group of sub-training sample sets including the same number of samples; randomly selecting K-1 groups of sub-training sample sets as the training set, and taking the remaining 1 group as the test set.
3. The method of claim 2, wherein the method of obtaining the predicted result of each trained base classifier according to the predicted results of the K sub-classifiers comprises: Obtaining the recognition accuracy of the prediction result of any test sample in a test data set by each sub-classifier corresponding to each trained base classifier, the recognition accuracy being determined according to the probability value of each sub-classifier correctly identifying the disease category of the any test sample, the test data set being determined according to the training sample set, and the test data set including a plurality of test samples; Determining the average weight of each sub-classifier for a plurality of test samples according to the weight of each sub-classifier for each test sample; According to the average weight of each sub-classifier, the prediction result of each sub-classifier is weighted to obtain the prediction result of each trained base classifier.
4. The method of claim 1-3, wherein, The method comprises the following steps: Obtaining a first image of the crop to be identified; Image segmentation is performed on the first image to extract the region where the lesion is located in the first image to obtain a second image; The second image is preprocessed to obtain the crop disease image to be identified.
5. The method of claim 4, wherein The method comprises the following steps: Labeling the largest region including the lesion in the first image to obtain a first sub-image; Repeat the following steps: Identify the positions of the lesion and the background in the first sub-image, and take the positions of the lesion and the background as the initial values of the GrabCut algorithm; Image segmentation is performed on the first sub-image based on the GrabCut algorithm to obtain a second sub-image; If the second sub-image includes the background, the second sub-image is taken as the first sub-image; If the second sub-image does not include the background, the second sub-image is taken as the second image.
6. The method of claim 4, wherein The method comprises the following steps: Image enhancement is performed on the second image based on a guided filtering method to obtain a third image; The third image is normalized to obtain the crop disease image to be identified; The method comprises the following steps: The second image is divided into a detail image and a base image based on the guided filtering method; Based on the brightness distribution characteristics of the second image, an enhancement weight of the detail image is obtained, the brightness distribution characteristics being determined by converting the second image from an RGB color space to a CIELAB color space, and the brightness space being determined according to the perceived brightness; The detail image and the base image are fused based on the enhancement weight to obtain the third image.
7. A system for identifying images of crop diseases, characterized by, The method comprises the following steps: A first acquisition module, a second acquisition module, and an image recognition module are provided. The first acquisition module is configured to obtain a crop disease image to be identified; The second acquisition module is configured to input the image of the crop disease to be identified into n trained base classifiers to obtain a target feature set of the image of the crop disease to be identified, each trained base classifier is obtained by training a same base classifier using different training sample sets, the same base classifier is constructed according to a lightweight convolutional neural network recognition model LW-EfficientNet, and the target feature set is obtained according to predicted results of the image of the crop disease to be identified output by the n trained base classifiers, n is a positive integer greater than 1. The image recognition module is configured to input the target feature set into a trained meta-learner to obtain a recognition result of the image of the crop disease to be identified. The acquisition method of the lightweight convolutional neural network recognition model LW-EfficientNet comprises the following steps: EfficientNet-B0 is used as a base network of the LW-EfficientNet, a lightweight convolutional attention module CBAM is used to improve a main body module MBConv in the EfficientNet-B0, a Ghost layer is used to replace a convolutional layer in a first layer of the EfficientNet-B0, and the LW-EfficientNet is obtained.
8. An electronic device comprising a processor and a memory having a computer program stored therein, characterized in that, The processor executes the computer program to implement the crop disease image recognition method in any one of claims 1 to 6. 9.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the crop disease image recognition method in any one of claims 1 to 6.
Citation Information
Patent Citations
CNN and transfer learning based disease intelligent identification method and system
AU2020103613A4
Crop leaf disease resistance identification method and system, electronic equipment and storage medium
CN110874835A