River basin water quality prediction and early warning method and device based on multi-model processing technology and medium

By adopting multi-model treatment technology in river basin water quality prediction, combined with deep learning and mechanism models, the problem of poor water quality prediction in the existing technology is solved, and more accurate and reliable water quality prediction is achieved.

CN119477644AActive Publication Date: 2025-02-18重庆市生态环境大数据应用中心

Patent Information

Application Number
CN202411610439.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-18
Estimated Expiration
2044-11-12

AI Technical Summary

Technical Problem

In the prior art, the prediction effect of river basin water quality prediction methods is poor, and it is difficult to effectively predict river water quality under the influence of multiple factors.

Method used

The water quality prediction and early warning method of river basin based on multi-model processing technology includes obtaining water environment monitoring data in river basin for pre-processing, building a deep learning model for water quality prediction and a water quality index prediction mechanism model, combining the advantages of deep learning and mechanism models, Multi-model fusion prediction.

Benefits of technology

It effectively improves the accuracy and reliability of river basin water quality prediction, can better identify influencing factors and water quality characteristic distribution, such as pollution key source areas, and solves the problem of poor water quality prediction results in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477644A_ABST
    Figure CN119477644A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of water quality prediction, and particularly relates to a river basin water quality prediction and early warning method and device based on a multi-model processing technology and a medium, and the method comprises the steps: firstly obtaining and preprocessing historical water environment monitoring data and real-time water environment monitoring data of a river basin; then constructing a water quality prediction deep learning model, and outputting a river basin water quality prediction result after training verification; constructing a water quality index prediction mechanism model, and after training verification, outputting water quality index prediction results of the river basin according to water quality prediction results; and finally, performing threshold judgment based on the river basin water quality prediction result and the dynamic change result of each water quality index of the river basin, and calling an expert emergency early warning plan according to the judgment result. According to the invention, the problem of poor prediction effect in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of water quality prediction, and in particular relates to a river basin water quality prediction and early warning method, equipment and medium based on a multi-model processing technology. Background Art

[0002] With the development of society, surface river prediction and early warning in urban development areas play an important role in the water quality management of river basins. The important factors affecting the water quality prediction of surface river basins include natural factors and human factors. For example, natural factors include meteorological data, geographical data, etc., and human factors include industrial pollution emissions, livestock and poultry breeding pollution emissions, etc. Therefore, the water quality of river basins involves many aspects, and reliable water quality prediction methods are particularly important for predicting water quality change trends.

[0003] The water quality prediction method in the prior art is relatively simple. It directly predicts by acquiring river data and then importing it into the prediction model. The prediction results of this type of model are difficult to effectively predict the river water quality under the influence of multiple factors. Summary of the invention

[0004] The technical problem solved by the present invention is to provide a river basin water quality prediction and early warning method, equipment and medium based on multi-model processing technology to solve the problem of poor prediction effect existing in the prior art.

[0005] The basic solution provided by the present invention: a river basin water quality prediction and early warning method based on multi-model processing technology, comprising:

[0006] S1: Acquire water environment monitoring data from surface water quality monitoring stations in a river basin and perform preprocessing; the water environment monitoring data includes historical water environment monitoring data and real-time water environment monitoring data;

[0007] S2: Build a deep learning model for water quality prediction based on a deep learning network, use pre-processed historical water environment monitoring data for water quality prediction analysis training, and use pre-processed real-time water environment monitoring data to output river basin water quality prediction results;

[0008] S3: Construct a water quality index prediction mechanism model, train the water quality index prediction mechanism model based on the pre-processed historical water environment monitoring data, verify the water quality index prediction mechanism model based on the pre-processed real-time water environment monitoring data, input the river basin water quality prediction results into the water quality index prediction mechanism model, and output the prediction results of various water quality indicators in the river basin;

[0009] S4: Make threshold judgments based on the water quality prediction results of the river basin and the dynamic changes of various water quality indicators in the river basin, and call up expert emergency warning plans based on the judgment results.

[0010] Further, the S1 includes:

[0011] S1-1: Divide the target river basin area into a grid, and obtain water environment monitoring data of the monitoring stations in the target river basin; the water environment monitoring data includes historical water environment monitoring data and real-time water environment monitoring data; the historical water environment monitoring data and real-time water environment monitoring data both include monitoring station monitoring data and meteorological data;

[0012] S1-2: Preprocessing the water environment monitoring data includes missing value processing, data cleaning, normalization, filling of null value processing, spatialization processing and time series matching processing.

[0013] Further, the S2 includes:

[0014] S2-1: Construct a deep learning model for water quality prediction based on deep learning network;

[0015] S2-2: Preset a water quality prediction task, build a sliding window according to the monitoring site value of the preset water quality prediction task, and fill the monitoring data and meteorological data of the monitoring site of the acquired historical water environment monitoring data into the sliding window;

[0016] S2-3: Generate data samples for the sliding window with a step size of 1, and divide them into training set, evaluation set and test set in chronological order with a preset ratio;

[0017] S2-4: Use the training set to train the model parameters of the water quality prediction deep learning model, use the evaluation set to optimize the hyperparameters of the water quality prediction deep learning model, use the test machine to verify the performance of the water quality prediction deep learning model, and output the trained water quality prediction deep learning model;

[0018] S2-5: Use the pre-processed real-time water environment monitoring data to input into the trained water quality prediction deep learning model, and output the river basin water quality prediction results;

[0019] S2-6: Encapsulate the deep learning model for water quality prediction.

[0020] Furthermore, the water quality prediction deep learning model is a fusion of a water quality prediction deep learning model based on a spatiotemporal graph convolutional network, a water quality prediction deep learning model based on a multi-layer attention mechanism network, and a water quality prediction deep learning model based on a long short-term memory network;

[0021] The water quality prediction deep learning model based on spatiotemporal graph convolutional network is used to construct an undirected graph of water quality monitoring network, and predict the water quality of different monitoring sections in the future region from the temporal and spatial information in the water environment monitoring data;

