Turbidity compensation method, device and terminal

By establishing a turbidity compensation model, the spectral interference caused by suspended particles in sewage is removed, and the problem of turbidity interference in water quality detection is solved, achieving more accurate water sample analysis.

CN119044095BActive Publication Date: 2025-03-18QUANZHOU INST OF EQUIP MFG +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411536458.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-18
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

In water quality detection, suspended particles in non-transparent wastewater cause scattering in spectral analysis, interfering with the real absorption signal, making the detection results in inaccurate.

Method used

By obtaining the turbidity and absorption spectrum of the water to be measured, a turbidity compensation model is established, the absorbance interference value is output, and the interference in the absorption spectrum is removed to obtain a pure absorption spectrum.

Benefits of technology

Effectively remove the interference of turbidity on the absorption spectrum, improve the accuracy of water quality detection, and provide more accurate water sample analysis data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119044095B_ABST
    Figure CN119044095B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a turbidity compensation method, device and terminal, wherein the turbidity compensation method comprises: obtaining the turbidity to be measured and the absorption spectrum to be measured of the water to be measured; inputting the turbidity to be measured into a turbidity compensation model, and outputting the absorbance interference value of the water to be measured; the turbidity compensation model is established based on a pure spectrum; based on the absorption spectrum to be measured and the absorbance interference value, the pure absorption spectrum of the water to be measured is calculated. The turbidity compensation method provided in the embodiment of the present application can eliminate the interference of turbidity on the absorption spectrum.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of water quality detection, and in particular to a turbidity compensation method, device and terminal. Background Art

[0002] In the fields of environmental monitoring and water quality analysis, it is necessary to measure various data of water bodies in order to analyze the water pollution and formulate corresponding water area management plans. By using spectral analysis to obtain the absorption spectrum of sewage, the absorption characteristics of compounds in sewage samples can be studied to analyze the pollution situation.

[0003] However, the water bodies that need to be treated are generally non-transparent sewage, containing a large number of suspended particles. When light passes through the sewage sample, the suspended particles block the path of the light and scatter it instead of being absorbed by the sewage sample, making the absorption characteristics of the compound in the obtained spectrum inaccurate, and the shape and intensity of the spectrum change.

[0004] Therefore, when detecting water body data, the scattering phenomenon generated by sewage samples will increase the background signal in the detection system, interfere with the real absorption signal, make the detection results contain inaccurate information, and affect the treatment of sewage. Summary of the invention

[0005] In view of the above problems, the embodiments of the present application provide a turbidity compensation method, device and terminal, which can eliminate the interference of turbidity on the absorption spectrum.

[0006] In a first aspect, an embodiment of the present application provides a turbidity compensation method, comprising:

[0007] Obtaining the turbidity to be measured and the absorption spectrum to be measured of the water to be measured;

[0008] The turbidity to be measured is input into the turbidity compensation model, and the absorbance interference value of the water to be measured is output; the turbidity compensation model is established based on the pure spectrum;

[0009] Based on the absorption spectrum to be tested and the absorbance interference value, the pure absorption spectrum of the water to be tested is calculated.

[0010] In an optional implementation, the turbidity compensation model is established based on the pure spectrum and further includes:

[0011] Obtain clean spectra of multiple sewage samples;

[0012] Obtain characteristic wavelengths of multiple pure spectra;

[0013] Based on the pure spectrum and characteristic wavelength, a turbidity compensation model is obtained.

[0014] In an optional implementation, obtaining clean spectra of a plurality of sewage samples includes:

[0015] Obtain turbidity data and absorption spectrum data of multiple sewage samples;

[0016] Based on the turbidity data, the pure spectrum data corresponding to the minimum turbidity is determined;

[0017] Based on the plurality of absorption spectrum data and the pure spectrum data, a plurality of pure spectra are obtained.

[0018] In an optional implementation, a plurality of characteristic wavelengths of pure spectra are obtained, including:

[0019] Performing principal component analysis on a plurality of pure spectra to obtain a plurality of characteristic wavelengths whose contribution rates meet a first threshold;

[0020] Get the number of target features N;

[0021] N characteristic wavelengths are determined based on the plurality of characteristic wavelengths.

[0022] In an optional implementation, a turbidity compensation model is obtained based on the pure spectrum and the characteristic wavelength, including:

[0023] Based on the turbidity data and N characteristic wavelengths, N intermediate compensation models and corresponding evaluation indicators are obtained;

