Cherry infection nondestructive testing method based on two-stage wave band selection and multi-model integration

By adopting two-stage band selection and multi-model integration methods in early cherry rot detection, the problem of insufficient detection sensitivity and accuracy in the prior art is solved, high-precision non-destructive testing is achieved, and the quality and yield of cherries are improved.

CN119757238APending Publication Date: 2025-04-04NANJING FORESTRY UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411965874.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The prior art lacks the fusion of multiple features in early cherry rot detection, resulting in insufficient detection sensitivity and accuracy.

Method used

Using a method based on two-stage band selection and multi-model integration, data is collected through hyperspectral imaging technology, calibration and feature extraction are carried out, full-wavelength discriminant model is constructed, and the model fusion is carried out using soft voting method and stacking method.

Benefits of technology

It significantly improves the sensitivity and accuracy of early cherry decay detection, and can accurately distinguish cherries of different degrees of rot without destroying the surface, provide timely disease warning, reduce disease spread, and improve cherry quality and yield.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119757238A_ABST
    Figure CN119757238A_ABST
Patent Text Reader

Abstract

The invention discloses a cherry infection nondestructive testing method based on dual-stage wave band selection and multi-model integration. The method comprises the following steps: (1) collecting hyperspectral imaging data according to an infection stage; (2) calibrating the hyperspectral imaging data; (3) extracting selection and spectral information of the region of interest; (4) adopting a multiple scatter correction (MSC) method, eliminating the spectral intensity difference among the samples by correcting the multiple scattering effect among the samples, and dividing a sample set; (5) constructing a full-wavelength discrimination model; (6) carrying out dual-stage characteristic wavelength screening and constructing a characteristic wavelength discrimination model; (7) fusing the model by adopting two integration strategies of a soft voting method and a stacking method; the method not only has high detection precision and fast processing speed, but also can be effectively applied to automatic monitoring of large-scale orchards, and provides innovative technical support for agricultural production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of nondestructive detection of agricultural products, and in particular to a nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration. Background Art

[0002] Cherries are perishable fruits, which are often easily affected by environmental factors such as temperature and humidity during post-harvest transportation, resulting in deterioration of fruit quality. Cherry rot, especially early rot, is often difficult to detect in time with traditional inspection methods. Early rot not only affects the appearance and taste of the fruit, but also leads to a significant decrease in the nutritional content and shelf life of the fruit, resulting in economic losses. Therefore, how to achieve rapid, accurate and non-destructive detection of early rot in cherries has become a key issue in improving the level of post-harvest management of cherries, ensuring product quality and extending the shelf life.

[0003] Hyperspectral imaging technology is a detection method that obtains spectral information in different bands to analyze materials. It can accurately reflect the physical and chemical properties of objects by recording the reflection spectrum of objects in the visible light and near-infrared spectrum. In recent years, with the development of technology, hyperspectral imaging technology has shown great advantages in non-destructive testing of agricultural products, especially in fruit quality assessment, disease identification and maturity detection.

[0004] Compared with traditional detection technologies, such as manual cutting or visual inspection, hyperspectral imaging technology can not only obtain high-precision image data in real time and non-destructively, but also can be used for detection in a variety of environments, with the characteristics of high efficiency, speed, and non-contact. In the early rot detection of cherries, hyperspectral images can identify the early signs of rotten fruit through detailed analysis of spectra in different bands, and can even accurately locate the rotten parts. Therefore, the use of hyperspectral imaging technology for early rot detection in cherries has important practical significance.

[0005] Existing studies have shown that the application of hyperspectral imaging technology in non-destructive testing of agricultural products has made some progress. Many studies have shown that hyperspectral technology can effectively detect internal and external quality problems of fruits such as cherries, such as rot, disease, maturity, etc., with high accuracy and sensitivity. However, most existing studies focus on the analysis of a single feature and lack research on the fusion of multiple features. Summary of the invention