[0022] The water quality prediction deep learning model based on the multi-layer attention mechanism network is based on the Encoder-Decoder structure and introduces a multi-layer attention mechanism to predict water quality parameters in water environment monitoring data;

[0023] The water quality prediction deep learning model based on the long short-term memory network is based on the LSTM water quality prediction AI model architecture to realize water quality parameter prediction for water environment monitoring data.

[0024] Further, the S3 includes:

[0025] S3-1: Construct spatial database and attribute database based on the acquired water environment monitoring data, and perform ArcGIS data processing;

[0026] S3-2: Construct a water quality index prediction mechanism model that integrates the water quality model and the hydrodynamic model, and perform training and verification based on data processed by ArcGIS data;

[0027] S3-3: Analyze the spatiotemporal distribution characteristics of water quality in the water quality prediction results of the river basin based on the integrated water quality index prediction mechanism model after training, and output the prediction results of various water quality indicators in the river basin;

[0028] S3-4: Encapsulate and invert the water quality prediction mechanism model to generate a dynamic water quality rendering map.

[0029] Further, the S4 includes:

[0030] S4-1: Regularly read the online water environment monitoring data of the river basin monitoring station to build a water quality evaluation optimization model; the water quality evaluation optimization model has preset warning level and warning limit data;

[0031] S4-2: Input the most recent water environment monitoring data read into the water quality evaluation optimization model, and output the current water quality evaluation data;

[0032] S4-3: Input the read water environment monitoring data into the encapsulated water quality prediction deep learning model and water quality prediction mechanism model, output the water quality deep learning prediction results and water quality mechanism prediction results respectively, and input them into the water quality evaluation optimization model, output the water quality deep learning prediction evaluation data and water quality mechanism prediction evaluation data;

[0033] S4-4: Compare the water quality deep learning prediction and evaluation data and the water quality mechanism prediction and evaluation data with the current water quality evaluation data, and use the model whose evaluation data error meets the preset standard in the comparison result as the water quality prediction model for the current preset period;

[0034] S4-5: Compare the water quality prediction result of the selected water quality prediction model with the preset warning level and warning limit data to generate a water quality warning result, perform a warning classification operation based on the water quality warning result, and output the warning classification result;

[0035] S4-6: Extract the corresponding expert emergency plan based on the warning classification results and transmit it to the corresponding river basin management office.

[0036] The river basin water quality prediction and early warning device based on the multi-model processing technology is applied to the river basin water quality prediction and early warning method based on the multi-model processing technology, including:

[0037] Data acquisition module: used to acquire water environment monitoring data from surface water quality monitoring stations in river basins, the water environment monitoring data including historical water environment monitoring data and real-time water environment monitoring data;

[0038] Data preprocessing module: used to preprocess the acquired water environment monitoring data;

[0039] Water quality prediction module: Build a deep learning model for water quality prediction based on a deep learning network, use pre-processed historical water environment monitoring data for water quality prediction analysis training, and use pre-processed real-time water environment monitoring data to output river basin water quality prediction results;

[0040] Water quality index prediction module: construct a water quality index prediction mechanism model, train the water quality index prediction mechanism model based on pre-processed historical water environment monitoring data, verify the water quality index prediction mechanism model based on pre-processed real-time water environment monitoring data, input the river basin water quality prediction results into the water quality index prediction mechanism model, and output the prediction results of various water quality indicators in the river basin;

[0041] Early warning module: Make threshold judgments based on river basin water quality prediction results and dynamic changes in various water quality indicators in the river basin, and retrieve expert emergency early warning plans based on the judgment results.

[0042] An electronic device includes a processor and a memory, wherein the memory stores programs or instructions, and the processor executes the river basin water quality prediction and early warning method based on multi-model processing technology as described above by calling the programs or instructions stored in the memory.

[0043] A computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute the river basin water quality prediction and early warning method based on the multi-model processing technology as described above.

[0044] The principles and advantages of the present invention are as follows: In the technical solution of the present application, the prior art uses a single prediction model to predict the water quality of a river basin, which has the problem of poor prediction effect. The present application adopts a multi-model fusion technology. First, after processing the acquired water environment monitoring data, a deep learning network is used to construct a water quality prediction deep learning model. The model is based on the automatic feature learning of the deep learning network, and can well predict the water quality of the river basin. On this basis, a water quality index prediction mechanism model is constructed by integrating the basin distributed water environment model, the hydrological water quality model and the hydrodynamic model. It can not only identify the factors affecting the water quality of the river basin, but also identify the distribution of related characteristics in the water quality, such as the key source area of ​​pollution.

[0045] Therefore, the solution of the present application effectively solves the problem that the water quality prediction model in the prior art has poor prediction results for water quality in complex river basin conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 is a flowchart of an embodiment of the present invention;

[0047] Figure 2 This is an architecture diagram of a water quality prediction deep learning model based on a spatiotemporal graph convolutional network according to an embodiment of the present invention;

[0048] Figure 3 is an undirected graph in an embodiment of the present invention;

[0049] Figure 4 Schematic diagram of the spatiotemporal dependence of different monitoring sections in the monitoring data in an embodiment of the present invention;

[0050] Figure 5 It is a structural diagram of a water quality prediction deep learning model based on a multi-layer attention mechanism network in an embodiment of the present invention;

[0051] Figure 6 It is a structural diagram of a water quality prediction deep learning model based on a long short-term memory network in an embodiment of the present invention;

[0052] Figure 7 Schematic diagram of the prediction results of ammonia nitrogen monitoring values ​​of each model in the embodiment of the present invention;

[0053] Figure 8 Schematic diagram of the prediction results of the total phosphorus monitoring value of each model in the embodiment of the present invention;

[0054] Fig. 9 Schematic diagram of prediction results of dissolved oxygen monitoring values ​​of various models in the embodiments of the present invention;

[0055] Fig.10 A comparison diagram of the calculated COD value and the measured COD value of the Lianghekou (R0) section illustrated in an embodiment of the present invention;

