Nondestructive testing method for content of vitamin C in Hongmeiren oranges
Through spectral characteristic wavelength screening and artificial neural network regression model, combined with unsupervised and supervised random forest multi-engine algorithm, high-precision non-destructive detection of vitamin C content in red beauty citrus is achieved, and the problem of low prediction accuracy in the existing technology is solved. Significantly improves detection accuracy.
Patent Information
- Application Number
- CN202411176036.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-13
AI Technical Summary
The existing technology is difficult to achieve high-precision non-destructive testing of the vitamin C content of red beauty citrus. It is mainly due to the low vitamin C content, which makes the model unable to effectively learn the complex mapping between the spectrum and vitamin C, and the prediction accuracy is low.
Through layered spectral feature wavelength screening, combined with unsupervised and supervised random forest multi-engine algorithms, the characteristic wavelength data set is integrated, and the artificial neural network regression model is constructed, and cross-validation and hyperparameter optimization are used to achieve the vitamin C content of Red Beauty Citrus. High-precision non-destructive testing.
The prediction accuracy of the vitamin C content of Red Beauty Citrus was significantly improved, with R2 of 0.902 and RMSE of 2.466, which was better than the traditional method, and solved the problem of low model learning efficiency and insufficient accuracy improvement effect.
Smart Images