[0024] Based on the evaluation indicators, the intermediate compensation model with the highest accuracy is determined to be the turbidity compensation model.

[0025] In an optional implementation, based on the turbidity data and N characteristic wavelengths, N intermediate compensation models and corresponding evaluation indicators are obtained, including:

[0026] Sequentially obtain multiple absorbances of multiple pure spectra corresponding to N characteristic wavelengths;

[0027] Based on the turbidity data and multiple absorbances, N intermediate compensation models and corresponding evaluation indicators are obtained in turn.

[0028] In an optional implementation, the evaluation indicators include: determination coefficient and root mean square error.

[0029] In a second aspect, an embodiment of the present application provides a turbidity compensation device, comprising:

[0030] A data acquisition module, used for acquiring the absorption spectrum of the water to be tested;

[0031] The turbidity compensation module is used to input the absorption spectrum to be measured into the turbidity compensation model and output the absorbance interference value of the water to be measured;

[0032] The data processing module is used to make a difference between the absorption spectrum to be measured and the absorbance interference value to obtain the pure absorbance of the water to be measured.

[0033] In a third aspect, an embodiment of the present application provides a terminal, comprising: a memory and a processor; the memory stores a computer program or instruction that can be executed by the processor; the processor executes the computer program or instruction to implement the turbidity compensation method of any one of the above-mentioned first aspects.

[0034] In a fourth aspect, an embodiment of the present application provides a computer storage medium, in which a computer program or instruction that can be executed by a processor is stored. When the computer program or instruction is executed, the turbidity compensation method of any one of the above-mentioned first aspects is implemented.

[0035] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device executes the turbidity compensation method described in any one of the first aspects above.

[0036] The turbidity compensation method, device and terminal provided in the embodiment of the present application establish a turbidity compensation model for the turbidity and absorbance interference values ​​to obtain the corresponding relationship between the turbidity and absorbance interference values, and then use the turbidity compensation model and the turbidity of the water to be measured to obtain the interference value of the absorbance under the turbidity, and then use the difference method to remove the interference value of the absorbance at each wavelength in the absorption spectrum to obtain the absorbance at multiple wavelengths that is not affected by turbidity, and thus obtain a pure absorption spectrum that is not affected by turbidity. This method can effectively remove the absorbance error caused by turbidity when measuring the absorption spectrum of a water sample, thereby obtaining a pure absorption spectrum without the influence of turbidity, and providing accurate measurement data for subsequent water quality research.

[0037] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 It is a flow chart of the turbidity compensation method provided in the embodiment of the present application.

[0040] Figure 2 This is a schematic diagram of a pure spectrum provided in an embodiment of the present application.

[0041] Figure 3It is a schematic diagram of the structure of the turbidity compensation device provided in an embodiment of the present application.

[0042] Figure 4 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used in the specification of the application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification, claims and drawings of this application are intended to cover non-exclusive inclusions.

[0045] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0046] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0047] The directional words appearing in the following description are all directions shown in the drawings, and are not specific limitations of the present application. For example, in the description of the present application, the directions or positional relationships indicated by the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation of the present application.

[0048] In addition, the terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order, and may explicitly or implicitly include one or more of the features.

[0049] In the description of the present application, unless otherwise specified, “plurality” means more than two (including two), and similarly, “plurality groups” means more than two (including two).

[0050] In the fields of environmental monitoring and water quality analysis, it is necessary to measure various data of water bodies in order to analyze the water pollution and formulate corresponding water area management plans. By using spectral analysis to obtain the absorption spectrum of sewage, the absorption characteristics of compounds in sewage samples can be studied to analyze the pollution situation.

[0051] However, the water bodies that need to be treated are generally non-transparent sewage, containing a large number of suspended particles. When light passes through the sewage sample, the suspended particles block the path of the light and scatter it instead of being absorbed by the sewage sample, making the absorption characteristics of the compound in the obtained spectrum inaccurate, and the shape and intensity of the spectrum change.

[0052] Based on the above problems, the embodiments of the present application provide a turbidity compensation method, device and terminal, which can eliminate the interference of turbidity on the absorption spectrum when detecting water body data, so as to make the detection result more accurate.

[0053] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0054] Figure 1 Schematic diagram of a turbidity compensation method provided in the embodiment of the present application. Figure 1 As shown, the turbidity compensation method provided in the embodiment of the present application may include:

[0055] S101, obtaining the turbidity and absorption spectrum of the water to be tested.

[0056] Turbidity refers to the amount of suspended particles such as soil, silt, fine organic matter, inorganic matter, plankton, etc. in a liquid. These particles can scatter or absorb light, thereby affecting the transparency of the liquid and making the liquid turbid.

[0057] In water quality testing, turbidity is an important parameter used to evaluate water cleanliness and filtration effects. The magnitude of turbidity is related to the content, size, shape, refractive index, etc. of suspended solids. The larger the turbidity value, the more turbid the water. Turbidity is usually measured using a turbidity meter, which determines the turbidity value by measuring the scattering or transmission of light when passing through a water sample. The measurement result unit can be expressed in Nephelometric Turbidity Units (NTU).

[0058] Absorption spectrum is a measure of a substance's ability to absorb light of a specific wavelength. Each substance has its own specific absorption spectrum, so the composition, content and structure of the substance can be understood through absorption spectrum analysis, thereby identifying and quantifying the substance. Absorbance refers to the ability of a solution to absorb light of a specific wavelength, and the absorption spectrum consists of absorbance at different wavelengths.

[0059] For example, the turbidity of a medium turbidity water sample is 20 NTU. Assuming the wavelength range is 400-700nm, the absorption spectrum data is: 400nm: 0.03, 500nm: 0.05, 600nm: 0.07, 700nm: 0.09; the turbidity of a high turbidity water sample is 50 NTU, and the absorption spectrum data is: 400nm: 0.06, 500nm: 0.10, 600nm: 0.15, 700nm: 0.20. It can be seen that as the turbidity increases, the absorbance of the water sample at the same wavelength also increases. It can be seen that there is a correlation between the turbidity and absorbance of the water sample, and the absorption spectrum corresponding to the turbidity can be predicted by establishing a data model of turbidity and absorbance.

[0060] S102, input the turbidity to be measured into the turbidity compensation model, and output the absorbance interference value of the water to be measured. The turbidity compensation model is established based on the pure spectrum.

[0061] Specifically, the turbidity to be measured is the turbidity of the water to be measured, and the turbidity compensation model is a data model of turbidity and absorbance interference value. By inputting the turbidity into the turbidity compensation model, the absorbance interference value of the turbidity on the water quality can be obtained, which represents the interference of the turbidity on the measured absorption spectrum. For example, when the turbidity is 20 NTU, the absorbance interference value is 0.01, which will increase the absorbance value of the measured absorption spectrum at each wavelength by 0.01.

[0062] S103, calculating and obtaining the pure absorption spectrum of the water to be tested based on the absorption spectrum to be tested and the absorbance interference value.

[0063] Specifically, the absorption spectrum is a spectrum curve composed of absorbances at multiple wavelengths. The absorption spectrum to be measured is a spectrum curve affected by turbidity measured according to the ultraviolet visible absorption spectroscopy. By removing the absorbance interference values ​​from the multiple absorbances of the spectrum curve, the part of the absorbance affected by turbidity is removed, and multiple absorbances without turbidity are obtained. Then, the absorption spectrum composed of multiple absorbances without turbidity is the pure absorption spectrum without turbidity.

[0064] By establishing a turbidity compensation model for the turbidity and absorbance interference values, the corresponding relationship between the turbidity and absorbance interference values ​​is obtained. Then, the turbidity compensation model and the turbidity of the water to be measured are used to obtain the interference value of the absorbance under the turbidity. Then, the interference value of the absorbance at each wavelength in the absorption spectrum is removed by the difference method, and the absorbance at multiple wavelengths not affected by turbidity is obtained, thus obtaining a pure absorption spectrum not affected by turbidity. This method can effectively remove the absorbance error caused by turbidity when measuring the absorption spectrum of water samples, thereby obtaining a pure absorption spectrum without the influence of turbidity, providing accurate measurement data for subsequent water quality research.

[0065] Optionally, the turbidity compensation model in S102 is established based on the pure spectrum and may include:

[0066] S201. Obtain pure spectra of multiple sewage samples.

[0067] Specifically, the pure spectrum is the spectrum data obtained by removing the influence of turbidity from the absorption spectrum data of the sewage sample. The sewage sample can be collected from the sewage source or the treatment system, and pollution and oxidation are avoided as much as possible during the sample collection process.

