Flood forecasting method based on LSTM neural network

By using an LSTM model with multi-source data fusion and spatiotemporal attention mechanism, combined with data fitting and physical constraint loss, the problems of single data utilization, physical inconsistency and spatiotemporal dependence in existing flood forecasting methods are solved. This achieves high-precision and interpretable probabilistic flood forecasting, improving the reliability and efficiency of flood control decision-making.

CN121857097APending Publication Date: 2026-04-14常山县水文站 +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-03
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing LSTM-based flood forecasting methods suffer from problems such as limited data utilization, physical inconsistencies, and coarse spatiotemporal dependency modeling, and do not consider the impact of rainfall input uncertainty on forecast results.

Method used

By adopting a multi-source data fusion architecture, introducing a spatiotemporal attention mechanism and a hybrid loss function, a multivariate LSTM model with a spatiotemporal attention mechanism is constructed. The model is trained by spatiotemporal alignment and probabilistic input sample sets, and probabilistic flood forecasting is achieved by combining data fitting and physical constraint loss.

Benefits of technology

It significantly improves the accuracy, physical plausibility, and interpretability of flood forecasts, provides rich risk information, enhances the transparency and credibility of models, and achieves full automation from data access to early warning issuance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121857097A_ABST
    Figure CN121857097A_ABST
Patent Text Reader

Abstract

The invention discloses a flood forecasting method based on an LSTM neural network, and relates to the technical field of hydrological forecasting. Comprising the following steps: collecting multi-source time sequence hydrological historical data of a target drainage basin, and carrying out space-time alignment to form historical multivariable space-time data blocks; constructing a plurality of future rainfall scene sequences, and respectively splicing the future rainfall scene sequences with the historical multivariable spatio-temporal data blocks to form a probabilistic input sample set; constructing a multivariable LSTM model fused with a space-time attention mechanism; constructing a mixed loss function containing data fitting loss and physical constraint loss; training and verifying the multivariable LSTM model fused with the space-time attention mechanism; and deploying the trained multivariable LSTM model fused with the space-time attention mechanism, and carrying out probabilistic flood forecasting. By introducing the space-time attention mechanism, the multi-source data fusion architecture and the mixed loss function, the flood forecasting precision, physical rationality and interpretability are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hydrological forecasting technology, and in particular to a flood forecasting method based on LSTM neural networks. Background Technology

[0002] Flood forecasting is a key non-engineering measure for flood prevention and disaster reduction. Traditional hydrological models rely on complex physical equations and a large number of empirical parameters, making calibration difficult and limiting their applicability in watersheds with scarce data.

[0003] In recent years, deep learning models, represented by LSTM, have shown great potential in hydrological forecasting due to their powerful time-series modeling capabilities. However, existing LSTM-based flood forecasting methods still have the following shortcomings: The data utilization is singular: most of them only use the historical flow series of the watershed outlet section, ignoring key information from multiple sources such as precipitation spatial distribution, soil moisture antecedent conditions, and evaporation, resulting in insufficient characterization of complex precipitation-runoff processes; Physical inconsistencies: Purely data-driven black-box models may produce prediction results that violate physical laws (such as mass non-conservation, abnormal receding curves, etc.), affecting the reliability and acceptability of the forecast results; Spatiotemporal dependency modeling is crude: Traditional LSTM treats all input features and time steps equally, making it difficult to adaptively focus on the "heavy rainfall period" and "key meteorological / hydrological station" that are most critical to the forecast target; Uncertainty in rainfall input during the forecast period: Existing methods usually use deterministic rainfall products from numerical weather prediction directly, without considering the impact of their forecast uncertainty on flood forecast results.

