Melon and fruit quality prediction method based on spectrum technology, conductivity measurement and machine learning

Through near-infrared spectroscopy technology and conductivity measurement combined with machine learning algorithms, a multimodal prediction model of gourd protein and FAA content was established, solving the problems of long detection time and high cost in the existing technology, and achieving fast and accurate large-scale detection.

CN119782696AActive Publication Date: 2025-04-08ZHEJIANG UNIV OF TECH

Patent Information

Application Number
CN202411623519.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-04-08
Estimated Expiration
2044-11-14

AI Technical Summary

Technical Problem

The prior art has problems such as limited sample size, long detection time and high cost when detecting gourd protein and FAA content, making it difficult to achieve fast and efficient large-scale testing.

Method used

Near-infrared spectroscopy technology combined with conductivity measurement is used to obtain the spectral data and conductivity data of gourd samples, and a multimodal prediction model is established through machine learning algorithms to achieve rapid and accurate prediction of gourd protein and FAA content.

Benefits of technology

Through multimodal fusion technology, the prediction accuracy of protein and FAA content is significantly improved, the detection cost is reduced, and it is suitable for large-scale promotion and application, and the detection efficiency and model robustness are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782696A_ABST
    Figure CN119782696A_ABST
Patent Text Reader

Abstract

The invention discloses a melon and fruit quality prediction method based on a spectrum technology, conductivity measurement and machine learning, which comprises the following steps: drying melons and fruits, grinding into powder, grouping and numbering to establish a plurality of melon and fruit core germplasm groups numbered one by one, respectively detecting near infrared spectrum data and conductivity data of the melon and fruit core germplasm groups, and detecting protein content and amino acid FAA, obtaining a corresponding data set; the near infrared spectrum data and the conductivity data of the data set are preprocessed, then the preprocessed near infrared spectrum data are subjected to characteristic wavelength selection, the absorbance value data and the conductivity data under the selected characteristic wavelength are fused into one data set, and the data set is divided into a test set and a training set. And training and predicting a result by using a ridge regression model. According to the method, spectral data and conductivity data of melons and fruits are obtained based on measurement, the content of protein and FAA in the melons and fruits is predicted through multi-modal fusion of the spectral data and the conductivity data, and the prediction accuracy and stability are further improved through the method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This patent belongs to the field of fruit and vegetable quality detection, and specifically involves a fruit quality prediction method based on spectral technology, conductivity measurement and machine learning. Background Art

[0002] Gourd is a cultivated variety of the Cucurbitaceae family. It is an annual climbing herb that usually blooms in the evening. As a vegetable, the fruit of gourd is rich in nutritional value and is rich in protein, FAA, vitamins and trace elements. The gourd flesh has a delicate texture, white color, tender meat, pleasant aroma and delicious taste, so it is deeply loved by consumers. Protein and FAA are important quality indicators of gourd. However, traditional methods for detecting protein and FAA of gourd have limitations such as long detection time, low efficiency and high cost, and are not suitable for large-scale detection in production practice. Therefore, it is urgent to develop a rapid detection technology specifically for gourd protein and FAA to achieve rapid and efficient detection and large-scale production.

[0003] In recent years, hyperspectral imaging (HSI), near-infrared spectroscopy (NIRS), ultrasonic detection and electrical property detection have been widely used in the rapid detection of fruit and vegetable quality. Due to its convenience, environmental protection and stability, near-infrared spectroscopy has gradually become the mainstream method for rapid detection of agricultural products. The wavelength range of near-infrared spectroscopy (780-2526nm) is between visible light and mid-infrared spectroscopy. By recording the harmonic and combined frequency absorption of hydrogen-containing groups (CH, NH, OH), near-infrared spectroscopy can present different absorption peaks at different wavelengths. When using near-infrared spectroscopy for fruit and vegetable quality analysis, a highly stable and accurate mathematical model should be constructed by mining spectral information data and chemometric methods.

[0004] For example, the invention patent with patent number CN111948357A proposes a method for quantitatively evaluating the umami quality of gourd. In terms of FAA detection, the Hitachi L-8900 amino acid automatic analyzer is used to detect the FAA content of gourd samples. Although this method can provide accurate FAA data, its disadvantages are that the detection steps are complicated and time-consuming, and it is difficult to achieve rapid evaluation. At the same time, professional experimental equipment and consumables are required, the detection cost is high, and it is not suitable for rapid detection needs in large-scale production.

[0005] The invention patent with patent number CN113484278A proposes a non-destructive detection method for comprehensive tomato quality based on spectral and principal component analysis. This method obtains the visible light and near-infrared spectral data of tomato samples, and combines the principal component analysis method to extract features, calculates the principal component score data of each tomato sample, and establishes a prediction model to predict the comprehensive quality of tomato samples. Although this method can quickly evaluate the quality of tomatoes through spectral data, its disadvantage is that it is limited to spectral data and cannot be combined with other physical characteristics for a more comprehensive quality assessment.

