A River Flow Velocity Measurement Method Based on LSTM and SVM

By combining LSTM and SVM models, the problems of inaccurate model accuracy and inaccurate identification of key vertical lines in traditional river flow velocity measurement are solved, achieving high-precision flow calculation and spatiotemporal continuity.

CN121009304BActive Publication Date: 2026-01-30ANSHUN HYDROLOGY & WATER RESOURCES BUREAU OF GUIZHOU PROVINCE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511114346.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-11
Publication Date
2026-01-30
Estimated Expiration
2045-08-11

AI Technical Summary

Technical Problem

Traditional river flow velocity measurement methods neglect the spatiotemporal dynamic relationship between flow cross-sectional features when dealing with complex hydrological characteristics, resulting in reduced model prediction accuracy and an inability to accurately identify the location of key flow verticals.

Method used

A method based on LSTM and SVM is adopted. By collecting and standardizing the cross-sectional features of water flow and meteorological features, a multi-layer LSTM prediction model is constructed. The flow velocity feature matrix is ​​generated by combining the momentum gradient optimization algorithm. The key water flow verticals are selected by using the recursive feature elimination method and the SVM model. The flow rate is calculated by combining the piecewise algorithm and the Saint-Venant equation, and dynamic Bayesian weighted fusion is performed.

Benefits of technology

It achieves precise positioning of key water flow verticals, reduces computational complexity, and improves the accuracy and spatiotemporal continuity of flow calculation through vector superposition algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009304B_ABST
    Figure CN121009304B_ABST
Patent Text Reader

Abstract

This invention discloses a river flow velocity measurement method based on LSTM and SVM, belonging to the field of hydrological monitoring technology. The method includes: collecting cross-sectional and meteorological features of the target river, performing time alignment and standardization to generate a standardized feature dataset; constructing a multi-layer LSTM prediction model based on the standardized feature dataset, training it using a mean squared error loss function, and combining it with a momentum gradient optimization algorithm to generate a velocity feature prediction matrix; based on the velocity feature prediction matrix, determining the importance of flow verticals using a recursive feature elimination method combined with cross-sectional features; and selecting key flow verticals and obtaining their location coordinates using an SVM model based on the importance of the flow verticals. This invention analyzes the contribution of each flow vertical to the LSTM model using a recursive feature elimination method and intelligently selects key verticals using an SVM model, ensuring data representativeness while significantly reducing computational complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hydrological monitoring technology, and in particular to a method for measuring river flow velocity based on LSTM and SVM. Background Technology

[0002] River flow velocity measurement is a crucial technical means for hydrological monitoring and water resource management. Traditional methods primarily rely on physical measurement equipment combined with cross-sectional segmentation for flow calculation. These methods estimate total flow by measuring representative vertical flow velocities and combining them with cross-sectional geometric characteristics, using numerical integration or empirical formulas. In recent years, with the development of machine learning technology, some studies have begun to introduce time series models or shallow neural networks for flow velocity prediction to improve computational efficiency. Furthermore, statistical learning-based methods have also been used to establish the mapping relationship between hydrological characteristics and flow velocities. These methods can provide effective flow estimation under specific hydrological conditions, providing data support for applications such as flood control scheduling and ecological flow protection.

[0003] The limitations of traditional methods in practical applications are mainly reflected in two aspects: First, when dealing with complex hydrological characteristics, flow prediction models often ignore the spatiotemporal dynamic relationships between flow cross-sectional features, leading to reduced model prediction accuracy. Second, in the calculation of flow velocity and flow cross-sectional flow, existing technologies are not accurate enough in identifying the key flow vertical locations that affect flow, and cannot effectively assess the importance of each flow vertical. Summary of the Invention

[0004] In view of the aforementioned existing problems, the present invention is proposed.

[0005] Therefore, this invention provides a river flow velocity measurement method based on LSTM and SVM to solve the problems of reduced model prediction accuracy and insufficient accuracy in identifying key flow vertical positions.

