River flow calculation model construction method, river flow calculation method and device

By training a river flow calculation model using a deep learning model and utilizing downstream and current river cross-section datasets, the problem of low accuracy and efficiency in river flow calculation is solved, enabling fast, accurate, and automated calculations that support water resource management and flood control and disaster reduction.

CN116822228BActive Publication Date: 2025-01-10CHINA THREE GORGES CORPORATION +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310810963.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-03
Publication Date
2025-01-10
Estimated Expiration
2043-07-03

AI Technical Summary

Technical Problem

Existing technologies for calculating river flow have significant errors, low accuracy and efficiency, and make it difficult to achieve fast and accurate automated calculations.

Method used

By acquiring time-series datasets of water level and flow rate at downstream and current river cross-sections, a deep learning model is trained to generate a river flow calculation model, which includes a cascade of a first deep learning model and a second deep learning model. Data preprocessing and feature extraction are then performed to improve calculation accuracy.

Benefits of technology

It enables rapid and accurate river flow calculation, reduces the workload of manual data processing, improves calculation accuracy and generalization ability, and provides technical support for water resource management and flood control and disaster reduction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116822228B_ABST
    Figure CN116822228B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of hydrological calculation technology, and discloses a river flow calculation model construction method, a river flow calculation method and a device. The river flow calculation model construction method includes: obtaining a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set; based on the first water level time series data set, the second water level time series data set, and the water flow time series data set, training a river flow calculation model to be trained until preset conditions are met, and generating a river flow calculation model; wherein the river flow calculation model includes a first deep learning model and a second deep learning model. The technical solution of the present invention can realize fast and accurate automated river flow calculation, and provide technical support for water resources management, flood prevention and disaster reduction, etc.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hydrological calculation, and in particular to a method for constructing a river flow calculation model, a river flow calculation method and a device. Background Art

[0002] River flow is an important basic data for river hydrological calculations, water resources evaluation, and water ecological environment evaluation. River flow measurement and calculation is also an important part of hydrological work. The flow of natural rivers is complex and changeable, and it is very difficult to accurately calculate river flow in real time. The water level and flow of the river section have a certain degree of correspondence, but in most river stations, the water level-flow relationship is very complicated. Under different flow processes, the same water level may correspond to multiple flows. Through the loop curve, only the approximate range of the corresponding flow can be obtained according to the current water level, which relies heavily on relevant manual professional experience. Therefore, how to achieve fast and accurate automated river flow calculation has become a technical problem that needs to be solved urgently. Summary of the invention

[0003] In view of this, the present invention provides a river flow calculation model construction method, a river flow calculation method and a device to solve the problems of large errors in the river flow calculation process in related technologies, and low flow calculation accuracy and efficiency.

[0004] In a first aspect, the present invention provides a method for constructing a river flow calculation model, comprising: obtaining a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set; based on the first water level time series data set, the second water level time series data set, and the water flow time series data set, training a river flow calculation model to be trained until preset conditions are met, and generating a river flow calculation model; wherein the river flow calculation model includes a first deep learning model and a second deep learning model.

[0005] The method for constructing a river flow calculation model provided in this embodiment obtains the first water level time series data set at the downstream river section within the same time series, the second water level time series data set at the current river section, and the water flow time series data set corresponding to the second water level time series data set to train the river flow calculation model to be measured, generate a river flow calculation model, and calculate the river flow. On the one hand, it makes full use of historical flow and water level data to give play to the role of historical data; on the other hand, the influence of the downstream water level on the water level at the current station is considered in the flow calculation process, and the change trend of the hydraulic state of the current station can be inferred through the change of the downstream water level, which can better reflect the process characteristics of the non-constant flow of the river in a physical sense, and improve the calculation accuracy of the flow of the river section; on the other hand, it can realize fast and accurate automatic river flow calculation, which can provide technical support for water resources management, flood prevention and disaster reduction, etc.

[0006] In an optional embodiment, a river flow calculation model to be trained is trained based on a first water level time series dataset, a second water level time series dataset and a water flow time series dataset until preset conditions are met to generate a river flow calculation model, including: preprocessing the first water level time series dataset, the second water level time series dataset and the water flow time series dataset; inputting the preprocessed first water level time series dataset into a first deep learning model to generate hydraulic state information at a downstream river section; inputting the hydraulic state information at the downstream river section and the preprocessed second water level time series dataset into a second deep learning model to generate a water flow at a current river section, wherein the second deep learning model is cascaded with the first deep learning model; calculating a loss value based on the water flow at the current river section and the preprocessed water flow time series dataset until the loss value meets the preset conditions to generate a river flow calculation model.

