A water quality detection method and system using hyperspectral analysis

Through hyperspectral analysis and multi-modal joint inversion technology, the problems of baseline drift and insufficient feature extraction of water quality detection systems in complex environments are solved, accurate estimation and real-time monitoring of water quality parameters are achieved, and the efficiency of water quality detection and management is improved. .

CN118150503BActive Publication Date: 2024-10-29ANHUI ZEAN ZHICHENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410563079.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-08
Publication Date
2024-10-29
Estimated Expiration
2044-05-08

AI Technical Summary

Technical Problem

It is difficult for the existing water quality detection system to fully and accurately reveal the chemical reaction mechanism and interaction relationship within the water body under complex environmental conditions. Moreover, it suffers from baseline drift, insufficient feature extraction and multi-parameter inversion difficulties, and the real-time water quality status is not accurately determined. .

Method used

Hyperspectral analysis method is used to collect visible, near-infrared, infrared and ultraviolet spectral data of water bodies, perform baseline correction processing and feature extraction, build a multi-modal joint inversion model, calculate water quality parameters and generate benchmark reference spectral data for real-time monitoring Water quality status.

Benefits of technology

It improves the sensitivity and accuracy of water quality detection, eliminates background interference and instrument noise, achieves accurate estimation of water quality parameters and real-time change monitoring, and improves the timeliness and scientific decision-making of water quality management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118150503B_ABST
    Figure CN118150503B_ABST
Patent Text Reader

Abstract

The present invention discloses a water quality detection method and system using hyperspectral analysis, which relates to the technical field of water quality detection, including collecting spectral data of water bodies, performing baseline correction processing on the spectral data of water bodies; performing feature extraction on the spectral data of the corrected water bodies to obtain feature vectors; constructing a multimodal joint inversion model based on the feature vectors, calculating water quality parameter estimates, and calculating benchmark reference spectral data according to the water quality parameter estimates; collecting real-time spectral data, and judging the water quality status according to the difference between the real-time spectral data and the benchmark reference spectral data. The present invention breaks through the limitations of traditional single-band or single-model inversion by constructing a multimodal joint inversion model and utilizing the complementarity and synergistic effect of the spectral data of water bodies; realizing the joint inversion of water quality parameters and generating benchmark reference spectral data with high credibility; improving the comprehensiveness and accuracy of water quality parameter estimation, and facilitating the precise and accurate assessment of water quality conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water quality detection, and in particular to a water quality detection method and system using hyperspectral analysis. Background Art

[0002] With the increasing awareness of environmental protection and the advancement of science and technology, water quality testing technology has developed rapidly. At present, most water quality testing systems on the market rely on single spectral analysis or limited pattern recognition technology. Although they can provide reliable results to a certain extent, the performance of existing technologies is still limited under complex environmental conditions, especially when facing problems such as mixture interference and baseline drift. Traditional single-mode inversion methods are difficult to fully and accurately reveal the complex chemical reaction mechanisms and interaction relationships inside the water body when dealing with multi-component and multi-source water quality problems. When establishing baseline reference spectral data, existing water quality testing systems are unable to timely reflect subtle changes in water quality conditions based solely on static references. Summary of the invention

[0003] In view of the above existing problems, the present invention is proposed.

[0004] Therefore, the present invention provides a water quality detection method and system using hyperspectral analysis to solve the problems of baseline drift, insufficient feature extraction, difficulty in multi-parameter inversion and inaccurate real-time water quality status judgment in water quality detection using hyperspectral analysis.

[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0006] In a first aspect, an embodiment of the present invention provides a water quality detection method using hyperspectral analysis, which includes collecting spectral data of a water body and performing baseline correction on the spectral data of the water body; performing feature extraction on the corrected spectral data of the water body to obtain a feature vector; based on the feature vector, constructing a multimodal joint inversion model to calculate water quality parameter estimates, and calculating benchmark reference spectral data based on the water quality parameter estimates; collecting real-time spectral data, and judging the water quality status based on the difference between the real-time spectral data and the benchmark reference spectral data.

