Water quality evaluation method and device, electronic equipment, storage medium and program product
By dynamically obtaining and analyzing full-band spectral data, using a variety of feature extraction algorithms and correlation coefficient calculation methods, the limitations of single water quality parameter determination in the existing technology are solved, and comprehensive pollution assessment and eutrophication level prediction of water quality are achieved, which improves the accuracy and timeliness of water quality assessment.
Patent Information
- Application Number
- CN202510660848.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-06-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing spectroscopic-based water quality parameter inversion technology focuses only on the determination of a single water quality parameter, and cannot make full use of spectral data, which affects the accuracy of water quality assessment results.
By dynamically obtaining the full-band spectral data collected by the spectrometer, multiple feature extraction algorithms are used to extract multiple groups of spectral features, calculate the correlation coefficient of water quality parameters, select candidate spectral characteristic values, calculate single-point pollution index, and determine the comprehensive pollution index in combination with the index of each parameter. At the same time, predict the eutrophication level based on the full-band spectral data.
A comprehensive pollution assessment of water quality has been achieved, the limitations of inversion of single water quality parameters have been broken, the accuracy and timeliness of water quality assessment results have been improved, and the water quality assessment results can be quickly responded to changes in water quality.
Smart Images

Figure CN120177387A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the technical field of water quality monitoring, and in particular, to a water quality assessment method, device, electronic device, storage medium, and program product. Background Art
[0002] Water quality monitoring is an important part of environmental protection and water resource management. In recent years, due to its advantages such as rapidity and non-destructiveness, the full-spectrum analysis technology has gradually received attention in the field of water quality monitoring. However, the current spectral-based water quality parameter inversion technology only focuses on the determination of a single water quality parameter, which has certain limitations. At the same time, this water quality parameter inversion technology cannot fully utilize spectral data, affecting the accuracy of water quality assessment results. Summary of the Invention
[0003] In view of this, one or more embodiments of this specification provide the following technical solutions: According to the first aspect of one or more embodiments of this specification, a water quality assessment method is proposed, including: Dynamically obtain the full-band spectral data collected by a spectrometer at a target water quality monitoring point; For the dynamically obtained full-band spectral data, use a variety of different feature extraction algorithms to extract multiple sets of spectral features from the full-band spectral data, where each set of spectral features corresponds to a feature extraction algorithm, and each set of spectral features includes multiple initial spectral feature values; For each water quality parameter, calculate the first type of correlation coefficient between each initial spectral feature value in the multiple sets of spectral features and the water quality parameter, and select a number of initial spectral feature values whose first type of correlation coefficient meets the first condition as the candidate spectral feature values of the water quality parameter; Calculate the single-point pollution index corresponding to the water quality parameter based on the candidate spectral feature values; Determine the comprehensive pollution index of the target water quality monitoring point by synthesizing the single-point pollution indices of each water quality parameter; For the dynamically obtained full-band spectral data, use the full-band spectral data as the model input, and use a trained eutrophication level prediction model to predict the eutrophication level of the target water quality monitoring point.
[0004] Optionally, the calculating the single-point pollution index corresponding to the water quality parameter based on the candidate spectral feature values includes: Calculate the sum value of the candidate spectral feature values; Perform normalization processing on the sum value, and determine the normalization result as the single-point pollution index corresponding to the water quality parameter.
[0005] Optionally, extracting multiple sets of spectral features from the full-band spectral data by using a variety of different feature extraction algorithms, including: Extracting a first quantity of principal components from the full-band spectral data by using a principal component analysis algorithm as a set of spectral features.
[0006] Optionally, extracting multiple sets of spectral features from the full-band spectral data by using a variety of different feature extraction algorithms, including: Calculating a second type of correlation coefficient between each band of the full-band spectral data and the measured value of the water quality parameter by using a correlation analysis algorithm; Selecting several bands whose second type of correlation coefficient satisfies a second condition as a first type of candidate bands; Extracting a second quantity of principal components from the first type of candidate bands by using a principal component analysis algorithm as a set of spectral features.
[0007] Optionally, extracting multiple sets of spectral features from the full-band spectral data by using a variety of different feature extraction algorithms, including: Calculating the feature importance of each band of the full-band spectral data by using a random forest regression algorithm; Selecting several bands whose feature importance satisfies a third condition as a second type of candidate bands; Extracting a third quantity of principal components from the second type of candidate bands by using a principal component analysis algorithm as a set of spectral features.
[0008] Optionally, the training process of the eutrophication level prediction model includes: Obtaining sample full-band spectral data; Determining the eutrophication level corresponding to each sample full-band spectral data as a sample label by using the comprehensive nutrition state index method; Training the eutrophication level prediction model by using the sample full-band spectral data and its sample label.
[0009] According to the second aspect of one or more embodiments of the present specification, a water quality assessment device is proposed, including: A spectral data acquisition unit for dynamically acquiring full-band spectral data collected by a spectrometer at a target water quality monitoring point; A spectral feature extraction unit, for the dynamically acquired full-band spectral data, extracting multiple sets of spectral features from the full-band spectral data by using a variety of different feature extraction algorithms, wherein each set of spectral features corresponds to one feature extraction algorithm, and each set of spectral features includes multiple initial spectral feature values; A correlation coefficient calculation unit calculates, for each water quality parameter, the first type of correlation coefficient between each initial spectral feature value in the multiple groups of spectral features and the water quality parameter, and selects a number of initial spectral feature values whose first type of correlation coefficient meets the first condition as the candidate spectral feature values of the water quality parameter; A single-point pollution calculation unit calculates the single-point pollution index corresponding to the water quality parameter based on the candidate spectral feature values; A comprehensive pollution calculation unit determines the comprehensive pollution index of the target water quality monitoring point by synthesizing the single-point pollution indices of each water quality parameter; An eutrophication prediction unit, for the full-band spectral data dynamically obtained, uses the full-band spectral data as the model input and predicts the eutrophication level of the target water quality monitoring point by using the trained eutrophication level prediction model.
[0010] According to the third aspect of one or more embodiments of the present specification, an electronic device is provided, including: a processor; a memory for storing processor-executable instructions; wherein, the processor realizes the steps of the foregoing method by running the executable instructions.
[0011] According to the fourth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the foregoing method are realized.
[0012] According to the fifth aspect of one or more embodiments of the present specification, a computer program product is provided, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the foregoing method are realized.
[0013] As can be seen from the above description, by using the water quality assessment method provided in this specification, on the one hand, multiple different feature extraction algorithms can be used to extract multiple groups of spectral features from the full-band spectral data, and then the implicit information such as spectral shape and absorption peak area in the full-band spectral data can be deeply and comprehensively mined. Then, for each water quality parameter, the first type of correlation coefficient between each initial spectral feature value in the multiple groups of spectral features and the water quality parameter can be calculated respectively. The initial spectral feature values whose first type of correlation coefficient meets the first condition are selected as candidate spectral feature values, and the single-point pollution index of the corresponding water quality parameter is calculated according to the candidate spectral feature values. Then, the comprehensive pollution index is obtained by integrating the single-point pollution indices of each water quality parameter, and thus the comprehensive water quality pollution assessment is fully realized by making full use of the implicit information mined from the spectral data, breaking through the limitation of the inversion of a single water quality parameter. At the same time, due to the more sufficient utilization of spectral data, the accuracy of the water quality assessment result can be effectively improved. On the other hand, the water quality assessment scheme provided in this specification can also predict the eutrophication level based on the full-band spectral data through a model, and thus a more comprehensive water quality assessment is realized. In addition, the water quality assessment method provided in this specification can dynamically obtain the full-band spectral data and dynamically evaluate the comprehensive pollution index and the eutrophication level, realizing water quality assessment at the minute level, and thus can quickly respond to the change of water quality. Especially in the event of sudden pollution, it can provide the water quality assessment result in time, which can assist in rapid decision-making and improve the timeliness of water quality assessment. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 FIG. is a schematic structural diagram of a water quality assessment system provided by an exemplary embodiment.
[0015] Figure 2 FIG. is a flowchart of a water quality assessment method provided by an exemplary embodiment.
[0016] Figure 3 FIG. is a comparison diagram of full-band spectral data before and after filtering provided by an exemplary embodiment.
[0017] Figure 4 FIG. is a flowchart of a spectral feature extraction method provided by an exemplary embodiment.
[0018] Figure 5 FIG. is a flowchart of another spectral feature extraction method provided by an exemplary embodiment.
[0019] Figure 6 FIG. is a schematic structural diagram of a device provided by an exemplary embodiment.
[0020] Figure 7 FIG. is a block diagram of a water quality assessment device provided by an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0021] Water quality monitoring is an important part of environmental protection and water resource management. In recent years, due to its advantages such as rapidity and non-destructiveness, the full-spectrum analysis technology has gradually attracted attention in the field of water quality monitoring. However, the current spectral-based water quality parameter inversion technology only focuses on the determination of a single water quality parameter, which has certain limitations. At the same time, this water quality parameter inversion technology cannot make full use of spectral data, affecting the accuracy of water quality assessment results.
[0022] This specification provides a water quality assessment scheme, which can dynamically assess water quality and make full use of the information in spectral data to evaluate the comprehensive pollution situation of water quality during the assessment process, greatly improving the accuracy and comprehensiveness of water quality assessment results.
[0023] Figure 1 It is a schematic diagram of the architecture of a water quality assessment system provided by an exemplary embodiment. As Figure 1 shown, the system may include a server 11, a network 12, and several spectrometers 13, such as a variable optical path reflection spectrometer, etc.
[0024] The server 11 may be a physical server including an independent host, or the server 11 may be a virtual server hosted by a host cluster. During operation, the server 11 may run the server-side program of an application to implement the related functions of the application. For example, when the server 11 runs the program of the water quality assessment service, it can be implemented as the corresponding water quality assessment service platform.
[0025] The spectrometer 13 has the functions of rapid sensing and high spatio-temporal resolution monitoring. Taking the variable optical path reflection spectrometer as an example, the wavelength range of the acquired spectral data is 195 - 727.5 nm, the resolution is 2.5 nm, and it can achieve real-time monitoring, collecting hundreds of pollution characteristic values at the second level, and the detection time interval is less than 2 min. After the spectrometer 13 acquires the spectral data, it can send the spectral data to the server 11 through the network 12, and the server 11 performs water quality assessment and can display the assessment results through a display device.
[0026] Among them, the display device may be an independent device (not shown). When the spectrometer 13 has a display screen, the spectrometer 13 can also be used as the display device, and this specification does not make special restrictions on this.
[0027] Figure 2 It is a flowchart of a water quality assessment method provided by an exemplary embodiment.
[0028] Please refer to Figure 2 and the water quality assessment method can be applied to the server in the foregoing Figure 1 shown embodiment, and may include the following steps: Step 202, dynamically obtain the full-band spectral data collected by the spectrometer at the target water quality monitoring point.
[0029] In this embodiment, a spectrometer may be deployed at each water quality monitoring point. The spectrometer can periodically collect the full-band spectral data of the corresponding water area. After the spectrometer collects the full-band spectral data, it can send the full-band spectral data to the server, and the server can then dynamically receive the full-band spectral data collected by the spectrometer. In this embodiment, the water quality monitoring point where the spectrometer that sends the full-band spectral data is located is called the target water quality monitoring point.
[0030] Step 204, for the dynamically obtained full-band spectral data, use a variety of different feature extraction algorithms to extract multiple sets of spectral features from the full-band spectral data. Among them, each set of spectral features corresponds to a feature extraction algorithm, and each set of spectral features includes multiple initial spectral feature values.
[0031] In this embodiment, for each dynamically obtained full-band spectral data, water quality assessment can be performed based on the full-band spectral data to obtain the comprehensive pollution index of the water quality at the target water quality monitoring point.
[0032] Specifically, for the full-band spectral data, a variety of different feature extraction algorithms can be used to extract multiple sets of spectral features from the full-band spectral data. Each set of spectral features can include multiple spectral feature values. For the sake of distinction, they are called initial spectral feature values. The initial spectral feature values can represent combinations of bands.
[0033] Among them, the number of initial spectral feature values included in each set of spectral features can be preset. The initial spectral feature values included in different spectral features can be the same or different. This specification does not make special restrictions on this.
[0034] For example, assume that 3 different feature extraction algorithms are used for the extraction of the spectral features, and each spectral feature extracted by each feature extraction algorithm includes 3 initial spectral feature values. Then, for the full-band spectral data, 9 initial spectral feature values can be extracted.
[0035] In this embodiment, the principal component analysis algorithm (Principal Component Analysis, PCA) can be used for the extraction of the spectral features, or the correlation analysis algorithm can be used for the extraction of the spectral features, or the importance analysis algorithm can be used for the extraction of the spectral features, etc. Specific details will be described in the subsequent embodiments.
[0036] Step 206: For each water quality parameter, calculate the first type of correlation coefficient between each initial spectral feature value in the multiple groups of spectral features and the water quality parameter, and select several initial spectral feature values whose first type of correlation coefficient meets the first condition as the candidate spectral feature values of the water quality parameter.
[0037] Based on the aforementioned step 204, after extracting multiple groups of spectral features, for each water quality parameter, the correlation coefficient between each initial spectral feature value included in these spectral features and the water quality parameter can be calculated respectively, which is called the first type of correlation coefficient.
[0038] In this embodiment, taking the water quality parameter total phosphorus (TP) as an example, assuming that 9 initial spectral feature values are extracted in the aforementioned step 204, the first type of correlation coefficient between these 9 initial spectral feature values and the total phosphorus concentration at the target water quality monitoring point can be calculated respectively, and then several initial spectral feature values that meet the first condition can be selected according to the first type of correlation coefficient as the candidate spectral feature values of total phosphorus.
[0039] Among them, the first condition can be the 2 initial spectral feature values with the highest absolute value of the first type of correlation coefficient, the 3 initial spectral feature values with the highest absolute value of the first type of correlation coefficient, etc. The total phosphorus concentration at the target water quality monitoring point can be obtained by inverting the full-band spectral data or by actual measurement. This specification does not make special restrictions on this.
[0040] Taking the first condition as the 2 initial spectral feature values with the highest first type of correlation coefficient as an example, the Pearson Correlation Analysis algorithm can be used to calculate the first type of correlation coefficient between each initial spectral feature value and the total phosphorus concentration, obtaining 9 first type of correlation coefficients, and then select the initial spectral feature values corresponding to the two first type of correlation coefficients with the highest absolute value as the candidate spectral feature values of total phosphorus. These two subsequent spectral feature values have the highest correlation with total phosphorus.
[0041] Similarly, two candidate spectral feature values can be selected for other water quality parameters respectively.
[0042] Step 208: Calculate the single-point pollution index corresponding to the water quality parameter based on the candidate spectral feature values.
[0043] Based on the aforementioned step 206, for each water quality parameter, after determining the candidate spectral feature values for it, the pollution index of the water quality parameter can be calculated according to the candidate spectral feature values, which is called the single-point pollution index.
[0044] Still taking the water quality parameter total phosphorus as an example, the single-point pollution index corresponding to total phosphorus can be calculated according to the 2 candidate spectral feature values with the highest correlation with total phosphorus.
[0045] Similarly, the corresponding single-point pollution indices can also be calculated for other water quality parameters respectively.
[0046] In this embodiment, when calculating the single-point pollution index, the sum value of the candidate spectral feature values can be calculated, and then the calculated sum value can be normalized, and the normalization result can be directly determined as the single-point pollution index of the corresponding water quality parameter.
[0047] For example, assume that the 2 candidate spectral feature values of total phosphorus are the 4th initial spectral feature value and the 7th spectral feature value, which are respectively represented as and , then the sum value Sum of the two can be calculated, . Then, the sum value Sum can be normalized. For example, the min-max normalization algorithm can be used for normalization to obtain the normalization result, and the normalization result can be determined as the single-point pollutant index of total phosphorus.
[0048] Step 210, determine the comprehensive pollution index of the target water quality monitoring point by integrating the single-point pollution indices of each water quality parameter.
[0049] In this embodiment, the single-point pollution indices corresponding to each water quality parameter can be integrated to obtain the comprehensive pollution index of the target water quality monitoring point.
[0050] Taking 6 water quality parameters as an example, the average value of the single-point pollution indices of these 6 water quality parameters can be calculated as the comprehensive pollution index. Of course, in other examples, algorithms such as median calculation and weighted average can also be used to calculate the comprehensive pollution index, and this specification does not make special restrictions on this.
[0051] Step 212, for the dynamically obtained full-band spectral data, use the full-band spectral data as the model input, and adopt the trained eutrophication level prediction model to predict the eutrophication level of the target water quality monitoring point.
[0052] In this embodiment, for each dynamically obtained full-band spectral data, on the basis of predicting the comprehensive pollution index based on it, the eutrophication level of the target water quality monitoring point will also be predicted based on the full-band spectral data, thereby realizing a more comprehensive water quality assessment, improving the comprehensiveness of water quality assessment, and providing richer information for water quality management.
[0053] In this embodiment, a eutrophication level prediction model can be trained. The acquired full-band spectral data can be preprocessed first, and then the preprocessed full-band spectral data can be input into the trained eutrophication level prediction model, and the eutrophication level of the target water quality monitoring point can be predicted by the model. The whole process does not need to rely on laboratory analysis, which can significantly improve the efficiency of eutrophication level assessment.
[0054] In this embodiment, taking the example of the spectrometer collecting full-band spectral data once every two minutes, the comprehensive pollution index and eutrophication level of the target water quality monitoring point can be predicted every two minutes, thereby realizing the prediction of comprehensive pollution index and eutrophication level at the minute level. When facing sudden environmental events, it can provide support for timely decision-making and effectively reduce potential environmental risks.
[0055] It can be seen from the above description that, by using the water quality assessment method provided in this specification, on the one hand, multiple groups of spectral features can be extracted from the full-band spectral data using a variety of different feature extraction algorithms, and then the implicit information such as spectral shape and absorption peak area in the full-band spectral data can be deeply and comprehensively excavated. Then, for each water quality parameter, the first type correlation coefficient of each initial spectral feature value in the multiple groups of spectral features and the water quality parameter can be calculated respectively, and the initial spectral feature value whose first type correlation coefficient meets the first condition is selected as the candidate spectral feature value, and the single point pollution index of the corresponding water quality parameter is calculated according to the candidate spectral feature value, and then the single point pollution index of each water quality parameter is integrated to obtain the comprehensive pollution index, and then the implicit information excavated from the spectral data is fully utilized to realize the comprehensive comprehensive pollution assessment of water quality, breaking through the limitation of the inversion of a single water quality parameter. At the same time, due to the more comprehensive use of spectral data, the accuracy of the water quality assessment result can also be effectively improved. On the other hand, the water quality assessment scheme provided in this specification can also predict the eutrophication level based on the full-band spectral data through the model, so as to achieve a more comprehensive water quality assessment. In addition, the water quality assessment method provided in this manual can dynamically obtain full-band spectral data, and dynamically evaluate the comprehensive pollution index and eutrophication level, to achieve water quality assessment at the minute level, and thus be able to quickly respond to changes in water quality, especially in sudden pollution incidents. It can provide a water quality assessment structure in a timely manner, assist in quick decision-making, and improve the timeliness of water quality assessment.
[0056] The specific implementation process of this specification is described in detail below from two aspects: preprocessing of full-band spectral data and extraction of spectral features.
[0057] 1. Preprocessing of full-band spectral data In this embodiment, after obtaining the full-band spectral data collected by the spectrometer at the target water quality monitoring point, preprocessing may be performed before extracting spectral features and predicting eutrophication levels.
[0058] Exemplarily, the obtained original full-band spectral data can be smoothed and corrected using a polynomial smoothing algorithm. Taking the SG filtering method (Savitzky-Golay) as an example, the SG filtering window size can be preset, and the data points in a moving window of a specific size are least-squares fitted using an nth-order polynomial, and the weighted average sum of the points near the center is comprehensively calculated from the odd-numbered equidistant data points in the window to further improve the spectral signal-to-noise ratio.
[0059] For the noisy spectral signal points { , ,…, }, assuming the fitting curve equation is:
[0060] where n is the order of the fitting equation.
[0061] The fitting residual of the algorithm formed recently is:
[0062] where is the fitting point, is the actual data point, is the data window, is the leftmost data point of the window, is the rightmost data point of the window.
[0063] Let be minimized, and its derivative with respect to each parameter is 0, that is
[0064] Substitute row column auxiliary matrix is denoted as A, and let , , , , and then another auxiliary matrix is set, then there is:
[0065] Also set;
[0066] Then there is:
[0067] Substitute the coefficient matrix into the above formula to obtain the spectral signal after SG filtering smoothing.
[0068] Please refer to Figure 3The comparison chart of the full-band spectral data before and after filtering is shown. Through SG filtering, the noise signal points in the original full-band spectral data can be removed, making the spectral curve smoother and more continuous.
[0069] II. Extraction of Spectral Features In this embodiment, various different feature extraction algorithms can be used to extract spectral features from the preprocessed full-band spectral data, and then multiple groups of spectral features can be obtained.
[0070] Exemplarily, the feature extraction algorithm may include the principal component analysis algorithm. Specifically, the principal component analysis algorithm can be used to extract the first number of principal components from the full-band spectral data as the first group of spectral features. Among them, the principal component analysis algorithm is an orthogonal linear transformation method based on information quantity. After the transformation, the spectral signal information is mainly concentrated in the first few mutually orthogonal principal components, and the components with less information quantity are discarded, which can reduce the data dimension while retaining the main features of the data.
[0071] Assume that the full-band spectral data covers a wavelength range of 195 - 727.5 nm, with a resolution of 2.5 nm. Each spectral data point includes spectral intensity values of multiple wavelengths and can be represented as a vector S = , where represents the spectral intensity at wavelength . Through the principal component analysis algorithm, the original spectral data can be dimensionally reduced to extract several important feature dimensions. Each principal component is a feature vector, including the weight combinations of multiple bands. For example, the first principal component is a feature vector and can be represented as , where represents the weight at wavelength λ. The value of each principal component is obtained by projecting the spectral data in the direction of this principal component, that is, the initial spectral feature value is extracted.
[0072] The first number can be set in advance, such as 3, 5, etc. Taking the first number as 3 as an example, the first 3 principal components among the spectral features extracted by the principal component analysis algorithm can be used as the first group of spectral features. This first group of spectral features includes 3 initial spectral feature values, that is, the corresponding principal component values, and can be represented as , and .
[0073] Exemplarily, please refer to Figure 4 , and the following algorithm can also be used for spectral feature extraction: Step 402, use the correlation analysis algorithm to calculate the second type of correlation coefficient between each band of the full-band spectral data and the measured values of water quality parameters.
[0074] In this embodiment, a correlation analysis algorithm (such as Pearson correlation analysis algorithm) may be used to calculate the correlation coefficient between each band in the full-band spectral data and the measured value of the water quality parameter, which is referred to as a second-type correlation coefficient.
[0075] Among them, the actual measured values of the water quality parameters can be obtained from ecological and environmental monitoring centers and other places, and this manual does not impose any special restrictions on this.
[0076] Step 404: Select several bands whose second-category correlation coefficients satisfy the second condition as first-category candidate bands.
[0077] In this embodiment, the second condition can be preset, for example, it can be the 8 bands with the highest absolute values of the second type correlation coefficients, the 10 bands with the highest absolute values of the second type correlation coefficients, etc.
[0078] Taking the second condition that the 10 bands with the highest absolute values of the second type correlation coefficients as an example, the 10 bands with the highest absolute values can be selected as the first type candidate bands based on the second type correlation coefficients.
[0079] Step 406: extract a second number of principal components from the first type of candidate bands using a principal component analysis algorithm as a group of spectral features.
[0080] Based on the aforementioned step 404, a principal component analysis algorithm may be used to extract a second number of principal components from the first candidate band as a second set of spectral features. The second number may also be preset and may be the same as or different from the first number.
[0081] Taking the second number of 3 as an example, the principal component analysis algorithm can be used to reduce the dimension of the 10 first-class candidate bands, and then the first 3 principal components are selected as the second set of spectral features. The second set of spectral features also includes 3 initial spectral feature values, which can be expressed as , and .
[0082] For example, please refer to Figure 5 , the following algorithms can also be used to extract spectral features: Step 502: Use a random forest regression algorithm to calculate the feature importance of each band of the full-band spectral data.
[0083] In this embodiment, the random forest regression model can also calculate the feature importance of each band during the establishment process. The principle is as follows: in the process of building a random forest, each decision tree uses a replacement sampling strategy to extract samples from the data set for training, resulting in about one-third of the data not being included in the training process. This part of the data is called out-of-bag data (OBB), and its initial error is calculated as Subsequently, for the feature X (i.e., the band) of each sample in the OBB set, random noise is systematically introduced for perturbation, and the re-evaluated error is denoted as Considering that the random forest consists of N decision trees, the importance index (i.e., the feature importance) of the feature X can be determined by combining the results of all trees through the following formula (8):
[0084] Generally speaking, if the prediction accuracy of the model decreases significantly (i.e., increases significantly) after adding random noise, it indicates that the feature X has a key impact on determining the sample classification or regression prediction result, and thus has a high importance.
[0085] Step 504, select several bands whose feature importance meets the third condition as the second type of candidate bands.
[0086] In this embodiment, the third condition can also be set in advance. For example, it can be the 8 bands with the highest feature importance, the 10 bands with the highest feature importance, etc.
[0087] Taking the third condition as the 10 bands with the highest feature importance as an example, based on the feature importance, the 10 bands with the highest importance can be selected as the second type of candidate bands.
[0088] Step 506, use the principal component analysis algorithm to extract the third number of principal components from the second type of candidate bands as a group of spectral features.
[0089] Similar to the aforementioned step 406, the principal component analysis algorithm can be used to extract the third number of principal components from the second type of candidate bands as the third group of spectral features. The third number can also be set in advance, and it can be the same as or different from the first number and / or the second number.
[0090] Taking the third number as 3 as an example, the principal component analysis algorithm can be used to reduce the dimension of 10 second type of candidate bands, and then the first 3 principal components can be selected as the third group of spectral features. The third group of spectral features also includes 3 initial spectral feature values, which can be expressed as 、 and 。
[0091] So far, three groups of spectral features can be extracted from the full-band spectral data. Each group of spectral features can include 3 initial spectral feature values, and then 、…、 These 9 initial spectral feature values are obtained.
[0092] It can be seen from this that this specification can adopt a variety of different feature extraction algorithms to extract multiple sets of spectral features from the full-band spectral data, and then can deeply and comprehensively mine the implicit information such as spectral shape and absorption peak area in the full-band spectral data, realizing full spectral data mining, improving the utilization rate of spectral data, and providing comprehensive data support for subsequent water quality assessment.
[0093] Optionally, based on the evaluation of the comprehensive pollution index of water quality based on the full-band spectral data, this specification can also predict the eutrophication level of the water quality at the target water quality monitoring point based on the full-band spectral data, thereby realizing a more comprehensive water quality assessment, improving the comprehensiveness of water quality assessment, and providing richer information for water quality management.
[0094] In this embodiment, an eutrophication level prediction model can be trained. For the obtained full-band spectral data, it can be preprocessed first, and then the preprocessed full-band spectral data is input into the trained eutrophication level prediction model to predict the eutrophication level of the target water quality monitoring point through this model. The whole process does not need to rely on laboratory analysis, and can significantly improve the efficiency of eutrophication level assessment.
[0095] The eutrophication level prediction model can be a random forest algorithm model or a support vector machine (SVM) algorithm model, etc. This specification does not make special restrictions on this.
[0096] In this embodiment, the samples for training the eutrophication level prediction model can be constructed in advance. For example, the full-band spectral data collected by a spectrometer can be obtained as samples, that is, sample full-band spectral data. Then, the comprehensive nutrition state index method can be used to determine the eutrophication level corresponding to each sample full-band spectral data as the sample label. Then, the sample full-band spectral data and its sample label are used to train the eutrophication level prediction model.
[0097] Among them, the comprehensive nutrition state index method is a method widely used in the assessment of water body eutrophication. This method evaluates the nutritional state of the water body by comprehensively considering multiple key indicators, so as to judge the degree of eutrophication risk. The relevant formula is as follows:
[0098]
[0099] In the formula, is the weight related to the nutrition state index of the th index, is the correlation coefficient between the th index and the reference index, n is the number of evaluation indicators, is the comprehensive trophic state index, is the trophic state index of the th index.
[0100] Based on chlorophyll a (Chl-a), the correlation coefficients and weights of each index are shown in Table 1 below: Table 1
[0101] The trophic state index of each index can refer to the following calculation formula:
[0102]
[0103]
[0104]
[0105] In this embodiment, the eutrophication level may include three levels: oligotrophic, mesotrophic, and eutrophic. The eutrophication level may also be represented by the eutrophication index, and this specification does not make special restrictions on this.
[0106] Optionally, after the comprehensive pollution index and eutrophication level of the target water quality monitoring point are evaluated based on the full-band spectral data in this specification, the evaluation results can be intuitively displayed through a visualization interface, which is convenient for the administrator to evaluate and take corresponding intervention measures.
[0107] In this embodiment, the eutrophication index and comprehensive pollution index of each water quality monitoring point can be correspondingly displayed in the sea area map, so as to intuitively understand the water quality conditions of different water quality monitoring points. Through verification, the accuracy of the eutrophication index and comprehensive pollution index calculation methods provided in this specification is relatively high. Therefore, the water quality assessment method provided in this specification has strong practicability, reduces the dependence on laboratory analysis, and improves the water quality assessment efficiency.
[0108] Figure 6 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to Figure 6, at the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610. Of course, it may also include other hardware required for other functions. One or more embodiments of this specification can be implemented in software. For example, the processor 602 reads the corresponding computer program from the non-volatile memory 610 into the memory 608 and then runs it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, and can also be hardware or a logic device.
[0109] Please refer to Figure 7 , the water quality assessment device 700 can be applied to a device as shown in Figure 6 to implement the technical solution of this specification. Among them, the water quality assessment device 700 can include: A spectral data acquisition unit 701 that dynamically acquires full-band spectral data collected by a spectrometer at a target water quality monitoring point; A spectral feature extraction unit 702 that, for the dynamically acquired full-band spectral data, extracts multiple sets of spectral features from the full-band spectral data using a variety of different feature extraction algorithms. Among them, each set of spectral features corresponds to a feature extraction algorithm, and each set of spectral features includes multiple initial spectral feature values; A correlation coefficient calculation unit 703 that, for each water quality parameter, calculates the first type of correlation coefficient between each initial spectral feature value in the multiple sets of spectral features and the water quality parameter, and selects several initial spectral feature values whose first type of correlation coefficient meets the first condition as the candidate spectral feature values of the water quality parameter; A single-point pollution calculation unit 704 that calculates the single-point pollution index corresponding to the water quality parameter based on the candidate spectral feature values; A comprehensive pollution calculation unit 705 that determines the comprehensive pollution index of the target water quality monitoring point by integrating the single-point pollution indices of each water quality parameter; An eutrophication prediction unit 706 that, for the dynamically acquired full-band spectral data, uses the full-band spectral data as the model input and predicts the eutrophication level of the target water quality monitoring point using a trained eutrophication level prediction model.
[0110] Optionally, the single-point pollution calculation unit 704 calculates the single-point pollution index corresponding to the water quality parameter based on the candidate spectral feature values, including: Calculating the sum value of the candidate spectral feature values; Normalizing the sum value and determining the normalization result as the single-point pollution index of the corresponding water quality parameter.
[0111] Optionally, the spectral feature extraction unit 702 extracts multiple sets of spectral features from the full-band spectral data by using multiple different feature extraction algorithms, including: Extracting the first quantity of principal components from the full-band spectral data by using the principal component analysis algorithm as a set of spectral features.
[0112] Optionally, the spectral feature extraction unit 702 extracts multiple sets of spectral features from the full-band spectral data by using multiple different feature extraction algorithms, including: Calculating the second type of correlation coefficient between each band of the full-band spectral data and the measured value of the water quality parameter by using the correlation analysis algorithm; Selecting several bands whose second type of correlation coefficient satisfies the second condition as the first type of candidate bands; Extracting the second quantity of principal components from the first type of candidate bands by using the principal component analysis algorithm as a set of spectral features.
[0113] Optionally, the spectral feature extraction unit 702 extracts multiple sets of spectral features from the full-band spectral data by using multiple different feature extraction algorithms, including: Calculating the feature importance of each band of the full-band spectral data by using the random forest regression algorithm; Selecting several bands whose feature importance satisfies the third condition as the second type of candidate bands; Extracting the third quantity of principal components from the second type of candidate bands by using the principal component analysis algorithm as a set of spectral features.
[0114] Optionally, the training process of the eutrophication level prediction model includes: Obtaining sample full-band spectral data; Determining the eutrophication level corresponding to each sample full-band spectral data as a sample label by using the comprehensive nutrition state index method; Training the eutrophication level prediction model by using the sample full-band spectral data and its sample label.
[0115] Based on the same concept as the above method, this specification also provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein, the processor realizes the steps of the method as described in any one of the above embodiments by running the executable instructions.
[0116] Based on the same concept as the above method, this specification also provides a computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method as described in any one of the above embodiments are realized.
[0117] Based on the same concept as the above method, this specification also provides a computer program product, including computer programs / instructions, which, when executed by a processor, implement the steps of the method described in any of the above embodiments.
Claims
1. A water quality assessment method, characterized in that: The method comprises: Dynamically obtain the full-band spectral data collected by the spectrometer at the target water quality monitoring point; For the full-band spectral data dynamically acquired, multiple groups of spectral features are extracted from the full-band spectral data using multiple different feature extraction algorithms, wherein each group of spectral features corresponds to one feature extraction algorithm, and each group of spectral features includes multiple initial spectral feature values; For each water quality parameter, respectively calculate the first type correlation coefficient between each initial spectral feature value in the multiple groups of spectral features and the water quality parameter, and select several initial spectral feature values whose first type correlation coefficients meet the first condition as candidate spectral feature values of the water quality parameter; Calculating a single point pollution index corresponding to the water quality parameter based on the candidate spectral characteristic value; Determine the comprehensive pollution index of the target water quality monitoring point by combining the single point pollution index of each water quality parameter; The full-band spectral data is dynamically acquired and used as a model input, and the trained eutrophication level prediction model is used to predict the eutrophication level of the target water quality monitoring point.
2. The method according to claim 1, characterized in that The calculating the single point pollution index corresponding to the water quality parameter based on the candidate spectral characteristic value comprises: Calculating the sum of the candidate spectrum feature values; The sum is normalized, and the normalized result is determined as a single point pollution index corresponding to the water quality parameter.
3. The method according to claim 1, characterized in that The method uses a plurality of different feature extraction algorithms to extract multiple groups of spectral features from the full-band spectral data, including: A principal component analysis algorithm is used to extract a first number of principal components from the full-band spectral data as a group of spectral features.
4. The method according to claim 1, characterized in that: The method uses a plurality of different feature extraction algorithms to extract multiple groups of spectral features from the full-band spectral data, including: A correlation analysis algorithm is used to calculate the second type correlation coefficient of each band of the full-band spectral data and the measured value of the water quality parameter; Selecting a number of bands whose second-category correlation coefficients satisfy the second condition as first-category candidate bands; A principal component analysis algorithm is used to extract a second number of principal components from the first type of candidate bands as a group of spectral features.
5. The method according to claim 1, characterized in that The method uses a plurality of different feature extraction algorithms to extract multiple groups of spectral features from the full-band spectral data, including: The random forest regression algorithm is used to calculate the feature importance of each band of the full-band spectral data; Selecting several bands whose feature importance meets the third condition as the second type of candidate bands; A principal component analysis algorithm is used to extract a third number of principal components from the second type of candidate bands as a group of spectral features.
6. The method according to claim 1, characterized in that The training process of the eutrophication level prediction model includes: Obtain full-band spectrum data of the sample; The comprehensive nutritional status index method was used to determine the eutrophication level corresponding to the full-band spectral data of each sample as the sample label; The sample full-band spectral data and its sample labels are used to train the eutrophication level prediction model.
7. A water quality assessment device, characterized in that: The device comprises: A spectral data acquisition unit dynamically acquires full-band spectral data collected by the spectrometer at the target water quality monitoring point; A spectral feature extraction unit, for the full-band spectral data dynamically acquired, extracts a plurality of groups of spectral features from the full-band spectral data using a plurality of different feature extraction algorithms, wherein each group of spectral features corresponds to a feature extraction algorithm, and each group of spectral features includes a plurality of initial spectral feature values; a correlation coefficient calculation unit, for each water quality parameter, respectively calculating a first type correlation coefficient between each initial spectral characteristic value in the plurality of groups of spectral characteristics and the water quality parameter, and selecting a plurality of initial spectral characteristic values whose first type correlation coefficients satisfy a first condition as candidate spectral characteristic values of the water quality parameter; A single point pollution calculation unit, which calculates a single point pollution index corresponding to the water quality parameter based on the candidate spectral characteristic value; A comprehensive pollution calculation unit, which combines the single-point pollution index of each water quality parameter to determine the comprehensive pollution index of the target water quality monitoring point; The eutrophication prediction unit dynamically obtains the full-band spectral data, uses the full-band spectral data as a model input, and uses a trained eutrophication level prediction model to predict the eutrophication level of the target water quality monitoring point.
8. An electronic device, characterized in that: include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 6 by executing the executable instructions.
9. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Paraffin level qualitative classification and quantitative regression method based on hyperspectral technology
CN108344701A
Full-spectrum water quality monitoring method and system
CN109580509A
Agricultural product quality parameter detection method and equipment based on fluorescence hyperspectral imaging
CN114720436A
Water eutrophication monitoring method, device, equipment and medium
CN118521895A
Water quality multi-parameter detection method and device based on artificial intelligence model and product
CN118777225A
Cited By
Water quality monitoring data analysis method and system
CN120632369A