[0068] Optionally, S201 may include:

[0069] S2011. Obtain turbidity data and absorption spectrum data of multiple sewage samples.

[0070] Specifically, after the sewage sample is collected, the sewage sample is placed in a spectrometer, and the absorption spectrum data of the sewage sample is measured by the spectrometer. For example, commonly used spectrometers include ultraviolet-visible spectrometers, infrared spectrometers, Raman spectrometers, etc., and a suitable spectrometer can be selected from them to perform spectrum measurement based on the chemical composition and wavelength range to be analyzed, and the spectrum characteristics of the sewage sample at different wavelengths or frequencies can be recorded.

[0071] It is understandable that combining turbidity data and absorption spectrum data can more comprehensively evaluate the water quality of sewage. For example, if the turbidity of a sewage sample is measured to be 20 NTU, it means that the sewage contains a large number of suspended particles, which may include organic and inorganic substances. The absorption spectrum data of the sewage sample is measured within the wavelength range of 200 nm to 800 nm, with a maximum absorption peak at about 280 nm and a secondary absorption peak at about 400 nm. The absorption peak at 280 nm indicates the presence of organic matter such as aromatic compounds or proteins in the sewage, and the absorption peak at 400 nm indicates the presence of metal ions such as iron and copper in the sewage.

[0072] S2012. Determine pure spectrum data corresponding to minimum turbidity based on the turbidity data.

[0073] Specifically, each sewage sample includes a turbidity and an absorption spectrum data. The turbidity and absorption spectrum data of a single sewage sample correspond. Multiple sewage samples have multiple turbidities in common. The multiple turbidities of multiple sewage samples constitute the turbidity data. The minimum turbidity can be selected from multiple turbidities by comparison, sorting, and other methods. Then, the corresponding pure spectrum data can be obtained based on the minimum turbidity. The pure spectrum data corresponding to the minimum turbidity can be regarded as the spectrum data interfered by turbidity in all sewage samples, which is composed of absorbance at multiple wavelengths. Exemplarily, the spectral data is represented in the form of coordinates, which can be (wavelength (unit nm), absorbance). For example, the spectral data may include: (220, 0.8572677), (220.5, 0.8352276), (221, 0.8133832)...

[0074] S2013. Obtain multiple pure spectra based on the multiple absorption spectrum data and the pure spectrum data.

[0075] Specifically, the absorption spectrum data of multiple sewage samples are subtracted from the pure spectrum data to obtain the pure spectrum of multiple sewage samples. For example, the absorption spectrum data of sample 1 includes: (220, 0.8572677), (220.5, 0.8352276), (221, 0.8133832)..., the pure spectrum data includes: (220, 0.2601446), (220.5, 0.2503132), (221, 0.2402563)..., then the pure spectrum of sample 1 includes: (220, 0.5971231), (220.5, 0.5849144), (221, 0.5731269)...

[0076] S202, obtaining characteristic wavelengths of a plurality of pure spectra.

[0077] Specifically, in optics, characteristic wavelengths are often used to describe spectral characteristics. Characteristic wavelengths are one of the key parameters for understanding the nature of waves and their interactions with matter. Through data analysis, the final wavelength can be selected as the characteristic wavelength of multiple pure spectra. The characteristic wavelength includes important information about the pure spectrum, the wavelength that best explains the data changes and structure, and can help researchers further analyze and understand spectral data.

[0078] Optionally, S202 may include: performing principal component analysis on a plurality of pure spectra to obtain a plurality of characteristic wavelengths whose contribution rates meet a first threshold, obtaining a target characteristic quantity N, and determining N characteristic wavelengths based on the plurality of characteristic wavelengths.

[0079] It is understandable that the absorption spectrum data of the sewage sample includes absorbance at many wavelengths. The turbidity compensation model established in the embodiment of the present application is established based on the data of more sewage samples. Therefore, the multiple pure spectra obtained by processing the absorption spectrum data contain a large amount of data. Before establishing the turbidity compensation model, it is necessary to pre-process the data, discard the impurities in the data, and select the most important and representative data for fitting, so as to obtain a turbidity compensation model with higher accuracy more quickly.

[0080] Specifically, principal component analysis (PCA) is a commonly used data dimensionality reduction technique. PCA maps the original data into a new coordinate system through linear transformation to obtain a set of linearly unrelated variables, which are called principal components. Each principal component is a weighted linear combination of the variables in the original data set. The first principal component has the largest variance and captures the most variability in the data. Each subsequent principal component has as little redundant information of the original variables as possible and is orthogonal to the previous component.