[0004] Therefore, proposing a flood forecasting method based on LSTM neural networks to overcome the difficulties of existing technologies is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, the present invention provides a flood forecasting method based on LSTM neural network, which significantly improves the accuracy, physical rationality and interpretability of flood forecasting by introducing a spatiotemporal attention mechanism, a multi-source data fusion architecture and a hybrid loss function.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: A flood forecasting method based on LSTM neural networks includes: S1. Collect multi-source time-series hydrological historical data of the target watershed, and align all collected data in time and space to form historical multivariate time-space data blocks. S2. For the forecast lead time, multiple future rainfall scenario sequences are constructed using ensemble numerical weather prediction products. These sequences are then concatenated with historical multivariate spatiotemporal data blocks to obtain multiple extended "historical-future" input sample sequences, forming a probabilistic input sample set. The probabilistic input sample set is then divided into a training set and a validation set according to a certain ratio. S3. Construct a multivariate LSTM model that integrates spatiotemporal attention mechanisms; S4. Construct a hybrid loss function that includes data fitting loss and physical constraint loss; S5. Train a multivariate LSTM model that incorporates a spatiotemporal attention mechanism using the training set and a hybrid loss function. Use the validation set to periodically evaluate the performance of the current trained model and finally obtain the trained model. S6. Deploy a trained multivariate LSTM model with a spatiotemporal attention mechanism to perform probabilistic flood forecasting.

[0007] Optionally, in the above method, the multi-source time-series hydrological historical data of the target watershed in S1 includes: Precipitation data: Gridded precipitation sequences from ground rain gauges, weather radar, and satellite inversion products for the target watershed; Hydrological data: water level and flow sequences at the outlet section and key internal nodes of the target watershed; Meteorological data: Temperature and evaporation pan evaporation series for the target watershed; Underlying surface data: land use types of the target watershed, and soil moisture saturation sequences retrieved from distributed hydrological models or remote sensing data.

[0008] Optionally, in the above method, the multivariate LSTM model that integrates spatiotemporal attention mechanisms in S3 includes: Input layer: Receives multivariate time series data; Feature attention layer: Weights the features at each time step to generate a weighted feature vector; LSTM layer: Processes the weighted time series and captures temporal dependencies; Temporal attention layer: The hidden states of the LSTM at all time steps are weighted to generate a context vector; Output layer: Makes predictions based on context vectors.

[0009] Optionally, in S4 of the above method, a hybrid loss function is constructed that includes data fitting loss and physical constraint loss, specifically as follows: Calculate the data fitting loss using the mean squared error (MSE):

[0010] in, For the actual observed flow sequence of the target watershed, Predict flow sequences for the target watershed; Physical constraint loss:

[0011] in, The mass balance loss is used to penalize significant deviations between the predicted total runoff and the input total precipitation during the forecast period. The loss during the receding process is used to penalize significant deviations between the predicted receding curve slope and the typical receding curve slope learned from historical data; The hybrid loss function is:

[0012] in, , and This is a hyperparameter used to balance various losses.

[0013] Optionally, in S5, the above method involves training a multivariate LSTM model that incorporates a spatiotemporal attention mechanism, specifically as follows: S501. The training process is carried out in batches and iteratively. Before each round of training, a small batch of samples is randomly selected from the training set to form a training batch, and the constructed multivariate LSTM model with spatiotemporal attention mechanism and hybrid loss function are initialized. S502. Input the batch of sample data into the model. For each time step in the sequence, the feature attention layer dynamically calculates the importance weight of each input feature and generates a weighted feature vector. The weighted feature vector is fed into the LSTM layer to learn the long-term dependencies in the sequence and outputs the hidden state at each historical moment. The time attention layer performs a second weighting on the hidden states of all historical moments, focusing on the key historical periods for predicting future traffic, and generates a context vector. Starting from the context vector, the decoder LSTM combines known future rainfall and other scenario features to gradually deduce the traffic prediction sequence for the entire forecast period in an autoregressive manner. S503. The traffic prediction sequence generated by the model and the actual observed traffic sequence are fed into the hybrid loss function for evaluation, and the total loss is calculated. S504. The calculated total loss is used to calculate the gradient of the loss with respect to all trainable parameters of the model through the backpropagation algorithm. The optimizer uses the obtained gradient to update the model parameters to minimize the total loss. S505. Periodically evaluate the performance of the currently trained model on an independent validation set. If the validation set loss no longer decreases within several consecutive training cycles, terminate the training early and roll back to the model state with the lowest validation loss. After training, for a forecast starting point, input historical deterministic data and multiple future rainfall scenarios, and the model will output multiple corresponding future flow prediction sequences. Treat the multiple prediction sequences output by the model as the probability distribution of the forecast flow, calculate its quantiles to obtain the uncertainty interval forecast, and use the 50% quantile as the deterministic forecast value.

