Raman spectrum sugar degree detection method and system based on temperature compensation
By eliminating abnormal temperature spectra during beer saccharification, establishing a temperature correction model, screening key characteristic wavelengths, and constructing a dual-input neural network model, the problem of temperature variation interfering with Raman spectroscopy detection was solved, and high-precision saccharin content prediction was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-03
AI Technical Summary
Existing Raman spectroscopy techniques cannot effectively compensate for spectral peak shifts and intensity fluctuations caused by temperature changes during beer saccharification, resulting in insufficient detection accuracy. Furthermore, anomaly removal and feature screening methods have poor generalization in dynamic temperature environments.
By collecting Raman spectral data at different temperatures, eliminating abnormal temperature spectra, establishing a spectral temperature correction model for compensation, and constructing a dual-input neural network model by selecting key characteristic wavelengths to capture the temperature-sugar content coupling relationship for sugar content prediction.
It significantly improves the accuracy and precision of sugar content detection, reduces the impact of temperature interference, enhances the generalization and stability of the model, and adapts to complex temperature dynamic changes.
Smart Images

Figure CN121783945A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spectral analysis technology, and in particular to a method and system for detecting sugar content using Raman spectroscopy based on temperature compensation. Background Technology
[0002] The saccharification stage of beer is the core step in the enzymatic hydrolysis of starch to produce fermentable sugars, and changes in sugar content directly determine the saccharification endpoint, fermentation efficiency, and beer flavor. Taking barley beer as an example, the temperature during the saccharification stage exhibits a dynamic gradient change (protein rest at 50℃ → saccharification at 65℃ → enzyme activity termination at 78℃), and the wort matrix contains complex components such as starch decomposition products, proteases, and β-glucan, which significantly interfere with spectral detection.
[0003] The existing technology has the following key drawbacks:
[0004] (1) Temperature interference: Although Raman spectroscopy is resistant to water interference to a certain extent, temperature changes will cause the vibrational energy level of wort molecules to shift, resulting in peak position drift (e.g., the sugar characteristic peak at 850 cm-1 can shift by ±3 cm-1 in the 50℃-78℃ range) and peak intensity fluctuation (attenuation rate of 15%-20%). Existing technologies have not designed a compensation mechanism for dynamic temperature changes, and the prediction error of the model varies significantly in different temperature ranges (RMSEP can increase from 0.6 to 1.5 Brix).
[0005] (2) Insufficient accuracy in anomaly removal: Some schemes only remove abnormal samples based on spectral errors, but "temperature mutations" caused by fluctuations in steam heating during saccharification can cause instantaneous distortion of spectral signals. Simply relying on MCCV cannot identify such temperature-related anomalies, and it is easy to retain low-quality samples.
[0006] (3) Limitations of feature selection and modeling: Some technical solutions use conventional CARS to select wavelengths, but do not consider the sensitivity of wavelengths to temperature. The selected "sugar content sensitive wavelengths" may be greatly affected by temperature, resulting in poor model generalization. Moreover, existing modeling methods (such as single-input NN) do not incorporate temperature features, cannot capture the coupling relationship between "temperature and sugar content", and are difficult to adapt to dynamic temperature environments.
[0007] In summary, existing technologies cannot meet the high-precision detection requirements across the entire temperature range of wort saccharification. There is an urgent need for a Raman spectroscopy method for saccharification detection that can actively compensate for temperature interference and optimize anomaly removal and feature screening. Summary of the Invention
[0008] The technical problem to be solved by this invention is to provide a temperature-compensated Raman spectroscopy method and system for sugar content detection, with the aim of improving the accuracy and precision of Raman spectroscopy in sugar content detection.
[0009] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:
[0010] On one hand, the present invention provides a temperature-compensated Raman spectroscopy method for sugar content detection, the method comprising:
[0011] Step S1: Collect Raman spectral sample data at different temperatures and remove spectral data with abnormal temperatures;
[0012] Step S2: Establish a spectral temperature correction model, obtain the spectral characteristic peak shift and peak intensity attenuation rate based on Raman spectral sample data at different temperatures, and compensate the spectrum based on the spectral characteristic peak shift and peak intensity attenuation rate.
[0013] Step S3: Calculate the correlation coefficient between the compensated spectrum and sugar content and the coefficient of variation of spectral intensity at different temperatures for the same wavelength, and screen out key characteristic wavelengths based on the correlation coefficient and the coefficient of variation.
[0014] Step S4: Establish a neural network training model to predict sugar content based on the selected key feature wavelengths and temperatures.
[0015] Furthermore, the removal of spectral data with temperature anomalies in step S1 includes:
[0016] Set a temperature fluctuation threshold and filter spectral data whose temperature fluctuations exceed the threshold at adjacent times;
[0017] Monte Carlo cross-validation was performed on the collected spectral data, and the mean and variance of the prediction error for each spectral data point were calculated.
[0018] Remove spectral data where temperature fluctuations exceed a threshold at adjacent times, as well as spectral data where the mean or variance of the error is greater than a set value.
[0019] Furthermore, the spectral temperature correction model is as follows: ,in, This represents the characteristic peak shift. The intensity of the characteristic peak after correction. The original intensity of the characteristic peak, For temperature, , , , and All are constants.
[0020] Furthermore, step S2 also includes: performing SNV, baseline correction and / or first derivative processing on the spectrum after compensation based on spectral characteristic peak shift and peak intensity attenuation rate.
[0021] Furthermore, the coefficient of variation of spectral intensity mentioned in step S4 is: ,in The spectral intensity variation coefficient is... The average spectral intensity at different temperatures for the same wavelength. This represents the standard deviation of spectral intensity at different temperatures for the same wavelength.
[0022] Furthermore, in step S4, the selection of key feature wavelengths based on the correlation coefficient and the coefficient of variation includes: competitive adaptive reweighting sampling with R×(1-CV) as the comprehensive weight, and selecting wavelengths with a correlation coefficient R greater than or equal to a set value and a spectral intensity coefficient of variation CV less than or equal to a set value as key feature wavelengths.
[0023] Furthermore, the input layer of the neural network training model established in step S5 includes spectral feature wavelength channels and temperature channels.
[0024] On the other hand, the present invention also provides a temperature-compensated Raman spectroscopy sugar content detection system, the system comprising:
[0025] Data acquisition module: used to acquire Raman spectral sample data at different temperatures;
[0026] Anomaly Removal Module: Used to remove spectral data whose temperature fluctuations exceed a threshold at adjacent time points, as well as spectral data whose mean or variance of error is greater than a set value;
[0027] Temperature compensation module: used to compensate for the spectrum based on the shift of spectral characteristic peaks and the peak intensity attenuation rate;
[0028] Key Feature Wavelength Filtering Module: Used to filter out key feature wavelengths based on the correlation coefficient and the coefficient of variation;
[0029] The sugar content prediction module is used to predict sugar content based on the selected key feature wavelengths and temperatures.
[0030] Furthermore, the system also includes:
[0031] The preprocessing module is used to perform SNV, baseline correction and first derivative processing on the spectrum after compensation based on spectral characteristic peak shift and peak intensity attenuation rate.
[0032] Display and communication module: used to synchronously display real-time temperature, raw spectrum, compensated spectrum and sugar content prediction.
[0033] Furthermore, the data acquisition module includes a Raman spectrometer, a laser source, a Raman fiber optic probe, and a temperature sensor. The fiber optic probe and temperature sensor are installed on the inner wall of the circulation pipe of the saccharification tank.
[0034] The beneficial effects of this invention are:
[0035] (1) Temperature is incorporated as a key variable into the entire process of sugar content Raman spectroscopy detection, and the interference of temperature on sugar content detection is actively eliminated by establishing a spectral temperature correction model;
[0036] (2) This invention combines a temperature mutation threshold to first screen high-risk samples and then uses Monte Carlo cross-validation, which effectively improves the accuracy of removing abnormal spectral data.
[0037] (3) Competitive adaptive reweighting sampling is performed using R×(1-CV) as the comprehensive weight. Wavelengths with correlation coefficient R greater than or equal to the set value and spectral intensity variation coefficient CV less than or equal to the set value are selected as key features. The selected wavelengths are more robust and effectively improve the generalization of the model.
[0038] (4) Dual-input modeling breaks through the limitations of single-input neural network training model by adding temperature input. The stability of the model for full temperature range detection based on the captured "temperature-sugar content" coupling relationship is significantly improved. Attached Figure Description
[0039] Figure 1 This is a flowchart of the temperature-compensated Raman spectroscopy method for sugar content detection according to the present invention;
[0040] Figure 2 This is a graph showing the results of outlier removal during the outlier sample removal process.
[0041] Figure 3 The calibration set and prediction set representations of the Raman spectroscopy NN model after the model is built;
[0042] Figure 4 This is a schematic diagram of the temperature-compensated Raman spectroscopy sugar content detection system of the present invention. Detailed Implementation
[0043] The core of the technical solution of this invention to solve the above-mentioned technical problems is: synchronously acquiring Raman spectral signals and real-time temperature data of saccharified wort, preprocessing the acquired spectral data to remove spectral data with abnormal temperatures, and then correcting spectral peak position drift and peak intensity fluctuations through an established spectral temperature correction model. Subsequently, competitive adaptive reweighted sampling with temperature correlation weighting is used to screen characteristic wavelengths that are "saccharin sensitive and temperature robust". Finally, a dual-input neural network model of "spectral features and temperature features" is constructed to achieve high-precision prediction of saccharin under complex temperature dynamic changes, significantly improve the detection stability of different temperature ranges in the saccharification process, and provide reliable support for the intelligent control of beer saccharification process.
[0044] The technical solution to be protected by the present invention will be further explained and described below with reference to the accompanying drawings and embodiments.
[0045] like Figure 1The temperature-compensated Raman spectroscopy method for sugar content detection according to the present invention includes:
[0046] Step S1: Collect Raman spectral data at different temperatures
[0047] A Raman fiber optic probe (immersion type, in direct contact with the wort) and a platinum resistance temperature sensor (3 cm apart) are installed in the stable flow area of the circulation pipeline in the mash saccharification tank. The sampling frequency is 1 time / minute to ensure that each Raman spectrum corresponds to a unique temperature data. The collected spectral data is stored as a "spectrum-temperature" correlated dataset.
[0048] Step S2: Temperature-related anomaly removal
[0049] Step 1: Set a temperature fluctuation threshold. In this implementation, the temperature fluctuation threshold is ±2℃. Filter out "temperature abrupt change samples" where the temperature difference between adjacent times exceeds 2℃ and mark them as high risk.
[0050] Step 2: Perform Monte Carlo cross-validation on all samples, such as... Figure 2 As shown, 80% of the samples are randomly sampled as a temporary calibration set and 20% as a temporary prediction set. This process is repeated 500 times, and the mean and variance of the prediction error for each sample are calculated.
[0051] Step 3: Remove samples with "temperature abrupt changes" and "mean error > 1.0 Brix or variance > 0.3", and retain the valid spectra.
[0052] Step S3: Temperature compensation pretreatment:
[0053] Construct a temperature correction model: Prepare standard samples of raw materials for the 10Brix saccharification process, and collect Raman spectra at 50℃, 55℃, 60℃, 65℃, 70℃, 75℃, and 78℃. Calculate the peak position shift (Δλ) and peak intensity attenuation rate (ΔI) of the characteristic peaks (850cm-1, 1120cm-1, and 1380cm-1).
[0054] The spectral temperature correction model is as follows: ,in, This represents the characteristic peak shift. The intensity of the characteristic peak after correction. The original intensity of the characteristic peak, For temperature, , , , and All are constants.
[0055] Real-time compensation: Substitute the effective spectrum obtained in step S2 into the above model, and correct the peak position and peak intensity by characteristic peak shift and peak intensity attenuation rate.
[0056] As a further preferred option, the temperature-corrected spectrum is further subjected to SNV (to eliminate scattering interference), baseline correction (polynomial fitting to subtract background), and / or first derivative (to enhance peak resolution) to obtain the compensated spectrum.
[0057] Step S4: TC-CARS Feature Selection
[0058] Calculate wavelength-to-sugar content correlation: For each wavelength of the compensated spectrum, calculate its Pearson correlation coefficient with the measured sugar content.
[0059] Calculate the temperature sensitivity coefficient: The temperature sensitivity coefficient is the coefficient of variation of the intensity of the same wavelength at different temperatures. ,in The spectral intensity variation coefficient is... The average spectral intensity at different temperatures for the same wavelength. This represents the standard deviation of spectral intensity at different temperatures for the same wavelength.
[0060] CARS weighted screening: In the calculation of variable weights in CARS, “R×(1-CV)” is introduced as a comprehensive weight, and wavelengths with “R≥0.8 and CV≤0.2” are retained first, and finally multiple key feature wavelengths are obtained.
[0061] Step S5: Sugar Content Prediction Model
[0062] The samples were divided into three layers based on saccharification temperature (50℃, 65℃, and 78℃). Within each layer, a calibration set (used for model training) and a prediction set (used for performance validation) were divided in a 7:3 ratio to ensure that the temperature distribution of the two sets of samples was consistent.
[0063] The sugar content prediction model is built on basic models such as PLS, LS-SVM, NN, CNN or LST. The performance of neural network prediction models built on different basic models is evaluated. In this embodiment, the neural network model built on NN is finally selected.
[0064] The sugar content prediction model structure includes: input layer (multiple spectral input feature channels and one temperature input feature channel) → hidden layer 1 (64 neurons, ReLU activation) → hidden layer 2 (32 neurons, ReLU activation) → output layer (1 neuron, linear activation).
[0065] Training parameters: learning rate 0.001, batch size 32, number of iterations 100, loss function is mean squared error (MSE).
[0066] Performance validation: Validation results on the prediction set show R²=0.991, RMSEP=0.42Brix, and RPD=6.8.
[0067] After the real-time acquired "spectral-temperature" data is processed through the above steps, it is input into a dual-input neural network to output a sugar content prediction value with a response time of less than 30 seconds.
[0068] The prediction set samples that were not involved in the modeling process during training were input into the model to independently verify its generalization ability, and the neural network model that passed the verification was used as the final sugar content prediction model.
[0069] Example:
[0070] Raw materials: highland barley malt (protein content 10.5%), mashed according to the conventional highland barley beer process (50℃×50min→65℃×90min→78℃×10min);
[0071] Equipment: Raman spectrometer (excitation wavelength 785nm, integration time 1400ms), platinum resistance temperature sensor (accuracy ±0.1℃), refractometer (saccharimetry measurement accuracy ±0.01Brix).
[0072] Sample size: 345 "spectrum-temperature-saccharin content" correlated samples were collected from 15 consecutive batches of the saccharification process. The comparison results between the saccharin content measured using the temperature-compensated Raman spectroscopy saccharin content detection method described in this invention and the saccharin content measured directly based on Raman spectroscopy data are shown in Table 1 and... Figure 3 As shown.
[0073] Table 1 Testing Plan Correction set R² Prediction set R² Prediction set RMSEP (Brix) RMSEP fluctuations (Brix) across different temperature ranges Existing solution (without temperature compensation) 0.978 0.952 0.85 0.62-1.48 The present invention (temperature compensation) 0.995 0.991 0.42 0.38-0.45
[0074] The results show that the prediction accuracy of the present invention is significantly improved, and the error fluctuation in different temperature ranges is reduced by more than 80%, thus solving the temperature interference problem of the existing solutions.
[0075] On the other hand, the present invention also provides a temperature-compensated Raman spectroscopy sugar content detection system, the system as follows: Figure 4 As shown, it specifically includes:
[0076] Data acquisition module: used to acquire Raman spectral sample data at different temperatures;
[0077] Anomaly Removal Module: Used to remove spectral data whose temperature fluctuations exceed a threshold at adjacent time points, as well as spectral data whose mean or variance of error is greater than a set value;
[0078] Temperature compensation module: used to compensate for the spectrum based on the shift of spectral characteristic peaks and the peak intensity attenuation rate;
[0079] The preprocessing module is used to perform SNV, baseline correction and first derivative processing on the spectrum after compensation based on spectral characteristic peak shift and peak intensity attenuation rate.
[0080] Key Feature Wavelength Filtering Module: Used to filter out key feature wavelengths based on the correlation coefficient and the coefficient of variation;
[0081] Sugar content prediction module: Used to predict sugar content based on the selected key feature wavelengths and temperatures.
[0082] Display and communication module: used to synchronously display real-time temperature, raw spectrum, compensated spectrum and sugar content prediction.
[0083] The data acquisition module includes a Raman spectrometer, a laser source, a Raman fiber optic probe, and a temperature sensor. The fiber optic probe and temperature sensor are installed on the inner wall of the circulation pipe in the mashing tank. The temperature sensor is a platinum resistance temperature sensor with a measurement range of 0-100℃ and an accuracy of ±0.1℃. The distance between the sensor and the Raman fiber optic probe is ≤5cm to ensure that the acquired temperature data and spectral data correspond to the same wort region.
[0084] The temperature compensation module supports regular updates. When the raw materials for the saccharification process are changed, data can be re-collected using standard samples to optimize the temperature compensation model parameters.
[0085] The sugar content prediction module has a built-in model performance monitoring unit. When the prediction error of a certain temperature range exceeds 0.5 Brix for three consecutive times, it will automatically trigger model fine-tuning and call historical samples of that temperature range to retrain the local parameters.
Claims
1. A temperature-compensated Raman spectroscopy-based method for sugar content detection, characterized in that, The method includes: Step S1: Collect Raman spectra at different temperatures and discard spectral data with abnormal temperatures; Step S2: Establish a spectral temperature correction model, obtain the spectral characteristic peak shift and peak intensity attenuation rate based on Raman spectral sample data at different temperatures, and compensate the spectrum based on the spectral characteristic peak shift and peak intensity attenuation rate. Step S3: Calculate the correlation coefficient between the compensated spectrum and sugar content and the coefficient of variation of spectral intensity at different temperatures for the same wavelength, and screen out key characteristic wavelengths based on the correlation coefficient and the coefficient of variation. Step S4: Establish a sugar content prediction model to predict sugar content based on the selected key feature wavelengths and temperatures.
2. The temperature-compensated Raman spectroscopy method for sugar content detection according to claim 1, characterized in that, The step S1 of removing spectral data with temperature anomalies includes: Set a temperature fluctuation threshold and filter spectral data whose temperature fluctuations exceed the threshold at adjacent times; Monte Carlo cross-validation was performed on the collected spectral data, and the mean and variance of the prediction error for each spectral data point were calculated. Remove spectral data where temperature fluctuations exceed a threshold at adjacent times, as well as spectral data where the mean or variance of the error is greater than a set value.
3. The temperature-compensated Raman spectroscopy method for sugar content detection according to claim 1, characterized in that, The spectral temperature correction model is as follows: ,in, This represents the characteristic peak shift. The intensity of the characteristic peak after correction. The original intensity of the characteristic peak, For temperature, , , , and All are constants.
4. The temperature-compensated Raman spectroscopy method for sugar content detection according to claim 1, characterized in that, Step S2 further includes performing SNV, baseline correction, and / or first derivative processing on the spectrum after compensation based on spectral characteristic peak shift and peak intensity attenuation rate.
5. The temperature-compensated Raman spectroscopy method for sugar content detection according to claim 1, characterized in that, The coefficient of variation of spectral intensity in step S4 is: ,in The spectral intensity variation coefficient is... The average spectral intensity at different temperatures for the same wavelength. This represents the standard deviation of spectral intensity at different temperatures for the same wavelength.
6. The temperature-compensated Raman spectroscopy method for sugar content detection according to claim 1, characterized in that, Step S4 involves selecting key feature wavelengths based on the correlation coefficient and the coefficient of variation, including: competitive adaptive reweighting sampling with R×(1-CV) as the comprehensive weight, and selecting wavelengths with a correlation coefficient R greater than or equal to a set value and a spectral intensity coefficient of variation CV less than or equal to a set value as key feature wavelengths.
7. The temperature-compensated Raman spectroscopy method for sugar content detection according to claim 1, characterized in that, The input layer of the sugar content prediction model established in step S5 includes spectral characteristic wavelength channels and temperature channels.
8. A temperature-compensated Raman spectroscopy-based sugar content detection system, used to implement the temperature-compensated Raman spectroscopy-based sugar content detection method according to any one of claims 1-7, characterized in that, The system includes: Data acquisition module: used to acquire Raman spectral sample data at different temperatures; Anomaly Removal Module: Used to remove spectral data whose temperature fluctuations exceed a threshold at adjacent time points, as well as spectral data whose mean or variance of error is greater than a set value; Temperature compensation module: used to compensate for the spectrum based on the shift of spectral characteristic peaks and the peak intensity attenuation rate; Key Feature Wavelength Filtering Module: Used to filter out key feature wavelengths based on the correlation coefficient and the coefficient of variation; The sugar content prediction module is used to predict sugar content based on the selected key feature wavelengths and temperatures.
9. The temperature-compensated Raman spectroscopy sugar content detection system according to claim 8, characterized in that, The system also includes: The preprocessing module is used to perform SNV, baseline correction and first derivative processing on the spectrum after compensation based on spectral characteristic peak shift and peak intensity attenuation rate. Display and communication module: used to synchronously display real-time temperature, raw spectrum, compensated spectrum and sugar content prediction.
10. The temperature-compensated Raman spectroscopy sugar content detection system according to claim 9, characterized in that, The data acquisition module includes a Raman spectrometer, a laser source, a Raman fiber optic probe, and a temperature sensor. The fiber optic probe and temperature sensor are installed on the inner wall of the circulation pipeline of the saccharification tank.