[0081] Eigenvalues ​​and eigenvectors are important concepts in the PCA process, and each eigenvalue or eigenvector corresponds to a principal component. PCA achieves dimensionality reduction of data by retaining principal components with larger variances and discarding principal components with smaller variances. In the embodiment of the present application, characteristic wavelengths of multiple pure spectra are extracted by PCA.

[0082] In addition, the embodiment of the present application uses PCA to extract characteristic wavelengths, and the first threshold is the contribution rate of PCA. The contribution rate of PCA refers to the proportion of the variance explained by each principal component to the total variance. In principal component analysis, principal components with higher contribution rates can usually better represent the changes in the original data. Therefore, characteristic wavelengths with higher contribution rates can be extracted by PCA, while compressing the data and retaining important information in the pure spectrum.

[0083] The target feature number N is the number of characteristic wavelengths that the user needs to extract through principal component analysis. The target feature number N is related to the number of data sets used to fit the turbidity compensation model. The user can determine the target feature number N based on experience or algorithms according to preset rules.

[0084] For example, the first threshold value can be set to 95%, and the target feature number N can be set to 5, so that five feature wavelengths with contribution rates greater than or equal to 95% in multiple pure spectra can be obtained through PCA. The target feature number N can be set as needed.

[0085] Data dimensionality reduction through PCA can reduce the complexity of the data and retain most of the data information. The characteristic wavelengths extracted by PCA can retain the most important information in the pure spectrum while reducing the amount of data and the complexity of calculation.

[0086] S203. Obtain a turbidity compensation model based on the pure spectrum and characteristic wavelength.

[0087] It can be seen from the above embodiments that each pure spectrum corresponds to a turbidity, and each characteristic wavelength can correspond to an absorbance in each pure spectrum. Therefore, based on the pure spectrum and the characteristic wavelength, the corresponding relationship between turbidity and absorbance can be obtained, so as to fit a turbidity compensation model in which the input is turbidity and the output is absorbance interference value.

[0088] Optionally, S203 may include:

[0089] S2031. Based on the turbidity data and N characteristic wavelengths, N intermediate compensation models and corresponding evaluation indicators are obtained.

[0090] Specifically, N characteristic wavelengths are extracted based on multiple pure spectra, which contain important information in the pure spectrum. The pure spectrum is obtained based on the absorption spectrum. Each absorption spectrum corresponds to a turbidity, and each pure spectrum also corresponds to a turbidity. Multiple pure spectra have multiple turbidities in total, and multiple turbidities constitute turbidity data. Based on the turbidity and important information of multiple pure spectra, the intermediate compensation model and the corresponding evaluation index are obtained through algorithm fitting.

[0091] Optionally, S2031 may include: sequentially acquiring multiple absorbances of multiple pure spectra corresponding to N characteristic wavelengths, and sequentially acquiring N intermediate compensation models and corresponding evaluation indicators based on the turbidity data and the multiple absorbances.

[0092] Specifically, each characteristic wavelength has a corresponding absorbance on each pure spectrum. Therefore, for multiple pure spectra of multiple sewage samples, each characteristic wavelength corresponds to multiple absorbances. Figure 2 This is a schematic diagram of a pure spectrum provided in the embodiment of the present application. Figure 2 As shown, PCA extracts 5 characteristic wavelengths. Taking the characteristic wavelength of 200nm as an example, there is a corresponding absorbance b1 on the pure spectrum a1, and a corresponding absorbance b2 on the pure spectrum a2... and so on. Assuming there are 129 sewage samples, the characteristic wavelength of 200nm corresponds to 129 absorbances from 129 pure spectra.

[0093] Specifically, the turbidity data includes the turbidity of multiple sewage samples, each turbidity corresponds to a pure spectrum, and each pure spectrum corresponds to an absorbance at a single characteristic wavelength. Therefore, for a certain characteristic wavelength, there are multiple turbidities and absorbances corresponding to the multiple turbidities. Figure 2 As shown, the characteristic wavelength of 200 nm corresponds to 129 turbidities and 129 absorbances, and the turbidity and absorbance correspond one to one.

[0094] Optionally, the turbidity data and multiple absorbances can be fitted by an elastic network regression algorithm to obtain an intermediate compensation model and corresponding evaluation indicators.

