A river network flood real-time prediction method and system based on space-time graph convolution
By constructing a river network flood prediction method based on spatiotemporal graph convolution, the problems of difficult modeling of river network topology and low computational efficiency in existing technologies are solved, achieving efficient and accurate flood forecasting with physical interpretability and adaptive capabilities, meeting the needs of real-time flood forecasting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEBEI UNIV OF ENG
- Filing Date
- 2026-01-19
- Publication Date
- 2026-06-26
AI Technical Summary
Existing flood forecasting methods are difficult to effectively model the irregular spatial topology and hydraulic connections of river networks, and have low computational efficiency and complex parameter calibration, making it difficult to meet the requirements for real-time flood forecasting with high spatiotemporal resolution.
A river network flood prediction method based on spatiotemporal graph convolution is adopted. By constructing an initial river network topology map, hydrological stations are used as nodes and river connections are used as edges. A weighted graph is constructed by combining physical hydrological attribute information. A dynamic graph learning module is introduced to train the spatiotemporal graph convolutional network model. Features are extracted using spatial and temporal convolutional layers, and a physical constraint loss function is added.
It achieves efficient and accurate flood forecasting, possesses physical interpretability and adaptive capabilities, and can complete multi-site forecasts within seconds, meeting the needs of flood control emergency response and improving forecast accuracy and stability.
Smart Images

