A cucumber disease identification method based on deep learning

Through the cucumber disease identification method based on deep learning, combined with multi-label data segmentation mode and custom loss function, it solves the problems of traditional identification technology that is time-consuming, labor-intensive and difficult to guarantee accuracy, and achieves efficient and accurate disease identification under different conditions. .

CN118942084BActive Publication Date: 2025-01-21QINGDAO AGRI UNIV

Patent Information

Application Number
CN202411388460.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-21
Estimated Expiration
2044-10-08

AI Technical Summary

Technical Problem

Traditional cucumber disease recognition technology relies on manual observation, which is time-consuming and labor-intensive. The recognition accuracy of machine learning algorithms under different lighting, angles, and background conditions is difficult to ensure, especially difficult to deal with leaves contaminated by multiple diseases.

Method used

An identification method based on deep learning is used to realize automatic identification of cucumber leaf diseases by constructing a multi-label data segmentation mode and a custom loss function, combined with the feature extraction module, Brownian distance covariance module and classifier module.

Benefits of technology

It improves the automation of disease identification, can accurately identify cucumber diseases under different weather and light conditions, reduces manual intervention, and adapts to the needs of intelligent planting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118942084B_ABST
    Figure CN118942084B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of agricultural disease identification, and in particular to a cucumber disease identification method based on deep learning, which is as follows: collecting images under different weather conditions to create a data set; scaling the images in the data set to a unified standard, and annotating the images; then enhancing the data set; dividing the data set into a training set, a validation set, and a test set, and further dividing the training set, the validation set, and the test set according to the annotation type; constructing a deep learning model including a feature extraction module, a Brownian distance covariance module, and a classifier module to achieve the prediction probability of the disease type in the image; training and testing the deep learning model, and inputting the images in the test set into the trained deep learning model to obtain the disease type in the image. The present invention can automatically learn features from a large number of disease images without manual intervention through a deep learning model, thereby improving the automation of disease identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural disease identification, and in particular to a cucumber disease identification method based on deep learning. Background Art

[0002] Cucumber is a large-scale vegetable. It is very susceptible to a variety of diseases during large-scale planting, such as downy mildew, angular leaf spot, and powdery mildew. If it is not discovered and treated in time, it will affect the growth of other plants, resulting in a decline in cucumber quality and yield, or even a complete crop failure, causing huge economic losses to agricultural growers. Therefore, accurate and rapid identification of cucumber diseases is of great significance for cucumber production. Traditional identification technology relies heavily on manual observation and empirical judgment, which not only requires the participation of professionals, but is also time-consuming and labor-intensive, and is difficult to meet the needs of modern agricultural planting. The pest and disease recognition algorithm based on machine learning is difficult to guarantee the accuracy of disease recognition under different lighting, angles, backgrounds, etc., and it is difficult to make reasonable judgments on cucumber leaves that are contaminated by multiple diseases. The deep learning model can automatically learn features from a large number of disease images without manual intervention, which can greatly improve the automation of disease recognition, but the accurate recognition of multiple diseases is still a challenging task.

[0003] Therefore, the present invention proposes a cucumber disease identification method based on deep learning to solve the above problems. Summary of the invention

[0004] In view of the shortcomings of the prior art, the present invention proposes a cucumber disease identification method based on deep learning. The present invention can automatically learn features from a large number of disease images through a deep learning model without human intervention, thereby improving the degree of automation of disease identification.

[0005] The technical solution to the technical problem of the present invention is a cucumber disease identification method based on deep learning, which is as follows:

[0006] S1. Create a dataset: Collect images of cucumber leaves in the greenhouse under different weather conditions in the early, middle and late stages. The images include abnormal leaf images and normal leaf images. Create a dataset with the collected images ;

[0007] S2. Data preprocessing: The images in the image are scaled to a unified standard and the images are labeled to obtain the preprocessed data set. ;

[0008] S3, Dataset Enhancement: By preprocessing the dataset Each image in the image is subjected to random noise, brightness jitter, contrast stretching, saturation jitter and hue jitter in traditional ways to perform data expansion and obtain an enhanced data set. ;

[0009] S4. Dataset division: The enhanced dataset Divide into training set, validation set and test set in proportion, and further divide the training set, validation set and test set according to the annotation type;