[0095] Specifically, Ridge Regression (Ridge) regression and Least Absolute Shrinkage and Selection Operator (Lasso) regression are commonly used regression analysis algorithms. Among them, the advantage of Lasso regression is that it can produce sparse solutions and automatically select the most important features, but it is unstable when there are highly correlated features. The advantage of Ridge regression is that it can handle highly correlated features, but it usually cannot produce sparse solutions.

[0096] Therefore, the embodiment of the present application provides an elastic network regression algorithm, which combines the advantages of Ridge regression and Lasso regression, and implements feature selection and handles multicollinearity problems by adding L1 and L2 regularization terms in the loss function. The loss function of the elastic network regression algorithm is as follows:

[0097] ;

[0098] Where minimize is the minimization loss function of the elastic network regression algorithm, which is used to find the optimal value of the model parameters to minimize the value of the loss function, n is the number of samples, p is the number of features, and y is the number of features. i is the observed value of the i-th sample, x ij is the jth feature of the i-th sample, β jis the coefficient of the jth feature, λ is the regularization weight, which controls the complexity of the model, and α is the mixing parameter, which controls the ratio of L1 regularization and L2 regularization. When α=1, the elastic network degenerates into Lasso regression; when α=0, the elastic network degenerates into ridge regression. The elastic network regression algorithm balances the complexity and interpretability of the model by adjusting α, and the appropriate α value can be selected through methods such as cross-validation to reduce the probability of model overfitting.

[0099] In addition, the elastic network regression algorithm is applicable to regression problems where the number of features is higher than the number of samples, or there is a correlation between features. In the embodiment of the present application, the absorption spectrum data obtained by the ultraviolet spectrometer has a high degree of collinearity, and the characteristic dimension of the absorption spectrum data is higher than the number of samples, so the elastic network regression algorithm is selected to fit the intermediate compensation model. The elastic network regression algorithm can effectively deal with the high collinearity problem between features through the L2 regularization term, and the L1 regularization term is used to sparse the coefficient vector, so that it performs well in dealing with high-dimensional data. And it can reduce model overfitting, while effectively controlling model complexity and feature selection, and improving the generalization ability and stability of the model.

[0100] The turbidity and absorbance at each characteristic wavelength are fitted in turn by the elastic network regression algorithm, and this is performed N times in total to obtain N intermediate compensation models, and the evaluation index corresponding to the intermediate compensation model is obtained at the same time, and finally N intermediate compensation models and corresponding evaluation indexes are obtained. Among them, the intermediate compensation model is a fitting model of turbidity and absorbance corresponding to a characteristic wavelength, and the evaluation index is at least one quantitative data that can evaluate the quality of the intermediate compensation model.

[0101] Optionally, the evaluation indicators include: determination coefficient and root mean square error.

[0102] Specifically, the coefficient of determination (𝑅 2 ) and Root Mean Square Error (RMSE) are two important indicators for evaluating the goodness of fit of a model and the accuracy of prediction. The coefficient of determination provides the percentage of variance explained by the model and is a relative measure that can be used to compare the fit of different models. The coefficient of determination ranges from 0 to 1. The closer it is to 1, the better the model fits the data and the stronger its ability to explain variance. The root mean square error provides an absolute measure of the prediction error. It is the standard deviation of the difference between the predicted value and the actual observed value, and can be used to quantify the accuracy of the model's prediction. The smaller the RMSE value, the higher the prediction accuracy of the model and the smaller the difference between the actual observed value.

[0103] S2032. Based on the evaluation index, determine that the intermediate compensation model with the highest accuracy is the turbidity compensation model.

[0104] It is understandable that high 2 A low value and a low RMSE value usually mean that the model has a good fitting effect. Therefore, among the N intermediate compensation models, select 𝑅 2 The model with the largest value and the smallest RMSE value can be used as a turbidity compensation model to accurately describe the relationship between turbidity and absorbance interference values.

[0105] Therefore, when using UV-visible light spectroscopy to detect chemical oxygen demand, eliminating the influence of turbidity on the absorption spectrum is the first step in performing chemical oxygen demand regression analysis, and it is also a crucial step. The embodiment of the present application uses an elastic network regression algorithm to fit the relationship between turbidity and the change in the absorption spectrum caused by turbidity, thereby obtaining a turbidity compensation model. Subsequently, the turbidity compensation model is used to eliminate the influence of turbidity in the absorption spectrum. Eliminate the influence of scattering caused by suspended matter and other substances in sewage on the absorption spectrum.

