A method, system and storage medium for intelligent inspection of a handheld Raman spectrometer

By generating baselines through weighted polynomial fitting and asymmetric least squares smoothing, combined with a signal-to-noise ratio threshold and a principal component successive subtraction strategy, the problem of unreliable analysis of mixture components in existing technologies is solved, thereby improving the accuracy and reliability of hazardous materials detection.

CN121612862BActive Publication Date: 2026-04-03RAYTHEON OPTOELECTRONIC TECH (TIANJIN) CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-02
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies cannot adjust judgment criteria based on signal quality, making it difficult to reliably analyze multiple components in a mixture, which leads to safety hazards in the detection of hazardous materials.

Method used

By combining weighted polynomial fitting and asymmetric least squares smoothing, a fitting baseline is generated. The baseline is subtracted by taking the minimum value point by point. The signal-to-noise ratio is calculated to set the matching threshold. The strategy of successively subtracting the principal components and re-matching the residual spectrum is adopted to identify the minor components.

Benefits of technology

It improves the accuracy of spectral preprocessing and the reliability of identification results, enabling reliable separation and identification of minor components from mixtures, and enhancing the detection capabilities of handheld devices in complex field environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121612862B_ABST
    Figure CN121612862B_ABST
Patent Text Reader

Abstract

This invention provides a method, system, and storage medium for intelligent inspection of a handheld Raman spectrometer. The method includes: acquiring raw Raman spectral data of the hazardous material to be tested and identifying candidate peak regions; determining the polynomial order based on the number of regions; performing a weighted polynomial fitting on the raw data to obtain a first candidate baseline, with peak regions having a lower weight than non-peak regions; simultaneously obtaining a second candidate baseline through asymmetric least-squares smoothing; and generating a baseline by taking the minimum of the two values ​​point by point; subtracting the baseline to obtain the pure Raman spectrum; setting a matching confidence threshold based on the signal-to-noise ratio; and matching the spectrum with a standard spectral library to identify principal components; subtracting the principal components and scaling the spectrum to obtain the residual spectrum; and when the residual spectral energy meets preset conditions, matching the spectrum with the spectral library again to identify secondary components.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of inspection, and in particular relates to an intelligent inspection method, system and storage medium for a handheld Raman spectrometer. Background Technology

[0002] Raman spectroscopy, a "fingerprint" identification technique that provides information about the molecular structure of substances, has been widely used in the rapid on-site detection of hazardous chemicals, explosives, and narcotics due to its advantages such as speed, non-destructive nature, and no sample preparation required. Handheld Raman spectrometers integrate this technology into portable devices, improving detection efficiency and safety. The intensity of fluorescence signals is typically several orders of magnitude higher than that of Raman signals, resulting in broad, variable baselines that severely mask weak Raman characteristic peaks, leading to a sharp decrease in the spectral signal-to-noise ratio. Therefore, accurately and reliably extracting pure Raman spectra from strong fluorescence backgrounds is crucial for data processing in handheld Raman spectrometers. Polynomial fitting algorithms are extremely sensitive to the choice of order; too low an order cannot reliably fit complex baselines, while too high an order can easily over-subtract broad Raman peaks as baseline components. While asymmetric least-squares smoothing algorithms offer some variability, they may still exhibit fitting bias when dealing with steeply changing baselines or the presence of sharp cosmic ray peaks.

[0003] After baseline correction, the obtained pure Raman spectrum needs to be compared with a standard spectral library to achieve qualitative identification of the substance. Traditional identification methods typically calculate the similarity between the spectrum to be tested and the standard spectra in the library, and set a matching confidence threshold to judge the identification result. When the signal-to-noise ratio of the spectrum to be tested is low, even if it is the correct substance, the matching value may be lower than the fixed threshold, resulting in a missed detection; while when the signal-to-noise ratio is high, the matching value of some similar substances may be higher than the threshold, resulting in a false alarm. In addition, hazardous materials detected on-site often exist in the form of mixtures. When faced with the spectrum of mixtures, traditional matching algorithms often can only identify the main component with the strongest signal and the highest content. The strong characteristic peaks of the main component mask the weak characteristic peaks of other minor components, making it difficult to detect the minor components. This lack of ability to identify components in mixtures poses a safety hazard in scenarios such as hazardous material screening and security inspections that require comprehensive and accurate identification. There is an urgent need for an intelligent inspection method that can adjust the judgment criteria according to signal quality and reliably analyze multiple components in a mixture. Summary of the Invention

[0004] This invention proposes an intelligent inspection method for a handheld Raman spectrometer to solve the problem in existing technologies where the judgment criteria cannot be adjusted based on signal quality, making it difficult to reliably analyze multiple components in a mixture. The method includes the following steps:

[0005] Acquire the raw Raman spectral data of the hazardous material to be tested; identify candidate regions of spectral peaks in the raw Raman spectral data;

