A water quality monitoring method and system based on intelligent analysis of hyperspectral images
By pre-processing, feature extraction and wavelength optimization of hyperspectral image data, combined with deep learning analysis, the problems of imperfect data processing and insufficient reliability of monitoring results in the existing water quality monitoring methods are solved, and efficient and accurate water quality monitoring and grade evaluation are achieved.
Patent Information
- Application Number
- CN202510443167.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-04-10
AI Technical Summary
The existing water quality monitoring methods have problems such as incomplete data preprocessing, experience-dependent wavelength selection, simple feature extraction methods, and inability to effectively deal with mixed cell problems and complex relationships between wavelengths, resulting in insufficient reliability and comprehensiveness of monitoring results.
Through the preprocessing, feature extraction and wavelength selection optimization of hyperspectral image data, combined with deep learning analysis, a water quality monitoring method based on hyperspectral images is constructed, including data standardization, spectral decomposition, wavelength optimization, self-attention mechanism and deep learning network applications, to realize automatic monitoring and grading evaluation of water quality parameters.
It realizes efficient and accurate water quality monitoring, eliminates the influence of atmospheric scattering and equipment noise, extracts pure spectral characteristics, improves the reliability and comprehensiveness of monitoring results, and can classify multiple water quality parameters at the same time.
Smart Images