[0007] The river flow calculation model construction method provided in this embodiment obtains data with good integrity, consistency and credibility by preprocessing the data, which can improve the calculation accuracy and generalization ability of the model.

[0008] In an optional implementation, preprocessing the first water level time series data set, the second water level time series data set, and the water flow time series data set includes:

[0009] The first water level time series data set, the second water level time series data set and the water flow time series data set are respectively processed with missing values ​​and normalized; the first water level time series data set, the second water level time series data set and the water flow time series data set after the missing value processing and normalization processing are subjected to time series segmentation processing to generate multiple sub-time series; the multiple sub-time series are subjected to randomization processing to generate a double water level data set.

[0010] The river flow calculation model construction method provided in this embodiment, on the one hand, obtains data with good integrity, consistency, and credibility through missing value processing and normalization processing, which can improve the calculation accuracy and generalization ability of the model; on the other hand, randomization processing of data can achieve data enhancement and increase the diversity of sample data.

[0011] In an optional embodiment, the first deep learning model includes an input layer, a hidden layer and an output layer; the second deep learning model includes a first neural network layer, a second neural network layer, a third neural network layer, a fourth neural network layer and a fifth neural network layer.

[0012] The river flow calculation model construction method provided in this embodiment sets up a multi-layer neural network layer, where different layers perform different functions, and each layer has a clear physical meaning and complements each other, thereby improving the accuracy of data feature extraction and thus improving the calculation accuracy of the model.

[0013] In an optional embodiment, the hydraulic state information and the second water level time series data set at the downstream river section are input into the second deep learning model to generate the water flow rate at the current river section, including: inputting the hydraulic state information at the downstream river section into the first neural network layer, and inputting the second water level time series data set into the second neural network layer to generate the hydraulic state information and the second water level time series data set at the downstream river section after dimension scaling; inputting the hydraulic state information and the second water level time series data set at the downstream river section after dimension scaling into the third neural network layer for data fusion to generate dual water level fusion data; wherein the dimension of the dual water level fusion data is the same as that of the fourth neural network layer; using the fourth neural network layer to extract features from the dual water level fusion data to generate a water flow rate information matrix at the current river section, inputting the water flow rate information matrix into the fifth neural network layer, and outputting the water flow rate at the current river section.

[0014] The method for constructing a river flow calculation model provided in this embodiment sets a multi-layer neural network layer, and different neural network layers perform different functions. The parameters of different neural network layers are jointly optimized during the training process. On the one hand, by extracting data features from the hydraulic state information at the input downstream river section and the second water level time series data set, and then fusing them to achieve the association between the two sets of input data, and then extracting the features of the fused data, the multi-layer setting can extract more data features, making it easier to learn the impact of the downstream water flow level on the water level at the current river section, as well as the relationship between the water level and flow at the current river section, thereby improving the calculation accuracy of the model; on the other hand, different layers perform different functions, and the physical meaning of each layer is clear and complementary, thereby improving the accuracy of data feature extraction, thereby improving the calculation accuracy of the model.

[0015] In a second aspect, the present invention provides a method for calculating river flow, comprising: obtaining measured water level data; inputting the measured water level data into a river flow calculation model constructed by any river flow calculation model construction method in the first aspect to generate a water flow at a river section to be calculated.

[0016] The river flow calculation method provided in this embodiment, on the one hand, can directly, quickly and accurately obtain the water flow at the river section to be measured by inputting the water level data to be measured into the river flow calculation model, thereby reducing the workload of manual data processing and being simple to operate and easy to popularize and promote; on the other hand, it can realize fast and accurate automated river section flow calculation, providing technical support for water resources management, flood prevention and disaster reduction, etc.

[0017] In a third aspect, the present invention provides a device for constructing a river flow calculation model, comprising: a first acquisition module, used to acquire a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set; a first generation module, used to train a river flow calculation model to be trained based on the first water level time series data set, the second water level time series data set, and the water flow time series data set until preset conditions are met to generate a river flow calculation model; wherein the river flow calculation model includes a first deep learning model and a second deep learning model.

[0018] In a fourth aspect, the present invention provides a river flow calculation device, comprising: a second acquisition module, used to obtain measured water level data; a second generation module, used to input the measured water level data into a river flow calculation model constructed by any river flow calculation model construction method in the first aspect, to generate the water flow at the river section to be calculated.

[0019] In a fifth aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the river flow calculation model construction method of the first aspect or any corresponding embodiment thereof, or the river flow calculation method of the second aspect by executing the computer instructions.