[0006] The polynomial order is determined based on the number of candidate peak regions, and a weighted polynomial fit is performed on the original Raman spectral data to obtain the first candidate baseline. During the fitting process, the weights lower than those of non-peak regions are assigned to the candidate peak regions.

[0007] The original Raman spectral data is smoothed using asymmetric least squares to obtain a second candidate baseline; the minimum value of the first candidate baseline and the second candidate baseline is taken point by point to generate a fitted baseline; the fitted baseline is subtracted from the original Raman spectral data to obtain the pure Raman spectrum; the signal-to-noise ratio of the pure Raman spectrum is calculated, and the matching confidence threshold is determined based on the signal-to-noise ratio.

[0008] The pure Raman spectrum is matched with a standard spectral library. When the maximum matching value obtained is greater than the matching confidence threshold, the corresponding principal component is determined. The spectrum that is scaled proportionally to the principal component is subtracted from the pure Raman spectrum to obtain the residual spectrum. When the energy of the residual spectrum meets the preset judgment condition, the residual spectrum is matched with the standard spectral library again to identify the minor components.

[0009] Optionally, identifying candidate regions for spectral peaks in the original Raman spectral data includes:

[0010] The raw Raman spectral data is smoothed using Savitzky-Golay and the first derivative is calculated. All Raman shift points in the first derivative that change from positive to negative values ​​after crossing zero are identified. The regions within the range of the shift points and N data points to their left and right are marked as candidate peak regions.

[0011] Optionally, determining the polynomial order based on the number of candidate spectral peak regions includes:

[0012] When the number of candidate regions of the spectral peak is less than the first quantity threshold, the order of the polynomial is set to the first order;

[0013] When the number of candidate regions of the spectral peak is between a first quantity threshold and a second quantity threshold, the order of the polynomial is set to the second order.

[0014] When the number of candidate regions of the spectral peak is greater than the second quantity threshold, the order of the polynomial is set to the third order;

[0015] Furthermore, when performing weighted polynomial fitting, the weight of the data points within the candidate spectral peak region is set as the first weight, and the weight of the data points outside the spectral peak region is set as the second weight, wherein the first weight is less than the second weight.

[0016] Optionally, the step of performing asymmetric least-squares smoothing on the original Raman spectral data to obtain a second candidate baseline includes:

[0017] The smoothing parameter λ, the asymmetric parameter p, and the number of iterations I of the asymmetric least squares smoothing algorithm are set, and the second candidate baseline is obtained through iterative calculation.

[0018] Optionally, calculating the signal-to-noise ratio of the pure Raman spectrum and determining the matching confidence threshold based on the signal-to-noise ratio includes:

[0019] Using formula Calculate the matching confidence threshold T, where The signal-to-noise ratio of the pure Raman spectrum is given. and This is a preset constant;

[0020] When the calculated T value is lower than the minimum threshold When, take To match the confidence threshold;

[0021] When the calculated T value is higher than the highest threshold When, take To match the confidence threshold.

[0022] Optionally, matching the pure Raman spectrum with a standard spectral library includes:

[0023] Calculate the Pearson correlation coefficient between the pure Raman spectrum and each standard spectrum in the standard spectral library, and take the largest calculated Pearson correlation coefficient value as the maximum matching value.

[0024] Optionally, subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum to obtain the residual spectrum includes:

[0025] The scaling factor k is calculated using the least squares method to minimize the sum of squared residuals between the pure Raman spectrum y and the standard spectrum x corresponding to the principal component, i.e., solving for... The residual spectrum is obtained by multiplying the standard spectrum corresponding to the principal component by the scaling factor k and then subtracting it from the pure Raman spectrum.

[0026] Optionally, the step of determining when the energy of the residual spectrum meets a preset condition includes:

[0027] The preset judgment condition is that the energy ratio of the residual spectrum to the pure Raman spectrum is greater than a preset energy ratio threshold;

[0028] Calculate the root mean square value of the signal intensity of the residual spectrum R. and the root mean square value of the signal intensity of the pure Raman spectrum P When the ratio When the value is greater than the preset energy ratio threshold, it is determined that the preset determination condition is met.

[0029] Furthermore, this invention also relates to an intelligent inspection system for a handheld Raman spectrometer, comprising the following modules:

[0030] The first identification module is used to acquire the raw Raman spectral data of the hazardous material to be tested; and to identify candidate regions of spectral peaks in the raw Raman spectral data.

[0031] The determination module is used to determine the polynomial order based on the number of candidate peak regions, and to perform weighted polynomial fitting on the original Raman spectral data to obtain a first candidate baseline, wherein during the fitting process, the weights lower than the non-peak regions are assigned to the candidate peak regions.