[0006] Purpose of the invention: The purpose of the present invention is to provide a nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration, which can improve the limitations of existing single feature analysis and further improve the sensitivity and accuracy of detection.

[0007] Technical solution: The present invention discloses a nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration, comprising the following steps:

[0008] (1) Collect hyperspectral imaging data according to the infection stage;

[0009] (2) Calibrate hyperspectral imaging data;

[0010] (3) extracting the selection and spectral information of the region of interest;

[0011] (4) The multivariate scatter correction (MSC) method is used to improve data consistency by correcting the multiple scattering effect between samples, eliminating the spectral intensity differences between samples, and dividing the sample sets;

[0012] (5) Construct a full-wavelength discrimination model;

[0013] (6) Performing dual-stage characteristic wavelength screening and constructing a characteristic wavelength discrimination model;

[0014] (7) Two integration strategies, soft voting and stacking, are used to fuse the models.

[0015] Furthermore, in step (1), cherry fruits of similar size, maturity and shape were selected, and cherry fruits without surface bruises, diseases or contamination were checked, washed, sterilized, dried, and stemmed, and stored at 20°C and 90% RH for 144 h after inoculation to produce rot spots with a diameter of about 1-10 mm, and hyperspectral imaging data were collected according to the infection stage.

[0016] Furthermore, in step (2), a hyperspectral image of the visible-near infrared band is collected, and each sample is imaged in a total of λ bands, and the λ value is set to 256; in order to obtain a clear image outline, the image resolution is set to 696×520 pixels. After the acquisition is completed, a 696×520×256 pixel three-dimensional data image is formed; the data is corrected using the following correction formula:

[0017]

[0018] Among them, I c is the corrected hyperspectral image data; I r is the hyperspectral image data before correction; I std is the calibrated hyperspectral image data of the calibration plate; I s is the reflectivity parameter of the calibration plate.

[0019] Furthermore, in step (3), the cherry fruit photographed in the sample is used as the region of interest (ROI), and the size of each data sample is 120×120 pixels. ENVI and MATLAB software are used to perform ROI identification, background subtraction, and spectral data extraction. All pixels within the ROI range are averaged to obtain the average spectrum of the cherry fruit, and the wavelength range below 400 nm and above 1000 nm is removed, retaining a total of 231 bands.

[0020] Furthermore, in step (4), the details are as follows: select the two bands of 819.49nm and 420.16nm for differential operation to suppress background noise. The differential formula is as follows:

[0021] △I=I 819.49nm -I 420.16nm

[0022] Among them, I 819.49nm is the reflection value of 819.49nm band, I 420.16nm It is the reflection value of 420.16nm band;

[0023] In the △I obtained by differential operation, the pixels with reflectance values ​​less than 0.12 are removed as a mask; the original hyperspectral image is multiplied pixel by pixel by the mask, and the pixels with a mask value of 1 are retained, that is, the cherry fruit area; for the area with a mask value of 0, the background information is removed. The mathematical formula of the mask process is as follows:

[0024] I ROI =I c ×M △I

[0025] Among them, I ROI I is the image of the region of interest after removing the background. c is the original corrected hyperspectral image, M △I It is a mask matrix. The area with mask value 1 is retained, and the area with value 0 is removed.

[0026] Furthermore, step (5) is as follows: construct a discriminant model based on full-wavelength spectral data: select six machine learning algorithms, namely support vector machine classification SVC, logistic regression LR, multi-layer perceptron MLP, lightweight gradient boosting machine LightGBM, k-nearest neighbor algorithm KNN, and adaptive enhancement AdaBoost, to train and evaluate the full-wavelength spectral classification model respectively; each algorithm is trained and tested using a ten-fold cross-validation method, and the performance indicators of each model are calculated; by comparing the performance of different models, the best model suitable for full-wavelength data is preliminarily selected for further optimization and comparison.

[0027] Further, step (6) includes the following steps:

[0028] (61) Use RFE to eliminate the least important features and obtain a feature subset: First, initialize and set parameters; second, select i features from the current feature set for training; use the model to train the current feature subset, calculate the importance of each feature, and build an SVC discriminant model based on the extracted feature wavelength; the importance of the feature is measured by the weight of the model; finally, sort the features according to their importance, delete the Ni least important features, update the feature subset, and retain the most important features for the next round of training; train the model with the selected feature subset, and use cross-validation to evaluate the model accuracy;

[0029] (62) Using CARS and based on the output of the RFE stage, the weights of the features are further adjusted to select more important features through a weighted mechanism:

[0030] Furthermore, step (7) is specifically as follows: two integration strategies, namely soft voting and stacking, are used to fuse the models, and the prediction results of multiple base learners are combined, including the following steps:

[0031] (71) Constructing base learners, including logistic regression, support vector machine classification SVC, and multi-layer perceptron MLP;

[0032] (72) Using soft voting method to combine base learners to predict results;

[0033] (73) The stacking method is used to train the meta-learner and make the final prediction results.

[0034] An electronic device described in the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements any one of the above when loaded into the processor.

[0035] A storage medium described in the present invention stores a computer program, and when the computer program is executed by a processor, any one of the above is implemented.

[0036] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: by collecting hyperspectral images of four groups of cherry samples with different corruption degrees in the visible-near infrared band (400-1000nm), six full-wavelength spectral classification models were established, and the effect of full-band data on the discrimination of cherry corruption degree was explored. On this basis, a two-stage recursive feature elimination (RFE) and competitive adaptive reweighted sampling (CARS) method were used to extract key wavelengths, and a characteristic wavelength classification model (such as RFE+CARS-SVC) was constructed, which significantly reduced the data dimension and improved the computational efficiency of the model. In addition, multiple classification models were fused by soft voting and stacking integration strategy, which further improved the stability and prediction performance of the discrimination model. This method can accurately distinguish cherries with different corruption degrees without destroying the cherry surface, provide timely disease warning, reduce the spread of diseases, and thus improve the quality and yield of cherries. The experimental results show that the invention not only has high detection accuracy and fast processing speed, but also can be effectively applied to the automated monitoring of large-scale orchards, providing innovative technical support for agricultural production. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a flow chart of the present invention;

[0038] Figure 2 is the average intensity and reflectivity of the present invention; wherein (a) the average intensity of the healthy area and the decayed area in the 400-1000nm band before correction, (b) the reflectivity of the healthy area and the decayed area in the 400-1000nm band after correction;

[0039] Figure 3 The reflectance spectra of all samples of four groups of cherry fruits infected to different degrees (healthy group HG, asymptomatic group AG, early infection group IG, late infection group AIG) of the present invention;

[0040] Figure 4 The reflectance spectrum range and average spectrum before correction of four groups of cherry fruits infected to different degrees (healthy group HG, asymptomatic group AG, early infection group IG, late infection group AIG) of the present invention;

[0041] Figure 5 It is the average spectrum of four groups of cherry fruits infected to different degrees (healthy group HG, asymptomatic group AG, early infection group IG, late infection group AIG) of the present invention;

[0042] Figure 6 The present invention is used to compare the classification performance of four characteristic wavelength screening methods under different characteristic wavelength numbers

[0043] Figure 7The classification performance under the optimal number of characteristic wavelengths of the RFE+CARS of the present invention and the four characteristic wavelength screening methods for comparison and the optimal number of characteristic wavelengths of the different characteristic wavelength screening methods;

[0044] Figure 8 The classification performance under the optimal number of characteristic wavelengths of the RFE+CARS of the present invention and the four characteristic wavelength screening methods used for comparison;

[0045] Fig. 9 It is a comparison of the results of the single classification model and the integrated classification model of the present invention (full wavelength) and a comparison of the results of the single classification model and the integrated classification model (RFE+CARS). DETAILED DESCRIPTION