[0007] As a preferred solution of the water quality detection method using hyperspectral analysis described in the present invention, the spectral data of the water body includes visible light spectral data, near infrared spectral data, infrared spectral data and ultraviolet spectral data.

[0008] As a preferred solution of the water quality detection method using hyperspectral analysis of the present invention, the baseline correction processing of the spectral data of the water body includes: defining the spectral data of the water body ,in Indicates different bands;

[0009] For The baseline correction formula for the spectral data of each band is expressed as:

[0010] ;

[0011] in, is the final corrected baseline spectral data, is the spectral data of water, It is applied to the original spectral data The result of smoothing is is the first-order derivative of the original spectral data. The baseline correction is estimated by least squares regression on the above processed data.

[0012] As a preferred solution of the water quality detection method using hyperspectral analysis described in the present invention, the feature extraction of the spectral data of the corrected water body includes multi-resolution analysis and feature extraction, multi-scale feature fusion and redundancy removal, and feature dimension reduction and normalization to obtain a feature vector, which is specifically as follows:

[0013] Discrete wavelet transform is used to extract features of different levels and frequencies. The specific expression is:

[0014] ;

[0015] in, It is The first subband coefficients, is the final corrected baseline spectral data, is the wavelet mother function in The low-pass filter coefficients of the layer, is the number of bands of the spectral data;

[0016] Sparse representation is used to fuse features at different levels, and redundancy is removed through regularization. The specific expression is:

[0017] ;

[0018] in, is the vector of all subband coefficients, is some predefined overcomplete dictionary matrix, is a sparse representation vector, is the regularization parameter;

[0019] Apply local preservation projection for nonlinear dimensionality reduction and normalization. The specific expression is:

[0020] ;

[0021] in, is the final eigenvector, is the fused feature vector, is the eigenvector and corresponding eigenvalue decomposition calculated by LPP, yes Norm normalization.

[0022] As a preferred solution of the water quality detection method using hyperspectral analysis described in the present invention, wherein: the multi-modal joint inversion model is constructed to calculate the estimated values ​​of water quality parameters, including defining the fusion of modal vectors and modal feature vectors, and calculating the estimated values ​​of water quality parameters, as follows:

[0023] Based on the eigenvector, the modal vector of the multimodal spectral data is defined as ,in is the number of modes, and the feature vectors of each mode are fused to form a joint feature vector. The specific expression is:

[0024] ;

[0025] in, is the joint eigenvector, For the The eigenvectors of the modes, For the The eigenvectors of the modes, It is The kernel function of the modes, It is The kernel function of the modes, represents the tensor product, is the weight matrix element obtained through optimization;

[0026] The expressions for the estimated values ​​of water quality parameters are:

[0027] ;

[0028] in, are the estimated values ​​of water quality parameters, is a water quality parameter, is the weight matrix of the last layer of the deep learning model, is the hidden layer representation of the deep learning model, which depends on the water quality parameters , is the joint eigenvector, yes Regularization parameter, is the penalty parameter of Bayesian regularization, is a regularization term selected based on Bayesian optimization.

[0029] As a preferred solution of the water quality detection method using hyperspectral analysis described in the present invention, wherein: the water quality parameter estimation value is used to calculate the reference spectral data, ... It includes turbidity and ammonia nitrogen concentration. Taking turbidity and ammonia nitrogen concentration as input values, the reference spectrum data is calculated, which is expressed as:

[0030] ;

[0031] in, is the benchmark reference spectral data, is the initial intensity of the light source, is related to wavelength The related turbidity absorption coefficient, is the turbidity, is the concentration of ammonia nitrogen The correction factor for the spectrum is is the ammonia nitrogen concentration.

[0032] As a preferred solution of the water quality detection method using hyperspectral analysis described in the present invention, the specific method of collecting real-time spectral data and judging the water quality state according to the difference between the real-time spectral data and the benchmark reference spectral data is as follows:

[0033] Define real-time spectrum data as , combined with the benchmark reference spectral data , set the safety limit to , calculate the difference, expressed as:

[0034] ;