Figure CN119942356B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water quality monitoring, and particularly to a water quality monitoring method and system based on intelligent analysis of hyperspectral images. Background Art
[0002] Water quality monitoring is an important part of environmental protection and water resource management, which is of great significance for ensuring water ecological security and human health. Traditional water quality monitoring methods mainly rely on manual sampling and laboratory analysis. This method is not only time-consuming and laborious, but also difficult to achieve large-scale and real-time water quality monitoring. With the rapid development of remote sensing technology, water quality monitoring methods based on visual images have gradually become a research hotspot. By quickly obtaining spectral information related to water bodies and conducting targeted analysis, contactless monitoring can be realized, with a fast response speed and a wide monitoring range.
[0003] Patent CN202510104487.6 discloses a water quality monitoring system based on multi-source data perception, which evaluates the water quality status by analyzing the impact of water quality changes on aquatic organisms. Although this method has certain advantages in the early warning of the risk of rapid water quality deterioration, there are still the following deficiencies: First, this method mainly relies on the visual features of surface images and cannot obtain the deep spectral information of water bodies, resulting in a single monitoring index; Second, this method does not fully consider the interference of environmental factors on the monitoring results, and the reliability needs to be improved; Finally, this method lacks the comprehensive analysis ability of multiple water quality parameters and is difficult to meet the needs of comprehensive water quality assessment.
[0004] In addition, existing water quality monitoring methods based on visual images also have some common problems: First, the data preprocessing method is not perfect enough to effectively eliminate interference factors such as atmospheric scattering and equipment noise; Second, wavelength selection often relies on experience or simple statistical methods and fails to make full use of spectral information; Third, the feature extraction method is relatively simple and fails to effectively handle the problem of mixed pixels and the complex relationship between wavelengths; Fourth, the classification model generally adopts traditional machine learning methods and has insufficient adaptability to non-linear and multi-parameter water quality assessment problems. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a water quality monitoring technology based on hyperspectral images. Through the optimization of links such as preprocessing, feature extraction, and wavelength selection of hyperspectral image data, and combined with deep learning analysis, automatic monitoring and grade evaluation of water quality parameters are realized to ensure efficient and accurate feedback of water quality monitoring results.
[0006] To achieve the above purpose, the present invention provides a water quality monitoring method based on intelligent analysis of hyperspectral images, including the following steps:
[0007] S1: Obtain the original hyperspectral image data of the water surface and perform preprocessing to obtain standardized hyperspectral image data;
[0008] S2: Extract spectral features and optimize wavelengths from the standardized hyperspectral data to obtain a key wavelength combination; including:
[0009] First, perform spectral decomposition. Use the vertex component analysis method to obtain the spectral response values of the endmembers at each wavelength, use the least squares method to obtain the endmember abundances at each spatial position, and use the minimization of the Frobenius norm to optimize the spectral decomposition. Then, calculate the discrimination score for each wavelength based on the spectral decomposition results. Then, obtain the fitness values of different wavelength combinations based on the discrimination scores of all wavelengths and the Pearson correlation coefficients between wavelengths, and use the genetic algorithm to iteratively optimize to obtain the optimal wavelength combination. Finally, construct a feature vector based on the standardized hyperspectral image data corresponding to each wavelength in the optimal wavelength combination;
[0010] S3: Calculate the adaptive weight coefficients and the normalized wavelength combination index between different wavelengths in the optimal wavelength combination, and construct a wavelength combination index matrix;
[0011] S4: Based on the wavelength combination index matrix and the self-attention enhancement mechanism, construct the input feature tensor of the deep learning network;
[0012] S5: Construct a water quality parameter level classifier based on the deep learning network to evaluate the levels of each water quality parameter.
[0013] Preferably, the step S1 includes the following steps:
[0014] S11: Use a hyperspectral imaging device to obtain the original hyperspectral image data of the water surface , including the spatial coordinates and wavelengths ;
[0015] S12: Perform spectral smoothing and denoising on the original hyperspectral image data to obtain the smoothed reflectance data , specifically:
[0016] ;
[0017] Among them, is the value of the smoothed reflectance data at the spatial coordinate with the wavelength , is the value of the original hyperspectral image data at the spatial coordinate with the wavelength ; is the interval between adjacent wavelength sampling points, is the weight coefficient of the Savitzky-Golay filter kernel function is the position index within the filtering window is the weight at The value range of is where is the filtering window radius;
[0018] S13: Perform spatial registration and geometric correction on the smoothed reflectance data to obtain the corrected reflectance data , specifically:
[0019] ;
[0020] wherein, is the value of the corrected reflectance data at the spatial coordinate at wavelength is is the value of the smoothed reflectance data at the spatial coordinate at wavelength is is the weight coefficient of the affine transformation matrix at the position is and are the horizontal index and vertical index of the affine transformation matrix respectively, and their value ranges are both integers in;
[0021] S14: Construct the standardized hyperspectral image data , specifically:
[0022] ;
[0023] wherein, is the value of the standardized hyperspectral image data at the spatial coordinate at wavelength is is the mean value of the reflectance values of all pixel points at wavelength is is the standard deviation of the reflectance values of all pixel points at wavelength is is the standardization adjustment parameter, used to control the degree of standardization, is the natural constant.
[0024] Preferably, the step S2 includes the following steps:
[0025] S21: Perform spectral decomposition on the standardized hyperspectral image data to obtain endmember spectra and abundance maps, specifically:
[0026] ;
[0027] where is the abundance value of the th endmember at the spatial coordinate , is the spectral response value of the th endmember at the wavelength , is the number of endmembers, is the Frobenius norm;
[0028] S22: Construct an evaluation index for wavelength importance and calculate the discrimination score for each wavelength, specifically:
[0029] ;
[0030] where is the discrimination score at the wavelength , is the average spectral response value of the th endmember at the wavelength , is the average spectral response value of the th endmember at the wavelength , is the spectral variance of the th endmember at the wavelength ;
[0031] S23: Optimize the wavelength combination based on the genetic algorithm and construct a fitness function :
[0032] ;
[0033] where is the fitness value of the candidate wavelength combination , and are both weight coefficients, is the Pearson correlation coefficient of the spectral response at the wavelength ;
[0034] Iteratively optimize to obtain the optimal wavelength combination , specifically:
[0035] ;;
[0036] where is the A selected optimal wavelength is the number of selected optimal wavelengths;
[0037] S24: Extract the optimal wavelength combination and the corresponding eigenvector , specifically:
[0038] ;
[0039] wherein, is the eigenvector at the spatial coordinate , is the normalized hyperspectral image data at the spatial coordinate at the wavelength value, is the weight coefficient of the th optimal wavelength and satisfies .
[0040] Preferably, the step S3 includes the following steps:
[0041] S31: Calculate the adaptive weight coefficient for adjusting the contributions of different wavelength combinations , specifically:
[0042] ;
[0043] wherein, is the weight coefficient of the wavelength and combination and , and both belong to the optimal wavelength combination ; is the spectral correlation degree of the wavelength and ;
[0044] S32: Construct a set of normalized wavelength combination indices, specifically:
[0045] ;
[0046] wherein, is the normalized wavelength combination index constructed using the wavelengths and and at the spatial coordinate and are respectively the normalized hyperspectral image data at the spatial coordinate at the wavelength and value at
[0047] S33: Construct a complete wavelength combination index matrix , specifically:
[0048] ;
[0049] where is the matrix containing all possible wavelength combination indices at spatial coordinate , with dimension .
[0050] Preferably, step S4 includes the following steps:
[0051] S41: Construct a self-attention mechanism to obtain the self-attention feature at spatial coordinate ; ;
[0052] S42: Construct the input feature tensor of the deep learning network, specifically:
[0053] ;
[0054] where is the feature enhanced by the self-attention mechanism at spatial coordinate , is the S-shaped growth curve function, is the input feature tensor at spatial coordinate .
[0055] More preferably, step S41 includes the following steps:
[0056] S411: Construct a feature transformation matrix through the statistical characteristics of features, specifically:
[0057] ;
[0058] where is the dimensional identity matrix, , and are respectively the standard deviation matrix, mean matrix and Pearson correlation coefficient matrix of the wavelength combination index matrix , is the feature dimension, ;
[0059] S412: Calculate the self-attention feature:
[0060] ;
[0061] where , and are the query feature, key feature, and value feature at the spatial coordinate respectively, is the self-attention feature at the spatial coordinate respectively, is the normalized exponential function.
[0062] Preferably, step S5 includes the following steps:
[0063] S51: Construct a deep learning network, specifically:
[0064] ;
[0065] Among them, is the convolutional layer, is the global average pooling operation, is the batch normalization operation, and are the first fully connected layer and the second fully connected layer respectively, is the rectified linear unit function, , and are the feature vectors of the first, second, and third layers respectively;
[0066] S52: Construct a water quality parameter level classifier, specifically:
[0067] ;
[0068] Among them, is the level probability distribution vector of the th water quality parameter, is the classification head network of the th water quality parameter, is the number of levels of the th water quality parameter, is the true label of the th water quality parameter belonging to the th level, is the predicted probability of the th water quality parameter belonging to the th level, is the cross-entropy loss value of the th water quality parameter, is the total loss value, is the natural logarithm, is the number of water quality parameter types;
[0069] S53: Obtain the monitoring result of the water quality parameter level, specifically:
[0070] ;
[0071] Among them, is the final grade evaluation result of the th water quality parameter, and the value range is .
[0072] The present invention also discloses a water quality monitoring system based on intelligent analysis of hyperspectral images, including:
[0073] Preprocessing module: Obtain the original hyperspectral image data on the water surface and perform preprocessing to obtain standardized hyperspectral image data;
[0074] Wavelength optimization module: Extract spectral features and optimize wavelengths from the standardized hyperspectral data to obtain a key wavelength combination;
[0075] Wavelength combination index matrix construction module: Calculate the adaptive weight coefficients between different wavelengths in the optimal wavelength combination and the normalized wavelength combination index, and construct a wavelength combination index matrix;
[0076] Input feature tensor construction module: Based on the wavelength combination index matrix and the self-attention enhancement mechanism, construct the input feature tensor of the deep learning network;
[0077] Water quality parameter grade evaluation module: Based on the deep learning network, construct a water quality parameter grade classifier to evaluate the grades of each water quality parameter.
[0078] Compared with the prior art, the present invention has at least the following beneficial effects:
[0079] 1. By designing a multi-level data preprocessing process, including steps such as spectral smoothing and denoising, spatial registration and correction, and data standardization, the present invention effectively eliminates the influence of factors such as atmospheric scattering, equipment noise, and geographical location; at the same time, algorithms such as Savitzky-Golay filtering and affine transformation are adopted to ensure the continuity and spatial consistency of spectral data; an adaptive standardization method is introduced, which not only maintains the discrimination of the data but also improves the comparability between different regions, providing a high-quality data basis for subsequent analysis.
[0080] 2. The present invention extracts pure spectral features through endmember decomposition technology, effectively solving the problem of mixed pixels; constructs a wavelength importance evaluation index that comprehensively considers the between-class difference and within-class variance, objectively evaluating the discrimination ability of each wavelength; uses a genetic algorithm for wavelength optimization, reducing data redundancy while ensuring the discriminability of features; designs a feature enhancement strategy based on the self-attention mechanism, fully exploring the correlation between wavelengths, and constructing a feature tensor with strong expressive ability.
[0081] 3. The present invention designs a multi-task learning framework, which can classify multiple water quality parameters simultaneously; through techniques such as residual connection and batch normalization, the training efficiency and generalization ability of the model are improved; the probability output method not only gives clear classification results, but also provides a reliability assessment of the prediction, providing strong technical support for water quality monitoring and management decision-making. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 is a flowchart of a water quality monitoring method based on intelligent analysis of hyperspectral images according to Embodiment 1 of the present invention;
[0083] Figure 2 is the red, green, and blue three-channel images of the monitored target water body according to Embodiment 1 of the present invention;
[0084] Figure 3 is the original hyperspectral image of the monitored target water body according to Embodiment 1 of the present invention;
[0085] Figure 4 is Figure 3 the image after smoothing;
[0086] Figure 5 is Figure 4 the image after registration and calibration;
[0087] Figure 6 is the standardized hyperspectral image of the monitored target water body according to Embodiment 1 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0088] The present invention will be further described below with reference to the accompanying drawings, but the present invention is not limited in any way. Any transformation or replacement based on the teachings of the present invention falls within the protection scope of the present invention.
[0089] Embodiment 1:
[0090] As Figure 1 shown, a water quality monitoring method based on intelligent analysis of hyperspectral images includes the following steps:
[0091] S1: Obtain the original hyperspectral image data of the water surface and perform preprocessing to obtain standardized hyperspectral image data:
[0092] S11: Use a hyperspectral imaging device to obtain the original hyperspectral image data of the water surface , including the spatial coordinates of the image and the wavelength ;
[0093] In this embodiment, the red, green, and blue three-channel images and the original hyperspectral image of the monitored target water body are respectively as Figure 2 and Figure 3 shown;
[0094] S12: For the original hyperspectral image data perform spectral smoothing and denoising processing to obtain the smoothed reflectance data , as Figure 4 shown, specifically:
[0095] ;
[0096] wherein, is the value of the smoothed reflectance data at the wavelength at the spatial coordinate , is the value of the original hyperspectral image data at the wavelength at the spatial coordinate , is the interval of adjacent wavelength sampling points, is the weight coefficient of the Savitzky-Golay filter kernel function at the position index within the filtering window, ranges from , is the filtering window radius, which is 3 in this embodiment;
[0097] Specifically:
[0098] ;
[0099] wherein, is the position vector, is the geometric progression matrix;
[0100] S13: Perform spatial registration and geometric correction on the smoothed reflectance data to obtain the corrected reflectance data , as Figure 5 shown, specifically:
[0101] ;
[0102] wherein, is the value of the corrected reflectance data at the wavelength at the spatial coordinate , is the value of the smoothed reflectance data at the wavelength at the spatial coordinate , is the affine transformation matrix The weight coefficient at the position and are respectively the horizontal index and the vertical index of the affine transformation matrix, and their value ranges are both integers in ;
[0103] Specifically, the affine transformation matrix in this embodiment is as follows:
[0104] Select the central wavelength of the spectral range as the reference wavelength; determine the spatial offset between wavelengths by calculating the Pearson correlation coefficient between other wavelengths and the reference wavelength; construct a 5×5 correction matrix based on the spatial offset to correct the spatial position deviation between wavelengths. The weight coefficients at each position of the correction matrix are calculated using a Gaussian function, and the smoothing parameter of the Gaussian function is 1; perform normalization processing on the correction matrix so that the sum of all weight coefficients is 1;
[0105] S14: Construct the standardized hyperspectral image data as shown in Figure 6 , specifically:
[0106] ;
[0107] where is the value of the standardized hyperspectral image data at the wavelength in the spatial coordinate , is the mean value of the reflectance values of all pixel points at the wavelength , is the standard deviation of the reflectance values of all pixel points at the wavelength , is the standardized adjustment parameter used to control the degree of standardization, which is 0.3 in this embodiment, is the natural constant.
[0108] This step adopts the method of multi-source data fusion, makes full use of the complementarity of hyperspectral and lidar data, and improves the integrity and reliability of the data; realizes the unification of data at different scales through data standardization, laying a foundation for subsequent feature extraction.
[0109] S2: Perform spectral feature extraction and wavelength optimization on the standardized hyperspectral data to obtain the key wavelength combination:
[0110] S21: Perform spectral decomposition on the standardized hyperspectral image data to obtain the endmember spectra and the abundance map, specifically:
[0111] ;
[0112] where is the abundance value of the th endmember at the spatial coordinate , obtained by the least squares method. is the spectral response value of the th endmember at the wavelength , obtained by the vertex component analysis method. is the number of endmembers, which is 3 in this embodiment. is the Frobenius norm;
[0113] In this embodiment, the process of obtaining the endmember spectra by the vertex component analysis method is as follows: The process is as follows:
[0114] Expand the standardized hyperspectral image data into a two-dimensional matrix in the spatial dimension , where is the pixel index; calculate the covariance matrix of the matrix , perform eigenvalue decomposition on the covariance matrix to obtain the eigenvector matrix and the eigenvalue diagonal matrix ; select the eigenvectors corresponding to the largest eigenvalues to form the projection matrix , project the original data into the eigenvector space to obtain ; find vertices in the projection space, and back-project these vertices into the original space to obtain the endmember spectra ;
[0115] S22: Construct an evaluation index for wavelength importance, calculate the discrimination score for each wavelength, specifically:
[0116] ;
[0117] Among them, is the discrimination score at the wavelength , is the average spectral response value of the th endmember at the wavelength , is the average spectral response value of the th endmember at the wavelength , is the spectral variance of the th endmember at the wavelength ;
[0118] S23: Optimize the wavelength combination based on the genetic algorithm, and construct the fitness function :
[0119] ;
[0120] Among them, is the fitness value of the candidate wavelength combination , and are both weight coefficients, which are 0.7 and 0.3 respectively in this embodiment, is the wavelength at which the Pearson correlation coefficient of the spectral response;
[0121] The optimization process of the genetic algorithm in this embodiment is as follows:
[0122] Initialize the population, encode the candidate wavelength combination into a binary chromosome, the chromosome length is the number of spectral wavelengths, 1 indicates that the wavelength is selected, and 0 indicates that it is not selected; set the population size to 100 and the maximum number of iterations to 200; perform the selection operation by roulette, and the selection probability is proportional to the individual fitness value; the crossover operation adopts the single-point crossover method, and the crossover probability is set to 0.8; the mutation operation adopts the bit-reversal method, and the mutation probability is set to 0.1; keep the individual with the highest fitness value directly in the next generation in each iteration, and the remaining individuals are generated through selection, crossover and mutation operations; stop the iteration when the maximum number of iterations is reached or the change in the optimal fitness value for 20 consecutive generations is less than ;
[0123] Iteratively optimize to obtain the optimal wavelength combination , specifically:
[0124] ;
[0125] Among them, is the th selected optimal wavelength, is the number of selected optimal wavelengths, which is 5 in this embodiment;
[0126] S24: Extract the feature vector corresponding to the optimal wavelength combination , specifically:
[0127] ;
[0128] Among them, is the feature vector at the spatial coordinate , is the normalized hyperspectral image data at the spatial coordinate at the wavelength , is the weight coefficient of the th optimal wavelength, and satisfies , in this embodiment .
[0129] In this step, endmember decomposition is used to obtain spectral endmembers and abundance maps, effectively separating the pure spectral information in mixed pixels; a wavelength importance evaluation index is constructed, comprehensively considering the between-class difference and within-class variance to objectively evaluate the discrimination ability of each wavelength; the genetic algorithm is used for wavelength optimization, and the fitness function is used to consider both the wavelength discrimination ability and redundancy, ensuring that the selected wavelength combination has strong discrimination ability and low information redundancy.
[0130] S3: Calculate the adaptive weight coefficients between different wavelengths in the optimal wavelength combination and the normalized wavelength combination index, and construct a wavelength combination index matrix:
[0131] S31: Calculate the adaptive weight coefficients used to adjust the contributions of different wavelength combinations , specifically:
[0132] ;
[0133] where is the weight coefficient of the wavelength and combination and , and both belong to the optimal wavelength combination ; is the spectral correlation degree of the wavelengths and ;
[0134] The process of obtaining the spectral correlation degree in this embodiment is:
[0135] ;
[0136] S32: Construct a set of normalized wavelength combination indices, specifically:
[0137] ;
[0138] where is the normalized wavelength combination index constructed using the wavelengths at the spatial coordinate and , and are the values of the standardized hyperspectral image data at the spatial coordinate when the wavelengths are and ;
[0139] S33: Construct a complete wavelength combination index matrix , specifically:
[0140] ;
[0141] Among them, is a matrix containing all possible wavelength combination indices at the spatial coordinate , with a dimension of .
[0142] In this step, the dynamic adjustment of the importance of different wavelength combinations is achieved by constructing an adaptive weight coefficient. The design of the weight coefficient fully considers the spectral correlation between wavelengths, enabling wavelength combinations with lower correlation to obtain higher weights, effectively improving the utilization efficiency of complementary information; adopting the form of normalized wavelength combination indices not only eliminates the influence of spectral absolute values but also highlights the relative difference characteristics between wavelengths, enhancing the discrimination ability of spectral features; integrating all possible wavelength combinations into a unified index matrix not only retains the complete combination information but also facilitates subsequent feature extraction and classification recognition.
[0143] S4: Based on the wavelength combination index matrix and the self-attention enhancement mechanism, construct the input feature tensor of the deep learning network:
[0144] S41: Construct a self-attention mechanism to obtain the self-attention feature at the spatial coordinate :
[0145] S411: Construct a feature transformation matrix through the statistical characteristics of features, specifically:
[0146] ;
[0147] Among them, is the -dimensional identity matrix, , and are respectively the standard deviation matrix, mean matrix, and Pearson correlation coefficient matrix of the wavelength combination index matrix , is the feature dimension, ;
[0148] S412: Calculate the self-attention feature:
[0149] ;
[0150] Among them, , and are respectively the query feature, key feature, and value feature at the spatial coordinate , is the spatial coordinate The self-attention feature at is the normalized exponential function;
[0151] S42: Construct the input feature tensor of the deep learning network, specifically:
[0152] ;
[0153] Among them, is the spatial coordinate The feature enhanced by the self-attention mechanism at is the S-shaped growth curve function, is the spatial coordinate The input feature tensor at
[0154] In this step, the adaptive enhancement of the wavelength combination feature is realized by designing the self-attention mechanism, and the statistical characteristics of the feature are fully utilized to construct the feature transformation matrix, so that the important feature combinations obtain higher attention weights; three statistical indicators of standard deviation, mean and correlation are considered simultaneously in the feature transformation process, comprehensively depicting the distribution characteristics and internal correlations of the features; the query-key-value attention calculation framework is adopted, which can not only capture the long-range dependence relationship between features, but also highlight the discriminative feature combinations.
[0155] S5: Construct a water quality parameter grade classifier based on the deep learning network to evaluate the grades of each water quality parameter:
[0156] S51: Construct a deep learning network, specifically:
[0157] ;
[0158] Among them, is the convolutional layer. In this embodiment, the convolutional kernel size of the convolutional layer is , the stride is 1, is the global average pooling operation, is the batch normalization operation, and are the first fully connected layer and the second fully connected layer respectively. In this embodiment, the output dimensions are 256 and 128 respectively, is the rectified linear unit function, , and are the feature vectors of the first, second, and third layers respectively;
[0159] S52: Construct a water quality parameter grade classifier, specifically:
[0160] ;
[0161] Among them, is the The grade probability distribution vector of water quality parameters is the classification head network for the th water quality parameter is the number of grades for the th water quality parameter is the true label for the th water quality parameter belonging to the th grade is the predicted probability for the th water quality parameter belonging to the th grade is the cross - entropy loss value for the th water quality parameter is the total loss value is the natural logarithm is the number of water quality parameter types, which is 3 in this embodiment, including total nitrogen, total phosphorus, and chlorophyll
[0162] In this embodiment, the training process of the deep learning network adopts the following strategy:
[0163] The initial learning rate is set to 0.001, and the Adam optimizer with a momentum of 0.9 is used for parameter update; every 10 training epochs, the learning rate decays to 0.1 times the original; the training batch size is set to 64; to prevent overfitting, an early stopping strategy is adopted, and training stops when the validation set loss does not decrease for 5 consecutive epochs
[0164] S53: Obtain the monitoring results of water quality parameter grades, specifically:
[0165] ;
[0166] Among them, is the final grade evaluation result for the th water quality parameter, and the value range is , indicating different pollution levels, which are divided into 5 levels in this embodiment is to select the grade with the highest probability among all possible grades as the final evaluation result
[0167] In this step, by designing a multi - level deep learning network structure, the accurate division of the pollution levels corresponding to each water quality parameter is realized. Among them, the convolutional layer can effectively extract spatial features, the global average pooling operation reduces the feature dimension and retains key information, and the batch normalization operation accelerates network training and improves model stability
[0168] Example 2:
[0169] This embodiment provides a water quality monitoring system based on intelligent analysis of hyperspectral images, which mainly includes the following five modules:
[0170] Pretreatment module: Obtain the original hyperspectral image data on the water surface and perform pretreatment to obtain standardized hyperspectral image data;
[0171] Wavelength optimization module: Extract spectral features and optimize wavelengths from the standardized hyperspectral data to obtain a key wavelength combination;
[0172] Wavelength combination index matrix construction module: Calculate the adaptive weight coefficients between different wavelengths in the optimal wavelength combination and the normalized wavelength combination index, and construct a wavelength combination index matrix;
[0173] Input feature tensor construction module: Based on the wavelength combination index matrix and the self-attention enhancement mechanism, construct the input feature tensor of the deep learning network;
[0174] Water quality parameter level evaluation module: Based on the deep learning network, construct a water quality parameter level classifier to evaluate the levels of various water quality parameters.
[0175] The water quality monitoring system provided in this embodiment is used to implement the water quality monitoring method in Embodiment 1 above. Among them, the functions implemented by each functional module of the water quality monitoring system correspond one by one to the steps of the water quality monitoring method; therefore, it will not be elaborated here.
[0176] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments. And the term "including", "comprising" or any other variant thereof in this article is intended to cover a non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such a process, device, article or method. Without further limitations, the element defined by the statement "including one..." does not exclude the existence of other identical elements in the process, device, article or method including the element.
[0177] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment method can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0178] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present invention.
Claims
1. A water quality monitoring method based on intelligent analysis of hyperspectral images, characterized in that: The following steps are involved: S1: Acquire the original hyperspectral image data of the water surface and perform preprocessing to obtain standardized hyperspectral image data; S2: Extract spectral features and optimize wavelengths of standardized hyperspectral data to obtain key wavelength combinations; including: First, spectral decomposition is performed, and the spectral response value of the endmember at each wavelength is obtained by using the vertex component analysis method. The endmember abundance value at each spatial position is obtained by using the least squares method. The spectral decomposition is optimized by minimizing the Frobenius norm. Then, the discrimination score of each wavelength is calculated based on the spectral decomposition result. Then, the fitness value of different wavelength combinations is obtained based on the discrimination scores of all wavelengths and the Pearson correlation coefficient between the wavelengths. The optimal wavelength combination is obtained by iterative optimization using a genetic algorithm. Finally, a feature vector is constructed based on the standardized hyperspectral image data corresponding to each wavelength in the optimal wavelength combination. S3: Calculate the adaptive weight coefficients and normalized wavelength combination indexes between different wavelengths in the optimal wavelength combination, and construct a wavelength combination index matrix; S4: Construct the input feature tensor of the deep learning network based on the wavelength combination index matrix and self-attention enhancement mechanism; S5: Construct a water quality parameter grade classifier based on the deep learning network and evaluate the grade of each water quality parameter.
2. The water quality monitoring method based on hyperspectral image intelligent analysis according to claim 1 is characterized in that: The step S1 comprises the following steps: S11: Use hyperspectral imaging equipment to obtain raw hyperspectral image data of the water surface , including the spatial coordinates of the image and wavelength ; S12: Raw hyperspectral image data Perform spectral smoothing and denoising to obtain smoothed reflectance data , specifically: ; in, is the smoothed reflectivity data In space coordinates The wavelength is The value of is the original hyperspectral image data In space coordinates The wavelength is The value of is the interval between adjacent wavelength sampling points, is the weight coefficient of the Savitzky-Golay filter kernel function Position index within the filter window The weight of The value range is , is the filter window radius; S13: Smoothed reflectivity data Perform spatial registration and geometric correction to obtain corrected reflectivity data , specifically: ; in, is the corrected reflectance data In space coordinates The wavelength is The value of is the smoothed reflectivity data In space coordinates The wavelength is The value of is the affine transformation matrix In Location The weight coefficient at and are the horizontal and vertical indices of the affine transformation matrix, respectively, and their value ranges are Integer in ; S14: Constructing standardized hyperspectral image data , specifically: ; in, Standardized hyperspectral image data In space coordinates The wavelength is The value of The wavelength The mean reflectance value of all pixels at The wavelength The standard deviation of the reflectance values of all pixels at is the standardization adjustment parameter used to control the degree of standardization. is a natural constant.
3. The water quality monitoring method based on hyperspectral image intelligent analysis according to claim 2 is characterized in that: The step S2 comprises the following steps: S21: Perform spectral decomposition on the standardized hyperspectral image data to obtain endmember spectra and abundance maps, specifically: ; in, For the The end members have spatial coordinates The abundance value at For the The end member is at the wavelength The spectral response value at is the number of end members, is the Frobenius norm; S22: Construct a wavelength importance evaluation index and calculate the discrimination score of each wavelength, specifically: ; in, The wavelength The discrimination score at For the The end member is at the wavelength The average spectral response value at For the The end member is at the wavelength The average spectral response value at For the The end member is at the wavelength Spectral variance at ; S23: Optimize wavelength combination based on genetic algorithm and construct fitness function : ; in, Candidate wavelength combinations The fitness value of and are weight coefficients, The wavelength Pearson correlation coefficient of the spectral response at ; Iterative optimization to obtain the optimal wavelength combination , specifically: ; in, For the The optimal wavelength is selected. is the optimal number of wavelengths selected; S24: Extracting the optimal wavelength combination The corresponding eigenvector , specifically: ; in, is the spatial coordinate The eigenvector at Standardized hyperspectral image data In space coordinates The wavelength is The value of For the The weight coefficient of the optimal wavelength satisfies .
4. The water quality monitoring method based on hyperspectral image intelligent analysis according to claim 3 is characterized in that: The step S3 comprises the following steps: S31: Calculate the adaptive weight coefficients used to adjust the contribution of different wavelength combinations , specifically: ; in, The wavelength and The combined weight coefficient and , and All belong to the optimal wavelength combination ; The wavelength and Spectral correlation of S32: Construct a normalized wavelength combination index set, specifically: ; in, In space coordinates Use wavelength and The normalized wavelength combination index constructed, and The standardized hyperspectral image data are In space coordinates The wavelength is and The value at time; S33: Constructing a complete wavelength combination index matrix , specifically: ; in, is the spatial coordinate The matrix containing all possible wavelength combination indices at is of dimension .
5. The water quality monitoring method based on hyperspectral image intelligent analysis according to claim 4 is characterized in that: The step S4 comprises the following steps: S41: Build a self-attention mechanism to obtain spatial coordinates Self-attention features at ; S42: Construct the input feature tensor of the deep learning network, specifically: ; in, is the spatial coordinate The features enhanced by the self-attention mechanism at is an S-shaped growth curve function, is the spatial coordinate The input feature tensor at .
6. The water quality monitoring method based on hyperspectral image intelligent analysis according to claim 5 is characterized in that: The step S41 comprises the following steps: S411: construct a feature transformation matrix based on feature statistical characteristics, specifically: ; in, for dimensional identity matrix, , and They are the wavelength combination index matrices The standard deviation matrix, mean matrix and Pearson correlation coefficient matrix of is the feature dimension, ; S412: Calculate self-attention features: ; in, , and The spatial coordinates are The query features, key features and value features at is the spatial coordinate The self-attention feature at is the normalized exponential function.
7. The water quality monitoring method based on hyperspectral image intelligent analysis according to claim 5 is characterized in that: The step S5 comprises the following steps: S51: Build a deep learning network, specifically: ; in, is the convolutional layer, is the global average pooling operation, is the batch normalization operation, and They are the first fully connected layer and the second fully connected layer, is a linear rectification function, , and are the feature vectors of the 1st, 2nd, and 3rd layers respectively; S52: Construct a water quality parameter level classifier, specifically: ; in, For the The probability distribution vector of the levels of water quality parameters, For the Classification head network of water quality parameters, For the The number of levels of water quality parameters, For the The water quality parameters belong to The true label of level, For the The water quality parameters belong to The predicted probability of level For the The cross entropy loss value of the water quality parameters, is the total loss value, is the natural logarithm, is the number of water quality parameter types; S53: Obtain water quality parameter level monitoring results, specifically: ; in, For the The final grade evaluation results of the water quality parameters range from .
8. A water quality monitoring system based on intelligent analysis of hyperspectral images, characterized in that: include: Preprocessing module: obtain the original hyperspectral image data of the water surface and perform preprocessing to obtain standardized hyperspectral image data; Wavelength optimization module: extracts spectral features and optimizes wavelengths of standardized hyperspectral data to obtain key wavelength combinations; Wavelength combination index matrix construction module: calculates the adaptive weight coefficients and normalized wavelength combination indexes between different wavelengths in the optimal wavelength combination, and constructs the wavelength combination index matrix; Input feature tensor construction module: constructs the input feature tensor of the deep learning network based on the wavelength combination index matrix and self-attention enhancement mechanism; Water quality parameter grade assessment module: construct a water quality parameter grade classifier based on a deep learning network to assess the grade of each water quality parameter; To realize the water quality monitoring method based on hyperspectral image intelligent analysis as described in any one of claims 1 to 7.
Citation Information
Patent Citations
A water quality monitoring system based on multi-source data perception
CN119534788B
Hyperspectral water quality parameter estimation method of LBFGS optimization acceleration multilayer sensing network
CN118552851A
Hyperspectral data and image analysis using machine learning
US20240288308A1