[0020] In a sixth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the river flow calculation model construction method of the first aspect or any corresponding embodiment thereof, or the river flow calculation method of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 is a flow chart of a method for constructing a river flow calculation model according to an embodiment of the present invention;

[0023] Figure 2 is a flow chart of another method for constructing a river flow calculation model according to an embodiment of the present invention;

[0024] Figure 3 is a flow chart of a method for calculating river flow according to an embodiment of the present invention;

[0025] Figure 4 is a relative error graph of a test set of a method for constructing a river flow calculation model according to an embodiment of the present invention;

[0026] Figure 5 is a relative error graph of a test set of a method for constructing a river flow calculation model according to an embodiment of the present invention;

[0027] Figure 6 is a test set absolute error graph of a method for constructing a river flow calculation model according to an embodiment of the present invention;

[0028] Figure 7 is a comparison between the measured flow value and the model calculated value of the test set flow of the river flow calculation model construction method according to an embodiment of the present invention;

[0029] Figure 8 is a structural block diagram of a device for constructing a river flow calculation model according to an embodiment of the present invention;

[0030] Fig. 9 is a structural block diagram of a river flow calculation device according to an embodiment of the present invention;

[0031] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0033] The method for constructing a river flow calculation model provided in this specification can be applied to electronic devices at river detection sites. The electronic devices may include, but are not limited to, notebooks, desktop computers, smart phones, tablet computers, etc. Of course, the method for constructing a river flow calculation model provided in this specification can also be applied to applications running in the above electronic devices. The electronic device can be applied to any scenario where river flow calculation is to be performed to achieve fast and accurate calculation of water flow.

[0034] An embodiment of the present invention provides a method for constructing a river flow calculation model. By acquiring dual water level data, the river flow calculation model is trained, and the trained river flow calculation model is used to calculate the water flow at the river section to be measured so as to achieve the effect of accurately calculating the water flow at the river section to be measured.

[0035] According to an embodiment of the present invention, an embodiment of a method for constructing a river flow calculation model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] In this embodiment, a method for constructing a river flow calculation model is provided, which can be used in the above-mentioned electronic devices, such as notebooks, desktop computers, smart phones, tablet computers, etc. Figure 1 is a flow chart of a method for constructing a river flow calculation model according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0037] Step S101, obtaining a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set.

[0038] Specifically, according to the river station where the river flow calculation method is applied, the historical flow time series of the station, the water level time series of the station, and the water level time series at the downstream river section of the station are collected. The specific acquisition method can refer to relevant mature technologies, such as the compiled data obtained by traditional methods, which will not be repeated here.

[0039] Step S102, based on the first water level time series data set, the second water level time series data set and the water flow time series data set, the river flow calculation model to be trained is trained until the preset conditions are met, and the river flow calculation model is generated; wherein the river flow calculation model includes a first deep learning model and a second deep learning model.

[0040] Specifically, the first water level time series data set, the second water level time series data set and the water flow time series data set obtained are divided into a training set and a test set, and the training set is used to train the river flow calculation model to be trained. After the preliminary training, the test set is used to test the preliminarily trained river flow calculation model. The preset condition may be the calculation loss value or error size of the river flow calculation model. When the test result meets the preset condition, the model is saved, otherwise the training continues. The river flow calculation model includes a first deep learning model and a second deep learning model.

[0041] The river flow calculation method provided in this embodiment obtains the first water level time series data set at the downstream river section within the same time series, the second water level time series data set at the current river section, and the water flow time series data set corresponding to the second water level time series data set to train the river flow calculation model to be measured, generate a river flow calculation model, and calculate the river flow. On the one hand, it makes full use of historical flow and water level data to give play to the role of historical data; on the other hand, the influence of the downstream water level on the water level at the current station is considered in the flow calculation process, and the change trend of the hydraulic state of the current station can be inferred through the change of the downstream water level, which can better reflect the process characteristics of the non-constant flow of the river in a physical sense and improve the flow calculation accuracy; on the other hand, it can realize fast and accurate automatic river flow calculation, and provide technical support for water resources management, flood prevention and disaster reduction, etc.

[0042] In this embodiment, a method for constructing a river flow calculation model is provided, which can be used in the above-mentioned electronic devices, such as notebooks, desktop computers, smart phones, tablet computers, etc. Figure 2is a flow chart of a method for constructing a river flow calculation model according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0043] Step S201, obtain the first water level time series data set at the downstream river section within the same time series, the second water level time series data set at the current river section, and the water flow time series data set corresponding to the second water level time series data set. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0044] Step S202, based on the first water level time series data set, the second water level time series data set and the water flow time series data set, the river flow calculation model to be trained is trained until the preset conditions are met, and the river flow calculation model is generated; wherein the river flow calculation model includes a first deep learning model and a second deep learning model.