[0035] in, Indicates the overall difference between the real-time spectral data and the benchmark reference spectral data. is the maximum value of the wavelength range of the measured spectral data, is the minimum value of the wavelength range for measuring spectral data, Indicates wavelength An infinitesimal increment of

[0036] when When the water quality is judged as "high quality", it means that the real-time spectrum data is close to the benchmark reference spectrum data, and the water quality is stable and excellent;

[0037] when When the water quality is judged as "good", it means that the water quality is still within the controllable range although it has slight fluctuations;

[0038] when When the water quality is judged as "medium", it means that the water quality has begun to deviate from the ideal state;

[0039] when When the water quality was judged as "very poor", it reflected that the water quality had seriously deteriorated.

[0040] In a second aspect, the present invention provides a water quality detection system using hyperspectral analysis, comprising a data collection module, a feature extraction module, a benchmark reference module and a water quality status judgment module; the data collection module is used to collect spectral data of a water body and perform baseline correction on the spectral data of the water body; the feature extraction module is used to perform feature extraction on the corrected spectral data of the water body to obtain a feature vector; the benchmark reference module is used to construct a multimodal joint inversion model based on the feature vector, calculate water quality parameter estimates, and calculate benchmark reference spectral data based on the water quality parameter estimates; the water quality status judgment module is used to collect real-time spectral data and judge the water quality status based on the difference between the real-time spectral data and the benchmark reference spectral data.

[0041] In a third aspect, an embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the water quality detection method using hyperspectral analysis as described in the first aspect of the present invention is implemented.

[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the water quality detection method using hyperspectral analysis as described in the first aspect of the present invention is implemented.

[0043] The beneficial effects of the present invention are as follows: by collecting spectral data of water bodies including visible light, near infrared, infrared and ultraviolet, the present invention can comprehensively reflect the spectral characteristics of various chemical components in the water body, broaden the scope of water quality detection, and improve the sensitivity and accuracy of detection; by smoothing and first-order derivative combined with least squares regression correction, background interference and instrument noise are effectively eliminated, the basic data quality of water quality detection is improved, and reliable input is provided for subsequent analysis; by constructing a multimodal joint inversion model and combining the complementarity and synergistic effect of spectral data in different bands, the joint inversion of water quality parameters is realized, and the credibility and accuracy of water quality parameter estimation are improved; by collecting real-time spectral data and comparing it with benchmark reference spectral data, the changes in water quality status are reflected in real time and dynamically, which significantly improves the timeliness and scientificity of decision-making in water quality management. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0045] Figure 1 This is a flow chart of the water quality detection method using hyperspectral analysis in Example 1.

[0046] Figure 2 This is a flow chart of the water quality detection system using hyperspectral analysis in Example 1. DETAILED DESCRIPTION

[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.

[0048] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0049] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0050] Example 1

[0051] Reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, provides a water quality detection method using hyperspectral analysis, comprising the following steps:

[0052] S1. Collect spectral data of water bodies and perform baseline correction on the spectral data of water bodies.

[0053] Furthermore, the spectral data of water bodies include visible light spectral data, near-infrared spectral data, infrared spectral data and ultraviolet spectral data. By synchronously collecting the spectral data of water bodies (including but not limited to visible light, near-infrared, infrared and ultraviolet spectra), it can not only fully reflect the spectral characteristics of various components in the water body, but also expand the wavelength coverage of detection, making water quality detection more comprehensive and in-depth.

[0054] Furthermore, the spectral data of the water body is subjected to baseline correction, including: defining the spectral data of the water body ,in Represents different bands, i=1, 2, ..., N;

[0055] For The baseline correction formula for the spectral data of each band is expressed as:

[0056] ;

[0057] in, is the final corrected baseline spectral data, is the spectral data of water, It is applied to the original spectral data The result of smoothing is is the first-order derivative of the original spectral data. The baseline correction is estimated by least squares regression on the above processed data.

[0058] The Savitzky-Golay filter will be based on the selected polynomial order (such as the order is n) and the window size (such as the window size is ), the coefficients are determined by minimizing the square error between the data points in the window and the polynomial fitting value ; The details are as follows:

[0059] For the original spectral data at wavelength Where The smoothing result can be expressed as:

[0060] ;

[0061] in, is the spectral data of water, is the half-width of the filter window, which determines the size of the neighborhood involved in the fitting. The total width of the window is , are the coefficients of the polynomial fit, which are obtained by applying a polynomial fit of a specific order to the data points within the filter window.

[0062] When using least squares regression for baseline correction, the baseline is defined as a straight line approximation, and its expression is:

[0063] ;

[0064] in, is the baseline function, is the wavelength, a is the slope, and b is the intercept;

[0065] To estimate parameters a and b, it is necessary to minimize the residual sum of squares, that is, the sum of the squares of the differences between all measured points and the baseline predicted values, which is expressed as:

[0066] ;

[0067] By solving the partial derivatives of this function with respect to a and b and setting them equal to zero, we can get the estimated values ​​of a and b.

[0068] It should be noted that in the baseline correction processing stage, smoothing technology is applied to the original spectral data of each band to reduce the impact of random noise. By calculating the first-order derivative, the peaks and valleys in the spectral data can be highlighted, which is convenient for identifying and separating the real water quality parameter signals. Combined with the least squares regression method, baseline correction estimation is performed on the data after smoothing and derivative processing. This method can accurately estimate and eliminate background noise and restore pure baseline spectral data; baseline correction solves the baseline drift problem in spectral measurement and ensures the accuracy and consistency of the original spectral data.

[0069] It should also be noted that in this way, the quality of basic water quality testing data is significantly improved, factors that may interfere with the inversion of water quality parameters are eliminated, and the accuracy and reliability of subsequent analysis are ensured. Therefore, whether in scientific research or practical application, this innovative step provides solid data support for water quality testing and greatly improves the performance and practicality of the entire testing system.

[0070] S2. Extract features from the corrected spectral data of the water body to obtain a feature vector.

[0071] Furthermore, feature extraction is performed on the corrected spectral data of the water body, including multi-resolution analysis and feature extraction, multi-scale feature fusion and redundancy removal, and feature dimension reduction and normalization to obtain a feature vector, as follows:

[0072] Discrete wavelet transform is used to extract features of different levels and frequencies. The specific expression is:

[0073] ;

[0074] in, It is The first subband coefficients, is the final corrected baseline spectral data, is the wavelet mother function in The low-pass filter coefficients of the layer, , Indicates the total number of layers of wavelet decomposition; is the number of bands of the spectral data; ;

[0075] Using discrete wavelet transform for multi-resolution analysis, this method can reveal the intrinsic structure and characteristics of spectral data at different levels and frequencies. The advantage of discrete wavelet transform is that it can provide high-quality localized information in both time and frequency. Therefore, it can effectively mine the key characteristics of water quality parameter changes from the spectral data of water bodies, while reducing the dimension of the original data, reducing the amount of data processing, and greatly improving the processing efficiency.

[0076] Sparse representation is used to fuse features at different levels, and redundancy is removed through regularization. The specific expression is:

[0077] ;

[0078] in, is the vector of all subband coefficients, is some kind of predefined overcomplete dictionary matrix used to capture the complex interactions between features; is a sparse representation vector, is a regularization parameter that controls the degree of sparsity.

[0079] Sparse representation technology is used to fuse feature information from different levels and frequencies. By constructing an overcomplete dictionary matrix, the optimal vector that can represent the original feature data in a sparse manner is found, achieving efficient fusion and expression of features. At the same time, with the help of regularization methods, the feature vectors are screened and optimized to eliminate irrelevant redundant information, thereby extracting the most representative features, which helps to improve the accuracy of water quality parameter inversion.

[0080] Apply local preservation projection for nonlinear dimensionality reduction and normalization. The specific expression is:

[0081] ;

[0082] in, is the final eigenvector, is the fused feature vector, is the eigenvector and corresponding eigenvalue decomposition calculated by LPP, yes Norm normalization.

[0083] The specific expression is:

[0084] ;

[0085] in, is the vector that needs to be normalized; express of Norm, calculated as ,in is a vector The elements, is the dimension of the vector;