[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:

[0007] In a first aspect, the present invention provides a method for measuring river flow velocity based on LSTM and SVM, which includes collecting cross-sectional features of the target river and meteorological features, performing time alignment and standardization processing, and generating a standardized feature dataset.

[0008] Based on a standardized feature dataset, a multi-layer LSTM prediction model is constructed, trained using the mean squared error loss function, and combined with the momentum gradient optimization algorithm to generate a flow velocity feature prediction matrix.

[0009] Based on the velocity feature prediction matrix, the importance of the flow vertical is determined by combining the recursive feature elimination method with the characteristics of the flow cross section. Based on the importance of the flow vertical, the SVM model is used to select the key flow vertical and obtain its location coordinates.

[0010] Based on the position coordinates of the key measurement vertical line, the segmented flow rate is calculated for the water flow cross section using a segmented algorithm, and verified by the discretized Saint-Venant equation to generate the verified segmented flow rate.

[0011] Based on the validated segmented flow rates, the total flow rate of the flow cross section is calculated by vector superposition of the flow rates of each segment, and then dynamically Bayesian weighted fusion is performed with the historical cross section flow rates to generate the river flow rate.

[0012] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the following steps are performed: the water flow cross-sectional features and meteorological features of the target river are collected, time-aligned and standardized to generate a standardized feature dataset; the water flow cross-sectional features and meteorological features are time-aligned and integrated to generate a feature dataset.

[0013] The feature dataset is subjected to Min-Max standardization to generate a standardized feature dataset.

[0014] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the steps of constructing a multi-layer LSTM prediction model based on a standardized feature dataset and training it using a mean squared error loss function are as follows.

[0015] Based on a standardized feature dataset, a first-layer bidirectional LSTM network is constructed to capture bidirectional dynamic water flow cross-sectional features and generate a primary feature representation that integrates bidirectional temporal information.

[0016] Based on the primary feature representation, a second-layer bidirectional LSTM network is constructed to extract mid-term water flow cross-section features, establish the spatial correlation of water flow verticals, and generate higher-order feature representations.

[0017] Based on primary and higher-order feature representations, a third-layer bidirectional LSTM network is constructed to extract long-term water flow cross-sectional features, control the flow of water flow cross-sectional features, and generate depth time-series features.

[0018] A multi-layer LSTM prediction model is constructed based on a three-layer bidirectional LSTM network and trained using the mean squared error loss function.

[0019] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the step of generating a flow velocity feature prediction matrix by combining the momentum gradient optimization algorithm refers to inputting a standardized feature dataset into a trained multi-layer bidirectional LSTM prediction model to obtain depth time-series features, calculating the predicted flow velocity values ​​at each vertical position of the flow, and generating a flow velocity feature prediction matrix by combining the momentum gradient optimization algorithm.

[0020] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the following steps are taken: based on the velocity feature prediction matrix, the importance of the flow vertical is determined by combining the recursive feature elimination method with the characteristics of the flow cross section; based on the importance of the flow vertical, the SVM model is used to select key flow verticals and obtain their location coordinates.

[0021] Based on the velocity feature prediction matrix, the contribution of the velocity at each flow vertical to the multilayer LSTM prediction model is analyzed and calculated.

[0022] Remove flow verticals that contribute little to the multilayer LSTM prediction model to determine the importance of flow verticals;

[0023] Based on the importance of the water flow vertical line, an SVM model is used to select key water flow vertical lines and obtain their location coordinates.

[0024] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the step of calculating the segmented flow rate of the flow cross section using a segmented algorithm based on the position coordinates of the key measurement vertical line refers to dividing the flow cross section into grids based on the position coordinates of the key measurement vertical line, and calculating the segmented flow rate based on the average flow velocity of the flow vertical line and the area of ​​the grid.

[0025] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the verification is performed using the discretized Saint-Venant equation, and the steps are as follows.

[0026] Based on the segmented flow rate, the spatial rationality of the flow vertical is evaluated using the discretized Saint-Venant equation, and a spatial rationality score is generated.

[0027] Spatial rationality scores of water flow verticals at different time periods were collected and divided into two groups: "normal" and "abnormal". The centroid values ​​of the spatial rationality scores of the "normal" and "abnormal" groups were calculated separately. The average of the two centroid values ​​was taken as the rationality threshold. If the spatial rationality score was less than or equal to the rationality threshold, the spatial distribution was considered reasonable and the verification was passed.

[0028] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the generation of verified segmented flow refers to calculating the difference between the absolute values ​​of the differences between two adjacent segmented flows, taking the median as the historical fluctuation range, and calculating the difference between the segmented flows that have passed spatial rationality verification at the previous moment and the current moment. If the difference does not exceed the historical fluctuation range, then the verified segmented flow is generated through the continuity verification of the segmented flow changes at adjacent moments.

[0029] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the step of calculating the total flow rate of a flow cross-section by vector superposition of the flow rates of each segment, based on the verified segmented flow rates, is as follows:

[0030] The verified segmented flow rate is converted into a vector segmented flow rate, and a cross-sectional coordinate system for the flow is constructed.

[0031] The flow rates of each vector segment are decomposed and synthesized in the water flow cross-section coordinate system to generate the total flow rate of the water flow cross-section.

[0032] As a preferred embodiment of the river flow velocity measurement method based on LSTM and SVM described in this invention, the steps for generating river flow are as follows:

[0033] Obtain the weights of historical flow cross-sections and generate the weights of the total flow cross-section using the complement principle;

[0034] The initial channel flow is generated by merging the historical flow section flow with the total flow section flow.

[0035] The deviation between the initial river flow and the historical flow section flow is predicted and dynamically corrected using particle filtering to generate the final river flow.

[0036] The beneficial effects of this invention are as follows: By analyzing the contribution of each flow vertical line to the LSTM model through the recursive feature elimination method, and combining it with the SVM model to intelligently select key vertical lines, the precise positioning of measurement points is achieved, which not only ensures the representativeness of the data but also significantly reduces the computational complexity; by using the vector superposition algorithm to spatially synthesize the segmented flow in the flow cross-section coordinate system, and then combining it with dynamic Bayesian weighted fusion of historical data, high-precision calculation of cross-sectional flow is achieved, which not only preserves the flow direction characteristics but also enhances the spatiotemporal continuity of the results. Attached Figure Description

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

[0038] Figure 1 This is a flowchart of a river flow velocity measurement method based on LSTM and SVM.

[0039] Figure 2 Flowchart for building a multi-layer LSTM prediction model.

[0040] Figure 3 Flowchart for selecting critical flow verticals.

[0041] Figure 4 This is a flowchart for segmented traffic verification and total traffic calculation. Detailed Implementation

[0042] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0043] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0044] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0045] Reference Figures 1-4 This is one embodiment of the present invention, which provides a river flow velocity measurement method based on LSTM and SVM, including the following steps:

[0046] S1. Collect the cross-sectional features of the target river's flow and meteorological features, perform time alignment and standardization processing, and generate a standardized feature dataset;

[0047] The dynamic time warping algorithm is used to align the cross-sectional features of water flow and meteorological features in time, and then integrate them to generate a feature dataset.

[0048] Furthermore, the cross-sectional features of the water flow and meteorological features are preprocessed. Missing values ​​are filled in by forward interpolation, and the hydrological and meteorological timestamps corresponding to each observation are retained. All hydrological timestamps and all meteorological timestamps are generated into a grid index through Cartesian product. On this two-dimensional index plane, the corresponding hydrological feature vectors and meteorological feature vectors are paired one by one, and the Euclidean distance between them is calculated to construct a global matching map.

[0049] The dynamic time warping algorithm is applied to the global matching map. The minimum cumulative distance is recursively calculated through dynamic programming, and the starting point is backtracked from the endpoint along the adjacent grid point with the minimum cumulative distance. During the backtracking process, each selected grid point is recorded in sequence, and the record sequence is reversed after the backtracking is completed to obtain the optimal registration path.

[0050] Meteorological features are mapped to the corresponding hydrological timestamps of water flow cross-section features according to the optimal registration path, and time alignment is performed. The time-aligned meteorological features and water flow cross-section features are then stitched together line by line according to the order of the hydrological timestamps to output the feature dataset.

[0051] The feature dataset is subjected to Min-Max standardization to generate a standardized feature dataset;

[0052] Furthermore, the cross-sectional features of water flow and meteorological features were scanned on the feature dataset, and the maximum and minimum values ​​of historical observations of each cross-sectional feature and meteorological feature were statistically analyzed. A minimum-maximum curve was constructed in chronological order.

[0053] Based on the maximum and minimum values ​​on the "minimum-maximum curve", the Min-Max scaling function is used to map the time-aligned water flow cross-sectional features and meteorological features to the 0-1 interval, generating standardized features. The standardized features are then merged in the order of the time-aligned water flow cross-sectional features and meteorological features to generate a standardized feature dataset.

[0054] The characteristics of a water flow cross section include water level, average flow velocity, flow rate, rate of change of water level, spatial sampling location of the vertical flow line, flow velocity of the vertical flow line, and rate of change of flow rate of the cross section.

[0055] Meteorological characteristics include cumulative rainfall, duration of rainfall, peak rainfall intensity, and location of the rainfall center.

[0056] S2. Based on the standardized feature dataset, a multi-layer LSTM prediction model is constructed, trained using the mean squared error loss function, and combined with the momentum gradient optimization algorithm to generate the flow velocity feature prediction matrix.

[0057] Based on a standardized feature dataset, a first-layer bidirectional LSTM network is constructed according to a bidirectional processing mechanism to capture bidirectional dynamic water flow cross-sectional features and generate a primary feature representation that integrates bidirectional temporal information.

[0058] Furthermore, the first-layer bidirectional LSTM network performs bidirectional temporal scanning of the standardized feature dataset according to the bidirectional processing mechanism, and saves the scanned hidden memory state into the LSTM network: during forward temporal processing, the LSTM network sequentially reads the standardized features of each hydrological timestamp in the standardized feature dataset, linearly combines the standardized features of the current hydrological timestamp with the hidden memory state of the previous hydrological timestamp, and generates the forward dynamic flow cross-sectional features of the current hydrological timestamp through the activation of the nonlinear activation function. The forward flow cross-sectional features of all hydrological timestamps are arranged in order to construct a forward mapping matrix.

[0059] During reverse time series processing, the LSTM network sequentially reads the standardized features of each hydrological timestamp in the standardized feature dataset, linearly combines the standardized features of the current hydrological timestamp with the hidden memory state of the next hydrological timestamp, and generates the reverse dynamic flow section features of the current hydrological timestamp through activation by a nonlinear activation function. The reverse flow section features of all hydrological timestamps are arranged in order to construct the reverse mapping matrix.

[0060] The positive and negative dynamic flow cross-sectional features are scanned to the same hydrological timestamp and then spliced ​​together to generate a primary feature representation that integrates bidirectional time-series information.

[0061] It should be noted that the bidirectional processing mechanism is a processing method that performs both forward and reverse timing processing; bidirectional timing information is a type of information that includes both forward and reverse timing information.

[0062] Based on the primary feature representation, a second-layer bidirectional LSTM network is constructed according to the temporal convolutional network. Multi-scale dilated convolution is used to extract mid-term water flow cross-section features, and spatial correlation of water flow verticals is established through local spatial graph convolutional layers to generate higher-order feature representations.

[0063] Furthermore, a medium-term time window is set by extrapolating 3–12 hours forward from the current hydrological timestamp. Within this medium-term time window, three sets of multi-scale dilated convolutional pipelines are deployed, each using a different dilation rate and kernel width. The primary feature sequence of the most recent fixed period (e.g., 3–12 hours) is subjected to sliding window convolution operation using the DilatedConv1D function to generate three sets of medium-term feature maps covering the "near-medium term" (e.g., 3–6h), "medium term" (e.g., 6–9h), and "far-medium term" (e.g., 9–12h). The three sets of medium-term feature maps are then concatenated at the hydrological timestamp to generate a multi-scale time series feature map.