[0045] Specifically, the above step S202 includes:

[0046] Step S2021, preprocessing the first water level time series data set, the second water level time series data set and the water flow time series data set.

[0047] Specifically, preprocessing includes but is not limited to cleaning and transforming the first water level time series data set, the second water level time series data set, and the water flow time series data set at a unified time interval of Δt, such as Δt=1h. By preprocessing the data, data with good integrity, consistency, and credibility can be obtained, which can improve the calculation accuracy and generalization ability of the model.

[0048] Specifically, the above step S2021 includes:

[0049] Step a1: perform missing value processing and normalization processing on the first water level time series data set, the second water level time series data set and the water flow time series data set respectively.

[0050] Specifically, missing value processing includes but is not limited to using interpolation, KNN (K-Nearest Neighbor, K nearest neighbor method), or random forest for filling. Normalization can use Minmax (a function for data normalization processing). Those skilled in the art can determine the missing value processing and normalization processing methods according to actual conditions, and are not limited here. As an optional implementation, this embodiment uses python (a programming language) programming language and sklearn (an open source machine learning toolkit based on python language) machine learning library to process data.

[0051] Specifically, the first water level time series data set, the second water level time series data set, and the water flow time series data set are scaled separately using MinMaxScaler() (a function for data normalization processing). On the one hand, the relative size of the data in each time series can be guaranteed, and on the other hand, the sizes of the water level time series and the flow time series are at the same order of magnitude, which is convenient for the deep learning model to learn the nonlinear relationship therein. If the range is set to [0, 5], compared with the default [0, 1], it has a larger data range and is more sensitive when calculating the loss value. By processing missing values ​​and normalizing, data with good integrity, consistency, and credibility can be obtained, which can improve the calculation accuracy and generalization ability of the model.

[0052] Step a2, performing time series segmentation processing on the first water level time series data set, the second water level time series data set and the water flow time series data set after the missing value processing and the normalization processing, to generate multiple sub-time series.

[0053] Specifically, the first water level time series data set, the second water level time series data set and the water flow time series data set are segmented to generate multiple sub-time series, each sub-sequence has a length of n, that is, contains n groups of water level and flow data, and the total time length is n×Δt.

[0054] Step a3: randomize the order of multiple sub-time series to generate a double water level data set.

[0055] Specifically, the order of the sub-time series after the water level and flow time series are split is randomized, and the corresponding relationship between time, water level and flow in the sub-time series remains unchanged. This can achieve data enhancement and increase the diversity of training samples, making it easier for the deep learning model to fully learn the features therein and improve the accuracy of the model calculation.

[0056] Step S2022: input the preprocessed first water level time series data set into the first deep learning model to generate hydraulic state information at the downstream river section.

[0057] Specifically, the first deep learning model includes an input layer, a hidden layer, and an output layer. As an optional implementation, the input layer can be a linear layer with 1 layer; the hidden layer can be a BiGRU (Bidirectional Gated Recurrent Units) layer with 2 layers, and the number of neurons in the hidden layer can be 128; the output layer can be a linear layer with 1 layer; the loss function can select MSE (Nean Square Error); the optimizer can select Adam (a random optimization algorithm); the activation function can select Hardtanh (an activation function), and the interval is set to [-1, 1]. Those skilled in the art can make a determination based on actual conditions, and there is no limitation here. The output of the first deep learning model may include hydraulic status information at the downstream river section, and the hydraulic status information may include the changing trend of the water level, such as whether it is flooded or backwatered.

[0058] Step S2023, input the hydraulic state information at the downstream river section and the preprocessed second water level time series data set into the second deep learning model to generate the water flow at the current river section; wherein the second deep learning model is cascaded with the first deep learning model.

[0059] Specifically, the above step S2023 includes:

[0060] Step b1, input the hydraulic state information at the downstream river section into the first neural network layer, and input the second water level time series data set into the second neural network layer, to generate the hydraulic state information at the downstream river section and the second water level time series data set after dimension scaling.

[0061] Specifically, as an optional implementation, five neural network layers can be set in the second deep learning model, the first neural network layer scales the dimension corresponding to the input hydraulic state information at the downstream river section, and the second neural network layer scales the dimension corresponding to the input second water level time series data set. The specific scaling scale can be determined according to the dimension of the fourth neural network layer, such as the first neural network layer scales the dimension corresponding to the input hydraulic state information at the downstream river section to 1 / 2 of the dimension of the fourth neural network layer, and the second neural network layer scales the dimension corresponding to the input second water level time series data set to 1 / 2 of the dimension of the fourth neural network layer. The specific scaling method can be determined by those skilled in the art according to actual conditions, and is not limited here.