[0046] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0047] like Figure 1 As shown, the embodiment of the present invention provides a nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration, comprising the following steps:

[0048] (1) Hyperspectral imaging data were collected according to the infection stage; specifically as follows: cherry fruits of similar size, maturity and shape were selected, and no surface bruises, diseases or contamination were checked. They were washed with distilled water, sterilized with sodium chloride solution (1%) for 3 minutes, dried naturally, and the fruit stalks were removed. They were numbered and divided into two groups (control group and infection group); for the infection group, samples that were naturally rotten due to fungal infection were obtained, and the rotten sample tissue was used as a culture medium to culture fungal spores, and the fungal spores were dissolved in water to form a fungal spore solution, which was inoculated into each cherry fruit using a syringe. About 10uL of the solution was injected into each sample at a depth of 3mm. The infected samples were stored at 20℃ and 85%RH to produce rotten spots with a diameter of about 1-10mm.

[0049] (2) Calibration of hyperspectral imaging data; as follows: Four groups of cherries with different infection degrees were measured, namely the healthy group (HG), the asymptomatic group (AG), the early infection group (IG), and the late infection group (AIG). The front and back sides were measured, and a total of 490×4 hyperspectral image data samples were measured. The visible near-infrared hyperspectral imaging system has a band range of 400-1000nm, and is composed of a dark box, a lifting platform / imaging spectrometer (SOC710VP, USA), four 75W halogen tungsten lamps, and a computer. The spectral range is from 400nm to 1000nm, and imaging is performed on 256 bands; after multiple adjustments, the distance from the sample surface to the hyperspectral lens is 52cm, and the integration time is set to 60ms. In order to capture a clear shape, the image resolution is set to 696×520 pixels, and a 696×520×256 three-dimensional image is obtained after the acquisition.

[0050] Hyperspectral images of visible-near infrared bands were collected. Each sample was imaged in a total of λ bands, and the λ value was set to 256. In order to obtain a clear image outline, the image resolution was set to 696×520 pixels. After the acquisition was completed, a 696×520×256 pixel three-dimensional data image was formed. The data was corrected using the following correction formula:

[0051]

[0052] Among them, I c is the corrected hyperspectral image data; I r is the hyperspectral image data before correction; I std is the calibrated hyperspectral image data of the calibration plate; I s is the reflectivity parameter of the calibration plate.

[0053] (3) Selection and spectral information extraction of the region of interest; the cherry fruit photographed in the sample was used as the region of interest (ROI), and the size of each data sample was 120 × 120 pixels. ENVI and MATLAB software were used for ROI identification, background subtraction, and spectral data extraction. All pixels within the ROI range were averaged to obtain the average spectrum of the cherry fruit. The wavelength range below 400 nm and above 1000 nm was removed, and a total of 231 bands were retained.

[0054] (4) The multivariate scattering correction (MSC) method is used to improve data consistency by correcting the multiple scattering effect between samples, eliminating the spectral intensity difference between samples, and dividing the sample set; the two bands of 819.49 nm and 420.16 nm are selected for differential operation to suppress background noise. The differential formula is as follows:

[0055] △I=I 819.49nm -I 420.16nm

[0056] Among them, I 819.49nm is the reflection value of 819.49nm band, I 420.16nm It is the reflection value of 420.16nm band;

[0057] In the △I obtained by differential operation, the pixels with reflectance values ​​less than 0.12 are removed as a mask; the original hyperspectral image is multiplied pixel by pixel by the mask, and the pixels with a mask value of 1 are retained, that is, the cherry fruit area; for the area with a mask value of 0, the background information is removed. The mathematical formula of the mask process is as follows:

[0058] I ROI =I c ×M △I

[0059] Among them, I ROI I is the image of the region of interest after removing the background. c is the original corrected hyperspectral image, M △I It is a mask matrix. The area with mask value 1 is retained, and the area with value 0 is removed.