[0010] S5. Build a deep learning model: The deep learning model includes a feature extraction module, a Brownian distance covariance module and a classifier module. The image is input into the deep learning model and then the deep features between different images are deeply mined through the feature extraction module. The features are then expressed at a deeper level through the Brownian distance covariance module. Finally, the deep features are input into the classifier module to obtain the predicted probability of the disease type in the image.

[0011] S6, training and testing model: including a custom loss function module, a training module and a testing module. The loss is calculated according to the prediction result obtained in step S5 and the actual annotation of the image. Then the data in the training set is input into the deep learning model to optimize the training of the deep learning model. Then the data in the validation set is input into the trained deep learning model for verification and the model parameters are updated. Finally, the threshold is set and the data in the test set is input into the verified deep learning model to obtain the disease type in the image.

[0012] S1 is as follows:

[0013] The cucumber leaf images were captured by a SLR camera;

[0014] The weather conditions include sunny, cloudy, rainy and overcast, and the number of images collected in the four conditions is the same;

[0015] The abnormal leaf images are yellow light leaf pathology images. The pathology types in the yellow light leaf pathology images include three common types: downy mildew, angular spot and powdery mildew.

[0016] Total collection images, where the normal image Zhang, abnormal image The abnormal images include a downy mildew image, b angular spot image, and c powdery mildew image. Expressed as , Representation dataset Middle images, Representation dataset any image in .

[0017] S2 is as follows:

[0018] Please ask two or more professionals in this field to independently review the dataset The images are labeled as normal and abnormal, and the corresponding label type number is marked for each image. The normal class corresponds to number 0, and the abnormal class corresponds to number 1 for downy mildew, number 2 for angular spot, and number 3 for powdery mildew.

[0019] When the same image is annotated differently, all professionals in the field will collectively determine the annotation type;

[0020] When there are multiple diseases in the same image, multiple labels are corresponding to one icon, that is, multi-label labeling;

[0021] Preprocessed dataset Expressed as , Represents the preprocessed dataset Middle images, Represents the preprocessed dataset any image in .

[0022] S3 is as follows:

[0023] Preprocessed dataset Medium Image , Indicates the number of channels of the image, Indicates the height of the image. Indicates the width of the image;

[0024] For images , by Methods in the library for randomly transforming the color space of an image Set 4 random numbers between 0 and 1, respectively , , and , and obtain an image with random changes in brightness, contrast, saturation, and hue , the calculation process is as follows:

[0025] ,

[0026] in, Indicates call Process the data, Indicates brightness, Indicates contrast, Indicates saturation, Indicates hue;

[0027] Preprocessed dataset Each image in Randomly generate 100 groups , each image 100 images are generated after random changes in brightness, contrast, saturation and hue , and then the preprocessed data set The number of images in becomes ;

[0028] Then for 100 Add random noise to the image and get 200 images;

[0029] Finally, we get the data set after data enhancement .

[0030] S4 is as follows:

[0031] By traversing the enhanced dataset Building a dictionary , determine the dictionary according to the annotation number The values ​​are 0, 1, 2, and 3, correspond Value Collection , , The value corresponds to The values ​​are the file names of the images corresponding to the corresponding numbers;

[0032] When a graph contains two annotations, they are assigned to the corresponding Value Value Collection middle;

[0033] The enhanced dataset is divided into two parts according to the ratio of 8:1:1. Divide into training set, validation set and test set. When dividing the data set, traverse the dictionary in turn All Value, indivual The value corresponds to Collection , Will Perform 8:1:1 data set division and get , and , , put 4 The training set, validation set, and test set after value division are stacked separately to obtain the training set , validation set and test set , which is expressed as follows:

[0034] ,

[0035] ,

[0036] ,

[0037] in, Indicates the training set correspond A collection of values, Indicates the validation set correspond A collection of values, Indicates the test set correspond A collection of values, .

[0038] S5 is as follows:

[0039] S5.1. Feature extraction module:

[0040] The deep feature extraction module contains five stacked convolutional blocks. , each Each includes a convolutional layer , a batch normalization layer , a max pooling layer and a Activation function layer, where the first middle The input channel is 3 and the output channel is 32; the second middle The input channels are 32 and the output channels are 64; the third middle The input channels are 64 and the output channels are 128; the fourth and fifth middle The input and output channels are both 128; each middle The kernel size of the maximum pooling layer is 2. The input feature extraction module passes through five After processing, the extracted deep feature image can be obtained , the calculation process is as follows:

[0041] ,

[0042] ,

[0043] in, Indicates five Operation, Represents deep feature image of high, Represents deep feature image The width, Represents deep feature image The number of channels, here ;

[0044] S5.2, Brown distance covariance module:

[0045] The deep feature image As the input of the Brownian distance covariance module, the deep feature image To express at a deeper level;

[0046] First, we use the deep feature image conduct Operation to change the deep feature image Shape, depth feature image The matrix transformation is , deep feature image The matrix Row and The value of the column , Are all random variables, according to the depth feature image The matrix in the calculation of the Brownian distance covariance matrix is The matrix calculation process is as follows:

[0047] ,

[0048] ,

[0049] ,

[0050] in, express and The Euclidean distance between express The identity matrix, represents transpose, Indicates taking and its transpose, Indicates Euclidean distance calculation;

[0051] At the same time, the annotations corresponding to the images are input into the Brownian covariance matrix module, and a of The matrices are , each labeled category The matrix is ​​accumulated and then averaged to get the Average of annotation types matrix;

[0052] S5.3, Classifier module:

[0053] The depth feature image obtained in step S5.1 Input to the classifier module The input of the activation function layer is used to sequentially transform the deep feature image The annotation is activated to make the deep feature image The outputs of the annotation types are probability values ​​between 0 and 1, and the probability prediction vector is obtained. .

[0054] S6 is as follows:

[0055] S6.1. Custom loss function module:

[0056] Predict vector based on probability , ground truth and Average of annotation types Matrix custom loss function, where the probability prediction vector of the image output by Sigmoid The real annotation of the image The binary cross entropy loss function is calculated as follows: ,

[0057] in, represents a custom loss function, Represents the logarithmic function;

[0058] S6.2, Training Module:

[0059] Model training phase:

[0060] Set the optimizer of the deep learning model to Optimizer, loss function is set to custom loss function, and training rounds are set to 100;

[0061] The training set Input into the deep learning model under training conditions and iterate in sequence. In each round, the training set After being shuffled, it is input into the constructed deep model to obtain the corresponding image of the input image. Matrix and probability prediction vector, and then optimize the model by minimizing the custom loss function;

[0062] Model validation phase:

[0063] The validation set Input the trained deep learning model for round verification, and then calculate the custom loss function. Once the loss value of this round on the verification set is less than the minimum loss value in the previous round, the model parameters are updated;

[0064] Finally, the parameters in the deep learning model are updated based on the results of the model training phase and the model verification phase, and the deep learning model is finally trained to obtain a trained deep learning model. ;

[0065] S6.3, test module:

[0066] The test set Input to In the above example, we get the probability vector of the image in the test set belonging to the four annotation types. , Represents the probability values ​​of the four annotation types, and then sets the threshold , when the probability value vector The probability value of a certain annotation type is greater than , then the disease type of the image can be obtained.

[0067] The effects provided in the content of the invention are only the effects of the embodiments, rather than all the effects of the invention. The above technical solution has the following advantages or beneficial effects:

[0068] The present invention designs a cucumber disease identification method based on deep learning, and innovatively proposes a constrained loss function under the joint action of the output of the deep learning model and the output of the Brownian covariance matrix by constructing a multi-label data segmentation mode, thereby realizing multi-level feature comparison, and realizing the ability of multi-label identification of cucumber diseases in a real environment by Sigmoid feature characterization. Through the automatic learning property of deep learning features, the process of manual feature extraction is reduced, and through data expansion of image brightness, contrast, and hue, the identification method implemented by the present invention can adapt to the intelligent recognition of images taken under different weather and lighting conditions, and effectively alleviates the situation of reduced yield caused by insufficient manpower, few experts in pest and disease identification, and little experience in the cucumber planting process, and provides a new solution for the intelligent cucumber planting industry. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0070] Figure 1 This is a flowchart of the deep learning model training in the present invention.

[0071] Figure 2 This is a flow chart of data collection and preprocessing in the present invention. DETAILED DESCRIPTION