[0056] Fig.11 A comparison diagram of the COD calculated value and the measured value of the new bridge (R2) section in an example of the present invention;

[0057] Fig.12 It is a comparison chart of the COD calculated value and the measured value of the Liaojia Oil Mill (R12) section illustrated in the embodiment of the present invention;

[0058] Fig.13 Schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0059] The following is further described in detail through specific implementation methods:

[0060] The symbols in the drawings of the specification include: electronic device 400 , processor 401 , memory 402 , input device 403 , and output device 404 .

[0061] The embodiment is basically as shown in the attached Figure 1 Shown: A river basin water quality prediction and early warning method based on multi-model processing technology, including:

[0062] S1: Acquire water environment monitoring data from surface water quality monitoring stations in the river basin and perform preprocessing; the water environment monitoring data includes historical water environment monitoring data and real-time water environment monitoring data; wherein S1 includes:

[0063] S1-1: Divide the area of ​​the target river basin into a grid and obtain water environment monitoring data from monitoring stations in the target river basin;

[0064] S1-2: Preprocess water environment monitoring data.

[0065] In this embodiment, the water environment monitoring data includes monitoring data and meteorological data obtained from monitoring sites, and the monitoring data obtained from the monitoring sites include geographical data, hydrological data, pollution source data, river terrain data, and socio-economic data, etc. In meteorological data, meteorological factors have a considerable impact on the generation and spread of water pollution. Therefore, the water environment monitoring data in this application takes meteorological data into account, and after subsequent analysis, the complex influence relationship of meteorological factors on the water quality of the river basin can be obtained; in this embodiment, the meteorological factors in the meteorological data, that is, meteorological indicators, include temperature, air pressure, humidity and rainfall, etc., and this application is meteorological The effective value range is set for the monitoring data obtained by monitoring indicators and monitoring sites, that is, meteorological data and monitoring data that are not within the effective value range are regarded as outliers and are regarded as missing values ​​in the subsequent processing flow, and need to be preprocessed. Therefore, the preprocessing of this application includes missing value processing and normalization. Specifically, many problems that arise in actual data collection will lead to missing and abnormal data. Among them, abnormal data can be regarded as missing values ​​after being judged in the effective range. Linear interpolation is used to fill missing values ​​during implementation. The linear interpolation method assumes that a continuous sequence containing missing values ​​satisfies a linear change relationship, and a linear function is used to fit the data changes.

[0066] In other embodiments of this embodiment, preprocessing measures also include data cleaning, filling null value processing, spatial processing and time series matching processing, so as to ensure the temporal, spatial and logical consistency of water environment monitoring data obtained from different sources.

[0067] S2: Build a deep learning model for water quality prediction based on a deep learning network, use pre-processed historical water environment monitoring data for water quality prediction analysis training, and use pre-processed real-time water environment monitoring data to output river basin water quality prediction results; S2 includes:

[0068] S2-1: Construct a deep learning model for water quality prediction based on deep learning network;

[0069] S2-2: Preset a water quality prediction task, build a sliding window according to the monitoring site value of the preset water quality prediction task, and fill the monitoring data and meteorological data of the monitoring site of the acquired historical water environment monitoring data into the sliding window;

[0070] S2-3: Generate data samples for the sliding window with a step size of 1, and divide them into training set, evaluation set and test set in chronological order with a preset ratio;

[0071] S2-4: Use the training set to train the model parameters of the water quality prediction deep learning model, use the evaluation set to optimize the hyperparameters of the water quality prediction deep learning model, use the test machine to verify the performance of the water quality prediction deep learning model, and output the trained water quality prediction deep learning model;

[0072] S2-5: Use the pre-processed real-time water environment monitoring data to input into the trained water quality prediction deep learning model, and output the river basin water quality prediction results;

[0073] S2-6: Encapsulate the deep learning model for water quality prediction.

[0074] In this embodiment, the water quality prediction deep learning model is constructed using a deep learning network, which is obtained through in-depth consideration based on comparative analysis of the existing model principles. Specifically, this application considers a large number of models, such as a method based on a mechanism model and a method based on machine learning. Among them, the method based on the mechanism model is based on a professional model in the field, simulating the entire process from discharge to diffusion of water pollutants, thereby predicting the future water quality of each monitoring station. This method has very high requirements on the integrity of pollution source data, and the model parameters need to be adjusted and adapted by professionals according to different water scenes, and the generalization ability is poor;

[0075] The method based on machine learning is a data-driven method that predicts various indicators of monitoring sites in the future by mining the implicit complex dependencies of historical data. The method based on machine learning can automatically learn the complex mapping relationship from multi-source data input to actual results. This type of method can be further subdivided into time series analysis models, general regression models and deep learning models. The time series analysis model predicts future trends by discovering linear laws in historical sequences, but cannot accept feature inputs other than sequence data. The general regression model can support multi-source data input, such as linear regression models, support vector machines, random forests, etc. The disadvantage of this type of method is that in order to achieve a considerable prediction accuracy, complex feature engineering is required, which increases the difficulty of model application.

[0076] The deep learning model fits the nonlinear complex mapping from input to output by stacking multiple layers of neural networks, which can realize automated feature learning and solve the feature selection problem of traditional regression models.

[0077] The deep learning model for water quality prediction based on deep learning network constructed in the present application is a fusion of a deep learning model for water quality prediction based on spatiotemporal graph convolutional network, a deep learning model for water quality prediction based on multi-layer attention mechanism network and a deep learning model for water quality prediction based on long short-term memory network. The fusion of the water quality prediction model based on spatiotemporal graph convolutional network and the deep learning model based on multi-layer attention mechanism network can obtain the complex spatial dependency of the monitoring data of the monitoring sites, while the fusion of the water quality prediction model based on spatiotemporal graph convolutional network and the deep learning model based on long short-term memory network can characterize the complex temporal dependency of the monitoring data.