[0006] For example, the invention patent with patent number CN118362608A proposes a device and method for measuring the acidity of fruits and vegetables. This method detects the conductivity of fruit and vegetable juice by measuring the conductivity electrode, and calculates the acidity information of fruits and vegetables by combining the data processing of the TDS electrical signal conversion board and the temperature sensor. The device has the advantages of low cost and fast measurement speed, but its disadvantage is that it only relies on conductivity to detect the acidity of fruits and vegetables, which may ignore the influence of other physical or chemical properties, limiting the comprehensiveness of the test results and its application in other quality tests.

[0007] There are certain limitations in relying solely on spectral data. In order to further improve the accuracy and efficiency of detection, the present invention proposes to use conductivity measurement as a supplementary data source. Conductivity data reflects the conductivity inside the sample, and this physical property is related to the internal structure and composition of the gourd sample. By combining conductivity data with spectral data and applying multimodal fusion technology, the prediction accuracy of protein and FAA content can be significantly improved.

[0008] The method of the present invention is mainly used for the detection of protein and amino acid (FAA) content in fruits and vegetables. Specifically, it relates to a method for obtaining spectral data and conductivity data of fruits and vegetables based on near-infrared spectroscopy technology combined with conductivity measurement, and predicting the protein and FAA content in the fruits and vegetables through multimodal fusion of the two. For the convenience of the experiment, this patent uses gourd as the experimental object. Summary of the invention

[0009] In view of the above technical problems existing in the prior art, the purpose of this application is to provide a method for predicting the quality of melons and fruits based on spectral technology, conductivity measurement and machine learning, aiming to solve the problems of limited sample size, long detection time and high cost in detecting the quality of gourds in the prior art. This method uses near-infrared spectroscopy technology to quickly obtain the spectral data of gourd samples, measures its conductivity data at the same time, and combines machine learning algorithms to establish a multimodal prediction model for the protein and FAA content of gourds, which can efficiently predict the protein and FAA content of gourds, thereby achieving a rapid and accurate evaluation of the quality of gourds.

[0010] The technical concept of this patent is: At present, the existing technology has problems such as limited sample size, long detection time, and high cost when detecting the quality of gourd. Therefore, this patent proposes to use NIRS (near infrared spectroscopy technology) combined with conductivity measurement and machine learning algorithms to further enhance the detection accuracy and efficiency of gourd protein and FAA content, thereby achieving a comprehensive evaluation of gourd quality.

[0011] The technical solutions adopted by this patent to achieve the above invention objectives are as follows:

[0012] A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning, comprising the following steps:

[0013] S1: Pick fresh fruits and vegetables at maturity, freeze-dry them, grind them into powder using a high-speed grinder, group and number the fruit and vegetable powders, and establish multiple numbered fruit and vegetable core germplasm groups;

[0014] S2: for the fruit samples of each germplasm group in step S1, respectively detect their near infrared spectrum data and conductivity data, as well as detect the nutritional data including protein content and amino acid FAA content, to obtain the corresponding data set;

[0015] S3: preprocessing the near infrared spectral data and conductivity data in the data set of step S2 to eliminate noise bias;

[0016] S4: Afterwards, the preprocessed near-infrared spectral data is subjected to characteristic wavelength selection, the absorbance value data and the conductivity data under the selected characteristic wavelength are merged into one data set, and the data set is divided into a test set and a training set;

[0017] S5: Use the ridge regression model to construct a regression prediction model for melon and fruit protein and FAA, and use the constructed prediction model to perform training and testing according to the test set and training set divided in step S3; when the melon and fruit protein and FAA content is subsequently detected, first obtain near-infrared spectral data and conductivity data according to the method of steps S2-S3, and after preprocessing and feature selection, input them into the trained prediction model to obtain the corresponding melon and fruit protein and FAA content data.

[0018] Furthermore, the melon and fruit described in step S1 is gourd, and uniform, fresh and tender fruits are harvested during the commercial maturity period of gourd. Each germplasm group collects 9 gourd fruits of commercial maturity, and these 9 fruits are divided into three groups, each group of three fruits. Samples are taken from the middle part of each group of fruits. The samples are freeze-dried in a freeze dryer (LGJ-10) for 3-4 days and ground into powder using a high-speed grinder (JXFSTPRP-24L).

[0019] Furthermore, in step S2, the melon and fruit samples of each germplasm group are divided into three parts for testing. The first part detects protein data, the second part uses Hitachi L-8900 amino acid analyzer to analyze FAA content, and the third part detects near-infrared spectrum data and conductivity data. The near-infrared spectrum data is obtained by scanning with a near-infrared analyzer. The detection process of the conductivity data is: the melon and fruit powder is tableted, and then the conductivity of the tableted sample is measured using a precision conductivity meter.

[0020] Furthermore, the steps of acquiring near infrared spectrum data by scanning with a near infrared analyzer are as follows:

[0021] 1) To obtain the near infrared spectrum of the gourd, the present invention uses a Thermo NicoletANTARIS II Fourier transform near infrared (FT-NIR) analyzer to scan the third part of the sample of each numbered gourd core germplasm population in step S2. The scanning is carried out under the conditions of constant temperature 24°C and constant humidity 60%. The scanning spectrum range is 1000 to 2500nm, and each sample is scanned 64 times with a resolution of 8cm -1 .

[0022] 2) Load the sample into a sample cup with a diameter of 5 cm and a height of about 1.5 cm. The thickness and compaction of the sample are kept consistent to minimize the measurement error caused by uneven sample loading. Each sample is scanned three times and the average absorption spectrum is calculated as the spectral value. The near-infrared spectral information of all samples is collected and stored.

[0023] Further, the steps of measuring the conductivity of the sample are as follows: using a precision conductivity meter to measure the conductivity of the sample after tableting. The conductivity meter uses a four-probe method, applying current through the external electrode, and the internal electrode measures the voltage change in the sample. This can reduce the influence of contact resistance on the measurement results and improve the measurement accuracy. Record the conductivity data of each sample. In order to ensure the stability of the results, each sample is measured at least three times, and the average value is taken as the final conductivity.

[0024] Furthermore, the near-infrared spectrum data in step S2 is curve data consisting of n data points in a rectangular coordinate system, and the horizontal coordinate and the vertical coordinate of the data point are wavelength and absorbance value respectively.

[0025] Furthermore, step S3 preprocesses the near-infrared spectral data. In order to eliminate the background, noise and interference caused by instrument and position changes during data acquisition, it is necessary to preprocess the original spectrum. By applying the multiple scattering correction (MSC) and standard normalized variable (SNV) method to preprocess the original spectral data, the interference of noise and baseline drift can be eliminated. The multiple scattering correction method corrects the influence of multiple scattering by constructing a ratio of the sample spectrum to the reference spectrum. Multiple scattering will cause the optical path length to increase and the signal intensity to decrease. The basic formula of MSC correction is as follows:

[0026] MSC=(R sample -R min ) / (R ref -R min ), (1)

[0027] In the above formula, R sample is the absorbance test value of a data point at wavelength i of an original spectral curve to be corrected, R min It is the minimum value of the absorbance value comparison at different wavelengths of an original spectral curve to be corrected, R ref It is the average value of the absorbance of all original spectral curves at the same wavelength i. The MSC value is the absorbance correction value of an original spectral curve to be corrected at wavelength i. i is an integer from 1 to n. The purpose of MSC correction is to remove the residual scattering components in the spectrum and improve the accuracy and comparability of the sample spectrum.

[0028] Standardization of variance (SNV) is a normalization technique used to eliminate differences caused by differences in light intensity and baseline drift. The SNV formula is as follows:

[0029] SNV=(X i -μ) / σ, (2)

[0030]

[0031] Among them, X i is the absorbance test value of a data point of an original spectral curve to be corrected at wavelength i, μ is the average value of the absorbance values ​​of an original spectral curve to be corrected at different wavelengths, and σ is the standard deviation of the absorbance values ​​of an original spectral curve to be corrected at different wavelengths;

[0032] The SNV correction value is the absorbance correction value of an original spectral curve to be corrected at wavelength i; for each spectrum, the SNV method subtracts the mean value from each data point in the spectrum and divides it by the standard deviation. In this case, the overall intensity variation and baseline drift in the spectrum are eliminated, thereby highlighting the spectral features.

[0033] Furthermore, in step S3, the conductivity data of each sample is normalized. Since the conductivity data and the spectral data have different magnitudes, they must be normalized so that they can be combined with the spectral data for model training. The normalization formula is as follows:

[0034]

[0035] Among them, Z is the conductivity correction value of the sample to be corrected, Y is the conductivity test value of the sample to be corrected, α is the mean conductivity of all samples, and γ is the standard deviation of the conductivity data of all samples. Through this method, the conductivity data is standardized to a similar magnitude to the spectral data, which is convenient for subsequent fusion and analysis.

[0036] Furthermore, the specific operation steps of step S4 are as follows:

[0037] 1) The data of protein content and amino acid FAA content were used as evaluation results, and the competitive adaptive reweighted sampling algorithm CARS was used to extract the characteristic wavelengths of the preprocessed near-infrared spectral data, so as to obtain the characteristic wavelengths of the near-infrared spectral data identified by proteins and the characteristic wavelengths of the near-infrared spectral data identified by FAA;

[0038] Competitive Adaptive Reweighted Sampling (CARS) is widely used for characteristic wavelength optimization of near-infrared spectral data based on Monte Carlo sampling and partial least squares (PLS) regression coefficients. CARS is used to extract characteristic wavelengths from preprocessed near-infrared spectral data. In each iteration (iteration is to compare between different sampling results, continuously screen and optimize, through multiple iterations, CARS can find those characteristic wavelengths that contribute the most to the prediction model and have the least redundancy), the calibration set samples are randomly reselected using the exponential decay function EDF (see the paper https: / / www.sciencedirect.com / science / article / pii / S0003267009008332) to facilitate the selection of characteristic wavelengths. The data is optimized by the adaptive reweighting method (RMSECV is calculated using the PLS model and the wavelength selection is optimized according to the regression coefficient). The subset with the smallest cross-validation root mean square error is selected as the characteristic wavelength. The algorithm is implemented in Python using the sklearn library and extracts characteristic wavelengths from preprocessed near-infrared spectral data.

