Medium and long term flood forecasting method, device, equipment, medium and product
By using the Transformer model and self-attention mechanism to process river flow and climatic factor timing data, the problem of medium and long-distance dependence on medium and long-term flood forecasts is solved, the prediction accuracy and adaptability are improved, and more accurate flood trend prediction is achieved.
Patent Information
- Application Number
- CN202410999557.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing medium- and long-term flood forecasting methods are difficult to process and identify long-distance dependencies in time series data, resulting in limited prediction accuracy.
Using the Transformer model and its self-attention mechanism, sample data is extracted from river flow and climatic factor timing data, and the maximum flow prediction model within the segment is constructed. The data is processed in parallel through the multi-head attention mechanism to predict the maximum river flow in the future medium and long-term unit period. .
It improves the accuracy of medium- and long-term flood prediction, enhances the adaptability and universality of the model, can better deal with rapidly changing environmental conditions, simplify the operation process and improves prediction efficiency.
Smart Images

Figure CN119129794A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of hydrological forecasting, and specifically relates to a medium- and long-term flood forecasting method, device, equipment, medium and product. Background Art
[0002] Long-term flood forecasting plays an important supporting role in flood control and drought relief, water conservancy project construction and management and application, and other national economic construction. In the long-term flood forecasting business, the forecast is usually classified as follows according to the length of the forecast period: the forecast period of less than 3 days is called short-term flood forecast, 4-10 days (including 10 days) is called medium-term flood forecast, more than 10 days to less than one year is called long-term flood forecast, and more than one year is called ultra-long-term flood forecast. In addition, the time scale of long-term flood forecast is divided into ten days, month, season and year.
[0003] Medium / long-term flood forecasting requires a longer forecast period, so the approaches and methods used are significantly different from those used for short-term flood forecasting. The main methods currently used for medium- and long-term flood forecasting are:
[0004] (1) Meteorological method: The change of runoff mainly depends on precipitation, which is determined by certain circulation patterns and weather processes. Therefore, the long-term change of runoff should be closely related to the evolution of large-scale weather processes. The meteorological method is based on this concept of cause, and is a method of forecasting based on the quantitative relationship between the early atmospheric circulation characteristics and the various high-altitude meteorological elements that represent these characteristics and the later hydrological elements.
[0005] (2) Astronomical and geophysical factors: Recent research results show that changes in the Earth's rotation speed, sea temperature conditions, planetary motion positions, solar activity, etc. have a certain impact on atmospheric movement and hydrological processes. After analyzing the corresponding relationship between these factors and hydrological processes, it is possible to predict the possible changes in hydrological elements in the later period.
[0006] (3) Statistical methods: Apply mathematical statistics methods to a large amount of historical data to find and analyze the statistical laws and relationships between changes in hydrological elements and forecasting factors, and then apply these laws to make forecasts. According to the characteristics of the factors considered when making forecast plans, this method can be divided into single-factor methods and multi-factor comprehensive methods. The single-factor method mainly uses the law of changes in the forecast object itself over time as the basis for forecasting, such as historical evolution method, time series analysis method, etc.; the multi-factor comprehensive method selects multiple factors from the factors that affect the forecast object and establishes their statistical laws as the basis for forecasting, such as multivariate linear regression analysis method. Since most of the current hydrological forecasting methods make some assumptions or simplifications based on certain physical causes, and only a few main factors are selected, establishing plans based on average conditions will produce certain forecasting method errors, and the hydrological laws obtained from the analysis of the existing limited data cannot fully represent the overall hydrological laws. Especially when there is a lack of large flood data, the sampling error is often large.
[0007] The limitations of the above existing methods have led to the exploration of new methods, especially the integration of deep learning attention mechanism technology. In 2017, Vaswani et al. proposed a deep learning-based model, Transformer, and first introduced this technology in their paper "Attention Is All You Need". The core of the Transformer model is the "self-attention" mechanism, which enables the model to consider other elements in the sequence while processing sequence data, thereby effectively capturing the correlation between elements. Therefore, how to use Transformer technology and its self-attention mechanism to predict medium- and long-term flood trends, so that it can process and identify long-distance dependencies in time series data, solve problems that are difficult to cover with traditional hydrological prediction models, and thus improve the accuracy of medium- and long-term flood predictions, better adapt to rapidly changing environmental conditions and improve the universality of the model, is a topic that technicians in this field urgently need to study. Summary of the invention
[0008] The purpose of the present invention is to provide a medium- and long-term flood forecasting method, apparatus, computer equipment, computer-readable storage medium and computer program product to solve the problem that existing medium- and long-term flood forecasting schemes are difficult to process and identify long-distance dependencies in time series data, which in turn leads to the difficulty of traditional hydrological prediction models to cover and the limited accuracy of medium- and long-term flood predictions.
[0009] In order to achieve the above object, the present invention adopts the following technical solutions:
[0010] First, a medium- and long-term flood forecasting method is provided, including:
[0011] Acquire river flow time series data and climate factor time series data, wherein the river flow time series data contains a plurality of medium- and long-term unit time periods that are sequentially continuous in time series and the maximum river flow in each of the plurality of medium- and long-term unit time periods, and the climate factor time series data contains the plurality of medium- and long-term unit time periods and a plurality of climate factor values in each of the medium- and long-term unit time periods;
[0012] A plurality of sample data are extracted from the river flow time series data and the climate factor time series data in the following manner: the maximum river flow and a plurality of climate factor values in k consecutive medium- and long-term unit time periods in time are extracted from the river flow time series data and the climate factor time series data as model input items, and the maximum river flow in the next medium- and long-term unit time period after the k medium- and long-term unit time periods is extracted from the river flow time series data as a model output item, and then the model input item and the model output item are taken as a sample data, wherein k represents a positive integer greater than or equal to 2 and less than K, and K represents the total number of time periods of the plurality of medium- and long-term unit time periods;
[0013] Build the Transformer model;
[0014] Using the plurality of sample data to perform model training on the Transformer model, and obtaining a maximum river flow prediction model within the section;
[0015] Obtaining the maximum river flow of the target river section in the latest k medium- and long-term unit time periods, and also obtaining multiple climate factor values in the latest k medium- and long-term unit time periods, wherein the latest k medium- and long-term unit time periods are sequentially continuous in time sequence;
[0016] Importing the maximum river flow in the segment of the most recent k medium- and long-term unit time periods and multiple climate factor values into the maximum river flow prediction model in the segment, and outputting the predicted value of the maximum river flow in the segment of the target river segment in the next medium- and long-term unit time period in the future, wherein the next medium- and long-term unit time period in the future refers to the next medium- and long-term unit time period after the most recent k medium- and long-term unit time periods;
[0017] The predicted value of the maximum river flow in the section is used as the medium- and long-term flood forecast result of the target river section in the next medium- and long-term unit time period in the future and is output and displayed.
[0018] Based on the above invention content, a new solution for medium- and long-term flood trend prediction using Transformer technology and its self-attention mechanism is provided, that is, a plurality of sample data are first extracted from river flow time series data and climate factor time series data, each sample data contains the maximum river flow in a plurality of medium- and long-term unit time periods used as model input items and a plurality of climate factor values as the maximum river flow in the next medium- and long-term unit time period after the plurality of medium- and long-term unit time periods used as model output items, and then a Transformer model is constructed, and the plurality of sample data are applied to perform model training , obtain the prediction model of the maximum river flow in the section, and finally import the maximum river flow in the target river section in the recent multiple medium- and long-term unit time periods and multiple climate factor values into the prediction model to obtain the predicted value of the maximum river flow in the target river section in the next medium- and long-term unit time period in the future and use it as the medium- and long-term flood forecast result. In this way, the Transformer model can be used to process and identify long-distance dependencies in time series data, solve problems that are difficult to cover with traditional hydrological prediction models, and thus improve the accuracy of medium- and long-term flood predictions, better adapt to rapidly changing environmental conditions and enhance the universality of the model, which is convenient for practical application and promotion.
[0019] In a possible design, the medium- to long-term unit period refers to a period that includes at least four natural days that are consecutive in time sequence.
[0020] In one possible design, the multiple climate factor values include the western Pacific subtropical high intensity index value, the Indo-Myanmar trough intensity index value, the Tibetan Plateau-1 index value, the tropical Indian Ocean sea surface temperature dipole index value, the subtropical South Indian Ocean dipole index value, the NINO 3.4 region sea surface temperature anomaly index value and / or the sunspot index value.
[0021] In a possible design, after obtaining the river flow time series data and the climate factor time series data and before extracting the sample data, the method further includes:
[0022] A forward filling method is used to fill in missing values in the original time series data, wherein the original time series data refers to the originally acquired river flow time series data and / or the climate factor time series data.
[0023] In a possible design, after obtaining the river flow time series data and the climate factor time series data and before extracting the sample data, the method further includes:
[0024] For each climate factor value in the plurality of climate factor values, standardization is performed according to the following formula:
[0025]
[0026] In the formula, represents a positive integer, Indicates the first of the multiple climate factor values The original value of the climate factor value, Indicates that The statistical average value of the climate factor corresponding to the climate factor value, Indicates that The statistical standard deviation of the climate factor corresponding to the climate factor value, Indicates the The value obtained by standardizing the values of the climate factors.
[0027] In one possible design, building a Transformer model involves:
[0028] Adopting self-attention mechanism in Transformer model;
[0029] A multi-head attention mechanism is used in each encoder layer and each decoder layer of the Transformer model to process data in parallel.
[0030] In a second aspect, a medium- and long-term flood forecasting device is provided, including a time series data acquisition unit, a sample data extraction unit, a model construction unit, a model training unit, a model application unit and a result display unit;
[0031] The time series data acquisition unit is used to acquire river flow time series data and climate factor time series data, wherein the river flow time series data contains a plurality of medium- and long-term unit time periods that are sequentially continuous in time series and the maximum river flow in each of the plurality of medium- and long-term unit time periods, and the climate factor time series data contains the plurality of medium- and long-term unit time periods and a plurality of climate factor values in each of the medium- and long-term unit time periods;
[0032] The sample data extraction unit is communicatively connected to the time series data acquisition unit, and is used to extract multiple sample data from the river flow time series data and the climate factor time series data in the following manner: extract the maximum river flow and multiple climate factor values in k medium- and long-term unit time periods that are sequentially continuous in time series from the river flow time series data and the climate factor time series data as model input items, and extract the maximum river flow in the next medium- and long-term unit time period after the k medium- and long-term unit time periods from the river flow time series data as model output items, and then use the model input item and the model output item as a sample data, wherein k represents a positive integer greater than or equal to 2 and less than K, and K represents the total number of time periods of the multiple medium- and long-term unit time periods;
[0033] The model building unit is used to build a Transformer model;
[0034] The model training unit is respectively connected to the sample data extraction unit and the model construction unit for applying the plurality of sample data to perform model training on the Transformer model to obtain a maximum river flow prediction model within the segment;
[0035] The time series data acquisition unit is further used to acquire the maximum river flow of the target river section in the latest k medium- and long-term unit time periods, and also to acquire multiple climate factor values in the latest k medium- and long-term unit time periods, wherein the latest k medium- and long-term unit time periods are sequentially continuous in time series;
[0036] The model application unit is respectively connected to the time series data acquisition unit and the model training unit for communication, and is used to import the maximum river flow in the segment of the most recent k medium- and long-term unit time periods and multiple climate factor values into the maximum river flow prediction model in the segment, and output the maximum river flow prediction value in the target river segment in the next medium- and long-term unit time period in the future, wherein the next medium- and long-term unit time period in the future refers to the next medium- and long-term unit time period after the most recent k medium- and long-term unit time periods;
[0037] The result display unit is communicatively connected to the model application unit, and is used to output and display the predicted value of the maximum river flow in the section as the medium- and long-term flood forecast result of the target river section in the next medium- and long-term unit time period in the future.
[0038] In a third aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the medium- and long-term flood forecasting method as described in the first aspect or any possible design of the first aspect.
[0039] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, executes the medium- and long-term flood forecasting method as described in the first aspect or any possible design of the first aspect.
[0040] In a fifth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implement the medium- and long-term flood forecasting method as described in the first aspect or any possible design of the first aspect.
[0041] Beneficial effects of the above scheme:
[0042] (1) The present invention creatively provides a new solution for medium- and long-term flood trend prediction using Transformer technology and its self-attention mechanism, that is, first extracting multiple sample data from river flow time series data and climate factor time series data, each sample data contains the maximum river flow in multiple medium- and long-term unit time periods as model input items and multiple climate factor values and the maximum river flow in the next medium- and long-term unit time period after the multiple medium- and long-term unit time periods as model output items, then constructing a Transformer model, and applying the multiple sample data to perform model training. , obtain the prediction model of the maximum river flow in the section, and finally import the maximum river flow in the target river section in the recent multiple medium- and long-term unit time periods and multiple climate factor values into the prediction model to obtain the predicted value of the maximum river flow in the target river section in the next medium- and long-term unit time period in the future and use it as the medium- and long-term flood forecast result. In this way, the Transformer model can be used to process and identify long-distance dependencies in time series data, solve problems that are difficult to cover with traditional hydrological prediction models, and thus improve the accuracy of medium- and long-term flood predictions, better adapt to rapidly changing environmental conditions and enhance the universality of the model, which is convenient for practical application and promotion;
[0043] (2) By integrating the Transformer model, a data-driven prediction system can be built. The system follows a simple input-calculation-output process and can optimize its parameters by learning a large amount of historical data to improve the accuracy of prediction.
[0044] (3) This solution has the ability to process long sequence data and automatically adjust parameters according to new data, which simplifies the operation process and improves the adaptability and prediction efficiency of the model;
[0045] (4) As more data accumulate, the prediction performance of the Transformer model will continue to improve, which will facilitate its application in different hydrological environments and thus improve the accuracy and ease of operation of long-term flood predictions. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A schematic flow chart of a medium- to long-term flood forecasting method provided in an embodiment of the present application.
[0048] Figure 2 An example diagram of the relationship between training loss and validation loss and the number of iterations during model training and validation provided in an embodiment of the present application.
[0049] Figure 3 A schematic diagram of the structure of a medium- to long-term flood forecasting device provided in an embodiment of the present application.
[0050] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structures of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these embodiments without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0052] It should be understood that although the terms first and second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are only used to distinguish one object from another object. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.
[0053] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.
[0054] Example
[0055] like Figure 1 As shown, the medium- and long-term flood forecasting method provided in the first aspect of this embodiment can be, but is not limited to, executed by a computer device with certain computing resources, such as a cloud server. Figure 1 As shown, the medium- and long-term flood forecasting method may include, but is not limited to, the following steps S1 to S7.
[0056] S1. Obtain river flow time series data and climate factor time series data, wherein the river flow time series data contains multiple medium- and long-term unit time periods that are consecutive in time series and the maximum river flow in each of the multiple medium- and long-term unit time periods, and the climate factor time series data contains the multiple medium- and long-term unit time periods and multiple climate factor values in each of the multiple medium- and long-term unit time periods.
[0057] In step S1, the medium- and long-term unit period refers to a period of at least four natural days that are consecutive in time sequence. The multiple climate factor values include but are not limited to key climate indicator values such as the Western Pacific Subtropical High Intensity Index, the Indo-Myanmar Trough Intensity Index, the Tibet Plateau-1 Index, the Tropical Indian Ocean Sea Surface Temperature Dipole Index, the Subtropical South Indian Ocean Dipole Index, the NINO 3.4 Region Sea Surface Temperature Anomaly Index, and / or the Sunspot Index. For example, in order to use the Transformer model to predict the long-term flood trend in Sichuan Province and to solve the shortcomings of traditional hydrological prediction models in dealing with the long-distance dependence of time series data, the annual maximum flow data of the main rivers in Sichuan Province from 1961 to 2023 and 106 climate factor data in the same time period can be collected, including the Western Pacific Subtropical High Intensity Index, the Indo-Myanmar Trough Intensity Index, the Tibet Plateau-1 Index, the Tropical Indian Ocean Sea Surface Temperature Dipole Index, the Subtropical South Indian Ocean Dipole Index, the NINO 3.4 Zone Sea Surface Temperature Anomaly Index, the Sunspot Index and other key climate indicator data.
[0058] S2. Extract multiple sample data from the river flow time series data and the climate factor time series data in the following manner: extract the maximum river flow and multiple climate factor values in k medium- and long-term unit time periods that are consecutive in time series from the river flow time series data and the climate factor time series data as model input items, and extract the maximum river flow in the next medium- and long-term unit time period after the k medium- and long-term unit time periods from the river flow time series data as the model output item, and then use the model input item and the model output item as a sample data, wherein k represents a positive integer greater than or equal to 2 and less than K, and K represents the total number of time periods of the multiple medium- and long-term unit time periods.
[0059] In step S2, k can be exemplified as 10. For example, the annual maximum flow data from 1961 to 1970 and 106 climate factor data in the same time period can be used as the model input items, and the annual maximum flow data in 1971 can be used as the model output items, thereby obtaining a sample data; for another example, the annual maximum flow data from 2013 to 2022 and 106 climate factor data in the same time period can be used as the model input items, and the annual maximum flow data in 2023 can be used as the model output items, thereby obtaining another sample data. In order to ensure the continuity and integrity of the time series data, preferably, after obtaining the river flow time series data and the climate factor time series data and before extracting the sample data, the method also includes but is not limited to: using the forward filling method to fill in the missing values in the original time series data, wherein the original time series data refers to the river flow time series data and / or the climate factor time series data originally obtained. And in order to eliminate the influence of different dimensions and make the subsequent model training more stable, preferably, after obtaining the river flow time series data and the climate factor time series data and before extracting the sample data, the method also includes but is not limited to: for each climate factor value in the multiple climate factor values, standardization processing is performed according to the following formula:
[0060]
[0061] In the formula, represents a positive integer, Indicates the first of the multiple climate factor values The original value of the climate factor value, Indicates that The statistical average value of the climate factor corresponding to the climate factor value, Indicates that The statistical standard deviation of the climate factor corresponding to the climate factor value, Indicates the In addition, the maximum river flow in the segment and the plurality of climate factor values may be internally connected according to the year index to ensure the data integrity of each unit time period.
[0062] S3. Build the Transformer model.
[0063] In step S3, specifically, a Transformer model is constructed, including but not limited to: using a self-attention mechanism in the Transformer model; using a multi-head attention mechanism in each encoder layer and each decoder layer of the Transformer model to process data in parallel. The self-attention mechanism allows the model to consider data at other time points when processing each input data, thereby effectively capturing long-distance time series dependencies; the specific calculation formula of the self-attention mechanism is as follows:
[0064]
[0065] Where Q, K and V represent the query matrix, key matrix and value matrix respectively. k The Transformer model includes multiple encoder layers and multiple decoder layers. By using a multi-head attention mechanism in each layer to process data in parallel, the model's ability to capture complex patterns can be increased. The structures of the encoder and decoder include LayerNorm function and Sublayer function, where LayerNorm is usually defined as:
[0066]
[0067] Where x represents the normalized feature vector input to the layer, μ represents the mean of x, σ represents the standard deviation of x, γ and β represent learnable parameters, which are used to scale and translate the normalized values respectively; Sublayer function refers to a sublayer containing specific functions, such as MultiHeadAttention and FeedForwardNetwork (FFN), which are encapsulated in a residual connection and layer normalization structure, as shown in the following figure:
[0068] Sublayer(x)=FFN(LayerNorm(x+MultiHeadAttention(x,x,x)))
[0069] This means that the input x is first processed with itself through multi-head attention, and its output is added to the original input x and sent to the LayerNorm function for normalization. The normalized output is then sent to the FFN network for further processing. This process enhances the learning ability of the model and helps the gradient flow more stably through residual connections and layer normalization.
[0070] S4. Using the multiple sample data to perform model training on the Transformer model, a maximum river flow prediction model within the section is obtained.
[0071] In step S4, the mean square error (MSE) can be used as a loss function to evaluate the accuracy of the model in predicting flood flow. The calculation formula of the above loss function MSE is as follows:
[0072]
[0073] Where Y i represents the true value, Represents the predicted value, n represents the number of samples. Specifically, the loss calculation is to measure the difference between the model output and the actual data (i.e., the square of the difference between the predicted value and the actual value), and then average the square of these differences for all time steps to obtain the MSE. In addition, during the model training process, the AdamW optimizer can be used to adjust the parameters of the Transformer model to minimize the prediction error and improve the prediction accuracy of future flood events. The AdamW optimizer combines weight decay and adaptive learning rate optimization to effectively maintain the stability of training. Its core update rule is: parameter θ t In each iteration, the gradient is adjusted according to the following formula:
[0074]
[0075] In the formula, θ t represents the parameter, η represents the learning rate, represents the second-order moment estimate, represents the first-order moment estimate, ε represents a small constant used to prevent division by zero, and λ represents the weight decay coefficient. This method not only takes into account the direction and magnitude of the gradient, but also suppresses the model complexity through weight decay, thereby avoiding overfitting and ensuring the generalization ability and prediction accuracy of the model when facing real-world data.
[0076] After step S4, this embodiment also extracts a training set from the time series data from 1961 to 2013 and a test set from the time series data from 2014 to 2023 based on the annual maximum flow data of the main rivers in Sichuan Province from 1961 to 2023 and the 106 climate factor data in the same time period, and applies them to train and verify the Transformer model, and obtains the following: Figure 2The relationship between the training loss (which is also defined by the mean square error MSE) and the validation loss and the number of iterations shown in the figure shows that: in the early stage of training, both the training loss and the validation loss drop rapidly, indicating that the model effectively learns from the data and quickly improves its prediction ability at this stage; after thousands of iterations, the loss curve begins to stabilize, indicating that the learning progress of the model slows down and begins to reach a performance bottleneck; in the later stage of the training process, both the training loss and the validation loss remain at a low level, showing that the model has a good fit to the data, and the stability of the validation loss indicates that the model has a certain generalization ability. Overall, the model shows good performance on the training and validation data, that is, the stable low values of the training and validation losses indicate that the model has learned the key features in the data and can make more accurate predictions, demonstrating the model's potential for predicting future flood trends in Sichuan Province. In addition, the parallel processing characteristics of the Transformer model significantly improve computational efficiency, making it a powerful tool for processing large-scale hydrological data.
[0077] S5. Obtain the maximum river flow of the target river section in the latest k medium- and long-term unit time periods, and also obtain multiple climate factor values in the latest k medium- and long-term unit time periods, wherein the latest k medium- and long-term unit time periods are consecutive in time sequence.
[0078] In step S5, if the maximum river flow prediction model in the section is trained based on the annual maximum flow data of the main rivers in Sichuan Province from 1961 to 2023 and 106 climate factor data in the same time period, then the target river section needs to be preferably a river section in Sichuan Province to ensure the applicability of the model and the accuracy of the final forecast results.
[0079] S6. Import the maximum river flow in the segment of the said most recent k medium- and long-term unit time periods and multiple climate factor values into the maximum river flow prediction model in the segment, and output the predicted value of the maximum river flow in the segment of the target river section in the next medium- and long-term unit time period in the future, wherein the next medium- and long-term unit time period in the future refers to the next medium- and long-term unit time period after the said most recent k medium- and long-term unit time periods.
[0080] In step S6, for example, the current year is 2024, the most recent k medium- and long-term unit time periods are 2015 to 2024, and the next medium- and long-term unit time period in the future is 2025.
[0081] S7. The predicted value of the maximum river flow in the section is used as the medium- and long-term flood forecast result of the target river section in the next medium- and long-term unit period in the future and is output for display.
[0082] Therefore, based on the medium- and long-term flood forecasting method described in the aforementioned steps S1 to S7, a new scheme for medium- and long-term flood trend prediction using Transformer technology and its self-attention mechanism is provided, that is, a plurality of sample data are first extracted from the river flow time series data and the climate factor time series data, each sample data contains the maximum river flow in a plurality of medium- and long-term unit time periods as model input items and a plurality of climate factor values as the model output item and the maximum river flow in the next medium- and long-term unit time period after the plurality of medium- and long-term unit time periods, and then a Transformer model is constructed, and a plurality of sample data are applied. This data is used to train the model and obtain a prediction model for the maximum river flow within a section. Finally, the maximum river flow within the target river section in the most recent medium- and long-term unit time periods and multiple climate factor values are imported into the prediction model to obtain the predicted value of the maximum river flow within the target river section in the next medium- and long-term unit time period in the future and use it as the medium- and long-term flood forecast result. In this way, the Transformer model can be used to process and identify long-distance dependencies in time series data, solve problems that are difficult to cover with traditional hydrological prediction models, and thus improve the accuracy of medium- and long-term flood predictions, better adapt to rapidly changing environmental conditions, and enhance the universality of the model, facilitating practical application and promotion.
[0083] like Figure 3 As shown, the second aspect of this embodiment provides a virtual device for implementing the medium- and long-term flood forecasting method described in the first aspect, including a time series data acquisition unit, a sample data extraction unit, a model construction unit, a model training unit, a model application unit and a result display unit;
[0084] The time series data acquisition unit is used to acquire river flow time series data and climate factor time series data, wherein the river flow time series data contains a plurality of medium- and long-term unit time periods that are sequentially continuous in time series and the maximum river flow in each of the plurality of medium- and long-term unit time periods, and the climate factor time series data contains the plurality of medium- and long-term unit time periods and a plurality of climate factor values in each of the medium- and long-term unit time periods;
[0085] The sample data extraction unit is communicatively connected to the time series data acquisition unit, and is used to extract multiple sample data from the river flow time series data and the climate factor time series data in the following manner: extract the maximum river flow and multiple climate factor values in k medium- and long-term unit time periods that are sequentially continuous in time series from the river flow time series data and the climate factor time series data as model input items, and extract the maximum river flow in the next medium- and long-term unit time period after the k medium- and long-term unit time periods from the river flow time series data as model output items, and then use the model input item and the model output item as a sample data, wherein k represents a positive integer greater than or equal to 2 and less than K, and K represents the total number of time periods of the multiple medium- and long-term unit time periods;
[0086] The model building unit is used to build a Transformer model;
[0087] The model training unit is respectively connected to the sample data extraction unit and the model construction unit for applying the plurality of sample data to perform model training on the Transformer model to obtain a maximum river flow prediction model within the segment;
[0088] The time series data acquisition unit is further used to acquire the maximum river flow of the target river section in the latest k medium- and long-term unit time periods, and also to acquire multiple climate factor values in the latest k medium- and long-term unit time periods, wherein the latest k medium- and long-term unit time periods are sequentially continuous in time series;
[0089] The model application unit is respectively connected to the time series data acquisition unit and the model training unit for communication, and is used to import the maximum river flow in the segment of the most recent k medium- and long-term unit time periods and multiple climate factor values into the maximum river flow prediction model in the segment, and output the maximum river flow prediction value in the target river segment in the next medium- and long-term unit time period in the future, wherein the next medium- and long-term unit time period in the future refers to the next medium- and long-term unit time period after the most recent k medium- and long-term unit time periods;
[0090] The result display unit is communicatively connected to the model application unit, and is used to output and display the predicted value of the maximum river flow in the section as the medium- and long-term flood forecast result of the target river section in the next medium- and long-term unit time period in the future.
[0091] The working process, working details and technical effects of the aforementioned device provided in the second aspect of this embodiment can be referred to the medium- and long-term flood forecasting method described in the first aspect, and will not be described in detail here.
[0092] like Figure 4As shown, the third aspect of this embodiment provides a computer device for executing the medium- and long-term flood forecasting method as described in the first aspect, including a memory, a processor and a transceiver that are sequentially connected in communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the medium- and long-term flood forecasting method as described in the first aspect. For example, the memory may include, but is not limited to, a random access memory (Random-Access Memory, RAM), a read-only memory (Read-Only Memory, ROM), a flash memory (Flash Memory), a first-in-first-out memory (First Input First Output, FIFO) and / or a first-in-last-out memory (First Input Last Output, FILO), etc.; the processor may include, but is not limited to, a microprocessor of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power module, a display screen and other necessary components.
[0093] The working process, working details and technical effects of the aforementioned computer device provided in the third aspect of this embodiment can be referred to the medium- and long-term flood forecasting method described in the first aspect, and will not be described in detail here.
[0094] In a fourth aspect of this embodiment, there is provided a computer-readable storage medium storing instructions including the medium- and long-term flood forecasting method as described in the first aspect, that is, the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the medium- and long-term flood forecasting method as described in the first aspect is executed. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to computer-readable storage media such as floppy disks, optical disks, hard disks, flash memories, USB flash drives, and / or memory sticks, and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0095] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in the fourth aspect of this embodiment can be referred to the medium- and long-term flood forecasting method described in the first aspect, and will not be repeated here.
[0096] A fifth aspect of this embodiment provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the medium- and long-term flood forecasting method as described in the first aspect. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0097] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A medium- to long-term flood forecasting method, characterized in that: include: Acquire river flow time series data and climate factor time series data, wherein the river flow time series data contains a plurality of medium- and long-term unit time periods that are sequentially continuous in time series and the maximum river flow in each of the plurality of medium- and long-term unit time periods, and the climate factor time series data contains the plurality of medium- and long-term unit time periods and a plurality of climate factor values in each of the medium- and long-term unit time periods; A plurality of sample data are extracted from the river flow time series data and the climate factor time series data in the following manner: the maximum river flow and a plurality of climate factor values in k consecutive medium- and long-term unit time periods in time are extracted from the river flow time series data and the climate factor time series data as model input items, and the maximum river flow in the next medium- and long-term unit time period after the k medium- and long-term unit time periods is extracted from the river flow time series data as a model output item, and then the model input item and the model output item are taken as a sample data, wherein k represents a positive integer greater than or equal to 2 and less than K, and K represents the total number of time periods of the plurality of medium- and long-term unit time periods; Build the Transformer model; Using the plurality of sample data to perform model training on the Transformer model, and obtaining a maximum river flow prediction model within the section; Obtaining the maximum river flow of the target river section in the latest k medium- and long-term unit time periods, and also obtaining multiple climate factor values in the latest k medium- and long-term unit time periods, wherein the latest k medium- and long-term unit time periods are sequentially continuous in time sequence; Importing the maximum river flow in the segment of the most recent k medium- and long-term unit time periods and multiple climate factor values into the maximum river flow prediction model in the segment, and outputting the predicted value of the maximum river flow in the segment of the target river segment in the next medium- and long-term unit time period in the future, wherein the next medium- and long-term unit time period in the future refers to the next medium- and long-term unit time period after the most recent k medium- and long-term unit time periods; The predicted value of the maximum river flow in the section is used as the medium- and long-term flood forecast result of the target river section in the next medium- and long-term unit time period in the future and is output and displayed.
2. The medium- and long-term flood forecasting method according to claim 1, characterized in that: The medium- to long-term unit period refers to a period that includes at least four natural days that are consecutive in time sequence.
3. The medium- and long-term flood forecasting method according to claim 1, characterized in that: The multiple climate factor values include the western Pacific subtropical high intensity index value, the Indo-Myanmar trough intensity index value, the Tibet Plateau-1 index value, the tropical Indian Ocean sea surface temperature dipole index value, the subtropical South Indian Ocean dipole index value, the NINO 3.4 region sea surface temperature anomaly index value and / or the sunspot index value.
4. The medium- and long-term flood forecasting method according to claim 1, characterized in that: After obtaining the river flow time series data and the climate factor time series data and before extracting the sample data, the method further includes: A forward filling method is used to fill in missing values in the original time series data, wherein the original time series data refers to the originally acquired river flow time series data and / or the climate factor time series data.
5. The medium- and long-term flood forecasting method according to claim 1, characterized in that: After obtaining the river flow time series data and the climate factor time series data and before extracting the sample data, the method further includes: For each climate factor value in the plurality of climate factor values, standardization is performed according to the following formula: In the formula, represents a positive integer, Indicates the first of the multiple climate factor values The original value of the climate factor value, Indicates that The statistical average value of the climate factor corresponding to the climate factor value, Indicates that The statistical standard deviation of the climate factor corresponding to the climate factor value, Indicates the The value obtained by standardizing the values of the climate factors.
6. The medium- and long-term flood forecasting method according to claim 1, characterized in that: Build the Transformer model, including: Adopting self-attention mechanism in Transformer model; A multi-head attention mechanism is used in each encoder layer and each decoder layer of the Transformer model to process data in parallel.
7. A medium- to long-term flood forecasting device, characterized in that: It includes a time series data acquisition unit, a sample data extraction unit, a model construction unit, a model training unit, a model application unit and a result display unit; The time series data acquisition unit is used to acquire river flow time series data and climate factor time series data, wherein the river flow time series data contains a plurality of medium- and long-term unit time periods that are sequentially continuous in time series and the maximum river flow in each of the plurality of medium- and long-term unit time periods, and the climate factor time series data contains the plurality of medium- and long-term unit time periods and a plurality of climate factor values in each of the medium- and long-term unit time periods; The sample data extraction unit is communicatively connected to the time series data acquisition unit, and is used to extract multiple sample data from the river flow time series data and the climate factor time series data in the following manner: extract the maximum river flow and multiple climate factor values in k medium- and long-term unit time periods that are sequentially continuous in time series from the river flow time series data and the climate factor time series data as model input items, and extract the maximum river flow in the next medium- and long-term unit time period after the k medium- and long-term unit time periods from the river flow time series data as model output items, and then use the model input item and the model output item as a sample data, wherein k represents a positive integer greater than or equal to 2 and less than K, and K represents the total number of time periods of the multiple medium- and long-term unit time periods; The model building unit is used to build a Transformer model; The model training unit is respectively connected to the sample data extraction unit and the model construction unit for applying the plurality of sample data to perform model training on the Transformer model to obtain a maximum river flow prediction model within the segment; The time series data acquisition unit is further used to acquire the maximum river flow of the target river section in the latest k medium- and long-term unit time periods, and also to acquire multiple climate factor values in the latest k medium- and long-term unit time periods, wherein the latest k medium- and long-term unit time periods are sequentially continuous in time series; The model application unit is respectively connected to the time series data acquisition unit and the model training unit for communication, and is used to import the maximum river flow in the segment of the most recent k medium- and long-term unit time periods and multiple climate factor values into the maximum river flow prediction model in the segment, and output the maximum river flow prediction value in the target river segment in the next medium- and long-term unit time period in the future, wherein the next medium- and long-term unit time period in the future refers to the next medium- and long-term unit time period after the most recent k medium- and long-term unit time periods; The result display unit is communicatively connected to the model application unit, and is used to output and display the predicted value of the maximum river flow in the section as the medium- and long-term flood forecast result of the target river section in the next medium- and long-term unit time period in the future.
8. A computer device, characterized in that: It includes a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the medium- and long-term flood forecasting method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on the computer, the medium- and long-term flood forecasting method as described in any one of claims 1 to 6 is executed.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or the instruction is executed by a computer, the medium- and long-term flood forecasting method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Medium-and-long-term runoff ensemble forecasting method
CN110555561A
Conv-Transform-based flood forecasting method
CN114819386A
Flood prediction method and device, electronic equipment and readable storage medium
CN117556255A
Method and system for determining common image point matching pair using diffusion model
KR102734160B1
Cited By
Hydrological flow prediction method and system based on multi-station space-time correlation
CN120450119A
Flood prediction method and device
CN122525696A
A flood prediction method and apparatus
CN122525696B