[0062] Step b2, input the dimensionally scaled hydraulic state information at the downstream river section and the second water level time series data set into the third neural network layer for data fusion to generate dual water level fusion data; wherein the dimension of the dual water level fusion data is the same as that of the fourth neural network layer.

[0063] Specifically, the third neural network layer fuses the hydraulic state information at the downstream river section after dimension scaling and the second water level time series dataset to generate dual water level fusion data.

[0064] Step b3, use the fourth neural network layer to extract features from the dual water level fusion data, generate a water flow information matrix at the current river section, input the water flow information matrix into the fifth neural network layer, and output the water flow at the current river section.

[0065] Specifically, the features extracted by the fourth neural network layer according to the dual water level fusion data may include hydraulic state information at the downstream river section and hydraulic state information at the current river section. The river flow calculation method provided in this embodiment sets a multi-layer neural network layer, and different neural network layers perform different functions, and the parameters of different neural network layers are jointly optimized during the training process. On the one hand, by extracting data features from the hydraulic state information at the input downstream river section and the second water level time series data set, and then fusing them to achieve the association of the two sets of input data, and then extracting the features of the fused data, the multi-layer setting can extract more data features, and it is easier to learn the impact of the downstream water flow level on the water level at the current river section, as well as the relationship between the water level and flow at the current river section, thereby improving the calculation accuracy of the model; on the other hand, different layers perform different functions, and the physical meaning of each layer is clear and complementary, thereby improving the accuracy of data feature extraction, thereby improving the calculation accuracy of the model.

[0066] Step S2024, calculating the loss value based on the water flow at the current river section and the preprocessed water flow time series data set until the loss value meets the preset conditions, and generating a river flow calculation model.

[0067] Specifically, the loss value is calculated based on the water flow at the current river section and the preprocessed water flow time series data set. If the loss value does not meet the preset conditions, such as the preset condition that the relative error is within 5%, the loss value gradient is fed back, and the internal parameters of the first deep learning model and the second deep learning model are adjusted until the loss value meets the preset conditions to generate a river flow calculation model.

[0068] The river flow calculation model construction method provided in this embodiment obtains data with good integrity, consistency and credibility by preprocessing the data, which can improve the calculation accuracy and generalization ability of the model.

[0069] According to an embodiment of the present invention, a method for calculating river flow is provided, which can be used in the above-mentioned electronic devices, such as notebooks, desktop computers, smart phones, tablet computers, etc. Figure 3is a flow chart of a method for calculating river flow according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0070] Step S301, obtaining measured water level data.

[0071] Step S302, inputting the measured water level data into a river flow calculation model constructed by any river flow calculation model construction method to generate the water flow at the river section to be calculated.

[0072] Specifically, the measured water level data includes the water level time series at the river section at the current water flow position and the water level time series at the river section at the downstream water flow position. The water level time series at the river section at the current water flow position and the water level time series at the river section at the downstream water flow position are input into the river flow calculation model to generate the water flow at the current river section.

[0073] The river flow calculation method provided in this embodiment, on the one hand, can directly, quickly and accurately obtain the water flow at the river section to be measured by inputting the water level data to be measured into the river flow calculation model, thereby reducing the workload of manual data processing and being simple to operate and easy to popularize and promote; on the other hand, it can realize fast and accurate automated river section flow calculation, providing technical support for water resources management, flood prevention and disaster reduction, etc.

[0074] The following is a specific example to illustrate the construction of a river flow calculation model and a river flow calculation method.

[0075] Embodiment 1:

[0076] First, a station with obvious non-constant characteristics of a large domestic river section is selected to collect the historical flow time series Q of the station, the water level time series H2 of the station, and the water level time series H1 about 1 km downstream of the station; in order to ensure the long-term stable operation of the model, the test set data needs to be more than half a year; Figure 4 Shown is the historical flow versus water level for this site.

[0077] Preprocess the historical flow time series and water level time series, including unifying the time interval to Δt, processing missing values, normalization, etc., and divide the data into training set and test set; if the time interval is unified to Δt = 1h, missing values ​​are processed, and Minmax (a function for data normalization) is used for normalization. This step can be completed using the python (a programming language) programming language and the sklearn (an open source machine learning toolkit based on the python language) machine learning library. Use a MinMaxScaler() (a function for data normalization) to scale the downstream water level time series H1, the water level time series H2 at the current site, and the flow time series Q at the current site separately. This can ensure the relative size of each sequence, and can also make the size of the water level time series and the flow time series at the same order of magnitude, which is more convenient for the network to learn the nonlinear relationship therein; if the range is set to [0,5], compared with the default [0,1], it has a larger data range and is more sensitive when calculating the loss value; divide the data into training set and test set;