[0039] The use of competitive adaptive reweighted sampling CARS to extract characteristic wavelengths from near-infrared spectral data belongs to the prior art. For example, the description of paragraph 0003 of the background technology section of Chinese patent CN116465855A states that "Competitive Adapative Reweighted Sampling (CARS) is an effective variable selection algorithm that is widely used in feature selection of near-infrared spectral data. CARS is proposed to select the most relevant combination of variables (characteristic wavelengths) in a continuous selection process. Based on the regression coefficients obtained by the partial least squares (PLS) model, CARS iteratively selects N variable subsets from N Monte Carlo sampling processes. In each sampling process, a fixed proportion of sample data is randomly selected to establish a calibration model. Next, a two-step variable selection procedure is used to select relevant wavelengths using the obtained regression coefficients. Finally, a subset with the lowest root mean square error (the most relevant wavelength combination) is selected using cross-validation."

[0040] 2) Based on the characteristic wavelength selected from the spectral data, the conductivity data is used as an additional physical feature and input into the multimodal analysis model together with the characteristic wavelength selected from the spectral data;

[0041] Assume that the absorbance values ​​of m spectral characteristic wavelengths are extracted, expressed as:

[0042] x spectral =[x1,x2,...,x m ] (4)

[0043] Each sample corresponds to a conductivity value d. The conductivity data is used as an additional feature and concatenated with the spectral feature vector to form a fused feature vector:

[0044] X fuesd =[x1,x2,...,x m ,d] (5)

[0045] The feature vector X after protein recognition fusion fused Passed as input to the regression model, the model outputs predicted values ​​for protein content.

[0046] FAA identifies the fused feature vector X fused Passed as input to the regression model, the model outputs the predicted value of FAA content:

[0047] y=f(X fuesd ) (6)

[0048] Among them, f is the regression model, such as ridge regression, support vector machine, etc., and y is the prediction result of the model.

[0049] The introduction of conductivity data can help improve the model's understanding of the physical and chemical properties of the sample and make up for the shortcomings that may be caused by single spectral information. The near-infrared spectral data after extracting the characteristic wavelength and the conductivity data are randomly divided into training sets and test sets in a ratio of 8:2. The conductivity data and spectral data are kept consistent during the division process to ensure the completeness of the modal information during training and testing.

[0050] In order to predict the protein and FAA content of gourd samples from spectral information and conductivity data, several common regression models were selected for experiments. These models are used to establish the relationship between input (spectral information and conductivity data) and output (protein and FAA content), so as to achieve the prediction of unknown samples. Commonly used methods include ridge regression, random forest regression, support vector machine regression, and fully connected neural network. Ridge regression is an extension of linear regression, which solves the problem of multicollinearity by imposing constraints on regression coefficients. Ridge regression performs better on relatively small data sets. When the data set is small, random forests, neural networks, and support vector machines may be too flexible, prone to overfitting, and weakly respond to variable correlation. Therefore, considering the high correlation between characteristic wavelengths and limited data samples, we adopted a ridge regression-based method to build a prediction model. The training data set and training labels were shape-transformed to match the input requirements of the ridge regression model, and the regularization parameter alpha was set to 0.1.

[0051] Furthermore, the training set in S5 is used to train the prediction model, and the test set is used to test the performance of the model; and the determination coefficient R based on the predicted value and the actual value of the test set is 2 And RMSE are used as indicators to determine the effectiveness of the model.

[0052]

[0053] The coefficient of determination R 2 In the formula for the root mean square error (RMSE), y i represents the true value of the i-th sample, represents the predicted value of the i-th sample, is the mean of all true values ​​of samples, and m is the number of samples.

[0054] Compared with the prior art, the present invention has the following beneficial effects:

[0055] (1). This patent uses near-infrared spectroscopy technology combined with conductivity measurement, and uses a multimodal fusion method to simultaneously obtain the spectral data and conductivity data of the gourd sample, so as to quickly and accurately predict the protein and FAA content of the gourd sample. Compared with traditional detection methods, the combination of spectral information and conductivity data further improves the accuracy and stability of the prediction. The equipment and consumables required for this method are low in cost, easy to operate, suitable for large-scale promotion and application, and significantly reduce the cost of detection. At the same time, through automated data processing and model training, the detection efficiency is improved and the intervention of manual operations is reduced.

[0056] (2) This patent combines spectral data and conductivity data for multimodal analysis, which can simultaneously process the chemical and physical properties of samples. Through reasonable experimental design and data processing methods, the system can process multiple samples simultaneously, improve detection throughput, and meet the needs of large-scale production and research. Conductivity data provides an additional dimension for the physical properties of samples, enhances the ability to predict protein and FAA content, and further improves the robustness and predictive performance of the model.