[0032] The calculation module is used to perform asymmetric least squares smoothing on the original Raman spectral data to obtain a second candidate baseline; to take the minimum value of the first candidate baseline and the second candidate baseline point by point to generate a fitted baseline; to subtract the fitted baseline from the original Raman spectral data to obtain a pure Raman spectrum; to calculate the signal-to-noise ratio of the pure Raman spectrum and to determine the matching confidence threshold based on the signal-to-noise ratio;

[0033] The second identification module is used to match the pure Raman spectrum with a standard spectral library. When the maximum matching value obtained is greater than the matching confidence threshold, the corresponding principal component is determined. The residual spectrum is obtained by subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum. When the energy of the residual spectrum meets the preset judgment condition, the residual spectrum is matched with the standard spectral library again to identify the minor components.

[0034] Preferably, identifying candidate regions for spectral peaks in the original Raman spectral data includes:

[0035] The raw Raman spectral data is smoothed using Savitzky-Golay and the first derivative is calculated. All Raman shift points in the first derivative that change from positive to negative values ​​after crossing zero are identified. The regions within the range of the shift points and N data points to their left and right are marked as candidate peak regions.

[0036] Preferably, determining the polynomial order based on the number of candidate spectral peak regions includes:

[0037] When the number of candidate regions of the spectral peak is less than the first quantity threshold, the order of the polynomial is set to the first order;

[0038] When the number of candidate regions of the spectral peak is between a first quantity threshold and a second quantity threshold, the order of the polynomial is set to the second order.

[0039] When the number of candidate regions of the spectral peak is greater than the second quantity threshold, the order of the polynomial is set to the third order;

[0040] Furthermore, when performing weighted polynomial fitting, the weight of the data points within the candidate spectral peak region is set as the first weight, and the weight of the data points outside the spectral peak region is set as the second weight, wherein the first weight is less than the second weight.

[0041] Preferably, the step of performing asymmetric least-squares smoothing on the original Raman spectral data to obtain a second candidate baseline includes:

[0042] The smoothing parameter λ, the asymmetric parameter p, and the number of iterations I of the asymmetric least squares smoothing algorithm are set, and the second candidate baseline is obtained through iterative calculation.

[0043] Preferably, the step of calculating the signal-to-noise ratio of the pure Raman spectrum and determining the matching confidence threshold based on the signal-to-noise ratio includes:

[0044] Using formula Calculate the matching confidence threshold T, where The signal-to-noise ratio of the pure Raman spectrum is given. and This is a preset constant;

[0045] When the calculated T value is lower than the minimum threshold When, take To match the confidence threshold;

[0046] When the calculated T value is higher than the highest threshold When, take To match the confidence threshold.

[0047] Preferably, matching the pure Raman spectrum with a standard spectral library includes:

[0048] Calculate the Pearson correlation coefficient between the pure Raman spectrum and each standard spectrum in the standard spectral library, and take the largest calculated Pearson correlation coefficient value as the maximum matching value.

[0049] Preferably, the step of subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum to obtain the residual spectrum includes:

[0050] The scaling factor k is calculated using the least squares method to minimize the sum of squared residuals between the pure Raman spectrum y and the standard spectrum x corresponding to the principal component, i.e., solving for... The residual spectrum is obtained by multiplying the standard spectrum corresponding to the principal component by the scaling factor k and then subtracting it from the pure Raman spectrum.

[0051] Preferably, the step of determining when the energy of the residual spectrum meets a preset condition includes:

[0052] The preset judgment condition is that the energy ratio of the residual spectrum to the pure Raman spectrum is greater than a preset energy ratio threshold;

[0053] Calculate the root mean square value of the signal intensity of the residual spectrum R. and the root mean square value of the signal intensity of the pure Raman spectrum P When the ratio When the value is greater than the preset energy ratio threshold, it is determined that the preset determination condition is met.

[0054] This invention combines weighted polynomial fitting (determining the order based on the number of spectral peaks) with asymmetric least-squares smoothing, and generates a baseline by taking the minimum of the two values ​​point by point. This process removes complex fluorescence background while preserving authentic Raman characteristic peak information to the greatest extent possible, thus improving the accuracy of spectral preprocessing. A matching confidence threshold is set based on the signal-to-noise ratio of the pure spectrum, ensuring that the judgment criteria align with the current spectral data quality and improving the overall reliability of the identification results. Furthermore, the strategy of successive principal component subtraction and residual spectrum re-matching reliably separates and identifies minor components masked by strong signals from mixtures, enhancing the detection capabilities of handheld devices in complex field environments. Attached Figure Description

[0055] Figure 1 A flowchart of the first embodiment;

[0056] Figure 2 This is a schematic diagram of the original Raman spectral data;

[0057] Figure 3 This is a schematic diagram of the first candidate baseline;

[0058] Figure 4 A schematic diagram of the pure Raman spectrum obtained after baseline subtraction;

[0059] Figure 5 This is a schematic diagram of the second candidate baseline;

[0060] Figure 6 A diagram illustrating the matching confidence threshold;