[0078] Slice the water level and flow time series to generate multiple subsequences. Each subsequence has a length of n, that is, it contains n groups of water level and flow data, and the total time length is n×Δt. For example, n=72;

[0079] The order of the subsequences after slicing the water level and flow time series is randomized, and the corresponding relationship between time, water level and flow in the subsequence remains unchanged;

[0080] Secondly, build a deep learning neural network framework, including a two-level architecture of the first deep learning model and the second deep learning model. The deep learning neural network framework can be built using the python (a programming language) programming language and the pytorch (an open source deep learning framework) library. Specifically:

[0081] Step c1, building a two-level deep learning model overall architecture, stipulating that the network architecture accepts two input variables to accept double water level time series input;

[0082] Step c2, the first deep learning model receives the downstream water level time series H1 and outputs the hidden state of the fourth neural network layer of the network;

[0083] Step c3, the second deep learning model receives the water level time series H2 at the upstream site and the hidden state variables output by the first deep learning model, and uses the output of the second deep learning model as the output variable of the overall architecture;

[0084] It should be noted that there are three ways to input the hidden state output by the first deep learning model into the second deep learning model: fuse the hidden state output by the first deep learning model with the water level time series H2 at the upstream site; directly input the hidden state output by the first deep learning model into the fourth neural network layer of the neural network in the second deep learning model as its initial hidden state; combine the first two, that is, fuse the hidden state output by the first deep learning model with the water level time series H2 at the upstream site as input variables, and also directly input the hidden state output by the first deep learning model into the fourth neural network layer of the neural network in the second deep learning model as its initial hidden state;

[0085] Set neural network hyperparameters related to neural network training, including determining the number of layers, the number of nodes in the input layer and output layer, the loss function, the optimizer, the activation function, the number of training rounds, etc.

[0086] To ensure the training effect and training efficiency, you can select the following parameters and training methods: the input layer is a neural network layer with 1 layer; the hidden layer is a BiGRU (Bidirectional Gated Recurrent Units) layer with 2 layers and 128 neurons in the hidden layer; the output layer is a neural network layer with 1 layer; and the loss function is MSE (Nean Square Error); the optimizer is Adam (a random optimization algorithm); the activation function is Hardtanh (an activation function), and the interval is set to [-1,1]. Compared with tanh (hyperbolic tangent), it has higher computational efficiency and accuracy.

[0087] In the first deep learning model, the input layer can be set with a linear layer to expand the dimension of H1 to the same dimension as the hidden layer, and then the expanded H1 is input into the hidden layer, and then the hidden state is output through the output layer;

[0088] The second deep learning model sets up five neural network layers. The first layer is used to expand the H2 dimension to 1 / 2 of the same dimension of the fourth neural network layer. The second layer scales the hidden state of the first deep learning model to 1 / 2 of the same dimension of the fourth neural network layer. The third layer fuses the variables output by the first two neural network layers for input into the fourth neural network layer in the second deep learning model. The fifth neural network layer aggregates the output variables of the fourth neural network layer in the second deep learning model into the output result of the overall network architecture.

[0089] Next, set the training mode, specifically:

[0090] Step d1, set the network architecture initialization function to initialize all network parameters; you can choose the xavier initialization function to speed up the convergence of the network architecture;

[0091] Step d2, setting the network architecture to training mode;

[0092] Step d3, in each round of training, a batch of downstream water level time series H1, upstream water level time series H2 and upstream flow time series Q in the same time period are input, H1 and H2 are used as input variables, and Q is used as the target variable;

[0093] Step d4, input H1 and H2 into the neural network for calculation, calculate the loss value of the output sequence and Q, and update the network parameters;

[0094] After training is completed, the flow calculation effect of the model is tested using the test set. The measured flow value of the test set is compared with the model calculation value. If the relative error is within 5%, the model is saved. Otherwise, the training continues. Figure 5 , Figure 6 , Figure 7 shown.

[0095] Finally, the trained model is deployed on the electronic equipment of the application site. The water level measured at the site is formed into a time series of length n, and input into the model, then the corresponding flow time series of length n can be obtained;