[0078] For the water quality prediction model based on spatiotemporal graph convolutional network, although the traditional deep learning method has been applied to extract the features of Euclidean space data with great success, the water environment monitoring data is generated from non-Euclidean space, and the performance of traditional deep learning methods in processing non-Euclidean space data is difficult to satisfy people. In this context, in view of the extremely high complexity and nonlinear characteristics of water quality data, this application takes into account the spatial and temporal dependencies between water quality monitoring sections, and proposes a water quality prediction model based on spatiotemporal graph convolutional network to solve the problem of water quality prediction. Specifically:

[0079] The temporal and spatial information contained in the data is used to predict the water quality indicators of different monitoring sections in the future. The water quality monitoring network is defined as an undirected graph, and the spatiotemporal dependency of water quality monitoring sections is modeled using spatiotemporal convolution blocks, which can effectively capture spatiotemporal correlation.

[0080] In the spatial dimension, the graph convolution formula after Chebyshev approximation and first-order approximation is used to capture spatial correlation. In the convolution process, not only the state of neighboring nodes but also the state of the node itself is considered. In the time dimension, gated convolution is used to capture time dependency. Different from the traditional convolution method, the model considers the problem of time series and uses causal convolution to perform parallel calculations on data, which makes the model training faster. The above graph convolution and gated convolution are combined into Figure 2 The structure shown uses a bottleneck strategy to achieve scale compression and feature compression, and a normalization layer is connected after each layer to prevent overfitting. The final model is a stack of two St-Conv Blocks followed by an output layer, in which the output layer first uses a time dimension convolution to merge the time dimension of the previous output data, and then outputs the final predicted data after a convolution. The predicted data is a picture of the next time dimension.

[0081] Undirected graphs such as Figure 3 As shown in the figure, the undirected graph G = (V, E, A), each point on G detects water quality at the same frequency F, and the water quality prediction problem is defined as: given all historical variable values ​​of all nodes on the spatiotemporal graph G in the past period of time, predict the water quality parameters of all nodes in the future period of time.

[0082] The water quality prediction deep learning model based on deep learning network also adopts a water quality prediction deep learning model based on multi-layer attention mechanism network, specifically:

[0083] The deep learning model for water quality prediction based on a multi-layer attention mechanism network is based on an encoder-decoder structure. It introduces a multi-layer attention mechanism to the spatiotemporal prediction of water quality parameters, models the dynamic spatiotemporal correlation between sensors, and improves the performance of the model by fusing external factors such as rainfall data corresponding to the sensors in the decoder stage. The challenges of spatiotemporal prediction of water quality parameters are mainly reflected in the following two aspects: (1) dynamic spatiotemporal correlation; (2) external factors.

[0084] The dynamic spatiotemporal correlation is reflected in the following two aspects.

[0085] 1. Complex spatial correlations between different sensor devices, such as Figure 4 As shown, the spatial correlation between sensors is highly dynamic over time, and the geographical locations are nonlinearly related;

[0086] 2. Dynamic correlation within the same sensor. Water quality time series data often follows a periodic pattern, but sometimes (such as sudden extreme weather) the sensor data will fluctuate greatly, so how to select the appropriate time interval is also a challenge.

[0087] As for external factors, the sensor data will be affected by the surrounding environment and the time (whether it is the emission peak period or not).

[0088] Therefore, the water quality prediction deep learning model based on the multi-layer attention mechanism network in this embodiment consists of the following two main parts. The model structure is as follows: Figure 5 As shown:

[0089] 1. Multi-layer attention mechanism: The multi-layer attention mechanism mainly consists of an encoder containing two spatial attention mechanisms (local spatial attention and global spatial attention) and a decoder containing temporal attention. In the encoder, two different spatial attention mechanisms are proposed to capture the complex spatial relationship between sensors using the implicit state of the encoder at the previous moment, the time series value of the sensor observation at the previous moment, and the spatial context (such as sensor network information). In the decoder, a temporal attention mechanism is used to adaptively select relevant time slices in the past for prediction.

[0090] Second, external factor fusion, this module is designed in this embodiment to handle the impact of external factors on the time series of geographic sensors, including meteorological data, time-related features, geographic-related features, etc. In other words, this module integrates these external factors, and then uses the output of this module as part of the input of the decoder mentioned above into the calculation of the network.

[0091] The water quality prediction deep learning model based on the long short-term memory network is specifically a water quality prediction AI model architecture based on the long short-term memory network model (LSTM). The long short-term memory network model (LSTM) is a deep learning model used to process sequence data with time dependencies, such as natural language. It is a network composed of multiple memory units, each of which has three gates (input gate, output gate, and forget gate) that can control the information stored and transmitted in the memory unit. The LSTM network uses these gates to balance short-term memory and long-term memory, thereby retaining long-term dependencies in sequence data while still effectively processing complex sequence data.

[0092] Each time step of the LSTM network contains multiple gates, including input gate, output gate and forget gate. In the input gate, the LSTM network selects important information from the input sequence and outputs it to the next time step. In the output gate, the LSTM network will select the information to be passed to the next time step and output it to the output part of the sequence. In the forget gate, the LSTM network controls which information is saved in the memory cell and which information should be forgotten. The LSTM network stores and operates sequence data through memory cells. The memory cell is controlled by three gates, which can store important information in the input sequence in its local state and pass it to the next time step when needed. In each time step, the memory cell will update its state to better reflect the important information in the input sequence.

[0093] The model structure and main parameters are as follows: Figure 6 As shown in the figure, the first layer is an LSTM training model with 300 neurons. According to the above principle, the model learns based on past fitting results and uses the memory characteristics of LSTM to optimize the water quality prediction ability. The purpose of the second layer is to prevent overfitting and allow all neurons to learn better. It is then connected to the third layer to fully connect the neurons in the previous layer, and finally output after the activation function in the fourth layer.