[0060] (5) Construct a full-wavelength discrimination model; the details are as follows: Construct a discrimination model based on full-wavelength spectral data: select six machine learning algorithms, including support vector machine classification SVC, logistic regression LR, multi-layer perceptron MLP, lightweight gradient boosting machine LightGBM, k-nearest neighbor algorithm KNN, and adaptive enhancement AdaBoost, to train and evaluate the full-wavelength spectral classification model respectively; each algorithm is trained and tested using a ten-fold cross-validation method, and the performance indicators of each model are calculated; by comparing the performance of different models, the best model suitable for full-wavelength data is preliminarily selected for further optimization and comparison.

[0061] (6) Performing dual-stage characteristic wavelength screening and constructing a characteristic wavelength discrimination model; comprising the following steps:

[0062] (61) Use RFE to eliminate the least important features and obtain the feature subset: First, initialize and set the parameters: select a support vector classifier SVC (kernel = 'linear') as the evaluator for feature selection, and the decision function f SVC(x) is as follows: Set the range of the number of features to be selected, from 1 to N (i.e., the total number of features). In each round of iteration, i features will be selected, i∈{1,2,...,N}, indicating the number of features selected in each round of iteration; set the accuracy of cross-validation as the evaluation indicator, and the goal is to make the model accuracy of the feature subset selected in each round reach the accuracy of the full-wavelength model (i.e., the accuracy when all features are used); for each round of feature selection, calculate the accuracy of the selected feature set through cross-validation and compare it with the accuracy of the full-feature model. If the accuracy of a feature subset selected at a certain time is greater than or equal to the accuracy of the full-feature model, then record the feature subset.

[0063] Secondly, select i features from the current feature set for training; use the model to train the current feature subset, calculate the importance of each feature, and build an SVC discriminant model based on the extracted feature wavelength; the importance of the feature is measured by the weight of the model; the formula is as follows:

[0064]

[0065] Among them, f SVC (x) is the predicted value of the model; w k is a weight vector, which indicates the importance of each feature in classification; b is a bias term, which indicates the distance between the decision hyperplane and the origin; d is the dimension of the feature space, which is usually the total number of features N;

[0066] Finally, we sort the features by importance, delete the least important features Ni, update the feature subset, and keep the most important features for the next round of training. We train the model with the selected feature subset and use cross-validation to evaluate the model accuracy. The specific process is as follows:

[0067] Recursive feature elimination process: For each iteration, select i features from the current feature set for training; use the model to train the current feature subset and calculate the importance of each feature. The importance of the feature is measured by the weight of the model. The weight formula is as follows, and the SVC discriminant model is constructed based on the extracted feature wavelength.

[0068] I k =|w k

[0069] Among them, I k is the importance of feature k; w k is the weight coefficient associated with feature k.

[0070] Delete unimportant features: Sort by feature importance, delete the Ni least important features, update the feature subset, and retain the most important features for the next round of training.

[0071] Training and evaluation: Use the selected feature subset to train the model and use cross-validation to evaluate the model accuracy. If the accuracy of this subset is greater than or equal to the accuracy of the full feature model, the feature subset is recorded. If the accuracy exceeds the accuracy of the full feature model for a cumulative number of times that reaches a set threshold (set to 10 times), the RFE is stopped.

[0072] (62) Using CARS and based on the output of the RFE stage, the weights of the features are further adjusted to select more important features through a weighted mechanism. The specific process is as follows:

[0073] Initialization and input: The input of CARS is the feature set selected by RFE in the first stage. The size of the feature subset is set to range from 1 to the maximum feature set size selected by RFE.

[0074] Weighted adjustment: Initially, the weight w of each feature k Set to a uniform value; in order to ensure that the weight is adaptive, CARS uses a sigmoid function to update the weight of the feature. The specific formula is as follows:

[0075]

[0076] Among them, w k is the weight of feature k; f k is the SVC classification model score for feature k.