[0096] It should be noted that time series with different subsequence lengths n can be selected as input models, and the optimal subsequence length n can be selected by comparing training errors, comprehensively considering training efficiency and model accuracy. During the model application process, the compiled data obtained by traditional methods can be integrated into the training set, and the relationship between the real-time water level time series and the flow time series can be incorporated into the model to continuously improve the adaptability and calculation accuracy of the model.

[0097] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0098] In this embodiment, a river flow calculation device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0099] This embodiment provides a device for constructing a river flow calculation model. Figure 8 As shown, including:

[0100] The first acquisition module 801 is used to acquire a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set.

[0101] The first generation module 802 is used to train the river flow calculation model to be trained based on the first water level time series data set, the second water level time series data set and the water flow time series data set until the preset conditions are met, and generate the river flow calculation model; wherein the river flow calculation model includes a first deep learning model and a second deep learning model.

[0102] In some optional implementations, the first generating module 802 includes:

[0103] The first preprocessing submodule is used to preprocess the first water level time series data set, the second water level time series data set and the water flow time series data set.

[0104] The first input submodule is used to input the preprocessed first water level time series data set into the first deep learning model to generate hydraulic state information at the downstream river section.

[0105] The second input submodule is used to input the hydraulic state information at the downstream river section and the preprocessed second water level time series data set into the second deep learning model to generate the water flow at the current river section; wherein the second deep learning model is cascaded with the first deep learning model.

[0106] The first generation submodule is used to calculate the loss value based on the water flow at the current river section and the preprocessed water flow time series data set until the loss value meets the preset conditions, thereby generating a river flow calculation model.

[0107] In some optional implementations, the first preprocessing submodule includes:

[0108] The first preprocessing unit is used to perform missing value processing and normalization processing on the first water level time series data set, the second water level time series data set and the water flow time series data set respectively.

[0109] The segmentation unit is used to perform time series segmentation processing on the first water level time series data set, the second water level time series data set and the water flow time series data set after the missing value processing and the normalization processing, so as to generate multiple sub-time series.

[0110] The randomization processing unit is used to perform randomization processing on the order of multiple sub-time series to generate a double water level data set.

[0111] In some optional embodiments, the first deep learning model includes an input layer, a hidden layer, and an output layer; the second deep learning model includes a first neural network layer, a second neural network layer, a third neural network layer, a fourth neural network layer, and a fifth neural network layer.

[0112] In some optional embodiments, the second input module includes:

[0113] The first input unit is used to input the hydraulic state information at the downstream river section into the first neural network layer, and input the second water level time series data set into the second neural network layer, so as to generate the hydraulic state information at the downstream river section and the second water level time series data set after dimension scaling.

[0114] The second input unit is used to input the hydraulic state information at the downstream river section after dimension scaling and the second water level time series data set into the third neural network layer for data fusion to generate dual water level fusion data; wherein the dimension of the dual water level fusion data is the same as the dimension of the fourth neural network layer.

[0115] The first generating unit is used to extract features from the dual water level fusion data using the fourth neural network layer, generate a water flow information matrix at the current river section, input the water flow information matrix into the fifth neural network layer, and output the water flow at the current river section.

[0116] This embodiment provides a device for constructing a river flow calculation model. Fig. 9 As shown, including:

[0117] The second acquisition module 901 is used to acquire measured water level data;

[0118] The second generation module 902 is used to input the measured water level data into a river flow calculation model constructed by any river flow calculation model construction method to generate the water flow at the river section to be calculated.

[0119] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.

[0120] In this embodiment, a river flow calculation model construction and a river flow calculation device are presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0121] The embodiment of the present invention also provides a computer device having the above Figure 8 The river flow calculation model building device shown in the figure, or the above Fig. 9 The river flow calculation device shown.

[0122] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.