[0072] In order to clearly illustrate the technical features of the present invention, the present invention is described in detail below through specific implementation methods and in conjunction with the accompanying drawings. The following disclosure provides many different embodiments or examples for implementing different structures of the present invention. In order to simplify the disclosure of the present invention, the components and settings of specific examples are described below.

[0073] Example 1

[0074] Combination Figure 1 and Figure 2 As shown, the present invention provides a cucumber disease identification method based on deep learning, which is as follows:

[0075] S1. Create a dataset: Collect images of cucumber leaves in the greenhouse under different weather conditions in the early, middle and late stages. The images include abnormal leaf images and normal leaf images. Create a dataset with the collected images ;

[0076] S2. Data preprocessing: The images in the image are scaled to a unified standard and the images are labeled to obtain the preprocessed data set. ;

[0077] S3, Dataset Enhancement: By preprocessing the dataset Each image in the image is subjected to random noise, brightness jitter, contrast stretching, saturation jitter and hue jitter in traditional ways to perform data expansion and obtain an enhanced data set. ;

[0078] S4. Dataset division: The enhanced dataset Divide into training set, validation set and test set in proportion, and further divide the training set, validation set and test set according to the annotation type;

[0079] S5. Build a deep learning model: The deep learning model includes a feature extraction module, a Brownian distance covariance module and a classifier module. The image is input into the deep learning model and then the deep features between different images are deeply mined through the feature extraction module. The features are then expressed at a deeper level through the Brownian distance covariance module. Finally, the deep features are input into the classifier module to obtain the predicted probability of the disease type in the image.

[0080] S6, training and testing model: including a custom loss function module, a training module and a testing module. The loss is calculated according to the prediction result obtained in step S5 and the actual annotation of the image. Then the data in the training set is input into the deep learning model to optimize the training of the deep learning model. Then the data in the validation set is input into the trained deep learning model for verification and the model parameters are updated. Finally, the threshold is set and the data in the test set is input into the verified deep learning model to obtain the disease type in the image.

[0081] S1 is as follows:

[0082] The cucumber leaf images were captured by a SLR camera;

[0083] The weather conditions include sunny, cloudy, rainy and overcast, and the number of images collected in the four conditions is the same;

[0084] The abnormal leaf images are yellow light leaf pathology images. The pathology types in the yellow light leaf pathology images include three common types: downy mildew, angular spot and powdery mildew.

[0085] Total collection images, where the normal image Zhang, abnormal image The abnormal images include a downy mildew image, b angular spot image, and c powdery mildew image. Expressed as , Representation dataset Middle images, Representation dataset any image in .

[0086] S2 is as follows:

[0087] Please ask two or more professionals in this field to independently review the dataset The images are labeled as normal and abnormal, and the corresponding label type number is marked for each image. The normal class corresponds to number 0, and the abnormal class corresponds to number 1 for downy mildew, number 2 for angular spot, and number 3 for powdery mildew.

[0088] When the same image is annotated differently, all professionals in the field will collectively determine the annotation type;

[0089] When there are multiple diseases in the same image, multiple labels are corresponding to one icon, that is, multi-label labeling;

[0090] Preprocessed dataset Expressed as , Represents the preprocessed dataset Middle images, Represents the preprocessed dataset any image in .

[0091] S3 is as follows:

[0092] Preprocessed dataset Medium Image , Indicates the number of channels of the image, Indicates the height of the image. Indicates the width of the image;

[0093] For images , by Methods in the library for randomly transforming the color space of an image Set 4 random numbers between 0 and 1, respectively , , and , and obtain an image with random changes in brightness, contrast, saturation, and hue , the calculation process is as follows:

[0094] ,

[0095] in, Indicates call Process the data, Indicates brightness, Indicates contrast, Indicates saturation, Indicates hue;

[0096] Preprocessed dataset Each image in Randomly generate 100 groups , each image 100 images are generated after random changes in brightness, contrast, saturation and hue , and then the preprocessed data set The number of images in becomes ;

[0097] Then for 100 Add random noise to the image and get 200 images;

[0098] Finally, we get the data set after data enhancement .

[0099] Avoid overfitting problems in deep learning models by enhancing data.

[0100] S4 is as follows:

[0101] By traversing the enhanced dataset Building a dictionary , determine the dictionary according to the annotation number The values ​​are 0, 1, 2, and 3, correspond Value Collection , , The value corresponds to The values ​​are the file names of the images corresponding to the corresponding numbers;