Figure CN119125039A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a fruit spectrum nondestructive detection method, in particular to a red beauty citrus vitamin C content nondestructive detection method, belonging to the technical field of fruit and vegetable quality detection. Background Art
[0002] Red Beauty mandarin is a representative variety of hybrid citrus, which is favored by consumers for its plump fruit, rich juice and sweet and sour taste. In addition, the quality and nutritional value of Red Beauty mandarin determines the business decision of producers and the purchasing trend of consumers, and one of the most important indicators to measure the quality and nutritional value of Red Beauty mandarin is vitamin C. Red Beauty mandarin is rich in vitamin C and has important nutritional value. Vitamin C is an important nutrient for the human body, with important active functions such as anti-aging, immunity enhancement and anti-inflammatory. Traditional methods for measuring vitamin C content, such as indicator titration and spectrophotometry, require the destruction of samples, which consumes a lot of time and manpower and causes food waste. Visible near-visible near-infrared spectroscopy has attracted widespread attention in agricultural product quality testing because of its non-destructive, rapid, accurate and low-cost nature. The collected visible near-visible near-infrared spectrum covers the 450nm to 2500nm band, including the vibration energy of many molecular groups of chemical components such as OH, CH, CO, etc. Therefore, by collecting visible-near infrared spectral data of Red Beauty citrus, the differences in its internal chemical composition can be reflected, and combined with the quantitative regression model, the vitamin C content of Red Beauty citrus can be non-destructively predicted.
[0003] Quantitative regression modeling aims to establish the relationship between spectrum and fruit quality, so as to construct a regression model of fruit quality and realize quantitative prediction of its quality. At present, unlike the sugar content of citrus, it is difficult to achieve effective regression prediction of the visible near-infrared spectrum of vitamin C content in Red Beauty citrus, resulting in low accuracy of non-destructive testing. The main difficulty lies in the fact that the vitamin C content of Red Beauty citrus accounts for only less than 1% of the total mass of the fruit. The content is low, and the model cannot effectively learn the complex mapping between the spectral data of Red Beauty citrus and vitamin C, so that the prediction accuracy is low and cannot be effectively used in production practice. Layer-by-layer spectral wavelength screening can effectively select the most important features for model accuracy prediction. By extracting these characteristic wavelengths, the complex mapping between spectrum and vitamin C can be effectively learned by using the multi-layer structure and activation function of the artificial neural network regression model, thereby significantly improving the prediction accuracy of the model.
[0004] Therefore, it is particularly necessary to screen the spectral characteristic wavelengths layer by layer and establish an artificial neural network quantitative regression model to achieve high-precision nondestructive detection of the vitamin C content in Red Beauty citrus. Summary of the invention
[0005] To solve the above problems, the present invention aims at the problem that the vitamin C content of Red Beauty citrus cannot be detected with high precision and non-destructive testing, and provides a method for non-destructive testing of the vitamin C content of Red Beauty citrus, so as to achieve high-precision non-destructive testing of the vitamin C content of Red Beauty citrus.
[0006] The first object of the present invention is to provide a method for non-destructive detection of vitamin C content in red beauty citrus, comprising the following steps:
[0007] (1) collecting visible and near infrared spectra of red beauty citrus samples and determining the vitamin C content of the corresponding samples;
[0008] (2) performing smoothing preprocessing on the visible near-infrared spectrum collected in step (1) to generate full-wavelength spectrum data, and forming a full-wavelength data set with the vitamin C content of the corresponding sample, and splitting the full-wavelength data set into a training set and a prediction set;
[0009] (3) Unsupervised screening combined with supervised random forest multi-engine algorithm was used to screen the characteristic wavelengths of the training set, and the characteristic wavelengths and the vitamin C content of the corresponding samples were integrated to form a characteristic wavelength data set;
[0010] (4) constructing an artificial neural network regression model and training the characteristic wavelength data set, using cross-validation and hyperparameter optimization to obtain the optimal hyperparameters of the model, and reconstructing the artificial neural network regression model using the optimal hyperparameters;
[0011] (5) The visible-near infrared spectrum of the Red Beauty citrus sample to be tested is input into the artificial neural network regression model reconstructed using the optimal hyperparameters in step (4) to obtain the vitamin C content of the sample to be tested.
[0012] In one embodiment, the wavelength of the visible near-infrared spectrum of the Red Beauty citrus sample collected in step (1) is 450 to 2500 nm, and 3 to 5 spectra are collected;
[0013] Optionally, the visible near infrared spectrum wavelength is 640 to 950 nm.
[0014] In one embodiment, the smoothing preprocessing in step (2) includes one or more of SG smoothing, Gaussian spectrum smoothing, and moving average spectrum smoothing.
[0015] In one embodiment, the sample size of the prediction set in step (2) is not less than 20% of the total number of samples.
[0016] In one embodiment, the unsupervised screening in step (3) comprises:
[0017] (1) Subjectively eliminate sample spectral difference variables or variables to be eliminated by subjective analysis, eliminate missing variables according to the missing ratio, and set a missing ratio threshold, which can be set to 10%, that is, if the missing ratio reaches the threshold, the variable is eliminated;
[0018] (2) Calculate the variance of each variable and eliminate variables with near-zero variance, that is, variables with variance less than 0.1;
[0019] (3) The Pearson correlation coefficient was calculated for each variable, and highly correlated variables were eliminated. The threshold was set at 0.9, that is, variables with a Pearson correlation coefficient greater than 0.9 were eliminated.
[0020] In one embodiment, the supervised random forest multi-engine algorithm in step (3) is a combination of VSURF, Boruta, and varSelRF algorithms, and is implemented using random forest feature screening in R language, including:
[0021] (1) Load the VSURF algorithm package, build a random forest model, specify hyperparameters such as the number of trees and the maximum number of nodes per tree, calculate the importance score of each wavelength, evaluate its contribution to the prediction target, and select the characteristic wavelength 1;
[0022] (2) Load the Boruta algorithm package, build a random forest model, and construct a shadow feature set. Based on the contribution of each wavelength in the decision tree node splitting, the boundary importance of each wavelength is determined by comparing the importance of the original wavelength and the shadow wavelength. If the importance of the original wavelength is significantly higher than that of the shadow wavelength, it is the feature wavelength 2;
[0023] (3) Load the varSelRF algorithm package, build a random forest model, obtain the overall importance score of each wavelength based on the contribution of each wavelength in the decision tree node splitting, such as the Gini index or information gain, and screen out the characteristic wavelength 3;
[0024] (4) Based on characteristic wavelengths 1 to 3, the feature set is combined with the vitamin C content in the corresponding samples to construct a characteristic wavelength data set.
[0025] In one embodiment, the contribution of each wavelength in the decision tree node splitting in step (3) includes a Gini index or information gain.
[0026] In one embodiment, the cross-validation in step (4) includes: one or more of K-fold cross-validation, leave-one-out cross-validation, repeated random partitioning cross-validation or leave-N cross-validation; and the hyperparameter optimization includes: one or more of grid search, random search, Bayesian optimization or genetic algorithm.
[0027] In one embodiment, step (4) also includes a model accuracy assessment, wherein the model accuracy assessment is a determination coefficient R 2And the root mean square error RMSE, the closer the determination coefficient is to 1, the smaller the root mean square error is, which means the higher the accuracy of the model.
[0028] In one embodiment, in step (4), R 2 The calculation formula is as follows:
[0029]
[0030] In one embodiment, the calculation formula of RMSE in step (4) is as follows:
[0031]
[0032] The second object of the present invention is to provide a method for improving the accuracy of non-destructive detection of vitamin C content in red beauty citrus, comprising the following steps:
[0033] (1) collecting visible and near infrared spectra of red beauty citrus samples and determining the vitamin C content in the corresponding samples;
[0034] (2) performing smoothing preprocessing on the collected visible and near-infrared spectra to generate full-wavelength spectrum data, and forming a full-wavelength data set with the vitamin C content of the corresponding sample, and splitting the full-wavelength data set into a training set and a prediction set;
[0035] (3) Unsupervised screening combined with supervised random forest multi-engine algorithm was used to screen the spectrum and vitamin C content of Red Beauty citrus to obtain a characteristic wavelength data set;
[0036] (4) constructing an artificial neural network regression model and training the characteristic wavelength data set, using cross-validation and hyperparameter optimization to obtain the optimal hyperparameters of the model, and reconstructing the artificial neural network regression model using the optimal hyperparameters;
[0037] (5) The visible-near infrared spectrum of the Red Beauty citrus sample to be tested is input into the artificial neural network regression model reconstructed using the optimal hyperparameters in step (4) to obtain the vitamin C content of the sample to be tested.
[0038] In one embodiment, the wavelength of the visible near-infrared spectrum collected from the Red Beauty citrus sample in step (1) is 450 to 2500 nm, and 3 to 5 spectra are collected; optionally, the wavelength of the visible near-infrared spectrum is 640 to 950 nm.
[0039] In one embodiment, the smoothing preprocessing in step (2) includes one or more of SG smoothing, Gaussian spectrum smoothing, and moving average spectrum smoothing.
[0040] In one embodiment, the sample size of the prediction set in step (2) is not less than 20% of the total number of samples.
[0041] In one embodiment, the unsupervised screening in step (3) comprises:
[0042] (1) Subjectively eliminate sample spectral difference variables or variables to be eliminated by subjective analysis, eliminate missing variables according to the missing ratio, and set a missing ratio threshold, which can be set to 10%, that is, if the missing ratio reaches the threshold, the variable is eliminated;
[0043] (2) Calculate the variance of each variable and eliminate variables with near-zero variance, that is, variables with variance less than 0.1;
[0044] (3) The Pearson correlation coefficient was calculated for each variable, and highly correlated variables were eliminated. The threshold was set at 0.9, that is, variables with a Pearson correlation coefficient greater than 0.9 were eliminated.
[0045] In one embodiment, the supervised random forest multi-engine algorithm in step (3) is a combination of VSURF, Boruta, and varSelRF algorithms, and is implemented using random forest feature screening in R language, including:
[0046] (1) Load the VSURF algorithm package, build a random forest model, specify hyperparameters such as the number of trees and the maximum number of nodes per tree, calculate the importance score of each wavelength, evaluate its contribution to the prediction target, and screen out characteristic wavelengths;
[0047] (2) Load the Boruta algorithm package, build a random forest model, and construct a shadow feature set. Based on the contribution of each wavelength in the decision tree node splitting, such as the Gini index or information gain, the boundary importance of each wavelength is determined by comparing the importance of the original wavelength and the shadow wavelength. If the importance of the original wavelength is significantly higher than that of the shadow wavelength, it is a characteristic wavelength.
[0048] (3) Load the varSelRF algorithm package, build a random forest model, and screen out characteristic wavelengths based on the contribution of each wavelength in the decision tree node splitting;
[0049] (4) The wavelengths selected by the above algorithm and the corresponding vitamin C content are combined to construct a characteristic wavelength data set.
[0050] In one embodiment, the cross-validation in step (4) includes: one or more of K-fold cross-validation, leave-one-out cross-validation, repeated random partitioning cross-validation or leave-N cross-validation; and the hyperparameter optimization includes: one or more of grid search, random search, Bayesian optimization or genetic algorithm.
[0051] In one embodiment, step (4) also includes a model accuracy assessment, wherein the model accuracy assessment is a determination coefficient R 2And the root mean square error RMSE, the closer the determination coefficient is to 1, the smaller the root mean square error is, which means the higher the accuracy of the model.
[0052] Beneficial effects of the present invention:
[0053] 1. The nondestructive detection method for vitamin C content in Red Beauty citrus proposed in the present invention has the advantages of being rapid, nondestructive, economical, and environmentally friendly compared to traditional destructive fruit vitamin C detection methods.
[0054] 2. The nondestructive testing method established based on four steps of the present invention realizes the regression of vitamin C components in fruits and has strong feasibility. In the process of establishing the prediction model, a layer-by-layer feature screening algorithm is used to select the spectral characteristic wavelength, and then an artificial neural network regression modeling is performed, which overcomes the deficiency that the traditional simple model cannot make a high-precision prediction of vitamin C; the method R of the present invention 2 The R of the competitive adaptive reweighted sampling (CRAS) method is significantly better than that of the traditional method. 2 is 0.854, RMSE is 3.275, and R of the genetic algorithm (GA) is 2 The R of recursive feature elimination (RFE) is 0.735, the RMSE is 4.553, and the 2 The average value of the regression line is 0.763 and the RMSE is 4.116.
[0055] 3. The characteristic wavelength screening in the present invention integrates and effectively combines the unsupervised and supervised random forest multi-engine algorithms to screen the characteristic variables of the spectral data set after smooth preprocessing. This method overcomes the problems of low model learning efficiency, unclear accuracy improvement effect and easy overfitting caused by high-dimensional and complex features of traditional wavelength screening algorithms. The selected characteristic wavelength plays an important role in the establishment of the rapid nondestructive detection model of vitamin C in Red Beauty citrus. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a visible, near-visible, and near-infrared spectrum of the Red Beauty citrus involved in the embodiments of the present invention;
[0057] Figure 2 The visible, near-visible and near-infrared spectral characteristic wavelengths of 20 red beauty citrus fruits selected in the embodiment of the present invention;
[0058] Figure 3 A scatter plot comparing the vitamin C content outputted by the Red Beauty citrus involved in the embodiments of the present invention and the actually measured vitamin C content;
[0059] Figure 4 A scatter plot comparing the vitamin C content output of the Red Beauty citrus and the actually measured vitamin C content in the comparative example of the present invention; DETAILED DESCRIPTION
[0060] The preferred embodiments of the present invention are described below. It should be understood that the embodiments are for better explaining the present invention and are not used to limit the present invention.
[0061] The artificial neural network regression model used in the embodiment can refer to the artificial neural network model in the patent document CN 117840072 A "A customizable spherical fruit and vegetable quality lossless sorting and suitable processing system and method".
[0062] Example 1: A non-destructive detection method for vitamin C content in red beauty citrus
[0063] A non-destructive detection method for vitamin C content in red beauty citrus, comprising the following steps:
[0064] (1) 126 red beauty citrus samples were collected from the Xiangshan Red Beauty Citrus Orchard, and each sample was subjected to visible, near-visible, and near-infrared spectral transmission scanning using a desktop automated spectral acquisition system, and the vitamin C content of each sample was then determined by spectrophotometry; wherein 5 spectra were collected for each citrus fruit, with a wavelength range of 640 to 950 nm, and the vitamin C content was determined 3 times;
[0065] (2) Performing SG smoothing preprocessing on the collected visible, near-visible and near-infrared spectra to generate full-wavelength spectral data and forming a full-wavelength data set with the vitamin C content of the sample, and splitting the full-wavelength data set into 80% training set and 20% prediction set;
[0066] (3) The unsupervised combined with supervised random forest multi-engine algorithm (VSURF, Boruta, varSelRF algorithm) was used to screen the characteristic wavelengths of the training set and integrate the characteristic wavelengths and the corresponding vitamin C content to form a characteristic wavelength data set;
[0067] (4) An artificial neural network regression model was constructed using the characteristic wavelength training set. Five-fold cross validation and hyperparameter grid search were used to obtain the optimal hyperparameters of the model. The artificial neural network regression model was reconstructed with the optimal hyperparameters, and the prediction set was used as input and the corresponding vitamin C content was used as output to achieve high-precision nondestructive detection of the vitamin C content in Red Beauty citrus.
[0068] Unsupervised combined with supervised random forest multi-engine algorithm (VSURF, Boruta, varSelRF algorithm) wavelength screening algorithm process and some R code:
[0069]
[0070]
[0071]
[0072]
[0073] The original spectrum of Vc in Red Beauty citrus is as follows Figure 1 As shown, the characteristic wavelength of the above multi-engine algorithm is as follows Figure 2 As shown in the figure, the optimal hyperparameters are: hidden_units = 1, penalty = 0.001, epochs = 150, and the calculated model accuracy is as follows Figure 3 As shown, the R 2 =0.902, RMSE = 2.466, R of the prediction set (new sample set) 2 =0.900, RMSE=2.841, which has high prediction accuracy.
[0074] Comparative Example 1: Not using unsupervised combined with supervised random forest multi-engine algorithm
[0075] On the basis of Example 1, step (3) is omitted and the steps are as follows:
[0076] (1) 126 red beauty citrus samples were collected from the Xiangshan Red Beauty Citrus Orchard, and each sample was subjected to visible, near-visible, and near-infrared spectral transmission scanning using a desktop automated spectral acquisition system, and the vitamin C content of each sample was then determined by spectrophotometry; wherein 5 spectra were collected for each citrus fruit, with a wavelength range of 640 to 950 nm, and the vitamin C content was determined 3 times;
[0077] (2) Performing SG smoothing preprocessing on the collected visible, near-visible and near-infrared spectra to generate full-wavelength spectral data and forming a full-wavelength data set with the vitamin C content of the sample, and splitting the full-wavelength data set into 80% training set and 20% prediction set;
[0078] (3) The artificial neural network regression model was constructed based on the training set, and the optimal hyperparameters of the model were obtained using five-fold cross validation and hyperparameter grid search. The artificial neural network regression model was reconstructed with the optimal hyperparameters, and the prediction set was used as input and the corresponding vitamin C content was used as output.
[0079] The results show that the best hyperparameters are: hidden_units = 6, penalty = 0.1, epochs = 150, and the calculated model accuracy is as follows Figure 4 As shown, the R 2 =0.738, RMSE =4.279, R of the prediction set (new sample set) 2 =0.761, RMSE =4.518. It can be seen that the method of Example 1 has higher accuracy than that of Comparative Example 1.
[0080] Comparative Example 2: Using conventional methods
[0081] On the basis of Example 1, conventional algorithms, namely competitive adaptive reweighted sampling (CRAS), genetic algorithm (GA) and recursive feature elimination (RFE) are used to replace the unsupervised combined with supervised random forest multi-engine algorithm, and the steps are as follows:
[0082] (1) 126 red beauty citrus samples were collected from the Xiangshan Red Beauty Citrus Orchard, and each sample was subjected to visible, near-visible, and near-infrared spectral transmission scanning using a desktop automated spectral acquisition system, and the vitamin C content of each sample was then determined by spectrophotometry; wherein 5 spectra were collected for each citrus fruit, with a wavelength range of 640 to 950 nm, and the vitamin C content was determined 3 times;
[0083] (2) Performing SG smoothing preprocessing on the collected visible, near-visible and near-infrared spectra to generate full-wavelength spectral data and forming a full-wavelength data set with the vitamin C content of the sample, and splitting the full-wavelength data set into 80% training set and 20% prediction set;
[0084] (3) Competitive adaptive reweighted sampling (CRAS), genetic algorithm (GA) and recursive feature elimination (RFE) were used to screen the characteristic wavelengths of the training set and integrate the characteristic wavelengths and the corresponding vitamin C content to form different characteristic wavelength data sets;
[0085] (4) The artificial neural network regression model was constructed based on the training set, and the optimal hyperparameters of the model were obtained using five-fold cross validation and hyperparameter grid search. The artificial neural network regression model was reconstructed with the optimal hyperparameters, and the prediction set was used as input and the corresponding vitamin C content was used as output.
[0086] The algorithm flow and some R codes are as follows:
[0087] 1. Competitive Adaptive Reweighted Sampling (CRAS) algorithm wavelength screening algorithm process and some R code:
[0088] n<-190#Number of samples
[0089] p<-145#Wavelength
[0090] X<-matrix(rnorm(n*p),nrow=n,ncol=p)#spectral data matrix
[0091] Y<-rnorm(n)#Organic acid content as dependent variable
[0092] #Assign initial weights to each characteristic wavelength (here initialized to equal values)
[0093] initial_weights<-rep(1 / p,p)
[0094] #In each round of feature selection, a competitive adaptive reweighted sampling algorithm and cross-validation are used to select feature wavelengths and establish a partial least squares regression model
[0095] num_iterations<-5#Set the number of iterations
[0096] selected_features<-NULL#Store the selected feature wavelength index
[0097] for(iter in 1:num_iterations){
[0098] # Sample the characteristic wavelength according to the current weight distribution
[0099] selected_indices<-sample.int(p,size=50,replace=FALSE,prob=initial_weights)
[0100] #Selected characteristic wavelength
[0101] selected_features<-union(selected_features,selected_indices)
[0102] #Extract the selected characteristic wavelength data
[0103] X_selected<-X[,selected_features]
[0104] #Use partial least squares regression model and evaluate performance
[0105] plsModel<-plsr(Y~X_selected,ncomp=15)#Assume that 15 components are used
[0106] #Perform cross-validation to evaluate model performance and simplify output RMSE
[0107] performance<-summary(plsModel)$validation$RMSE$calibration$mean
[0108] #Update the weight of the characteristic wavelength based on performance
[0109] initial_weights[selected_features]<-performance
[0110] }
[0111] #Repeat the feature selection cycle until the preset stop condition is reached (here simplified to a fixed number of times)
[0112] selected_features<-selected_features[order(initial_weights[selected_features],decreasing=TRUE)]#Sort by performance
[0113] #Combining the features selected by the above algorithm with the corresponding Vc content to build a characteristic wavelength data set
[0114] 2. Genetic algorithm wavelength screening algorithm process and some R codes:
[0115] #Data Splitting
[0116] set.seed(42)
[0117] datasplit<-
[0118] rsample::initial_split(simdata,prop=0.7,strata=Y)
[0119] traindata<-rsample::training(datasplit)
[0120] testdata<-rsample::testing(datasplit)
[0121] trainx<-bake(datarecipe,new_data=NULL)%>%
[0122] select(-Y)
[0123] trainy<-traindata$Ytestx<-bake(datarecipe,new_data=testdata)%>%
[0124] select(-Y)
[0125] testy<-testdata$Y
[0126] library(caret)
[0127] set.seed(1216)
[0128] result_ga_rf<-gafs(
[0129] x=as.data.frame(trainx),
[0130] y=trainy,
[0131] iters=100,#number of iterations
[0132] popSize=20,#Number of individuals in each generation
[0133] pcrossover=0.6,#crossover probability
[0134] pmutation=0.1, # mutation probability
[0135] elite=0,#retain the number of best individuals in each generation
[0136] gafsControl=gafsControl(
[0137] method="cv",
[0138] number=3,
[0139] functions=rfGA,
[0140] verbose=T ) )
[0143] #Combining the features selected by the above algorithm with the corresponding Vc content to build a characteristic wavelength data set
[0144] 3. Recursive feature elimination wavelength screening algorithm process and some R codes:
[0145]
[0146] #Combining the features selected by the above algorithms with the corresponding Vc content to construct a characteristic wavelength data set Comparative Example 3: Only using unsupervised combined with a supervised random forest multi-engine algorithm
[0147] On the basis of Example 1, the Boruta and varSelRF algorithms in step (3) are omitted, and the remaining steps are consistent with Example 1 to test the detection accuracy of the method.
[0148] Comparative Example 4: Using only unsupervised combined with two supervised random forest multi-engine algorithms
[0149] On the basis of Example 1, the varSelRF algorithm in step (3) is omitted, and the remaining steps are consistent with Example 1 to test the detection accuracy of the method.
[0150] The detection accuracy of the methods of comparative examples 2 to 4 was tested, and the results are shown in Table 1.
[0151] The results are shown in Table 1, and the results show that the prediction of the vitamin C content in the red beauty citrus by Example 1 has higher accuracy than the different characteristic wavelength screening algorithms in Comparative Example 2, that is, the present invention realizes the high-precision non-destructive detection of vitamin C in the red beauty citrus. Compared with using only one random forest algorithm or using two random forest algorithms, the prediction accuracy of this method is higher, indicating that the unsupervised joint random forest triple algorithm is the most suitable feature selection algorithm, which can effectively combine the artificial neural network model to realize the high-precision non-destructive detection of vitamin C in the red beauty citrus.
[0152] Table 1 Comparison of the accuracy of predicting vitamin C content with different characteristic wavelength data sets
[0153] Different characteristic wavelength screening <![CDATA[R 2 ]]> RMSE Example 1 0.902 2.466 Comparative Example 2 (CRAS) 0.854 3.275 Comparative Example 2 (GA) 0.735 4.553 Comparative Example 2 (RFE) 0.763 4.116 Comparative Example 3 (VSURF) 0.887 2.718 Comparative Example 4 (VSURF+Boruta) 0.899 2.512
[0154] Although the present invention has been disclosed as above in the form of a preferred embodiment, it is not intended to limit the present invention. Anyone familiar with this technology can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention should be based on the definition of the claims.
Claims
1. A non-destructive detection method for vitamin C content in red beauty citrus, characterized in that: The steps include: (1) collecting visible and near infrared spectra of red beauty citrus samples and determining the vitamin C content in the corresponding samples; (2) performing smoothing preprocessing on the visible near-infrared spectrum collected in step (1) to generate full-wavelength spectrum data, and forming a full-wavelength data set with the vitamin C content of the corresponding sample, and splitting the full-wavelength data set into a training set and a prediction set; (3) Unsupervised screening combined with supervised random forest multi-engine algorithm was used to screen the characteristic wavelengths of the training set, and the characteristic wavelengths and the vitamin C content of the corresponding samples were integrated to form a characteristic wavelength data set; (4) constructing an artificial neural network regression model, training the characteristic wavelength data set, using cross-validation and hyperparameter optimization to obtain the optimal hyperparameters of the model, and reconstructing the artificial neural network regression model using the optimal hyperparameters; (5) The visible-near infrared spectrum of the Red Beauty citrus sample to be tested is input into the artificial neural network regression model reconstructed using the optimal hyperparameters in step (4) to obtain the vitamin C content of the sample to be tested.
2. The method according to claim 1, characterized in that The wavelength of the visible near-infrared spectrum of the Red Beauty citrus sample collected in step (1) is 640 to 950 nm, and 3 to 5 spectra are collected.
3. The method according to claim 1, characterized in that The smoothing preprocessing in step (2) includes one or more of SG smoothing, Gaussian spectrum smoothing, and moving average spectrum smoothing.
4. The method according to claim 1, characterized in that: The sample size of the prediction set in step (2) shall not be less than 20% of the total number of samples.
5. The method according to claim 1, characterized in that The unsupervised screening in step (3) is implemented in R language, including: (1) Subjectively eliminate sample spectrum difference variables or variables to be eliminated by subjective analysis, and eliminate variables with a missing ratio of more than 10%; (2) Calculate the variance of each variable and eliminate variables with variance less than 0.1; (3) Calculate the Pearson correlation coefficient for each variable and eliminate variables with a Pearson correlation coefficient greater than 0.
9.
6. The method according to claim 1, characterized in that The supervised random forest multi-engine algorithm in step (3) is a combination of VSURF, Boruta, and varSelRF algorithms, implemented in R language using random forest feature screening, including: (1) Load the VSURF algorithm package, build a random forest model, specify hyperparameters, calculate the importance score of each wavelength, and screen out the characteristic wavelength 1; (2) Load the Boruta algorithm package, build a random forest model, and construct a shadow feature set. Determine the boundary importance of the wavelength by comparing the contributions of the original wavelength and the shadow wavelength. If the importance of the original wavelength is significantly higher than that of the shadow wavelength, select it as feature wavelength 2; (3) Load the varSelRF algorithm package, build a random forest model, calculate the overall importance score of each wavelength, and screen out characteristic wavelength 3; (4) The feature sets are merged based on characteristic wavelength 1, characteristic wavelength 2, and characteristic wavelength 3, and are compared with the vitamin C content of the corresponding samples to construct a characteristic wavelength data set.
7. The method according to claim 1, characterized in that The cross validation in step (4) includes one or more of K-fold cross validation, leave-one-out cross validation, repeated random partitioning cross validation or leave-N cross validation; the hyperparameter optimization includes one or more of grid search, random search, Bayesian optimization or genetic algorithm.
8. The method according to claim 1, characterized in that Step (4) also includes model accuracy assessment, which is performed by determining the coefficient of determination R 2 And the root mean square error RMSE is achieved.
9. A method for improving the accuracy of non-destructive detection of vitamin C content in red beauty citrus, characterized in that: Includes steps: (1) collecting visible and near infrared spectra of red beauty citrus samples and determining the vitamin C content of the corresponding samples; (2) performing smoothing preprocessing on the collected visible and near-infrared spectra to generate full-wavelength spectrum data, and forming a full-wavelength data set with the vitamin C content of the corresponding sample, and splitting the full-wavelength data set into a training set and a prediction set; (3) Unsupervised screening combined with supervised random forest multi-engine algorithm was used to screen the spectrum and vitamin C content of Red Beauty citrus to obtain a characteristic wavelength data set; (4) constructing an artificial neural network regression model and training the characteristic wavelength data set, using cross-validation and hyperparameter optimization to obtain the optimal hyperparameters of the model, and reconstructing the artificial neural network regression model using the optimal hyperparameters; (5) The visible-near infrared spectrum of the Red Beauty citrus sample to be tested is input into the artificial neural network regression model reconstructed using the optimal hyperparameters in step (4) to obtain the vitamin C content of the sample to be tested.
10. Use of the method according to any one of claims 1 to 8 or the method according to claim 9 in detecting the content of vitamin C in Red Beauty citrus.
Citation Information
Patent Citations
Nondestructive testing method for Fushi apple quality based on near infrared spectrum
CN107064047A
Near-infrared spectrum rapid evaluation method for rice taste quality
CN111007040A
Model construction method and device for estimating nutrient content of wolfberry based on hyperspectrum
CN116482037A
Customizable non-destructive sorting and suitable processing system and method for quality of sphere-like fruits and vegetables
CN117840072A
Method for estimating nitrogen content of grassland vegetation leaves
CN118243644A
Cited By
High-resolution surface soil moisture estimation method fused with space-ground multivariate data
CN120180136A
