Food quality component analysis method and system based on near infrared spectrum technology
By pre-processing and extracting characteristic wavelengths of food samples, and building an analysis model with partial least squares regression algorithm, the problem of insufficient accuracy and accuracy of spectral information utilization in food analysis is solved, and efficient and accurate food quality detection is achieved.
Patent Information
- Application Number
- CN202510354445.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-03-24
AI Technical Summary
Existing near-infrared spectroscopy techniques have challenges in accurate extraction and utilization of spectral information in food analysis, resulting in insufficient analysis accuracy and accuracy.
By obtaining the original near-infrared spectral data of the food sample set, pre-processing is performed to reduce noise interference and baseline drift, feature wavelengths are extracted, and a quantitative analysis model of food quality is constructed in combination with partial least squares regression algorithm to output the predicted value of component content.
It significantly improves the accuracy, efficiency and reliability of food quality ingredient detection, achieves fast, lossless and accurate detection of food quality and ingredients, and improves the accuracy and accuracy of testing.
Smart Images

Figure CN119915770A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of food component analysis, and in particular to a food quality component analysis method and system based on near infrared spectroscopy technology. Background Art
[0002] In the food industry, accurate identification of food quality and ingredients is the key to ensuring food safety, improving food quality and meeting consumer demand. Traditional food testing methods, including chemical analysis, sensory evaluation, microbial testing, etc., can provide relatively accurate results, but they are often time-consuming and complex to operate, and may damage food, and cannot meet the modern food industry's demand for rapid, accurate, and non-destructive testing.
[0003] As a non-destructive detection technology, near-infrared spectroscopy has the advantages of fast detection speed, simple operation and no pollution. It has been widely used in the field of food testing in recent years. By collecting near-infrared spectral information of food samples, near-infrared spectroscopy can reflect the absorption and scattering characteristics of light by different components in the sample, thereby realizing the identification of food quality and ingredients.
[0004] However, although the existing near-infrared spectroscopy technology has many advantages in the field of food analysis, it still faces some challenges in practical application, such as how to accurately extract and utilize near-infrared spectral information, and how to improve the analysis precision and accuracy of food quality components. Therefore, there is room for improvement. Summary of the invention
[0005] In order to achieve rapid, non-destructive and accurate detection of food quality and ingredients and improve the precision and accuracy of detection, the present application provides a food quality ingredient analysis method and system based on near-infrared spectroscopy technology.
[0006] The above-mentioned invention objective of the present application is achieved through the following technical solutions:
[0007] A method for analyzing food quality components based on near infrared spectroscopy technology, the method comprising the steps of:
[0008] Acquire a food sample set, acquire original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data;
[0009] Preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix;
[0010] The characteristic wavelength of the near-infrared spectrum information is extracted based on the processed spectrum matrix, and a food quality quantitative analysis model is constructed based on the characteristic wavelength in combination with a partial least squares regression algorithm, and a component content prediction value is output based on the food quality quantitative analysis model:
[0011]
[0012] Among them, β j is the regression coefficient, x(λ j ) represents the characteristic wavelength λ j The absorbance value at
[0013] A quality component analysis report of the food to be tested is generated based on the predicted component content.
[0014] By adopting the above technical scheme, in the process of analyzing the quality and composition of food, by collecting representative food samples to form a food sample set, it is ensured that the samples cover the main types of target food, processing methods and other factors that may affect the quality and composition, so as to fully reflect the quality and composition characteristics of food when establishing a prediction model, and provide a solid foundation for subsequent spectral acquisition and model establishment. The food samples in the food sample set are spectrally scanned using a near-infrared spectrometer to obtain their original near-infrared spectral information, and the original near-infrared spectral information is pre-processed, including smoothing filtering, baseline correction and normalization, so as to reduce noise interference and eliminate the influence of baseline drift on spectral data, so as to enhance spectral characteristics. In order to improve data comparability and spectral data quality, the feature selection method of continuous projection algorithm is used for the processed near-infrared spectral information to extract the characteristic wavelengths most relevant to food quality and ingredients. According to the extracted characteristic wavelengths, combined with the least squares regression algorithm, a food quality quantitative analysis model is constructed to effectively solve the problem of multicollinearity. The constructed food quality quantitative analysis model is used to output the predicted value of ingredient content. According to the output predicted value of ingredient content, a food quality ingredient analysis report is generated. Through systematic data processing and modeling process, the accuracy, efficiency and reliability of food quality ingredient detection are significantly improved, and the rapid, non-destructive and accurate detection of food quality and ingredients is realized, and the accuracy and precision of detection are improved.
[0015] In a preferred example, the present application may be further configured as follows: the preprocessing of the original infrared spectrum matrix to generate a processed spectrum matrix specifically includes:
[0016] Performing MSC correction on the original infrared spectrum matrix, performing linear regression on each original infrared spectrum to obtain a corrected infrared spectrum;
[0017] The corrected infrared spectrum is filtered by first-order derivative and normalized to generate a processed spectrum matrix.
[0018] By adopting the above technical solution, after collecting the near-infrared spectrum of the food to be tested, all near-infrared spectra are integrated to form an original infrared spectrum matrix. The original infrared spectrum matrix is subjected to MSC correction and linear regression to generate a corrected spectrum matrix, which effectively eliminates the scattering effect caused by the difference in sample particle size. The corrected matrix is then processed by first-order derivative filtering to eliminate baseline drift and sharpen the absorption peak, thereby improving the signal-to-noise ratio at the characteristic wavelength. The spectrum intensity is compressed to the [0,1] interval through range normalization to eliminate the influence of optical path differences and reduce the prediction error of foods of different thicknesses.
[0019] In a preferred example, the present application may be further configured as follows: the preprocessing of the original infrared spectrum matrix to generate a processed spectrum matrix further includes:
[0020] Determine the Mahalanobis distance between the spectrum to be tested and the standard spectrum based on the original infrared spectrum matrix;
[0021] When the Mahalanobis distance between the spectrum to be tested and the standard spectrum is greater than the preset distance threshold, it is marked as an abnormal spectrum;
[0022] The abnormal spectrum is subjected to Gaussian weighted smoothing processing to obtain repaired spectrum data, and it is determined whether the repaired spectrum data is a normal spectrum. If so, the repaired spectrum data is updated into the spectrum matrix.
[0023] By adopting the above technical scheme, abnormal spectra due to various reasons are prone to appear in the collected near-infrared spectrum data of the food to be tested. By comparing the Mahalanobis distance between each spectrum to be tested and the standard spectrum in the original infrared spectrum matrix with a preset distance threshold, when the Mahalanobis distance between the spectrum to be tested and the standard spectrum is greater than the preset distance threshold, the spectrum data is marked as an abnormal spectrum, and Gaussian weighted smoothing is performed on the abnormal spectrum to obtain repaired spectrum data, and it is determined whether the repaired spectrum data is a normal spectrum. If so, the repaired spectrum data is updated to the spectrum matrix, so that the abnormal spectrum in the spectrum matrix can be repaired, which is beneficial to improve the accuracy of food quality component detection results.
[0024] In a preferred example, the present application may be further configured as follows: extracting the characteristic wavelength of the near-infrared spectrum information based on the processed spectrum matrix specifically includes:
[0025] The comprehensive weight of each spectral wavelength is calculated based on the processed spectral matrix:
[0026]
[0027] In the formula, ρ(x i,y) is the correlation coefficient between wavelength j and target component, is the absorbance variance at wavelength j;
[0028] Selecting wavelengths in turn according to the comprehensive weights of the wavelengths of the spectrum, and screening out candidate wavelengths according to a preset dynamic termination threshold for the selected wavelengths;
[0029] The candidate wavelengths are orthogonalized to form characteristic wavelengths of near-infrared spectral information.
[0030] By adopting the above technical solution, a dual-factor comprehensive weight is constructed by fusing the correlation coefficient between the wavelength and the target component of the food, that is, the absorbance variance. The two factors work together to improve the screening of characteristic wavelengths. The wavelengths are selected in order from high to low according to the comprehensive weight of the wavelengths, and the selected wavelengths are compared with the preset dynamic termination threshold. Specifically, when the cross-validation root mean square error change rate caused by the selected wavelength is less than 1%, the screening is terminated, and then the candidate wavelengths are screened out to avoid the complication of the constructed food quality quantitative analysis model due to excessive screening. The screened candidate wavelengths are orthogonalized to form characteristic wavelengths of near-infrared spectral information, eliminate the collinearity effect of the selected wavelengths, eliminate redundancy and optimize information density, and improve the screening efficiency of characteristic wavelengths.
[0031] In a preferred example, the present application may be further configured as follows: before outputting the component content prediction value according to the food quality quantitative analysis model, the food quality component analysis method based on near infrared spectroscopy technology further includes:
[0032] Collecting spectral data of standard substances, and calculating a model drift correction coefficient based on the spectral data of the standard substances;
[0033] When the model drift correction coefficient is greater than a preset coefficient threshold, adjusting the model intercept term;
[0034] The regression coefficient matrix of the model is updated based on the adjusted model intercept term, and the food quality quantitative analysis model is updated using the updated regression coefficient matrix.
[0035] By adopting the above technical scheme, before using the food quality quantitative analysis model to output the prediction results of the quality components of the food to be tested, by regularly collecting the spectral data of the standard substance and calculating the model drift correction coefficient, the performance attenuation of the detection model can be quantified. When the model drift correction coefficient is greater than the preset coefficient threshold of 2%, the model intercept term is proportionally adjusted to directly eliminate the systematic error caused by the instrument baseline drift or the change of the ambient temperature and humidity. The regression coefficient matrix is synchronously updated based on the adjusted intercept term, and the food quality quantitative analysis model is updated using the updated regression coefficient matrix, thereby realizing the dynamic calibration function of the food quality quantitative analysis model. When detecting different batches or different types of food, the food quality quantitative analysis model can be automatically calibrated, thereby improving the accuracy of the detection results and shortening the model calibration time, thereby improving the detection efficiency.
[0036] In the second aspect, the above invention objective of the present application is achieved through the following technical solutions:
[0037] A food quality component analysis system based on near infrared spectroscopy technology, the food quality component analysis system based on near infrared spectroscopy technology comprising:
[0038] A food infrared spectrum acquisition module is used to obtain a food sample set, obtain original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data;
[0039] A spectrum preprocessing module, used for preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix;
[0040] A model building module, for extracting characteristic wavelengths of the near-infrared spectrum information based on the processed spectrum matrix, building a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model;
[0041] The analysis report generation module is used to generate a quality component analysis report of the food to be tested based on the predicted value of the component content.
[0042] By adopting the above technical scheme, in the process of analyzing the quality and composition of food, by collecting representative food samples to form a food sample set, it is ensured that the samples cover the main types of target food, processing methods and other factors that may affect the quality and composition, so as to fully reflect the quality and composition characteristics of food when establishing a prediction model, and provide a solid foundation for subsequent spectral acquisition and model establishment. The food samples in the food sample set are spectrally scanned using a near-infrared spectrometer to obtain their original near-infrared spectral information, and the original near-infrared spectral information is pre-processed, including smoothing filtering, baseline correction and normalization, so as to reduce noise interference and eliminate the influence of baseline drift on spectral data, so as to enhance spectral characteristics. In order to improve data comparability and spectral data quality, the feature selection method of continuous projection algorithm is used for the processed near-infrared spectral information to extract the characteristic wavelengths most relevant to food quality and ingredients. According to the extracted characteristic wavelengths, combined with the least squares regression algorithm, a food quality quantitative analysis model is constructed to effectively solve the problem of multicollinearity. The constructed food quality quantitative analysis model is used to output the predicted value of ingredient content. According to the output predicted value of ingredient content, a food quality ingredient analysis report is generated. Through systematic data processing and modeling process, the accuracy, efficiency and reliability of food quality ingredient detection are significantly improved, and the rapid, non-destructive and accurate detection of food quality and ingredients is realized, and the accuracy and precision of detection are improved.
[0043] On the third aspect, the above-mentioned purpose of the present application is achieved through the following technical solutions:
[0044] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned food quality component analysis method based on near infrared spectroscopy technology are implemented.
[0045] Fourthly, the above-mentioned purpose of the present application is achieved through the following technical solutions:
[0046] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned food quality component analysis method based on near-infrared spectroscopy technology.
[0047] In summary, the present application includes at least one of the following beneficial technical effects:
[0048] 1. Use a near-infrared spectrometer to perform spectral scanning on the food samples in the food sample set to obtain their original near-infrared spectral information. Preprocess the original near-infrared spectral information, including smoothing filtering, baseline correction and normalization, to reduce noise interference and eliminate the influence of baseline drift on spectral data, so as to enhance spectral characteristics and improve data comparability and spectral data quality. Use the feature selection method of the continuous projection algorithm for the processed near-infrared spectral information to extract the characteristic wavelengths most relevant to food quality and ingredients. Based on the extracted characteristic wavelengths and combined with the least squares regression algorithm, a food quality quantitative analysis model is constructed to effectively solve the problem of multicollinearity. The constructed food quality quantitative analysis model is used to output the predicted value of the component content. Based on the output predicted value of the component content, a food quality component analysis report is generated. Through the systematic data processing and modeling process, the accuracy, efficiency and reliability of food quality component detection are significantly improved, and the rapid, non-destructive and accurate detection of food quality and ingredients is achieved, and the accuracy and precision of detection are improved.
[0049] 2. After collecting the near-infrared spectra of the food to be tested, all near-infrared spectra are integrated to form an original infrared spectrum matrix. The original infrared spectrum matrix is subjected to MSC correction and linear regression to generate a corrected spectrum matrix, which effectively eliminates the scattering effect caused by the difference in sample particle size. The corrected matrix is then processed by first-order derivative filtering to eliminate baseline drift and sharpen the absorption peak, thereby improving the signal-to-noise ratio at the characteristic wavelength. The spectrum intensity is compressed to the [0,1] interval through range normalization to eliminate the influence of optical path differences and reduce the prediction error of foods of different thicknesses.
[0050] 3. In the collected near-infrared spectrum data of the food to be tested, abnormal spectra due to various reasons are prone to appear. By comparing the Mahalanobis distance between each spectrum to be tested and the standard spectrum in the original infrared spectrum matrix with the preset distance threshold, when the Mahalanobis distance between the spectrum to be tested and the standard spectrum is greater than the preset distance threshold, the spectrum data is marked as an abnormal spectrum, and Gaussian weighted smoothing is performed on the abnormal spectrum to obtain repaired spectrum data, and it is determined whether the repaired spectrum data is a normal spectrum. If so, the repaired spectrum data is updated to the spectrum matrix, so that the abnormal spectrum in the spectrum matrix can be repaired, which is conducive to improving the accuracy of food quality component detection results;
[0051] 4. Before using the food quality quantitative analysis model to output the prediction results of the quality components of the food to be tested, the performance attenuation of the detection model can be quantified by regularly collecting the spectral data of the standard substance and calculating the model drift correction coefficient. When the model drift correction coefficient is greater than the preset coefficient threshold of 2%, the model intercept term is proportionally adjusted to directly eliminate the systematic errors caused by the instrument baseline drift or the changes in ambient temperature and humidity. The regression coefficient matrix is synchronously updated based on the adjusted intercept term, and the food quality quantitative analysis model is updated using the updated regression coefficient matrix, thereby realizing the dynamic calibration function of the food quality quantitative analysis model. When detecting different batches or different types of food, the food quality quantitative analysis model can be automatically calibrated, thereby improving the accuracy of the test results and shortening the model calibration time, thereby improving the detection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 This is a flow chart of a method for analyzing food quality components based on near infrared spectroscopy technology in one embodiment of the present application;
[0053] Figure 2 This is a flowchart for implementing step S20 in the food quality component analysis method based on near infrared spectroscopy technology in one embodiment of the present application;
[0054] Figure 3 This is a flowchart of abnormal spectrum processing of a food quality component analysis method based on near infrared spectroscopy technology in one embodiment of the present application;
[0055] Figure 4 This is a flowchart for implementing step S30 in the food quality component analysis method based on near infrared spectroscopy technology in one embodiment of the present application;
[0056] Figure 5 This is a flowchart for implementing model updating in a food quality component analysis method based on near infrared spectroscopy technology in one embodiment of the present application;
[0057] Figure 6 This is a principle block diagram of a food quality component analysis system based on near infrared spectroscopy technology in one embodiment of the present application;
[0058] Figure 7 It is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The present application is further described in detail below in conjunction with the accompanying drawings.
[0060] In one embodiment, if Figure 1 As shown, the present application discloses a method for analyzing food quality components based on near infrared spectroscopy technology, which specifically includes the following steps:
[0061] S10: Acquire a food sample set, acquire original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data.
[0062] Specifically, in the process of analyzing the quality and composition of food, representative food samples are collected to form a food sample set to ensure that the samples cover the main types of target foods, processing methods and other factors that may affect the quality and composition, so as to fully reflect the quality and composition characteristics of the food when establishing a prediction model, and provide a solid foundation for subsequent spectral acquisition and model building. A near-infrared spectrometer is used to perform spectral scanning on the food samples in the food sample set, where the spectrum covers a wavenumber range of 900cm-1 to 2500cm-1, the resolution is set to 8cm-1, and each sample is scanned 32 times to obtain its original near-infrared spectral information.
[0063] S20: preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix.
[0064] Specifically, the raw near-infrared spectral information is preprocessed, including smoothing filtering, baseline correction and normalization, to reduce noise interference and eliminate the influence of baseline drift on spectral data, so as to enhance spectral characteristics and improve data comparability and improve spectral data quality.
[0065] S30: extracting characteristic wavelengths of the near-infrared spectral information based on the processed spectral matrix, constructing a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model.
[0066] Specifically, the feature selection method of the continuous projection algorithm is used for the processed near-infrared spectral information to extract the characteristic wavelengths most relevant to food quality and composition. According to the extracted characteristic wavelengths, combined with the least squares regression algorithm, a food quality quantitative analysis model is constructed to effectively solve the multicollinearity problem. Specifically, the construction process of the food quality quantitative analysis model is as follows:
[0067] The ridge regression algorithm is used to correct the regression coefficient. The ridge regression correction coefficient ensures the stability of the model. The variable importance projection index is calculated based on the corrected coefficient. The variable importance projection index is used to screen the wavelength and establish a confidence interval. The screened variables reduce redundancy and make the confidence interval more reliable. According to the regression coefficient and confidence interval, a quantitative analysis model of food quality is constructed.
[0068] Furthermore, the constructed food quality quantitative analysis model is used to output the predicted value of the component content, as shown in the following formula:
[0069]
[0070] Among them, βj is the regression coefficient, x(λ j ) represents the absorbance value at the characteristic wavelength λj.
[0071] S40: Generate a quality component analysis report of the food to be tested based on the predicted component content.
[0072] Specifically, a food quality ingredient analysis report is generated based on the output predicted value of ingredient content. Through systematic data processing and modeling processes, the accuracy, efficiency and reliability of food quality ingredient testing are significantly improved.
[0073] In this embodiment, during the quality and component analysis of food, representative food samples are collected to form a food sample set, ensuring that the samples cover the main types of target foods, processing methods and other factors that may affect the quality and composition, so as to fully reflect the quality and component characteristics of the food when establishing a prediction model, providing a solid foundation for subsequent spectral acquisition and model establishment, and using a near-infrared spectrometer to perform spectral scanning on the food samples in the food sample set to obtain their original near-infrared spectral information. The original near-infrared spectral information is pre-processed, including smoothing filtering, baseline correction and normalization processing, etc., to reduce noise interference and eliminate the influence of baseline drift on spectral data, so as to enhance spectral characteristics and Improve data comparability, improve spectral data quality, use the feature selection method of continuous projection algorithm for the processed near-infrared spectral information, extract the characteristic wavelengths most relevant to food quality and ingredients, and construct a food quality quantitative analysis model based on the extracted characteristic wavelengths in combination with the least squares regression algorithm to effectively solve the problem of multicollinearity. Use the constructed food quality quantitative analysis model to output the predicted value of ingredient content, and generate a food quality ingredient analysis report based on the output predicted value of ingredient content. Through systematic data processing and modeling processes, the accuracy, efficiency and reliability of food quality ingredient detection are significantly improved, and rapid, non-destructive and accurate detection of food quality and ingredients is achieved, thereby improving the accuracy and precision of detection.
[0074] In one embodiment, if Figure 2 As shown, in step S20, the original infrared spectrum matrix is preprocessed to generate a processed spectrum matrix, which specifically includes:
[0075] S21: performing MSC correction on the original infrared spectrum matrix, performing linear regression on each original infrared spectrum, and obtaining a corrected infrared spectrum.
[0076] Specifically, after collecting the near infrared spectrum of the food to be tested, all near infrared spectra are integrated to form an original infrared spectrum matrix, and the original infrared spectrum matrix is subjected to MSC correction:
[0077] Wherein, a represents the baseline offset, and b represents the linear scaling factor, which is determined by fitting the linear relationship between the measured spectrum and the reference spectrum using the least squares method;
[0078] Generate a corrected spectral matrix that effectively eliminates the scattering effect caused by differences in sample particle size.
[0079] S22: Apply first-order derivative filtering to the corrected infrared spectrum and perform normalization processing to generate a processed spectrum matrix.
[0080] Specifically, the corrected samples were subjected to first-order derivative filtering, where the polynomial order was set to 3 and the sliding window width was 15 wave number points, to eliminate the baseline drift and sharpen the absorption peak, thereby improving the signal-to-noise ratio at the characteristic wavelength;
[0081] Furthermore, normalization processing is performed to compress the spectral intensity to the [0,1] interval through range normalization to eliminate the influence of optical path differences and reduce the prediction error of foods of different thicknesses.
[0082] In one embodiment, if Figure 3 As shown, in step S20, the original infrared spectrum matrix is preprocessed to generate a processed spectrum matrix, which also includes:
[0083] S23: determining the Mahalanobis distance between the spectrum to be measured and the standard spectrum based on the original infrared spectrum matrix.
[0084] Specifically, in the collected near-infrared spectrum data of the food to be tested, abnormal spectra due to various reasons are likely to appear. The Mahalanobis distance between each spectrum to be tested and the standard spectrum in the original infrared spectrum matrix is calculated according to the following formula:
[0085] μ is the standard spectral mean vector, Σ is the covariance matrix;.
[0086] S24: When the Mahalanobis distance between the spectrum to be tested and the standard spectrum is greater than a preset distance threshold, it is marked as an abnormal spectrum.
[0087] Specifically, the Mahalanobis distance between each spectrum to be measured and the standard spectrum in the infrared spectrum matrix is greater than a preset distance threshold. The spectrum data is marked as an abnormal spectrum.
[0088] S25: performing Gaussian weighted smoothing processing on the abnormal spectrum to obtain repaired spectrum data, and determining whether the repaired spectrum data is a normal spectrum. If so, updating the repaired spectrum data into the spectrum matrix.
[0089] Specifically, Gaussian weighted smoothing is performed on the abnormal spectrum to obtain repaired spectrum data, and it is determined whether the repaired spectrum data is a normal spectrum. If so, the repaired spectrum data is updated to the spectrum matrix, and then the abnormal spectrum in the spectrum matrix can be repaired, which is beneficial to improve the accuracy of food quality component detection results.
[0090] In one embodiment, if Figure 4 As shown, in step S30, the characteristic wavelength of the near-infrared spectrum information is extracted based on the processed spectrum matrix, which specifically includes:
[0091] S31: Calculate the comprehensive weight of each spectral wavelength based on the processed spectral matrix.
[0092] Specifically, according to the formula: In the formula, ρ(x i ,y) is the correlation coefficient between wavelength j and target component, is the absorbance variance at wavelength j. By integrating the correlation coefficient between wavelength and target food components, namely absorbance variance, a dual-factor comprehensive weight is constructed. The synergy of the two is conducive to improving the screening of characteristic wavelengths.
[0093] S32: selecting wavelengths in sequence according to the comprehensive weights of the wavelengths of the spectrum, and screening out candidate wavelengths according to a preset dynamic termination threshold for the selected wavelengths.
[0094] Specifically, wavelengths are selected in order from high to low according to their comprehensive weights, and the selected wavelengths are compared with a preset dynamic termination threshold. Specifically, when the cross-validation root mean square error change rate caused by the selected wavelength is less than 1%, the screening is terminated, and then the candidate wavelengths are screened out to avoid complicating the constructed food quality quantitative analysis model due to excessive screening.
[0095] S33: Orthogonalizing the candidate wavelengths to form characteristic wavelengths of near-infrared spectrum information.
[0096] Specifically, the selected candidate wavelengths are orthogonalized, and the redundant wavelengths whose absolute value of the correlation coefficient with the selected wavelength exceeds 0.9 are eliminated to form the characteristic wavelengths of the near-infrared spectral information, eliminate the collinearity effect of the selected wavelengths, optimize the information density by eliminating redundancy, and improve the screening efficiency of the characteristic wavelengths.
[0097] In one embodiment, if Figure 5 As shown, before outputting the component content prediction value according to the food quality quantitative analysis model, the food quality component analysis method based on near infrared spectroscopy technology also includes:
[0098] S301: Collecting spectral data of standard substances, and calculating a model drift correction coefficient based on the spectral data of standard substances.
[0099] Specifically, before using the food quality quantitative analysis model to output the prediction results of the quality components of the food to be tested, the performance attenuation of the detection model can be quantified by regularly collecting spectral data of standard substances and calculating the model drift correction coefficient.
[0100] S302: When the model drift correction coefficient is greater than a preset coefficient threshold, adjust the model intercept term.
[0101] Specifically, when the model drift correction coefficient is greater than a preset coefficient threshold of 2%, the model intercept term is adjusted proportionally to directly eliminate the systematic error caused by instrument baseline drift or changes in ambient temperature and humidity.
[0102] S303: updating the regression coefficient matrix of the model based on the adjusted model intercept term, and updating the food quality quantitative analysis model using the updated regression coefficient matrix.
[0103] Specifically, the regression coefficient matrix is synchronously updated based on the adjusted intercept term, and the food quality quantitative analysis model is updated using the updated regression coefficient matrix, thereby realizing the dynamic calibration function of the food quality quantitative analysis model. When detecting different batches or different types of food, the food quality quantitative analysis model can be automatically calibrated, thereby improving the accuracy of the test results and shortening the model calibration time, thereby improving the detection efficiency.
[0104] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0105] In one embodiment, a food quality component analysis system based on near infrared spectroscopy technology is provided, and the food quality component analysis system based on near infrared spectroscopy technology corresponds one-to-one to the food quality component analysis method based on near infrared spectroscopy technology in the above embodiment. Figure 6 As shown in the figure, the food quality component analysis system based on near infrared spectroscopy technology includes food infrared spectrum acquisition module, spectrum preprocessing module, model building module and analysis report generation module. The detailed description of each functional module is as follows:
[0106] A food infrared spectrum acquisition module is used to obtain a food sample set, obtain original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data;
[0107] A spectrum preprocessing module, used for preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix;
[0108] A model building module, for extracting characteristic wavelengths of the near-infrared spectrum information based on the processed spectrum matrix, building a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model;
[0109] The analysis report generation module is used to generate a quality component analysis report of the food to be tested based on the predicted value of the component content.
[0110] Preferably, the spectrum preprocessing module includes:
[0111] An MSC correction submodule is used to perform MSC correction on the original infrared spectrum matrix, perform linear regression on each original infrared spectrum, and obtain a corrected infrared spectrum;
[0112] The first-order derivative filtering submodule is used to apply first-order derivative filtering to the corrected infrared spectrum and perform normalization processing to generate a processed spectrum matrix.
[0113] Preferably, the model building module includes:
[0114] A spectrum wavelength weight determination submodule, used for calculating the comprehensive weight of each spectrum wavelength based on the processed spectrum matrix;
[0115] The wavelength screening submodule is used to select wavelengths in turn according to the comprehensive weights of the wavelengths of the spectrum, and screen out candidate wavelengths according to a preset dynamic termination threshold value for the selected wavelengths;
[0116] The characteristic wavelength generation submodule is used to perform orthogonal processing on the candidate wavelengths to form characteristic wavelengths of near-infrared spectrum information.
[0117] For the specific limitations of the food quality component analysis system based on near-infrared spectroscopy technology, please refer to the limitations of the food quality component analysis method based on near-infrared spectroscopy technology mentioned above, which will not be repeated here. Each module in the above-mentioned food quality component analysis system based on near-infrared spectroscopy technology can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0118] In one embodiment, an electronic device is provided. The electronic device may be a server, and its internal structure diagram may be as follows: Figure 7As shown. The electronic device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store food near-infrared spectra and food quality quantitative analysis models. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a food quality component analysis method based on near-infrared spectroscopy technology is implemented.
[0119] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0120] Acquire a food sample set, acquire original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data;
[0121] Preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix;
[0122] Extracting characteristic wavelengths of the near-infrared spectrum information based on the processed spectrum matrix, constructing a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model;
[0123] A quality component analysis report of the food to be tested is generated based on the predicted component content.
[0124] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0125] Acquire a food sample set, acquire original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data;
[0126] Preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix;
[0127] Extracting characteristic wavelengths of the near-infrared spectrum information based on the processed spectrum matrix, constructing a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model;
[0128] A quality component analysis report of the food to be tested is generated based on the predicted component content.
[0129] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0130] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0131] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for analyzing food quality components based on near infrared spectroscopy technology, characterized in that: The food quality component analysis method based on near infrared spectroscopy technology comprises the following steps: Acquire a food sample set, acquire original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data; Preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix; Extracting characteristic wavelengths of the near-infrared spectrum information based on the processed spectrum matrix, constructing a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model; A quality component analysis report of the food to be tested is generated based on the predicted component content.
2. The method for analyzing food quality components based on near infrared spectroscopy according to claim 1, characterized in that: The preprocessing of the original infrared spectrum matrix to generate a processed spectrum matrix specifically includes: Performing MSC correction on the original infrared spectrum matrix, performing linear regression on each original infrared spectrum to obtain a corrected infrared spectrum; The corrected infrared spectrum is filtered by first-order derivative and normalized to generate a processed spectrum matrix.
3. The method for analyzing food quality components based on near infrared spectroscopy according to claim 1, characterized in that: The preprocessing of the original infrared spectrum matrix to generate a processed spectrum matrix also includes: Determine the Mahalanobis distance between the spectrum to be tested and the standard spectrum based on the original infrared spectrum matrix; When the Mahalanobis distance between the spectrum to be tested and the standard spectrum is greater than the preset distance threshold, it is marked as an abnormal spectrum; Gaussian weighted smoothing is performed on the abnormal spectrum to obtain repaired spectrum data, and it is determined whether the repaired spectrum data is a normal spectrum. If so, the repaired spectrum data is updated into the spectrum matrix.
4. The method for analyzing food quality components based on near infrared spectroscopy according to claim 1, characterized in that: The step of extracting the characteristic wavelength of the near-infrared spectrum information based on the processed spectrum matrix specifically includes: Calculating the comprehensive weight of each spectral wavelength based on the processed spectral matrix; Select wavelengths in turn according to the comprehensive weights of the wavelengths of the spectrum, and screen out candidate wavelengths according to a preset dynamic termination threshold for the selected wavelengths; The candidate wavelengths are orthogonalized to form characteristic wavelengths of near-infrared spectral information.
5. The method for analyzing food quality components based on near infrared spectroscopy according to claim 1, characterized in that: Before outputting the component content prediction value according to the food quality quantitative analysis model, the food quality component analysis method based on near infrared spectroscopy technology also includes: Collecting spectral data of standard substances, and calculating a model drift correction coefficient based on the spectral data of the standard substances; When the model drift correction coefficient is greater than a preset coefficient threshold, adjusting the model intercept term; The regression coefficient matrix of the model is updated based on the adjusted model intercept term, and the food quality quantitative analysis model is updated using the updated regression coefficient matrix.
6. A food quality component analysis system based on near infrared spectroscopy technology, characterized in that: The food quality component analysis system based on near infrared spectroscopy technology includes: A food infrared spectrum acquisition module is used to obtain a food sample set, obtain original near-infrared spectrum data based on the food sample set, and form an original infrared spectrum matrix according to the combination of the original near-infrared spectrum data; A spectrum preprocessing module, used for preprocessing the original infrared spectrum matrix to generate a processed spectrum matrix; A model building module, for extracting characteristic wavelengths of the near-infrared spectrum information based on the processed spectrum matrix, building a food quality quantitative analysis model based on the characteristic wavelengths in combination with a partial least squares regression algorithm, and outputting a component content prediction value based on the food quality quantitative analysis model; The analysis report generation module is used to generate a quality component analysis report of the food to be tested based on the predicted value of the component content.
7. The food quality component analysis system based on near infrared spectroscopy technology according to claim 6 is characterized in that: The spectrum preprocessing module comprises: An MSC correction submodule is used to perform MSC correction on the original infrared spectrum matrix, perform linear regression on each original infrared spectrum, and obtain a corrected infrared spectrum; The first-order derivative filtering submodule is used to apply first-order derivative filtering to the corrected infrared spectrum and perform normalization processing to generate a processed spectrum matrix.
8. The food quality component analysis system based on near infrared spectroscopy technology according to claim 6, characterized in that: The model building module includes: A spectrum wavelength weight determination submodule, used for calculating the comprehensive weight of each spectrum wavelength based on the processed spectrum matrix; The wavelength screening submodule is used to select wavelengths in turn according to the comprehensive weights of the wavelengths of the spectrum, and screen out candidate wavelengths according to a preset dynamic termination threshold value for the selected wavelengths; The characteristic wavelength generation submodule is used to perform orthogonal processing on the candidate wavelengths to form characteristic wavelengths of near-infrared spectrum information.
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 processor executes the computer program, the steps of the food quality component analysis method based on near-infrared spectroscopy technology as described in any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of a method for analyzing food quality components based on near-infrared spectroscopy technology as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method for detecting polymer body temperature
CN101561325A
Near infrared spectrum information extraction method based on canonical correlation coefficients
CN105891147A
Method for detecting internal quality of fruits with near infrared spectrum and special detection system
CN106841103A
Near-infrared quantitation system for proteins and fats in coffee milk beverage, and establishment method thereof
CN108572155A
Apple quality rapid nondestructive testing method based on near infrared technology
CN111537469A
Cited By
Textile fiber component qualitative online analysis system and method
CN120404644A
Wine brewing raw material quality detection system based on near infrared spectrum
CN120847027A
Multispectral quantitative analysis method and device for components of mixture
CN121384840A
Fruit and vegetable quality nondestructive testing method and system based on spectrum technology
CN121431424A
Food nutritional ingredient rapid metering detection and label generation system
CN122259494A