[0086] Will Norm normalization is applied to the eigenvectors The complete expression for is:

[0087] ;

[0088] Normalized feature vector Each element will be adjusted to its A degree of norm of 1 makes the features comparable and unaffected by scale.

[0089] In the process of dimensionality reduction, the relative distance relationship between adjacent sample points in the original high-dimensional space is preserved, which is crucial for identifying similar water quality states or changing trends of water quality parameters in water quality testing. Normalizing the feature vectors after dimensionality reduction can ensure the comparability of different features, further eliminate the dimensional influence between features, and enhance the generalization ability and stability of the model. Further extract the key information in water quality testing, thereby improving the accuracy and sensitivity of water quality status judgment.

[0090] It should be noted that the use of discrete wavelet transform to mine features of different levels and frequencies not only retains the key information of water quality parameter changes, but also reduces the data dimension and improves processing efficiency. Feature fusion and redundancy removal through sparse representation and regularization technology make the feature vector more refined and representative, which helps to improve the inversion accuracy of water quality parameters. It not only improves the efficiency of data processing, but also enhances the sensitivity and accuracy of water quality detection.

[0091] S3. Based on the eigenvector, a multimodal joint inversion model is constructed to calculate the estimated values ​​of water quality parameters. Based on the estimated values ​​of water quality parameters, the benchmark reference spectral data is calculated.

[0092] Furthermore, a multi-modal joint inversion model is constructed to calculate the estimated values ​​of water quality parameters, including defining the fusion of modal vectors and modal eigenvectors, and calculating the estimated values ​​of water quality parameters, as follows:

[0093] Based on the eigenvector, the modal vector of the multimodal spectral data is defined as ,in is the number of modes, and the feature vectors of each mode are fused to form a joint feature vector. The specific expression is:

[0094] ;

[0095] in, is the joint eigenvector, For the The eigenvectors of the modes, For the The eigenvectors of the modes, It is The kernel function of the modes, It is The kernel function of the modes, represents the tensor product, is the weight matrix element obtained through optimization, which represents the importance of the interaction between different modes;

[0096] The expressions for the estimated values ​​of water quality parameters are:

[0097] ;

[0098] in, are the estimated values ​​of water quality parameters, is a water quality parameter, is the weight matrix of the last layer of the deep learning model, is the hidden layer representation of the deep learning model, which depends on the water quality parameters , is the joint eigenvector, yes Regularization parameter, is the penalty parameter of Bayesian regularization, It is a regularization term selected based on Bayesian optimization and contains prior knowledge.

[0099] Furthermore, based on the estimated values ​​of water quality parameters, the reference spectral data are calculated, and the estimated values ​​of water quality parameters are It includes turbidity and ammonia nitrogen concentration. Taking turbidity and ammonia nitrogen concentration as input values, the reference spectrum data is calculated, which is expressed as:

[0100] ;

[0101] in, is the benchmark reference spectral data, is the initial intensity of the light source, is related to wavelength The related turbidity absorption coefficient, is the turbidity, is the concentration of ammonia nitrogen The correction factor for the spectrum is is the ammonia nitrogen concentration.

[0102] It should be noted that the complementarity and synergistic effect of the spectral data of water bodies have broken the limitations that may exist in the traditional single band or model in the inversion of water quality parameters; feature vectors rich in water quality information are extracted from the spectral data of water bodies. These feature vectors contain various manifestations of water quality parameters in different bands (visible light, near-infrared, infrared and ultraviolet spectra), thereby making full use of the specificity of different bands in perceiving water quality parameters.

[0103] It should also be noted that the construction of a multimodal joint inversion model is essentially a combination of multiple physical and chemical mechanisms and mathematical methods, combining feature vectors from different bands to jointly participate in the estimation process of water quality parameters. This joint inversion not only improves the accuracy of parameter estimation, but also solves the inversion uncertainty problem caused by insufficient information in a single band; it can comprehensively process the water quality parameter information reflected in the spectral data of different bands, find the best parameter estimation combination through optimization algorithms, and generate water quality parameter estimates with high credibility. These estimates correspond to the generated benchmark reference spectral data, which can not only be used for comparison and judgment of real-time water quality status, but also provide strong support for the prediction of water quality evolution trends;