[0061] Figure 7 This is a schematic diagram for determining the residual spectral energy.

[0062] Figure 8 This is a schematic diagram showing the matching of pure spectra with the standard library. Detailed Implementation

[0063] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0064] In the first embodiment, the present invention proposes an intelligent inspection method for a handheld Raman spectrometer, such as... Figure 1 This includes the following steps:

[0065] S1, acquire the raw Raman spectral data of the hazardous material to be tested; identify candidate regions of spectral peaks in the raw Raman spectral data;

[0066] Specifically, a laser with a wavelength of, for example, 785 nm, is emitted from the built-in laser of a handheld Raman spectrometer. This laser is focused onto the surface of the hazardous material being tested by a probe. The scattered light is collected, and after Rayleigh scattering is removed by a filter, the light is dispersed by a grating within the spectrometer and projected onto a detector such as a CCD. Photoelectric conversion is performed by setting an integration time, for example, 1 to 5 seconds, to generate raw Raman spectral data with Raman shift as the abscissa and light intensity as the ordinate. Figure 2 .

[0067] The original Raman spectral data is subjected to preliminary smoothing and noise reduction processing, for example, using the Savitzky-Golay smoothing algorithm. The second derivative of the smoothed spectral data is calculated, and a continuous interval with negative values ​​is searched in the second derivative curve. The abscissa range corresponding to the start and end points of the negative value interval is marked as the spectral peak candidate region.

[0068] To initially locate regions in the Raman spectrum where characteristic peaks may exist, in an optional embodiment, identifying candidate peak regions in the original Raman spectral data includes:

[0069] The raw Raman spectral data is smoothed using Savitzky-Golay and the first derivative is calculated. All Raman shift points in the first derivative that change from positive to negative values ​​after crossing zero are identified. The regions within the range of the shift points and N data points to their left and right are marked as candidate peak regions.

[0070] Savitzky-Golay smoothing filtering is applied to the acquired raw Raman spectral data sequence to remove high-frequency noise while preserving peak shape and width information. For example, a polynomial of order 3 with a width of 11 data points is used to smooth the spectrum, resulting in a smoother spectral curve. In Raman spectroscopy, the ideal peak apex corresponds to the zero point where the first derivative curve changes from positive to negative. The entire first derivative data sequence is traversed to find all Raman shift points that satisfy this condition. For example, at a Raman shift of wavenumber 1003, the first derivative value is 0.2, while at wavenumber 1004, the value is -0.1; therefore, the area near wavenumber 1003 is marked as a potential peak position. For each found shift point, an interval of 31 data points is formed by placing N data points to the left and right (e.g., N is set to 15) to the right, marking this as a peak candidate region. The set of all marked regions is used for subsequent baseline correction processing.

[0071] S2, determine the polynomial order based on the number of candidate peak regions, wherein the polynomial order increases with the increase of the number of candidate peak regions, and perform weighted polynomial fitting on the original Raman spectrum data to obtain the first candidate baseline, wherein during the fitting process, the weights lower than the non-peak regions are assigned to the candidate peak regions.

[0072] Specifically, the total number N of the identified spectral peak candidate regions is counted, and the order of the polynomial is determined according to preset rules. For example, when N is less than 3, the order is set to 3; when N is between 3 and 7, the order is set to 5; and when N is greater than or equal to 7, the order is set to 7. Then, a fitting process is performed, setting the weight of all data points belonging to the spectral peak candidate regions to a small value, such as 0.01, and setting the weight of all data points not belonging to the spectral peak regions to a larger value, such as 1. A polynomial that minimizes the weighted sum of squared residuals is solved, and the curve of this polynomial is the first candidate baseline. Figure 3 .

[0073] In an optional embodiment, the step of determining the polynomial order based on the number of candidate peak regions, wherein the polynomial order increases with the increase of the number of candidate peak regions, and performing weighted polynomial fitting on the original Raman spectral data to obtain a first candidate baseline, wherein during the fitting process, weights lower than those of non-peak regions are assigned to the candidate peak regions, including:

[0074] When the number of candidate regions of the spectral peak is less than the first quantity threshold, the order of the polynomial is set to the first order;

[0075] When the number of candidate regions of the spectral peak is between a first quantity threshold and a second quantity threshold, the order of the polynomial is set to the second order.

[0076] When the number of candidate regions of the spectral peak is greater than the second quantity threshold, the order of the polynomial is set to the third order;

[0077] Furthermore, when performing weighted polynomial fitting, the weight of the data points within the candidate spectral peak region is set as the first weight, and the weight of the data points outside the spectral peak region is set as the second weight, wherein the first weight is less than the second weight.