[0123] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0124] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0125] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0126] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0127] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0128] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0129] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0130] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for constructing a river flow calculation model, characterized in that: include: Acquire a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set; Based on the first water level time series data set, the second water level time series data set and the water flow time series data set, the river flow calculation model to be trained is trained until the preset conditions are met, and the river flow calculation model is generated; wherein the river flow calculation model includes a first deep learning model and a second deep learning model; the first deep learning model includes an input layer, a hidden layer and an output layer; the second deep learning model includes a first neural network layer, a second neural network layer, a third neural network layer, a fourth neural network layer and a fifth neural network layer; The method of training the river flow calculation model to be trained based on the first water level time series data set, the second water level time series data set and the water flow time series data set until a preset condition is met to generate a river flow calculation model includes: Preprocessing the first water level time series data set, the second water level time series data set and the water flow time series data set; Inputting the preprocessed first water level time series data set into the first deep learning model to generate hydraulic state information at the downstream river section; Inputting the hydraulic state information at the downstream river section and the preprocessed second water level time series data set into the second deep learning model to generate the water flow at the current river section; wherein the second deep learning model is cascaded with the first deep learning model; Calculating a loss value based on the water flow at the current river section and the preprocessed water flow time series data set until the loss value meets a preset condition, thereby generating a river flow calculation model; The step of inputting the hydraulic state information at the downstream river section and the second water level time series data set into the second deep learning model to generate the water flow at the current river section includes: Inputting the hydraulic state information at the downstream river section into the first neural network layer, and inputting the second water level time series data set into the second neural network layer, to generate the hydraulic state information at the downstream river section and the second water level time series data set after dimension scaling; Input the dimensionally scaled hydraulic state information at the downstream river section and the second water level time series data set into the third neural network layer for data fusion to generate dual water level fusion data; wherein the dimension of the dual water level fusion data is the same as that of the fourth neural network layer; The fourth neural network layer is used to extract features from the dual water level fusion data to generate a water flow information matrix at the current river section, and the water flow information matrix is ​​input into the fifth neural network layer to output the water flow at the current river section.

2. The method according to claim 1, characterized in that The preprocessing of the first water level time series data set, the second water level time series data set and the water flow time series data set includes: Performing missing value processing and normalization processing on the first water level time series data set, the second water level time series data set, and the water flow time series data set respectively; Performing time series segmentation processing on the first water level time series data set, the second water level time series data set and the water flow time series data set after missing value processing and normalization processing to generate multiple sub-time series; The order of the multiple sub-time series is randomized to generate a dual water level data set.

3. A method for calculating river flow, characterized in that: include: Obtain measured water level data; The measured water level data is input into the river flow calculation model constructed by the river flow calculation model construction method as described in claim 1 or 2 to generate the water flow at the river section to be calculated.

4. A device for constructing a river flow calculation model, characterized in that: The device comprises: A first acquisition module is used to acquire a first water level time series data set at a downstream river section within the same time series, a second water level time series data set at a current river section, and a water flow time series data set corresponding to the second water level time series data set; A first generating module is used to train the river flow calculation model to be trained based on the first water level time series data set, the second water level time series data set and the water flow time series data set until a preset condition is met, thereby generating a river flow calculation model; wherein the river flow calculation model includes a first deep learning model and a second deep learning model; the first deep learning model includes an input layer, a hidden layer and an output layer; the second deep learning model includes a first neural network layer, a second neural network layer, a third neural network layer, a fourth neural network layer and a fifth neural network layer; The first generation module includes: A first preprocessing submodule, used for preprocessing the first water level time series data set, the second water level time series data set and the water flow time series data set; A first input submodule, used to input the preprocessed first water level time series data set into the first deep learning model to generate hydraulic state information at the downstream river section; A second input submodule is used to input the hydraulic state information at the downstream river section and the preprocessed second water level time series data set into a second deep learning model to generate the water flow at the current river section; wherein the second deep learning model is cascaded with the first deep learning model; The first generation submodule is used to calculate the loss value based on the water flow at the current river section and the preprocessed water flow time series data set until the loss value meets the preset conditions, thereby generating a river flow calculation model; The second input module includes: A first input unit is used to input the hydraulic state information at the downstream river section into the first neural network layer, and input the second water level time series data set into the second neural network layer, so as to generate the hydraulic state information at the downstream river section and the second water level time series data set after dimension scaling; The second input unit is used to input the hydraulic state information at the downstream river section after dimension scaling and the second water level time series data set into the third neural network layer for data fusion to generate double water level fusion data; wherein the dimension of the double water level fusion data is the same as the dimension of the fourth neural network layer; The first generating unit is used to extract features from the dual water level fusion data using the fourth neural network layer, generate a water flow information matrix at the current river section, input the water flow information matrix into the fifth neural network layer, and output the water flow at the current river section.

5. A river flow calculation device, characterized in that: The device comprises: The second acquisition module is used to obtain the measured water level data; The second generation module is used to input the measured water level data into the river flow calculation model constructed by the river flow calculation model construction method as described in claim 1 or 2, and generate the water flow at the river section to be calculated.

6. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the river flow calculation model construction method described in claim 1 or 2, or executes the river flow calculation method described in claim 3 by executing the computer instructions.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the river flow calculation model construction method described in claim 1 or 2, or execute the river flow calculation method described in claim 3.

Citation Information

Patent Citations

  • River flow monitoring data quality control method based on chaotic neural network

    CN108510072A

  • River ecological flow monitoring method based on remote sensing technology

    CN111401529A