[0104] It should also be noted that by constructing a multimodal joint inversion model, the complementarity and synergistic effect of the spectral data of the water body are fully utilized, breaking through the limitations of the traditional single-band or single-model inversion; the joint inversion of water quality parameters is achieved, and benchmark reference spectral data with high credibility is generated; the comprehensiveness and accuracy of water quality parameter estimation are improved, which helps to evaluate and track water quality conditions more finely and accurately, and has important practical significance and application value in the fields of water resources management, environmental protection, and water pollution early warning.

[0105] S4. Collect real-time spectral data, and determine the water quality status according to the difference between the real-time spectral data and the benchmark reference spectral data.

[0106] Furthermore, real-time spectral data is collected, and the specific method of judging the water quality status is as follows based on the difference between the real-time spectral data and the benchmark reference spectral data:

[0107] Define real-time spectrum data as , combined with the benchmark reference spectral data , set the safety limit to , calculate the difference, expressed as:

[0108] ;

[0109] in, Indicates the overall difference between the real-time spectral data and the benchmark reference spectral data. is the maximum value of the wavelength range of the measured spectral data, is the minimum value of the wavelength range for measuring spectral data; Indicates wavelength An infinitesimal increment of

[0110] when When the water quality is judged as "high quality", it means that the real-time spectrum data is close to the benchmark reference spectrum data, and the water quality is stable and excellent;

[0111] when When the water quality is judged as "good", it means that the water quality is still within the controllable range although it has slight fluctuations;

[0112] when When the water quality is judged as "medium", it means that the water quality has begun to deviate from the ideal state and needs to be closely monitored and necessary measures taken to improve it;

[0113] when When the water quality is judged as "extremely poor", it reflects that the water quality has seriously deteriorated. The emergency plan should be immediately activated and rectification should be actively carried out.

[0114] It should be noted that by comparing real-time monitoring with baseline data, this method can reflect water quality changes in real time and dynamically, and achieve rapid and accurate judgment of water quality status. This real-time monitoring capability greatly improves the timeliness and scientific nature of water quality management, and is conducive to timely detection and prevention of water pollution incidents.

[0115] It should also be noted that the difference calculation between real-time spectral data and benchmark reference spectral data can accurately reflect the changes in water quality relative to normal or expected states during real-time monitoring. This method can quickly identify abnormal changes in water quality parameters by quantifying the difference, and promptly discover potential trends in water quality deterioration or improvement; based on objective spectral data analysis, it avoids the errors and lags that may be caused by traditional subjective judgments, and provides strong data support for water quality management decisions.

[0116] The present embodiment also provides a water quality detection system using hyperspectral analysis, including a data collection module, a feature extraction module, a benchmark reference module and a water quality status judgment module; the data collection module is used to collect spectral data of water bodies and perform baseline correction on the spectral data of water bodies; the feature extraction module is used to extract features from the corrected spectral data of water bodies to obtain feature vectors; the benchmark reference module is used to construct a multimodal joint inversion model based on the feature vectors, calculate water quality parameter estimates, and calculate benchmark reference spectral data based on the water quality parameter estimates; the water quality status judgment module is used to collect real-time spectral data and judge the water quality status based on the difference between the real-time spectral data and the benchmark reference spectral data.

[0117] This embodiment also provides a computer device, which is suitable for the case of a water quality detection method using hyperspectral analysis, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the water quality detection method using hyperspectral analysis proposed in the above embodiment.

[0118] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.

[0119] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the water quality detection method using hyperspectral analysis as proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0120] In summary, the present invention forms a comprehensive, efficient and accurate water quality detection system by integrating technical means such as hyperspectral analysis, multi-scale feature extraction, multimodal joint inversion and real-time comparative analysis, which greatly improves the efficiency of water quality detection and management, and has broad application value and significant practical significance.

[0121] Example 2

[0122] Referring to Table 1, which is the second embodiment of the present invention, in order to further verify the advancement of the present invention, experimental simulation data of a water quality detection method using hyperspectral analysis is provided.

