Plant disease recognition method, device, electronic device and storage medium
Through the small sample training method combining integrated classification and meta-learning, the problem of degradation of recognition accuracy caused by a small number of samples in plant disease recognition is solved, and more stable and accurate disease recognition results are achieved.
Patent Information
- Application Number
- CN202110614433.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-02
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-06-02
AI Technical Summary
The prior art is difficult to effectively utilize a small number of samples in plant disease identification, resulting in a decrease in recognition accuracy, especially the difficulty of identifying uncommon crop diseases.
Using an integrated classification and meta-learning method, the initial parameter values of the plant disease recognition model and the decision weight of the integrated classifier are obtained through a small sample training method, and the stability and accuracy of the recognition results are improved through the training and weighted output of the sequence-based learner.
It effectively reduces the variance of identification results, improves the accuracy of plant disease recognition and the stability of classifiers, and is suitable for disease recognition in a small sample environment.
Smart Images

Figure CN113869098B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital image processing, and particularly to a method, apparatus, electronic device, and storage medium for plant disease recognition. Background Art
[0002] Crop diseases are important factors leading to yield reduction. Quickly identifying the disease types and formulating corresponding pesticides to kill the pathogens in time are of great significance for reducing the application rate and increasing efficiency. At present, smartphones have been widely used, and their cameras can capture disease images at any time. With the help of digital image recognition technology, a convenient means for crop disease diagnosis is provided. In disease recognition, deep convolutional neural networks are mainly used. This is a high-parameter model, which is trained with a large amount of data. The larger the amount of data, the higher the recognition accuracy of the trained model. However, when the target data is insufficient, transfer learning is generally used for training. Even so, thousands of samples are required for training. In practice, it is often restricted by the collection cost and time, and it is often impossible to collect a lot of disease samples. Especially for some uncommon crop diseases, their occurrence is random and cannot be predicted in advance, and it is difficult to systematically obtain a large number of samples. When there are only a few disease samples, they cannot be used to train a large deep neural network because overfitting will occur, resulting in a sharp drop in recognition accuracy.
[0003] Few-shot learning uses a small amount of labeled data to improve the generalization performance of the recognition model by learning the commonalities in different sub-tasks, so as to meet the actual disease recognition requirements. At present, few-shot learning methods are roughly divided into methods based on metric learning, meta-learning, data augmentation, and multi-modal. For few-shot learning, it is very difficult to train a powerful classification model on new types with only a few training samples. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, apparatus, electronic device, and storage medium for plant disease recognition, which reduces the variance of the recognition results, improves the stability of the classifier, and the accuracy of plant disease recognition.
[0005] In a first aspect, the present invention provides a method for plant disease recognition, including:
[0006] Obtaining a target image of a plant disease to be recognized;
[0007] Inputting the target image of the plant disease to be recognized into a plant disease recognition model to obtain a plant disease recognition result output by the plant disease recognition model;
[0008] Wherein, the plant disease recognition model is obtained based on a training method of integrated classification and meta-learning, and the training method includes:
[0009] A few-shot training method based on meta-learning to obtain the initial values of the parameters of the plant disease classifier of the plant disease recognition model and the decision weights of each classifier of the ensemble classifier.
[0010] Use the initial parameter values as the initial parameters of the first base learner in the sequential base learner, and train the sequential base learner as a new ensemble classifier, where the subsequent base learner is trained with the parameters of the previous trained base learner as the initial values.
[0011] Among them, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting factors are the decision weights of each classifier of the ensemble classifier obtained by the few-shot training method based on meta-learning.
[0012] Optionally, the training method further includes: using a set of images of general plant diseases similar to the target disease images to be recognized to train a meta-learner, which reflects the feature extraction and recognition ability of general plant diseases; then, the parameters learned by the meta-learner are given to a set of sequential classifiers, and this set of sequential classifiers is trained and learned again on the target disease image set.
[0013] Optionally, the training method includes:
[0014] Step S1: Determine the types of plant diseases to be recognized. For each type of plant disease to be recognized, collect a predetermined number of image samples to form a target data set S de , S de which contains the plant disease images to be recognized and their corresponding plant disease type labels, and collect the images of general plant diseases to form a training and validation data set S tv , S tv which contains the plant disease images for training and their corresponding disease type labels, and the plant disease types in S tv are different from those in S de ;
[0015] Step S2: Determine the number of loops N outer in the training process of the meta-learner ML, randomly initialize the parameters θ of the meta-learner ML, determine the number of base learners N T to be trained, and establish a set of base learners with the same network structure as the meta-learner ML Initialize the initial decision weights of each base learner
[0016] Step S3: Sample N tv groups of training tasks {T inner , T sup , T que} from S
[0017] Step S4: Using θ as the initial value, for each group of T sup Train successively with Algorithm 1 Update BL i (i = 1, …, N T )'s parameters, and calculate all BL i (i = 1, …, N T ) on T que 's loss function L que ;
[0018] Step S5: Calculate the overall meta-loss function L inner on N meta groups of training tasks. Based on the loss function, update the parameters θ and decision weights w of the meta-learner ML;
[0019] Step S6: Repeat Step S3, Step S4, and Step S5 for N outer times to obtain the final parameters θ and decision weights w of the meta-learner ML.
[0020] Optionally, training the plant disease recognition model further includes:
[0021] Step S7: Reconstruct a new set of base learners Sample N de groups of training tasks {T act , T sup} from S que . Using the parameters θ of the meta-learner ML obtained by training in Step S6 as the initial parameters and on T act of N sup groups of training tasks (i = 1, …, N act ), retrain with the Algorithm 1 and evaluate the average classification accuracy of the diseases to be recognized on T act of N que groups of training tasks. If the average accuracy meets the preset conditions, then is used as the deployable plant disease recognizer, where during decision-making, the prediction results of are weighted with the decision weights w in Step S6, and the classification with the highest score is taken as the predicted disease.
[0022] Optionally, Step S4 includes:
[0023] Step S41: Initialize BL with the parameters θ of the meta-learner 1 ;
[0024] Step S42: Train successively where, when training BL i , BLi The initial parameter of i-1 is the parameter of the trained BL, and the training object is only BL. i , and the other N T -1 base learners do not participate in the training.
[0025] Optionally, the process of training BL i includes:
[0026] Step S421: Let i = 1;
[0027] Step S422: Calculate the loss function of BL i on all disease images in T sup :
[0028]
[0029] where is the result of predicting the plant disease type of the j-th disease image in T i by using the parameter of the BL i-1 as the initial parameter, where sup is the true disease type label corresponding to , with a one-hot structure, where L
[0030] where is the soft cross-entropy function, CE where, for the base learner BL with i = 1 1
[0031] 1 its initial parameter takes θ, and N sup is the number of all disease images in T sup ;
[0032] Step S423: Update the parameter of BL i :
[0033]
[0034] where α 1 is the learning rate for updating and is the gradient calculated for with respect to ;
[0035] Step S424: i ← i + 1, and repeat Step S422 and Step S423 until i > N T .
[0036] Optionally, the said Step S5 includes:
[0037] Step S51: Calculate the L inner in the N que groups of training tasks as the overall meta-loss function L meta ;
[0038] Step S52: Update the meta-learner parameter θ and the decision weight w:
[0039]
[0040] where α 2 and α 3 are the learning rates for updating θ and w respectively, and are the gradients of L meta with respect to θ and w respectively.
[0041] Optionally, the step S7 includes:
[0042] Step S71: Calculate the combined predicted plant disease type scores Score i (i = 1, …, N T ) for the k-th image of the plant disease to be recognized in T que : k
[0043]
[0044] where is the prediction result of BL i for the disease image
[0045] , w i is the decision weight obtained by training at the end of step S6;
[0046] Step S72: Take the disease type corresponding to the maximum value among the components of Score k as the discrimination type of the k-th image.
[0047] In a second aspect, the present invention provides a plant disease recognition device, including:
[0048] An acquisition module, configured to acquire a target image of a plant disease to be recognized;
[0049] A recognition module, configured to input the target image of the plant disease to be recognized into a plant disease recognition model, and obtain a plant disease recognition result output by the plant disease recognition model;
[0049] wherein, the plant disease recognition model is obtained based on a training method of integrated classification and meta-learning, and the training method includes:
[0050] The parameter initial values of the plant disease classifier of the plant disease recognition model and the decision weights of each of the ensemble classifiers are obtained by a few-shot training method based on meta-learning.
[0051] Use the parameter initial values as the initial parameters of the first base learner in the sequential base learner, and train the sequential base learner as a new ensemble classifier, where the subsequent base learner is trained with the parameters of the previous trained base learner as the initial values.
[0052] Among them, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting is the decision weights of each of the ensemble classifiers obtained by the few-shot training method based on meta-learning.
[0053] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the plant disease recognition method according to the first aspect when executing the program.
[0054] In a fourth aspect, the present invention 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 steps of the plant disease recognition method according to the first aspect are implemented.
[0055] In summary, the plant disease recognition method, device, electronic device, and non-transitory computer-readable storage medium provided by the present invention utilize a few-shot plant disease recognition method that combines the ensemble classification idea with meta-learning. In this method, a group of base learners are trained as an ensemble classifier, and the disease recognition result is obtained by weighting the outputs of each classifier, which greatly reduces the variance of the recognition result. At the same time, the parameter initial values of the actual disease classifier and the decision weights of each of the ensemble classifiers are obtained by using the meta-learning training method, which improves the stability of the classifier and the accuracy of plant disease recognition. Description of the Drawings
[0056] Figure 1 is a flowchart of the plant disease recognition method according to an embodiment of the present invention;
[0057] Figure 2 is a flowchart of the method for training a plant disease recognition model according to an embodiment of the present invention;
[0058] Figure 3 is a flowchart of Algorithm 1 for training a base learner of a plant disease recognition model according to an embodiment of the present invention;
[0059] Figure 4 is a schematic structural diagram of the plant disease recognition device according to an embodiment of the present invention; and
[0060] Figure 5 It is a schematic structural diagram of the electronic device provided by the present invention. Detailed implementation manners
[0061] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of 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 of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0062] Figure 1 It is a flowchart of the plant disease recognition method according to an embodiment of the present invention. Referring to Figure 1 , the plant disease recognition method provided by the embodiment of the present invention includes the following steps:
[0063] Step 110: Obtain a target image of the plant disease to be recognized;
[0064] Step 120: Input the target image of the plant disease to be recognized into a plant disease recognition model to obtain a plant disease recognition result output by the plant disease recognition model;
[0065] Wherein, the plant disease recognition model is obtained based on a training method integrating classification and meta-learning,
[0066] The training method includes:
[0067] Based on a meta-learning based few-shot training method, obtain the initial values of the parameters of the plant disease classifier of the plant disease recognition model and the decision weights of each classifier of the ensemble classifier,
[0068] Use the initial parameter values as the initial parameters of the first base learner in the sequential base learner, and train the sequential base learner as a new ensemble classifier, wherein the subsequent base learner is trained with the parameters of the previous trained base learner as the initial values;
[0069] Wherein, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting coefficients are the decision weights of each classifier of the ensemble classifier obtained based on the meta-learning based few-shot training method.
[0070] The general idea of the present invention is to first train a meta-learner through learning on a general plant disease set S tv , and the meta-learner reflects the ability to extract and recognize the characteristics of general plant diseases; secondly, endow the group of sequential recognizers with the experience learned by the meta-learner, and this group of recognizers is in the target disease set S deSecondary training is performed. In actual recognition, each of the identifiers in this group gives a score belonging to a certain disease. The disease type with the highest score after multiplying the scores of each identifier by their respective weights is the final output of the group of identifiers. The experience learned by the meta-learner is reflected in its network parameters, which are used as the initial parameters of the first identifier in the sequence identifier. The role of the meta-learning process can be achieved with a small amount of data (S tv ) recognition tasks and a few trainings to quickly adapt to new recognition tasks (S de ), in addition, the weights of a set of sequence-based learners (which are also actual sequence identifiers) are also learned during the meta-learning process.
[0071] The present invention does not learn a group of base learners in parallel, but learns a group of sequential base learners, because a group of parallel learners is prone to overfitting. The meaning of sequence means that each base learner is trained in sequence during the training process, and the subsequent base learner is trained with the parameters of the previously trained base learner as the initial value. Therefore, the present invention generally includes two processes: (1) meta-learner training process: the final result is to obtain the model parameters of the meta-learner and the weights of each base learner (also each actual identifier) in a group of sequential learners, and the specific training steps include the following steps S1-S6; (2) actual disease identifier training process, and the specific training steps include the following steps S7.
[0072] In the above embodiment, the present invention trains a group of base learners as an integrated classifier, and the plant disease recognition result is obtained by weighting the output of each classifier, which greatly reduces the variance of the recognition result; based on the small sample training method of meta-learning, the initial values of the parameters of the actual plant disease classifier and the decision weights of the integrated classifier are obtained, thereby improving the stability of the plant disease classifier and the accuracy of plant disease recognition.
[0073] Based on the above embodiments, Figure 2 and Figure 3 As shown, the training of the plant disease recognition model includes:
[0074] Step S1: Determine the type of plant disease to be identified, and for each type of plant disease to be identified, collect a predetermined number of image samples to form a target data set S de , S de Contains plant disease images to be identified and corresponding plant disease type labels, and collects images of general plant diseases to form training and verification data sets S tv , S tv Contains plant disease images and corresponding disease type labels used for training, S tv With S de The types of plant diseases are different;
[0075] Step S2: Determine the number of loops N in the training process of the meta-learner ML outer , randomly initialize the parameters θ of the meta-learner ML, and determine the number N of base learners to be trained T , and establish a set of base learners with the same network structure as the meta-learner ML Initialize the initial decision weights of each base learner
[0076] Step S3: Sample N tv groups of training tasks {T inner , T sup , T que} in the N-Way M-shot manner from S
[0077] Step S4: Using θ as the initial value, in each group of T sup train in sequence with Algorithm 1 Update the parameters of BL i (i = 1, …, N T ), calculate the loss function L of all BL i (i = 1, …, N T ) on T que ; que
[0078] Step S5: Calculate the overall meta-loss function L inner on the N meta groups of training tasks, and update the parameters θ and decision weights w of the meta-learner ML based on the loss function;
[0079] Step S6: Repeat Step S3, Step S4, and Step S5 for N outer times to obtain the final parameters θ and decision weights w of the meta-learner ML
[0080] Among them, for Step S1, in one example, assume that the plant diseases to be identified are A, B, C, D, and E, and there are only 10 image samples that can be collected for each disease. Combine these five disease samples and their true disease labels to form the target dataset S de = {x i , y i}, where x i is the sample and y i is the corresponding disease label. Since there is too little of this disease data, it is very easy to overfit when training with a typical deep network, resulting in a sharp drop in the recognition rate in actual recognition. The present invention uses a method that combines the principle of meta-learning and ensemble learning to solve this problem. First, collect some other plant diseases that do not include the above 5 diseases. Assume that 20 diseases are collected, with 20 samples for each. Combine these disease samples to form the training and validation dataset Stv = {x i , y i}}。
[0081] For step S2, in one example, the meta-learner ML and the base learners BL1, BL2, etc. have exactly the same network structure, which can be a relatively shallow convolutional network, such as COV4\5, RESNET18\25\34, etc. It is not easy to use a deep network because when the training samples are insufficient, the latter is prone to overfitting. The parameter θ of ML refers to the parameters of its network model. The sum of each weight should satisfy
[0082] For step S3, in this embodiment, the 5-way 5-shot method can be used for training, that is, each training task extracted includes 5 disease types, and each disease type contains 5 samples. The number of training tasks extracted can be, for example, 100, that is, N inner = 100.
[0083] For step S4, in one example, since ML and BL i (i = 1,..., N T ) are networks with exactly the same structure, initialize BL with θ as the initial value 1 , train BL 1 , and then initialize BL with the parameters of the trained BL 1 , train BL 2 , and so on, and train this group of base learners sequentially in sequence. 2 Based on the above embodiment, training the plant disease recognition model may further include:
[0084] Step S7: Reconstruct a new group of base learners
[0085] Sample N from S de groups of training tasks {T act , T sup}, use the parameter θ of the meta-learner ML obtained by training in step S6 as the initial parameter and on the T que of N act groups of training tasks (i = 1,..., N sup ), retrain with the algorithm 1 act and evaluate the average classification accuracy of the diseases to be recognized on the T of N act groups of training tasks. If the average accuracy meets the preset conditions, then que is used as the deployable plant disease recognizer, where the decision weights w in step S6 are used for decision-making for The prediction results are weighted, and the classification with the highest score is taken as the predicted disease.
[0086] For step S4, in one example, the reconfigured and the sequence-based learner group in step S2 are exactly the same in structure and quantity, but through learning, they are directly used for the identification of target diseases, and are preferably called the sequence disease identifier group. The training and test data set S de is composed of real target disease samples. The training method is exactly the same as Algorithm 1 in step S4. The parameters of the meta-learner ML trained in steps S1 - S6 are used as the initial values, and the disease identifier group is trained sequentially, that is, the parameters θ of the ML model trained at the end of step S6 are used as the initial values to initialize BL 1 and train BL 1 Then, with the trained BL 1 parameters to initialize BL 2 and train BL 2 and so on, and train this group of disease identifiers sequentially.
[0087] Based on the above embodiments, step S4 includes:
[0088] Step S41: Initialize BL with the parameters θ of the meta-learner 1 ;
[0089] Step S42: Train sequentially where, when training BL i , the initial parameters of BL i are the parameters of the trained BL i-1 , and the training object is only BL i , and the other N T -1 base learners do not participate in the training.
[0090] Based on the above embodiments, the process of training BL i includes:
[0091] Step S421: Let i = 1;
[0092] Step S422: Calculate the loss function of BL i on all disease images in T sup :
[0093]
[0094] where, is BL i with the parameters of the BL i-1 as the initial parameters, for T as the initial parameters, for Tsup the j-th disease image the result of predicting the type of plant disease,
[0095] wherein, is the corresponding true disease type label, having a one-hot structure,
[0096] wherein, L CE is the soft cross-entropy function. In one example, the loss function can also be calculated in other ways.
[0097] wherein, for the base learner BL with i = 1 1 its initial parameter takes θ, N sup is T sup the number of all disease images;
[0098] Step S423: Update the parameters of BL i :
[0099]
[0100] where α 1 is the learning rate for updating , is the gradient calculated for with respect to ;
[0101] Step S424: i ← i + 1, repeat Step S422 and Step S423 until i > N T .
[0102] Based on the above embodiments, the said Step S5 includes:
[0103] Step S51: Calculate the average value of L inner in the N que groups of training tasks as the overall meta-loss function L meta ;
[0104] Step S52: Update the meta-learner parameter θ and the decision weight w:
[0105]
[0106] where, α 2 and α 3 are the learning rates for updating θ and w respectively, and are the gradients of L meta with respect to θ and w respectively.
[0107] Based on the above embodiments, the said Step S7 includes:
[0108] Step S71: Calculate all BL i (i = 1, …, N T ) For the k-th image of the plant disease to be recognized in T que to obtain the combined prediction plant disease type score Score : k :
[0109]
[0110] Wherein is the prediction result of BL i for the disease image , w i is the decision weight obtained by training at the end of step S6;
[0111] Step S72: Take the disease type corresponding to the maximum value among the components of Score k as the discrimination type of the k-th image.
[0112] In one example, other methods can also be used to calculate the predicted plant disease type score of the k-th image of the plant disease to be recognized .
[0113] The plant disease recognition method, device, electronic device and non-transitory computer-readable storage medium provided by the present invention utilize a few-shot plant disease recognition method that combines the idea of integrated classification and meta-learning. In this method, a group of base learners are trained as an integrated classifier, and the disease recognition result is obtained by weighting the outputs of each classifier, which greatly reduces the variance of the recognition result. At the same time, the initial values of the parameters of the actual disease classifier and the decision weights of each integrated classifier are obtained by using the meta-learning training method, which improves the stability of the classifier and the accuracy of plant disease recognition.
[0114] Referring to Figure 4 , Figure 4 is a schematic structural diagram of a plant disease recognition device according to an embodiment of the present invention. The plant disease recognition device provided in this embodiment includes:
[0115] An acquisition module 410, configured to acquire a target image of a plant disease to be recognized;
[0116] A recognition module 420, configured to input the target image of the plant disease to be recognized into a plant disease recognition model to obtain a plant disease recognition result output by the plant disease recognition model;
[0117] Wherein, the plant disease recognition model is obtained based on a training method of integrated classification and meta-learning, and the training method includes:
[0118] A few-shot training method based on meta-learning to obtain the initial values of the parameters of the plant disease classifier in the plant disease recognition model and the decision weights of each classifier in the ensemble classifier.
[0119] Use the initial parameter values as the initial parameters of the first base learner in the sequential base learner, and train the sequential base learner as a new ensemble classifier, where the subsequent base learner is trained with the parameters of the previous trained base learner as the initial values.
[0120] Among them, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting factors are the decision weights of each classifier in the ensemble classifier obtained by the few-shot training method based on meta-learning.
[0121] Figure 5 An example of the physical structure diagram of an electronic device is shown as Figure 5 shown. The electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communication interface 520, and the memory 530 complete communication with each other through the communication bus 540. The processor 510 can call the logical instructions in the memory 530 to execute the plant disease recognition method, and the method includes:
[0122] Obtain the target image of the plant disease to be recognized;
[0123] Input the target image of the plant disease to be recognized into the plant disease recognition model to obtain the plant disease recognition result output by the plant disease recognition model;
[0124] Among them, the plant disease recognition model is obtained based on an ensemble classification and meta-learning training method, and the training method includes:
[0125] A few-shot training method based on meta-learning to obtain the initial values of the parameters of the plant disease classifier in the plant disease recognition model and the decision weights of each classifier in the ensemble classifier.
[0126] Use the initial parameter values as the initial parameters of the first base learner in the sequential base learner, and train the sequential base learner as a new ensemble classifier, where the subsequent base learner is trained with the parameters of the previous trained base learner as the initial values.
[0127] Among them, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting factors are the decision weights of each classifier in the ensemble classifier obtained by the few-shot training method based on meta-learning.
[0128] In addition, when the logical instructions in the above-mentioned memory 530 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 can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in 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.
[0129] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the plant disease recognition method provided by the above-mentioned various methods. The method includes:
[0130] Obtain a target image of the plant disease to be recognized;
[0131] Input the target image of the plant disease to be recognized into a plant disease recognition model to obtain a plant disease recognition result output by the plant disease recognition model;
[0132] Among them, the plant disease recognition model is obtained based on a training method integrating classification and meta-learning. The training method includes:
[0133] Based on a meta-learning-based few-shot training method, obtain the initial values of the parameters of the plant disease classifier of the plant disease recognition model and the decision weights of each decision-making classifier of the integrated classifier.
[0134] Use the initial parameter values as the initial parameters of the first base classifier in the sequential base classifier, and train the sequential base classifier as a new integrated classifier. Among them, the subsequent base classifier is trained with the parameters of the previously trained base classifier as the initial values.
[0135] Among them, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new integrated classifier, and the weighting factors are the decision weights of each decision-making classifier of the integrated classifier obtained based on the meta-learning-based few-shot training method.
[0136] In another aspect, 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 implements the plant disease recognition method provided above, and the method includes:
[0137] Obtain a target image of the plant disease to be recognized;
[0138] Input the target image of the plant disease to be recognized into the plant disease recognition model to obtain the plant disease recognition result output by the plant disease recognition model;
[0139] Wherein, the plant disease recognition model is obtained based on a training method integrating classification and meta-learning;
[0140] The training method includes:
[0141] Based on the few-shot training method of meta-learning, obtain the initial values of the parameters of the plant disease classifier of the plant disease recognition model and the decision weights of each classifier of the ensemble classifier,
[0142] Use the initial parameter values as the initial parameters of the first base learner in the sequential base learner, and train the sequential base learner as a new ensemble classifier. Among them, the subsequent base learner is trained with the parameters of the previous trained base learner as the initial values;
[0143] Wherein, the plant disease recognition result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting is the decision weights of each classifier of the ensemble classifier obtained based on the few-shot training method of meta-learning.
[0144] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. 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 labor.
[0145] 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 such an 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.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended 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 perform equivalent replacements for some of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying plant diseases, characterized in that, it includes: Obtain a target image of the plant disease to be identified; Input the target image of the plant disease to be identified into a plant disease identification model to obtain a plant disease identification result output by the plant disease identification model; Among them, the plant disease identification model is obtained based on a training method of meta-learning and ensemble classification, and the training method includes: Step S2: Determine the number of loops N in the training process of the meta-learner ML outer , randomly initialize the parameters θ of the meta-learner ML, and determine the number of base learners N to be trained T , establish a set of base learners {BL 1 , BL 2 , …, BL NT} with the same network structure as the meta-learner ML, and initialize the initial decision weights w = {w 1 , w 2 , …, w NT}; Step S3: Sample N sets of training tasks {T tv , T inner} from the training and validation dataset S of the plant disease recognition model in the N-Way M-shot manner; tv N inner {T sup , T que}; Step S4 includes: Step S41: Initialize BL with the parameters θ of the meta-learner 1 ; Step S42: Train BL sequentially 1 , BL 2 , …, BL NT , where when training BL i , the initial parameters of BL i are the parameters of the trained BL i-1 , and only BL i is the training object, and the other N T-1 base learners do not participate in the training. Update the parameters of B Li (i = 1, …, N T ), calculate the loss function L Li of all B T (i = 1, …, N que ) on T que ; Step S5: Calculate the overall meta-loss function L on N inner sets of training tasks meta , and update the initial parameter θ and the initial decision weight w of the meta-learner ML based on the loss function; Step S6: Repeat Step 2, Step 3, and Step 4 for N outer times to obtain the final parameters θ and decision weights w of the meta-learner ML; Among them, the plant disease identification result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting is the decision weights of each classifier of the ensemble classifier obtained by the small-sample training method based on meta-learning. The new ensemble classifier is composed of trained base learners.
2. The method for identifying plant diseases according to claim 1, characterized in that, the training method includes: Using a set of images of general plant diseases as the training and validation dataset S tv , a meta-learner is trained, and the meta-learner reflects the feature extraction and recognition capabilities of general plant diseases; secondly, the parameters learned by the meta-learner are given to a group of sequence classifiers, and this group of sequence classifiers is trained and learned again on the target disease image set.
3. The method for identifying plant diseases according to claim 1 or 2, characterized in that, The training and validation dataset S of the plant disease recognition model tv is determined based on the following steps: Step S1: Determine the types of plant diseases to be recognized. For each type of plant disease to be recognized, collect a predetermined number of image samples to form a target dataset S de , S de contains the plant disease images to be recognized and the corresponding plant disease type labels. Collect the images of general plant diseases to form the training and validation dataset S tv , S tv contains the plant disease images for training and the corresponding disease type labels. S tv is different from the plant disease types in S de .
4. The method for identifying plant diseases according to claim 3, characterized in that, Training the plant disease identification model further includes: Step S7: Reconstruct a new set of base learners {BL 1 , BL 2 , …, BL NT}. Sample N de groups of training tasks {T act , T sup , …, T que} from S act . Use the parameters θ of the meta-learner ML obtained by training in Step S6 as the initial parameters, and on the T sup of the N act groups of training tasks (i = 1, …, N 1 ), retrain {BL 2 , BL NT , …, BL act} based on the said Step S41 and the said Step S42, and evaluate the average classification accuracy of the diseases to be recognized on the T que of the N 1 groups of training tasks. If the average accuracy meets the preset conditions, then take {BL 2 , BL NT , …, BL 1 , BL 2 , …, BL NT} as the deployable plant disease recognizer. Among them, when making a decision, use the decision weight w in Step S6 to weight the prediction results of {BL 1 , BL 2 , …, BL NT}, and take the classification with the highest score as the predicted disease.
5. The method for identifying plant diseases according to claim 1, characterized in that, Training BL i The process includes: Step S421: Let i = 1; Step S422: Calculate BL i on all disease images at T sup : the loss function Among them, is BL i Using the parameters of the BL i-1 as the initial parameters, the result of predicting the plant disease type of the j-th disease image of T is sup Among them, is the corresponding true disease type label, with a one-hot structure, Among them, L CE is the soft cross-entropy function, Among them, for the base learner BL with i = 1 1 , its initial parameters take θ, N sup is T sup the number of all disease images Step S423: Update the parameters of BL i : where α 1 is the updated learning rate, and is the gradient calculated with respect to Step S424: i ← i + 1, repeat Step S422 and Step S423 until i > N T .
6. The method for identifying plant diseases according to claim 1, characterized in that, The step S5 includes: Step S51: Calculate the L inner average value of the N que groups of training tasks as the overall meta-loss function L meta ; Step S52: Update the meta-learner parameter θ and the decision weight w: θ ← θ - α 2 ▽ θ L meta , w ← w - α 3 ▽ w L meta where α 2 and α 3 are the learning rates for updating θ and w respectively, and ▽ θ and ▽ w are the gradients of L meta with respect to θ and w respectively.
7. The method for identifying plant diseases according to claim 4, characterized in that, The step S7 includes: Step S71: Calculate all BL i (i = 1, …, N T ) for the k-th image of the plant disease to be recognized in T que to obtain the combined prediction score Score of the plant disease type : k : Among them is BL i the prediction result of the disease image , w i is the decision weight obtained through training at the end of step S6; Step S72: Obtain Score k The disease type corresponding to the maximum value among the components is used as the discrimination type of the k-th image.
8. A plant disease identification device, characterized in that, it includes: An acquisition module for acquiring a target image of the plant disease to be identified; An identification module for inputting the target image of the plant disease to be identified into a plant disease identification model to obtain a plant disease identification result output by the plant disease identification model; Among them, the plant disease identification model is obtained based on a training method of ensemble classification and meta-learning, and the training method includes: Step S2: Determine the number of loops N in the training process of the meta-learner ML outer , randomly initialize the parameters θ of the meta-learner ML, and determine the number of base learners N to be trained T , and establish a set of base learners with the same network structure as the meta-learner ML Initialize the initial decision weights of each base learner Step S3: Sample N groups of training tasks {T, T} from the training and validation dataset S of the plant disease recognition model in the N-Way M-shot manner; tv N inner {T sup , T que}; Step S4 includes: Step S41: Initialize BL with the parameters θ of the meta-learner 1 ; Step S42: Train sequentially where, when training BL i , the initial parameters of BL i are the parameters of the trained BL i-1 , and the training object is only BL i , and the other N T-1 base learners do not participate in the training. Update the parameters of B Li (i = 1, …, N T ), calculate the loss function L Li of all B T (i = 1, …, N que ) on T que ; Step S5: Calculate the overall meta-loss function L on N inner groups of training tasks meta , and update the initial parameter θ and the initial decision weight w of the meta-learner ML based on the loss function; Step S6: Repeat steps 2, 3, and 4 for N outer times to obtain the final parameters θ and decision weights w of the meta-learner ML; Among them, the plant disease identification result is obtained by weighting the outputs of each classifier in the new ensemble classifier, and the weighting is the decision weights of each classifier of the ensemble classifier obtained by the small-sample training method based on meta-learning.
9. An electronic device includes 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 steps of the method for identifying plant diseases according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for identifying plant diseases according to any one of claims 1 to 7.