[0094] The training process of the fusion model of this application is to first obtain the water environment monitoring data and preprocess it, then set the hyperparameters of the model, for example: the batch size is set to 64, the output dimension of GCN is 16, the hidden state length of LSTM is 32, and the number of GCN layers is 1. The Adam optimizer is used to optimize the model parameters, the learning rate is set to 0.002, and the training epoch is set to 150; in order to reduce randomness, the model will be trained independently for 5 times, and the average of the 5 experimental results is taken as the final result in the experimental part;

[0095] Preset water quality prediction tasks, for example, the prediction task is defined as using the historical water environment monitoring data and meteorological data of all stations with 18 values ​​(Tin=18, sampling period is 4h) to predict the water quality of the next 18 values ​​(Tout=18, sampling period is 4h). The water quality parameters and meteorological data with a length of 18 in a sample are used as model input, and the water quality indicators with a length of 18 are used as the true value of surface water quality. Use a sliding window with a window size of 36 and a step size of 1 to generate data samples, and divide them into training set, evaluation set and test set in chronological order with a ratio of 7:1:2;

[0096] The model parameters are optimized with samples from the training set, and the hyperparameters are optimized with the running results on the evaluation set. The performance of the model is verified on the test set. The performance evaluation indicators include mean absolute error (MAE) and mean relative error (MRE), which are calculated as follows:

[0097]

[0098] Among them, Y i and Respectively represent the true value and predicted value of the i-th sample, N represents the number of samples, MAE directly calculates the absolute value between the true value and the predicted value, and MRE divides the true value on the basis of MAE to get the relative error rate. The result is more intuitive, but it is not suitable for data indicators with a value range near 0 (the relative error will be very large).

[0099] In order to verify the performance advantage of the fusion model in this embodiment, the fusion model of the present application is compared with the existing model based on the machine learning method. The baseline model used for comparison is as follows:

[0100] 1. Support Vector Regression (SVR). This method is a regression version of the traditional support vector machine (SVM). The goal is to find the optimal hyperplane in the feature space so that all data samples in the feature space are closest to the plane. The original version of SVR only supports single variable output. As an experimental comparison baseline, this paper establishes an SVR model for each indicator and prediction step.

[0101] 2. Autoregressive Integrated Moving Average (ARIMA) model: This method converts the time series into a stationary time series and regresses the dependent variable to its lagged value and random error term. It is one of the most common models in time series linear analysis.

[0102] 3. Long Short-Term Memory Network (LSTM). LSTM maintains memory during sequence modeling and has a more complex gate structure than RNN and GRU. It sets the forget gate and input gate to control the retention and update of long-term memory, and sets the output gate to obtain the output result at each moment. LSTM alleviates the gradient vanishing problem in the RNN model and is the most commonly used neural network for modeling time series in deep learning.

[0103] In order to evaluate the performance of each model in short-term and long-term prediction tasks, the errors of the models at different prediction steps are listed; Figure 7 , Figure 8 and Fig. 9 The figure shows the prediction results of the proposed model and the comparison model on the three indicators of ammonia nitrogen, total phosphorus and dissolved oxygen mass concentration. In the figure, L is the prediction step length. It can be seen that compared with other baseline models, the fusion model of this application has obvious performance advantages.

[0104] Therefore, this application proposes a new deep learning model for water quality prediction, which uses graph neural networks and multi-layer attention mechanisms to model the complex spatial dependencies of surface water quality monitoring sites. Long short-term memory networks are used to model the complex temporal dependencies of historical indicator sequences, and multi-step prediction outputs of water quality indicators for all surface water quality sites are achieved. Experimental results show that compared with traditional regression methods, the use of this model can significantly improve the prediction performance, and compared with time series analysis methods, general regression methods and general deep learning methods, this model can achieve performance improvement.

[0105] S3: Construct a water quality index prediction mechanism model, train the water quality index prediction mechanism model based on the pre-processed historical water environment monitoring data, verify the water quality index prediction mechanism model based on the pre-processed real-time water environment monitoring data, input the river basin water quality prediction results into the water quality index prediction mechanism model, and output the prediction results of various water quality indicators in the river basin; S3 includes:

[0106] S3-1: Construct spatial database and attribute database based on the acquired water environment monitoring data, and perform ArcGIS data processing;

[0107] S3-2: Construct a water quality index prediction mechanism model that integrates the water quality model and the hydrodynamic model, and perform training and verification based on data processed by ArcGIS data;

[0108] S3-3: Analyze the spatiotemporal distribution characteristics of water quality in the water quality prediction results of the river basin based on the integrated water quality index prediction mechanism model after training, and output the prediction results of various water quality indicators in the river basin;

[0109] S3-4: Encapsulate and invert the water quality prediction mechanism model to generate a dynamic water quality rendering map.

[0110] In this embodiment, for the acquired water environment monitoring data, in addition to the above-mentioned missing value processing and normalization processing, a spatial database and an attribute database are also constructed based on the acquired water environment monitoring data. The spatial database includes digital elevation maps, land use maps, soil type maps, watershed system maps, administrative division maps, etc., and the attribute database includes water quality databases, meteorological databases, soil databases, socio-economic databases, etc.

[0111] The data stored in the above database is then processed by ArcGIS data, which includes information layer preparation, vector-to-raster conversion, spatial interpolation processing, water system map generation, sub-basin generation and spatial overlay processing; the data processed by ArcGIS data is transmitted to the water quality index prediction mechanism model that is a fusion of the constructed water quality model and the hydrodynamic model. The construction of the fused water quality index prediction mechanism model in this embodiment is specifically as follows:

[0112] Step 1: Construct the control equations of the water quality index prediction mechanism model, including the two-dimensional diving control equation and the material transport equation, specifically:

[0113] The vector form of the planar two-dimensional diving control equation is:

[0114]

[0115]

[0116] Where t represents time; x and y represent horizontal coordinates; U is the vector of conserved variables; F and G are the vectors of flux variables; F d and G d is the diffusion flux vector; S is the vector of the source term, h is the water depth, u and v are the flow velocities in the x and y directions respectively, η is the water level, τ bx and τ by are the bottom friction terms in the x and y directions, v t is the diffusion coefficient of the transported substance.