[0014] Optionally, in S6, a pre-trained multivariate LSTM model incorporating spatiotemporal attention mechanisms is deployed for probabilistic flood forecasting, specifically as follows: The trained model is automatically connected to real-time monitoring data and numerical weather prediction products to generate deterministic flood process lines and uncertain forecast intervals for a certain future forecast period in real time. When the forecasted traffic exceeds the preset warning threshold, a tiered warning will be automatically triggered.

[0015] As can be seen from the above technical solutions, compared with the prior art, this invention provides a flood forecasting method based on LSTM neural networks, which has the following beneficial effects: By fusing multi-source data (precipitation, soil moisture, etc.) and a spatiotemporal attention mechanism, this invention can capture the spatiotemporal heterogeneity of the rainfall-runoff process more precisely; the hybrid loss function incorporates hydrophysical laws (mass conservation, receding water laws) as soft constraints into the model training, effectively avoiding the physical paradoxes that may arise from a purely data-driven model, and improving the reliability of the forecast results; it achieves a leap from single deterministic forecasting to probabilistic interval forecasting, providing richer risk information for flood control decision-making; after the spatiotemporal attention weights are visualized, the key driving factors and key historical periods that the model focuses on when making forecasts can be revealed, enhancing the transparency and interpretability of the model decision-making process, and helping hydrologists understand and trust the model; this method can be encapsulated into an automated forecasting system, realizing full automation from data access to early warning issuance, and significantly improving the efficiency of operational forecasting. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0017] Figure 1 The flowchart of a flood forecasting method based on LSTM neural network provided by the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Reference Figure 1 As shown, this invention discloses a flood forecasting method based on an LSTM neural network, comprising: S1. Collect multi-source time-series hydrological historical data of the target watershed, and align all collected data in time and space to form historical multivariate time-space data blocks. S2. For the forecast lead time, multiple future rainfall scenario sequences are constructed using ensemble numerical weather prediction products. These sequences are then concatenated with historical multivariate spatiotemporal data blocks to obtain multiple extended "historical-future" input sample sequences, forming a probabilistic input sample set. The probabilistic input sample set is then divided into a training set and a validation set according to a certain ratio. S3. Construct a multivariate LSTM model that integrates spatiotemporal attention mechanisms; S4. Construct a hybrid loss function that includes data fitting loss and physical constraint loss; S5. Train a multivariate LSTM model that incorporates a spatiotemporal attention mechanism using the training set and a hybrid loss function. Use the validation set to periodically evaluate the performance of the current trained model and finally obtain the trained model. S6. Deploy a trained multivariate LSTM model with a spatiotemporal attention mechanism to perform probabilistic flood forecasting.

[0020] Furthermore, in S1, the multi-source time-series hydrological historical data of the target watershed includes: Precipitation data: Gridded precipitation sequences from ground rain gauges, weather radar, and satellite inversion products for the target watershed; Hydrological data: water level and flow sequences at the outlet section and key internal nodes of the target watershed; Meteorological data: target watershed temperature and evaporation pan evaporation series; evaporation pan evaporation refers to the depth of water lost due to evaporation in an evaporation pan of a certain diameter within 24 hours (unit: mm). This is an observed value that reflects the evaporation capacity of a specific instrument under specific conditions, and is greatly affected by local microclimate and instrument model, usually exceeding the actual evaporation of natural water bodies. Using data such as sunshine duration (or solar radiation), temperature, humidity, and wind speed provided by meteorological stations or reanalysis data, the daily potential evapotranspiration is calculated using the Penman-Montis formula (FAO recommended standard method), and then interpolated to the required time step (e.g., hours).

[0021] Underlying surface data: land use types of the target watershed, and soil moisture saturation sequences retrieved from distributed hydrological models or remote sensing data.