[0077] Feature selection: Based on the weight of the feature, select the features with higher weight. In each round of iteration, adjust the feature weight, select important features, and remove low-weight features.

[0078] Training and evaluation: Train the model with the selected feature subset and use cross-validation to evaluate the model accuracy. Record the selected features and evaluation results in each round.

[0079] (7) Two integration strategies, soft voting and stacking, are used to fuse the models.

[0080] Furthermore, in step (1), cherry fruits of similar size, maturity and shape were selected, and cherry fruits without surface bruises, diseases or contamination were checked, washed, sterilized, dried, and stemmed, and stored at 20°C and 90% RH for 144 h after inoculation to produce rot spots with a diameter of about 1-10 mm, and hyperspectral imaging data were collected according to the infection stage.

[0081] Further, step (2), further, step (3), further, further, step (5)

[0082] Further, step (6) and step (7) are specifically as follows: the model is fused by using two integration strategies, namely, soft voting method and stacking method, to combine the prediction results of multiple base learners, including the following steps:

[0083] (71) Construct a base learner, including logistic regression, support vector machine classification SVC, and multi-layer perceptron MLP. The logistic regression parameters are set as follows: random_state = 42 to ensure that the randomness of the model is reproducible; max_iter = 1000 to set the maximum number of iterations to prevent convergence problems on some more complex data sets.

[0084] Support Vector Machine Classify (SVC), the parameter settings are as follows: probability = True, so that the SVM model can output the predicted probability of each category instead of directly outputting the category label; kernel = 'linear', using the linear kernel function for classification, which is suitable for linearly separable data.

[0085] Multi-Layer Perceptron (MLP), parameter settings are as follows: random_state = 42, to ensure that the randomness of the model is reproducible; max_iter = 1000, to set the maximum number of iterations to prevent convergence problems on some more complex data sets.

[0086] (72) Use soft voting to combine the prediction results of the base learners; the specific process is as follows: put the above base learners into a VotingClassifier. By setting voting = 'soft', the model will perform weighted voting based on the prediction probability of each classifier, rather than directly performing hard voting based on the category of each classifier. The soft voting method selects the category with the highest probability as the final prediction result. The decision rule of soft voting can be expressed as follows.

[0087]

[0088] in, is the final predicted category, p k (y|x) is the predicted probability of the kth base learner for category y, α k is the weight of the kth base learner, Indicates that the category with the largest sum of predicted probabilities is selected.

[0089] (73) The stacking method trains the meta-learner and makes the final prediction result. The specific process is as follows: First, the base learner is trained on the training data and generates a prediction result for each sample. The prediction result of each base learner k on sample x is The formula is described as follows;

[0090]

[0091] Next, the prediction results of these base learners are As a new feature, it is input into the meta-learner for training. The meta-learner uses a linear kernel SVM classifier (SVC (kernel = 'linear')), and finally the meta-learner gives the final prediction category The decision rule of the stacking method can be expressed as follows.

[0092]

[0093] The accuracy of cherry decay degree discrimination based on full wavelength is shown in Table 1. SVC, LR and MLP have the best classification performance, with accuracy rates of 99.74%, 99.03% and 99.44%, respectively. In contrast, the accuracy of LightGBM is 92.45%, while KNN and AdaBoost are 67.09% and 61.48%, respectively. The reasons for the analysis are as follows: SVC can effectively identify the classification boundary of linearly separable data by maximizing the hyperplane of the classification interval; LR, as a linear classifier, can fit the classification boundary well when the data is linearly separable; MLP shallow neural network can effectively fit and avoid overfitting on simple linear data, and its performance is close to the best; in terms of model complexity and generalization ability, simple models (such as SVC, LR, MLP) can effectively fit linear data and have strong generalization ability; while complex models (such as LightGBM and AdaBoost) are prone to overfitting or redundant decisions when processing linear data, resulting in performance degradation. Although KNN is a simple model, its generalization ability depends on the global sample distribution and performs poorly on low-dimensional linear problems.