[0117] Material transport equation:

[0118]

[0119] C represents the material transport variable; v t is the diffusion coefficient of the transported substance, v t =αu * h,α takes values ​​between 0.3 and 1.0. S C is the source term of the transport variable.

[0120] Step 2: Discrete processing of water flow control equations, specifically:

[0121] Based on the unstructured grid, the finite volume method is used to solve the mathematical model of water flow. The formula (1) of the two-dimensional diving control equation is integrated on any triangular control volume to obtain:

[0122]

[0123] Let U i is the average value of the cell, stored at the center of the cell,

[0124] Applying Green's formula to the material transport equation, the area is decomposed into line integrals along its perimeter to obtain:

[0125]

[0126] Where L i is the perimeter of the ith control unit V, n=(n x ,n y )=(cosφ,sinφ) is the outer normal unit vector on the perimeter, φ is the angle between the outer normal vector and the positive direction of the x-axis, A i is the area of ​​calculation unit i.

[0127] The line integral of the formula obtained by integrating the two-dimensional diving control equation on any triangular control volume is discretized and sorted out to obtain:

[0128]

[0129] Where: m is the number of control volume edges. Since this paper uses a triangular control volume, m = 3; l ij is the length of each side of the unit; Represents the normal numerical flux through the jth edge of the i-th unit.

[0130] Step 3: Discretization of the transport equation, specifically:

[0131] The material transport equation is also discretized in the triangular control volume by finite volume. The integral of equation (3) on element i is:

[0132]

[0133] Green's formula is used to differentiate the area into line integrals along its perimeter, and the line integral part is discretized and sorted out to obtain:

[0134]

[0135] Q ij is the flow through the jth edge of unit i; is the gradient of the transport variable in the direction of the outer normal of the jth edge of unit i, where:

[0136]

[0137] N1 and N2 are the two vertices of the jth edge of unit i. ij is the transport variable value of the j-th edge of unit i, calculated by upwind reconstruction interpolation:

[0138] Assume that the adjacent cells of cell i on side j are m ij , and the water flows from unit i to unit m ij , then the transport variable C at edge j ij It is obtained by interpolating the transport variables at the centers of two adjacent cells:

[0139]

[0140] Φ (r) is a function of the change gradient r of the transport variable. In order to reduce numerical dissipation and improve calculation accuracy, this paper uses the van Leer function to restrict the change gradient function:

[0141] Φ (r) =max[0,(r+|r| / (1+r))]

[0142]

[0143] s i is the edge where the flow in unit i flows out of the unit; is the value of the transport variable at the center of the unit grid adjacent to edge k.

[0144] After the water quality prediction mechanism model is constructed, the initial conditions, boundary conditions and model parameters of the model are set according to the actual river conditions. For example, this embodiment takes the Binan River as an example, where the initial conditions are: the initial water level and initial flow rate of the model are both set to 0;

[0145] The boundary conditions are as follows: three boundaries are divided, including two flow boundaries (the two estuaries of Banzhuershe in the main channel of Meijiang River and the two estuaries of Binan River) and one water level boundary (the two estuaries of Binan River);

[0146] The model parameters are as follows: the riverbed roughness of the Binan River Basin ranges from 0.016 to 0.035. On this basis, the roughness of the riverbed in the Binan River Basin during the dry season is determined to be between 0.016 and 0.044 through calculation and debugging. In terms of the selection of the comprehensive attenuation coefficient of pollutants, on this basis, the attenuation coefficients of COD, ammonia nitrogen, and total phosphorus in the Binan River Basin are determined to be 0.20 / d, 0.15 / d, and 0.1 / d.

[0147] After the model is set up and trained, the simulation effect of the model is verified using real-time water environment monitoring data, taking the COD water quality indicator as an example:

[0148] The comparison results of COD calculation and measured values ​​at Lianghekou (R0), Xindaqiao (R2), and Liaojiayoufang (R12) sections are as follows: Fig.10 , Fig.11 and Fig.12 The comparison results show that the calculated COD values ​​of each section are consistent with the measured values, with relative errors of -6.18%, 8.71%, and 1.67%, respectively.

[0149] In addition, deep learning models and mechanism models are encapsulated, including model algorithm encapsulation and data encapsulation involved in the calculation, and model calculation services are released to realize online calling of model services and real-time storage of prediction results.

[0150] Inversion and rendering are to display the model's prediction results on a digital map of the river basin in a visual interface to improve the intuitive feedback of the prediction results.

[0151] In summary, the water quality index prediction mechanism model that integrates the hydrodynamic and water quality models established in this application reproduces the river flow and material transport process well. The simulation results are in good agreement with the measured values, and the deviations are controlled within a reasonable range. It can be used for subsequent water environment simulation analysis.

[0152] S4: Based on the water quality prediction results of the river basin and the dynamic changes of various water quality indicators in the river basin, threshold judgment is made, and expert emergency warning plans are retrieved according to the judgment results. Among them, S4 includes:

[0153] S4-1: Regularly read the online water environment monitoring data of the river basin monitoring station to build a water quality evaluation optimization model; the water quality evaluation optimization model has preset warning level and warning limit data;

[0154] S4-2: Input the most recent water environment monitoring data read into the water quality evaluation optimization model, and output the current water quality evaluation data;

[0155] S4-3: Input the read water environment monitoring data into the encapsulated water quality prediction deep learning model and water quality prediction mechanism model, output the water quality deep learning prediction results and water quality mechanism prediction results respectively, and input them into the water quality evaluation optimization model, output the water quality deep learning prediction evaluation data and water quality mechanism prediction evaluation data;

[0156] S4-4: Compare the water quality deep learning prediction and evaluation data and the water quality mechanism prediction and evaluation data with the current water quality evaluation data, and use the model whose evaluation data error meets the preset standard in the comparison result as the water quality prediction model for the current preset period;