[0022] Furthermore, in S2, for the forecast lead time (e.g., the next 1-72 hours), an ensemble numerical weather prediction product (NWP model) is used to construct multiple future rainfall scenario sequences, which are then concatenated with historical multivariate spatiotemporal data blocks to obtain multiple extended "historical-future" input sample sequences, forming a probabilistic input sample set. This is a key bridge connecting data uncertainty and model probabilistic output, and is a preprocessing operation that moves from "deterministic forecasting" to "probabilistic forecasting". Furthermore, historical deterministic data refers to all observational or analytical data that traces back a period of time (such as the past 72 hours) from the forecast start time (e.g., 8:00 AM today). This part of the data is known and certain, including historical measured flow, historical rainfall, historical soil moisture, etc. Future scenario sequence: refers to a set of numerical weather forecast products that predict a period of time (the next 48 hours) ahead of the forecast start time. It is not a single value, but rather N (e.g., 51) equally likely future rainfall sequences generated by the NWP model. Each sequence represents a future possibility, and the set of these N sequences describes the uncertainty distribution of future rainfall. Concatenation: In the time dimension, the "historical deterministic data segment" and "a future scenario data segment" are connected end to end to form a complete long sequence spanning history and the future. The above concatenation operation is repeated 51 times for 51 future scenarios, and the final result is 51 input sequences. The historical portion (the first 72 steps) of each sequence is exactly the same because the history is deterministic. The rainfall characteristics in the future portion (last 48 steps) of each sequence are different, corresponding to 51 possible future weather developments.

[0023] Furthermore, the input uncertainty of NWP is directly injected into the hydrological forecasting model. The model no longer receives a "guessed" future rainfall, but a set of possible future rainfalls. The model calculates this set of inputs and naturally produces a set of possible future flow outputs. During the model training phase, a large number of such sample sets are used for learning. The model will gradually learn how to connect the "various possible rainfall change scenarios" observed in history with the "corresponding flow responses", thus possessing the ability to handle future uncertainties. During operational forecasting, for the same forecast start time, these 51 constructed samples are input into the trained model at once. The model will perform 51 forward calculations in parallel (or serially) and output 51 future flow process lines. These 51 lines constitute the final probabilistic forecast product.