[0106] The turbidity compensation method provided in the embodiment of the present application establishes a turbidity compensation model for turbidity and absorbance interference values ​​to obtain the corresponding relationship between turbidity and absorbance interference values, and then uses the turbidity compensation model and the turbidity of the water to be measured to obtain the interference value of the absorbance under the turbidity, and then removes the absorbance interference value at each wavelength in the absorption spectrum by difference, and obtains the absorbance at multiple wavelengths that is not affected by turbidity, thus obtaining a pure absorption spectrum that is not affected by turbidity. This method can effectively remove the absorbance error caused by turbidity when measuring the absorption spectrum of a water sample, thereby obtaining a pure absorption spectrum without the influence of turbidity, and providing accurate measurement data for subsequent water quality research.

[0107] Figure 3 Schematic diagram of the structure of the turbidity compensation device provided in the embodiment of the present application. Figure 3 As shown, the turbidity compensation device provided in the embodiment of the present application may include:

[0108] The data acquisition module 301 is used to acquire the absorption spectrum of the water to be tested.

[0109] The turbidity compensation module 302 is used to input the absorption spectrum to be measured into the turbidity compensation model and output the absorbance interference value of the water to be measured.

[0110] The data processing module 303 is used to make a difference between the absorption spectrum to be measured and the absorbance interference value to obtain the pure absorbance of the water to be measured.

[0111] Optionally, the turbidity compensation device provided in the embodiment of the present application may further include:

[0112] The spectrum acquisition module 305 is used to acquire pure spectra of multiple sewage samples.

[0113] The feature processing module 304 is used to obtain the feature wavelengths of multiple pure spectra.

[0114] The model training module 306 is used to obtain a turbidity compensation model based on the pure spectrum and the characteristic wavelength.

[0115] Optionally, the spectrum acquisition module 305 is specifically used for:

[0116] Acquire turbidity data and absorbance spectral data for multiple wastewater samples.

[0117] Based on the turbidity data, the pure spectrum data corresponding to the minimum turbidity is determined.

[0118] Based on the plurality of absorption spectrum data and the pure spectrum data, a plurality of pure spectra are obtained.

[0119] Optionally, the feature processing module 304 is specifically used for:

[0120] A principal component analysis is performed on the plurality of pure spectra to obtain a plurality of characteristic wavelengths whose contribution rates meet a first threshold.

[0121] Get the number of target features N.

[0122] N characteristic wavelengths are determined based on the plurality of characteristic wavelengths.

[0123] Optionally, the model training module 306 is specifically used for:

[0124] Based on the turbidity data and N characteristic wavelengths, N intermediate compensation models and corresponding evaluation indicators are obtained.

[0125] Based on the evaluation indicators, the intermediate compensation model with the highest accuracy is determined to be the turbidity compensation model.

[0126] Optionally, the model training module 306 is specifically used for:

[0127] A plurality of absorbances of a plurality of absorption spectrum data corresponding to N characteristic wavelengths are sequentially acquired.

[0128] Based on the turbidity data and multiple absorbances, N intermediate compensation models and corresponding evaluation indicators are obtained in turn.

[0129] Optionally, the evaluation indicators include: determination coefficient and root mean square error.

[0130] Figure 4 Schematic diagram of a terminal structure provided by an embodiment of the present application. Figure 4As shown, the terminal provided in the embodiment of the present application may include: a memory 11 and a processor 10; the memory 11 stores a computer program 12 or instructions that can be executed by the processor; the processor 10 executes the computer program 12 or the instructions to implement the turbidity compensation method described in any one of the above method embodiments.

[0131] Optionally, the terminal 1 provided in the embodiment of the present application may further include a display 13 for displaying the turbidity obtained by the turbidity compensation method.

[0132] In summary, the turbidity compensation method, device and terminal provided in the embodiment of the present application establish a turbidity compensation model for turbidity and absorbance interference values ​​to obtain the corresponding relationship between turbidity and absorbance interference values, and then use the turbidity compensation model and the turbidity of the water to be measured to obtain the interference value of the absorbance under the turbidity, and then remove the absorbance interference value at each wavelength in the absorption spectrum by difference, and obtain the absorbance at multiple wavelengths that is not affected by turbidity, so as to obtain a pure absorption spectrum that is not affected by turbidity. This method can effectively remove the absorbance error caused by turbidity when measuring the absorption spectrum of a water sample, thereby obtaining a pure absorption spectrum without the influence of turbidity, and providing accurate measurement data for subsequent water quality research.