[0157] S4-5: Compare the water quality prediction result of the selected water quality prediction model with the preset warning level and warning limit data to generate a water quality warning result, perform a warning classification operation based on the water quality warning result, and output the warning classification result;

[0158] S4-6: Extract the corresponding expert emergency plan based on the warning classification results and transmit it to the corresponding river basin management office.

[0159] In this embodiment, for the constructed water quality prediction deep learning model and water quality index prediction mechanism model, the dimension of the water quality results predicted by the water quality prediction deep learning model belongs to the monitoring section site on the target river basin, while the water quality index prediction mechanism model is aimed at the water quality index results of several grids divided on each section. For example, 2000 grids are divided to obtain the water quality index results on each grid. Therefore, it is not difficult to see that the resources and computing power required for the operation of the water quality prediction deep learning model are less than the resources and computing power required for the operation of the water quality index prediction mechanism model. In different monitoring environments, according to the results desired by the user, it is necessary to intelligently call the corresponding model for processing. Therefore, through the water quality evaluation optimization model, the evaluation data comparison results of the two fusion models within a period of time are compared, and the preset error is set according to the user's needs. After comparison, the corresponding fusion model that is less than the preset error and closest to the preset error can be used as the model called for subsequent monitoring for a period of time. In this way, it not only meets the actual needs of the user, but also reduces the resource pressure and computing power of the system.

[0160] In another embodiment of the present embodiment, a river basin water quality prediction and early warning device based on a multi-model processing technology is also included, which is applied to the above-mentioned river basin water quality prediction and early warning method based on a multi-model processing technology, including:

[0161] Data acquisition module: used to acquire water environment monitoring data from surface water quality monitoring stations in river basins, the water environment monitoring data including historical water environment monitoring data and real-time water environment monitoring data;

[0162] Data preprocessing module: used to preprocess the acquired water environment monitoring data;

[0163] Water quality prediction module: Build a deep learning model for water quality prediction based on a deep learning network, use pre-processed historical water environment monitoring data for water quality prediction analysis training, and use pre-processed real-time water environment monitoring data to output river basin water quality prediction results;

[0164] Water quality index prediction module: construct a water quality index prediction mechanism model, train the water quality index prediction mechanism model based on pre-processed historical water environment monitoring data, verify the water quality index prediction mechanism model based on pre-processed real-time water environment monitoring data, input the river basin water quality prediction results into the water quality index prediction mechanism model, and output the prediction results of various water quality indicators in the river basin;

[0165] Early warning module: Make threshold judgments based on river basin water quality prediction results and dynamic changes in various water quality indicators in the river basin, and retrieve expert emergency early warning plans based on the judgment results.

[0166] Also included is an electronic device such as Fig.13 As shown, the electronic device 400 includes one or more processors 401 and a memory 402 .

[0167] The processor 401 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.

[0168] The memory 402 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may run the program instructions to implement the river basin water quality prediction and early warning method based on multi-model processing technology of any embodiment of the present invention described above and / or other desired functions. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.

[0169] In one example, the electronic device 400 may further include: an input device 403 and an output device 404, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 403 may include, for example, a keyboard, a mouse, etc. The output device 404 may output various information to the outside, including early warning information, braking force, etc. The output device 404 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0170] Of course, to simplify, Fig.13Only some of the components related to the present invention in the electronic device 400 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 400 may also include any other appropriate components.

[0171] In addition to the above-mentioned methods and devices, an embodiment of the present invention may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the river basin water quality prediction and early warning method based on multi-model processing technology provided in any embodiment of the present invention.

[0172] The computer program product may be written in any combination of one or more programming languages ​​to write program code for performing the operations of the embodiments of the present invention, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0173] In addition, an embodiment of the present invention may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the river basin water quality prediction and early warning method based on multi-model processing technology provided in any embodiment of the present invention.

[0174] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0175] The above are only embodiments of the present invention. Common knowledge such as the known specific structures and characteristics in the scheme is not described in detail here. Ordinary technicians in the relevant field are aware of all the common technical knowledge in the technical field to which the invention belongs before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply conventional experimental means before that date. Ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the scope of protection of the present invention, and these will not affect the effect of the implementation of the present invention and the practicality of the patent. The scope of protection required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.

Claims

1. A river basin water quality prediction and early warning method based on multi-model processing technology, characterized by: include: S1: Acquire water environment monitoring data from surface water quality monitoring stations in a river basin and perform preprocessing; the water environment monitoring data includes historical water environment monitoring data and real-time water environment monitoring data; S2: Build a deep learning model for water quality prediction based on a deep learning network, use pre-processed historical water environment monitoring data for water quality prediction analysis training, and use pre-processed real-time water environment monitoring data to output river basin water quality prediction results; S3: Construct a water quality index prediction mechanism model, train the water quality index prediction mechanism model based on the pre-processed historical water environment monitoring data, verify the water quality index prediction mechanism model based on the pre-processed real-time water environment monitoring data, input the river basin water quality prediction results into the water quality index prediction mechanism model, and output the prediction results of various water quality indicators in the river basin; S4: Make threshold judgments based on the water quality prediction results of the river basin and the dynamic changes of various water quality indicators in the river basin, and call up expert emergency warning plans based on the judgment results.

2. The method for predicting and warning river basin water quality based on multi-model processing technology according to claim 1 is characterized in that: The S1 includes: S1-1: Divide the target river basin area into a grid, and obtain water environment monitoring data of the monitoring stations in the target river basin; the water environment monitoring data includes historical water environment monitoring data and real-time water environment monitoring data; the historical water environment monitoring data and real-time water environment monitoring data both include monitoring station monitoring data and meteorological data; S1-2: Preprocessing the water environment monitoring data includes missing value processing, data cleaning, normalization, filling of null value processing, spatialization processing and time series matching processing.