[0024] Furthermore, in S3, a multivariate LSTM model incorporating a spatiotemporal attention mechanism is used. The model employs an encoder-decoder architecture, where the encoder is responsible for "understanding" and "compressing" historical information, and the decoder uses this information to "generate" future predictions. The entire model is an end-to-end data processing pipeline, and includes: Input layer: Receives a multivariate time series sample, such as a matrix of shape [historical time step, number of features], where each row represents a historical moment (e.g., 1 hour ago) and each column represents a hydrological and meteorological feature (e.g., average rainfall in the basin, upstream station flow, soil moisture, etc.). Feature Attention Layer: This layer weights the features at each time step, generating a weighted feature vector. This is the first step in the model's processing, acting as a dynamic filter to evaluate the importance of multiple input features at the current moment. It answers the question: "To predict future flow, at this specific moment, should I focus more on rainfall data or soil moisture data? Should I focus on rainfall in area A or area B?" A small neural network (attention network) within the model combines the model's internal state (memory) from the previous moment to calculate the "attention score" for each input feature at the current moment. Then, the Softmax function transforms these scores into a set of weights, summing to 1. Features with higher weights are considered more critical to the current prediction task. The original feature values ​​are multiplied by their corresponding weights to obtain a new weighted feature vector. Thus, before a flood, the weight of rainfall features is automatically increased; during the receding flood period, the weights of earlier flow and evaporation features may dominate. LSTM layer: Processes the weighted time series and captures temporal dependencies; it is the memory center of the model, responsible for learning complex long-term dependencies in the historical sequence (e.g., how a light rain three days ago affects the current soil moisture, and thus affects today's runoff); it consists of multiple layers of LSTM units, each of which, through its precise gating mechanism (input gate, forget gate, output gate), determines how much past information to retain, how much new input to absorb, and what content to output to the next layer or the next time step; for each historical time step in the input sequence, the encoder outputs a "hidden state," which is a high-dimensional vector that can be understood as the model's "summary" or "memory encoding" of that time step and all previous history; The temporal attention layer weights the hidden states of the LSTM across all time steps to generate a context vector. This layer extracts the most relevant segments to the current forecasting task from a long historical memory, answering the question: "In the past 72 hours, was the heavy rain 6 hours ago the most critical, or the moderate rain 24 hours ago? Or the rainfall a week ago that contributed to the previous soil moisture?" Another attention network calculates the importance weight of the hidden states at each historical moment for generating the final forecast. Similarly, these weights are normalized using Softmax; historical moments with high weights mean that their information is crucial to the forecast. The hidden states of all historical moments are weighted and summed according to the calculated temporal attention weights to generate a single, condensed "context vector." This vector is no longer a simple memory of the last time step, but a summary of the essence of the entire historical sequence, in which key events are highly emphasized. Output layer: Predicts based on context vectors; transforms the generated "context vectors" into the initial state of the decoder LSTM, ensuring that the decoder "knows" the essence of history when it starts predicting; the decoder works in a recurrent (autoregressive) manner, progressively predicting the flow at each future time step: Step 1: Combines the initial state and the known weather forecast (such as rainfall) for the first future moment to predict the flow at the first moment; Step 2: Uses the flow predicted in the previous step (or the true value used during training) as part of the input, combines it with the weather forecast for the second future moment, and updates the decoder state to predict the flow at the second moment; this process is repeated until the flow sequence for the entire forecast period (such as the next 48 hours) is generated; a fully connected neural network maps the internal state of the decoder at each moment to a specific flow prediction value.

[0025] Furthermore, in S4, a hybrid loss function is constructed that includes data fitting loss and physical constraint loss. Traditional neural network loss functions usually only focus on the numerical difference between the predicted value and the true value (such as mean square error). This purely data-driven optimization objective has obvious defects: the model may become a "mathematically excellent but physically absurd" black box. For example, it may predict the result of "flooding without rain" or "the receding process fluctuates against physical laws", which is unacceptable in the field of hydrology that emphasizes causal mechanisms and physical consistency. Therefore, the design of this hybrid loss function formalizes the domain knowledge of hydrologists and transforms it into mathematical constraints that can be optimized together with the data loss, specifically: Data fitting loss is calculated using the mean squared error (MSE) to ensure that the model-predicted flow process curve is as close as possible to historical observations.

[0026] in, For the actual observed flow sequence of the target watershed, Predict flow sequences for the target watershed; Physical constraint loss:

[0027] in, The mass balance loss is used to penalize significant deviations between the predicted total runoff and the input total precipitation during the forecast period. The loss during the receding process is used to penalize significant deviations between the predicted receding curve slope and the typical receding curve slope learned from historical data; Mass balance loss is based on the law of conservation of water. In principle, the total runoff during the forecast period in a closed watershed should not exceed the total effective rainfall input during the same period (after deducting losses such as evaporation and infiltration). Calculation of mass balance loss: The total runoff predicted by the model for the future forecast period is summed together with the input total future rainfall for the same period. Not all rainfall is converted into runoff, so a learnable (or dynamically adjusted based on previous soil moisture) "loss coefficient" is introduced to estimate the effective rainfall. If the predicted total runoff consistently and significantly exceeds the calculated effective rainfall, this loss term will generate a large penalty value, forcing the model to adjust its parameters in subsequent training to make the prediction results move towards satisfying the mass balance. This constraint fundamentally prevents the model from "creating something out of nothing," ensures the most basic material conservation of the hydrological cycle, and greatly enhances the physical reliability of the forecast results. The loss during the receding process is based on the theory of receding curves. During periods of no or very little rainfall, river flow exhibits a natural receding pattern with an approximate exponential decay. The rate of receding is related to the geological and geomorphological characteristics of the watershed. The model automatically identifies the "receding section" after rainfall stops from the predicted future flow process line. Based on historical data or hydrological knowledge, a reasonable range of receding coefficients is defined to describe how the flow should decay over time. The model's predicted values ​​during the receding phase are compared with the theoretical receding curve. If the model's predictions show unreasonable fluctuations, or rise or fall too quickly / slowly, the loss term will penalize it. This guides the model to learn the correct receding dynamics and avoids producing jagged or counterintuitive receding predictions. This constraint ensures that the model's predictions during the flood receding phase conform to natural laws, which is crucial for subsequent decisions such as reservoir scheduling and determining the timing of warning cancellation.

[0028] The hybrid loss function is:

[0029] in, , and These are hyperparameters used to balance various losses; the three parts are connected through hyperparameters. , and A weighted summation is performed, and these weights can be preset or designed as learnable parameters, allowing the model to find the optimal balance point during training.

[0030] Furthermore, in S5, a multivariate LSTM model incorporating a spatiotemporal attention mechanism is trained, specifically as follows: S501. The training process is carried out in batches and iteratively. Before each round of training, a small batch of samples is randomly selected from the training set to form a training batch, and the constructed multivariate LSTM model with spatiotemporal attention mechanism and hybrid loss function are initialized. S502. Input the batch of sample data into the model. For each time step in the sequence, the feature attention layer dynamically calculates the importance weight of each input feature and generates a weighted feature vector. The weighted feature vector is fed into the LSTM layer to learn the long-term dependencies in the sequence and outputs the hidden state at each historical moment. The time attention layer performs a second weighting on the hidden states of all historical moments, focusing on the key historical periods for predicting future traffic, and generates a context vector. Starting from the context vector, the decoder LSTM combines known future rainfall and other scenario features to gradually deduce the traffic prediction sequence for the entire forecast period in an autoregressive manner. S503. The traffic prediction sequence generated by the model and the actual observed traffic sequence are fed into the hybrid loss function for evaluation, and the total loss is calculated. S504. The calculated total loss is used to calculate the gradient of the loss with respect to all trainable parameters of the model through the backpropagation algorithm. The optimizer uses the obtained gradient to update the model parameters to minimize the total loss. S505. Periodically evaluate the performance of the currently trained model on an independent validation set. If the validation set loss no longer decreases over multiple consecutive training cycles, terminate training early and roll back to the model state with the lowest validation loss. After training, for a forecast starting point, given historical deterministic data and N future rainfall scenarios, the model will output N corresponding future flow prediction sequences. These N sequences are considered as a probability distribution of the forecast flow, and their quantiles (e.g., 10%, 50%, 90%) can be calculated to obtain the uncertainty interval forecast, with the 50% quantile used as the deterministic forecast value.

[0031] Furthermore, in S6, a pre-trained multivariate LSTM model incorporating spatiotemporal attention mechanisms is deployed for probabilistic flood forecasting, specifically as follows: The trained model is automatically connected to real-time monitoring data and numerical weather prediction products to generate deterministic flood process lines and uncertain forecast intervals for a certain future forecast period in real time. When the forecasted traffic exceeds the preset warning threshold, a tiered warning will be automatically triggered.

[0032] In one specific embodiment, taking a sub-basin of the Yangtze River as an example, this flood forecasting method is implemented: We collected hourly surface rain gauge data, estimated and merged precipitation products, outlet hydrological station flow, air temperature, and potential evapotranspiration data for the past 20 years in the watershed. Soil moisture sequences were obtained using the distributed hydrological model VIC. All data were processed into a unified format, either hourly, spatially averaged (watershed average), or representative of key stations. Using the ECMWF 51-member ensemble forecast product, 51 scenarios for rainfall in the next 48 hours were generated. Each scenario was then stitched together with historical data from the past 72 hours to form 51 input samples. Construct a two-layer LSTM network, embedding feature and temporal attention modules before and after it respectively, setting α=1.0, β=0.5, γ=0.2, training the model with data from the past 15 years, and using the remaining 5 years of data for validation and testing; In five flood events during the testing period, compared with traditional LSTM models and conceptual hydrological models, the relative error of peak flow of the present invention was reduced by an average of about 18%, and the peak occurrence time error was reduced by an average of about 3 hours. At the same time, it provided a reliable 90% forecast uncertainty interval, and the measured flood process lines all fell within this interval.

[0033] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0034] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A flood forecasting method based on LSTM neural network, characterized in that, include: S1. Collect multi-source time-series hydrological historical data of the target watershed, and align all collected data in time and space to form historical multivariate time-space data blocks. S2. For the forecast lead time, multiple future rainfall scenario sequences are constructed using ensemble numerical weather prediction products, and then concatenated with historical multivariate spatiotemporal data blocks to obtain multiple extended "historical-future" input sample sequences, forming a probabilistic input sample set. The probabilistic input sample set is then divided into a training set and a validation set according to a certain ratio. S3. Construct a multivariate LSTM model that integrates spatiotemporal attention mechanisms; S4. Construct a hybrid loss function that includes data fitting loss and physical constraint loss; S5. Train a multivariate LSTM model that incorporates a spatiotemporal attention mechanism using the training set and a hybrid loss function. Use the validation set to periodically evaluate the performance of the current trained model and finally obtain the trained model. S6. Deploy a trained multivariate LSTM model with a spatiotemporal attention mechanism to perform probabilistic flood forecasting.