[0102] When a graph contains two annotations, they are assigned to the corresponding Value Value Collection middle;

[0103] The enhanced dataset is divided into two parts according to the ratio of 8:1:1. Divide into training set, validation set and test set. When dividing the data set, traverse the dictionary in turn All Value, indivual The value corresponds to Collection , Will Perform 8:1:1 data set division and get , and , , put 4 The training set, validation set, and test set after value division are stacked separately to obtain the training set , validation set and test set , which is expressed as follows:

[0104] ,

[0105] ,

[0106] ,

[0107] in, Indicates the training set correspond A collection of values, Indicates the validation set correspond A collection of values, Indicates the test set correspond A collection of values, .

[0108] S5 is as follows:

[0109] S5.1. Feature extraction module:

[0110] The deep feature extraction module contains five stacked convolutional blocks. , each Each includes a convolutional layer , a batch normalization layer , a max pooling layer and a Activation function layer, where the first middle The input channel is 3 and the output channel is 32; the second middle The input channels are 32 and the output channels are 64; the third middle The input channels are 64 and the output channels are 128; the fourth and fifth middle The input and output channels are both 128; each middle The kernel size of the maximum pooling layer is 2. The input feature extraction module passes through five After processing, the extracted deep feature image can be obtained , the calculation process is as follows:

[0111] ,

[0112] ,

[0113] in, Indicates five Operation, Represents deep feature image of high, Represents deep feature image The width, Represents deep feature image The number of channels, here ;

[0114] S5.2, Brown distance covariance module:

[0115] The deep feature image As the input of the Brownian distance covariance module, the deep feature image To express at a deeper level;

[0116] First, we use the deep feature image conduct Operation to change the deep feature image Shape, depth feature image The matrix transformation is , deep feature image The matrix Row and The value of the column , Are all random variables, according to the depth feature image The matrix in the calculation of the Brownian distance covariance matrix is The matrix calculation process is as follows:

[0117] ,

[0118] ,

[0119] ,

[0120] in, express and The Euclidean distance between express The identity matrix, represents transpose, Indicates taking and its transpose, Indicates Euclidean distance calculation;

[0121] At the same time, the annotations corresponding to the images are input into the Brownian covariance matrix module, and a of The matrices are , each labeled category The matrix is ​​accumulated and then averaged to get the Average of annotation types matrix;

[0122] S5.3, Classifier module:

[0123] The depth feature image obtained in step S5.1 Input to the classifier module The input of the activation function layer is used to sequentially transform the deep feature image The annotation is activated to make the deep feature image The outputs of the annotation types are probability values ​​between 0 and 1, and the probability prediction vector is obtained. .

[0124] S6 is as follows:

[0125] S6.1. Custom loss function module:

[0126] Predict vector based on probability , ground truth and Average of annotation types Matrix custom loss function, where the probability prediction vector of the image output by Sigmoid The real annotation of the image The binary cross entropy loss function is calculated as follows: ,

[0127] in, represents a custom loss function, Represents the logarithmic function;

[0128] S6.2, Training Module:

[0129] Model training phase:

[0130] Set the optimizer of the deep learning model to Optimizer, loss function is set to custom loss function, and training rounds are set to 100;

[0131] The training set Input into the deep learning model under training conditions and iterate in sequence. In each round, the training set After being shuffled, it is input into the constructed deep model to obtain the corresponding image of the input image. Matrix and probability prediction vector, and then optimize the model by minimizing the custom loss function;

[0132] Model validation phase:

[0133] The validation set Input the trained deep learning model for round verification, and then calculate the custom loss function. Once the loss value of this round on the verification set is less than the minimum loss value in the previous round, the model parameters are updated;

[0134] Finally, the parameters in the deep learning model are updated based on the results of the model training phase and the model verification phase, and the deep learning model is finally trained to obtain a trained deep learning model. ;

[0135] S6.3, test module:

[0136] The test set Input to In the above example, we get the probability vector of the image in the test set belonging to the four annotation types. , Represents the probability values ​​of the four annotation types, and then sets the threshold , when the probability value vector The probability value of a certain annotation type is greater than , then the disease type of the image can be obtained.