[0057] (3) This method is not only applicable to the quality inspection of gourds, but can also be extended to the quality inspection of other fruits and vegetables, especially the application scenario of multimodal analysis combined with spectral and conductivity data. By fusing conductivity data with spectral data, the detection accuracy of different types of fruits and vegetables can be improved, expanding the application scope of this patent in other agricultural products. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 A flowchart of the method of this patent;

[0059] Figure 2 This is the original image of the near infrared spectrum data of this patent;

[0060] Figure 3a This is the preprocessing result diagram of the near infrared spectroscopy data of this patent based on the SNV method;

[0061] Figure 3b This is the preprocessing result diagram of the near infrared spectroscopy data of this patent based on the MSC method;

[0062] Figure 4a This is a graph showing the extraction results of characteristic wavelengths for protein identification using near infrared spectroscopy data from this patent;

[0063] Figure 4b This is the result diagram of characteristic wavelength extraction for amino acid (FAA) content identification based on the near infrared spectroscopy data of this patent. DETAILED DESCRIPTION

[0064] The specific implementation of this patent is further described in detail below in conjunction with the drawings in the specification.

[0065] Reference Figures 1 to 4b The method for predicting the quality of gourd based on spectroscopy, conductivity measurement and machine learning includes the following steps:

[0066] S1: Preparation of gourd samples, including:

[0067] A total of 206 core germplasm populations of gourd were selected as experimental materials. Uniform, fresh and tender fruits were harvested during the commercial maturity of gourd. Nine gourd fruits of commercial maturity were collected from each germplasm population, and these nine fruits were divided into three groups, with three fruits in each group. Samples were taken from the middle part of each group of fruits. The samples were freeze-dried in a freeze dryer (LGJ-10) for 3-4 days and ground into powder using a high-speed grinder (JXFSTPRP-24L).

[0068] The melon and fruit samples of each germplasm group were divided into three parts for testing. The first part tested protein data, the second part used Hitachi L-8900 amino acid analyzer to analyze FAA content, and the third part tested near-infrared spectral data and conductivity data. The near-infrared spectral data was obtained by scanning with a near-infrared analyzer. The detection process of conductivity data was: the melon and fruit powder was tableted, and then the conductivity of the tableted samples was measured using a precision conductivity meter.

[0069] S2: The protein and FAA content of the gourd samples were determined using specific instruments, including:

[0070] Use a near infrared analyzer to scan the gourd sample and obtain near infrared spectrum data, including:

[0071] To obtain the near infrared spectrum of the gourd, the present invention uses a Thermo NicoletANTARIS II Fourier transform near infrared (FT-NIR) analyzer to scan the sample. The scanning is carried out under the conditions of constant temperature of 24°C and constant humidity of 60%. The scanning spectrum range is 1000 to 2500nm, and each sample is scanned 64 times with a resolution of 8cm -1 The samples were loaded into a sample cup with a diameter of 5 cm and a height of about 1.5 cm. The thickness and compaction of the samples were kept consistent to minimize the measurement error caused by uneven sample loading. Each sample was scanned three times, and the average absorption spectrum was calculated as the spectral value. The near-infrared spectral information of all samples was collected and stored.

[0072] The stored near-infrared spectral data are visualized, such as Figure 2 As shown in Figure 2, the near-infrared (NIR) reflectance spectra of 206 core collections of P. lappa range from 4000 to 10000 cm -1 The spectral trends of all samples are similar. In terms of reflectivity, at 4698 cm-1 、5102cm -1 and 6697cm -1 There is a significant absorption peak.

[0073] S3: Measure the conductivity data of the gourd sample, including:

[0074] Use a precision conductivity meter to measure the conductivity of the pressed samples. The conductivity meter uses a four-probe method to apply current through the external electrodes and measure the voltage change in the sample through the internal electrodes. This can reduce the impact of contact resistance on the measurement results and improve measurement accuracy. Record the conductivity data of each sample. To ensure the stability of the results, each sample is measured at least three times and the average value is taken as the final conductivity.

[0075] Conductivity data can reflect the physical properties of the sample, especially those related to conductivity and ion movement. Combined with spectral data, conductivity can provide additional sample information and help improve the prediction accuracy of protein and FAA content.

[0076] S4: Preprocessing the near infrared spectrum data and conductivity data obtained by scanning with the near infrared analyzer, including:

[0077] In order to eliminate the background, noise and interference caused by instrument and position changes during data acquisition, it is necessary to preprocess the raw spectra. The interference of noise and baseline drift can be eliminated by preprocessing the raw spectral data using the multiple scattering correction (MSC) and standard normalized variable (SNV) methods.

[0078] The multiple scattering correction method corrects the effect of multiple scattering by constructing the ratio of the sample spectrum to the reference spectrum. Multiple scattering will cause an increase in optical path length and a decrease in signal intensity.

[0079] The basic formula for MSC correction is as follows:

[0080] MSC=(R sample -R min ) / (R ref -R min ), (1)