[0064] Multi-scale time series feature maps and primary feature representations are fed into a bidirectional processing mechanism in parallel, and hydrological timestamp scanning is performed on both forward and reverse time series to generate intermediate bidirectional feature representations.

[0065] At each hydrological timestamp, a local spatial graph convolution operator based on the flow vertical line is used to perform spatial correlation aggregation on the spliced ​​mid-term bidirectional feature representation and multi-scale temporal feature map to generate the spatial structure of the flow vertical line.

[0066] By fusing multi-scale temporal feature maps with the spatial structure of water flow vertical lines, a high-order feature representation is generated.

[0067] It should be noted that, based on statistics of river flow across the country, significant changes occur within 3 to 12 hours of meteorological changes, which is defined as a medium-term time window.

[0068] It should be noted that the spatial correlation of water flow verticals refers to the spatial relationship and influence between various water flow verticals on the water flow cross section.

[0069] Based on primary and higher-order feature representations, a third-layer bidirectional LSTM network is constructed by fusion of residual jump and multi-scale time window to extract long-term water flow cross-section features. The flow of water flow cross-section features is controlled by a gating modulation process to generate deep temporal features.

[0070] Furthermore, the primary feature representation and the high-level feature representation are concatenated according to the residual jump. Through multi-scale time window fusion, the water flow cross-section features covering different time periods are extracted respectively. The water flow cross-section features are then fused to generate multi-scale fused features. The multi-scale fused features are then input into the third layer bidirectional LSTM network, and a bidirectional processing mechanism is used to capture long-term water flow cross-section features.

[0071] The forgetting gate performs a weighted summation of the standardized feature dataset and the hidden memory state of the previous hydrological timestamp, generates a forgetting ratio through the Sigmoid activation function, and cleans up the hidden memory state of the previous hydrological time based on the forgetting ratio to generate a memory base that can receive new information.

[0072] The input gate concatenates the standardized features of the current hydrological timestamp with the hidden memory state of the previous hydrological timestamp to form an input concatenation vector. This input concatenation vector is then linearly weighted, summed, and biased to generate an intermediate input value. This intermediate value is fed into a Sigmoid activation function, which compresses the output to the 0-1 range to obtain the input ratio. Based on the standardized features of the current hydrological timestamp, the input gate generates candidate memory components and writes these components into the free space of the memory base according to the input ratio, generating an updated memory state.

[0073] The output gate concatenates the updated memory state with the standardized features of the current hydrological timestamp to generate an output concatenation vector. The output concatenation vector is then linearly weighted and subjected to bias processing to generate an output intermediate value. Finally, the output ratio is generated by passing the Sigmoid activation function. The output ratio is multiplied element-wise with the updated memory state to generate the hidden state output.

[0074] The hidden state output is distinguished into positive hidden state output and negative hidden state output through a bidirectional processing mechanism. The positive hidden state output and the negative hidden state output are spliced ​​at the same hydrological timestamp to generate a bidirectional fused feature representation. The bidirectional fused feature representation is arranged in order according to the hydrological timestamp to generate a feature flow sequence. The bidirectional fused feature representations of adjacent hydrological timestamps in the feature flow sequence are compared one by one to analyze the consistency of the change magnitude and direction.

[0075] Calculate the Euclidean distance between the bidirectional fusion feature representations of two adjacent hydrological timestamps, and use it as the fluctuation amplitude of the bidirectional fusion feature representation. Calculate the average fluctuation amplitude of all bidirectional fusion feature representations. Based on the time series arrangement of the bidirectional fusion feature representations at all hydrological timestamps in the feature space, set the average fluctuation amplitude of all bidirectional fusion feature representations ± x times the standard deviation as the fluctuation threshold range. If the average fluctuation amplitude of the bidirectional fusion feature representations falls within the fluctuation threshold range, the change amplitude is considered stable.

[0076] Based on the vector direction of the bidirectional fusion feature representation at two adjacent hydrological timestamps, calculate the directional angle between the bidirectional fusion feature representations at all two adjacent hydrological timestamps, count all directional angle data, and set the median of the directional angle data as the directional angle threshold. If the directional angle between the bidirectional fusion feature representations at two adjacent hydrological timestamps is less than the directional angle threshold, the directions are consistent.

[0077] Stable bidirectional fusion feature representations are characterized by stable amplitude changes and consistent direction, which are propagated over time. Abrupt bidirectional fusion feature representations are characterized by not falling within the fluctuation threshold range or having inconsistent direction, which gradually weaken over time until they stop propagating, generating continuous and clearly directional water flow cross-section feature flow paths, achieving effective control of water flow cross-section feature flow, and generating depth time-series features.

[0078] It should be noted that, in order to more accurately capture the continuous changes and potential long-term trends of water flow cross-sectional characteristics, the time frame for long-term water flow cross-sectional characteristics is usually set to 12 to 48 hours or longer.

[0079] Based on a three-layer bidirectional LSTM network, a multi-layer LSTM prediction model is constructed by realizing multi-layer information interaction through inter-layer dynamic weighted residual fusion, and trained using the mean squared error loss function.