[0094] Table 1 Accuracy of cherry decay degree judgment based on full wavelength

[0095]

[0096]

[0097] The characteristic wavelengths and full wavelengths and classification accuracy based on RFE+CARS dual-stage, RFE, SPA, CARS, and PSO screening are shown in Table 2 and Figure 7 , Figure 8 Among the above methods,

[0098] A.RFE+CARS (dual-stage screening): combines the feature optimization capability of RFE and the rapid screening capability of CARS, and performs well in screening key wavelengths and reducing dimensions.

[0099] B.RFE (Recursive Feature Elimination): It can effectively remove redundant features and select the wavelength that contributes most to the classification result through iterative optimization. If the initial feature dimension is too high, the optimization process may be slow.

[0100] C. SPA (Continuous Projection Algorithm): The algorithm is simple, efficient, and suitable for fast feature screening. The accuracy is low, and the screened features may not be sufficient to support high-quality classification.

[0101] D.PSO and CARS: The learning curve is not smooth enough and fluctuations may affect the stability of the model.

[0102] E. Full wavelength: uses complete spectral data, has the largest amount of information, and can theoretically capture all potential features. It is easily disturbed by noise and redundant features, which may lead to overfitting.

[0103] In summary, RFE+CARS is the optimal method, which combines the efficiency and accuracy of feature screening, and balances the number of characteristic wavelengths and classification performance. The spectral bands most sensitive to cherry infection are analyzed as follows:

[0104] A. The number of bands is concentrated in the range of 400-500nm, accounting for more than 40% of the total number of sensitive bands. Common bands include 440.1211nm, 455.1336nm, and 472.699nm, which are related to the characteristic absorption of pigments and chemical components in the visible light range, such as carotenoids and chlorophyll.

[0105] B. The number of bands is the second largest, concentrated in the 700-1000nm area, especially between 700-800nm ​​and 900-1000nm. Common bands such as 913.3804nm, 992.2056nm, and 997.6765nm may be related to the absorption of water, tissue structure, and other molecular characteristics.

[0106] C. Sparsity of key bands: Although there are a small number of sensitive bands in the 700-800nm ​​range (such as 777.0344nm, 763.8235nm), the number is significantly less than that at the two ends.

[0107] Table 2 Characteristic wavelengths and classification accuracy of different methods

[0108]

[0109]

[0110] The accuracy comparison between single classifier and integrated classifier is shown in Table 3 and Fig. 9 As shown. Under the RFE-CARS wavelength screening condition, the classifier stacking strategy - integrated model (Stacking) performed best, with an accuracy (ACC) of 99.80%. This method effectively screened out key features of only 36 wavelengths (15.58%) while maintaining an extremely high accuracy (only a slight decrease of 0.05% from 99.85% of the full wavelength), significantly reducing the number of features compared to the 231 wavelengths of the full wavelength data.

[0111] The results show that ensemble learning is a potentially effective approach that can significantly improve the performance and robustness of machine learning models by combining the strengths of multiple individual classifiers.

[0112] Table 3 Comparison of accuracy of single classification and integrated classification models

[0113]

[0114]

Claims

1. A nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration, characterized in that: The following steps are involved: (1) Collect hyperspectral imaging data according to the infection stage; (2) Calibrate hyperspectral imaging data; (3) extracting the selection and spectral information of the region of interest; (4) The multivariate scatter correction (MSC) method is used to correct the multiple scattering effects between samples, eliminate the spectral intensity differences between samples, and divide the sample sets; (5) Construct a full-wavelength discrimination model; (6) Performing dual-stage characteristic wavelength screening and constructing a characteristic wavelength discrimination model; (7) Two integration strategies, soft voting and stacking, are used to fuse the models.

2. A nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: In step (1), cherry fruits of similar size, maturity and shape are selected, and cherry fruits without surface bruises, diseases or contamination are checked. They are washed, sterilized, dried, and stemmed. After inoculation, they are stored at 20°C and 90% RH for 144 hours to produce rot spots with a diameter of about 1-10 mm. Hyperspectral imaging data are collected according to the infection stage.