[0081] In the above formula, R sample is the absorbance test value of a data point at wavelength i of an original spectral curve to be corrected, R min It is the minimum value of the absorbance value comparison at different wavelengths of an original spectral curve to be corrected, R refIt is the average value of the absorbance of all original spectral curves at the same wavelength i. The MSC value is the absorbance correction value of an original spectral curve to be corrected at wavelength i. i is an integer from 1 to n. The purpose of MSC correction is to remove the residual scattering components in the spectrum and improve the accuracy and comparability of the sample spectrum.

[0082] Standardization of variance (SNV) is a normalization technique used to eliminate differences caused by differences in light intensity and baseline drift. The SNV formula is as follows:

[0083] SNV=(X i -μ) / σ, (2)

[0084]

[0085] Among them, X i is the absorbance test value of a data point of an original spectral curve to be corrected at wavelength i, μ is the average value of the absorbance values ​​of an original spectral curve to be corrected at different wavelengths, and σ is the standard deviation of the absorbance values ​​of an original spectral curve to be corrected at different wavelengths;

[0086] The SNV correction value is the absorbance correction value of an original spectral curve to be corrected at wavelength i; for each spectrum, the SNV method subtracts the mean value from each data point in the spectrum and divides it by the standard deviation. In this case, the overall intensity variation and baseline drift in the spectrum are eliminated, thereby highlighting the spectral features.

[0087] By comparing the original near-infrared data, both MSC and SNV can effectively reduce noise, but there is little difference in the trend. The specific results are as follows Figure 3a-Figure 3b As shown, the subsequent experimental steps of this patent use the data processed by MSC as the experimental results.

[0088] The conductivity data of each sample is normalized. Since the conductivity data and the spectral data have different magnitudes, they must be normalized so that they can be combined with the spectral data for model training. The normalization formula is as follows:

[0089]

[0090] Among them, Z is the conductivity correction value of the sample to be corrected, Y is the conductivity test value of the sample to be corrected, α is the mean conductivity of all samples, and γ is the standard deviation of the conductivity data of all samples. Through this method, the conductivity data is standardized to a similar magnitude to the spectral data, which is convenient for subsequent fusion and analysis.

[0091] S5: Select characteristic wavelengths from the pre-processed near-infrared spectral data obtained in S4, merge the absorbance value data and conductivity data under the selected characteristic wavelengths into one data set, and then divide the test set and training set into a ratio of 8:2. Specifically, it includes:

[0092] Competitive Adaptive Reweighted Sampling (CARS), based on Monte Carlo sampling and partial least squares (PLS) regression coefficients, is widely used for characteristic wavelength optimization of near-infrared spectral data. CARS is used to sample the preprocessed near-infrared spectral data. In each iteration, the calibration set samples are randomly reselected using an exponential decay function to facilitate the selection of characteristic wavelengths. The data is optimized using an adaptive reweighting method. The subset with the smallest cross-validation root mean square error is selected as the characteristic wavelength. The algorithm is implemented in Python using the sklearn library and extracts characteristic wavelengths from preprocessed near-infrared spectral data.

[0093] In this study, CARS was used to extract the significant characteristic wavelengths of near-infrared spectral data. The extracted characteristic wavelengths are mainly concentrated in the range of 4000 to 5000 cm -1 and 7000 to 10000cm -1 Compared with the original near-infrared spectral data, the number of characteristic wavelengths is significantly reduced. By applying the CARS algorithm, we identified 127 highly relevant characteristic wavelengths for proteins, renumbered these characteristic wavelengths as integers from 1 to 127, and the results of the near-infrared spectral data extraction of characteristic wavelengths identified by proteins are shown in Figure 1. Figure 4a By applying the CARS algorithm, we identified 124 highly relevant characteristic wavelengths for the FAA, renumbered these characteristic wavelengths as integers from 1 to 124, and the near-infrared spectral data was extracted using the characteristic wavelengths identified by the FAA. Figure 4a middle.

[0094] Figure 4a-4b The distribution of these characteristic wavelengths is shown respectively, with the horizontal axis being the number of the characteristic wavelength and the vertical axis being the vertical axis of the spectrum.

[0095] In addition, from Figure 4a-4b The characteristic wavelength distribution represented by the red line in the middle shows that the characteristic wavelength distribution obtained based on the CARS algorithm is relatively uniform. The CARS algorithm selects and extracts the most representative features through a competitive process without explicitly favoring a specific wavelength.

[0096] Based on the selection of spectral characteristic wavelengths, the conductivity data is used as an additional physical feature and input into the multimodal analysis model together with the selected spectral characteristic wavelengths. Assuming that the absorbance values ​​of m spectral characteristic wavelengths are extracted, it is expressed as:

[0097] Xspectral =[x1,x2,...,x m ] (4)

[0098] Each sample corresponds to a conductivity value d.

[0099] The conductivity data is used as an additional feature and concatenated with the spectral feature vector to form a fused feature vector:

[0100] X fused =[x1,x2,...,x m ,d] (5)

