Fruit and vegetable disease and insect pest detection method based on spectrum database and model confidence coefficient
By employing a detection method based on spectral databases and model confidence, combined with lightweight convolutional neural networks and expert systems, the accuracy problem of fruit and vegetable pest and disease detection was solved, achieving high efficiency and accuracy in pest and disease detection and continuous model optimization.
Patent Information
- Application Number
- CN202510898797.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-11-07
AI Technical Summary
Existing methods for detecting diseases and pests in fruits and vegetables have not been validated for accuracy, making them prone to errors.
A detection method based on spectral database and model confidence is adopted. By acquiring spectral data of fruit and vegetable crops, a lightweight convolutional neural network is used for disease and pest diagnosis. The reliability of the diagnosis results is judged by combining the model confidence, and an expert system corrects uncertain results.
It improves the accuracy of pest and disease detection, prevents misjudgments, ensures that only highly reliable results are automatically entered into the database, and corrects uncertain results through an expert system, thereby achieving continuous optimization of the diagnostic model and dynamic updates of the database.
Smart Images

Figure CN120913101A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of agricultural remote sensing and artificial intelligence, and particularly relates to a fruit and vegetable disease and pest detection method based on a spectrum database and model confidence. BACKGROUND
[0002] Timely and accurate diagnosis of fruit and vegetable diseases and pests is crucial for agricultural production. Traditional methods often rely on manual observation and experience, which is inefficient and easily affected by subjective factors.
[0003] In the prior art, for example, a Chinese invention patent with application number CN202410635672.3 discloses a fruit and vegetable video disease and pest detection method based on deep learning and big data technology, which specifically discloses a camera module, a deep learning model training module, a video detection display module, a detection data collection module, a real-time detection module and an alarm module, an offline detection module and a display module. The camera module uses a camera installed in a greenhouse to take a set of range-different fruit and vegetable growth videos every 24 hours. The deep learning model training module includes an iteration unit and an identification unit. The video detection display module is an interface generated by software development, which displays the fruit and vegetable disease and pest detection status in real time. The real-time detection module processes and analyzes the detection data in real time, and triggers the alarm module when a certain indicator is reached. The offline detection module processes and analyzes the detection data offline, and finally displays the results in the display module.
[0004] However, the recognition scheme in the prior art only detects diseases and pests, and does not verify the accuracy of disease and pest detection, which can easily lead to errors in disease and pest detection. SUMMARY
[0005] Therefore, it is necessary to verify the accuracy of disease and pest detection, which can easily lead to errors in disease and pest detection, and to provide a fruit and vegetable disease and pest detection method based on a spectrum database and model confidence.
[0006] To achieve the above-mentioned purpose, the present application adopts the following scheme:
[0007] A fruit and vegetable disease and pest detection method based on a spectrum database and model confidence, comprising the following steps:
[0008] Step S10. Obtain the spectrum data of the fruit and vegetable crops;
[0009] Step S20. Based on the disease and pest diagnosis model, output the disease and pest diagnosis result and its corresponding model confidence;
[0010] Step S30. Based on the pre-set confidence model, judge the model confidence corresponding to the disease and pest diagnosis result and the pre-set range, and output the diagnosis result and the corresponding reliability.
[0011] Preferably, step S10. acquiring the spectral data of the fruit and vegetable crops comprises the following steps:
[0012] Step S11. acquiring the multispectral image of the fruit and vegetable crops;
[0013] Step S12. performing the pre-processing module to pre-process the image, and outputting the spectral data.
[0014] Preferably, step S30. based on the pre-set confidence model, judging whether the model confidence corresponding to the disease and pest diagnosis result is within the pre-set range, and outputting the diagnosis result and the corresponding reliability, further comprising the following steps:
[0015] Step S31. acquiring the disease and pest diagnosis result and the corresponding model confidence;
[0016] Step S32. based on the pre-set confidence model, judging whether the model confidence corresponding to the disease and pest diagnosis result is not less than the threshold of high model confidence:
[0017] If yes, outputting the high model confidence;
[0018] If no, outputting the model confidence corresponding to the disease and pest diagnosis result to the expert system module.
[0019] Preferably, in step S32, if no, outputting the model confidence corresponding to the disease and pest diagnosis result to the expert system module, further comprising the following steps:
[0020] Step S33. acquiring the model confidence corresponding to the disease and pest diagnosis result, and the model confidence corresponding to the disease and pest diagnosis result is less than the threshold of high model confidence;
[0021] Step S34. based on the expert system module, judging whether the model confidence corresponding to the disease and pest diagnosis result is not less than the threshold of low model confidence;
[0022] If yes, identifying and confirming the diagnosis result and the corresponding model confidence by the expert, correcting the diagnosis result, and outputting the corrected diagnosis result;
[0023] If no, identifying the diagnosis result and the corresponding model confidence by the expert, and outputting the correct diagnosis result.
[0024] Preferably, the model confidence is Conf total , and the model confidence Conf total is weighted by the classification probability confidence Conf cls , the prediction uncertainty confidence Conf unc , and the embedding distance confidence Conf dist .
[0025] Preferably, the classification probability confidence
[0026]
[0027] wherein, represents the prediction probability of the model for the i-th class, z i represents the logit value of the last layer of the model, C represents the total number of classes, T represents the temperature parameter, and T > 0.
[0028] Preferably, the prediction uncertainty confidence Conf unc = exp(-λσ 2 );
[0029] wherein,
[0030]
[0031] is the average value of all M predictions, M is the number of forward times, p (1) ,…, p (M) is the probability corresponding to the M groups, σ is the standard deviation, and λ is a hyperparameter that controls the decay speed.
[0032] Preferably, the embedding distance confidence Conf dist = exp(-γD M (x))
[0033] wherein,
[0034]
[0035] γ is a scaling hyperparameter, f(x) is the embedding representation of the input sample in the feature space, μ is the feature center (mean) of a class of the training set, T is the temperature parameter, Σ is the covariance matrix of the features, D is the Mahalanobis distance, which measures the standardized distance between the sample and the class center.
[0036] Preferably, the model confidence c = [Conf cls , Conf unc , Conf dist ], three kinds of confidence are combined into an input vector c,
[0037] w = Softmax(W·ReLU(V·c))
[0038] wherein, V, W are weight matrices (linear transformation parameters) to be learned, ReLU is an activation nonlinearity, Softmax makes the weights satisfy w1+w2+w3=1, w1, w2, w3 are respectively Conf cls , Conf unc , Confdist weight of the fruit.
[0039] The technical scheme adopted by the present application can achieve the following beneficial effects:
[0040] By calculating and comparing the model confidence of the output diagnosis result, the model confidence of the diagnosis result is given, solving the problem of incorrect detection of plant diseases and insect pests due to the lack of verification of the accuracy of plant disease and insect pest detection. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 A flowchart of a fruit and vegetable plant disease and insect pest detection method based on a spectrum database and model confidence disclosed by the embodiments of the present application. DETAILED DESCRIPTION
[0042] In order to facilitate the understanding of the present application, the present application will be described more fully below with reference to the related drawings. The preferred embodiments of the present application are shown in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0043] It should be noted that when a device is considered to be "connected" to another device, it can be directly connected to the other device or there can be a mediating device present at the same time. The terms "internal", "top", "upper", "lower", "up", "down" and similar expressions used herein are for illustrative purposes only and do not represent the only implementation.
[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used in the specification of the present application are only for the purpose of describing the specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0045] Referring to Figure 1 , the present application provides a fruit and vegetable plant disease and insect pest detection method based on a spectrum database and model confidence, comprising the following steps:
[0046] Step S10. Obtain the spectrum data of the fruit and vegetable crop;
[0047] Step S20. Based on the plant disease and insect pest diagnosis model, output the plant disease and insect pest diagnosis result and its corresponding model confidence;
[0048] Step S30. Based on the pre-set confidence model, determine whether the model confidence corresponding to the plant disease and insect pest diagnosis result is within the pre-set range, and output the diagnosis result and the corresponding reliability.
[0049] Specifically, the spectral data acquisition of fruit and vegetable crops is carried out by DJIM350RTK unmanned aerial vehicle carrying RedEdge-P multispectral camera at the front end of the system, and the GPS high-precision positioning module is integrated. The platform can automatically cruise in the field and obtain crop image information, and the collection range covers blue light, green light, red light, red edge, near infrared and other key vegetation bands, providing multi-dimensional spectral data basis for subsequent diagnosis.
[0050] The spectral data acquisition includes the following steps:
[0051] a. Original image acquisition The original image acquisition is obtained by one-time exposure of the RedEdge-P multispectral camera carried on the unmanned aerial vehicle. Five gray images
Blue (475nm), Green (560nm), Red (668nm), Red-Edge (717nm), NIR (842nm) can be understood as "taking 5 black and white photos with different filters at the same moment"
[0052] b. Image ortho-mosaic
[0053]
[0054] c. Radiometric calibration and reflectivity calculation, load 5 GeoTIFFs in QGIS at the same time, and convert the digital quantity DN into physical reflectivity by using the grid calculator: formula 3-1
[0055]
[0056] DN = Dark + Gain * T * R ij DN is the pixel gray value, Dark is the dark level, Gain is the camera gain, T is the exposure time, R is the gray board reflectivity exp panel
[0057] d. The difference in sunlight angle will cause the difference in reflectivity, which can be calibrated by the simplified cosine:
[0058]
[0059] where θ sun is the sun's depression angle (flight log can be checked), θ inc,ij is the pixel incidence angle, calculated by the attitude of the unmanned aerial vehicle, R ij is the reflectivity value at the i-th row and j-th column pixel (Pixel).
[0060] e.ROI crop and band merge vector import: Load the field block Shapefile in QGIS; Crop by mask: Menu Raster -> Extract -> Crop by Mask;
[0061] Multi-band synthesis: Raster -> Merge -> Build Virtual Raster (VRT) -> Check "Layer to Multi-band" and output spectral.vrt.
[0062] Finally, each pixel has a 5-dimensional feature vector:
[0063] X(i,j) = bigl[R Blue ,,R Green ,,R Red ,,R RE ,,R NIR bigr] ij
[0064] This five-channel tensor is directly fed into the deep learning model in the next section.
[0065] After obtaining the aligned spectral data, the system automatically performs image preprocessing operations such as radiation correction, geometric registration, illumination normalization, distortion correction, and outputs standardized multi-band image data, ensuring spectral consistency and spatial alignment accuracy of the model input.
[0066] The pest and disease diagnosis model is deployed in the UAV edge computing terminal or ground station, using a lightweight convolutional neural network (CNN) architecture to identify and grade the types of pests and diseases in the preprocessed images, while outputting the integrated model confidence. In the pre-set confidence model, if the model confidence ≥ 0.9: the model prediction is highly reliable; if 0.7 ≤ model confidence < 0.9: the model has some uncertainty; if the model confidence < 0.7: the model confidence is too low.
[0067] Further, first, a multi-spectral imaging device is used to obtain high-resolution multi-spectral image data by flying over the fruit and vegetable planting area. Preferably, the UAV used, such as DJI M350 RTK, is equipped with a RedEdge-P multi-spectral camera to obtain image information in multiple bands such as visible light and near-infrared. Through the preprocessing step, the collected spectral images are corrected and optimized, including but not limited to spectral calibration, noise removal, image registration, and region of interest extraction, etc., to provide high-quality input data for subsequent model analysis.
[0068] Then, the pre-processed spectral data is input into a pre-trained disease and pest diagnosis model for inference. The model can use a deep learning algorithm such as a convolutional neural network, which has been trained using a large number of labeled samples in the initial spectral database, and can output a disease and pest species diagnosis result for the input sample and a model confidence evaluation of the result. The output obtained by model inference includes: first, the diagnosis result (for example, determining the type of disease or pest species of a certain crop), and second, the model confidence value, which indicates the credibility of the model for the diagnosis result. The worker confirms the accuracy of his judgment through the diagnosis result and the corresponding model confidence.
[0069] The technical scheme of the fruit and vegetable disease and pest detection method based on the spectral database and the model confidence can achieve the following beneficial effects:
[0070] By calculating and comparing the model confidence of the output diagnosis result, the model confidence of the diagnosis result is given, which solves the problem of only detecting diseases and pests without verifying the accuracy of disease and pest detection, resulting in errors in disease and pest detection.
[0071] Based on the above scheme, step S10. Obtain the spectral data of the fruit and vegetable crop, including the following steps: step S11. Obtain a multispectral image of the fruit and vegetable crop; and step S12. Perform a pre-processing module to pre-process the image and output spectral data.
[0072] An unmanned aerial vehicle carrying a multispectral imaging device is used to conduct aerial inspection of the fruit and vegetable planting area to obtain high-resolution multispectral image data. Preferably, the unmanned aerial vehicle used, such as DJI M350 RTK, is equipped with a RedEdge-P multispectral camera to obtain image information in multiple wavebands such as visible light and near-infrared. The collected spectral image is corrected and optimized by a pre-processing module, including but not limited to spectral calibration, noise removal, image registration, and extraction of regions of interest, etc., to provide high-quality input data for subsequent model analysis.
[0073] In the above scheme, step S30. Based on the pre-set confidence model, determine whether the model confidence corresponding to the disease and pest diagnosis result is within the pre-set range, and output the diagnosis result and the corresponding reliability, further comprising the following steps:
[0074] Step S31. Obtain the disease and pest diagnosis result and its corresponding model confidence;
[0075] Step S32. Based on the pre-set confidence model, determine whether the model confidence corresponding to the disease and pest diagnosis result is not less than a high threshold of model confidence:
[0076] If yes, output the high model confidence;
[0077] If not, the model confidence corresponding to the pest and disease diagnosis result is output to the expert system module.
[0078] Specifically, after obtaining the pest and disease diagnosis result and its corresponding model confidence, by comparing it with the pre-set confidence model, if the model confidence is ≥ 0.9: it means that the model prediction is highly reliable, no manual intervention is needed, and the recognition result and the image will be directly written into the pest and disease spectrum database, and the diagnosis result and the corresponding model confidence high result will be fed back to the staff (through the display screen, wireless network, Bluetooth and other ways, as long as the staff can see it); if the model confidence is < 0.9, the model confidence corresponding to the pest and disease diagnosis result is output to the expert system module; wherein the expert system module is manually annotated and classified by pest and disease diagnosis experts according to image and spectrum data to ensure the accuracy of the recognition result and the robustness of the system. The label data output by the expert system module will be written into the system database as new training samples and used for online fine-tuning, transfer training or incremental learning of subsequent models to continuously improve the recognition performance and adaptability of the model in the actual environment, forming a complete learning closed loop.
[0079] Based on the above scheme, in step S32, if not, the model confidence corresponding to the pest and disease diagnosis result is output to the expert system module, further comprising the following steps:
[0080] Step S33. Obtain the model confidence corresponding to the pest and disease diagnosis result, and the model confidence corresponding to the pest and disease diagnosis result is less than the threshold of high model confidence;
[0081] Step S34. Based on the expert system module, judge whether the model confidence corresponding to the pest and disease diagnosis result is not less than the threshold of low model confidence;
[0082] If yes, the expert identifies and confirms the diagnosis result and the corresponding model confidence, corrects the diagnosis result, and outputs the corrected diagnosis result;
[0083] If not, the expert identifies the diagnosis result and the corresponding model confidence, and outputs the correct diagnosis result.
[0084] Further, if 0.7 ≤ model confidence < 0.9: it means that the model has certain uncertainty, and the model confidence is medium. Such medium confidence samples will trigger the expert review process, and the model confidence corresponding to the pest and disease diagnosis result will be submitted to the expert for review and judgment; if the model confidence is < 0.7: it means that the model confidence is too low, and the system judges that the sample is a difficult or potential abnormal case, which is also submitted to the expert for processing, and is marked as "low confidence sample".
[0085] Further, after obtaining the pest diagnosis result and the corresponding model confidence, the expert checks the spectral image of the sample and the preliminary conclusion given by the model, combines the actual pest situation with the knowledge of the expert, and gives an authoritative diagnosis result label. For medium confidence samples (the model confidence of the pest diagnosis result is not less than the low threshold of the model confidence), the model may be partially correct but not enough to determine, and the expert focuses on verifying the features that are easily confused by the model, confirms and corrects the label (pest diagnosis result). For example, the model gives a diagnosis result of A disease corresponding to spectral data of B disease, and the expert corrects A disease to B disease through the corresponding spectral data.
[0086] For low confidence samples (the model confidence of the pest diagnosis result is less than the low threshold of the model confidence), the model is almost unable to give a meaningful judgment, and the expert will perform a complete manual diagnosis on these possible new or abnormal cases. Once the expert completes the labeling, the system archives the sample data with the label confirmed by the expert to the abnormal sample library, and the abnormal sample library is used to store cases that the model has once been uncertain or misjudged, and provides targeted training data for subsequent model improvement. All samples labeled by experts (including medium and low confidence categories) are added to the main spectral database together with their correct labels, and are saved as new training samples.
[0087] In an embodiment of the present application, the model confidence is Conf total , and the model confidence Conf total is obtained by weighting the classification probability confidence Conf cls , the prediction uncertainty confidence Conf unc , and the embedding distance confidence Conf dist .
[0088] In the above scheme, the classification probability confidence
[0089]
[0090] wherein, represents the prediction probability of the model for the i-th class, z i represents the logit value of the last layer of the model, C represents the total number of classes, and T is a temperature parameter (T>0) adjusting the smoothness of softmax. When T=1, it is a standard softmax; when T>1, the output is more gentle (the distribution is more "soft"); when T<1, the output is more sharp (the probability of a certain class is very high, and the others are almost zero). By adjusting T, the softmax output probability is more matched with the actual accuracy, and the confidence calibration ability is improved.
[0091] Taking the maximum probability:
[0092]
[0093] represents the class with the highest probability in the softmax output as the classification confidence of the sample; the closer the probability is to 1, the more confident the model is in the class.
[0094] Further, the prediction uncertainty confidence Conf unc = exp(-λσ 2 );
[0095] wherein,
[0096]
[0097] is the average of all M predictions, M is the number of forward times, p (1) ,…,p (M) is the probability corresponding to the M groups, σ is the standard deviation, and λ is a hyperparameter that controls the decay speed.
[0098] The embedding distance confidence Conf dist = exp(-γD M (x))
[0099] wherein,
[0100]
[0101] γ is a scaling hyperparameter, f(x) is the embedding representation of the input sample in the feature space, μ is the feature center (mean) of a class of the training set, T is a temperature parameter, Σ is the covariance matrix of the features, and D is the Mahalanobis distance, which measures the standardized distance between the sample and the class center.
[0102] The model confidence c = [Conf cls , Conf unc , Conf dist ] combines the three kinds of confidence into an input vector c,
[0103] w = Softmax(W·ReLU(V·c))
[0104] wherein, V, W are weight matrices (linear transformation parameters) to be learned, ReLU is an activation nonlinearity, and Softmax makes the weights satisfy w1+w2+w3=1, and w1, w2, w3 are the weights of Conf cls , Conf unc , Conf dist , respectively.
[0105] Model confidence calculation method: In this embodiment, the calculation of the model confidence C fuses information in three dimensions to improve the accuracy of the confidence evaluation. Specifically, C is determined based on the following three aspects:
[0106] 1) Classification probability: the Softmax maximum probability value P_max output by the model, indicating the intuitive confidence degree of the model for the predicted pest and disease category.
[0107] 2) Prediction uncertainty: an uncertainty quantitative indicator is calculated through the prediction output of the model, for example, using Monte Carlo dropout multiple forward reasoning or the standard deviation σ based on the prediction results of the ensemble model, to measure the stability of the model's prediction for the sample. The larger the standard deviation, the higher the uncertainty and the lower the confidence.
[0108] 3) Embedding feature distance: the sample to be tested is input into the model to extract its representation vector in the embedding feature space, which is compared with the feature vectors of the known samples in the model training set to calculate the nearest neighbor distance D. The larger the distance, the higher the degree of deviation of the sample from the training data distribution (i.e. it may be a novel or abnormal sample), and the lower the confidence. After normalizing the three indicators P_max, σ and D obtained above, they are input into a dynamic weighted fusion model to calculate the final confidence C. Preferably, the fusion model can use a trained multilayer perceptron (MLP) network or a pre-set weighting formula to adaptively adjust the weights of each indicator based on historical validation data, so as to accurately evaluate the model confidence in different situations. For example, if the Softmax probability of a certain type of disease is always high, leading to overconfidence, the fusion model will appropriately reduce the weight of P_max in the comprehensive confidence, and enhance the consideration of uncertainty σ and feature distance D. Through this dynamic weight confidence fusion method, the reliability of the model's judgment for the current sample can be more comprehensively described.
[0109] In addition, in order to prevent the model from making overconfident judgments, confidence calibration and regularization measures are introduced during model training and inference. On the one hand, an entropy regularization term is added during model training to encourage the model output to maintain appropriate information entropy, thereby avoiding extreme output probabilities that lead to distorted confidence evaluations; on the other hand, temperature scaling calibration technology is applied to the output probability during model deployment and inference, i.e. introducing a temperature coefficient to stretch or compress the probability distribution during Softmax calculation (for example, setting a temperature T>1 to lower the maximum probability value and increase the entropy), so that the confidence of the model output better matches the actual accuracy. Through entropy regularization and temperature scaling, the model confidence calculation is more reliable and will not produce a high confidence score due to model overfitting or sample distribution deviation.
[0110] In another embodiment of the present application, a calibration module is further included, and the entropy regularization and temperature calibration are stored in the calibration module, wherein:
[0111] (1) The entropy value L of the entropy regularization entropy is:
[0112] is the prediction probability of the i-th class, and C is the total number of classes.
[0113] The entropy regularization further includes a loss function additional term:
[0114] L total = L task + β·L entropy
[0115] L total is the total loss function, L task is the task loss, L entropy is the entropy regularization term, and β is a weight hyperparameter.
[0116] (2) The calibration index ECE of the temperature calibration is:
[0117]
[0118] K is the number of bins into which the prediction confidence interval is divided, B k is the sample set in the k-th bin, n is the total number of samples, acc(B k ) is the average accuracy of the samples in the bin, and conf(B k ) is the average confidence of the samples in the bin.
[0119] After the model completes the diagnosis of the new sample and calculates the confidence, the present application respectively processes the sample according to the high and low of the confidence, and constructs a dynamic database update and model optimization cycle. Preferably, the model confidence is divided into three levels: high, medium and low. When the model confidence is ≥0.9, it is considered that the model is very reliable for the result judgment, and the diagnosis result of the model can be directly adopted. When the model confidence is 0.7≤C<0.9, it is considered that the model is medium reliable, and the reliability of the result is doubtful. When the model confidence is <0.7, it is considered that the model has low confidence, and the result is likely to be inaccurate or belongs to an abnormal situation that the model has not seen.
[0120] The pre-set reliability model employs the following processing strategies based on the aforementioned confidence levels: For samples with high confidence (≥0.9), the predicted pest and disease types are directly considered valid information, and the sample and its model prediction label are entered into the fruit and vegetable pest and disease spectral database and saved as new data; for samples with medium confidence (0.7–0.9), they are marked as pending review and submitted to experts for verification; for samples with low confidence (<0.7), they are marked as abnormal and submitted to experts for evaluation. This three-tiered confidence interval division allows for differentiated processing of results with varying levels of reliability, ensuring both timely utilization of highly reliable results and human intervention in unreliable results, preventing the inclusion of erroneous information in the database.
[0121] After the submission of medium- and low-confidence samples, the expert system module sends the relevant spectral data and the model's preliminary diagnostic results to a remote expert diagnostic platform via the network. Human experts with experience in plant disease and pest diagnosis then identify and label these samples. Experts review the spectral images of the samples and the model's preliminary conclusions, combining their own knowledge to judge the actual disease and pest situation and provide authoritative diagnostic labels. For medium-confidence samples, the model may be partially correct but not certain enough; experts focus on verifying easily confused features of the model, confirming and correcting labels. For low-confidence samples, the model can hardly provide meaningful judgments; experts will conduct complete human diagnoses for these potentially novel or anomalous cases. Once the experts complete the labeling, the system archives these expert-labeled sample data into an anomaly sample database. The anomaly sample database is used to specifically store cases where the model was previously uncertain or made incorrect judgments, providing targeted training data for subsequent model improvements. Furthermore, all expert-labeled samples (including medium- and low-confidence categories) are added to the main spectral database along with their correct labels and saved as new training samples. At the same time, the system also makes corresponding records for high-confidence samples that have been automatically added to the database (e.g., marking that their labels come from model predictions rather than manual input) for reference during training.
[0122] In another embodiment of this application, an incremental training module is further included, wherein the incremental training module stores the incremental training of the model, and the incremental training is triggered as follows:
[0123] Trigger = (N exp ≥N th )vee(R low >R th )vee(Δt≥T cycle )
[0124] Where, N exp : Added number of expert-annotated samples, N th Expert sample trigger threshold, Rlow : current low-confidence sample ratio, R th : low-confidence sample ratio threshold, At: time elapsed since last model training, T cycle : training time period threshold.
[0125] As time goes on, the newly added samples (including high-confidence automatically added samples and expert-annotated added samples) accumulated in the spectrum database increase continuously. In order to make the model learn these new data in time, the present application sets up a dynamic triggering mechanism for model incremental training. The triggering conditions can be set in advance, for example, when the number of newly added samples in the spectrum database reaches a certain threshold, or when the new data is checked periodically (such as every few days / weeks), the model update training is triggered once. In the incremental training process, the above-mentioned newly added expert-annotated samples and high-confidence samples are added to the model training set, and the original diagnostic model is retrained or fine-tuned online. By introducing expert-annotated data, the model can correct previous errors or uncertain recognition, and significantly improve the accuracy on the corresponding category; while adding high-confidence model prediction samples (i.e. the model's confident correct guess), it is equivalent to using the reliable data generated by the model itself to further enrich the training set, which helps to consolidate the model's grasp of existing knowledge. During the training process, methods such as entropy regularization are continued to be applied to improve the generalization ability, and after training, temperature scaling and other means are used to calibrate the confidence of the new output of the model. After completing the update training, the new model is deployed to the front-end embedded diagnostic system for subsequent field inspection and diagnosis, thus entering the next round of operation cycle. In this way, the model and the database continue to evolve: the model becomes more robust and can recognize more diverse pest and disease spectra; the spectrum database also expands new instances, covering more comprehensive pest and disease spectral features. The whole system forms a closed loop through the model confidence feedback mechanism, and learns and improves in practical application autonomously, significantly improving the efficiency and accuracy of fruit and vegetable pest and disease diagnosis.
[0126] In summary, the present application establishes a data update and model optimization mechanism for experts and models to work together by introducing model confidence fusion calculation and hierarchical processing in the diagnosis process. This method effectively prevents the accumulation of misjudgments caused by model overconfidence, ensuring that only high-reliability results are automatically entered into the database, and uncertain results are all corrected by experts. With the help of expert annotation feedback and model incremental self-learning, the present application realizes the dynamic evolution and update of the fruit and vegetable pest and disease spectrum database, as well as the continuous optimization and upgrading of the diagnosis model, which is of great significance for ensuring the accuracy and adaptability of pest and disease identification in agricultural production.
[0127] The above-described embodiments only express the device arrangement manner of the present application, the description is more specific and detailed, but it cannot be understood as the limitation of the patent application scope; it should be pointed out that for ordinary skilled in the art, under the premise of not departing from the concept of the present application, a number of adjustments and improvements can be made, which belong to the protection scope of the present application; therefore, the protection scope of the present application patent should be subject to the appended claims.
Claims
1. A fruit and vegetable disease and pest detection method based on a spectral database and model confidence, characterized by, The method comprises the following steps: Step S10. Obtain spectral data of the fruit and vegetable crops; Step S20. Output the disease and pest diagnosis result and the corresponding model confidence based on the disease and pest diagnosis model; Step S30. Determine whether the model confidence corresponding to the disease and pest diagnosis result is within the preset range based on the preset confidence model, and output the diagnosis result and the corresponding reliability. 2.The method of claim 1, wherein, Step S10. Obtain spectral data of the fruit and vegetable crops, comprising the following steps: Step S11. Obtain a multispectral image of the fruit and vegetable crops; Step S12. Perform pre-processing on the image by using a pre-processing module to output the spectral data. 3.The method of claim 1, wherein, Step S30. Determine whether the model confidence corresponding to the disease and pest diagnosis result is within the preset range based on the preset confidence model, and output the diagnosis result and the corresponding reliability, further comprising the following steps: Step S31. Obtain the disease and pest diagnosis result and the corresponding model confidence; Step S32. Determine whether the model confidence corresponding to the disease and pest diagnosis result is not less than a high threshold of the model confidence based on the preset confidence model: If yes, output the diagnosis result and the corresponding high model confidence; If no, output the model confidence corresponding to the disease and pest diagnosis result to the expert system module. 4.The method of claim 3, wherein, In step S32, if no, output the model confidence corresponding to the disease and pest diagnosis result to the expert system module, further comprising the following steps: Step S33. Obtain the model confidence corresponding to the disease and pest diagnosis result, and the model confidence is less than the high threshold of the model confidence; Step S34. Determine whether the model confidence corresponding to the disease and pest diagnosis result is not less than a low threshold of the model confidence based on the expert system module: If yes, identify and confirm the diagnosis result and the corresponding model confidence by an expert, correct the diagnosis result, and output the corrected diagnosis result; If no, identify the diagnosis result and the corresponding model confidence by an expert, and output the correct diagnosis result. 5.The method of claim 1, wherein, The model confidence is Conf total , and the model confidence Conf total is derived from a classification probability confidence Conf cls , a prediction uncertainty confidence Conf unc , and an embedding distance confidence Conf dist weighted. 6.The method of detecting fruit and vegetable diseases and insect pests based on a spectrum database and model confidence according to claim 5, characterized in that, the classification probability confidence wherein, represents the predicted probability of the model for the i-th class, z i represents the logit value of the last layer of the model, C represents the total number of classes, T is a temperature parameter, and T > 0.
7. The method for detecting diseases and pests of fruits and vegetables based on a spectral database and model confidence according to claim 6, characterized in that, The prediction uncertainty confidence Conf unc = exp(-λσ 2 ); wherein, is the average of all M predictions, M is the forward order, p (1) ,…,p (M) is the probability of the corresponding M group, σ is the standard deviation, and λ is a hyperparameter that controls the decay speed. 8.The method of claim 5, wherein, The embedding distance confidence Conf dist = exp(-γD M (x)) Wherein, γ is a scaling hyperparameter, f(x) is an embedding representation of an input sample in a feature space, μ is a feature center (mean) of a certain class of a training set, T is a temperature parameter, Σ is a covariance matrix of features, and D is a Mahalanobis distance, which measures the standardized distance between a sample and a class center. 9.The method of claim 5, wherein, The model confidence c = [Conf cls ,Conf unc ,Conf dist ] combines the three confidences into an input vector c, w=Softmax(W·ReLU(V·c)) wherein V, W are weight matrices (linear transformation parameters) to be learned, ReLU is an activation nonlinearity, Softmax makes weights satisfy wl + w2 + w3 = 1, wl, w2, w3 are weights of Conf cls , Conf unc , Conf dist , respectively.
Citation Information
Patent Citations
Fruit and vegetable video pest detection method based on deep learning and big data technology
CN118570696A
Cited By
Planetary surface scientific interest target intelligent sampling method and system
CN121561625A
Intelligent sampling method and system for scientific interest targets on planetary surfaces
CN121561625B