[0133] An embodiment of the present application further provides a computer storage medium, in which a computer program or instruction that can be executed by a processor is stored. When the computer program or instruction is executed, the turbidity compensation method of any one of the above method embodiments is implemented.

[0134] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device executes the turbidity compensation method described in any one of the above method embodiments.

[0135] The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The processor in the computer reads the computer-readable program code stored in the computer-readable medium, so that the processor can perform the functional actions specified in each step or combination of steps in the above method embodiment; and generate a device for implementing the functional actions specified in each block or combination of blocks in the block diagram.

[0136] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the turbidity compensation method stored in the memory.

[0137] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.

[0138] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0139] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0140] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.

[0141] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

[0142] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, 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 embodiments of the present application.

Claims

1. A turbidity compensation method, characterized in that: The method comprises: Obtaining the turbidity to be measured and the absorption spectrum to be measured of the water to be measured; The turbidity to be measured is input into a turbidity compensation model, and the absorbance interference value of the water to be measured is output; the turbidity compensation model is established based on a pure spectrum; Based on the absorption spectrum to be measured and the absorbance interference value, a pure absorption spectrum of the water to be measured is calculated; The turbidity compensation model is established based on the pure spectrum and includes: Obtain clean spectra of multiple sewage samples; Acquire a plurality of characteristic wavelengths of the pure spectrum; The turbidity compensation model is obtained based on the pure spectrum and the characteristic wavelength.

2. The method according to claim 1, characterized in that The method of obtaining pure spectra of multiple sewage samples comprises: Obtain turbidity data and absorption spectrum data of multiple sewage samples; Based on the turbidity data, determining pure spectrum data corresponding to minimum turbidity; Based on the plurality of absorption spectrum data and the pure spectrum data, a plurality of pure spectra are obtained.

3. The method according to claim 2, characterized in that The step of obtaining a plurality of characteristic wavelengths of the pure spectrum comprises: Performing principal component analysis on the plurality of pure spectra to obtain a plurality of characteristic wavelengths whose contribution rates meet a first threshold; Get the number of target features N; N characteristic wavelengths are determined based on the plurality of characteristic wavelengths.

4. The method according to claim 3, characterized in that The step of obtaining the turbidity compensation model based on the pure spectrum and the characteristic wavelength comprises: Based on the turbidity data and the N characteristic wavelengths, N intermediate compensation models and corresponding evaluation indicators are obtained; Based on the evaluation index, the intermediate compensation model with the highest accuracy is determined as the turbidity compensation model.

5. The method according to claim 4, characterized in that The method of obtaining N intermediate compensation models and corresponding evaluation indicators based on the turbidity data and the N characteristic wavelengths includes: Sequentially acquiring a plurality of absorbances of a plurality of the pure spectra corresponding to the N characteristic wavelengths; Based on the turbidity data and the multiple absorbances, N intermediate compensation models and corresponding evaluation indicators are obtained in sequence.

6. The method according to claim 4, characterized in that The evaluation indicators include: determination coefficient and root mean square error.

7. A turbidity compensation device, characterized in that: The device comprises: A data acquisition module, used for acquiring the absorption spectrum of the water to be tested; A turbidity compensation module, used for inputting the absorption spectrum to be measured into a turbidity compensation model, and outputting the absorbance interference value of the water to be measured; the turbidity compensation model is established based on a pure spectrum; A data processing module, used for subtracting the absorption spectrum to be measured from the absorbance interference value to obtain the pure absorbance of the water to be measured; The turbidity compensation model is established based on the pure spectrum and includes: Obtain clean spectra of multiple sewage samples; Acquire a plurality of characteristic wavelengths of the pure spectrum; The turbidity compensation model is obtained based on the pure spectrum and the characteristic wavelength.

8. A terminal, characterized in that: The terminal comprises: a memory and a processor; the memory stores a computer program or an instruction that can be executed by the processor; the processor executes the computer program or the instruction to implement the turbidity compensation method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the turbidity compensation method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Turbidity compensation method, device, equipment and storage medium

    CN115266603A