3. The method for predicting and warning river basin water quality based on multi-model processing technology according to claim 2 is characterized in that: The S2 includes: S2-1: Construct a deep learning model for water quality prediction based on deep learning network; S2-2: Preset a water quality prediction task, build a sliding window according to the monitoring site value of the preset water quality prediction task, and fill the monitoring data and meteorological data of the monitoring site of the acquired historical water environment monitoring data into the sliding window; S2-3: Generate data samples for the sliding window with a step size of 1, and divide them into training set, evaluation set and test set in chronological order with a preset ratio; S2-4: Use the training set to train the model parameters of the water quality prediction deep learning model, use the evaluation set to optimize the hyperparameters of the water quality prediction deep learning model, use the test machine to verify the performance of the water quality prediction deep learning model, and output the trained water quality prediction deep learning model; S2-5: Use the pre-processed real-time water environment monitoring data to input into the trained water quality prediction deep learning model, and output the river basin water quality prediction results; S2-6: Encapsulate the deep learning model for water quality prediction.

4. The method for predicting and warning river water quality based on multi-model processing technology according to claim 3 is characterized in that: The water quality prediction deep learning model is a fusion of a water quality prediction deep learning model based on a spatiotemporal graph convolutional network, a water quality prediction deep learning model based on a multi-layer attention mechanism network, and a water quality prediction deep learning model based on a long short-term memory network; The water quality prediction deep learning model based on spatiotemporal graph convolutional network is used to construct an undirected graph of water quality monitoring network, and predict the water quality of different monitoring sections in the future region from the temporal and spatial information in the water environment monitoring data; The water quality prediction deep learning model based on the multi-layer attention mechanism network is based on the Encoder-Decoder structure and introduces a multi-layer attention mechanism to predict water quality parameters in water environment monitoring data; The water quality prediction deep learning model based on the long short-term memory network is based on the LSTM water quality prediction AI model architecture to realize water quality parameter prediction for water environment monitoring data.

5. The method for predicting and warning river water quality based on multi-model processing technology according to claim 4 is characterized in that: The S3 includes: S3-1: Construct spatial database and attribute database based on the acquired water environment monitoring data, and perform ArcGIS data processing; S3-2: Construct a water quality index prediction mechanism model that integrates the water quality model and the hydrodynamic model, and perform training and verification based on data processed by ArcGIS data; S3-3: Analyze the spatiotemporal distribution characteristics of water quality in the water quality prediction results of the river basin based on the integrated water quality index prediction mechanism model after training, and output the prediction results of various water quality indicators in the river basin; S3-4: Encapsulate and invert the water quality prediction mechanism model to generate a dynamic water quality rendering map.

6. The method for predicting and warning river water quality based on multi-model processing technology according to claim 5 is characterized in that: The S4 includes: S4-1: Regularly read the online water environment monitoring data of the river basin monitoring station to build a water quality evaluation optimization model; the water quality evaluation optimization model has preset warning level and warning limit data; S4-2: Input the most recent water environment monitoring data read into the water quality evaluation optimization model, and output the current water quality evaluation data; S4-3: Input the read water environment monitoring data into the encapsulated water quality prediction deep learning model and water quality prediction mechanism model, output the water quality deep learning prediction results and water quality mechanism prediction results respectively, and input them into the water quality evaluation optimization model, output the water quality deep learning prediction evaluation data and water quality mechanism prediction evaluation data; S4-4: Compare the water quality deep learning prediction and evaluation data and the water quality mechanism prediction and evaluation data with the current water quality evaluation data, and use the model whose evaluation data error meets the preset standard in the comparison result as the water quality prediction model for the current preset period; S4-5: Compare the water quality prediction result of the selected water quality prediction model with the preset warning level and warning limit data to generate a water quality warning result, perform a warning classification operation based on the water quality warning result, and output the warning classification result; S4-6: Extract the corresponding expert emergency plan based on the warning classification results and transmit it to the corresponding river basin management office.

7. A river basin water quality prediction and early warning device based on multi-model processing technology, applied to a river basin water quality prediction and early warning method based on multi-model processing technology as described in any one of claims 1 to 6 above, characterized in that: include: Data acquisition module: used to acquire water environment monitoring data from surface water quality monitoring stations in river basins, the water environment monitoring data including historical water environment monitoring data and real-time water environment monitoring data; Data preprocessing module: used to preprocess the acquired water environment monitoring data; Water quality prediction module: Build a deep learning model for water quality prediction based on a deep learning network, use pre-processed historical water environment monitoring data for water quality prediction analysis training, and use pre-processed real-time water environment monitoring data to output river basin water quality prediction results; Water quality index prediction module: construct a water quality index prediction mechanism model, train the water quality index prediction mechanism model based on pre-processed historical water environment monitoring data, verify the water quality index prediction mechanism model based on pre-processed real-time water environment monitoring data, input the river basin water quality prediction results into the water quality index prediction mechanism model, and output the prediction results of various water quality indicators in the river basin; Early warning module: Make threshold judgments based on river basin water quality prediction results and dynamic changes in various water quality indicators in the river basin, and retrieve expert emergency early warning plans based on the judgment results.

8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores programs or instructions, and the processor executes the river basin water quality prediction and early warning method based on multi-model processing technology as described in any one of claims 1-6 by calling the programs or instructions stored in the memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores programs or instructions, and the programs or instructions enable the computer to execute the river basin water quality prediction and early warning method based on multi-model processing technology as described in any one of claims 1-6 above.

Citation Information

Patent Citations

  • Water quality prediction method and device and server

    CN112529296A

  • Water quality prediction method, system and device based on deep learning

    CN116364203A

  • Lake and river water quality parameter prediction method based on time convolutional neural network

    CN117275600A

Cited By

  • Artificial intelligence river water quality pollutant spatial form monitoring system and method

    CN119809144A

  • River abnormity early warning method and system based on deep learning image processing

    CN119888376A

  • A River Abnormality Early Warning Method and System Based on Deep Learning Image Processing

    CN119888376B

  • Reservoir water quality model prediction method and system based on big data

    CN120338172A

  • River water quality prediction method and system based on big data

    CN121279555A