[0080] Furthermore, the primary feature representation, higher-order feature representation, and deep temporal features are used as the output features of the first, second, and third layers, respectively. Based on a three-layer bidirectional LSTM network, a weighted residual fusion method is used to weight the output features of each layer. The output features of the current layer are combined with the residuals of the output features of the previous layer to generate a weighted fused temporal feature representation, which is then passed to the next layer. Through dynamic weighting and information interaction strategies, the weighted fusion results of each layer are combined with the output features of the current layer to generate a weighted residual. The mean squared error loss function is used to calculate the prediction error, as shown in the following formula.

[0081]

[0082] Where L is the prediction error, N is the number of training samples, and v it Let be the actual flow velocity value of the i-th vertical water flow line at time t. Let be the predicted flow velocity value of the i-th flow vertical at time t, where i is the index variable of the flow vertical and t represents the time.

[0083] The prediction error is propagated backward layer by layer to each layer of the multilayer LSTM prediction model using the backpropagation algorithm to obtain the gradient signal of the corresponding layer and generate a complete gradient set. Historical gradient sets are collected, and the complete gradient set is combined with the historical gradient set. The momentum gradient optimization algorithm is used to update the direction and adjust the magnitude of the output features of each layer of the multilayer LSTM prediction model and generate update instructions. According to the update instructions, the output features of each layer of the multilayer LSTM prediction model are corrected to generate new parameter configurations. The new parameter configurations are then input into the multilayer LSTM prediction model to train the multilayer LSTM prediction model.

[0084] The standardized feature dataset is input into the trained multi-layer bidirectional LSTM prediction model to obtain deep temporal features. The predicted values ​​of water flow velocity at each vertical position of the water flow are calculated through forward propagation, and the velocity feature prediction matrix is ​​generated by combining the momentum gradient optimization algorithm.

[0085] Furthermore, the standardized feature dataset is input into the trained multi-layer bidirectional LSTM prediction model to generate standardized feature vectors. These vectors are then passed forward and activated to activate the deep temporal features. The multi-layer bidirectional LSTM prediction model processes the flow cross-sectional features at each hydrological timestamp and outputs the predicted flow velocity at each vertical flow position, expressed as follows:

[0086]

[0087] Among them, V t,i S is the predicted flow velocity at the position of the i-th vertical line at time t; t Let be the standardized eigenvector at time t; W is the mean of the standardized eigenvectors. (f) W is the positive mapping matrix; (b) H is the inverse mapping matrix; t The depth time-series features extracted by the LSTM prediction model; λ is the feature difference sensitivity parameter; β is the nonlinear adjustment coefficient (usually ranging from 0.1 to 1.0), i is the index variable of the water flow vertical line, t represents the time, σ is the Sigmoid function, and tanh is the hyperbolic tangent function.

[0088] The multi-level bidirectional LSTM prediction model is optimized by combining the momentum gradient optimization algorithm. Based on the optimized multi-level bidirectional LSTM prediction model, the predicted flow velocity values ​​for each hydrological timestamp and each flow vertical position are generated. The predicted flow velocity values ​​are then organized to generate a flow velocity feature prediction matrix.

[0089] S3. Based on the velocity feature prediction matrix, the importance of the flow vertical line is determined by combining the recursive feature elimination method with the characteristics of the flow cross section. According to the importance of the flow vertical line, the SVM model is used to select the key flow vertical line and obtain its location coordinates.

[0090] Based on the velocity feature prediction matrix, sensitivity analysis based on gradient attribution is used to calculate the contribution of the velocity of each flow vertical to the multilayer LSTM prediction model.

[0091] Furthermore, based on the velocity feature prediction matrix, the mean squared error loss function is differentiated, and its gradient with respect to the predicted velocity values ​​is calculated. The gradient of the mean squared error loss function is then propagated to each layer of the LSTM prediction model using the backpropagation algorithm to obtain the gradient information of the velocity at each flow vertical. This gradient information is then normalized, and the normalized result is used as the contribution value of the velocity at each flow vertical. The contribution score of the velocity at each flow vertical to the multi-layer LSTM prediction model is determined, expressed as follows:

[0092]

[0093] Among them, C i The contribution score for the i-th flow vertical line is given, where T is the total length of the time series, M is the total number of flow vertical lines laid out on the flow cross section, and g i,t Let g be the gradient value of the i-th vertical line of the water flow at time t. j,t Let φ be the gradient value of the j-th vertical line of the water flow at time t. i,t w is the offset of the predicted flow velocity value. i,t is the time Gaussian weight term, and ∈ is the local minimum constant.

[0094] Remove flow lines that contribute little to the multilayer LSTM prediction model, and determine the importance of the flow lines based on the dispersion of the remaining flow lines.

[0095] Furthermore, the contribution scores of all flow velocity verticals are statistically analyzed and the average contribution score is calculated. The average contribution score is set as the threshold for removing flow verticals. Flow verticals with a contribution score of flow velocity lower than the threshold are removed. The variance of the gradient value of the flow verticals is calculated as the dispersion score of the flow verticals. The dispersion score is set as the importance score of the flow verticals. The higher the importance score of the flow verticals, the more important the flow verticals are.

[0096] It should be noted that the degree of dispersion refers to the magnitude of the dispersion of the gradient value of the remaining water flow vertical line over the entire range;

[0097] Based on the importance of the flow vertical line, the SVM model is used to select key flow vertical lines and obtain their location coordinates through kernel function mapping and flow cross-section features.