[0078] The total number of identified spectral peak candidate regions is counted, and this number is compared with a preset threshold to select the most suitable polynomial order. For example, the first threshold is set to 5, the second threshold to 15, the first order to 4, the second order to 6, and the third order to 8. If three spectral peak candidate regions are detected (less than five), a fourth-order polynomial is used for fitting, suitable for spectra with simpler baseline morphology. If ten spectral peak candidate regions are detected, a sixth-order polynomial is used. If twenty are detected, an eighth-order polynomial is used to accommodate more complex baseline fluctuations.

[0079] After determining the polynomial order, a weight vector of equal length to the number of spectral data points is created. All data points falling within the candidate peak regions are assigned a low weight value, the first weight, for example, 0.01. All data points outside the peak regions are assigned a higher weight value, the second weight, for example, 1. A weighted polynomial fitting is then performed. The fitting process prioritizes data points with higher weights, i.e., points in the baseline region, while largely ignoring points in the peak regions with lower weights. The fitted polynomial curve is the first candidate baseline. This weighting strategy ensures that the fitting process primarily constructs the polynomial curve based on data points in the flat baseline regions between peaks, effectively avoiding interference from Raman characteristic peak signals on the baseline shape and obtaining a more accurate first candidate baseline.

[0080] S3, perform asymmetric least squares smoothing on the original Raman spectral data to obtain a second candidate baseline; take the minimum value of the first candidate baseline and the second candidate baseline point by point to generate a fitted baseline; subtract the fitted baseline from the original Raman spectral data to obtain the pure Raman spectrum; calculate the signal-to-noise ratio of the pure Raman spectrum, and determine the matching confidence threshold based on the signal-to-noise ratio;

[0081] Specifically, an iterative method is used to solve for a smooth curve. When fitting the original Raman spectrum data points, a small weight is applied to data points above the curve, such as 0.001, while a weight close to 1, such as 0.999, is applied to data points below the curve. At the same time, a smoothing factor, such as 10 to the power of 6, is used to constrain the smoothness of the curve itself. After multiple iterations until convergence, the resulting smooth curve is the second candidate baseline.

[0082] Create a new array with the same number of original spectral data points. Iterate from the first data point to the last data point. At each Raman shift point, compare the intensity values ​​of the first candidate baseline and the second candidate baseline at the corresponding point, and store the smaller of the two values ​​in the corresponding position of the new array. After the iteration is completed, the curve represented by the new array is the fitted baseline.

[0083] The intensity value of each data point in the original Raman spectrum is subtracted from the intensity value of the fitted baseline at the corresponding Raman shift point to obtain a difference. The new spectrum composed of the differences of all data points is the pure Raman spectrum after background subtraction.

[0084] In a pure Raman spectrum, the highest intensity peak is identified, and its peak height is taken as the signal value S. A flat region without prominent peaks is selected, and the standard deviation of the signal intensity within this region is calculated as the noise value N. The signal-to-noise ratio (SNR) is then S / N. A matching confidence threshold is determined based on a pre-defined functional relationship, for example... This means that the higher the signal-to-noise ratio, the higher the threshold will be. Figure 4 .

[0085] In an optional embodiment, the step of performing asymmetric least-squares smoothing on the original Raman spectral data to obtain a second candidate baseline includes:

[0086] The smoothing parameter λ, the asymmetric parameter p, and the number of iterations I of the asymmetric least squares smoothing algorithm are set, and the second candidate baseline is obtained through iterative calculation.

[0087] An asymmetric least squares smoothing algorithm is used to generate another candidate baseline. The original Raman spectral data is fitted iteratively, with different penalty weights applied to the peak and baseline signals. Three key parameters need to be set before execution: smoothing parameters... Control the smoothness of the baseline, for example, set to , A larger value results in a smoother, more rigid baseline. The asymmetric parameter p is used to distinguish between peaks and the baseline; for example, setting it to 0.005 assigns a much smaller weight to data points above the current baseline (potential spectral peaks) than to data points below the baseline. The number of iterations I defines the number of times the algorithm is optimized; for example, setting it to 20.

[0088] After setting the parameters, iterative calculations begin. In each iteration, a weighted least squares problem is solved to generate a new baseline. The weight matrix is ​​updated based on whether the current spectral data point is above or below the new baseline. The point, among which For signal strength, Let p be the current baseline strength, and p be the weight of the baseline. The points are weighted by 1-p. This process is repeated I times, with each iteration gradually bringing the baseline closer to the true spectral background, while the weight of the spectral peak regions becomes extremely small. After I iterations, the resulting smooth curve is the second candidate baseline, as shown below. Figure 5 .

[0089] To adjust the stringency of substance identification based on the quality of the spectrum to be measured, in an optional embodiment, calculating the signal-to-noise ratio of the pure Raman spectrum and determining a matching confidence threshold based on the signal-to-noise ratio includes:

[0090] Using formula Calculate the matching confidence threshold T, where SNR is the signal-to-noise ratio of the pure Raman spectrum. and This is a preset constant;

[0091] When the calculated T value is lower than the minimum threshold When, take To match the confidence threshold;