2. The flood forecasting method based on LSTM neural network according to claim 1, characterized in that, In S1, the multi-source time-series hydrological historical data of the target watershed includes: Precipitation data: Gridded precipitation sequences from ground rain gauges, weather radar, and satellite inversion products for the target watershed; Hydrological data: water level and flow sequences at the outlet section and key internal nodes of the target watershed; Meteorological data: Temperature and evaporation pan evaporation series for the target watershed; Underlying surface data: land use types of the target watershed, and soil moisture saturation sequences retrieved from distributed hydrological models or remote sensing data.

3. The flood forecasting method based on LSTM neural network according to claim 1, characterized in that, In S3, the multivariate LSTM model that incorporates a spatiotemporal attention mechanism includes: Input layer: Receives multivariate time series data; Feature attention layer: Weights the features at each time step to generate a weighted feature vector; LSTM layer: Processes the weighted time series and captures temporal dependencies; Temporal attention layer: The hidden states of the LSTM at all time steps are weighted to generate a context vector; Output layer: Makes predictions based on context vectors.

4. The flood forecasting method based on LSTM neural network according to claim 3, characterized in that, In S4, a hybrid loss function is constructed that includes data fitting loss and physical constraint loss, specifically as follows: Calculate the data fitting loss using the mean squared error (MSE): in, For the actual observed flow sequence of the target watershed, Predict flow sequences for the target watershed; Physical constraint loss: in, The mass balance loss is used to penalize significant deviations between the predicted total runoff and the input total precipitation during the forecast period. The loss during the receding process is used to penalize significant deviations between the predicted receding curve slope and the typical receding curve slope learned from historical data; The hybrid loss function is: in, , and This is a hyperparameter used to balance various losses.