[0098] Furthermore, the importance score of the water flow vertical line is paired with the water flow cross-section features to generate a feature-score training set. Kernel function mapping is applied to the feature-score training set to map the water flow cross-section features to a high-dimensional space, generating a high-dimensional feature representation.

[0099] The separation boundary is fitted based on the high-dimensional feature representation of key and non-key flow lines, hyperplane parameters are generated, and candidate hyperplanes are constructed. The hyperplane parameters are initialized according to the high-dimensional feature representation. The hyperplane parameters are iteratively adjusted by calculating the distance between the high-dimensional feature representation and the candidate hyperplane in the high-dimensional space, increasing the interval between key and non-key flow lines in the high-dimensional feature representation, and support vectors are obtained, generating an initial support vector set.

[0100] Based on the initial set of support vectors, an SVM model is trained. Iterative optimization is used to alternately update the support vectors and hyperplane parameters. The Lagrange multipliers of each support vector and its geometric distance to the hyperplane are calculated. Support vectors that satisfy the condition that the Lagrange multipliers are between zero and regularity constants (such as 0.1, 1, 10) and are closest to the hyperplane are selected as the support vectors with decisive effects. An optimized set of support vectors and their corresponding water flow cross-section feature weights are generated. The water flow verticals corresponding to the support vectors are marked as key water flow verticals. The spatial sampling positions of the key water flow verticals are traced and used as their position coordinates. At the same time, the trained SVM model is obtained.

[0101] S4. Based on the position coordinates of the key measurement vertical lines, the segmented flow rate is calculated for the water flow cross section using a segmented algorithm, and verified by the discretized Saint-Venant equation to generate the verified segmented flow rate.

[0102] Based on the position coordinates of the key measurement vertical line, the flow cross section is divided into grids using the Delaunay triangulation algorithm. The segmented flow rate is then calculated using the numerical integration method based on the average flow velocity of the flow vertical line and the area of ​​the grid.

[0103] Furthermore, based on the position coordinates of the key measurement vertical lines, the flow cross-section is divided into non-overlapping triangular grids using the Delaunay triangulation algorithm. Based on the average flow velocity along the vertical line within each grid cell and the grid area, the segmented flow rate of each grid is calculated using numerical integration, expressed as follows:

[0104]

[0105] Among them, Q n For segmented traffic, S n Let n be the area of ​​the nth triangular mesh. Let A be the water flow velocity at vertex A of the triangular mesh. The water flow velocity at vertex B of the triangular mesh. Let C be the water flow velocity at vertex C of the triangular mesh.

[0106] Based on the segmented flow rate, the spatial rationality of the flow vertical is evaluated using the discretized Saint-Venant equation, and a spatial rationality score is generated.

[0107] Furthermore, the segmented flow rate is input into the discretized Saint-Venant equation to generate the flow rate change of the key measurement vertical. Based on the maximum and minimum values ​​on the "minimum-maximum curve", the flow rate change is calculated to be the difference between the flow rate change and the maximum and minimum values, generating the maximum difference and minimum difference. The maximum difference and minimum difference are compared, and the larger difference is selected and the difference is converted into a spatial rationality score using a normalization method.

[0108] Spatial rationality scores of water flow verticals at different time periods were collected and divided into "normal" and "abnormal" groups using a clustering algorithm. The centroid values ​​of the spatial rationality scores of the "normal" and "abnormal" groups were calculated separately. The average of the two centroid values ​​was taken as the rationality threshold. If the spatial rationality score was less than or equal to the rationality threshold, the spatial distribution was considered reasonable. This was verified.

[0109] Furthermore, spatial rationality scores of water flow verticals at different time periods were collected. A K-means clustering algorithm was used, with two clusters: "normal" and "abnormal." Two initial cluster centers were randomly selected to classify all spatial rationality scores. Each score was assigned to the nearest cluster center. The centroid of each cluster was recalculated, and the cluster centers were updated. This process of updating the new cluster centers was repeated until the cluster centers no longer changed. The spatial rationality scores were then divided into "normal" and "abnormal" groups. The centroid values ​​of the spatial rationality scores for the "normal" and "abnormal" groups were calculated, and the average of the two centroid values ​​was used as a rationality threshold. Spatial distributions were considered reasonable if the spatial rationality score was less than or equal to the threshold. This was verified.

[0110] It should be noted that the water flow verticals at different time periods refer to the water flow verticals collected and calculated at different time points for the same river cross section during continuous hydrological observation.

[0111] The absolute value of the difference between two adjacent segmented flows is calculated based on the hydrological timestamp, and the median is taken as the historical fluctuation range. The difference between the segmented flows of the previous hydrological timestamp and the current hydrological timestamp that have passed the spatial rationality verification is calculated. If the difference does not exceed the historical fluctuation range, the segmented flows that have passed the verification of the continuity of the segmented flows of adjacent hydrological timestamps are generated.

[0112] Furthermore, the segmented flows are arranged according to hydrological timestamps. For each pair of adjacent time points, the difference between the segmented flows is calculated to obtain a segmented flow difference sequence. The absolute value of the segmented flow difference sequence is taken to generate an absolute difference sequence. The absolute difference sequence is arranged in ascending order, and the median is extracted and recorded as the historical fluctuation range. The segmented flow of the previous hydrological timestamp is subtracted from the segmented flow of the current hydrological timestamp one by one to obtain the segmented flow difference between adjacent hydrological timestamps. This difference is compared with the historical fluctuation range. If the segmented flow difference between adjacent hydrological timestamps does not exceed the historical fluctuation range, the continuity of the segmented flow change between adjacent hydrological timestamps is verified, and the verified segmented flow is generated.