[0123] Seven different water quality samples were selected, and different turbidity and ammonia nitrogen concentration levels were set for each sample (clear water sample, low turbidity sample, medium turbidity sample, high turbidity sample, low ammonia nitrogen sample, medium ammonia nitrogen sample and high ammonia nitrogen sample).

[0124] First, a hyperspectral instrument is used to collect spectral data of water bodies in the visible light, near-infrared, infrared and ultraviolet bands, and correction processing is performed to ensure the data is accurate.

[0125] Secondly, for each sample, feature extraction is performed based on the corrected spectral data, and a feature vector is generated by combining discrete wavelet transform, sparse representation and local preserving projection.

[0126] Next, a multimodal joint inversion model was constructed, the characteristic vectors of each modality were fused and the estimated values ​​of water quality parameters (turbidity and ammonia nitrogen concentration) were estimated using a deep learning model, and then the benchmark reference spectral data was calculated.

[0127] Finally, the actual monitoring situation is simulated, the real-time spectral data at the current moment is obtained again, and the difference between the real-time spectral data and the benchmark reference spectral data is calculated to determine the water quality status.

[0128] The details are shown in the following table:

[0129] Table 1 Experimental record table

[0130] Sample No. S1 S2 S3 S4 S5 S6 S7 Turbidity (NTU) 0 5 15 30 0 15 30 Ammonia nitrogen concentration (mg / L) 0 1 5 10 50 100 150 Difference between reference spectral data 0.01 0.03 0.08 0.15 0.10 0.25 0.35 Real-time spectral data difference 0.01 0.02 0.09 0.17 0.12 0.28 0.37 Water quality status high quality good medium medium good Very bad Very bad

[0131] By analyzing the data in the above table, it is obvious that the effectiveness and superiority of the method of the present invention can be seen. Compared with traditional single spectral analysis or non-joint inversion models, the present invention effectively improves the accuracy of water quality parameter estimation by integrating multi-band spectral data. For example, under extreme conditions of turbidity of 15 NTU and ammonia nitrogen concentration of 100 mg / L, the difference between real-time spectral data and benchmark reference spectral data is only 0.28, while when using traditional methods, this difference may be significantly increased.

[0132] The water quality status discrimination method of the present invention can not only monitor water quality changes in real time, but also accurately distinguish four levels of water quality from "high quality" to "very poor", providing timely and accurate decision-making basis for water quality management. Especially for the complex situation where turbidity and ammonia nitrogen concentration increase at the same time, the present invention can still accurately judge the water quality status, showing strong adaptability and creativity. This reflects the significant beneficial effects and technical innovation of the present invention in the field of water quality detection.

