Crop Disease Recognition Method, Device, Equipment and Storage Medium
By adding dropout layer after the fully connected layer of the ResNeXt model and adjusting its probability value, the error problem caused by the crop disease recognition algorithm in the prior art relying on manual feature extraction is solved, and a higher recognition accuracy is achieved.
Patent Information
- Application Number
- CN202210383553.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-12
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-04-12
AI Technical Summary
The existing crop disease recognition algorithm relies on manual feature extraction, which may cause large errors in extreme cases and have low model accuracy.
The dropout layer is further connected after the fully connected layer of the ResNeXt model, and the probability value of the dropout layer is adjusted to suppress the number of neurons output by the model, thereby improving the ResNeXt model and improving the accuracy of crop disease recognition.
By reducing the number of neurons output by the model, the model can more fit the crop disease recognition scenario, avoid overfitting, and improve the accuracy of the model to identify crop diseases.
Smart Images

Figure CN114764887B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technologies, and in particular, to a disease recognition method and apparatus. Background Art
[0002] With the advancement of smart agriculture and precision agriculture, disease recognition models relying on machine learning are emerging.
[0003] Currently, some algorithms, such as color threshold method, Support Vector Machine (SVM), and random forest, etc., are applied to disease recognition to achieve automatic detection of crop diseases.
[0004] However, the feature extraction of these algorithms relies on manual work, and in extreme cases, it may cause large errors and the model accuracy is low. Summary of the Invention
[0005] In view of the defects existing in the prior art, the present invention provides a method, apparatus, device, and storage medium for crop disease recognition.
[0006] In a first aspect, the present invention provides a method for crop disease recognition, including:
[0007] Using the improved ResNeXt model to recognize crop diseases;
[0008] Wherein, the output of the fully connected layer in the ResNeXt model is connected to a dropout layer.
[0009] Optionally, according to the crop disease recognition method provided by the present invention, the improved ResNeXt model is obtained by the following method:
[0010] Obtaining a crop information sample set, the sample set including a training set, a test set, and a validation set;
[0011] Based on the training set, training the improved ResNeXt model;
[0012] Based on the test set, adjusting the probability value of the dropout layer to suppress the number of neurons output by the model.
[0013] Optionally, according to the crop disease recognition method provided by the present invention, the adjusting the probability value of the dropout layer based on the test set to suppress the number of neurons output by the model includes:
[0014] Inputting the test set into the improved ResNeXt model to obtain the disease recognition result corresponding to the test set;
[0015] Adjust the probability value of the dropout layer based on the accuracy rate of the disease recognition result.
[0016] Optionally, according to the crop disease recognition method provided by the present invention, the adjusting the probability value of the dropout layer based on the accuracy rate of the disease recognition result includes:
[0017] In the case where the accuracy rate is the maximum value, determine the probability value corresponding to the maximum value as the first probability value;
[0018] Set the probability value of the dropout layer to the first probability value.
[0019] Optionally, according to the crop disease recognition method provided by the present invention, the method further includes:
[0020] Use the improved ResNeXt model to determine the first disease category corresponding to the crop to be recognized;
[0021] Input the crop to be recognized into multiple classification models respectively, and determine the second disease categories corresponding to the crop to be recognized respectively;
[0022] Determine the third disease category among the first disease category and all the second disease categories as the disease recognition result corresponding to the crop to be recognized;
[0023] Wherein, the third disease category is the disease category with the most repeated occurrences among the first disease category and all the second disease categories.
[0024] Optionally, according to the crop disease recognition method provided by the present invention, the crop information sample set includes crop pictures and the position information of the crops.
[0025] In a second aspect, the present invention further provides a crop disease recognition device, including:
[0026] An identification unit, configured to use the improved ResNeXt model to identify crop diseases;
[0027] Wherein, the output of the fully connected layer in the ResNeXt model is connected to a dropout layer.
[0028] In a third aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, it implements the crop disease recognition method as described in any one of the above.
[0029] Fourthly, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the crop disease recognition method described in any one of the above is implemented.
[0030] Fifthly, the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the crop disease recognition method described in any one of the above is implemented.
[0031] The crop disease recognition method, device, equipment and storage medium provided by the present invention further connect a dropout layer after the fully connected layer in the ResNeXt model to improve the ResNeXt model; and then use the improved ResNeXt model to recognize crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease recognition scenario, avoid the overfitting phenomenon when the existing ResNeXt model recognizes crop diseases, and improve the accuracy of the model in recognizing crop diseases. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0033] Figure 1 is one of the flow diagrams of the crop disease recognition method provided by the present invention;
[0034] Figure 2 is the improved model structure provided by the present invention;
[0035] Figure 3 is the block structure diagram of the model provided by the present invention;
[0036] Figure 4 is another flow diagram of the crop disease recognition method provided by the present invention;
[0037] Figure 5 is yet another flow diagram of the crop disease recognition method provided by the present invention;
[0038] Figure 6 is the loss function image of the model in the related art;
[0039] Figure 7 is the loss function image of the improved model provided by the present invention;
[0040] Figure 8It is a schematic structural diagram of the crop disease recognition device provided by the present invention;
[0041] Figure 9 It is one of the schematic structural diagrams of the electronic device provided by the present invention;
[0042] Figure 10 It is the second schematic structural diagram of the electronic device provided by the present invention. Detailed implementation manners
[0043] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without creative efforts shall fall within the protection scope of the present invention.
[0044] To facilitate a clearer understanding of the embodiments of the present application, some related background knowledge is introduced as follows:
[0045] Timely obtaining accurate information about diseases can effectively reduce the economic losses of crops and increase the crop yields.
[0046] Currently, the detection methods for crop diseases mostly rely on visual inspection and experience, requiring a large amount of manpower and material resources. Moreover, it is also difficult to accurately identify the corresponding diseases, and there is a problem that similar diseases are difficult to distinguish, resulting in the inability to timely prevent and control the large-scale spread of crop diseases, thus causing greater losses.
[0047] With the development of computer science and technology, the progress of computer vision, and the proposal of deep learning algorithms such as Convolutional Neural Networks (CNN) and Recursive Neural Network (RNN), extensive attempts have been made to use deep learning algorithms to solve problems related to machine vision in the agricultural field, and agricultural work has greatly reduced its dependence on manual labor. The automated processing and discrimination of the algorithms can timely and accurately monitor the growth trend of crops and disease problems, thereby reducing the consumption of manpower and material resources, increasing the crop yields, and reducing the production costs at the same time.
[0048] Some common algorithms can be applied to disease recognition to achieve the automation of crop disease detection. For example, color threshold method, SVM, random forest, etc. However, the feature extraction of these algorithms all relies on manual experience, and the models do not have robustness and strong robustness. In extreme cases, it may cause large errors, and these methods cannot achieve satisfactory model accuracy and recall rate.
[0049] To solve or partially solve the above-mentioned defects, the present invention provides a method, device, equipment and storage medium for identifying crop diseases. The following will combine Figures 1 - 8 to describe the crop disease identification method of the present invention.
[0050] Figure 1 is one of the schematic flowcharts of the crop disease identification method provided by the present invention. As Figure 1 shown, the present invention provides a crop disease identification method, and the method includes the following steps:
[0051] Step 110: Use the improved ResNeXt model to identify crop diseases;
[0052] Among them, the output of the fully connected layer in the ResNeXt model is connected to a dropout layer.
[0053] Specifically, aiming at the defects that in the related art, the feature extraction of algorithms relying on machine learning depends on manual experience, or the disease identification model does not have robustness and robustness, and may cause large errors in extreme cases, the present invention improves the ResNeXt model. After the fully connected layer of the ResNeXt model, a dropout layer is further connected to reduce the number of neurons output from the ResNeXt model.
[0054] It should be noted that ResNeXt refers to the enhanced Residual Network (ResNet); dropout refers to suppressing some neurons during the deep learning training process, so that these suppressed neurons do not need to work.
[0055] Optionally, the ResNeXt model is a neural network model of the ResNeXt series, including but not limited to ResNeXt50_32x4d, ResNeXt50_1x64d, and ResNeXt50_2x40d.
[0056] The crop disease identification method provided by the present invention further connects a dropout layer after the fully connected layer in the ResNeXt model to improve the ResNeXt model; then uses the improved ResNeXt model to identify crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease identification scenario, avoid the overfitting phenomenon when the existing ResNeXt model identifies crop diseases, and improve the accuracy of the model in identifying crop diseases.
[0057] Optionally, the improved ResNeXt model is obtained through the following methods, including steps a, b, and c:
[0058] Step a: Obtain a crop information sample set, where the sample set includes a training set, a test set, and a validation set;
[0059] Step b: Based on the training set, train the improved ResNeXt model;
[0060] Step c: Based on the test set, adjust the probability value of the dropout layer to suppress the number of neurons output by the model.
[0061] Specifically, in order to obtain an improved ResNeXt model, a sample set including crop information can be prepared first, and the samples in the sample set are divided into a training set, a validation set, and a test set according to a certain ratio. For example, according to the ratio of training set: validation set: test set being 8:1:1, 80% of the sample set is used as the training set, 10% of the sample set is used as the test set, and 10% of the sample set is used as the validation set.
[0062] Optionally, after obtaining the crop information sample set, the training set can be input into the improved ResNeXt model to train the improved ResNeXt model so that the improved ResNeXt model has the ability to identify crop diseases. Here, the improved ResNeXt model refers to a ResNeXt model with a dropout layer connected after the fully connected layer.
[0063] Optionally, after training the improved ResNeXt model using the training set, the probability value of the dropout layer can be further adjusted based on the test set, and the dynamic change of the disease recognition result can be observed after adjusting the probability value of the dropout layer to determine the probability value of the dropout layer of the model when the accuracy rate on the test set is the highest.
[0064] The crop disease recognition method provided by the present invention trains the improved ResNeXt model using the training set to obtain a model capable of identifying crop diseases, and then adjusts the probability value of the dropout layer based on the test set to improve the generalization of the model, avoid the defect of poor application effect when the existing ResNeXt model is used to identify crop diseases, and improve the accuracy rate of the model in identifying crop diseases.
[0065] Optionally, the adjusting the probability value of the dropout layer based on the test set to suppress the number of neurons output by the model includes:
[0066] Input the test set into the improved ResNeXt model to obtain the disease recognition result corresponding to the test set;
[0067] Adjust the probability value of the dropout layer based on the accuracy rate of the disease recognition result.
[0068] Specifically, after obtaining the trained improved ResNeXt model, the test set can be input into the improved ResNeXt model to obtain the disease recognition result corresponding to the test set.
[0069] Optionally, after obtaining the disease recognition result corresponding to the test set, the probability value of the dropout layer can be adjusted according to the accuracy rate of the disease recognition result, where the accuracy rate refers to that the disease category of the test set recognized by the model is consistent with the actual disease category of the test set, and the probability value of the dropout layer refers to the proportion of the input neurons that remain active. For example, if the probability value is 0.5, then half of the input neurons are randomly frozen and do not participate in the training of the model.
[0070] The crop disease recognition method provided by the present invention trains the improved ResNeXt model using the training set to obtain a model capable of recognizing crop diseases, and then inputs the test set into the improved ResNeXt model, adjusts the probability value of the dropout layer based on the accuracy rate of the model, provides a specific method for adjusting the probability value of the dropout layer, and improves the accuracy rate of the model in recognizing crop diseases.
[0071] Optionally, the adjusting the probability value of the dropout layer based on the accuracy rate of the disease recognition result includes:
[0072] In the case where the accuracy rate is the maximum value, determine the probability value corresponding to the maximum value as the first probability value;
[0073] Set the probability value of the dropout layer to the first probability value.
[0074] Specifically, in order to improve the effect of the improved ResNeXt model in actual application and avoid large errors in actual application although the model performs well in training, the present invention further connects a dropout layer after the fully connected layer of the existing ResNeXt model, and inputs the test set into the improved ResNeXt model to obtain the probability value corresponding to the dropout layer in the model when the accuracy rate of the test set reaches the maximum, so as to set the parameters of the dropout layer in the model.
[0075] The crop disease recognition method provided by the present invention obtains the probability value of the dropout layer in the improved ResNeXt model when the accuracy rate of the test set reaches the maximum, enabling the improved ResNeXt model to maintain a high accuracy rate when using the test set after training, thereby ensuring the accuracy rate in actual applications and further improving the accuracy rate of the model.
[0076] Optionally, the ResNeXt model may be a ResNeXt50_32x4d model.
[0077] Optionally, a second fully connected layer may be connected after the dropout layer, and the number of neurons in the second fully connected layer is the same as the number of preset disease categories.
[0078] Specifically, Figure 2 is the improved model structure provided by the present invention. As Figure 2 shown, the improved model includes a zero-padding (ZERO PAD) layer, stage 1 (stage1) to stage 5 (stage5), an average pooling (AVG POOL) layer, a flattening (Flatten) layer, and a fully connected (FC) layer. A dropout layer may be connected after the fully connected layer, and a second fully connected layer may be connected after the dropout layer.
[0079] Among them, the number of neurons in the second fully connected layer is the same as the number of preset disease categories, that is, the same as the number of disease categories that the model can recognize, while the number of neurons in the first fully connected layer, that is, the fully connected layer connected after the flattening layer, is not limited.
[0080] Among them, the zero-padding layer performs zero-value padding on the input data; the average pooling layer performs average pooling on the feature map after stage 5; the flattening layer flattens the pooled feature map; the fully connected layer connects each node to all nodes in the previous layer, for comprehensively extracting the features in the previous layer and finally outputting the prediction result.
[0081] Optionally, a group of dropout layer and fully connected layer may be connected after the second fully connected layer.
[0082] Specifically, the ResNeXt model is a series of models. The ResNeXt model can be regarded as an optimization of the ResNet structure. ResNeXt adopts the idea of the inception structure, but continues to use the strategy of constructing repeated convolutional layers in ResNet, making the network more elegant and concise on the basis of having performance, and also proposes the concept of "cardinality". ResNeXt controls the network width and depth of the transformation part through the cardinality.
[0083] Among them, the Inception structure is a neural network structure that performs multiple convolutional operations or pooling operations on the input image in parallel and concatenates all the results into a deeper feature map; cardinality is the number of branches (blocks) in the model structure.
[0084] Specifically, Figure 3 is the block structure diagram of the model provided by the present invention. The model can be ResNeXt50_32x4d. The 32 in ResNeXt50_32x4d refers to the number of cardinalities, and 4d refers to the number of 3×3 convolutions. In addition, the model can also be ResNeXt29_8X64d, ResNeXt29_16x64d, ResNeXt50_32x3d, ResNeXt101_32x4d, ResNeXt101_64x4d.
[0085] As Figure 3 shown, each branch of ResNeXt50_32x4d has 256 1×1 convolutions, 4 3×3 convolutions, and 4 1×1 convolutions.
[0086] Based on the ResNeXt50_32x4d model, a dropout layer is used after the original fully connected layer, followed by another fully connected layer, then another dropout layer, and finally another fully connected layer for output.
[0087] In traditional models, the parameter ratio in all fully connected layers (FC) almost accounts for 80% of the entire network, increasing the training time of the model and resulting in a huge demand for computer memory. Too many parameters will also lead to overfitting problems. Especially in various images taken in the wild, there is a lot of noise, such as the unevenness of the background and the unevenness of the illumination, which is easily overfitted by complex models, resulting in overfitting problems. To address this issue, the present invention adds a dropout layer after the FC to reduce the number of neurons in the model, thereby avoiding overfitting.
[0088] After ResNeXt50_32x4d passes through the fully connected layer, a dropout layer is added and the probability value is set to 0.5, indicating that randomly 50% of the network nodes do not work (the output is set to zero) and the weights are not updated. Then it is connected to a fully connected layer, and the same dropout layer is added again. Finally, it is connected to a fully connected layer. After passing through layers such as the maximum smoothing layer (softmax), the disease recognition result is finally output.
[0089] The input image size of the ResNeXt50_32x4d model is 224×224×3. 224 refers to the width and height of the image, and 3 refers to the number of color channels of the image. Since the input is a color RGB image, the number of channels is 3. AsFigure 2 As shown, Stage 1 includes a convolutional layer (CONV layer), an accelerated training layer (Batch Norm layer), an activation function layer (Relu layer), and a max pooling layer (MAXPOOL layer). After the input image passes through Stage 1, the image size becomes 112×112×64; then it enters Stage 2 (including 2 convolutional blocks), and the image size becomes 56×56×256; it enters Stage 3 (including 3 convolutional blocks), and the image size becomes 28×28×512; it enters Stage 4 (including 5 convolutional blocks), and the image size becomes 14×14×1024; it enters Stage 5 (including 2 convolutional blocks), and the image size becomes 7×7×2048; then through the average pooling layer and the flattening layer, the image size becomes one-dimensional; finally, through the first fully connected layer, multiple neurons are output; the dropout layer reduces the multiple input neurons, and then through the processing of the fully connected layer, the result is finally output.
[0090] For the crop disease recognition method provided by the present invention, using the dropout layer after the fully connected layer can reduce the neurons of the model, improve the generalization ability of the model, prevent the model from overfitting, and thus improve the performance of the model.
[0091] Furthermore, the method further includes:
[0092] Using the improved ResNeXt model to determine the first disease category corresponding to the crop to be recognized;
[0093] Inputting the crop to be recognized into multiple classification models respectively to determine the second disease categories corresponding to the crop to be recognized respectively;
[0094] Determining the third disease category among the first disease category and all the second disease categories as the disease recognition result corresponding to the crop to be recognized;
[0095] Wherein, the third disease category is the disease category with the most repeated occurrences among the first disease category and all the second disease categories.
[0096] Specifically, Figure 4 is the second flowchart of the crop disease recognition method provided by the present invention. As Figure 4 shown, the crop disease recognition method provided by the embodiments of the present invention can analyze the collected data using software. The specific software analysis includes using the improved model, target detection algorithm 1, target detection algorithm 2, and target detection algorithm 3 to recognize the diseases corresponding to the input data, and performing an optimal voting selection on the analysis results, and finally outputting the prediction result and the corresponding treatment method.
[0097] Optionally, the target detection algorithm 1 can be the third version of the You Only Look Once (Yolo v3) algorithm, the target detection algorithm 2 can be the fourth version of the Yolo algorithm (Yolo v4), and the target detection algorithm 3 can be the Single Shot MultiBox Detector (SSD) algorithm, to identify the diseases corresponding to the input data.
[0098] Optionally, the model used for software analysis can also include other deep learning network algorithm models, such as the fifth version of the Yolo algorithm (Yolo v5), the Faster Convolutional Neural Networks (Faster R-CNN), and the Mask Faster Convolutional Neural Networks (Mask R-CNN).
[0099] Specifically, to obtain data, data collection is required, and a handheld device can be used to collect crop information.
[0100] Optionally, the crop information sample set includes crop pictures and the location information of the crops.
[0101] Specifically, the collected crop picture information can be temporarily stored locally, and further obtain the geographical location information corresponding to the crop picture information, where the geographical location information characterizes the regional characteristics of the disease, to assist the model in identifying the disease information of the crops.
[0102] Specifically, after data collection, an APP integrated with multiple recognition models can be enabled to analyze and identify the collected image information. Each model will identify the obtained pictures, and then through the "optimal voting selection" mechanism, the results predicted by each model are integrated to obtain the best prediction result, and the disease information and treatment methods are fed back to provide a reasonable solution for the user.
[0103] Specifically, the treatment methods corresponding to the disease information will vary according to the disease results predicted by the model. For example, if the predicted result of the model is early blight, the treatment method for early blight can be returned; if the predicted result is late blight, the treatment method for late blight can be returned.
[0104] Specifically, the "optimal voting selection" mechanism means that Figure 4 as shown, each model identifies the same picture in parallel, and each model will obtain its own prediction result. Finally, the results are comprehensively judged to obtain the best prediction result.
[0105] For example, five different models predict the same picture, and the prediction results are divided into two categories, A and B. Among them, two models predict that the picture belongs to category A, and three models predict it as category B. According to the "optimal voting selection" mechanism, the prediction results of each model are integrated, and finally it is determined that the picture belongs to category B because the models predicting category B are in the majority, thus integrating the prediction results of each model and making the prediction accuracy higher.
[0106] It should be noted that the crop disease recognition in the present invention Method can recognize the diseases of a variety of crops, and the specific categories of crop diseases that can be recognized are not limited in the present invention.
[0107] The crop disease recognition method provided by the present invention adopts the "optimal voting selection" mechanism, integrates the prediction results of each model, has a better prediction effect than a single model, and the obtained prediction results are more accurate; and on the basis of providing the type of disease that the crop is infected with, a treatment method is provided to help the user prescribe the right medicine and increase the practicality.
[0108] Figure 5 is the third schematic flow chart of the crop disease recognition method provided by the present invention. As Figure 5 shown, the crop disease recognition method provided by the present invention includes steps 510 to 530.
[0109] Step 510, obtain a crop information sample set.
[0110] Specifically, the obtained crop information sample set can be the picture information of the crop and the corresponding geographical location information, and the sample set can include a training set and a test set.
[0111] Step 520, obtain an improved ResNeXt model.
[0112] Step 530, vote to select the optimal disease recognition result.
[0113] Taking the training of the model on the potato disease data set as an example below, both the original ResNeXt50_32x4d and the improved ResNeXt50_32x4d use the potato disease data set. The number of images in the entire data set is 4,517, and each image is an image of a potato leaf, including 4 disease types (early blight, late blight, leaf roll disease, ring rot disease), plus a total of 5 types including the healthy category.
[0114] The above data set is divided into a training set, a validation set, and a test set, and the quantity ratio among them is 8:1:1. Among them, the training set is used for the data samples for model fitting, the model learns features from the training set, the validation set is used to adjust the parameters of the model and for a preliminary evaluation of the model's ability, and the test set is used to test the performance of the model.
[0115] The model is trained using the training set data. Stochastic Gradient Descent (SGD) is used as the optimizer (to optimize the model and accelerate the training process, saving the time for network training. The initial learning rate can be 0.001, and the momentum can be 0.9 (the learning rate and momentum are two parameters of SGD). The batch size is 8 (8 images are taken from the dataset each time and input into the model for training). The cross-entropy loss function is used as the loss function, and 35 epochs are set for training (an epoch refers to the number of rounds of model training). The above is the training of the model on the potato disease dataset, but it can also be trained on the datasets of other crops, and the present invention does not limit this.
[0116] Figure 6 is the image of the loss function of the model in the related technology. The model can be ResNeXt50_32x4d, as Figure 6 shown. The training set loss curve (Train_Loss) is the upper curve of the two curves, representing the loss value obtained on the training set; the validation set loss curve (Val_Loss) is the lower curve of the two curves, representing the loss value obtained on the validation set; the epoch number (Epoch Number) represents the number of rounds of training.
[0117] From Figure 6 it can be seen that the curves of Train_Loss and Val_Loss are both decreasing, indicating that the model fitting effect is good and the model performance is good.
[0118] Figure 7 is the image of the loss function of the improved model provided by the present invention. The model can be ResNeXt50_32x4d, as Figure 7 shown. The training set loss curve (Train_Loss) is the upper curve of the two curves, representing the loss value obtained on the training set; the validation set loss curve (Val_Loss) is the lower curve of the two curves, representing the loss value obtained on the validation set; the epoch number (Epoch Number) represents the number of rounds of training.
[0119] From Figure 7 it can be seen that the curves of Train_Loss and Val_Loss are both decreasing, and the decreasing amplitude is larger than that in Figure 6 , indicating that the model fitting effect is better.
[0120] Table 1 shows the accuracy rates of the model in the related art and the improved model on the test set. As shown in Table 1, the accuracy rate of the improved model is slightly higher than that of the model in the prior art, and the improved model has better performance. Among them, the accuracy rate refers to the ratio of the number of samples correctly classified by the model for the test set to the total number of samples.
[0121] Table 1
[0122] Model category Improved model Model in the related technology Accuracy rate (%) 99.56 98
[0123] After obtaining the improved ResNeXt model, the crop disease recognition method provided by the present invention further uses an optimal voting selection mechanism to select the optimal disease recognition result, thereby improving the accuracy rate of the model in recognizing crop diseases.
[0124] In the crop disease recognition method provided by the present invention, a dropout layer is further connected after the fully connected layer in the ResNeXt model to improve the ResNeXt model; then, the improved ResNeXt model is used to recognize crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease recognition scenario, avoid the overfitting phenomenon when the existing ResNeXt model recognizes crop diseases, and improve the accuracy rate of the model in recognizing crop diseases.
[0125] The crop disease recognition device provided by the present invention will be described below. The crop disease recognition device described below can be correspondingly referred to the crop disease recognition method described above.
[0126] Figure 8 is a schematic structural diagram of the crop disease recognition device provided by the present invention. As Figure 8 shown, the crop disease recognition device provided by the present invention includes:
[0127] An identification unit 810, configured to use the improved ResNeXt model to identify crop diseases;
[0128] Wherein, a dropout layer is connected to the output of the fully connected layer in the ResNeXt model.
[0129] In the crop disease recognition device provided by the present invention, a dropout layer is further connected after the fully connected layer in the ResNeXt model to improve the ResNeXt model; then, the improved ResNeXt model is used to recognize crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease recognition scenario, avoid the overfitting phenomenon when the existing ResNeXt model recognizes crop diseases, and improve the accuracy rate of the model in recognizing crop diseases.
[0130] Optionally, the recognition unit 810 is further configured to:
[0131] Obtain a crop information sample set, where the sample set includes a training set, a test set, and a validation set;
[0132] Train the improved ResNeXt model based on the training set;
[0133] Adjust the probability value of the dropout layer based on the test set to suppress the number of neurons output by the model.
[0134] Optionally, the recognition unit 810 is further configured to:
[0135] Input the test set into the improved ResNeXt model to obtain the disease recognition result corresponding to the test set;
[0136] Adjust the probability value of the dropout layer based on the accuracy rate of the disease recognition result.
[0137] Optionally, the recognition unit 810 is further configured to:
[0138] When the accuracy rate is the maximum value, determine the probability value corresponding to the maximum value as the first probability value;
[0139] Set the probability value of the dropout layer to the first probability value.
[0140] Optionally, the recognition unit 810 is further configured to:
[0141] Use the improved ResNeXt model to determine the first disease category corresponding to the crop to be recognized;
[0142] Input the crop to be recognized into multiple classification models respectively to determine the second disease categories corresponding to the crop to be recognized respectively;
[0143] Determine the third disease category among the first disease category and all the second disease categories as the disease recognition result corresponding to the crop to be recognized;
[0144] Wherein, the third disease category is the disease category with the most repeated occurrences among the first disease category and all the second disease categories.
[0145] Optionally, the crop information sample set includes crop pictures and the position information of the crops.
[0146] The crop disease recognition device provided by the present invention further connects a dropout layer after the fully connected layer in the ResNeXt model to improve the ResNeXt model. Then, the improved ResNeXt model is used to recognize crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease recognition scenario, avoid the overfitting phenomenon when the existing ResNeXt model recognizes crop diseases, and improve the accuracy of the model in recognizing crop diseases.
[0147] It should be noted here that the above-mentioned crop disease recognition device provided by the present invention can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. The same parts and beneficial effects as those in the method embodiment will not be specifically described in this embodiment.
[0148] Figure 9 is one of the structural schematic diagrams of the electronic device provided by the present invention, as Figure 9 shown, the electronic device includes: a processor 910, a communication interface 920, a memory 930, and a communication bus 940. Among them, the processor 910, the communication interface 920, and the memory 930 complete communication with each other through the communication bus 940. The processor 910 can call the logical instructions in the memory 930 to execute the crop disease recognition method;
[0149] Among them, the processor 910 is used for:
[0150] using the improved ResNeXt model to recognize crop diseases;
[0151] Among them, the output of the fully connected layer in the ResNeXt model is connected to a dropout layer.
[0152] In addition, when the logical instructions in the above-mentioned memory 930 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this 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 for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0153] The electronic device provided by the present invention further connects a dropout layer after the fully connected layer in the ResNeXt model to improve the ResNeXt model; and then uses the improved ResNeXt model to identify crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease identification scenario, avoid the overfitting phenomenon when the existing ResNeXt model identifies crop diseases, and improve the accuracy of the model in identifying crop diseases.
[0154] Optionally, the processor 910 is further configured to:
[0155] Obtain a crop information sample set, where the sample set includes a training set, a test set, and a validation set;
[0156] Based on the training set, train the improved ResNeXt model;
[0157] Based on the test set, adjust the probability value of the dropout layer to suppress the number of neurons output by the model.
[0158] Optionally, the processor 910 is further configured to:
[0159] Input the test set into the improved ResNeXt model to obtain the disease identification result corresponding to the test set;
[0160] Based on the accuracy of the disease identification result, adjust the probability value of the dropout layer.
[0161] Optionally, the processor 910 is further configured to:
[0162] When the accuracy is the maximum value, determine the probability value corresponding to the maximum value as the first probability value;
[0163] Set the probability value of the dropout layer to the first probability value.
[0164] Optionally, the ResNeXt model is a ResNeXt50_32x4d model.
[0165] Optionally, a second fully connected layer is further connected after the dropout layer, and the number of neurons in the second fully connected layer is the same as the number of preset disease categories.
[0166] Optionally, the processor 910 is further configured to:
[0167] Use the improved ResNeXt model to determine the first disease category corresponding to the crop to be identified;
[0168] Input the crop to be identified into multiple classification models respectively, and determine the second disease categories corresponding to the crop to be identified respectively;
[0169] Determine the third disease category among the first disease category and all the second disease categories as the disease recognition result corresponding to the crop to be identified;
[0170] Wherein, the third disease category is the disease category with the most repeated occurrences among the first disease category and all the second disease categories.
[0171] Optionally, the crop information sample set includes crop pictures and the location information of the crops.
[0172] Optionally, Figure 10 is the second schematic diagram of the structure of the electronic device provided by the present invention. As Figure 10 shown, the electronic device may include: a display screen 1010, a camera module 1020, a GLSS module 1030, a CPU module 1040, a RAM module 1050, a ROM module 1060, and a battery module 1070.
[0173] Wherein, the display screen 1010 is provided with a registration key 1011 and a power key 1012. The power key 1012 is used to turn on the screen, and the registration key 1011 is used to capture images; the camera module 1020 includes a high-definition camera (such as: a 48MP camera) 1021 for acquiring image data of crop diseases; the GLSS module 1030 is used to locate the crops and obtain geographical location information; the CPU module 1040 is the central processor of the device, and the battery module 1070 provides power for the device to work continuously.
[0174] Specifically, the high-definition camera 1021 is used to obtain image data of crop diseases, and then temporarily store it locally through the RAM module 1050 and the ROM module 1060. Furthermore, the acquisition App is used to collect visible light pictures and the current location information. Finally, multiple recognition models are loaded to vote and select crop disease information, and a reasonable solution is provided for the user.
[0175] Optionally, the above-mentioned multiple models can be upgraded and expanded through computer transmission. The operating system of the above device can be Android, and the present invention does not limit this.
[0176] The electronic device provided by the present invention further connects a dropout layer after the fully connected layer in the ResNeXt model to improve the ResNeXt model; then, the improved ResNeXt model is used to identify crop diseases, which can reduce the number of neurons output by the model, make the model better fit the crop disease recognition scenario, avoid the overfitting phenomenon when the existing ResNeXt model is used to identify crop diseases, and improve the accuracy of the model in identifying crop diseases.
[0177] It should be noted here that the above-mentioned electronic device provided by the present invention can implement all the method steps implemented by the above method embodiment and can achieve the same technical effect. The same parts and beneficial effects as those in the method embodiment will not be specifically described in this embodiment.
[0178] On the other hand, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is used to execute the crop disease recognition method provided by the above-mentioned various methods. The method includes:
[0179] Using the improved ResNeXt model to identify crop diseases;
[0180] Wherein, a dropout layer is connected to the output of the fully connected layer in the ResNeXt model.
[0181] On yet another aspect, the present invention also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the crop disease recognition method provided by the above-mentioned various methods. The method includes:
[0182] Using the improved ResNeXt model to identify crop diseases;
[0183] Wherein, a dropout layer is connected to the output of the fully connected layer in the ResNeXt model.
[0184] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative work.
[0185] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, 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., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0186] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or equivalently replace some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.
Claims
1. A method for identifying crop diseases, characterized in that, Including: Using the improved ResNeXt model to identify crop diseases; Among them, the output of the fully connected layer in the ResNeXt model is connected to a dropout layer; The improved ResNeXt model is obtained through the following method: Obtain a crop information sample set, and the sample set includes a training set, a test set, and a validation set; Based on the training set, train the improved ResNeXt model; Based on the test set, adjust the probability value of the dropout layer to suppress the number of neurons output by the model; The adjusting the probability value of the dropout layer based on the test set to suppress the number of neurons output by the model includes: Input the test set into the improved ResNeXt model to obtain the disease recognition result corresponding to the test set; Based on the accuracy of the disease recognition result, adjust the probability value of the dropout layer; the accuracy refers to that the disease category of the test set recognized by the model is consistent with the actual disease category of the test set; The adjusting the probability value of the dropout layer based on the accuracy of the disease recognition result includes: In the case where the accuracy is the maximum value, determine the probability value corresponding to the maximum value as the first probability value; Set the probability value of the dropout layer to the first probability value; Among them, the improved ResNeXt model includes a zero-padding layer, stages 1 to 5, an average pooling layer, a flattening layer, and a fully connected layer. A dropout layer is connected after the fully connected layer, a second fully connected layer is connected after the dropout layer, and another set of dropout layer and fully connected layer is connected after the second fully connected layer; the number of neurons in the second fully connected layer is the same as the preset number of disease categories.
2. The method for identifying crop diseases according to claim 1, characterized in that, The method further includes: Using the improved ResNeXt model to determine the first disease category corresponding to the crop to be identified; Input the crop to be identified into multiple classification models respectively to determine the second disease categories corresponding to the crop to be identified respectively; Determine the third disease category among the first disease category and all the second disease categories as the disease recognition result corresponding to the crop to be identified; Among them, the third disease category is the disease category with the most repeated occurrences among the first disease category and all the second disease categories.
3. The method for identifying crop diseases according to claim 1, characterized in that, The crop information sample set includes crop pictures and the location information of the crops.
4. A device for identifying crop diseases, characterized in that, Including: An identification unit for using the improved ResNeXt model to identify crop diseases; Among them, the output of the fully connected layer in the ResNeXt model is connected to a dropout layer; The crop disease identification device further includes an acquisition unit for obtaining a crop information sample set, where the sample set includes a training set, a test set, and a validation set; training the improved ResNeXt model based on the training set; adjusting the probability value of the dropout layer based on the test set to suppress the number of neurons output by the model; The obtaining unit is further configured to input the test set into the improved ResNeXt model to obtain the disease recognition result corresponding to the test set; adjust the probability value of the dropout layer based on the accuracy rate of the disease recognition result; the accuracy rate refers to that the disease category of the test set recognized by the model is consistent with the actual disease category of the test set. The obtaining unit is further configured to, when the accuracy rate is the maximum value, determine the probability value corresponding to the maximum value as the first probability value; set the probability value of the dropout layer as the first probability value. Among them, the improved ResNeXt model includes a zero-padding layer, stages 1 to 5, an average pooling layer, a flattening layer, and a fully connected layer. A dropout layer is connected after the fully connected layer, a second fully connected layer is connected after the dropout layer, and a group of dropout layer and fully connected layer are further connected after the second fully connected layer; the number of neurons in the second fully connected layer is the same as the preset number of disease categories.
5. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the crop disease recognition method according to any one of claims 1 to 3.
6. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that, When the computer program is executed by the processor, it implements the crop disease recognition method according to any one of claims 1 to 3.
7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the crop disease recognition method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Citrus Huanglongbing identification method and device based on Mixup algorithm
CN110135371A