5. A flood forecasting method based on an LSTM neural network according to claim 4, characterized in that, In S5, the multivariate LSTM model incorporating a spatiotemporal attention mechanism is trained as follows: S501. The training process is carried out in batches and iteratively. Before each round of training, a small batch of samples is randomly selected from the training set to form a training batch, and the constructed multivariate LSTM model with spatiotemporal attention mechanism and hybrid loss function are initialized. S502. Input the batch of sample data into the model. For each time step in the sequence, the feature attention layer dynamically calculates the importance weight of each input feature and generates a weighted feature vector. The weighted feature vector is fed into the LSTM layer to learn the long-term dependencies in the sequence and outputs the hidden state at each historical moment. The time attention layer performs a second weighting on the hidden states of all historical moments, focusing on the key historical periods for predicting future traffic, and generates a context vector. Starting from the context vector, the decoder LSTM combines known future rainfall and other scenario features to gradually deduce the traffic prediction sequence for the entire forecast period in an autoregressive manner. S503. The traffic prediction sequence generated by the model and the actual observed traffic sequence are fed into the hybrid loss function for evaluation, and the total loss is calculated. S504. The calculated total loss is used to calculate the gradient of the loss with respect to all trainable parameters of the model through the backpropagation algorithm. The optimizer uses the obtained gradient to update the model parameters to minimize the total loss. S505. Periodically evaluate the performance of the currently trained model on an independent validation set. If the validation set loss no longer decreases within several consecutive training cycles, terminate the training early and roll back to the model state with the lowest validation loss. After training, for a forecast starting point, input historical deterministic data and multiple future rainfall scenarios, and the model will output multiple corresponding future flow prediction sequences. Treat the multiple prediction sequences output by the model as the probability distribution of the forecast flow, calculate its quantiles to obtain the uncertainty interval forecast, and use the 50% quantile as the deterministic forecast value.

6. The flood forecasting method based on LSTM neural network according to claim 5, characterized in that, In S6, a pre-trained multivariate LSTM model incorporating spatiotemporal attention mechanisms is deployed for probabilistic flood forecasting, specifically as follows: The trained model is automatically connected to real-time monitoring data and numerical weather prediction products to generate deterministic flood process lines and uncertain forecast intervals for a certain future forecast period in real time. When the forecasted traffic exceeds the preset warning threshold, a tiered warning will be automatically triggered.