Knowledge-guided transmission spectroscopy adaptive optical path compensation method, system and medium
Patent Information
- Application Number
- CN202611011939.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-08
- Publication Date
- 2026-10-23
AI Technical Summary
[0004]针对上述现有技术存在的不足,本发明提供了一种知识引导的透射光谱自适应光程补偿方法、系统及介质,旨在解决透射光谱在线检测中因样品尺寸、等效透射厚度及组织异质性引起的有效光程漂移问题,尤其是解决传统补偿方法补偿强度固定、依赖单一参考波长、容易破坏目标品质相关谱学信息的问题
[0044]本发明提供的知识引导的透射光谱自适应光程补偿方法适用于块茎类、果蔬类等尺寸差异明显且内部组织具有强散射特性的样品在可见/近红外透射检测中的光程扰动补偿,该补偿方法既能够识别不同波长对光程变化的敏感程度,又能够判断该波长是否承载目标品质信息,能给使光程敏感波段得到充分校正,同时对目标相关波段实施保护,从而在抑制光程扰动与保持有效谱学信息之间形成可调节的平衡。
Smart Images

Figure CN122961922A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of spectral detection, non-destructive testing of agricultural products, and spectral preprocessing, and particularly to a knowledge-guided adaptive optical path compensation method, system, and medium for transmission spectra. Background Technology
[0002] In transmission spectroscopy, the intensity of transmitted light is determined by the sample's internal absorption, scattering, and interfacial refraction. For an ideal homogeneous medium, the intensity attenuation can approximately satisfy an exponential relationship. However, for strongly scattering biological media such as tubers, fruits, and vegetables, differences in sample size, tissue density, internal porosity, and morphology can cause the actual effective optical path to deviate from the geometric thickness, resulting in an overall intensity shift, limiting distortion, local spectral compression, and feature weakening of the transmission spectrum. Even if the light source, detector, and acquisition geometry remain unchanged, the difference in equivalent transmission thickness between different samples can still become a major non-target perturbation affecting quantitative or qualitative analysis.
[0003] Existing optical path correction methods mainly include geometric normalization, traditional extinction coefficient compensation, correlation wavelength compensation, spectral ratio compensation, and statistical preprocessing such as standard normal variable transformation and multivariate scattering correction. Geometric normalization usually applies a uniform ratio to the entire spectrum based on sample thickness, lacking constraints on exponential decay and wavelength differences; traditional extinction coefficient compensation often uses the same or fixed intensity optical path reduction for all wavelengths, which can easily lead to overcorrection of key bands containing target information; correlation wavelength or spectral ratio methods rely on a single reference wavelength, and when the reference wavelength is simultaneously affected by changes in target components or noise interference, the error will propagate to the entire spectrum through regression or ratio calculation; although general scattering correction can reduce multiplicative differences, it does not utilize real-time geometric dimensions and is difficult to distinguish between sample size effects and target information effects. Summary of the Invention
[0004] To address the shortcomings of the existing technologies, this invention provides a knowledge-guided adaptive optical path compensation method, system, and medium for transmission spectroscopy. It aims to solve the problem of effective optical path drift caused by sample size, equivalent transmission thickness, and tissue heterogeneity in online transmission spectroscopy detection, particularly addressing the issues of fixed compensation intensity, reliance on a single reference wavelength, and easy destruction of spectroscopic information related to target quality in traditional compensation methods.
[0005] To achieve the above objectives, the present invention provides a knowledge-guided adaptive optical path compensation method for transmission spectra, comprising the following steps:
[0006] S1. Obtain the transmission spectral response of the sample at multiple wavelengths, and simultaneously obtain the equivalent optical path parameters of the sample detection direction;
[0007] S2. Construct a calibration sample set, which includes the transmission spectrum, equivalent optical path parameter and target quality response of each sample;
[0008] S3. Determine the reference optical path based on the calibration sample set;
[0009] S4. Establish the mapping relationship between the optical response and the equivalent optical path parameter at each wavelength to obtain the apparent optical path sensitivity coefficient at that wavelength.
[0010] S5. Calculate the optical path perturbation knowledge index for each wavelength.
[0011] S6. Calculate the target information knowledge index for each wavelength;
[0012] S7. Normalize the optical path disturbance knowledge index and the target information knowledge index to the same scale, and construct an adaptive compensation weight. Assign a larger compensation weight to wavelengths that are sensitive to optical path and contribute less to target information, and reduce the compensation weight to wavelengths that contribute more to target information.
[0013] S8. Using the reference optical path, apparent optical path sensitivity coefficient, global compensation intensity coefficient and adaptive compensation weight, optical path compensation is performed on each wavelength to obtain the compensated transmission spectrum.
[0014] S9. Input the compensated transmission spectrum into the subsequent quality identification or content prediction model.
[0015] In some embodiments, the reference optical path in step S3 is any one of the median, mean, truncated mean, or preset standard thickness of the equivalent optical path parameters in the calibration sample set.
[0016] In some embodiments, the transmission spectral response in step S4 is selected from transmittance, normalized transmission intensity, absorbance, logarithmic transmission intensity, or preprocessed spectral value; a linear regression model is constructed at the logarithmic transmission threshold, and the absolute value of the regression coefficient is used as the apparent spectrum sensitivity coefficient for the corresponding wavelength.
[0017] In some embodiments, the optical path perturbation knowledge index in step S5 is a geometric sensitivity index, which is calculated using at least one of the following: absolute value of regression slope, correlation coefficient, partial least squares variable importance projection value, and mutual information.
[0018] In some embodiments, the target information knowledge index in step S6 is a target relevance index. When the target quality response is a continuous quality index, it is calculated using the correlation coefficient, regression coefficient, or partial least squares variable importance projection value. When the target quality response is a discrete category label, it is calculated using the discriminant variable importance, category relevance, or multi-response partial least squares variable importance projection value after encoding the category label.
[0019] In some embodiments, step S7 uses extreme value normalization to normalize the two types of knowledge indicators. The normalization calculation process introduces a very small positive number to avoid the denominator being zero. The calculation formula for the adaptive compensation weight is set with a target information protection coefficient to adjust the degree of suppression of the compensation intensity by the target correlation. The adaptive compensation weight value is constrained to the range of 0 to 1.
[0020] In some embodiments, step S8 includes:
[0021] The compensation index is calculated wavelength by wavelength based on the difference between the equivalent optical path parameters of the sample under test and the reference optical path.
[0022] The compensation index is subject to amplitude limiting to prevent abnormal index values.
[0023] The compensated transmission spectrum is obtained by using an index conversion method based on the compensation index after amplitude limiting.
[0024] In some embodiments, the compensation index is calculated using the following formula:
[0025] ;
[0026] Where q is the global compensation strength coefficient, and G λ For adaptive compensation weights, b λ To represent the sensitivity coefficient of the sightseeing itinerary, For reference optical path, The equivalent transmission thickness of the sample to be tested is given; the compensation exponent is constrained to the interval [-M, M] by using the clip limiting function, where M is the truncation threshold of the exponent term.
[0027] In some embodiments, the compensation spectral conversion formula is as follows:
[0028] ;
[0029] The logarithmic field is equivalently expressed as:
[0030] .
[0031] In some embodiments, the reference optical path, apparent optical path sensitivity coefficient, adaptive compensation weight, global compensation intensity coefficient, and exponential term truncation threshold are obtained from the calibration sample set and then stored uniformly; during the real-time detection of the sample under test, the stored calibration parameters are directly called, and the target variable of the sample under test does not participate in the construction process of the compensation parameters.
[0032] In some embodiments, the target quality response includes at least one of dry matter content, sugar content, maturity, and internal defect level.
[0033] In some embodiments, a laser displacement sensor is used to collect the sample equatorial diameter as the equivalent transmission thickness; the compensated transmission spectrum is preprocessed by combining Savitzky-Golay first derivative and standard normal variable transformation, and then input into a partial least squares regression model or an SE-AlexNet deep learning model to complete the quality prediction.
[0034] Another aspect of the present invention provides a knowledge-guided transmission spectrum adaptive optical path compensation system for performing the knowledge-guided transmission spectrum adaptive optical path compensation method described above, the optical path compensation system comprising:
[0035] A light source assembly is used to emit incident light onto the sample under test within the transmission detection area;
[0036] The spectral acquisition unit is used to receive transmitted light through the sample and acquire multi-wavelength transmission spectral responses.
[0037] The thickness measurement unit is used to simultaneously acquire the equivalent optical path parameters of the sample in the detection direction.
[0038] The synchronous acquisition unit is used to match, bind, and transmit the transmission spectral response and equivalent optical path parameters corresponding to the same sample.
[0039] The parameter storage unit is used to store all compensation parameters obtained based on the calibration sample set.
[0040] The optical path compensation processing unit is connected to the synchronous acquisition unit and the parameter storage unit respectively. It is configured to perform calibration calculation of the calibration set parameters and wavelength-by-wavelength optical path compensation calculation of the sample under test, and output the compensated transmission spectrum normalized to the reference optical path conditions.
[0041] The compensated spectral output unit is used to transmit the compensated transmission spectrum to downstream quality identification or content prediction models.
[0042] In another aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements all the steps of the knowledge-guided transmission spectrum adaptive optical path compensation method as described above.
[0043] Compared with the prior art, the present invention has the following advantages:
[0044] The knowledge-guided adaptive optical path compensation method for transmission spectroscopy provided by this invention is applicable to optical path disturbance compensation in visible / near-infrared transmission detection of samples such as tubers, fruits and vegetables, which have significant size differences and strong internal scattering characteristics. This compensation method can identify the sensitivity of different wavelengths to changes in optical path and determine whether the wavelength carries target quality information. It can fully correct the optical path sensitive bands while protecting the target-related bands, thereby forming an adjustable balance between suppressing optical path disturbances and maintaining effective spectral information.
[0045] The knowledge-guided adaptive optical path compensation method for transmission spectra provided by this invention is a knowledge-guided compensation approach that coordinates physical disturbance suppression and target information fidelity. It overcomes the limitations of traditional transmission spectrum optical path correction, which relies solely on empirical compensation based on sample geometry, a single reference wavelength, or a uniform scaling factor. By integrating optical path disturbance suppression and effective target information protection into the compensation mechanism, it constructs a knowledge-guided optical path compensation framework for specific detection targets. This framework transforms full-spectrum correction driven by a single geometric factor into a collaborative compensation approach that balances physical disturbance removal and target information fidelity.
[0046] The knowledge-guided adaptive optical path compensation method for transmission spectroscopy provided by this invention establishes a wavelength-resolved characterization mechanism for optical path perturbations. It uses the sample's equivalent diameter, equivalent transmission thickness, or other parameters that characterize the geometric scale of the detection direction as effective optical path proxy variables, and establishes a mapping relationship between transmission response and geometric scale along the wavelength dimension to obtain the apparent optical path sensitivity for each wavelength. Therefore, it is possible to quantitatively identify the degree to which different wavelength bands are affected by variations in sample size, internal scattering path, and transmission thickness, achieving wavelength-by-wavelength analysis of optical path perturbations and providing a physical basis for differentiated compensation.
[0047] The knowledge-guided adaptive optical path compensation method for transmission spectra provided by this invention constructs a wavelength-wise adaptive compensation mechanism with target constraints. It integrates optical path sensitivity and target information correlation to build wavelength-wise adaptive compensation weights, and dynamically adjusts the optical path correction amplitude for each wavelength accordingly: enhanced compensation is applied to bands sensitive to optical path disturbances but with low target information contribution; compensation intensity is reduced or protective compensation is applied to key bands with high target information contribution. This mechanism enables the compensation intensity to adaptively change with wavelength characteristics and the detected target, without relying on a single reference wavelength or requiring a uniform compensation ratio across the entire spectrum. This reduces systematic deviations caused by reference wavelength drift, target component coupling, and cross-band transmission of local noise, thereby improving the robustness, adaptability, and information fidelity of transmission spectrum correction for complex, strongly scattering samples. Attached Figure Description
[0048] Figure 1 This is a schematic diagram of the overall process of the knowledge-guided transmission spectrum adaptive optical path compensation method shown in the embodiment of the present invention;
[0049] Figure 2 This is a diagram illustrating the architecture of a knowledge-guided transmission spectrum adaptive optical path compensation system according to an embodiment of the present invention.
[0050] Figure 3 This is a flowchart illustrating the calibration parameter construction and real-time compensation process in an embodiment of the present invention.
[0051] Figure 4 The geometric sensitivity and target correlation dual-constraint weights are constructed as shown in the embodiments of the present invention;
[0052] Figure 5 This is a block diagram of the online transmission spectrum detection and optical path compensation system shown in an embodiment of the present invention;
[0053] In the attached figures, the following labels are used:
[0054] 300-Transmission Spectrum Adaptive Optical Path Compensation System;
[0055] 310 - Light source assembly;
[0056] 320 - Spectral Acquisition Unit;
[0057] 330 - Thickness measurement unit;
[0058] 340 - Synchronous Acquisition Unit;
[0059] 350-parameter storage unit;
[0060] 360-Optical path compensation processing unit;
[0061] 370-Compensated Spectral Output Unit;
[0062] Steps: S1-S9. Detailed Implementation
[0063] See Figure 1-5 An embodiment of the present invention provides a knowledge-guided adaptive optical path compensation method for transmission spectra, comprising the following steps:
[0064] S1. Obtain the transmission spectral response of the sample at multiple wavelengths, and simultaneously obtain the equivalent diameter or equivalent transmission thickness of the sample in the detection direction, which is denoted as the equivalent optical path parameter.
[0065] S2. Construct a calibration sample set, which includes the transmission spectrum, equivalent optical path parameter and target quality response of each sample;
[0066] S3. Determine the reference optical path based on the calibration sample set;
[0067] S4. Establish the mapping relationship between the optical response and the equivalent optical path parameter at each wavelength to obtain the apparent optical path sensitivity coefficient at that wavelength; the spectral response can be transmittance, normalized transmittance, absorbance, logarithmic transmittance, or preprocessed spectral values.
[0068] S5. Calculate the optical path perturbation knowledge index for each wavelength; this index is used to characterize the degree to which the corresponding wavelength is affected by changes in sample diameter, thickness, or effective optical path; it can be the absolute value of the regression slope, correlation coefficient, variable importance projection value, or a combination thereof.
[0069] S6. Calculate the target information knowledge index for each wavelength; this index is used to characterize the correlation between the corresponding wavelength and the target quality response; when the target quality response is a continuous variable, regression, correlation or variable importance projection can be used for calculation; when the target quality response is a categorical variable, category label matrix, discriminant variable importance or category correlation can be used for calculation.
[0070] S7. Normalize the optical path disturbance knowledge index and the target information knowledge index to the same scale, and construct an adaptive compensation weight. Assign a larger compensation weight to wavelengths that are sensitive to optical path and contribute less to target information, and reduce the compensation weight to wavelengths that contribute more to target information, so as to avoid overcorrection.
[0071] S8. Using the reference optical path, apparent optical path sensitivity coefficient, global compensation intensity coefficient and adaptive compensation weight, optical path compensation is performed on each wavelength to obtain the compensated transmission spectrum.
[0072] S9. Input the compensated transmission spectrum into the subsequent quality identification or content prediction model. The model can be a chemometrics model, a statistical learning model, a rule model, or other data analysis model. The core of this invention is not limited to a specific model structure.
[0073] In this embodiment, the reference optical path in step S3 is any one of the median, mean, truncated mean, or preset standard thickness of the equivalent optical path parameters in the calibration sample set, in order to reduce the influence of extreme-sized samples on the reference value.
[0074] In this embodiment, the transmission spectral response in step S4 is selected from transmittance, normalized transmission intensity, absorbance, logarithmic transmission intensity, or preprocessed spectral value; a linear regression model is constructed at the logarithmic transmission threshold, and the absolute value of the regression coefficient is used as the apparent spectrum sensitivity coefficient for the corresponding wavelength.
[0075] In this embodiment, the optical path perturbation knowledge index in step S5 is a geometric sensitivity index, which is calculated using at least one of the following: absolute value of regression slope, correlation coefficient, partial least squares variable importance projection value, and mutual information.
[0076] In this embodiment, the target information knowledge index in step S6 is the target relevance index. When the target quality response is a continuous quality index, it is calculated using the correlation coefficient, regression coefficient, or partial least squares variable importance projection value. When the target quality response is a discrete category label, it is calculated using the discriminant variable importance, category relevance, or multi-response partial least squares variable importance projection value after encoding the category label.
[0077] In step S7 of this embodiment, extreme value normalization is used to normalize the two types of knowledge indicators. The normalization calculation process introduces a very small positive number to avoid the denominator being zero. In the calculation formula for the adaptive compensation weight, a target information protection coefficient is set to adjust the degree of suppression of the compensation intensity by the target correlation. The adaptive compensation weight value is constrained to the range of 0 to 1.
[0078] In this embodiment, step S8 includes:
[0079] The compensation index is calculated wavelength by wavelength based on the difference between the equivalent optical path parameters of the sample under test and the reference optical path.
[0080] The compensation index is subject to amplitude limiting to prevent abnormal index values.
[0081] The compensated transmission spectrum is obtained by using an index conversion method based on the compensation index after amplitude limiting.
[0082] The formula for calculating the compensation index is as follows:
[0083] ;
[0084] Where q is the global compensation strength coefficient, and G λ For adaptive compensation weights, b λ To represent the sensitivity coefficient of the sightseeing itinerary, For reference optical path, The equivalent transmission thickness of the sample to be tested is given; the compensation exponent is constrained to the interval [-M, M] by using the clip limiting function, where M is the truncation threshold of the exponent term.
[0085] The formula for compensating for spectral conversion is:
[0086] ;
[0087] The logarithmic field is equivalently expressed as:
[0088] .
[0089] In this embodiment, the reference optical path, apparent optical path sensitivity coefficient, adaptive compensation weight, global compensation intensity coefficient, and exponential term truncation threshold are obtained from the calibration sample set and then stored uniformly. During the real-time detection of the sample under test, the stored calibration parameters are directly called, and the target variable of the sample under test does not participate in the construction process of the compensation parameters. The target quality response includes at least one of dry matter content, sugar content, maturity, and internal defect level, or other quality indicators to be detected.
[0090] In this embodiment, a laser displacement sensor is used to collect the equatorial diameter of the sample as the equivalent transmission thickness. The compensated transmission spectrum is preprocessed by combining the Savitzky-Golay first derivative and standard normal variable transformation, and then input into a partial least squares regression model or an SE-AlexNet deep learning model to complete the quality prediction.
[0091] The following is in conjunction with the appendix Figure 3-5 The knowledge-guided adaptive optical path compensation method for transmission spectrum provided in the embodiments of the present invention will be further described in detail.
[0092] like Figure 3 As shown, the transmission spectral optical path compensation method of this invention includes a parameter construction stage and an online real-time compensation stage. The parameter construction stage is used to determine the reference optical path. Sensitivity coefficient of sightseeing process Wavelength adaptive compensation weight And global compensation parameters; the online real-time compensation stage is used to calculate the transmission spectrum of the sample under test. and equivalent transmission thickness The compensation index is calculated for each wavelength and the compensation spectrum is output.
[0093] Let the transmitted light intensity of the i-th sample at wavelength λ be Iᵢ,λ, the incident light intensity of the blank or reference be I0,λ, the transmittance be Tᵢ,λ, and the effective optical path length inside the sample be Lᵢ. Then the transmission process can be approximated as:
[0094] (1)
[0095] In the formula, κ λ Let λ be the apparent attenuation coefficient at wavelength λ. For strongly scattering samples, equation (1) is used to describe the apparent attenuation law, without requiring the sample to strictly satisfy the ideal Beer-Lambert law. This invention uses the equivalent diameter, equivalent thickness, or other equivalent optical path characteristics Dᵢ that can be measured in real time to approximately reflect the change of Lᵢ, and estimates the response of the actual spectrum to Dᵢ wavelength by wavelength on the calibration set.
[0096] Establish an online calibration sample set. Select several calibration samples covering the expected sample size range and target variable range, and pass each calibration sample sequentially through the online transmission spectroscopy detection area. For the first... Real-time acquisition wavelength of each calibration sample Transmission spectrum at Simultaneously obtain its equivalent transmission thickness in the detection direction. And correlate the target variable reference value of the calibration sample. .
[0097] The target variable reference value It can be a continuous quality reference value or a discrete category label. The above-mentioned calibration samples constitute the online calibration sample set. .
[0098] Reference optical path Sensitivity coefficient of sightseeing process Geometric sensitivity index Target relevance indicators and compensation weight All parameters are determined solely based on the online calibration sample set, without invoking the target variable information of the sample to be tested, thereby avoiding the reverse involvement of the test information in the construction of compensation parameters.
[0099] The reference optical path is determined online. The reference optical path is determined based on the equivalent transmission thickness of the online calibration sample set. Preferably, the median of the equivalent transmission thickness of the calibrated sample is used as the reference optical path.
[0100] (2)
[0101] In the formula, 𝒞 represents the set of sample indices for the calibration set.
[0102] In other embodiments, the reference optical path can also be the mean, truncated mean, quantile, or a pre-defined standard thickness of the equivalent transmission thickness. The median is preferred to reduce the impact of extreme-sized samples on the reference optical path.
[0103] Online estimation of the transmittance sensitivity coefficient. The natural logarithm is taken after applying a positive constraint to the transmittance of the calibration sample, and the result is calculated at each wavelength. Establish the relationship between logarithmic transmission response and equivalent transmission thickness:
[0104] (3)
[0105] (4)
[0106] In the formula, a λ For the intercept, eᵢ, λFor the residual, D̄ is the mean of the equivalent transmission thickness of the correction set, and the underlined term in the numerator of equation (4) represents the mean of the logarithmic transmittance of the correction set at wavelength λ. |b λ The larger the value, the more sensitive the wavelength is to changes in size or effective optical path.
[0107] Online calculation of geometric sensitivity indices. The transmission spectral matrix of the online calibration sample set is used as the independent variable, along with the equivalent transmission thickness. As the response variable, a contribution evaluation relationship for wavelength variables is established, and the geometric sensitivity index corresponding to each wavelength is obtained. The geometric sensitivity index is used to characterize the degree to which each wavelength is affected by changes in sample geometry and effective optical path. Preferably, the variable importance projection value of a partial least squares model is used as... Alternatively, regression coefficients, correlation coefficients, mutual information, or other indicators that can evaluate the contribution of wavelength variables can be used.
[0108] Calculate the target relevance index online. Use the transmission spectral matrix of the same online calibration sample set as the independent variable and the target variable as the independent variable. As the response variable, the contribution evaluation relationship of the target variable is established, and the target relevance index corresponding to each wavelength is obtained. When the target variable When the target variable is a continuous quality reference value, a single response variable contribution evaluation method is used; when the target variable... When using discrete category labels, the category labels are encoded into a response matrix, and a multi-response variable contribution evaluation method is adopted.
[0109] Preferably, the variable importance projection values of the partial least squares model are used as... The target relevance index is used to characterize the degree to which different wavelengths contribute effective information to the currently detected target.
[0110] Normalized variable contribution indicators. Geometric sensitivity indicators are also included. Relevance indicators to the target Mapping to interval Contribution index for any wavelength variable Normalization can be performed using the following formula:
[0111] (5)
[0112] In the formula, ε is a small positive number to prevent the denominator from being zero.
[0113] The normalized geometric sensitivity index and target relevance index are denoted as follows: and .
[0114] Construct dual-constraint compensation weights online. For example... Figure 4As shown, based on the normalized geometric sensitivity index and target relevance index, knowledge-guided adaptive compensation weights are constructed wavelength by wavelength. :
[0115] (6)
[0116] In the formula, The target information protection coefficient is used to adjust the degree to which target correlation suppresses the optical path compensation intensity. To prevent tiny positive numbers with a denominator of zero.
[0117] Compensation weight Constrained in interval Internally, when the geometric sensitivity of a certain wavelength is high and the target correlation is low, the wavelength corresponds to... The optical path compensation is relatively large; when the target correlation of a certain wavelength is high, the corresponding wavelength is... Reduce the intensity of compensation to avoid excessive weakening of the target's effective information.
[0118] After the calibration parameters are constructed, the parameter vector will be...
[0119]
[0120] It is stored in the control unit or data processing unit of the online detection system for real-time retrieval during subsequent continuous detection processes.
[0121] Perform wavelength-by-wavelength optical path compensation online. When the... As each sample passes through the online detection area, its transmission spectrum is acquired in real time. And simultaneously obtain its equivalent transmission thickness. The true value of the target variable for the sample to be tested does not need to be known in advance.
[0122] Based on the equivalent transmission thickness of the sample to be tested With reference optical path The difference between them is used to calculate the compensation index for each wavelength:
[0123] (7)
[0124] In the formula, q is the global compensation intensity coefficient, used to control the overall correction amplitude. To prevent abnormal thickness, local abnormal weights, or spectral noise from causing the exponent term to become too large, the compensation exponent is limited:
[0125] (8)
[0126] In the formula, The threshold for truncating the exponential term; This indicates that the input value is restricted to a range. Inside.
[0127] The compensated spectrum after amplitude limiting is as follows:
[0128] (9)
[0129] Equivalently, this can be represented in the logarithmic field as:
[0130] (10)
[0131] Using the sample index Capable of indexing online calibration samples To distinguish between them and avoid mixing up the subscripts of calibration samples and real-time test samples.
[0132] Online output of compensated spectrum. The compensated transmission spectrum is then displayed. As a reference optical path The standardized transmission spectrum under the given conditions is output in real time and transmitted to the subsequent analysis module of the online detection system.
[0133] The compensated spectrum can be used for real-time spectral shape comparison, characteristic band analysis, quality parameter regression, or category discrimination. The specific structure of the subsequent analysis model does not constitute a necessary limitation on the optical path compensation method of this invention.
[0134] Furthermore, this embodiment uses online detection of potato dry matter content as an example to illustrate the knowledge-guided wavelength adaptive transmission spectrum optical path compensation method described in this invention. The subsequent regression model is only used to evaluate the effectiveness of the compensated spectrum and does not constitute the core technical content of this invention.
[0135] like Figure 5 As shown, the online transmission spectral detection and optical path compensation system used in this embodiment includes a light source assembly, a transmission detection zone, a spectral acquisition unit, a thickness measurement unit, a synchronous acquisition unit, an optical path compensation processing unit, a parameter storage unit, and a compensated spectral output unit. The light source assembly emits incident light onto the sample to be tested located within the transmission detection zone, and the spectral acquisition unit receives the transmitted light through the sample to obtain the transmission spectrum. The thickness measurement unit acquires the equivalent transmission thickness of the sample under test. The synchronous acquisition unit maps the transmission spectrum to the equivalent transmission thickness at the sample level and transmits it to the optical path compensation processing unit. The optical path compensation processing unit calls the compensation parameters in the parameter storage unit to generate and output the compensation spectrum.
[0136] This embodiment uses the Hisen 6 potato as the detection object. It utilizes an online visible / near-infrared transmission spectroscopy acquisition system to perform knowledge-guided adaptive optical path compensation on the transmission spectra of potato samples of different diameters, and then uses this information to predict dry matter content.
[0137] Two hundred potato samples, free from mechanical damage, insect infestation, deformities, and rot, were selected, washed, air-dried, and equilibrated at room temperature for 24 hours for dry matter content determination and quantitative modeling. Before spectral acquisition, all samples were equilibrated for 24 hours in a constant temperature laboratory at 25 ℃ ± 1℃, and the equatorial diameter of the samples was measured using a laser displacement sensor as the equivalent transmission thickness. After the spectral acquisition system was preheated for 30 minutes, dark current calibration was performed. Transmission spectra of each sample were acquired 10 times, and the average spectrum was used as the input spectrum for that sample.
[0138] In the optical path compensation process, the median of the equivalent diameter of the calibration set samples is first set as the reference diameter D0; then, a linear relationship between the transmission spectral response and the sample diameter is established at each wavelength to obtain the optical path sensitivity coefficient b at that wavelength. λ Furthermore, a PLS model was established using the sample diameter as the response variable, and the diameter sensitivity VIP value V was calculated. D (λ), using the target variable as the response variable, establish a PLS model and calculate the target relevance VIP value V. Y (λ). The target variable in the dry matter prediction task is the measured dry matter content. V D (λ) and V Y (λ) After normalization, construct the knowledge-guided compensation weight G. λ This allows for stronger compensation for wavelengths that are diameter-sensitive and contribute less to target information, while providing weaker compensation for critical wavelengths highly correlated with dry matter, thereby preventing over-correction of effective quality information. In this embodiment, while maintaining the reference optical path... Sensitivity coefficient of sightseeing process Wavelength adaptive compensation weights Under the condition that remains unchanged, the global compensation strength coefficient is adjusted based on the internal verification results of the calibration set. Sensitivity analysis was performed. The target information protection coefficient η was set to 1.0, the global compensation strength coefficient q was set to 0.001, and ε was set to 1×10⁻⁶. -9 It is used to safely limit the extreme compensation exponent caused by abnormal size, local abnormal weight, or noise, so as to avoid numerical overflow or abnormal spectrum in the exponent calculation. Primarily used as a numerical stability protection parameter, it does not imply that the compensation index of normal samples will necessarily reach this threshold. The number of internal repetitions is set to 5. All compensation parameters are estimated only from the training or calibration set and then applied to the independent prediction set.
[0139] The above parameter values are the preferred values obtained in this embodiment under the conditions of instrument response scale, sample size distribution and target detection task; under other instrument, sample type or detection conditions, they can be adjusted based on the internal verification results of the calibration set.
[0140] In the dry matter content prediction experiment, 200 healthy samples were divided into a calibration set and a prediction set in a 7:3 ratio, with 140 samples in the calibration set and 60 samples in the prediction set. The dry matter content of the calibration set was 19.81±3.25 g / 100 g, with an equivalent thickness of 56.22±2.75 mm; the dry matter content of the prediction set was 20.85±4.18 g / 100 g, with an equivalent thickness of 56.51±2.79 mm.
[0141] To reduce the impact of spectral preprocessing methods on the evaluation results of different optical path compensation methods, while maintaining consistency in the division of the calibration set, prediction set, and evaluation metrics, candidate preprocessing schemes such as standard normal variable transformation, multivariate scattering correction, Savitzky-Golay smoothing, and derivative processing were examined for each compensation method. The preprocessing methods and model parameters for each method were determined based on the internal validation results of the calibration set; the independent prediction set was not involved in the selection of preprocessing schemes or parameter optimization. The final report presents the prediction performance of each optical path compensation method under its optimal preprocessing conditions, used to evaluate the comprehensive application effect achievable by different methods after equivalent optimization.
[0142] When building a PLSR model using the original spectrum, the prediction set R² P The RMSE is 0.802. P The value is 1.845 g / 100 g; The knowledge-guided adaptive optical path compensation method for transmission spectroscopy, combined with SG first derivative and SNV preprocessing, yields the PLSR model prediction set R². P Increased to 0.834, RMSE P Reduced to 1.691 g / 100 g. Compared to the original spectrum, R² P Increased by 0.032, RMSE P The decrease was 0.154 g / 100 g.
[0143] Furthermore, an SE-AlexNet dry matter prediction model was constructed using a knowledge-guided transmission spectroscopy adaptive optical path compensation method, SG1+SNV preprocessing, and 5x Gaussian noise amplification. The model achieved R² on the prediction set. P Reached 0.934, RMSE P It is 0.854 g / 100 g, MAE P The value is 0.604 g / 100 g, and the prediction bias is only 0.007 g / 100 g; the calibration set R² C The RMSE is 0.989. C It is 0.397 g / 100 g, MAE CThe result was 0.258 g / 100 g. The results indicate that this knowledge-guided adaptive optical path compensation method can effectively reduce the interference of differences in sample diameter and effective optical path on the transmission spectrum, while retaining effective spectroscopic information related to dry matter content.
[0144] Furthermore, another embodiment of the present invention provides a knowledge-guided transmission spectrum adaptive optical path compensation system 300 for performing the knowledge-guided transmission spectrum adaptive optical path compensation method as described above, wherein the optical path compensation system 300 includes:
[0145] The light source assembly 310 is used to emit incident light onto the sample to be tested within the transmission detection area;
[0146] The spectral acquisition unit 320 is used to receive transmitted light through the sample to be tested and acquire multi-wavelength transmission spectral responses.
[0147] Thickness measurement unit 330 is used to simultaneously acquire the equivalent optical path parameters of the sample under test in the detection direction;
[0148] The synchronous acquisition unit 340 is used to match, bind, and transmit the transmission spectral response and equivalent optical path parameters corresponding to the same sample.
[0149] The parameter storage unit 350 is used to store all compensation parameters obtained based on the calibration of the calibration sample set;
[0150] The optical path compensation processing unit 360 is connected to the synchronous acquisition unit 340 and the parameter storage unit 350 respectively. It is configured to perform calibration calculation of the calibration set parameters and wavelength-by-wavelength optical path compensation calculation of the sample under test, and output the compensated transmission spectrum normalized to the reference optical path conditions.
[0151] The compensated spectral output unit 370 is used to transmit the compensated transmission spectrum to the downstream quality identification or content prediction model.
[0152] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements all the steps of the knowledge-guided transmission spectrum adaptive optical path compensation method as described above.
[0153] In summary, the wavelength-adaptive transmission spectrum optical path compensation method based on dual constraints of geometric sensitivity and target correlation provided by this invention acquires the transmittance, equivalent transmission thickness, and target reference value of the calibration sample at each wavelength, using the median of the equivalent transmission thickness of the calibration set as the reference optical path. The apparent optical path sensitivity coefficient is obtained by wavelength regression in the logarithmic transmission domain. The contribution of each wavelength to the equivalent transmission thickness and target variable is evaluated to obtain geometric sensitivity and target correlation indices, which are then normalized to guide the compensation weights. For the sample under test, an exponential compensation term determined by the global compensation intensity, the aforementioned weights, the apparent optical path sensitivity coefficient, and the difference between the sample and the reference optical path is calculated per wavelength. After amplitude limiting, the compensated spectrum converted to the reference optical path condition is output. This method applies strong correction to bands that are optically path sensitive but contribute little to target information, while reducing the correction intensity for target-correlated bands. It overcomes the problems of overcorrection and error propagation caused by uniform compensation intensity or a single reference wavelength, and is suitable for online transmission spectrum detection of strongly scattering samples with significant variations in size, thickness, or morphology.
[0154] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only.
[0155] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A knowledge-guided adaptive optical path compensation method for transmission spectra, characterized in that: Includes the following steps: S1. Obtain the transmission spectral response of the sample at multiple wavelengths, and simultaneously obtain the equivalent optical path parameters of the sample detection direction; S2. Construct a calibration sample set, which includes the transmission spectrum, equivalent optical path parameter and target quality response of each sample; S3. Determine the reference optical path based on the calibration sample set; S4. Establish the mapping relationship between the optical response and the equivalent optical path parameter at each wavelength to obtain the apparent optical path sensitivity coefficient at that wavelength. S5. Calculate the optical path perturbation knowledge index for each wavelength. S6. Calculate the target information knowledge index for each wavelength; S7. Normalize the optical path disturbance knowledge index and the target information knowledge index to the same scale, and construct an adaptive compensation weight. Assign a larger compensation weight to wavelengths that are sensitive to optical path and contribute less to target information, and reduce the compensation weight to wavelengths that contribute more to target information. S8. Using the reference optical path, apparent optical path sensitivity coefficient, global compensation intensity coefficient and adaptive compensation weight, optical path compensation is performed on each wavelength to obtain the compensated transmission spectrum. S9. Input the compensated transmission spectrum into the subsequent quality identification or content prediction model.
2. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: In step S3, the reference optical path can be any one of the median, mean, truncated mean, or preset standard thickness of the equivalent optical path parameters in the calibration sample set.
3. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: In step S4, the transmission spectral response can be selected from transmittance, normalized transmission intensity, absorbance, logarithmic transmission intensity, or pre-processed spectral value. A linear regression model is constructed based on the logarithmic transmission threshold, and the absolute value of the regression coefficient is used as the apparent transmission sensitivity coefficient for the corresponding wavelength.
4. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: In step S5, the optical path perturbation knowledge index is a geometric sensitivity index, which is calculated using at least one of the following: absolute value of regression slope, correlation coefficient, partial least squares variable importance projection value, and mutual information.
5. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: In step S6, the target information knowledge index is a target relevance index. When the target quality response is a continuous quality index, it is calculated using the correlation coefficient, regression coefficient, or partial least squares variable importance projection value. When the target quality response is a discrete category label, it is calculated using the discriminant variable importance, category relevance, or multi-response partial least squares variable importance projection value after encoding the category label.
6. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: In step S7, extreme value normalization is used to normalize the two types of knowledge indicators. The normalization calculation process introduces a very small positive number to avoid the denominator being zero. In the calculation formula for the adaptive compensation weight, a target information protection coefficient is set to adjust the degree of suppression of the compensation intensity by the target correlation. The adaptive compensation weight value is constrained to the range of 0 to 1.
7. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: Step S8 includes: The compensation index is calculated wavelength by wavelength based on the difference between the equivalent optical path parameters of the sample under test and the reference optical path. The compensation index is subject to amplitude limiting to prevent abnormal index values. The compensated transmission spectrum is obtained by using an index conversion method based on the compensation index after amplitude limiting.
8. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 7, characterized in that: The formula for calculating the compensation index is as follows: ; Where q is the global compensation strength coefficient, and G λ For adaptive compensation weights, b λ To represent the sensitivity coefficient of the sightseeing itinerary, For reference optical path, The equivalent transmission thickness of the sample to be tested is given; the compensation exponent is constrained to the interval [-M, M] by the clip limiting function, where M is the truncation threshold of the exponent term.
9. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 8, characterized in that: The formula for compensating for spectral conversion is: ; The logarithmic field is equivalently expressed as: 。 10. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: The reference optical path, apparent optical path sensitivity coefficient, adaptive compensation weight, global compensation intensity coefficient, and exponential term truncation threshold are obtained from the calibration sample set and then stored uniformly. During the real-time detection of the sample, the stored calibration parameters are directly called, and the target variable of the sample does not participate in the construction process of the compensation parameters.
11. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 1, characterized in that: The target quality response includes at least one of dry matter content, sugar content, maturity, and internal defect level.
12. The knowledge-guided adaptive optical path compensation method for transmission spectra according to claim 11, characterized in that: A laser displacement sensor is used to collect the equatorial diameter of the sample as the equivalent transmission thickness. The compensated transmission spectrum is preprocessed by Savitzky-Golay first derivative and standard normal variable transformation, and then input into a partial least squares regression model or an SE-AlexNet deep learning model to complete the quality prediction.
13. A knowledge-guided transmission spectrum adaptive optical path compensation system, characterized in that: For performing the knowledge-guided transmission spectrum adaptive optical path compensation method as described in any one of claims 1-12, the optical path compensation system comprises: A light source assembly is used to emit incident light onto the sample under test within the transmission detection area; The spectral acquisition unit is used to receive transmitted light through the sample and acquire multi-wavelength transmission spectral responses. The thickness measurement unit is used to simultaneously acquire the equivalent optical path parameters of the sample in the detection direction. The synchronous acquisition unit is used to match, bind, and transmit the transmission spectral response and equivalent optical path parameters corresponding to the same sample. The parameter storage unit is used to store all compensation parameters obtained based on the calibration sample set. The optical path compensation processing unit is connected to the synchronous acquisition unit and the parameter storage unit respectively. It is configured to perform calibration calculation of the calibration set parameters and wavelength-by-wavelength optical path compensation calculation of the sample under test, and output the compensated transmission spectrum normalized to the reference optical path conditions. The compensated spectral output unit is used to transmit the compensated transmission spectrum to downstream quality identification or content prediction models.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements all the steps of the knowledge-guided transmission spectrum adaptive optical path compensation method as described in any one of claims 1-12.