Water supply network water quality monitoring method and system based on neural network
Through the water quality monitoring method of water supply network based on neural networks, using multi-spectral data and neural network models, the problem of traditional water quality monitoring methods being time-consuming and unable to provide real-time feedback is solved, and high-accurate water quality monitoring is achieved.
Patent Information
- Application Number
- CN202510090098.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-01-21
AI Technical Summary
Traditional water quality monitoring methods rely on manual sampling and laboratory analysis, which is time-consuming and labor-intensive, and cannot provide real-time feedback on water quality conditions, and cannot deal with the problem of deterioration in the water supply pipeline network in a timely manner.
The water quality monitoring method of water supply pipeline network based on neural network is adopted. By collecting multi-spectral data, the noise level is calculated and the band image is screened, performance indicators are evaluated, feature expression images are formed, and input them into the neural network for training to generate a water quality monitoring model.
The data quality is improved, the focus ability of the neural network to have the most impact on water quality is enhanced, and the accuracy and prediction capabilities of water quality monitoring results are significantly improved.
Smart Images

Figure CN120014409A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water quality monitoring, and in particular to a method and system for monitoring water quality of a water supply network based on a neural network. Background Art
[0002] With the acceleration of urbanization, the complexity and importance of water supply networks have become increasingly prominent. Water supply networks are not only responsible for transporting water from water treatment plants to residents and businesses, but also need to ensure the safety and stability of water quality during transportation. Traditional water quality monitoring methods mainly rely on manual sampling and laboratory analysis, which is not only time-consuming and labor-intensive, but also unable to provide real-time feedback on water quality conditions, which can easily cause hidden dangers.
[0003] In recent years, water pollution incidents have occurred frequently, such as due to aging, corrosion, leakage of pipe networks, etc., which has led to water quality deterioration and seriously affected the health of residents. Therefore, a fast, accurate and intelligent water quality monitoring method is particularly urgent. Summary of the invention
[0004] In order to solve the above problems, an object of the embodiments of the present invention is to provide a method and system for monitoring water quality in a water supply network based on a neural network.
[0005] A water quality monitoring method for a water supply network based on a neural network, comprising:
[0006] Step 1: Collect multispectral data of water supply network detection points;
[0007] Step 2: Calculate the noise level of multispectral data and filter out band images with noise levels within a preset range;
[0008] Step 3: Evaluate the performance indicators of the band images and select the feature expression images whose performance indicators are within the preset range;
[0009] Step 4: Calibrate the water quality index corresponding to each feature expression image to form a training sample;
[0010] Step 5: Input the training samples into the neural network for training to obtain a water quality monitoring model;
[0011] Step 6: Use the water quality monitoring model to complete water quality monitoring of the target water supply network detection point.
[0012] Preferably, the step 2: calculating the noise level of the multispectral data and screening out band images with noise levels within a preset range includes:
[0013] Step 2.1: Divide the multispectral data image of each band into window structures of equal size;
[0014] Step 2.2: Calculate the weight value of each pixel in the window structure;
[0015] Step 2.3: Divide multiple intervals between the minimum and maximum values of the pixel weight value;
[0016] Step 2.4: Divide the corresponding pixel weight values in each window structure into different intervals;
[0017] Step 2.5: The weight value corresponding to the window structure with the most number in the interval is taken as the noise level of the entire band image;
[0018] Step 2.6: Filter out the band images whose noise levels are within a preset range.
[0019] Preferably, in step 2.2, the calculation formula of the pixel weight value in the window structure is:
[0020]
[0021] Among them, lv represents the pixel weight value in the window structure, B represents the length and width of the window structure, and s i represents the value of the i-th pixel in the window structure, and lm represents the average pixel variance of the window structure.
[0022] Preferably, the step 3: evaluating the performance index of the band image and screening out the feature expression images whose performance index is within a preset range includes:
[0023] Step 3.1: Stretch each band image into a one-dimensional vector to form a flat image;
[0024] Step 3.2: Calculate the correlation between the flattened images of each band;
[0025] Step 3.3: Construct the correlation matrix of spectral data based on the correlation;
[0026] Step 3.4: Calculating a band selection threshold according to the spectral data correlation matrix;
[0027] Step 3.5: Filter out the band images corresponding to the band selection threshold whose correlation is less than the band selection threshold as the feature expression images.
[0028] Preferably, the step 3.2: calculating the correlation between the flat images of each band includes:
[0029] Using the formula:
[0030]
[0031] Calculate the correlation between the flattened images of each band; where p ij represents the correlation between the flattened image of the i-th band and the flattened image of the j-th band, b nirepresents the nth pixel value in the flattened image, Represents the mean value of pixels in the flattened image.
[0032] Preferably, in step 3.3, the spectral data correlation matrix is:
[0033]
[0034] in, Represents the element in the i-th row and j-th column in the spectral data correlation matrix, and 1≤i≤L, 1≤j≤L.
[0035] Preferably, the step 3.4: calculating the band selection threshold according to the spectral data correlation matrix comprises:
[0036] Step 3.4.1: Extract the maximum value in the correlation matrix of spectral data;
[0037] Step 3.4.2: Calculate the band selection threshold using the maximum value; wherein the calculation formula of the band selection threshold is:
[0038]
[0039] Among them, t fine represents the band selection threshold, represents the maximum value in the correlation matrix of spectral data, Represents the band selection function.
[0040] Preferably, the step 5: inputting the training samples into a neural network for training to obtain a water quality monitoring model comprises:
[0041] Step 5.1: Input the training samples into 3D-CNN and 2D-CNN to extract features to form feature images; the feature extraction formula is:
[0042]
[0043] Among them, X 3D Represents the features extracted using the 3D-CNN layer, Conv3D 3×3 represents a 3D-CNN layer with a convolution kernel size of 3, X in represents the input training sample, X conv Represents the features extracted using the 2D-CNN layer, Conv2D 1×1 Represents a 2D-CNN layer with a convolution kernel size of 1, Conv2D 3×3 Represents a 2D-CNN layer with a convolution kernel size of 3, Conv2D 5×5 represents a 2D-CNN layer with a convolution kernel size of 5, Indicates the channel splicing operation, represents the element addition operation, X out Represents the output feature image;
[0044] Step 5.2: Input the feature image into the Transformer network for training to obtain a water quality monitoring model.
[0045] The present invention also provides a water quality monitoring system for a water supply network based on a neural network, comprising:
[0046] Multispectral data acquisition module, used to collect multispectral data of water supply network detection points;
[0047] The band image screening module is used to calculate the noise level of multispectral data and screen out band images with noise levels within a preset range;
[0048] A performance index evaluation module is used to evaluate the performance index of the band image and screen out feature expression images whose performance index is within a preset range;
[0049] A sample calibration module is used to calibrate the water quality index corresponding to each feature expression image to form a training sample;
[0050] A training module is used to input training samples into a neural network for training to obtain a water quality monitoring model;
[0051] The water quality monitoring module is used to complete the water quality monitoring of the target water supply network detection point using the water quality monitoring model.
[0052] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps in the above-mentioned method for monitoring water quality of a water supply network based on a neural network are implemented.
[0053] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0054] The present invention relates to a water quality monitoring method for a water supply network based on a neural network. Compared with the prior art, the present invention effectively improves data quality by calculating noise levels and screening suitable band images. The evaluation of band image performance indicators ensures that only feature expression images with good performance are selected, which helps the neural network focus on variables that have the greatest impact on water quality, greatly increases the prediction ability of the model, and improves the accuracy of water quality monitoring results.
[0055] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0057] Figure 1 A flow chart of a water quality monitoring method for a water supply network based on a neural network provided by the present invention;
[0058] Figure 2 A schematic diagram of a water quality monitoring system for a water supply network based on a neural network provided by the present invention. DETAILED DESCRIPTION
[0059] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0060] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0061] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0062] See also Figure 1 , a water quality monitoring method for a water supply network based on a neural network, comprising:
[0063] Step 1: Collect multispectral data of water supply network detection points;
[0064] Step 2: Calculate the noise level of multispectral data and filter out band images with noise levels within a preset range;
[0065] Furthermore, step 2 includes:
[0066] Step 2.1: Divide the multispectral data image of each band into window structures of equal size;
[0067] Step 2.2: Calculate the weight value of each pixel in the window structure;
[0068] In step 2.2, the calculation formula of the pixel weight value in the window structure is:
[0069]
[0070] Among them, lv represents the pixel weight value in the window structure, B represents the length and width of the window structure, and s i represents the value of the i-th pixel in the window structure, and lm represents the average pixel variance of the window structure.
[0071] Step 2.3: Divide multiple intervals between the minimum and maximum values of the pixel weight value;
[0072] Step 2.4: Divide the corresponding pixel weight values in each window structure into different intervals;
[0073] Step 2.5: The weight value corresponding to the window structure with the most number in the interval is taken as the noise level of the entire band image;
[0074] Step 2.6: Filter out the band images whose noise levels are within a preset range.
[0075] The present invention divides the band image into window structures with equal pixel sizes, calculates the local variance of these window structures, and then divides N equal-width intervals within the maximum and minimum lv ranges of the image blocks, and distributes all blocks to these intervals according to the values. The noise level of the interval with the largest number of blocks will be used as the noise level of the entire band image. The present invention can ensure the quality of subsequent analysis data by screening image bands with lower noise.
[0076] Step 3: Evaluate the performance indicators of the band images and select the feature expression images whose performance indicators are within the preset range;
[0077] Furthermore, step 3 includes:
[0078] Step 3.1: Stretch each band image into a one-dimensional vector to form a flat image;
[0079] Step 3.2: Calculate the correlation between the flattened images of each band;
[0080] In step 3.2, the present invention may use the Pearson correlation coefficient calculation formula:
[0081]
[0082] Calculate the correlation between the flattened images of each band; where p ij represents the correlation between the flattened image of the i-th band and the flattened image of the j-th band, b ni represents the nth pixel value in the flattened image, b i Represents the mean value of pixels in the flattened image.
[0083] Step 3.3: Construct the correlation matrix of spectral data based on the correlation;
[0084] In step 3.3, the spectral data correlation matrix is:
[0085]
[0086] in, Represents the element in the i-th row and j-th column in the spectral data correlation matrix, and 1≤i≤L, 1≤j≤L.
[0087] Step 3.4: Calculating a band selection threshold according to the spectral data correlation matrix;
[0088] Among them, step 3.4 includes:
[0089] Step 3.4.1: Extract the maximum value in the correlation matrix of spectral data;
[0090] Step 3.4.2: Calculate the band selection threshold using the maximum value; wherein the calculation formula of the band selection threshold is:
[0091]
[0092] Among them, t fine represents the band selection threshold, represents the maximum value in the correlation matrix of spectral data, Represents the band selection function.
[0093] Step 3.5: Filter out the band images corresponding to the band selection threshold whose correlation is less than the band selection threshold as the feature expression images.
[0094] The present invention can discover complementary features between images by retaining bands with low correlation, which can improve the generalization ability of the model and reduce the risk of overfitting.
[0095] Step 4: Calibrate the water quality index corresponding to each feature expression image to form a training sample;
[0096] Step 5: Input the training samples into the neural network for training to obtain a water quality monitoring model;
[0097] Wherein, step 5 includes:
[0098] Step 5.1: Input the training samples into 3D-CNN and 2D-CNN to extract features to form feature images; the feature extraction formula is:
[0099]
[0100] Among them, X 3D Represents the features extracted using the 3D-CNN layer, Conv3D 3×3 represents a 3D-CNN layer with a convolution kernel size of 3, X in represents the input training sample, X conv Represents the features extracted using the 2D-CNN layer, Conv2D 1×1 Represents a 2D-CNN layer with a convolution kernel size of 1, Conv2D 3×3 Represents a 2D-CNN layer with a convolution kernel size of 3, Conv2D 5×5 represents a 2D-CNN layer with a convolution kernel size of 5, Indicates the channel splicing operation, represents the element addition operation, X out Represents the output feature image;
[0101] The training sample first passes through a 3D-CNN layer with a convolution kernel size of 3 to fully explore the joint features of space and spectrum, and then passes through a 3-layer 2D convolution block with a convolution kernel size of 1 to further extract spectral information, and then uses a convolution block with a convolution kernel size of 3 to capture spatial information. Finally, multi-granularity feature extraction is performed through convolution blocks with convolution kernel sizes of 1, 3, and 5, and the fine-grained and coarse-grained features are added and fused, and then feature splicing is performed to form the final feature representation. Based on 3D convolution and multi-layer 2D convolution, the present invention can effectively capture the complex relationship between spatial and spectral information, improve the performance of features, and combine the method of extracting and fusing features layer by layer. It can construct features hierarchically from low-level to high-level, and improve the network's ability to understand data.
[0102] Step 5.2: Input the feature image into the Transformer network for training to obtain a water quality monitoring model;
[0103] Step 6: Use the water quality monitoring model to complete water quality monitoring of the target water supply network detection point.
[0104] The present invention calculates the noise level and screens suitable band images, which effectively improves the data quality. The evaluation of band image performance indicators ensures that only feature expression images with good performance are selected, which helps the neural network focus on the variables that have the greatest impact on water quality, greatly increases the predictive ability of the model, and improves the accuracy of water quality monitoring results.
[0105] See also Figure 2 The present invention also provides a water quality monitoring system for a water supply network based on a neural network, comprising:
[0106] Multispectral data acquisition module, used to collect multispectral data of water supply network detection points;
[0107] The band image screening module is used to calculate the noise level of multispectral data and screen out band images with noise levels within a preset range;
[0108] A performance index evaluation module is used to evaluate the performance index of the band image and screen out feature expression images whose performance index is within a preset range;
[0109] A sample calibration module is used to calibrate the water quality index corresponding to each feature expression image to form a training sample;
[0110] A training module is used to input training samples into a neural network for training to obtain a water quality monitoring model;
[0111] The water quality monitoring module is used to complete the water quality monitoring of the target water supply network detection point using the water quality monitoring model.
[0112] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory and the processor are connected via the bus, and is characterized in that when the computer program is executed by the processor, the steps in the above-mentioned method for monitoring water quality of a water supply network based on a neural network are implemented. Compared with the prior art, the beneficial effects of the electronic device provided by the present invention are the same as the beneficial effects of the method for monitoring water quality of a water supply network based on a neural network described in the above-mentioned technical solution, and are not elaborated herein.
[0113] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps in the above-mentioned method for monitoring water quality of a water supply network based on a neural network are implemented. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present invention are the same as the beneficial effects of the method for monitoring water quality of a water supply network based on a neural network described in the above technical solution, which will not be repeated here.
[0114] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technical solution that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A water quality monitoring method for a water supply network based on a neural network, characterized in that: include: Step 1: Collect multispectral data of water supply network detection points; Step 2: Calculate the noise level of multispectral data and filter out band images with noise levels within a preset range; Step 3: Evaluate the performance indicators of the band images and select the feature expression images whose performance indicators are within the preset range; Step 4: Calibrate the water quality index corresponding to each feature expression image to form a training sample; Step 5: Input the training samples into the neural network for training to obtain a water quality monitoring model; Step 6: Use the water quality monitoring model to complete water quality monitoring of the target water supply network detection point.
2. A water quality monitoring method for a water supply network based on a neural network according to claim 1, characterized in that: The step 2: calculating the noise level of the multispectral data and screening out the band images whose noise level is within a preset range, includes: Step 2.1: Divide the multispectral data image of each band into window structures of equal size; Step 2.2: Calculate the weight value of each pixel in the window structure; Step 2.3: Divide multiple intervals between the minimum and maximum values of the pixel weight value; Step 2.4: Divide the corresponding pixel weight values in each window structure into different intervals; Step 2.5: The weight value corresponding to the window structure with the most number in the interval is taken as the noise level of the entire band image; Step 2.6: Filter out the band images whose noise levels are within a preset range.
3. A water quality monitoring method for a water supply network based on a neural network according to claim 2, characterized in that: In step 2.2, the calculation formula of the pixel weight value in the window structure is: Among them, lv represents the pixel weight value in the window structure, B represents the length and width of the window structure, and s i represents the value of the i-th pixel in the window structure, and lm represents the average pixel variance of the window structure.
4. A water quality monitoring method for a water supply network based on a neural network according to claim 3, characterized in that: The step 3: evaluating the performance index of the band image and selecting the feature expression images whose performance index is within a preset range, includes: Step 3.1: Stretch each band image into a one-dimensional vector to form a flat image; Step 3.2: Calculate the correlation between the flattened images of each band; Step 3.3: Construct the correlation matrix of spectral data based on the correlation; Step 3.4: Calculating a band selection threshold according to the spectral data correlation matrix; Step 3.5: Filter out the band images corresponding to the band selection threshold whose correlation is less than the band selection threshold as the feature expression images.
5. A method for monitoring water quality of a water supply network based on a neural network according to claim 4, characterized in that: The step 3.2: calculating the correlation between the flattened images of each band, includes: Using the formula: Calculate the correlation between the flattened images of each band; where p ij represents the correlation between the flattened image of the i-th band and the flattened image of the j-th band, b ni represents the nth pixel value in the flattened image, Represents the mean value of pixels in the flattened image.
6. A method for monitoring water quality of a water supply network based on a neural network according to claim 5, characterized in that: In step 3.3, the spectral data correlation matrix is: in, Represents the element in the i-th row and j-th column in the spectral data correlation matrix, and 1≤i≤L, 1≤j≤L.
7. A water quality monitoring method for a water supply network based on a neural network according to claim 6, characterized in that: The step 3.4: calculating the band selection threshold according to the spectral data correlation matrix, comprises: Step 3.4.1: Extract the maximum value in the correlation matrix of spectral data; Step 3.4.2: Calculate the band selection threshold using the maximum value; wherein the calculation formula of the band selection threshold is: Among them, t fine represents the band selection threshold, represents the maximum value in the correlation matrix of spectral data, Represents the band selection function.
8. A water quality monitoring method for a water supply network based on a neural network according to claim 7, characterized in that: The step 5: inputting the training samples into the neural network for training to obtain a water quality monitoring model, including: Step 5.1: Input the training samples into 3D-CNN and 2D-CNN to extract features to form feature images; the feature extraction formula is: Among them, X 3D Represents the features extracted using the 3D-CNN layer, Conv3D 3×3 represents a 3D-CNN layer with a convolution kernel size of 3, X in represents the input training sample, X conv Represents the features extracted using the 2D-CNN layer, Conv2D 1×1 Represents a 2D-CNN layer with a convolution kernel size of 1, Conv2D 3×3 Represents a 2D-CNN layer with a convolution kernel size of 3, Conv2D 5×5 represents a 2D-CNN layer with a convolution kernel size of 5, Indicates the channel splicing operation, represents the element addition operation, X out Represents the output feature image; Step 5.2: Input the feature image into the Transformer network for training to obtain a water quality monitoring model.
9. A water quality monitoring system for water supply network based on neural network, characterized in that: include: Multispectral data acquisition module, used to collect multispectral data of water supply network detection points; The band image screening module is used to calculate the noise level of multispectral data and screen out band images with noise levels within a preset range; A performance index evaluation module is used to evaluate the performance index of the band image and screen out feature expression images whose performance index is within a preset range; A sample calibration module is used to calibrate the water quality index corresponding to each feature expression image to form a training sample; A training module is used to input training samples into a neural network for training to obtain a water quality monitoring model; The water quality monitoring module is used to complete the water quality monitoring of the target water supply network detection point using the water quality monitoring model.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the steps of the water quality monitoring method of a water supply network based on a neural network as described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Multi-spectral image classification method based on threshold self-adaption and convolutional neural network
CN107392130A
Hyperspectral band selection method based on separable convolution and hard threshold function
CN109344698A
Hyperspectral image waveband selection method based on ternary weight convolutional neural network
CN110084311A
Training method of water quality parameter inversion model, and water quality monitoring method and device
CN112378866A
Hyperspectral and multispectral image fusion method based on attention mechanism
CN117474781A