[0092] When the calculated T value is higher than the highest threshold When, take To match the confidence threshold.

[0093] Calculate the signal-to-noise ratio (SNR) of a pure Raman spectrum. One method is to use the maximum signal intensity value of the spectrum as the signal value and the standard deviation of the intensity of the background region as the noise value. For example, if the maximum peak intensity of a spectrum is 6000 and the standard deviation of the background region is 50, then the SNR is 120.

[0094] Assuming a preset constant It is 0.99. The value is 8. For a spectrum with an SNR of 120, the calculated T value is... For another spectrum with higher noise, the SNR might be only 30, with a calculated T value of 0.723. This indicates that the better the signal quality, the higher the required matching threshold; conversely, the threshold should be relaxed appropriately. For example, the minimum threshold... Set to 0.70, the highest threshold. Let's set it to 0.95. In the example above, both 0.923 and 0.723 are within the range, so we use them directly. If a high-quality spectrum calculates T to be 0.97, then the threshold is set to... That is, 0.95, such as Figure 6 .

[0095] S4, Match the pure Raman spectrum with a standard spectral library. When the maximum matching value obtained is greater than the matching confidence threshold, determine the corresponding principal component. Subtract the spectrum scaled proportionally to the principal component from the pure Raman spectrum to obtain the residual spectrum. When the energy of the residual spectrum meets the preset judgment condition, match the residual spectrum with the standard spectral library again to identify the minor components.

[0096] Specifically, the Pearson correlation coefficient is calculated for each known substance in the standard spectral library, comparing the pure Raman spectrum with the standard spectrum of each known substance. The largest value among all calculations is selected as the maximum match value. This maximum match value is compared with the determined match confidence threshold. If the former is greater than the latter, the substance represented by the standard spectrum corresponding to the maximum match value is considered to be the principal component in the sample to be tested.

[0097] Using the pure Raman spectrum as the main component, an optimal scaling factor is calculated using the least squares method. This factor ensures that multiplying the standard spectrum of the principal component by this factor results in the intensity of the main peaks being closest to the corresponding peaks in the pure Raman spectrum. Subtracting the scaled principal component spectrum point-by-point from the pure Raman spectrum yields the residual spectrum.

[0098] The sum of squares of the intensity values ​​of all data points in the residual spectrum is calculated to obtain the total energy of the residual spectrum. Simultaneously, the total energy of the original pure Raman spectrum is also calculated. A preset criterion is whether the total energy of the residual spectrum is greater than a specific percentage, such as 5%, of the total energy of the original pure Raman spectrum. If this condition is met, the residual spectrum is treated as a new spectra to be measured, and the matching step with the standard spectral library is repeated to identify any minor components that may be present in the sample, such as... Figure 7 Optionally, the intensity can be normalized before matching.

[0099] In an optional embodiment, matching the pure Raman spectrum with a standard spectral library includes:

[0100] Calculate the Pearson correlation coefficient between the pure Raman spectrum and each standard spectrum in the standard spectral library, and take the largest calculated Pearson correlation coefficient value as the maximum matching value.

[0101] Prepare a database containing standard Raman spectra of various known substances. The pure Raman spectrum to be identified is considered as a numerical vector Y. Retrieve standard spectra one by one from the standard spectrum library; each standard spectrum is also a numerical vector X.

[0102] For each standard spectrum X in the library, calculate its Pearson correlation coefficient r with the pure Raman spectrum Y. The formula for this coefficient is: For example, the r-value calculated by comparing the pure spectrum with the standard spectrum of ethanol in the library is 0.96, the r-value calculated with the standard spectrum of acetone is 0.85, and the r-value calculated with the standard spectrum of water is 0.32. The entire spectral library is traversed. All calculated correlation coefficient values ​​are compared, and the maximum value is found. In the above example, the maximum value is 0.96. This 0.96 is determined as the maximum match value. When the maximum match value of 0.96 is greater than the match confidence threshold, such as 0.9, the corresponding substance ethanol is considered to be the main component in the sample to be tested. Figure 8 .

[0103] To separate the identified principal component spectrum from the mixture spectrum, in an optional embodiment, subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum to obtain the residual spectrum includes:

[0104] The scaling factor k is calculated using the least squares method to minimize the sum of squared residuals between the pure Raman spectrum y and the standard spectrum x corresponding to the principal component, i.e., solving for... The residual spectrum is obtained by multiplying the standard spectrum corresponding to the principal component by the scaling factor k and then subtracting it from the pure Raman spectrum.

[0105] Two spectral vectors are determined for the calculation: the pure Raman spectrum y, i.e., the baseline-corrected spectrum of the sample, and the standard spectrum x, i.e., the best-matching standard spectrum found above, corresponding to the principal component. Since the concentration of the principal component in the sample is unknown, and the spectral intensity differs from that in the standard spectral library, an optimal scaling factor k needs to be calculated.