3. The nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: In step (2), a hyperspectral image of the visible-near infrared band is collected. Each sample is imaged in a total of λ bands, and the λ value is set to 256. In order to obtain a clear image outline, the image resolution is set to 696×520 pixels. After the acquisition is completed, a 696×520×256 pixel three-dimensional data image is formed. The data is corrected using the following correction formula: Among them, I c is the corrected hyperspectral image data; I r is the hyperspectral image data before correction; I std is the calibrated hyperspectral image data of the calibration plate; I s is the reflectivity parameter of the calibration plate.

4. The nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: In step (3), the cherry fruit photographed in the sample is used as the region of interest (ROI), and the size of each data sample is 120×120 pixels. ENVI and MATLAB software are used to perform ROI identification, background subtraction, and spectral data extraction. All pixels within the ROI range are averaged to obtain the average spectrum of the cherry fruit, and the wavelength range below 400nm and above 1000nm is removed, retaining a total of 231 bands.

5. The nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: In step (4), the details are as follows: select the two bands of 819.49nm and 420.16nm for differential operation to suppress background noise. The differential formula is as follows: △I=I 819.49nm -I 420.16nm Among them, I 819.49nm is the reflection value of 819.49nm band, I 420.16nm It is the reflection value of 420.16nm band; In the △I obtained by differential operation, the pixels with reflectance values ​​less than 0.12 are removed as a mask; the original hyperspectral image is multiplied pixel by pixel by the mask, and the pixels with a mask value of 1 are retained, that is, the cherry fruit area; for the area with a mask value of 0, the background information is removed. The mathematical formula of the mask process is as follows: I ROI =I c ×M △I Among them, I ROI I is the image of the region of interest after removing the background. c is the original corrected hyperspectral image, M △I It is a mask matrix. The area with mask value 1 is retained, and the area with value 0 is removed.

6. The nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: Step (5) is as follows: Construct a discriminant model based on full-wavelength spectral data: select six machine learning algorithms, including support vector machine classification SVC, logistic regression LR, multi-layer perceptron MLP, lightweight gradient boosting machine LightGBM, k-nearest neighbor algorithm KNN, and adaptive enhancement AdaBoost, to train and evaluate the full-wavelength spectral classification model respectively; each algorithm is trained and tested using a ten-fold cross-validation method, and the performance indicators of each model are calculated; by comparing the performance of different models, the best model suitable for full-wavelength data is preliminarily selected for further optimization and comparison.

7. The nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: Step (6) comprises the following steps: (61) Use RFE to eliminate the least important features and obtain a feature subset: First, initialize and set parameters; second, select i features from the current feature set for training; use the model to train the current feature subset, calculate the importance of each feature, and build an SVC discriminant model based on the extracted feature wavelength; the importance of the feature is measured by the weight of the model; finally, sort the features according to their importance, delete the Ni least important features, update the feature subset, and retain the most important features for the next round of training; train the model with the selected feature subset, and use cross-validation to evaluate the model accuracy; (62) CARS is used to further adjust the weights of features based on the output of the RFE stage, and more important features are screened out through a weighted mechanism.

8. The nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to claim 1, characterized in that: Step (7) is as follows: two integration strategies, soft voting and stacking, are used to fuse the models and combine the prediction results of multiple base learners, including the following steps: (71) Constructing base learners, including logistic regression, support vector machine classification SVC, and multi-layer perceptron MLP; (72) Using soft voting method to combine base learners to predict results; (73) The stacking method is used to train the meta-learner and make the final prediction results.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is loaded into a processor, a nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to any one of claims 1 to 8 is implemented.

10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, a nondestructive detection method for cherry infection based on dual-stage band selection and multi-model integration according to any one of claims 1 to 8 is implemented.