Figure CN122286609A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of technology, and specifically to a method and system for real-time prediction of river network floods based on spatiotemporal graph convolution. Background Technology
[0002] Flood forecasting is a core non-engineering measure for flood control and disaster reduction, and its accuracy is directly related to the safety of people's lives and property and the scientific scheduling of water conservancy projects. Traditional flood forecasting methods mainly rely on hydrological and hydrodynamic models based on physical mechanisms. These models simulate the movement of water in the river channel by solving partial differential equations such as the Saint-Venant equations, and have a clear physical basis. However, their application faces significant challenges: First, building a distributed physical model requires extremely detailed underlying surface data such as topography, geomorphology, soil, and vegetation, as well as hydraulic parameters such as river cross-section and roughness, which are costly and often incomplete. Second, the model solving process involves complex numerical calculations, resulting in huge computational costs, making it difficult to meet the stringent timeliness requirements of real-time flood forecasting with high spatiotemporal resolution for large-scale watersheds. Finally, the model parameter calibration process is complex, and its generalization ability under different hydrological conditions is limited.
[0003] In recent years, with the accumulation of monitoring data and the improvement of computing power, pure data-driven methods based on deep learning have provided new ideas for flood forecasting. These methods, such as recurrent neural networks (RNNs) and long short-term memory networks (LSTMs), can directly learn the complex mapping relationship between input and output from historical hydrological time-series data, avoiding explicit solutions to physical equations, thus achieving extremely high computational efficiency. However, most existing data-driven methods treat each hydrological station as an independent or simply sequential time series, failing to effectively model the inherent, irregular spatial topology of river networks (such as the confluence of tributaries and the bifurcation of the river system) and the hydraulic connections between stations. This makes it difficult for the model to accurately depict the propagation, superposition, and evolution of flood waves in complex river networks. Furthermore, pure data-driven models are like "black boxes," lacking physical interpretability in their internal logic. They may learn spurious correlations that violate fundamental physical laws such as the conservation of mass, resulting in poor prediction reliability in extreme scenarios not covered by training data, thus limiting their application in critical decision-making.
[0004] Therefore, how to construct an intelligent flood forecasting model that can maintain the efficiency of data-driven methods, embed hydrophysical laws, and effectively utilize river network spatial structure information has become a technical problem that urgently needs to be solved in this field.
[0005] Therefore, the existing technology still needs further development. Summary of the Invention
[0006] The purpose of this invention is to overcome the above-mentioned technical deficiencies and provide a method and system for real-time prediction of river network floods based on spatiotemporal graph convolution, so as to solve the problems existing in the prior art.
[0007] To achieve the above-mentioned technical objectives, according to a first aspect of the present invention, the present invention provides a method for real-time prediction of river network floods based on spatiotemporal graph convolution, comprising: S1. Obtain historical time-series hydrological data of multiple monitoring points in the target river network and construct an initial river network topology map corresponding to the target river network; wherein, the nodes of the initial river network topology map represent the monitoring points, and the edges represent the river channel connection relationships between the nodes; S2. Based on the historical time-series hydrological data and the initial river network topology map, construct and train a spatiotemporal graph convolutional network prediction model; wherein, the spatiotemporal graph convolutional network prediction model is used to learn the spatial dependencies between the nodes and the temporal dependencies of each node itself; S3. Input the real-time collected time-series hydrological data into the trained spatiotemporal graph convolutional network prediction model, and output the flood prediction results for the target river network in the future for a set period.
[0008] Specifically, in step S1, the connection relationship and connection direction between the nodes are determined based on the river structure data of the target river network and the geographical location of the monitoring point, so as to construct the initial river network topology map.
[0009] Specifically, in step S2, the spatial convolutional layer of the spatiotemporal graph convolutional network prediction model is used to extract spatial features based on the initial river network topology map; the graph convolution operation of the spatial convolutional layer takes the initial river network topology map as its input graph structure basis.
[0010] Specifically, in step S2, during the graph convolution operation of the spatial convolution layer, weights are assigned to the edges in the initial river network topology graph, and the weights are determined based on the physical hydrological attribute information of the edges.
[0011] Specifically, the physical hydrological attribute information includes at least one of the following: the river length and slope corresponding to the edge, or the upstream and downstream water volume correlation strength calculated based on the historical time series hydrological data.
[0012] Specifically, in step S2, the spatiotemporal graph convolutional network prediction model further includes a dynamic graph learning module; the dynamic graph learning module is used to dynamically adjust the node connection relationships or connection weights of the graph structure used by the spatial convolutional layer according to the input time-series hydrological data.
[0013] Specifically, the dynamic graph learning module calculates the dynamic adjacency matrix between nodes based on the current input data using a learnable parameterized function or attention mechanism, in order to adjust the graph structure used by the spatial convolutional layer.
[0014] Specifically, in step S2, the temporal convolutional layer of the spatiotemporal graph convolutional network prediction model is used to extract temporal features from the time-series hydrological data of each node; the temporal convolutional layer adopts a one-dimensional convolutional neural network or a temporal convolutional network structure.
[0015] Specifically, in step S2, when training the spatiotemporal graph convolutional network prediction model, the loss function used includes a physical constraint term, which is used to make the model's prediction results conform to the water balance principle.
[0016] According to a second aspect of the present invention, a real-time river network flood prediction system based on spatiotemporal graph convolution is provided, comprising: The data acquisition and processing module is used to acquire historical and real-time time-series hydrological data from multiple monitoring points in the target river network and construct an initial river network topology map corresponding to the target river network. The model building and training module is used to build and train a spatiotemporal graph convolutional network prediction model based on the historical time-series hydrological data and the initial river network topology map. The real-time prediction module is used to input the real-time time-series hydrological data into the trained spatiotemporal graph convolutional network prediction model, and output and display the flood prediction results for the target river network in the future for a set period.
[0017] Beneficial effects: 1. This invention achieves a deep integration of physical mechanisms and data-driven approaches, enhancing the physical plausibility and generalization ability of the model. It creatively abstracts the river network as a graph structure, using hydrological stations as nodes and river connections as edges, enabling deep learning models to explicitly handle irregular spatial topologies for the first time. By constructing a weighted graph that integrates physical hydrological attributes such as river length, slope, and historical correlation strength, and incorporating a simplified water balance equation into the model training as a differentiable loss function, key domain knowledge is successfully injected into the data-driven model in a soft-constraint manner. This ensures that the model not only fits the data during the learning process but also follows fundamental physical laws, thereby significantly improving the physical reliability of the prediction results. Especially when facing scarce training data or extrapolating forecasts of extreme floods, it exhibits superior stability and generalization performance.
[0018] 2. Possessing dynamic perception and adaptive capabilities, this invention significantly improves forecast accuracy under complex hydrological scenarios. The invention introduces a dynamic graph learning module, enabling the model to adaptively adjust the connection weights between nodes in the graph based on the characteristics of real-time input hydrological data. This means the model can dynamically "perceive" changes in the contribution of water from different sources, such as automatically increasing the influence weight of strongly runoff-producing tributaries during heavy rainfall. This mechanism of "physical static skeleton + dynamic data adjustment" allows the model to finely characterize time-varying flow relationships caused by dam scheduling, floodplain diversion, and underlying surface changes, thereby more accurately simulating the dynamic propagation and superposition process of floods in complex river networks, resulting in a substantial improvement in forecast accuracy.
[0019] 3. This invention overcomes the bottlenecks of traditional methods, achieving a balance between high timeliness and high accuracy. It avoids the heavy computational burden of numerically solving complex partial differential equations in traditional hydrodynamic models and also breaks through the limitations of traditional data-driven methods that neglect spatial structure. The Spatiotemporal Graph Convolutional Network (ST-GCN) can jointly extract the spatiotemporal features of flood processes end-to-end and in parallel. Once the model is trained, online prediction takes extremely short time, completing multi-site flood process forecasts for the next few hours to tens of hours within seconds. This fully meets the dual requirements of forecast speed and accuracy in flood control emergency response, saving valuable time for real-time scheduling decisions.
[0020] 4. Enhanced model interpretability and practicality, providing additional hydrological insights. The edge weights and flood propagation time parameters learned by the model have clear hydrophysical meanings. For example, dynamic attention weights can reveal the real-time proportion of different upstream inflows contributing to downstream flood peaks, and the learned propagation time can be used to verify empirical values. This makes the model not only a predictive "black box" but also a tool for analyzing process mechanisms, increasing hydrological experts' trust in the model results, facilitating result verification and operational applications, and promoting the deep integration of artificial intelligence technology in the field of hydrology. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating the real-time flood prediction method for river networks based on spatiotemporal graph convolution provided in a specific embodiment of the present invention. Figure 2 This is a schematic diagram of the system composition of the real-time river network flood prediction system based on spatiotemporal graph convolution provided in a specific embodiment of the present invention. Detailed Implementation
[0022] To enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Based on the embodiments in this application, other similar embodiments obtained by those skilled in the art without creative effort should all fall within the scope of protection of this application. Furthermore, directional terms mentioned in the following embodiments, such as "up," "down," "left," and "right," are only for reference to the directions in the accompanying drawings; therefore, the directional terms used are for illustrative purposes and not for limiting the invention.
[0023] First, it should be noted that the core of the method of this invention lies in constructing a spatiotemporal graph convolutional network (ST-GCN) model that deeply integrates physical knowledge and data-driven approaches to simulate the propagation process of floods in river networks.
[0024] The present invention will be further described below with reference to the accompanying drawings and preferred embodiments.
[0025] Please see Figure 1 This invention provides a real-time flood prediction method for river networks based on spatiotemporal graph convolution, comprising: S1. Obtain historical time-series hydrological data of multiple monitoring points in the target river network and construct an initial river network topology map corresponding to the target river network; wherein, the nodes of the initial river network topology map represent the monitoring points, and the edges represent the river channel connection relationships between the nodes; It should be further explained that step S1 includes two core sub-steps: data preparation and graph construction, specifically including: S1.1 Data Acquisition: Collect hourly water levels from all M hydrological stations and water level stations over the past N years (e.g., 10 years) from the hydrological database or real-time monitoring system of the target river basin. (unit: meters) and flow rate ( The original dataset consists of data (unit: cubic meters per second). Simultaneously, the geographical coordinates (latitude and longitude) of these monitoring points, as well as digitized river network data of the basin (e.g., in Shapefile format), are collected.
[0026] S1.2 Data Preprocessing: 1. Data cleaning: Remove outliers from the raw data (e.g., using the 3-sigma principle to consider data that exceeds three times the standard deviation of the historical average for the same period as outliers) and impute missing values (e.g., using linear interpolation or the ARIMA time series model for imputation). 2. Data Standardization: Each feature (e.g., water level, flow rate) at each monitoring point is standardized to eliminate dimensions and accelerate model training. The standardization formula is: .in, These are the original eigenvalues. It is the standardized value. It is the mean of this feature over all historical time steps. It is the standard deviation of that feature. and Compute and save from the training set for subsequent processing of the validation set, test set, and real-time data; 3. Constructing Training Samples: The sliding time window method is used to construct input-output sample pairs for the model. The length of the historical time window is set. and the predicted future time window length . The preferred duration is 72 hours, because this duration typically covers the main process of a flood spreading from upstream to downstream. The preferred timeframe is 12 hours to meet the timeliness requirements of short-term flood forecasting. For a single sample, the input... It contains time-series data from all M monitoring points and C characteristics (such as water level and flow rate) over the past 72 hours; output This refers to the water level or flow sequence of M' key stations that need to be predicted within the next 12 hours. The standardized historical data is segmented in this way to obtain tens of thousands of sample pairs, which are then divided into training, validation, and test sets in chronological order (e.g., in a 7:2:1 ratio).
[0027] S1.3 Constructing the initial river network topology: This is crucial for embedding prior physical knowledge. Construct a directed unweighted graph. The specific plan is as follows: 1. Node set It contains M nodes, each node Each node corresponds to a monitoring point. The initial characteristics of the node are the standardized time-series data obtained in step S1.2; 2. Edge set Adjacency Matrix : It is A 0-1 matrix. For any two nodes and The connection relationships are determined by analyzing digitized river channel data and monitoring point coordinates. The specific algorithm steps are as follows: ①Use GIS tools to calculate the vertical distance from each monitoring point to the nearest river channel and "capture" it to the nearest river channel; ② Determine the direction of water flow in the basin based on the digital elevation model (DEM) or a known river system map; ③ For any two points and If in the river network, from arrive If there exists a connected path that flows in the direction of the water flow and does not pass through other monitoring points in between, then it is considered that there is a path from... point to Directed edge and order .otherwise, Especially for oneself, (Subsequent spatial convolutions will incorporate self-connections).
[0028] S2. Based on the historical time-series hydrological data and the initial river network topology map, construct and train a spatiotemporal graph convolutional network prediction model; wherein, the spatiotemporal graph convolutional network prediction model is used to learn the spatial dependencies between the nodes and the temporal dependencies of each node itself; It should be further explained that step S2 is the model building and training phase. The overall model architecture mainly consists of an input layer, a spatiotemporal graph convolutional block, and an output layer. In this embodiment, the model consists of three cascaded spatiotemporal graph convolutional blocks (ST-ConvBlocks) and a fully connected output layer. Each ST-ConvBlock performs "temporal convolution, spatial graph convolution, and temporal convolution" operations internally, and uses residual connections. Furthermore, the specific model training scheme is as follows: 1. Optimizer: Using the Adam optimizer, initial learning rate The learning rate decays to 0.95 every 50 training epochs. Adam was chosen because of its adaptive learning rate characteristic; 0.001 is a commonly used initial learning rate in deep learning, and the decay strategy helps with convergence in the later stages of training. 2. Number of training epochs: The maximum number of training epochs is set to 1000, and an early stopping strategy is adopted. When the validation set loss no longer decreases for 20 consecutive epochs, training is stopped, and the model with the lowest validation set loss is restored. 1000 epochs are sufficient for the model to be fully trained, and early stopping prevents overfitting; 3. Loss Function: Total Loss . It is the mean square error between the predicted value and the actual value. It is a loss due to physical constraints. This is the physical constraint weighting coefficient, with a preferred value of 0.2. Choosing 0.2 is to introduce appropriate physical constraints while ensuring data fitting accuracy. After grid search (trying 0.05, 0.1, 0.2, 0.5, 1.0), 0.2 achieved the best overall performance (balance between fitting error and physical error) on the validation set.
[0029] S3. Input the real-time collected time-series hydrological data into the trained spatiotemporal graph convolutional network prediction model, and output the flood prediction results for the target river network in the future for a set period.
[0030] Step S3 is the application prediction phase. In the deployment environment, the system maintains a size of The system provides a real-time data buffer. At each forecast time (e.g., on the hour), the system retrieves the latest hydrological data from each monitoring point from the data interface, and performs the same standardization process as during the training phase (using the data calculated from the training set). and After that, it forms a shape as The input tensor is used as the input. This tensor is fed into the trained model, which then propagates forward and directly outputs the future... The standardized forecast values of all stations requiring forecasting for a given time period are then destandardized. This allows us to obtain actual water level or flow forecast values, and the forecast result curves can be displayed through a visual interface.
[0031] Understandably, this invention constructs an end-to-end, learnable river network flood propagation model. Its greatest advantage lies in its natural encoding of the irregular topology of the river network through a graph structure, enabling the model to explicitly utilize spatial correlation information. The powerful feature extraction capabilities of spatiotemporal graph convolutional networks allow it to automatically learn complex hydrological response relationships from historical data, avoiding the dependence of traditional hydrodynamic models on solving complex physical equations and detailed topographic data. This results in extremely high computational efficiency; a 12-hour multi-site forecast of a watershed can typically be completed within seconds on a GPU, fully meeting the timeliness requirements of real-time forecasting. Furthermore, this method exhibits good scalability; when new monitoring points are added, only the graph structure needs to be updated and the model retrained to incorporate the new information.
[0032] Specifically, in step S1, the connection relationship and connection direction between the nodes are determined based on the river structure data of the target river network and the geographical location of the monitoring point, so as to construct the initial river network topology map.
[0033] It should be further noted that this invention specifies the basis and method for constructing the initial diagram. The initial diagram must accurately reflect the actual water flow convergence and propagation path; this is the cornerstone of the model's physical rationality. The specific implementation steps are as follows: 1. Data Processing: Obtain a vector map layer of the river system in the watershed (e.g., a line shape file) and a monitoring point location layer (a point shape file). Using GIS software, "snap" the monitoring points to the nearest river line to ensure that each point accurately falls on the river channel.
[0034] 2. Constructing topological relationships: ① Direction determination: Based on the water flow direction extracted from the DEM or the clear upstream and downstream relationship in the hydrological data, mark the flow direction (from upstream to downstream) for each river channel segment. ② Connection judgment: Traverse all monitoring point pairs The judgment logic is as follows: First, check from... Starting from the river segment in question, following the direction of flow, is there a connecting waterway that leads to the destination? The river segment in question. This can be implemented in the river network graph using a graph traversal algorithm (such as depth-first search). Secondly, check if this connected path does not pass through any of the following segments. and Any other monitoring point besides [the monitoring point mentioned above]. If both conditions are met, then a path is considered to exist from [the monitoring point mentioned above]. arrive Directed connections in the adjacency matrix Lieutenant General Set to 1. For example, if Located on a tributary, Located in the downstream main stream, and from arrive If there are no other stations on the path, then .like yes If the two points are located upstream of the tributary, or on two unconnected tributaries, then ; 3. Handling Special Cases: For water conservancy projects such as reservoirs and dams, they are considered special nodes. Their connection relationships need to be set according to the project scheduling rules. For example, the upstream node of a reservoir's outflow node is the reservoir's inflow node, and its downstream node is the downstream river channel node. In the absence of real-time scheduling information, it can be simplified to a regular confluence point.
[0035] Understandably, this GIS-based and rule-driven automated mapping method ensures that the initial map structure strictly conforms to the principles of mass and energy conservation in hydrology. Information (simulated water flow) can only flow from upstream nodes to downstream nodes, providing the deep learning model with a strongly physically guided initial information propagation path. This is far more efficient than having the model learn effective paths from fully connected or randomly connected graphs, and fundamentally prevents the model from learning spurious correlations such as "downstream influencing upstream," which defies common sense in physics. This greatly enhances the model's generalization ability and the reliability of the results.
[0036] Specifically, in step S2, the spatial convolutional layer of the spatiotemporal graph convolutional network prediction model is used to extract spatial features based on the initial river network topology map; the graph convolution operation of the spatial convolutional layer takes the initial river network topology map as its input graph structure basis.
[0037] It should be further explained that in this embodiment, the spatial graph convolutional layer adopts a simplified form of Chebyshev graph convolution, namely an approximate first-order local spectral convolution, the mathematical expression of which is: in: It is the first The feature matrix of all nodes in the layer. It is the number of nodes. It is the first The feature dimensions of the layer; It is the adjacency matrix after adding self-connections. This is the initial 0-1 adjacency matrix constructed in this invention. It is an identity matrix. Adding self-joins allows nodes to retain their own characteristics when aggregating neighbor information; yes The degree matrix is a diagonal matrix whose diagonal elements are... , i.e., node The degree (number of neighbors + 1); It is a symmetric normalized Laplacian operator used to normalize the feature aggregation process and prevent numerical instability caused by excessive differences in node degree. It is the first The layer's trainable parameter weight matrix is used to perform linear transformations on the aggregated features; It is an activation function, such as ReLU, i.e. .
[0038] Specific calculation steps: Assume that in a certain spatiotemporal graph convolution block, the feature matrix after temporal convolution is... ,in It is the number of time steps. That is the number of channels. Spatial convolution will occur independently at each time step. The operation is performed on the node features, that is, on (shape is) Applying the graph convolution formula described above, sparse matrix multiplication can be used for efficient computation in implementation. In this embodiment, and It is usually set to 64 or 128 to balance model capacity and computational overhead.
[0039] It is understandable that this spatial convolution operation is the core of this invention for achieving spatial information aggregation. It enables the features of each node (monitoring point) to be analyzed based on the initial river network topology. The defined connections interact with their immediate upstream and downstream nodes (neighbors). Each convolution operation propagates information one hop (i.e., information is obtained from immediate neighbors). By stacking multiple such spatial convolutional layers, information can propagate multiple hops within the river network, allowing predictions for a downstream station to incorporate information from the entire upstream catchment area. This design cleverly uses mathematical operations to simulate the convergence and propagation of floodwaters within the river network, forming the mathematical basis for the physical interpretability of this method.
[0040] Specifically, in step S2, during the graph convolution operation of the spatial convolution layer, weights are assigned to the edges in the initial river network topology graph, and the weights are determined based on the physical hydrological attribute information of the edges.
[0041] It should be further explained that, in order to make the graph structure more accurately reflect the physical transport characteristics of the river channel, we will use the initial 0-1 adjacency matrix... Upgrade to a weighted adjacency matrix The specific implementation steps are as follows: 1. Calculate edge weights: For Each element that is 1 Calculate its corresponding edge weight This embodiment uses a composite weighting calculation method: in, These are weighting coefficients, satisfying... In the absence of prior knowledge, it can be set as The calculation places slight emphasis on the distance factor, as distance is the primary determinant of flood propagation time. The calculations for each component are as follows: ① Distance weight : . From node To the node The river length (non-linear distance) was calculated from GIS. This is a scale parameter, preferably the median of all channel lengths in the river network. Using the median is preferred because it is insensitive to outliers and better represents the characteristics of most river sections. Exponential decay simulates the attenuation of hydrological influences with distance. ②Slope weight : . From node To the node The average slope of the river channel. This represents the maximum slope of all river channels within the watershed. A steeper slope generally corresponds to a faster water flow velocity, thus impacting propagation efficiency; therefore, its weight is directly proportional to the slope. When calculating the slope, the nodal elevation differences are calculated using a DEM with filled depressions, and then divided by the river channel length. ; ③Relevance weight : . The nodes are calculated based on historical daily average flow sequences. With nodes The Pearson correlation coefficient. The closer the value is to 1, the higher the synchronicity of the flow changes between the two stations, and the closer the hydrological connection. We take... This is to eliminate negative correlations (which is usually unreasonable in hydrology, unless it is a special regulation project). 2. Matrix Normalization: After calculating all weights, an asymmetric weight matrix is obtained. (because Not necessarily equal to Then, using Alternative And calculate the normalized Laplacian matrix with self-connections: The degree matrix here according to calculate.
[0042] Understandably, by introducing edge weights based on physical hydrological attributes, we upgrade the static topological connectivity graph into a physically enhanced graph containing rich information such as river channel length, terrain slope, and historical statistical relationships. This makes information aggregation during spatial convolution no longer a simple "average," but a weighted aggregation based on the river's physical characteristics and historical statistical patterns. For example, upstream nodes that are closer, have steeper slopes, and stronger historical correlations have greater "voice" (weight) over downstream nodes. This allows the model to more precisely distinguish the contribution of different upstream water flows when simulating flood wave propagation, thereby significantly improving the accuracy and physical plausibility of spatial feature extraction.
[0043] Specifically, the physical hydrological attribute information includes at least one of the following: the river length and slope corresponding to the edge, or the upstream and downstream water volume correlation strength calculated based on the historical time series hydrological data.
[0044] It should be further explained that this invention specifies the physical hydrological attributes that can be used to calculate edge weights. Here, a better implementation scheme considering time delay is provided for calculating the "strength of upstream and downstream water volume correlation"—the time-delay mutual information method, which is better able to capture nonlinear, time-delayed dependencies than the simple Pearson correlation coefficient.
[0045] Time-delay mutual information calculation steps: For a path from the upstream node to downstream nodes edge : 1. Obtain the standardized traffic time series of both on the training set. and , ; 2. Set a maximum possible flood propagation time. For example, 24 hours might be sufficient for small and medium-sized rivers, while several days might be required for large rivers. A sliding window size can be set. For example, 6 hours; 3. For each time delay (From 0 to (with a step size of 1 hour), calculate the sequence. and Mutual information within the time window The formula for calculating mutual information is: .in, and It is after discretization and Sequence. Discretization can be performed using the equal-frequency binning method, with the preferred number of bins being 10-20; 4. Find the way Maximum time delay ,Right now .this This can be considered as the most likely estimate of the flood propagation time between the two sites; 5. Set the maximum mutual information value As the intensity of the correlation between upstream and downstream water volume The metric. It can be normalized: ,in It can be 0. It is calculated from all edges. The maximum value in.
[0046] Furthermore, select the maximum time delay. Hours and sliding windows The rationale for using a 6-hour window is that 24 hours covers the flood propagation time of most small and medium-sized river basins; a 6-hour window strikes a balance between computational efficiency and capturing the correlation between flood peaks. The time-delay mutual information method can effectively capture nonlinear relationships and estimate... It can be used as the initial value of the time delay parameter in the subsequent physical constraint loss, making the model more hydrophysical.
[0047] Understandably, specifying the "strength of upstream and downstream water volume correlation" as time-delayed mutual information not only quantifies the strength of the correlation but also identifies the most likely time delay for the correlation to occur. This introduces prior knowledge of dynamic time alignment into the model. When constructing the weighted graph, the following is used... It can more accurately characterize complex hydrological response relationships, especially for station pairs with strong nonlinearity and variable response time. Its effect is better than simple linear correlation coefficient, further improving the accuracy of physical knowledge injection.
[0048] Specifically, in step S2, the spatiotemporal graph convolutional network prediction model further includes a dynamic graph learning module; the dynamic graph learning module is used to dynamically adjust the node connection relationships or connection weights of the graph structure used by the spatial convolutional layer according to the input time-series hydrological data.
[0049] It should be further explained that the dynamic graph learning module is one of the key innovations of this invention. Its function is to enable the model to adaptively adjust the interaction strength between nodes according to real-time hydrological conditions. Its implementation is integrated into each spatiotemporal graph convolutional block, located before the spatial convolutional layer. The specific process is as follows: For a node feature tensor input to the current ST-ConvBlock First, the node state vector is compressed along the time dimension using a 1x1 convolution or a global average pooling operation, resulting in a node state vector that incorporates recent temporal information. ,in It is the dimension of the state vector, for example, set to 32.
[0050] Then, the dynamic graph learning module is based on Calculate a dynamic adjacency matrix This embodiment uses an adaptive attention mechanism to calculate... : 1. For each pair of nodes Calculate an attention score : in: It is a node and The state vector; It is a shared, learnable linear transformation weight matrix. The preferred value is 16, used for dimensionality reduction and feature transformation; This represents a vector concatenation operation; It is a learnable attention vector; LeakyReLU is a non-linear activation function with a negative slope parameter set to 0.2, which is a commonly used value in attention networks to alleviate the gradient vanishing problem. 2. To combine physical priors with data-driven dynamics, we only apply the initial static adjacency matrix. The edges that exist in (i.e.) Calculate attention scores for edge pairs. The edges of the pair, It is set to a very large negative number (e.g., -1e9). This ensures that dynamic adjustments only occur on physically permissible river connections and do not create connections out of thin air; 3. Softmax normalize the attention scores to obtain dynamic weight coefficients. : in, Indicated in static diagram Middle node The set of all neighboring nodes (including itself, if self-connections are added). This reflects the neighbors under the current input features. For nodes The importance of; 4. Finally, the dynamic adjacency matrix used for the current spatial convolutional layer. The element is defined as This matrix is asymmetric and row-normalized.
[0051] Furthermore, in practical use, this dynamically calculated... Directly used in graph convolution formulas Or with static weighted matrix Combined in a weighted sum manner: ,in It is the normalized static weighted matrix. It is a learnable scalar parameter, initially set to 0.5.
[0052] Understandably, the dynamic graph learning module endows the model with "contextual awareness." For example, during a flood, when a tributary experiences a surge in flow due to heavy rainfall, the state vector of the corresponding node in that tributary... This will change; through the attention mechanism, the model will automatically increase the weight of the influence of that node on its downstream nodes. (Increases). However, during the dry season, the influence weight of the tributary decreases. This simulates the dynamic changes in the contribution of different water sources to the downstream in reality, enabling the model to more accurately and adaptively characterize complex hydrological processes and significantly improve forecast accuracy, especially in watersheds with strong changes in underlying surface conditions or human activities.
[0053] Specifically, the dynamic graph learning module calculates the dynamic adjacency matrix between nodes based on the current input data using a learnable parameterized function or attention mechanism, in order to adjust the graph structure used by the spatial convolutional layer.
[0054] It should be further noted that this invention further defines the implementation mechanism of the dynamic graph learning module. Besides the aforementioned attention mechanism, another robust and efficient implementation method is a parameterized function based on node state similarity. The specific steps are as follows: 1. Node state mapping: As before, obtain the node state matrix from the input features. ; 2. Similarity Calculation: Cosine similarity between node states is calculated after a learnable transformation, serving as the basis for dynamic connection strength. First, two different learnable weight matrices are used... State of each node Mapped to query vector and key vector : ; 3. Calculate the dynamic adjacency matrix: Elements of the dynamic adjacency matrix The calculation is as follows: in: Calculate the dot product similarity between the query vector and the key vector; It is a scaling factor, preferably This is used to stabilize gradients, a common technique in Transformer models; The summation of the denominator and the summation of the denominator achieves softmax normalization, ensuring that each node is normalized across all its physical neighbors ( The sum of the weights of ) is 1; It is an indicator function if and only if there exists a function in the static graph from arrive The value is 1 when the edge is active, and 0 otherwise. This again forces dynamic adjustments to be performed within the physical connectivity framework.
[0055] 4. Fusion with Static Graphs: We employ a gating fusion mechanism to combine dynamic graphs with weighted static physical graphs: in: It is a node The mean of the state vectors of the neighboring nodes; These are learnable parameters. It's a splicing operation.
[0056] It is a node Unique gated scalar. A value close to 1 indicates the current time, and the node... It relies more on data-driven learned dynamic relationships; a value close to 0 indicates a greater reliance on prior static physical relationships. The value is determined by the current state of the node itself and its neighbors.
[0057] Furthermore, this gating fusion mechanism is a preferred implementation method for dynamic graph learning. These parameters are learned during model training along with all other parameters via gradient descent. (Gate value) The dynamic changes enable the model to intelligently balance "following physical laws" and "adapting to real-time changes", thus enhancing the model's adaptability and robustness.
[0058] Understandably, the dynamic graph learning mechanism based on similarity calculation and gating fusion provides a stable and expressive parameterization method. It organically unifies the determinism of physical priors (static graph) with the flexibility of data-driven (dynamic adjustment). The gating mechanism allows the model to learn, under different hydrological scenarios, the extent to which it trusts physical priors and the extent to which it relies on relationships inferred from real-time data. This is more flexible and intelligent than fixed weighted combinations, and is one of the core technical features of this invention for achieving high-precision dynamic simulation, significantly improving the model's performance boundaries.
[0059] Specifically, in step S2, the temporal convolutional layer of the spatiotemporal graph convolutional network prediction model is used to extract temporal features from the time-series hydrological data of each node; the temporal convolutional layer adopts a one-dimensional convolutional neural network or a temporal convolutional network structure.
[0060] It should be further noted that this embodiment preferably uses a temporal convolutional network as the temporal convolutional layer because it has advantages such as parallel computation, stable gradients, and strong long-range dependency modeling capabilities. Specific implementation details are as follows: In each ST-ConvBlock, the temporal convolutional layer employs causal dilation one-dimensional convolution. Its mathematical expression is: for the input sequence... (Where B is the batch size,) This is the number of input channels. (This is the sequence length). After passing through a dilated causal convolutional layer, the output is... Each element is calculated as follows: in: These are the convolution kernel weights. This refers to the kernel size, which is preferably 3 in this embodiment. Choosing 3 is to capture local (e.g., adjacent 3-hour timeframes) temporal patterns while maintaining the model's lightweight nature. It is the inflation factor. In a stacked multilayer TCN, the first... Layer expansion factor Typically set to For example, the first TCN layer The second layer The third layer And so on. This exponential growth allows higher-level neurons to possess very large receptive fields, for example, when... When stacked with 4 layers, the receptive field of the neurons in the top layer is... This is sufficient to cover a relatively long historical sequence; It is a bias term; Furthermore, pay attention to the index. The sequence must be non-negative, which is achieved through "causal padding," that is, padding the left side of the sequence with zeros. At each position, ensure that the output length matches the input length, and at each time... The output depends only on And previous inputs.
[0061] Furthermore, the network structure is as follows: A complete temporal convolutional layer typically consists of two dilated causal convolutional sublayers, interspersed with nonlinear activation and regularization: TCN_Block(X): 1. Conv1D_1: Dilated Causal Convolution, Convolution Kernel Inflation factor The number of input and output channels is set according to the number of layers. The number of input and output channels is usually kept constant (e.g., 64). 2. WeightNorm: Weight normalization accelerates training and improves stability; 3. ReLU: Activation function; 4. Dropout: Dropout layer, with a dropout rate preferably of 0.1, used to prevent overfitting; 5. Conv1D_2: Same as above; 6. WeightNorm; 7. ReLU; 8. Dropout; 9. ResidualConnection: If the input and output dimensions are the same, the original input will be... The results are added to the above processing results to form a residual connection. If the dimensions are inconsistent, a 1x1 convolution is used to adjust the input dimensions before adding them together.
[0062] Understandably, in this embodiment, the number of ST-ConvBlocks is set to 3. Within each Block, the number of channels (i.e., feature dimensions) of the TCN are [64, 64, 64]. The kernel size of the TCN... The inflation factor sequence is [1, 2, 4]. The dropout rate is set to 0.1. These parameters were chosen based on extensive ablation experiments, achieving a good balance between model complexity, training efficiency, and prediction accuracy.
[0063] Understandably, TCN, through dilated convolutions and residual connections, can efficiently capture temporal dependency patterns ranging from hourly to dayly scales, which is crucial for simulating flood processes with different propagation times. Its parallel computation characteristics (compared to the sequential computation of RNNs) enable faster training. Combined with spatial graph convolutions, the model can simultaneously uncover the two core questions of flood forecasting: "how it propagates spatially" and "how it evolves temporally," forming a powerful spatiotemporal feature extractor.
[0064] Specifically, in step S2, when training the spatiotemporal graph convolutional network prediction model, the loss function used includes a physical constraint term, which is used to make the model's prediction results conform to the water balance principle.
[0065] It should be further explained that the physical constraint loss This is crucial to ensuring that the model output conforms to hydrophysical laws. This embodiment designs a constraint term based on a simplified flow continuity equation. The specific calculation steps are as follows: Consider a confluence node in a river network ,exist During the period ( Consistent with the model's output time step (e.g., 1 hour), its water balance equation can be simplified to: In this study, evaporation and infiltration are ignored, and it is assumed that changes in river storage capacity are mainly caused by the difference in flow between upstream and downstream. To construct a differentiable loss function, we further simplify the study and focus on the relationship between upstream inflow and downstream outflow: Define physical constraint loss The sum of squares of the differences between the predicted flow and the estimated flow from the upstream inflow at all prediction time steps for all confluence nodes: in: It is the set of all confluence nodes in the river network, that is, nodes with at least two upstream neighbors. It is the number of merge nodes; It is a model for nodes In the future Traffic forecast at each time point (standardized value); It is a node In the initial river network topology map The set of all directly upstream neighbor nodes; From the upstream node to downstream nodes The flood propagation time (in model time steps). This is a learnable positive real parameter for each directed edge. One During model initialization, the time-delay mutual information method can be used to estimate... If no estimated value is available, it can be initialized to a small positive number (such as 1). Indicates upstream node exist Predicted flow at any given time. Because It might not be an integer, so linear interpolation is needed here: Let , ,but This ensures that the loss function is accurate with respect to... and They are all differentiable.
[0066] The total loss function is: .
[0067] in: It is the Huber loss between predicted and observed values, which is more robust to outliers than MSE. The formula is: ,in It's an error. It is a threshold value, preferably 1.0.
[0068] It is an L2 regularization term used to prevent overfitting, and the weights... The preferred value is 0.001.
[0069] This is the weight of the physical constraint loss, with a preferred value of 0.2, as mentioned above.
[0070] Furthermore, during training, the model not only learns the network weights It also learns the propagation time parameters of all edges. This is equivalent to allowing the model to automatically correct and calibrate the propagation time of each river segment from the data, so that the learned dynamic process conforms to the data and satisfies the soft constraints of water balance.
[0071] Understandably, introducing physical constraint loss is a crucial step in this invention's transition from a "pure black box model" to a "physically interpretable AI model." It incorporates the core hydrological principle—mass conservation—into the training objective of the deep neural network through a differentiable physical consistency term, using it as a soft constraint. This not only mathematically guides the model parameters towards physically reasonable optimization, improving the model's generalization ability, especially its reliability in extrapolation (such as predicting larger floods), but also enhances the learned propagation time parameters. It inherently possesses clear hydrophysical significance and can be used as part of the model output to assist hydrologists in understanding and validating the model. This hybrid modeling paradigm, which is primarily data-driven and supplemented by physical constraints, greatly enhances the scientific rigor and practicality of the model.
[0072] Please see Figure 2 The present invention provides another embodiment, which provides a real-time river network flood prediction system based on spatiotemporal graph convolution. The real-time river network flood prediction system based on spatiotemporal graph convolution includes: The data acquisition and processing module 100 is used to acquire historical and real-time time-series hydrological data from multiple monitoring points in the target river network and construct an initial river network topology map corresponding to the target river network. The model building and training module 200 is used to build and train a spatiotemporal graph convolutional network prediction model based on the historical time-series hydrological data and the initial river network topology map. The real-time prediction module 300 is used to input the real-time time-series hydrological data into the trained spatiotemporal graph convolutional network prediction model, and output and display the flood prediction results for the target river network in the future for a set period of time.
[0073] It should be further noted that this system is a software and / or hardware implementation of the above methods, deployed on a server or cloud platform. The specific functions and interactions of each module are as follows: (1) Data acquisition and processing module 100: 1. Data Interface Unit: This unit acquires real-time water level, flow rate, and rainfall data from various monitoring points periodically (e.g., every 5 minutes) via standard APIs (such as Web Service, RESTful API) or database connections (such as ODBC, JDBC). Simultaneously, it retrieves static river vector data and monitoring point coordinate data from file servers or spatial databases.
[0074] 2. Data Preprocessing Engine: ① Real-time stream processing: Real-time data is cleaned (by removing jump points), formatted, and stored in a real-time data buffer. This buffer is a sliding window that always keeps the data up-to-date. Hourly data.
[0075] ② Historical data batch processing: During the model training phase, the engine reads long-term historical data and executes the data cleaning, standardization, and sample construction processes described in S1.2 to generate training and testing datasets.
[0076] ③ Topology Builder: Calls a GIS engine (such as the GDAL library or ArcGIS Engine) or its built-in map building algorithm to automatically generate and store an initial river network topology map based on river data and station coordinates. The physical properties of its edges (length, slope, initial propagation time, etc.) are also considered. This process is typically performed once during system initialization.
[0077] (2) Model building and training module 200: 1. Model Configuration Unit: Provides a graphical or configuration file interface, allowing users to set model hyperparameters such as the number of ST-ConvBlock layers, the number of channels and inflation factor of TCN, learning rate, and loss function weights. It also supports loading predefined configuration files.
[0078] 2. Model training engine: Implemented based on deep learning frameworks (such as PyTorch, TensorFlow). Its workflow is as follows: ① Load the preprocessed training and validation datasets.
[0079] ② Based on the configuration, instantiate the spatiotemporal graph convolutional network prediction model defined in this invention. Initialize the model parameters and the learnable propagation time parameters. .
[0080] ③ Enter the training loop. In each epoch, iterate through the training data and calculate the total loss. Perform backpropagation and gradient descent (such as the Adam optimizer) to update all learnable parameters.
[0081] ④ Periodically evaluate model performance on the validation set and save the model parameters that minimize the validation set loss.
[0082] ⑤ After the early stopping condition is triggered, training ends, and the optimal model parameters are serialized and saved to the model file.
[0083] (3) Real-time prediction module 300: 1. Prediction Service Engine: This is a persistent, memory-resident service (such as a web service based on Flask or Fast APIs). The engine is triggered when a preset prediction time (e.g., the hour) is reached. ① Read the latest data from the real-time data buffer Hourly data.
[0084] ② Call the same standardized processor as in the training phase, and use the data saved during the training phase. and Standardize real-time data.
[0085] ③ Load the optimal model parameter file saved by the model building and training module, and organize the standardized data into a model input tensor.
[0086] ④ Perform forward inference calculations on the model to obtain the future. Standardized forecast results for each hour.
[0087] ⑤ Perform destandardization on the prediction results to obtain the predicted values of the true dimensions (such as m, m³ / s).
[0088] 2. Results Dissemination Unit: This unit writes the forecast results into the forecast results database and disseminates them through various methods: ① API Interface: Provided in JSON format for other business systems (such as flood control command system) to call.
[0089] ② Visualization interface: On the WebGIS platform, the future water level / flow process lines of each station are displayed in the form of time series curves, isosurfaces, and warning lights, and stations exceeding the warning level are highlighted.
[0090] ③ Warning generation: The forecast results are compared with preset warning water levels, guaranteed water levels and other thresholds to automatically generate warning information of different levels, and send them to relevant personnel via SMS, application push and other means.
[0091] Furthermore, the entire system can be deployed in a containerized manner, achieving loose coupling and high availability between modules. Understandably, this system has engineered and productized the advanced ST-GCN prediction algorithm, achieving full automation from data access and model training to real-time forecasting and result dissemination. Its modular design facilitates maintenance and upgrades; for example, it can seamlessly replace more advanced graph neural network models. The system can operate 24 / 7, providing fast, accurate, and physically sound flood forecast products, significantly improving the intelligence level and response speed of flood control decision-making.
[0092] In a preferred embodiment, this application also provides an electronic device, the electronic device comprising: The computer device includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, implement the described real-time river network flood prediction method based on spatiotemporal graph convolution. The computer device can be broadly categorized as a server, terminal, or any other electronic device with the necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, memory, network interface, communication interface, etc., connected via a system bus. The processor of the computer device can be used to provide the necessary computing, processing, and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and internal memory. The non-volatile storage medium may store an operating system, computer programs, etc. The internal memory can provide an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface and communication interface of the computer device can be used to connect and communicate with external devices via a network. When the computer program is executed by the processor, it performs the steps of the method of the present invention.
[0093] This invention can be implemented as a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the steps of the methods of embodiments of the invention to be performed. In one embodiment, the computer program is distributed across multiple network-coupled computer devices or processors, such that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be executed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be executed by one or more computer devices or processors, and one or more other method steps / operations may be executed by one or more other computer devices or processors. One or more computer devices or processors may execute a single method step / operation, or execute two or more method steps / operations.
[0094] Those skilled in the art will understand that the method steps of this invention can be performed by a computer program instructing related hardware, such as a computer device or processor, to perform the steps of this invention when executed. Depending on the context, any references herein to memory, storage, databases, or other media may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0095] The technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification, provided that such combination does not contain contradictions.
[0096] The specific embodiments of the present invention described above do not constitute a limitation on the scope of protection of the present invention. Any other corresponding changes and modifications made in accordance with the technical concept of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for real-time prediction of river network floods based on spatiotemporal graph convolution, characterized in that, Includes the following steps: S1. Obtain historical time-series hydrological data of multiple monitoring points in the target river network and construct an initial river network topology map corresponding to the target river network; wherein, the nodes of the initial river network topology map represent the monitoring points, and the edges represent the river channel connection relationships between the nodes; S2. Based on the historical time-series hydrological data and the initial river network topology map, construct and train a spatiotemporal graph convolutional network prediction model; wherein, the spatiotemporal graph convolutional network prediction model is used to learn the spatial dependencies between the nodes and the temporal dependencies of each node itself; S3. Input the real-time collected time-series hydrological data into the trained spatiotemporal graph convolutional network prediction model, and output the flood prediction results for the target river network in the future for a set period.
2. The method according to claim 1, characterized in that, In step S1, the connection relationships and connection directions between the nodes are determined based on the river structure data of the target river network and the geographical location of the monitoring points, so as to construct the initial river network topology map.
3. The method according to claim 2, characterized in that, In step S2, the spatial convolutional layer of the spatiotemporal graph convolutional network prediction model is used to extract spatial features based on the initial river network topology map; the graph convolution operation of the spatial convolutional layer takes the initial river network topology map as its input graph structure basis.
4. The method according to claim 3, characterized in that, In step S2, during the graph convolution operation of the spatial convolution layer, weights are assigned to the edges in the initial river network topology graph, and the weights are determined based on the physical hydrological attribute information of the edges.
5. The method according to claim 4, characterized in that, The physical hydrological attribute information includes at least one of the following: the river length and slope corresponding to the edge, or the correlation strength between upstream and downstream water volume calculated based on the historical time-series hydrological data.
6. The method according to claim 3, characterized in that, In step S2, the spatiotemporal graph convolutional network prediction model further includes a dynamic graph learning module; the dynamic graph learning module is used to dynamically adjust the node connection relationships or connection weights of the graph structure used by the spatial convolutional layer according to the input time-series hydrological data.
7. The method according to claim 6, characterized in that, The dynamic graph learning module calculates the dynamic adjacency matrix between nodes based on the current input data using learnable parameterized functions or attention mechanisms, in order to adjust the graph structure used by the spatial convolutional layer.
8. The method according to claim 3, characterized in that, In step S2, the temporal convolutional layer of the spatiotemporal graph convolutional network prediction model is used to extract temporal features from the time-series hydrological data of each node; the temporal convolutional layer adopts a one-dimensional convolutional neural network or a temporal convolutional network structure.
9. The method according to any one of claims 1-8, characterized in that, In step S2, when training the spatiotemporal graph convolutional network prediction model, the loss function used includes a physical constraint term, which is used to make the model's prediction results conform to the water balance principle.
10. A real-time river network flood prediction system based on spatiotemporal graph convolution, characterized in that, The system for implementing the method as described in any one of claims 1-9 comprises: The data acquisition and processing module is used to acquire historical and real-time time-series hydrological data from multiple monitoring points in the target river network and construct an initial river network topology map corresponding to the target river network. The model building and training module is used to build and train a spatiotemporal graph convolutional network prediction model based on the historical time-series hydrological data and the initial river network topology map. The real-time prediction module is used to input the real-time time-series hydrological data into the trained spatiotemporal graph convolutional network prediction model, and output and display the flood prediction results for the target river network in the future for a set period of time.