[0106] The value of k is determined by solving a least-squares problem, with the goal of minimizing the sum of squares of the differences between y and k times x. The optimal scaling factor can be derived from the formula. For example, by calculating k for all data points across the entire spectral range, a value of 0.75 is obtained. Multiplying each data point of the standard spectrum x by 0.75 yields a scaled spectrum that matches the contribution of the principal component in the spectrum to be measured. Subtracting the value of the corresponding point in the scaled spectrum from each data point of the pure Raman spectrum y yields the residual spectrum. Theoretically, this residual spectrum contains spectral information of substances in the sample other than the principal component.

[0107] In an optional embodiment, the step of determining when the energy of the residual spectrum meets a preset criterion includes:

[0108] The preset judgment condition is that the energy ratio of the residual spectrum to the pure Raman spectrum is greater than a preset energy ratio threshold;

[0109] Calculate the root mean square value of the signal intensity of the residual spectrum R. and the root mean square value of the signal intensity of the pure Raman spectrum P ,in , When the ratio When the value is greater than the preset energy ratio threshold, it is determined that the preset determination condition is met.

[0110] This is used to determine whether the remaining spectral signal after removing the principal components is sufficiently prominent, and whether further mixture analysis is necessary. The root mean square value of the signal intensity is used to represent the energy of the spectrum; the entire spectrum is considered as a signal vector, and the energy is related to the overall amplitude of the signal. The energy of the original pure Raman spectrum P is calculated. ,in These are spectral data points, and N is the total number of points. For example, the calculation yields... The value is 500. Calculate the energy of the residual spectrum R after subtracting the principal components. If the residual spectrum still contains prominent characteristic peaks of other substances, the calculated... This will be a non-negligible value, for example, 120. If the sample is a pure substance, the residual spectrum should mainly consist of noise, and the energy value will be very small. Subsequently, the ratio of the above two energy values ​​is calculated to be 0.24. This ratio is compared with a preset energy ratio threshold, for example, 0.1. Because 0.24 is greater than 0.1, it is determined that the preset condition is met, indicating that there is a prominent signal in the residual spectrum. The residual spectrum needs to be used as a new spectrum to be measured, and the matching and subtraction analysis process needs to be repeated.

[0111] In a second embodiment, the present invention also provides an intelligent inspection system for a handheld Raman spectrometer, comprising the following modules:

[0112] The first identification module is used to acquire the raw Raman spectral data of the hazardous material to be tested; and to identify candidate regions of spectral peaks in the raw Raman spectral data.

[0113] The determination module is used to determine the polynomial order based on the number of candidate peak regions, wherein the polynomial order increases with the increase of the number of candidate peak regions, and to perform weighted polynomial fitting on the original Raman spectral data to obtain a first candidate baseline, wherein during the fitting process, the weights lower than the non-peak regions are assigned to the candidate peak regions.

[0114] The calculation module is used to perform asymmetric least squares smoothing on the original Raman spectral data to obtain a second candidate baseline; to take the minimum value of the first candidate baseline and the second candidate baseline point by point to generate a fitted baseline; to subtract the fitted baseline from the original Raman spectral data to obtain a pure Raman spectrum; to calculate the signal-to-noise ratio of the pure Raman spectrum and to determine the matching confidence threshold based on the signal-to-noise ratio;

[0115] The second identification module is used to match the pure Raman spectrum with a standard spectral library. When the maximum matching value obtained is greater than the matching confidence threshold, the corresponding principal component is determined. The residual spectrum is obtained by subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum. When the energy of the residual spectrum meets the preset judgment condition, the residual spectrum is matched with the standard spectral library again to identify the minor components.

[0116] In this specification, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise limited, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. In this document, "a," "an," "the," "the," and "its" may also include plural forms unless the context clearly indicates otherwise. "Multiple" refers to at least two, such as 2, 3, 5, or 8, etc. "And / or" includes any and all combinations of the associated listed items.

[0117] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0118] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for intelligent inspection of a handheld Raman spectrometer, characterized in that, Includes the following steps: Acquire the raw Raman spectral data of the hazardous material to be tested; identify candidate regions of spectral peaks in the raw Raman spectral data; The polynomial order is determined based on the number of candidate peak regions, and a weighted polynomial fit is performed on the original Raman spectral data to obtain the first candidate baseline. During the fitting process, the weights lower than those of non-peak regions are assigned to the candidate peak regions. The original Raman spectral data are smoothed using asymmetric least squares to obtain a second candidate baseline; the minimum value of the first candidate baseline and the second candidate baseline is taken point by point to generate a fitted baseline; The fitted baseline is subtracted from the original Raman spectral data to obtain the pure Raman spectrum; Calculate the signal-to-noise ratio of the pure Raman spectrum, and determine the matching confidence threshold based on the signal-to-noise ratio; The pure Raman spectrum is matched with a standard spectral library. When the maximum matching value obtained is greater than the matching confidence threshold, the corresponding principal component is determined. The residual spectrum is obtained by subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum. When the energy of the residual spectrum meets the preset judgment condition, the residual spectrum is matched again with the standard spectral library to identify minor components.

