A method and system for calibrating ultraviolet-visible light spectrum of water
Through a step-by-step spectral standardization method, including wavelength accuracy correction, spectral response standardization, baseline extraction and calibration, and spectral offset compensation, the problems of low visible light band restoration, loss of spectral details, difficulty in correcting wavelength offset and baseline offset, and excessive demand for standard samples in the existing technology of ultraviolet-visible light spectroscopy applications in water bodies are solved, and highly consistent spectra and seamless model migration are achieved.
Patent Information
- Application Number
- CN202510926915.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-07-07
AI Technical Summary
Existing spectral standardization methods have problems in the application of ultraviolet-visible light spectra in water, such as low visible light band restoration, loss of spectral details, difficulty in correcting wavelength shift and baseline shift, and excessive demand for standard samples.
A step-by-step spectral standardization method is used, including wavelength accuracy correction, spectral response standardization, baseline extraction and calibration, and spectral offset compensation. The number of standard samples is optimized through singular value decomposition and Bayesian optimization algorithms to reduce the dependence on standard samples.
The degree of restoration of visible light bands and spectral details is significantly improved, wavelength offset and baseline offset are systematically corrected, the demand for standard samples is reduced, and the consistency of spectra between different devices is improved.
Smart Images

Figure CN120446020B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of environmental monitoring and analysis, and in particular to a method and system for calibrating ultraviolet and visible light spectra of water bodies. Background Art
[0002] The ultraviolet-visible spectrum of natural water can be approximated as a negative exponential function. The absorbance in the ultraviolet band decays rapidly, while the attenuation in the visible band decays more slowly. Organic matter and phytoplankton pigments are the main optically active substances that affect the spectral absorption characteristics of water bodies, manifesting as a broad shoulder peak at 240-300nm and a gentle peak at 660-700nm. The variance of the water spectrum is mainly concentrated in the ultraviolet band, resulting in existing methods mainly extracting ultraviolet features during feature extraction. The variance of visible light feature variations accounts for a low proportion of the total extracted features, resulting in insufficient restoration when reconstructing the visible light band spectrum. In addition, although existing methods can restore the overall exponential decay trend of water spectra, they have difficulty capturing and recovering subtle spectral features such as shoulder peaks and subtle absorption peaks. Therefore, it is necessary to develop dedicated spectral standardization methods for natural water bodies.
[0003] The primary goal of spectral standardization is to normalize spectral response. However, spectral inconsistencies in water bodies manifest in many forms, and existing methods fail to specifically address all manifestations of spectral differences. Baseline drift and wavelength deviation are two other major manifestations of spectral inconsistencies in water bodies. Existing spectral standardization methods struggle to correct for wavelength shift because the UV-visible spectra of natural water bodies typically lack the sharp peaks required for accurate calibration, necessitating the development of separate methods for evaluation and correction. Baseline drift, caused by a combination of spectrometer instability and the random motion of water particles, is a significant source of uncertainty in spectral measurements. Existing methods often treat the spectral baseline as a factor of uncertainty and directly deduct it, losing information about the spectral baseline. However, the baseline itself carries critical information about the concentration and composition of suspended particles. Therefore, the spectral baseline should be corrected rather than discarded. In summary, existing spectral standardization methods fail to adequately address the issue of spectral inconsistencies in water bodies.
[0004] Existing spectral standardization methods require the use of a large number of standard samples, which is time-consuming and labor-intensive. Existing methods typically require 50%-70% of the overall data set to construct the standardization method. This data usage ratio is already comparable to the ratio used to construct the water quality inversion model. Generally speaking, spectral standardization using standard samples is a necessary step before developing a water quality inversion model, especially when the model is intended to be applied to different devices. Over-reliance on standard samples will reduce the efficiency of subsequent model development and greatly increase data collection costs, further limiting the practicality of spectral standardization methods. Therefore, when constructing a spectral standardization method, it is very important to reduce dependence on the number of standard samples. Summary of the Invention
[0005] The present invention provides a method and system for standardizing the ultraviolet and visible light spectra of water bodies, which are used to solve the defects of the existing technology such as low visible light band restoration, loss of spectral details, and high dependence on standard samples, and achieve high consistency of water spectra measured by spectrometers of different devices under low standard sample conditions.
[0006] The present invention provides a method for calibrating ultraviolet-visible light spectrum of water, comprising the following steps.
[0007] Obtaining a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated;
[0008] Performing wavelength accuracy calibration on the slave spectrometer;
[0009] The following steps are performed for the ultraviolet light band and the visible light band of the slave spectrometer: spectral data of the master spectrometer and the slave spectrometer are combined to construct a joint spectral matrix, and singular value decomposition is performed on the joint spectral matrix; the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer are optimized using a Bayesian optimization algorithm to determine a minimum number of standard samples; based on the minimum number of standard samples, a conversion matrix is constructed to perform spectral response normalization processing on the ultraviolet light band and the visible light band to be corrected respectively;
[0010] performing baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples;
[0011] A spectral offset is calculated at a band boundary between the standardized ultraviolet light band and the standardized visible light band, and the spectral offset is superimposed on the standardized visible light band.
[0012] According to the water ultraviolet-visible spectrum calibration method provided by the present invention, the spectral data of the master spectrometer and the slave spectrometer are combined to construct a joint spectral matrix, and singular value decomposition is performed on the joint spectral matrix, specifically including:
[0013] Combined with the host spectrometer spectrum and the slave spectrometer spectrum , construct the joint spectral matrix :
[0014] ;
[0015] in, are respectively the ultraviolet spectrum of the host spectrometer and the ultraviolet spectrum of the slave spectrometer; or are respectively the visible light spectrum of the host spectrometer and the visible light spectrum of the slave spectrometer;
[0016] Perform singular value decomposition on the joint spectrum matrix to obtain the singular value vector ;
[0017] ,
[0018] in, is the left singular vector matrix, is a diagonal matrix of singular values, is the right singular vector matrix, is the right singular vector matrix The transposed matrix of
[0019] Perform low-rank approximation on the singular values, retaining the previous n The singular values corresponding to the principal components and their corresponding singular vectors;
[0020] The singular values and their singular vectors after low-rank approximation are expressed as;
[0021] ;
[0022] ,
[0023] in, is the left singular vector matrix after low-rank approximation, is the singular value diagonal matrix after low-rank approximation, is the right singular vector matrix after low-rank approximation, The submatrix consisting of the first n singular values retained.
[0024] According to the method for calibrating the ultraviolet-visible spectrum of water provided by the present invention, the order of the singular value decomposition and the number of standard samples used for calibrating the spectrum of the slave spectrometer are optimized using a Bayesian optimization algorithm to determine the minimum number of standard samples, specifically including:
[0025] Preselecting potential representative samples from the joint spectral matrix using a maximum sample space coverage method;
[0026] Select standard samples and principal components from the potential representative samples, use the number of standard samples k and the number of principal components n as hyperparameters, and evaluate the similarity between the corrected slave spectrometer spectrum and the master spectrometer spectrum corresponding to each group (n, k) ;
[0027] To make the spectrum of the slave spectrometer after correction similar to that of the master spectrometer Reaching the preset similarity threshold and minimizing the number of standard samples is the optimization goal, and the Bayesian optimization algorithm is used to optimize the number of standard samples k and the number of principal components n;
[0028] After the optimization is completed, the minimum standard sample number is output , the number of principal components and the corresponding minimum number of standard samples.
[0029] According to the water ultraviolet-visible spectrum calibration method provided by the present invention, the conversion matrix is constructed based on the minimum number of standard samples to perform spectral response standardization processing on the ultraviolet light band and the visible light band to be corrected, specifically including:
[0030] from Before the selection vector and vectors, respectively. ;
[0031] The normalized spectrum of the slave spectrometer is , the slave spectrometer spectrum before normalization is , the relationship is:
[0032] ,
[0033] in, Expressed as:
[0034] ;
[0035] ,
[0036] in, They represent the average values of the slave spectrometer spectrum and the host spectrometer spectrum, and I is The identity matrix of , the superscript “+” indicates the Moore-Penrose generalized inverse of the matrix, 、 They are 、 The transpose of .
[0037] According to the water ultraviolet-visible spectrum calibration method provided by the present invention, baseline extraction and baseline calibration are performed on the spectral data of the slave spectrometer based on the minimum number of standard samples, specifically comprising:
[0038] Establishing a baseline mapping relationship between the master spectrometer and the slave spectrometer based on the minimum number of standard samples;
[0039] The baselines of the host spectrometer and the slave spectrometer are extracted respectively using the improved polynomial fitting method:
[0040] Based on the baseline mapping relationship, a linear fitting method is used to fit the baseline values of the host spectrometer and the slave spectrometer;
[0041] The baseline value of the slave spectrometer spectrum is replaced by the fitted baseline value.
[0042] According to the water ultraviolet-visible spectrum calibration method provided by the present invention, the wavelength accuracy calibration of the slave spectrometer specifically includes:
[0043] Obtain the standard peak wavelength of the holmium oxide filter;
[0044] Performing wavelength accuracy calibration on the slave spectrometer using a holmium oxide filter; if the wavelength root mean square error of the slave spectrometer is greater than a preset error threshold, establishing a relationship equation between the pixel position of the slave spectrometer and the standard peak wavelength using a polynomial fitting method;
[0045] The spectrum of the slave spectrometer is linearly interpolated to a preset standard peak wavelength grid to achieve wavelength alignment of the output data of the slave spectrometer.
[0046] The present invention also provides a water ultraviolet-visible light spectrum calibration system, comprising the following modules:
[0047] An acquisition module acquires a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated;
[0048] A wavelength accuracy correction module, used for performing wavelength accuracy correction on the slave spectrometer;
[0049] a spectral response normalization module for performing, for each of the ultraviolet and visible light bands of the slave spectrometer, the following operations: constructing a joint spectral matrix by combining the spectral data of the master spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectral matrix; optimizing the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer using a Bayesian optimization algorithm to determine a minimum number of standard samples; and constructing a conversion matrix based on the minimum number of standard samples to perform spectral response normalization on each of the ultraviolet and visible light bands to be corrected;
[0050] A baseline calibration module, configured to perform baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples;
[0051] The offset compensation module is used to calculate the spectral offset at the band boundary between the standardized ultraviolet light band and the standardized visible light band, and add the spectral offset to the standardized visible light band.
[0052] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for calibrating the ultraviolet-visible spectrum of water as described above is implemented.
[0053] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for calibrating the ultraviolet-visible spectrum of water as described above is implemented.
[0054] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for calibrating the ultraviolet-visible spectrum of water.
[0055] The present invention provides a method and system for calibrating ultraviolet and visible light spectra of water bodies. The method comprises the following steps: obtaining a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated; performing wavelength accuracy calibration on the slave spectrometer; and separately performing the following steps on the ultraviolet and visible light bands of the slave spectrometer: jointly constructing a joint spectral matrix using the spectral data of the host spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectral matrix; optimizing the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer using a Bayesian optimization algorithm to determine a minimum number of standard samples; constructing a conversion matrix based on the minimum number of standard samples to perform spectral response standardization processing on the ultraviolet and visible light bands to be calibrated; performing baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples; and calculating a spectral offset at the band boundary between the standardized ultraviolet and visible light bands, and superimposing the spectral offset on the standardized visible light band. The present invention significantly improves the restoration of visible light bands and spectral details through a step-by-step spectral standardization method. It jointly optimizes the number of standard samples and the number of principal components of singular value decomposition through a Bayesian optimization algorithm. While ensuring spectral consistency, it significantly reduces the demand for standard samples and thus greatly reduces data collection costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0057] Figure 1This is one of the flow charts of the water ultraviolet-visible spectrum calibration method provided by the present invention.
[0058] Figure 2 This is the second flow chart of the method for calibrating the ultraviolet-visible spectrum of water provided by the present invention.
[0059] Figure 3 This is a comparison diagram of water spectra of multiple sample areas before and after step-by-step spectral standardization provided by the present invention.
[0060] Figure 4 This is a comparison diagram of the effects of directly applying the water quality inversion model constructed based on the host spectrum provided by the present invention to the slave spectrum.
[0061] Figure 5 It is a structural schematic diagram of the water ultraviolet-visible light spectrum calibration system provided by the present invention.
[0062] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0063] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0064] The present invention is described in detail below with reference to the accompanying drawings. The specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. In the description of the present invention, unless otherwise specified, "at least one" includes one or more. "Multiple" refers to two or more. For example, at least one of A, B, and C includes: A exists alone, B exists alone, A and B exist at the same time, A and C exist at the same time, B and C exist at the same time, and A, B, and C exist at the same time. In the present invention, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0065] The development of micro-gratings has greatly expanded the application of UV-visible spectrometers in surface water quality monitoring. UV-visible spectroscopy, with its advantages of reagent-free operation, rapid measurement, and high flexibility, has become a highly sought-after technology for in-situ water quality monitoring. Traditional water quality monitoring tasks rely on bulky laboratory-grade UV-visible spectrometers. However, the miniaturization and portability of UV-visible spectrometers (hereafter referred to as water quality spectrometers) have made them adaptable to a variety of complex scenarios, such as long-term in-situ monitoring based on buoys, portable handheld field equipment, and underwater profiling. However, with the emergence of spectrometers designed for different scenarios, significant spectral differences have been found, seriously hindering the application of water quality inversion models across different devices. These spectral differences between devices severely affect the comparability of monitoring results from different spectrometers and hinder the reuse of existing water quality inversion models across different devices. This variability requires retraining and recalibration of models for new devices, significantly reducing the efficiency of water quality monitoring applications. Therefore, this issue has become a bottleneck restricting the further development of UV-visible spectroscopy technology in in-situ water quality monitoring.
[0066] To adapt to diverse application requirements, water quality spectrometer hardware designs need to be adjusted and optimized to achieve miniaturization, portability, and in-situ monitoring. However, these hardware adjustments are often the primary cause of spectral inconsistencies between devices. For example, to achieve miniaturization, buoy-type water quality spectrometers simplify or even eliminate the optical system that suppresses internal stray light, while laboratory-grade spectrometers employ methods such as Lyot apertures and increased working distances to suppress internal stray light. To facilitate handheld operation, handheld spectrometers place the light source and grating on the same side and employ transmissive immersed fiber optics. Similarly, to minimize size and increase light source life, buoy-type spectrometers use pulsed xenon lamps for the entire UV-visible band, while laboratory-grade spectrometers typically employ a combination of deuterium and halogen lamps. While these hardware adjustments make the devices more compact, flexible, and suitable for in-situ monitoring, they also increase internal stray light, affecting water spectral quality and leading to reduced spectral consistency between devices. To address this issue, it is necessary to develop water spectral standardization methods to improve spectral consistency between different devices.
[0067] The core concept of Loading Space Standardization (LSS) is to eliminate instrument variations by utilizing the host model's loading matrix. The specific steps are divided into three parts: first, principal component analysis is performed on the host calibration sample spectrum to extract the loading matrix, which contains information on the main variations in the spectrum; then, the slave standardized sample spectrum is projected into this loading space, and a score matrix is generated through pseudo-inverse operations; finally, singular value decomposition is used to establish a transformation relationship between the host and slaves to correct for instrument or environmental variations. LSS does not require modification of the host's original calibration model, directly leveraging the stability of its loading structure. It is suitable for correcting systematic offsets such as temperature fluctuations and optical path length variations.
[0068] Spectral Space Transformation (SST) extracts a shared principal component space by performing singular value decomposition on the master and slave spectra. It then maps the test spectrum from the slave space to the master space using a transformation matrix, eliminating nonlinear differences in spectral response. SST does not assume spectral baseline alignment or smoothness.
[0069] Piecewise Direct Standardization (PDS) uses a moving window to segment the spectrum within a local wavelength range, eliminating spectral heterogeneity between instruments. The process involves selecting a wavelength window, using PLS or multivariate regression to establish a local linear relationship between the master and slave spectra, and constructing a separate transformation matrix for each segment to ultimately form a global correction model.
[0070] EPO (External Parameter Orthogonalisation) is a standardized method for eliminating spectral differences between instruments. Its core idea is to separate the instrument difference signal and the target analysis signal through orthogonal projection.
[0071] The EWMA-PCA water spectral normalization method first filters water spectral data using the exponentially weighted moving average (EWMA algorithm) to reduce noise interference and maintain the main trends of the spectral waveform. Principal component analysis (PCA) is then used to reduce the dimensionality of the filtered data and extract the principal components to eliminate redundant information in the spectra. Subsequently, a direct standardization (DS) algorithm is used to construct a conversion matrix between the master and slave spectral data. Finally, Z-score standardization and normalization are performed to unify the spectra measured by different instruments in terms of absorbance range and measurement range, thereby correcting for spectral differences between different devices.
[0072] The characteristics of the UV-visible spectrum of natural water may make existing methods inapplicable. The UV-visible spectrum of natural water can be approximated by a negative exponential function ( ). Among them, the absorbance in the ultraviolet band decays rapidly, while the attenuation in the visible band slows down. Organic matter and phytoplankton pigments are the main optically active substances that affect the spectral absorption characteristics of water bodies, which are manifested as a broad shoulder peak at 240-300nm and a gentle peak at 660-700nm. The variance of the water body spectrum is mainly concentrated in the ultraviolet band, resulting in the existing methods mainly extracting ultraviolet features during feature extraction. The proportion of visible light features in the total extracted features is low, resulting in insufficient restoration when reconstructing the visible light band spectrum. In addition, although the existing methods can restore the overall exponential decay trend of the water body spectrum, it is difficult to capture and restore subtle spectral features such as shoulder peaks and subtle absorption peaks. Therefore, it is necessary to develop a special spectral standardization method for natural water bodies.
[0073] The primary goal of spectral standardization is to normalize spectral response. However, spectral inconsistencies in water bodies manifest in many forms, and existing methods fail to specifically address all manifestations of spectral differences. Baseline drift and wavelength deviation are two other major manifestations of spectral inconsistencies in water bodies. Existing spectral standardization methods struggle to correct for wavelength shift because the UV-visible spectra of natural water bodies typically lack the sharp peaks required for accurate calibration, necessitating the development of separate methods for evaluation and correction. Baseline drift, caused by a combination of spectrometer instability and the random motion of water particles, is a significant source of uncertainty in spectral measurements. Existing methods often treat the spectral baseline as a factor of uncertainty and directly deduct it, losing information about the spectral baseline. However, the baseline itself carries critical information about the concentration and composition of suspended particles. Therefore, the spectral baseline should be corrected rather than discarded. In summary, existing spectral standardization methods fail to adequately address the issue of spectral inconsistencies in water bodies.
[0074] Existing spectral standardization methods require the use of a large number of standard samples, which is time-consuming and labor-intensive. Existing methods typically require 50%-70% of the overall data set to construct the standardization method. This data usage ratio is already comparable to the ratio used to construct the water quality inversion model. Generally speaking, spectral standardization using standard samples is a necessary step before developing a water quality inversion model, especially when the model is intended to be applied to different devices. Over-reliance on standard samples will reduce the efficiency of subsequent model development and greatly increase data collection costs, further limiting the practicality of spectral standardization methods. Therefore, when constructing a spectral standardization method, it is very important to reduce dependence on the number of standard samples.
[0075] In view of this, in order to address the problems of insufficient visible light bands, insufficient restoration of spectral details, failure to solve wavelength offset and baseline offset, and excessive demand for standard samples in existing spectral standardization methods when applied to water spectra, the present invention will propose a step-by-step spectral standardization method suitable for ultraviolet and visible light spectra of water, which is used to improve the restoration of spectral details and visible light bands by existing standardization methods, reduce the required standard samples, and thus achieve high consistency of water spectra measured by spectrometers in different scenarios (such as buoy type and handheld type), and realize seamless migration of water quality inversion models in different scenarios.
[0076] The present invention will be described in detail below with reference to specific embodiments.
[0077] In some specific embodiments of the present invention, Figure 1 As shown, this solution provides a method for calibrating ultraviolet-visible light spectra of water, the method comprising:
[0078] Step 100: Obtain a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated;
[0079] Step 200: performing wavelength accuracy calibration on the slave spectrometer;
[0080] Step 300, performing the following steps for the ultraviolet band and the visible light band of the slave spectrometer: constructing a joint spectral matrix by combining the spectral data of the master spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectral matrix; optimizing the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer using a Bayesian optimization algorithm to determine a minimum number of standard samples; constructing a conversion matrix based on the minimum number of standard samples to perform spectral response normalization processing on the ultraviolet band and the visible light band to be corrected, respectively;
[0081] Step 400: performing baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples;
[0082] Step 500: Calculate a spectral offset at a band boundary between the standardized ultraviolet light band and the standardized visible light band, and add the spectral offset to the standardized visible light band.
[0083] It's important to note that existing spectral calibration schemes exhibit significant spectral differences between spectrometers designed for different scenarios (e.g., buoy-type, handheld, also known as slaves), impacting the reuse of water quality inversion models. Hardware adjustments (e.g., light source and grating design) lead to spectral inconsistencies between devices, primarily manifesting as baseline drift, wavelength shift, and relative response differences. Furthermore, existing standardization methods (e.g., LSS, SST, PDS, and EWMA-PCA) suffer from insufficient restoration of visible light bands, resulting in loss of detail; a failure to systematically address wavelength and baseline shifts; and a high demand for standard samples (requiring 50%-70% of the dataset).
[0084] Therefore, the present invention addresses the shortcomings of the existing technology through a step-by-step spectral standardization method, improves the restoration of visible light bands and spectral details, systematically corrects wavelength offset and baseline offset, significantly reduces the demand for standard samples (down to 10%), improves spectral consistency between different devices, and supports seamless migration of water quality inversion models.
[0085] The embodiments of the present invention are described using the ultraviolet light band (200-400nm) and the visible light band (400-800nm) as examples. The present invention can be applied to ultraviolet light bands and visible light bands of different classification standards, and therefore is not limited to the specific ranges of the two bands.
[0086] In some possible embodiments of the present invention, a new spectrum standardization method for the UV-visible spectrum of water is proposed for the three main manifestations of spectral inconsistency. Figure 2 As shown, the general procedure of this method includes the following steps: (1) wavelength correction; (2) spectral relative response normalization; (3) baseline normalization; (4) spectral reconstruction.
[0087] It is worth noting that spectral relative response standardization is the process of standardizing the ultraviolet light band and the visible light band, and baseline standardization is the process of standardizing the spectrometer spectral data. The two are independent processes, and their order can be swapped according to actual needs.
[0088] In some possible implementations of the present invention, performing wavelength accuracy correction on the slave spectrometer specifically includes:
[0089] Obtain the standard peak wavelength of the holmium oxide filter;
[0090] Performing wavelength accuracy calibration on the slave spectrometer using a holmium oxide filter; if the wavelength root mean square error of the slave spectrometer is greater than a preset error threshold, establishing a relationship equation between the pixel position of the slave spectrometer and the standard peak wavelength using a polynomial fitting method;
[0091] The spectrum of the slave spectrometer is linearly interpolated to a preset standard peak wavelength grid to achieve wavelength alignment of the output data of the slave spectrometer.
[0092] Specifically, this embodiment provides an implementation method for wavelength accuracy correction. For wavelength accuracy testing and calibration, a holmium oxide standard glass filter is used to test the wavelength accuracy of handheld and float-type spectrometers.
[0093] In a possible embodiment, after calibrating the spectrometer with air, the standard filter is measured with the spectrometer to be calibrated. For example, the holmium oxide filter has 18 fixed peaks in the range of 250–700 nm. If the root mean square error of the wavelength exceeds a preset error threshold, such as 1 nm, wavelength calibration is required. The correction wavelength can be obtained by fitting the channel number of the spectrometer with the corresponding wavelength of the standard filter. For ease of post-processing, the spectra of different spectrometers are linearly interpolated onto a unified wavelength grid, and the interval of the wavelength grid can be set to 2 nm, such as from 200 nm to 800 nm.
[0094] For relative spectral response normalization in the UV and visible bands, the UV and visible bands will be normalized separately. Because spectral variations are concentrated in the UV band, the ability to depict fine spectral details is poor. Similar spectral normalization processes are used for the UV band (200-400nm) and the visible band (400-800nm). This spectral normalization process includes two key steps: constructing the conversion equation from the instrument spectrum to the host spectrum and optimizing the standard sample.
[0095] In some possible implementations of the present invention, the spectral data of the master spectrometer and the slave spectrometer are combined to construct a joint spectral matrix, and singular value decomposition is performed on the joint spectral matrix, specifically including:
[0096] Combined with the host spectrometer spectrum and the slave spectrometer spectrum , construct the joint spectral matrix :
[0097] (1);
[0098] in, are respectively the ultraviolet spectrum of the host spectrometer and the ultraviolet spectrum of the slave spectrometer; or are respectively the visible light spectrum of the host spectrometer and the visible light spectrum of the slave spectrometer;
[0099] Perform singular value decomposition on the joint spectrum matrix to obtain the singular value vector ;
[0100] (2),
[0101] in, is the left singular vector matrix, is a diagonal matrix of singular values, is the right singular vector matrix, is the right singular vector matrix The transposed matrix of
[0102] Perform low-rank approximation on the singular values, retaining the previous n The singular values corresponding to the principal components and their corresponding singular vectors;
[0103] The singular values and their singular vectors after low-rank approximation are expressed as;
[0104] (3);
[0105] (4),
[0106] in, is the left singular vector matrix after low-rank approximation, is the singular value diagonal matrix after low-rank approximation, is the right singular vector matrix after low-rank approximation, The submatrix consisting of the first n singular values retained.
[0107] Specifically, this embodiment provides an implementation for normalizing the spectral response of a slave spectrometer in the ultraviolet and visible bands. This embodiment performs relative spectral response normalization for both the ultraviolet and visible bands. Because spectral variations are concentrated in the ultraviolet band, the ability to depict subtle spectral details is poor. Similar spectral normalization processes are used for the ultraviolet band (200-400nm) and the visible band (400-800nm). This spectral normalization process includes two key steps: constructing the conversion equation from the slave to the master spectrum and optimizing the standard sample.
[0108] In some possible implementations of the present invention, the Bayesian optimization algorithm is used to optimize the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer to determine the minimum number of standard samples, specifically including:
[0109] Preselecting potential representative samples from the joint spectral matrix using a maximum sample space coverage method;
[0110] Select standard samples and principal components from the potential representative samples, use the number of standard samples k and the number of principal components n as hyperparameters, and evaluate the similarity between the corrected slave spectrometer spectrum and the master spectrometer spectrum corresponding to each group (n, k) ;
[0111] To make the spectrum of the slave spectrometer after correction similar to that of the master spectrometer Reaching the preset similarity threshold and minimizing the number of standard samples is the optimization goal, and the Bayesian optimization algorithm is used to optimize the number of standard samples k and the number of principal components n;
[0112] After the optimization is completed, the minimum standard sample number is output , the number of principal components and the corresponding minimum number of standard samples.
[0113] In some possible implementations of the present invention, constructing a conversion matrix based on the minimum number of standard samples to perform spectral response standardization on the ultraviolet light band and the visible light band to be corrected, specifically includes:
[0114] from Before the selection vector and vectors, respectively. ;
[0115] The normalized spectrum of the slave spectrometer is , the slave spectrometer spectrum before normalization is , the relationship is:
[0116] (5),
[0117] in, Expressed as:
[0118] (6);
[0119] (7),
[0120] in, They represent the average values of the slave spectrometer spectrum and the host spectrometer spectrum, and I is The identity matrix of , the superscript “+” indicates the Moore-Penrose generalized inverse of the matrix, 、 They are 、 The transpose of .
[0121] In a possible embodiment, Bayesian optimization is performed based on Optuna to search for the optimal combination.
[0122] In a possible embodiment, the Kennard-Stone method, which is a maximum coverage method of the sample space, is used to screen samples that cover the spectral variance distribution.
[0123] Specifically, regarding the construction of the conversion matrix, it is necessary to find the relationship between the master spectrum and the slave spectrum in the orthogonal space. This generally includes the following steps:
[0124] First, the combined host spectrum ( ) and the slave spectrum ( ) Construct a joint matrix and perform singular value decomposition on the joint matrix:
[0125] ,
[0126] Second, perform low-rank approximation on the singular value vector, retaining the singular values and their corresponding singular vectors corresponding to the first n components. The singular values and their singular vectors after low-rank approximation are expressed as .
[0127] Third, according to the number of standard samples k, Select the first k vectors and the last k vectors to form .
[0128] Fourth, construct the conversion equation. The normalized slave spectrum is , and its relationship with the slave spectrum before normalization is:
[0129]
[0130] in, Expressed as:
[0131]
[0132] in, Represent the average values of the slave spectrum and the master spectrum respectively. The identity matrix of , the superscript “+” indicates the Moore-Penrose generalized inverse of the matrix, 、 They are 、 The transpose of .
[0133] Specifically, in order to reduce the dependence on the number of standard samples, the present invention ensures the representativeness of the standard samples, and uses the number of standard samples as a hyperparameter, and uses Bayesian optimization to jointly optimize these two parameters with the number of principal components of the singular value decomposition required in the construction of the conversion equation, so as to reduce the dependence on the standard samples. The representativeness of the standard samples is evaluated using the Kennard-Stone method. The Kennard-Stone method ensures that the selected samples are evenly distributed in the data space by iteratively selecting samples with the largest mutual distance. One of the keys to reducing the number of standards and samples is to ensure the representativeness of the samples, and the other key is to use only necessary samples. When the contribution of the increase in the number of standard samples to the spectral similarity gradually decreases, it means that the added samples are non-essential samples. The present invention uses the number of principal components of the singular value decomposition and the number of standard samples as method hyperparameters, and uses Bayesian optimization to jointly determine the required number of standard samples. In specific implementation, the present invention uses Optuna for hyperparameter optimization. Optuna automatically terminates the search for unnecessary sample sizes by analyzing the marginal gain in spectral similarity. When additional samples no longer significantly improve the coefficient of determination, further evaluation of the hyperparameter is prematurely stopped, thereby identifying the critical optimal number. This dynamically narrows the search space, reducing unnecessary evaluations and accelerating the optimization process. The similarity between the master and slave spectra is defined by the coefficient of determination, which serves as the objective function for hyperparameter optimization.
[0134] In some possible implementations of the present invention, performing baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples specifically includes:
[0135] Establishing a baseline mapping relationship between the master spectrometer and the slave spectrometer based on the minimum number of standard samples;
[0136] The baselines of the host spectrometer and the slave spectrometer are extracted respectively using the improved polynomial fitting method:
[0137] Based on the baseline mapping relationship, a linear fitting method is used to fit the baseline values of the host spectrometer and the slave spectrometer;
[0138] The baseline value of the slave spectrometer spectrum is replaced by the fitted baseline value.
[0139] Specifically, the baseline term, UV band, and visible band are combined to restore the corrected slave spectrum. To avoid discontinuities at the UV-visible band boundary, an offset term is added to the visible band. The offset term is determined by the difference between the corrected UV and visible bands at the band boundary.
[0140] In a possible embodiment, calculating a spectral offset at a band boundary between the standardized ultraviolet light band and the standardized visible light band, and superimposing the spectral offset onto the standardized visible light band, specifically includes:
[0141] Calculating a spectral offset at a band boundary based on a spectral normalization result of the ultraviolet light band and a spectral normalization result of the visible light band;
[0142] The spectrum offset is added to the spectrum normalization result of the visible light band, so that the standardized ultraviolet light band and the standardized visible light band are smoothly connected at the spectrum boundary.
[0143] Specifically, the baseline of the master spectrum was used to correct the baseline of the slave spectrum. The baselines of the master and slave spectra were extracted using an improved polynomial fitting method. A linear fitting method was used to fit the baseline values of the master and slave spectra, thereby correcting the spectral baselines and preserving the spectral baseline information. Standard samples selected during relative spectral response normalization were used for baseline normalization.
[0144] The method for calibrating the ultraviolet and visible light spectrum of water bodies provided by the present invention addresses the defects mentioned in the background technology of "the existing methods have insufficient restoration of the visible light band and loss of details in the processing of ultraviolet and visible light spectra of natural water bodies". The key point of the present invention is to adopt a step-by-step processing strategy for ultraviolet and visible light bands and to construct a conversion equation from the machine spectrum to the host spectrum. By constructing the conversion equations separately for the standardization of the ultraviolet and visible light bands, the principal component conversion matrix of the two parts of the features is independently optimized, the weight of the visible light features is increased, and the recovery accuracy of the subtle absorption peaks is improved, thereby overcoming the problem of insufficient restoration of the visible light band. At the same time, an offset compensation mechanism is introduced at the junction of ultraviolet and visible light, and the absorbance of the visible light band is dynamically adjusted according to the difference between the two bands after correction, thereby improving the continuity of the corrected spectrum. In response to the problem of "existing methods having too high dependence on standard samples", the present invention proposes a "Bayesian joint optimization framework". By taking the number of standard samples and the number of principal components of the singular value decomposition as hyperparameters, a Bayesian optimization search for the optimal combination is performed based on Optuna; the Kennard-Stone method is used to screen samples covering the spectral variance distribution, and the introduction of redundant samples is terminated in advance in combination with marginal gain judgment, and the use of standard samples is eventually reduced from the traditional 50%-70% to 10%, significantly reducing the cost of data collection. In response to the defect that "wavelength offset and baseline offset are not systematically resolved", the present invention designs a "spectral baseline correction + wavelength offset correction" solution. When the improved polynomial fitting method is used to extract the baseline, the baseline of the slave spectrum is retained, and a spectral baseline mapping relationship from the host to the slave is constructed to avoid information loss caused by direct deduction of the traditional method; in the wavelength correction stage, in response to the problem that the water spectrum lacks characteristic peaks and the wavelength deviation cannot be evaluated, the present invention performs wavelength correction based on the characteristic peaks of the holmium oxide filter to improve the accuracy of cross-device spectral alignment.
[0145] In a specific embodiment, Figure 3 As shown, Figure 3 The present invention provides a comparison of the water spectra of multiple sample areas before and after step-by-step spectral standardization. In this embodiment, the Yongding River, Haihe River and South Canal are selected to compare the water spectra before and after step-by-step spectral standardization. Step-by-step spectral standardization includes: Figure 1 The present invention utilizes a step-by-step spectral normalization method, specifically targeting the visible light band, to enhance the restoration of spectral detail through three steps: spectral response normalization (step S300), baseline normalization (also known as baseline calibration) (step S400), and offset compensation (step 500). Compared to existing methods, this method significantly improves the restoration of spectral detail in the visible light band, particularly with respect to the phytoplankton pigment absorption peak in the 660-700nm region, thereby reducing or resolving the problem of spectral detail loss.
[0146] In a possible embodiment, the present invention significantly reduces the number of standard samples required by combining Bayesian optimization with the number of principal components of the singular value decomposition. Experimental data shows that compared to traditional methods that require 50%-70% of the entire dataset to construct the normalization method, the present invention can reduce the number of standard samples required to complete spectral response normalization while ensuring spectral consistency, reducing the need for standard samples to only 10% of the original number of samples, thereby significantly reducing data collection costs.
[0147] In a specific embodiment, as shown in Table 1, Table 1 is a comparison of the similarity of water spectra after using the water ultraviolet-visible light spectrum calibration method provided by the present invention and other background methods, wherein: R 2 UV and R 2 Vis represents the spectral similarity in the ultraviolet and visible light bands, respectively. This method, through four steps: wavelength correction, relative response normalization in the ultraviolet and visible light bands, baseline normalization, and spectral reconstruction, specifically addresses key spectral inconsistencies, including wavelength shift, baseline drift, and relative response inconsistency. This achieves high consistency in water spectra measured by spectrometers in different scenarios. Experimental results show that using this method significantly improves the similarity of water spectra measured in the visible light band using different devices (such as buoys and handhelds). Compared with background technologies such as PDS, SST, and EPO, the global spectral similarity (R²) has increased from 0.89 to 0.96 to 0.99. Spectral similarity in the ultraviolet and visible light bands has been even more significantly improved, with a significant increase from -2 to -1.4 in the visible light band to 0.96, and from 0.82 to 0.94 in the ultraviolet band to 0.99.
[0148] Table 1
[0149]
[0150] In a specific embodiment, Figure 4 As shown, Figure 4This graph compares the performance of applying a water quality inversion model constructed based on the master spectra directly to the slave spectra using the spectral normalization method presented in this paper. The first row shows the chlorophyll a inversion model, the second row shows the COD inversion model, and the third row shows the turbidity inversion model. The first to fourth columns represent different water quality spectrometers. The data in this graph demonstrates that the present invention is not only transferable from laboratory-grade spectrometers to micro-spectrometers, but also transferable and interoperable between micro-spectrometers. To validate the proposed method's applicability across different monitoring scenarios, we selected the "Handheld-2" spectrometer as a reference spectrometer and used the proposed method to calibrate other micro-spectrometers (i.e., Buoy-1, Buoy-2, and Handheld-1) to the "Handheld-2" spectrometer. Experimental results demonstrate that the spectral consistency achieved using the Handheld-2 spectrometer as the reference spectrometer (RMSE = 0.011) is slightly better than that achieved using the laboratory-grade spectrometer as the reference (RMSE = 0.035), further demonstrating the effectiveness of the proposed method. Further analysis showed that the spectral differences between micro-spectrometers were smaller than those between micro-spectrometers and laboratory-grade spectrometers, making standardization between micro-spectrometers easier than standardizing desktop spectrometers. Because handheld spectrometers are more suitable for field measurements than bulky laboratory-grade spectrometers, this invention demonstrates that it will improve the applicability of water quality spectrometers in complex scenarios.
[0151] This invention significantly improves the consistency of water spectra and facilitates the seamless migration of water quality inversion models across different devices. This means that the model can be directly applied to different devices without retraining or adjustment, significantly improving the efficiency and accuracy of water quality monitoring and expanding the application range of water quality spectrometers. Experiments have shown that after spectral standardization, the water quality inversion model constructed based on the master device spectrum can be directly applied to the slave device spectrum without the need for adjustment or model construction.
[0152] The water ultraviolet-visible light spectrum calibration system provided by the present invention is described below. The water ultraviolet-visible light spectrum calibration system described below and the water ultraviolet-visible light spectrum calibration method described above can correspond to each other.
[0153] In some specific embodiments of the present invention, Figure 5 As shown, this solution provides a water ultraviolet-visible light spectrum calibration system, including:
[0154] An acquisition module 51 is configured to acquire a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated;
[0155] A wavelength accuracy correction module 52 is used to perform wavelength accuracy correction on the slave spectrometer;
[0156] The spectral response normalization module 53 is configured to perform the following operations on the ultraviolet band and the visible light band of the slave spectrometer: constructing a joint spectral matrix by combining the spectral data of the master spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectral matrix; optimizing the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer using a Bayesian optimization algorithm to determine a minimum number of standard samples; and constructing a conversion matrix based on the minimum number of standard samples to perform spectral response normalization on the ultraviolet band and the visible light band to be corrected, respectively.
[0157] A baseline calibration module 54 is configured to perform baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples;
[0158] The offset compensation module 55 is configured to calculate a spectral offset at a band boundary between the standardized ultraviolet light band and the standardized visible light band, and to add the spectral offset to the standardized visible light band.
[0159] The implementation principle and beneficial effects of the water ultraviolet-visible light spectrum calibration system provided in an embodiment of the present invention are similar to the implementation principle and beneficial effects of the water ultraviolet-visible light spectrum calibration method shown in the above embodiment. Please refer to the implementation principle and beneficial effects of the water ultraviolet-visible light spectrum calibration method shown in the above embodiment, and no further details will be given here.
[0160] Figure 6 An example of a physical structure diagram of an electronic device is shown below. Figure 6As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communications interface 620 and the memory 630 communicate with each other via the communications bus 640. The processor 610 may call the logic instructions in the memory 630 to execute a method for calibrating the ultraviolet-visible spectrum of water, the method comprising: obtaining a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated; performing wavelength accuracy correction on the slave spectrometer; and performing the following on the ultraviolet band and visible light band of the slave spectrometer: jointly constructing a joint spectrum matrix using the spectral data of the host spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectrum matrix; and using a Bayesian optimization algorithm to perform the singular value decomposition on the singular value decomposition. The order and the number of standard samples used for spectral calibration of the slave spectrometer are optimized to determine a minimum number of standard samples; based on the minimum number of standard samples, a conversion matrix is constructed to perform spectral response standardization on the ultraviolet light band and the visible light band to be corrected respectively; based on the minimum number of standard samples, baseline extraction and baseline calibration are performed on the spectral data of the slave spectrometer; a spectral offset is calculated at the band boundary of the standardized ultraviolet light band and the standardized visible light band, and the spectral offset is superimposed on the standardized visible light band.
[0161] Furthermore, the logic instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0162] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the water ultraviolet-visible light spectrum calibration method provided by the above methods, the method comprising: obtaining a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated; performing wavelength accuracy correction on the slave spectrometer; and performing the following on the ultraviolet light band and visible light band of the slave spectrometer respectively: jointly constructing a joint spectral matrix by combining the spectral data of the host spectrometer and the slave spectrometer, and performing the following on the ultraviolet light band and visible light band of the slave spectrometer; ... The joint spectral matrix is subjected to singular value decomposition; the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer are optimized using a Bayesian optimization algorithm to determine a minimum number of standard samples; based on the minimum number of standard samples, a conversion matrix is constructed to perform spectral response standardization on the ultraviolet light band and the visible light band to be corrected respectively; based on the minimum number of standard samples, baseline extraction and baseline calibration are performed on the spectral data of the slave spectrometer; a spectral offset is calculated at the band boundary of the standardized ultraviolet light band and the standardized visible light band, and the spectral offset is superimposed on the standardized visible light band.
[0163] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the water ultraviolet-visible light spectrum calibration method provided by the above methods, the method comprising: obtaining a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated; performing wavelength accuracy correction on the slave spectrometer; and performing, on the ultraviolet light band and visible light band of the slave spectrometer, respectively: jointly constructing a joint spectral matrix by combining the spectral data of the host spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectral matrix; The invention discloses a method for optimizing the order of the singular value decomposition and the number of standard samples used for the spectrum calibration of the slave spectrometer by using a Bayesian optimization algorithm to determine a minimum number of standard samples; constructing a conversion matrix based on the minimum number of standard samples to perform spectral response standardization on the ultraviolet light band and the visible light band to be corrected, respectively; performing baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples; calculating a spectral offset at the band boundary between the standardized ultraviolet light band and the standardized visible light band, and superimposing the spectral offset on the standardized visible light band.
[0164] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0165] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for calibrating ultraviolet-visible light spectra of water, characterized in that: include: Obtaining a master spectrometer and a slave spectrometer, wherein the master spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated; Performing wavelength accuracy calibration on the slave spectrometer; The following steps are performed for the ultraviolet light band and the visible light band of the slave spectrometer: spectral data of the master spectrometer and the slave spectrometer are combined to construct a joint spectral matrix, and singular value decomposition is performed on the joint spectral matrix; the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer are optimized using a Bayesian optimization algorithm to determine a minimum number of standard samples; based on the minimum number of standard samples, a conversion matrix is constructed to perform spectral response normalization processing on the ultraviolet light band and the visible light band to be corrected respectively; performing baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples; A spectral offset is calculated at a band boundary between the standardized ultraviolet light band and the standardized visible light band, and the spectral offset is superimposed on the standardized visible light band.
2. The method for calibrating the ultraviolet-visible spectrum of water according to claim 1, wherein: The spectral data of the master spectrometer and the slave spectrometer are combined to construct a joint spectral matrix, and singular value decomposition is performed on the joint spectral matrix, specifically including: Combined with the host spectrometer spectrum and the slave spectrometer spectrum , construct the joint spectral matrix : ; in, are respectively the ultraviolet spectrum of the host spectrometer and the ultraviolet spectrum of the slave spectrometer; or are respectively the visible light spectrum of the host spectrometer and the visible light spectrum of the slave spectrometer; Perform singular value decomposition on the joint spectrum matrix to obtain the singular value vector ; , in, is the left singular vector matrix, is a diagonal matrix of singular values, is the right singular vector matrix, is the right singular vector matrix The transposed matrix of Perform low-rank approximation on the singular values, retaining the previous n The singular values corresponding to the principal components and their corresponding singular vectors; The singular values and their singular vectors after low-rank approximation are expressed as; ; , in, is the left singular vector matrix after low-rank approximation, is the singular value diagonal matrix after low-rank approximation, is the right singular vector matrix after low-rank approximation, The submatrix consisting of the first n singular values retained.
3. The method for calibrating the ultraviolet-visible spectrum of water according to claim 2, wherein: The Bayesian optimization algorithm is used to optimize the order of the singular value decomposition and the number of standard samples used for the spectrum calibration of the slave spectrometer to determine the minimum number of standard samples, specifically including: Preselecting potential representative samples from the joint spectral matrix using a maximum sample space coverage method; Select standard samples and principal components from the potential representative samples, use the number of standard samples k and the number of principal components n as hyperparameters, and evaluate the similarity between the corrected slave spectrometer spectrum and the master spectrometer spectrum corresponding to each group (n, k) ; To make the spectrum of the slave spectrometer after correction similar to that of the master spectrometer Reaching the preset similarity threshold and minimizing the number of standard samples is the optimization goal, and the Bayesian optimization algorithm is used to optimize the number of standard samples k and the number of principal components n; After the optimization is completed, the minimum standard sample number is output , the number of principal components and the corresponding minimum number of standard samples.
4. The method for calibrating the ultraviolet-visible spectrum of water according to claim 3, wherein: The step of constructing a conversion matrix based on the minimum number of standard samples to perform spectral response standardization on the ultraviolet light band and the visible light band to be corrected, specifically includes: from Before the selection vector and vectors, respectively. ; The normalized spectrum of the slave spectrometer is , the slave spectrometer spectrum before normalization is , the relationship is: , in, Expressed as: ; , in, They represent the average values of the slave spectrometer spectrum and the host spectrometer spectrum, and I is The superscript "+" indicates the Moore-Penrose generalized inverse of the matrix. 、 They are 、 The transpose of .
5. The method for calibrating the ultraviolet-visible spectrum of water according to claim 4, wherein: Based on the minimum number of standard samples, baseline extraction and baseline calibration are performed on the spectral data of the slave spectrometer, specifically including: Establishing a baseline mapping relationship between the master spectrometer and the slave spectrometer based on the minimum number of standard samples; The baselines of the host spectrometer and the slave spectrometer are extracted respectively using the improved polynomial fitting method: Based on the baseline mapping relationship, a linear fitting method is used to fit the baseline values of the host spectrometer and the slave spectrometer; The baseline value of the slave spectrometer spectrum is replaced by the fitted baseline value.
6. The method for calibrating the ultraviolet-visible spectrum of water according to claim 1, wherein: The wavelength accuracy calibration of the slave spectrometer specifically includes: Obtain the standard peak wavelength of the holmium oxide filter; Performing wavelength accuracy calibration on the slave spectrometer using a holmium oxide filter; if the wavelength root mean square error of the slave spectrometer is greater than a preset error threshold, establishing a relationship equation between the pixel position of the slave spectrometer and the standard peak wavelength using a polynomial fitting method; The spectrum of the slave spectrometer is linearly interpolated to a preset standard peak wavelength grid to achieve wavelength alignment of the output data of the slave spectrometer.
7. A water ultraviolet-visible light spectrum calibration system, characterized in that: include: An acquisition module acquires a host spectrometer and a slave spectrometer, wherein the host spectrometer is a reference spectrometer and the slave spectrometer is a spectrometer to be calibrated; A wavelength accuracy correction module, used for performing wavelength accuracy correction on the slave spectrometer; a spectral response normalization module for performing, for each of the ultraviolet and visible light bands of the slave spectrometer, the following operations: constructing a joint spectral matrix by combining the spectral data of the master spectrometer and the slave spectrometer, and performing singular value decomposition on the joint spectral matrix; optimizing the order of the singular value decomposition and the number of standard samples used for spectral calibration of the slave spectrometer using a Bayesian optimization algorithm to determine a minimum number of standard samples; and constructing a conversion matrix based on the minimum number of standard samples to perform spectral response normalization on each of the ultraviolet and visible light bands to be corrected; A baseline calibration module, configured to perform baseline extraction and baseline calibration on the spectral data of the slave spectrometer based on the minimum number of standard samples; The offset compensation module is used to calculate the spectral offset at the band boundary between the standardized ultraviolet light band and the standardized visible light band, and add the spectral offset to the standardized visible light band.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the water ultraviolet-visible light spectrum calibration method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the water ultraviolet-visible light spectrum calibration method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the water ultraviolet-visible light spectrum calibration method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method for measuring water quality parameters based on spectral data standardization
CN111198165A
Spectrum correction method, device, equipment and medium
CN117147487A