[0137] In order to further demonstrate the beneficial effects of the present invention, based on the data set collected by the present invention, the accuracy of identifying diseases is compared between the present invention and the existing dynamic convolutional neural network framework DICNN. As shown in Table 1, the accuracy of disease identification using the present method is higher, which proves that the present invention can greatly improve the ability of automatic identification of cucumber diseases by constructing a multi-label data segmentation mode and a customized loss function.

[0138] Table 1 Comparison of the accuracy of the method in the present invention and the existing method

[0139]

[0140] Although the above describes the specific implementation mode of the invention in conjunction with the drawings, it is not intended to limit the scope of protection of the invention. Based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.

Claims

1. A cucumber disease identification method based on deep learning, characterized in that: The following steps are involved: S1. Create a dataset: Collect images of cucumber leaves in the greenhouse under different weather conditions in the early, middle and late stages. The images include abnormal leaf images and normal leaf images. Create a dataset with the collected images ; S2. Data preprocessing: The images in the image are scaled to a unified standard and the images are labeled to obtain the preprocessed data set. ; S3, Dataset Enhancement: By preprocessing the dataset Each image in the image is subjected to random noise, brightness jitter, contrast stretching, saturation jitter and hue jitter in traditional ways to perform data expansion and obtain an enhanced data set. ; S4. Dataset division: The enhanced dataset Divide into training set, validation set and test set in proportion, and further divide the training set, validation set and test set according to the annotation type; S5. Build a deep learning model: The deep learning model includes a feature extraction module, a Brownian distance covariance module and a classifier module. The image is input into the deep learning model and then the deep features between different images are deeply mined through the feature extraction module. The features are then expressed at a deeper level through the Brownian distance covariance module. Finally, the deep features are input into the classifier module to obtain the predicted probability of the disease type in the image. S5 is as follows: S5.

1. Feature extraction module: The deep feature extraction module contains five stacked convolutional blocks. , each Each includes a convolutional layer , a batch normalization layer , a max pooling layer and a Activation function layer, where the first middle The input channel is 3 and the output channel is 32; the second middle The input channels are 32 and the output channels are 64; the third middle The input channels are 64 and the output channels are 128; the fourth and fifth middle The input and output channels are both 128; each middle The kernel size of the maximum pooling layer is 2. The input feature extraction module passes through five After processing, the extracted deep feature image can be obtained , the calculation process is as follows: , , in, Indicates five Operation, Represents deep feature image of high, Represents deep feature image The width, Represents deep feature image The number of channels, here ; S5.2, Brown distance covariance module: The deep feature image As the input of the Brownian distance covariance module, the deep feature image To express at a deeper level; First, we use the deep feature image conduct Operation to change the deep feature image Shape, depth feature image The matrix transformation is , deep feature image The matrix Row and The value of the column , Are all random variables, according to the depth feature image The matrix in the calculation of the Brownian distance covariance matrix is The matrix calculation process is as follows: , , , in, express and The Euclidean distance between express The identity matrix, represents transpose, Indicates taking and its transpose, Indicates Euclidean distance calculation; At the same time, the annotations corresponding to the images are input into the Brownian covariance matrix module, and a of The matrices are , each labeled category The matrix is ​​accumulated and then averaged to get the Average of annotation types matrix; S5.3, Classifier module: The depth feature image obtained in step S5.1 Input to the classifier module The input of the activation function layer is used to sequentially transform the deep feature image The annotation is activated to make the deep feature image The outputs of the annotation types are probability values ​​between 0 and 1, and the probability prediction vector is obtained. ; S6, training and testing model: including a custom loss function module, a training module and a testing module, performing loss calculation according to the prediction result obtained in step S5 and the real annotation of the image, then inputting the data in the training set into the deep learning model to optimize the deep learning model, then inputting the data in the validation set into the trained deep learning model for verification, and updating the model parameters, finally setting the threshold, inputting the data in the test set into the verified deep learning model to obtain the disease type in the image; S6 is as follows: S6.