[0101] The feature vector X after protein recognition fusion fused Passed as input to the regression model, the model outputs the predicted value of protein content;

[0102] FAA identifies the fused feature vector X fused It is passed as input to the regression model, and the model outputs the predicted value of FAA content.

[0103] y=f(X fuesd ) (6)

[0104] Among them, f is the regression model (such as ridge regression, support vector machine, etc.), and y is the prediction result of the model.

[0105] The introduction of conductivity data can help improve the model's understanding of the physical and chemical properties of the sample and make up for the deficiencies that may be caused by single spectral information.

[0106] The near-infrared spectral data and conductivity data after extracting the characteristic wavelengths were randomly divided into training and test sets in a ratio of 8:2. A total of 164 training samples and 42 test samples were used. The conductivity data and spectral data were kept consistent during the division process to ensure the complete modal information during training and testing.

[0107] S5: Use ridge regression to build a regression prediction model for gourd protein and FAA. Specifically include:

[0108] In order to predict the protein and FAA content of gourd samples from spectral information and conductivity data, several common regression models were selected for experiments. These models are used to establish the relationship between input (spectral information and conductivity data) and output (protein and FAA content) to achieve prediction of unknown samples. Commonly used methods include ridge regression, random forest regression, support vector machine regression, ordinary least squares, and fully connected neural network. Ridge regression is an extension of linear regression that solves the problem of multicollinearity by imposing constraints on the regression coefficients. Ridge regression performs better on relatively small data sets. When the data set is small, random forests, neural networks, and support vector machines may be too flexible, prone to overfitting, and have a weak response to variable correlation.

[0109] Therefore, considering the high correlation between characteristic wavelengths and limited data samples, we adopted a ridge regression-based approach to build a prediction model. The training dataset and training labels were transformed to match the input requirements of the ridge regression model, and the regularization parameter alpha was set to 0.1.

[0110] S6: Based on the prediction model in S5, the spectral data and conductivity data obtained by the near infrared analyzer are input to predict the protein and FAA content of the gourd. Specifically, it includes:

[0111] The training set in S4 is used to train the prediction model in S5, and the test set in S4 is used to test the performance of the model in S5. The coefficient of determination R between the predicted value and the actual value of the test set is calculated. 2 And RMSE are used as indicators to determine the effectiveness of the model.

[0112]

[0113] As shown in Tables 1 and 2, the protein and FAA content prediction models based on the ridge regression algorithm have a good fitting effect with the observed data (test set), and the predicted values ​​are closely consistent with the true values ​​along the diagonal. In addition, compared with random forest, support vector machine and fully connected neural network, ridge regression showed faster speed and higher R 2 The R value of the model based on ridge regression in protein content prediction is 2 The value is 0.957 and the RMSE value is 0.228, which is 15.5% higher than the second place. In addition, in the prediction of FAA content, its R 2 The value is 0.766 and the RMSE value is 0.523, which is 26.4% better than the second place.

[0114] Table 1 Results of protein prediction model

[0115]

[0116] Table 2 Results of FAA prediction model

[0117]

[0118] The contents described in the embodiments of this specification are merely an enumeration of the implementation forms of the patent concept. The protection scope of this patent should not be deemed to be limited to the specific forms described in the embodiments. The protection scope of this patent also extends to equivalent technical means that can be thought of by those skilled in the art based on the inventive concept.

Claims

1. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning, characterized in that The following steps are involved: S1: Pick fresh fruits and vegetables at maturity, freeze-dry them, grind them into powder using a high-speed grinder, group and number the fruit and vegetable powders, and establish multiple numbered fruit and vegetable core germplasm groups; S2: for the fruit samples of each germplasm group in step S1, respectively detect their near infrared spectrum data and conductivity data, as well as detect the nutritional data including protein content and amino acid FAA content, to obtain the corresponding data set; S3: preprocessing the near infrared spectral data and conductivity data in the data set of step S2 to eliminate noise bias; S4: Afterwards, the preprocessed near-infrared spectral data is subjected to characteristic wavelength selection, the absorbance value data and the conductivity data under the selected characteristic wavelength are merged into one data set, and the data set is divided into a test set and a training set; S5: Use the ridge regression model to construct a regression prediction model for melon and fruit protein and FAA, and use the constructed prediction model to perform training and testing according to the test set and training set divided in step S3; when the melon and fruit protein and FAA content is subsequently detected, first obtain near-infrared spectral data and conductivity data according to the method of steps S2-S3, and after preprocessing and feature selection, input them into the trained prediction model to obtain the corresponding melon and fruit protein and FAA content data.

2. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 1, characterized in that The melon and fruit described in step S1 is gourd. Nine gourd fruits of commercial maturity are collected from each germplasm group. The nine fruits are divided into three groups, with three fruits in each group. Samples are taken from the middle part of each group of fruits. The samples are freeze-dried in a freeze dryer for 3-4 days and ground into powder using a high-speed grinder.

3. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 1, characterized in that In step S2, the melon and fruit samples of each germplasm group are divided into three parts for detection. The first part detects protein data, the second part uses Hitachi L-8900 amino acid analyzer to analyze FAA content, and the third part detects near-infrared spectrum data and conductivity data. The near-infrared spectrum data is obtained by scanning with a near-infrared analyzer. The detection process of the conductivity data is: the melon and fruit powder is tableted, and then the conductivity of the tableted sample is measured using a precision conductivity meter.

4. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 1, characterized in that The near infrared spectrum data in step S2 is curve data consisting of n data points in a rectangular coordinate system, and the horizontal coordinate and vertical coordinate of the data point are wavelength and absorbance value respectively; Step S3 preprocesses the near infrared spectrum data using one of the following two methods: 1) By applying the multiple scattering correction method MSC to preprocess the raw spectral data, the interference of noise and baseline drift can be eliminated. The basic formula of MSC correction is as follows: MSC=(R sample -R min ) / (R ref -R min ) In the above formula, R sample is the absorbance test value of a data point at wavelength i of an original spectral curve to be corrected, R min It is the minimum value of the absorbance value comparison at different wavelengths of an original spectral curve to be corrected, R ref It is the average value of the absorbance of all original spectral curves at the same wavelength i, and the MSC value is the absorbance correction value of an original spectral curve to be corrected at wavelength i; i is an integer from 1 to n; 2) The original spectral data was preprocessed by the standard normalized variable SNV method to eliminate the differences caused by light intensity differences and baseline drift. The basic formula for SNV correction is as follows: SNV=(X i -m) / s Among them, X i is the absorbance test value of a data point of an original spectral curve to be corrected at wavelength i, μ is the average value of the absorbance values ​​of an original spectral curve to be corrected at different wavelengths, and σ is the standard deviation of the absorbance values ​​of an original spectral curve to be corrected at different wavelengths; The SNV correction value is the absorbance correction value of an original spectrum curve to be corrected at wavelength i; The standard deviation σ The calculation formula is as follows:

5. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 1, characterized in that The preprocessing of the conductivity data in step S3 is to perform standardization so as to combine it with the spectral data for model training. The standardization formula is as follows: Among them, Z is the conductivity correction value of the sample to be corrected, Y is the conductivity test value of the sample to be corrected, α is the mean conductivity of all samples, and γ is the standard deviation of the conductivity data of all samples. Through this method, the conductivity data is standardized to a similar magnitude to the spectral data, which is convenient for subsequent fusion and analysis.

6. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 1, characterized in that The specific operation steps of step S4 are as follows: 1) The data of protein content and amino acid FAA content were used as evaluation results, and the competitive adaptive reweighted sampling algorithm CARS was used to extract the characteristic wavelengths of the preprocessed near-infrared spectral data, so as to obtain the characteristic wavelengths of the near-infrared spectral data identified by proteins and the characteristic wavelengths of the near-infrared spectral data identified by FAA; 2) Based on the characteristic wavelength selected from the spectral data, the conductivity data is used as an additional physical feature and input into the multimodal analysis model together with the characteristic wavelength selected from the spectral data; Assume that the absorbance values ​​of m spectral characteristic wavelengths are extracted, expressed as: X spectral =[x1,x2,...,x m ] Each sample corresponds to a conductivity value d. The conductivity data is used as an additional feature and concatenated with the spectral feature vector to form a fused feature vector: X fused =[x1,x2,...,x m ,d] The feature vector X after protein recognition fusion fused Passed as input to the regression model, the model outputs the predicted value of protein content; FAA identifies the fused feature vector X fused It is passed as input to the regression model, and the model outputs the predicted value of FAA content.

7. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 6, characterized in that The ridge regression model in step S5 is used to establish the relationship between the input layer data and the output layer data, so as to achieve the prediction of unknown samples. The input layer data is the feature vector X after protein recognition or FAA recognition fusion. fused , the output layer data is protein content or FAA content.

8. A method for predicting fruit quality based on spectroscopy, conductivity measurement and machine learning as claimed in claim 1, characterized in that The training set in S5 is used to train the prediction model, and the test set is used to test the performance of the model; and the coefficient of determination R based on the predicted value and the actual value of the test set is calculated. 2 And RMSE as an indicator to determine the effectiveness of the model: The coefficient of determination R 2 In the formula for the root mean square error (RMSE), y i represents the true value of the i-th sample, represents the predicted value of the i-th sample, y i is the mean of all true values ​​of samples, and m is the number of samples.

Citation Information

Patent Citations

  • Detection index and method for quantitatively evaluating bottle gourd umami quality

    CN111948357A

  • Tomato comprehensive quality nondestructive testing method based on spectrum and principal component analysis

    CN113484278A

  • Near infrared spectrum band selection method of solid wood board

    CN116465855A

  • Device and method for measuring acidity of fruits and vegetables

    CN118362608A

  • Real time monitoring of product purification

    CN109313419A

Cited By

  • Fruit and vegetable quality nondestructive testing method and system based on spectrum technology

    CN121431424A