[0113] S5. Based on the verified segmented flow, the total flow of the flow section is calculated by vector superposition of the flow of each segment, and the flow is dynamically Bayesian weighted and fused with the historical flow section flow to generate the river flow.

[0114] Based on the angle between the centerline of the grid and the flow direction of the flow cross-section, the verified segmented flow rate is converted into a vector segmented flow rate, and a flow cross-section coordinate system is constructed using principal component analysis. The vector projection method is used to decompose and synthesize each vector segmented flow rate in the flow cross-section coordinate system to generate the total flow rate of the flow cross-section.

[0115] Furthermore, based on the standardized feature dataset, the vector direction values ​​of the cross-sectional average flow velocity at each hydrological timestamp are extracted. The vector direction of the cross-sectional average flow velocity corresponding to all hydrological timestamps is calculated, and principal component analysis is used to extract the vector direction of the cross-sectional average flow velocity. The direction of the first principal component is selected as the overall flow direction of the flow cross-section feature. The centerline direction of the grid corresponding to each vector segment flow is extracted, and the angle between the centerline direction and the overall flow direction of the flow cross-section feature is calculated and recorded. Based on the angle value, the verified segment flow is converted into vector form to generate vector segments. Flow rate; collect the direction and magnitude of all vector segment flow rates to form a data matrix, center the data matrix and calculate the covariance, extract eigenvalues ​​and eigenvectors, and establish a flow cross-section coordinate system with the eigenvector corresponding to the largest eigenvalue as the principal axis; map the vector segment flow rates uniformly to the flow cross-section coordinate system, calculate the projection of each vector segment flow rate in the principal component direction and the secondary direction using the vector projection method, generate component vectors, process the projection results of all vector segment flow rates, sum the components in the principal component direction and the secondary direction according to the direction, and synthesize the sum of the summed components to obtain the total flow rate of the flow cross-section.

[0116] The weights of historical flow cross-sectional discharges are obtained using the Markov chain Monte Carlo sampling method; the weights of the total flow cross-sectional discharges are generated using the complement principle; and the historical flow cross-sectional discharges and the total flow cross-sectional discharges are weighted and fused to generate the initial channel discharge.

[0117] Furthermore, using the Markov chain Monte Carlo sampling method, the probability distribution of historical flow section discharges is defined and sampled to generate candidate flow section features. The weights of the flow section features are calculated using the normalized variance method. Based on the complement principle, features irrelevant to the flow section features are identified and eliminated. The remaining features constitute the complement of the flow section features. The initial weight of the total flow section discharge is calculated based on the complement of the flow section features. The initial weight is adjusted using the complement principle to generate the complement weight. The initial weight and the complement weight are combined to generate the weight of the total flow section discharge. The weights of the historical flow section discharges and the total flow section discharges are weighted and fused to generate the initial channel discharge.

[0118] It should be noted that the complement principle refers to automatically deriving another set of complementary weights through complement operations after a set of weights has been determined, ensuring that the overall weight distribution is reasonable and the sum is 1.

[0119] Gaussian process regression is used to predict the deviation between the initial channel flow and the historical flow section flow, and particle filtering is used for dynamic correction to generate the final channel flow.

[0120] Furthermore, the deviation between the historical cross-sectional flow and the initial channel flow is calculated to obtain the deviation amount. Gaussian process regression is used to predict the deviation amount. Combining the trend change and fluctuation characteristics of the standardized feature dataset, the dynamic change trend of the deviation amount is estimated, and a predicted flow deviation is generated. Based on the predicted flow deviation, the particle filtering method is used to correct the predicted flow deviation through resampling to generate a predicted flow correction deviation. The predicted flow correction deviation is added to the initial channel flow to generate the final channel flow.

[0121] This embodiment also provides a computer device applicable to the river flow velocity measurement method based on LSTM and SVM, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the river flow velocity measurement method based on LSTM and SVM as proposed in the above embodiment.

[0122] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0123] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements the river flow velocity measurement method based on LSTM and SVM as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0124] In summary, this invention achieves precise location of measurement points by analyzing the contribution of each flow vertical line to the LSTM model using the recursive feature elimination method and intelligently selecting key vertical lines using the SVM model, thus ensuring data representativeness while significantly reducing computational complexity. Furthermore, by using a vector superposition algorithm to spatially synthesize segmented flow rates in the flow cross-section coordinate system and then combining this with dynamic Bayesian weighted fusion of historical data, high-precision calculation of cross-sectional flow rates is achieved, preserving the flow direction characteristics while enhancing the spatiotemporal continuity of the results.