1. Custom loss function module: Predict vector based on probability , ground truth and Average of annotation types Matrix custom loss function, where Sigmoid outputs the probability prediction vector of the image The real annotation of the image The binary cross entropy loss function is calculated as follows: , in, represents a custom loss function, Represents the logarithmic function; S6.2, Training Module: Model training phase: Set the optimizer of the deep learning model to Optimizer, loss function is set to custom loss function, and training rounds are set to 100; The training set Input into the deep learning model under training conditions and iterate in sequence. In each round, the training set After being shuffled, it is input into the constructed deep model to obtain the corresponding image of the input image. Matrix and probability prediction vector, and then optimize the model by minimizing the custom loss function; Model validation phase: The validation set Input the trained deep learning model for round verification, and then calculate the custom loss function. Once the loss value of this round on the verification set is less than the minimum loss value in the previous round, the model parameters are updated; Finally, the parameters in the deep learning model are updated based on the results of the model training phase and the model verification phase, and the deep learning model is finally trained to obtain a trained deep learning model. ; S6.3, test module: The test set Input to In the above example, we get the probability vector of the image in the test set belonging to the four annotation types. , Represents the probability values ​​of the four annotation types, and then sets the threshold , when the probability value vector The probability value of a certain annotation type is greater than , then the disease type of the image can be obtained.

2. A cucumber disease identification method based on deep learning according to claim 1, characterized in that: S1 is as follows: The cucumber leaf images were captured by a SLR camera; The weather conditions include sunny, cloudy, rainy and overcast, and the number of images collected in the four conditions is the same; The abnormal leaf images are yellow light leaf pathology images. The pathology types in the yellow light leaf pathology images include three common types: downy mildew, angular spot and powdery mildew. Total collection images, where the normal image Zhang, abnormal image The abnormal images include a downy mildew image, b angular spot image, and c powdery mildew image. Expressed as , Representation dataset Middle images, Representation dataset any image in .

3. A cucumber disease identification method based on deep learning according to claim 2, characterized in that S2 The details are as follows: Please ask two or more professionals in this field to independently review the dataset The images are labeled as normal and abnormal, and the corresponding label type number is marked for each image. The normal class corresponds to number 0, and the abnormal class corresponds to number 1 for downy mildew, number 2 for angular spot, and number 3 for powdery mildew. When the same image is annotated differently, all professionals in the field will collectively determine the annotation type; When there are multiple diseases in the same image, multiple labels are corresponding to one icon, that is, multi-label labeling; Preprocessed dataset Expressed as , Represents the preprocessed dataset Middle images, Represents the preprocessed dataset any image in .

4. The cucumber disease identification method based on deep learning according to claim 3 is characterized in that S3 The details are as follows: Preprocessed dataset Medium Image , Indicates the number of channels of the image, Indicates the height of the image. Indicates the width of the image; For images , by Methods in the library for randomly transforming the color space of an image Set 4 random numbers between 0 and 1, respectively , , and , and obtain an image with random changes in brightness, contrast, saturation, and hue , the calculation process is as follows: , in, Indicates call Process the data, Indicates brightness, Indicates contrast, Indicates saturation, Indicates hue; Preprocessed dataset Each image in Randomly generate 100 groups , each image 100 images are generated after random changes in brightness, contrast, saturation and hue , and then the preprocessed data set The number of images in becomes ; Then for 100 Add random noise to the image and get 200 images; Finally, we get the data set after data enhancement .

5. A cucumber disease identification method based on deep learning according to claim 4, characterized in that: S4 is as follows: By traversing the enhanced dataset Building a dictionary , determine the dictionary according to the annotation number The values ​​are 0, 1, 2, and 3, correspond Value Collection , , The value corresponds to The values ​​are the file names of the images corresponding to the corresponding numbers; When a graph contains two annotations, they are assigned to the corresponding Value Value Collection middle; The enhanced dataset is divided into two parts according to the ratio of 8:1:

1. Divide into training set, validation set and test set. When dividing the data set, traverse the dictionary in turn All Value, indivual The value corresponds to Collection , Will Perform 8:1:1 data set division and get , and , , put 4 The training set, validation set, and test set after value division are stacked separately to obtain the training set , validation set and test set , which is expressed as follows: , , , in, Indicates the training set correspond A collection of values, Indicates the validation set correspond A collection of values, Indicates the test set correspond A collection of values, .

Citation Information

Patent Citations

  • Disease recognition method of winter jujube based on deep convolutional neural network and disease image

    AU2020102885A4

  • Method for identifying plant leaf diseases by using GPCNNs and ELM

    CN110222696A

Cited By

  • Method and system for predicting diseases and pests of green infarction vegetables based on big data processing

    CN121482779A