[0133] 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 preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A water quality detection method using hyperspectral analysis, characterized in that: include: Collecting spectral data of water bodies and performing baseline correction on the spectral data of water bodies; Extract features from the corrected spectral data of the water body to obtain feature vectors; Based on the eigenvectors, a multimodal joint inversion model is constructed to calculate the estimated values ​​of water quality parameters. Based on the estimated values ​​of water quality parameters, the benchmark reference spectral data is calculated. Collect real-time spectral data and judge the water quality status according to the difference between the real-time spectral data and the benchmark reference spectral data; The baseline correction process for the spectral data of the water body includes: defining the spectral data of the water body ,in Indicates different bands; For The baseline correction formula for the spectral data of each band is expressed as: ; in, is the final corrected baseline spectral data, is the spectral data of water, It is applied to the original spectral data The result of smoothing is is the first-order derivative of the original spectral data. The baseline correction estimation is performed on the above processed data using least squares regression; The feature extraction of the corrected spectral data of the water body includes multi-resolution analysis and feature extraction, multi-scale feature fusion and redundancy removal, and feature dimension reduction and normalization to obtain a feature vector, which is as follows: Discrete wavelet transform is used to extract features of different levels and frequencies. The specific expression is: ; in, It is The first subband coefficients, is the final corrected baseline spectral data, is the wavelet mother function in The low-pass filter coefficients of the layer, is the number of bands of the spectral data; Sparse representation is used to fuse features at different levels, and redundancy is removed through regularization. The specific expression is: ; in, is the vector of all subband coefficients, is some predefined overcomplete dictionary matrix, is a sparse representation vector, is the regularization parameter; Apply local preservation projection for nonlinear dimensionality reduction and normalization. The specific expression is: ; in, is the final eigenvector, is the fused feature vector, is the eigenvector and corresponding eigenvalue decomposition calculated by LPP, yes Norm normalization; The multi-modal joint inversion model is constructed to calculate the estimated values ​​of water quality parameters, including defining the fusion of modal vectors and modal eigenvectors, and calculating the estimated values ​​of water quality parameters, as follows: Based on the eigenvector, the modal vector of the multimodal spectral data is defined as ,in is the number of modes, and the feature vectors of each mode are fused to form a joint feature vector. The specific expression is: ; in, is the joint eigenvector, For the The eigenvectors of the modes, For the The eigenvectors of the modes, It is The kernel function of the modes, It is The kernel function of the modes, represents the tensor product, is the weight matrix element obtained through optimization; The expressions for the estimated values ​​of water quality parameters are: ; in, are the estimated values ​​of water quality parameters, is a water quality parameter, is the weight matrix of the last layer of the deep learning model, is the hidden layer representation of the deep learning model, which depends on the water quality parameters , is the joint eigenvector, yes Regularization parameter, is the penalty parameter of Bayesian regularization, is a regularization term selected based on Bayesian optimization; The water quality parameter estimation value is used to calculate the reference spectrum data. It includes turbidity and ammonia nitrogen concentration. Taking turbidity and ammonia nitrogen concentration as input values, the reference spectrum data is calculated, which is expressed as: ; in, is the benchmark reference spectral data, is the initial intensity of the light source, is related to wavelength The related turbidity absorption coefficient, is the turbidity, is the concentration of ammonia nitrogen The correction factor for the spectrum is is the ammonia nitrogen concentration; The specific method of collecting real-time spectral data and judging the water quality status according to the difference between the real-time spectral data and the benchmark reference spectral data is as follows: Define real-time spectrum data as , combined with the benchmark reference spectral data , set the safety limit to , calculate the difference, expressed as: ; in, Indicates the overall difference between the real-time spectral data and the benchmark reference spectral data. is the maximum value of the wavelength range of the measured spectral data, is the minimum value of the wavelength range for measuring spectral data, Indicates wavelength An infinitesimal increment of when When the water quality is judged as "high quality", it means that the real-time spectrum data is close to the benchmark reference spectrum data, and the water quality is stable and excellent; when When the water quality is judged as "good", it means that the water quality is still within the controllable range although it has slight fluctuations; when When the water quality is judged as "medium", it means that the water quality has begun to deviate from the ideal state; when When the water quality was judged as "very poor", it reflected that the water quality had seriously deteriorated.

2. The water quality detection method using hyperspectral analysis as claimed in claim 1, characterized in that: The spectral data of the water body includes visible light spectral data, near infrared spectral data, infrared spectral data and ultraviolet spectral data.

3. A water quality detection system using hyperspectral analysis, based on the water quality detection method using hyperspectral analysis according to claim 2, characterized in that: It includes a data collection module, a feature extraction module, a benchmark reference module and a water quality status judgment module; The data collection module is used to collect spectral data of the water body and perform baseline correction processing on the spectral data of the water body; The feature extraction module is used to extract features from the corrected spectral data of the water body to obtain a feature vector; The benchmark reference module is used to construct a multi-modal joint inversion model based on the characteristic vector, calculate the estimated value of the water quality parameter, and calculate the benchmark reference spectral data according to the estimated value of the water quality parameter; The water quality status judgment module is used to collect real-time spectral data and judge the water quality status according to the difference between the real-time spectral data and the benchmark reference spectral data.

Citation Information

Patent Citations

  • Method for establishing urban river network water body spectrum library and application

    CN103473707A

  • Method and system for analyzing filling for karst reservoir based on spectrum decomposition and machine learning

    US20230083651A1