[0125] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A river flow measuring method based on LSTM and SVM, characterized in that: The application relates to a river flow forecasting method and device. The water flow section characteristics and weather characteristics of a target river are collected, time alignment and standardization processing are performed, and a standardized characteristic data set is generated; Based on the standardized characteristic data set, a multi-layer LSTM prediction model is constructed, training is performed through a mean square error loss function, and a flow velocity characteristic prediction matrix is generated in combination with a momentum gradient optimization algorithm; Based on the flow velocity characteristic prediction matrix, the importance of the water flow vertical line is judged through a recursive feature elimination method in combination with the water flow section characteristics, the position coordinates of the key water flow vertical line are obtained through an SVM model according to the importance of the water flow vertical line; According to the position coordinates of the key measurement vertical line, the segmented flow of the water flow section is calculated through a segmentation algorithm, and the segmented flow is verified through a discretized Saint-Venant equation, thereby generating verified segmented flow; Based on the verified segmented flow, the total flow of the water flow section is calculated through vector superposition of the segmented flow of the water flow section, and the river flow is dynamically weighted and fused with the historical section flow. 2.The river flow rate measuring method based on LSTM and SVM according to claim 1, wherein: The water flow section characteristics and weather characteristics are time-aligned, and a characteristic data set is generated by integration; The characteristic data set is subjected to Min-Max standardization processing to generate a standardized characteristic data set. 3.The river flow rate measuring method based on LSTM and SVM according to claim 2, wherein: Based on the standardized characteristic data set, a multi-layer LSTM prediction model is constructed, training is performed through a mean square error loss function, and a flow velocity characteristic prediction matrix is generated in combination with a momentum gradient optimization algorithm. Based on the standardized characteristic data set, a first two-way LSTM network is constructed to capture bidirectional dynamic water flow section characteristics, generate primary feature representation fused with bidirectional time sequence information; Based on the primary feature representation, a second two-way LSTM network is constructed to extract medium-term water flow section characteristics, establish spatial correlation of the water flow vertical line, and generate high-order feature representation; Based on the primary feature representation and the high-order feature representation, a third two-way LSTM network is constructed to extract long-term water flow section characteristics, control water flow section characteristic flow, and generate deep time sequence characteristics; The three two-way LSTM networks are combined to construct a multi-layer LSTM prediction model, and training is performed through a mean square error loss function. 4.The river flow rate measuring method based on LSTM and SVM according to claim 3, wherein: The standardized characteristic data set is input into the trained multi-layer LSTM prediction model to obtain deep time sequence characteristics, calculate the flow velocity prediction value of each water flow vertical line position, and generate a flow velocity characteristic prediction matrix in combination with a momentum gradient optimization algorithm. 5.The river flow rate measuring method based on LSTM and SVM according to claim 4, wherein: Based on the flow velocity characteristic prediction matrix, the importance of the water flow vertical line is judged through a recursive feature elimination method in combination with the water flow section characteristics, the position coordinates of the key water flow vertical line are obtained through an SVM model according to the importance of the water flow vertical line, and the steps are as follows, The contribution of the flow velocity of each water flow vertical line to the multi-layer LSTM prediction model is analyzed and calculated according to the flow velocity characteristic prediction matrix; Water flow vertical lines with low contribution to the multi-layer LSTM prediction model are removed to judge the importance of the water flow vertical line; Based on the importance of the water flow vertical line, an SVM model is used to select the key water flow vertical line and obtain the position coordinates. 6.The river flow rate measuring method based on LSTM and SVM according to claim 5, wherein: The calculation of the sectional flow according to the position coordinates of the key measurement vertical lines refers to grid division of the water flow section according to the position coordinates of the key measurement vertical lines, and calculation of the sectional flow according to the average flow velocity of the water flow vertical line and the area of the grid.

7. The LSTM and SVM based river flow rate estimation method of claim 6, wherein: The verification through the discretized Saint-Venant equation is performed in the following steps, According to the sectional flow, the spatial distribution rationality of the water flow vertical line is evaluated through the discretized Saint-Venant equation, and a spatial rationality score is generated. The spatial rationality scores of the water flow vertical lines in different time periods are collected and divided into two groups of "normal" and "abnormal", and the centroid values of the spatial rationality scores of the "normal" group and the "abnormal" group are calculated, and the average of the two centroid values is taken as the rationality threshold value. The spatial distribution is considered reasonable if the spatial rationality score is less than or equal to the rationality threshold value, and the verification is passed. 8.The river flow rate measuring method based on LSTM and SVM according to claim 7, wherein: The generation of the sectional flow passing the verification refers to the calculation of the absolute value of the difference between the sectional flows at adjacent times, taking the median as the historical fluctuation amplitude, and the rationality difference calculation of the sectional flows passing the spatial rationality verification at the previous time and the current time. If the rationality difference is not more than the historical fluctuation amplitude, the sectional flow change continuity verification is passed, and the sectional flow passing the verification is generated. 9.The river flow rate measuring method based on LSTM and SVM according to claim 8, wherein: The calculation of the total flow of the water flow section based on the sectional flow passing the verification through the vector superposition of the sectional flows of the water flow section is performed in the following steps, The sectional flow passing the verification is converted into a vector sectional flow, and a water flow section coordinate system is constructed. The vector sectional flows are decomposed and synthesized in the water flow section coordinate system to generate the total flow of the water flow section. 10.The river flow rate measuring method based on LSTM and SVM according to claim 9, wherein: The generation of the river flow is performed in the following steps, The weight of the historical water flow section flow is obtained, and the weight of the total flow of the water flow section is generated through the complement principle. The historical water flow section flow and the total flow of the water flow section are fused to generate an initial river flow. The deviation of the initial river flow from the historical water flow section flow is predicted, and the particle filtering is performed for dynamic correction to generate the final river flow.

Citation Information

Patent Citations

  • River flow calculation method and system

    CN110243423A

  • Basin flood risk assessment method and system based on particle recognition algorithm

    CN119228150A