2. The method according to claim 1, characterized in that, The identification of candidate peak regions in the raw Raman spectral data includes: The raw Raman spectral data is smoothed using Savitzky-Golay and the first derivative is calculated. All Raman shift points in the first derivative that change from positive to negative values ​​after crossing zero are identified. The regions within the range of the shift points and N data points to their left and right are marked as candidate peak regions.

3. The method according to claim 1, characterized in that, Determining the polynomial order based on the number of candidate spectral peak regions includes: When the number of candidate regions of the spectral peak is less than the first quantity threshold, the order of the polynomial is set to the first order; When the number of candidate regions of the spectral peak is between a first quantity threshold and a second quantity threshold, the order of the polynomial is set to the second order. When the number of candidate regions of the spectral peak is greater than the second quantity threshold, the order of the polynomial is set to the third order; Furthermore, when performing weighted polynomial fitting, the weight of the data points within the candidate spectral peak region is set as the first weight, and the weight of the data points outside the spectral peak region is set as the second weight, wherein the first weight is less than the second weight.

4. The method according to claim 1, characterized in that, The step of performing asymmetric least-squares smoothing on the original Raman spectral data to obtain a second candidate baseline includes: The smoothing parameter λ, the asymmetric parameter p, and the number of iterations I of the asymmetric least squares smoothing algorithm are set, and the second candidate baseline is obtained through iterative calculation.

5. The method according to claim 3, characterized in that, The calculation of the signal-to-noise ratio of the pure Raman spectrum and the determination of the matching confidence threshold based on the signal-to-noise ratio include: Using formula Calculate the matching confidence threshold T, where SNR is the signal-to-noise ratio of the pure Raman spectrum. and This is a preset constant; When the calculated T value is lower than the minimum threshold When, take To match the confidence threshold; When the calculated T value is higher than the highest threshold When, take To match the confidence threshold.

6. The method according to claim 1, characterized in that, The step of matching the pure Raman spectrum with a standard spectral library includes: Calculate the Pearson correlation coefficient between the pure Raman spectrum and each standard spectrum in the standard spectral library, and take the largest calculated Pearson correlation coefficient value as the maximum matching value.

7. The method according to claim 1, characterized in that, The step of subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum to obtain the residual spectrum includes: The scaling factor k is calculated using the least squares method to minimize the sum of squared residuals between the pure Raman spectrum y and the standard spectrum x corresponding to the principal component, i.e., to solve for... The residual spectrum is obtained by multiplying the standard spectrum corresponding to the principal component by the scaling factor k and then subtracting it from the pure Raman spectrum.

8. The method according to claim 1, characterized in that, The step of determining when the energy of the residual spectrum meets a preset condition includes: The preset judgment condition is that the energy ratio of the residual spectrum to the pure Raman spectrum is greater than a preset energy ratio threshold; Calculate the root mean square value of the signal intensity of the residual spectrum R. and the root mean square value of the signal intensity of the pure Raman spectrum P When the ratio When the value is greater than the preset energy ratio threshold, it is determined that the preset determination condition is met.

9. A handheld Raman spectrometer intelligent inspection system, characterized in that, Includes the following modules: The first identification module is used to acquire the raw Raman spectral data of the hazardous material to be tested; and to identify candidate regions of spectral peaks in the raw Raman spectral data. The determination module is used to determine the polynomial order based on the number of candidate peak regions, and to perform weighted polynomial fitting on the original Raman spectral data to obtain a first candidate baseline, wherein during the fitting process, the weights lower than the non-peak regions are assigned to the candidate peak regions. The calculation module is used to perform asymmetric least squares smoothing on the original Raman spectral data to obtain a second candidate baseline; and to take the minimum value of the first candidate baseline and the second candidate baseline point by point to generate a fitted baseline. The fitted baseline is subtracted from the original Raman spectral data to obtain the pure Raman spectrum; Calculate the signal-to-noise ratio of the pure Raman spectrum, and determine the matching confidence threshold based on the signal-to-noise ratio; The second identification module is used to match the pure Raman spectrum with a standard spectral library, and when the maximum matching value obtained is greater than the matching confidence threshold, the corresponding principal component is determined. The residual spectrum is obtained by subtracting the spectrum scaled proportionally to the principal component from the pure Raman spectrum. When the energy of the residual spectrum meets the preset judgment condition, the residual spectrum is matched again with the standard spectral library to identify minor components.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program, when executed by a processor, implements the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Asymmetric weighted least squares based Raman spectrum detection baseline correction method

    CN108844939A

  • Raman spectrum baseline piecewise polynomial fitting method based on sliding window

    CN118245732A