River flow inversion method based on physical constraint and double random forest cascade

By employing a method combining physical constraints and a double random forest cascade, the problem of river flow inversion under small sample conditions was solved, achieving high-precision and physically consistent flow prediction. This method is applicable to river flow monitoring in areas with no or scarce data.

CN121787276APending Publication Date: 2026-04-03TAIYUAN GUODAO TECHNOLOGY CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies struggle to construct high-precision, physically consistent, and well-generalized river flow inversion models under conditions of scarce flow data.

Method used

We employ a method based on physical constraints and cascaded double random forests to decompose the flow inversion problem into two more easily solvable sub-problems. We generate synthetic data through physical constraints and train it using a double random forest model to ensure the physical rationality and generalization ability of the model output.

Benefits of technology

With very little actual data, it significantly improves the accuracy of traffic inversion and the stability of the model, providing an efficient and reliable traffic monitoring tool.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121787276A_ABST
    Figure CN121787276A_ABST
Patent Text Reader

Abstract

The invention discloses a river flow inversion method and system based on physical constraint and double random forest cascade, and belongs to the technical field of hydrological monitoring. The method comprises the following steps: firstly, carrying out quality inspection and preprocessing on obtained actually-measured hydrological data of a river section; based on the preprocessed training data, empirical distribution of the key hydraulic parameters is inverted through a hydraulic formula, and a first random forest model is trained to establish a mapping relation among the river width, the water depth and the surface flow velocity; then, under the constraint of the hydraulics formula, generating a large-scale physically consistent synthetic hydrological data set by using the first random forest model; and finally, fusing the actual measurement training set and the synthetic data set, and training a second random forest model to establish a high-precision inversion model from the river width and the surface flow velocity to the flow. The method effectively solves the training problem of the traffic inversion model under the condition of data scarcity, and has high prediction precision and strong physical rationality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hydrological monitoring and water conservancy information technology, specifically to a high-precision inversion method for river flow that integrates hydraulic physical mechanisms and machine learning and is suitable for small sample conditions. Background Technology

[0002] River flow is a core parameter in hydrological monitoring, and its accurate inversion is crucial for water resource management, flood control and disaster reduction, and water conservancy project scheduling. Traditional contact measurement methods (such as ADCP) are costly and difficult to monitor continuously. In recent years, non-contact flow inversion technology has developed rapidly, with existing technologies mainly presenting three technical routes, but all have obvious limitations.

[0003] The first category consists of methods based on physical models or empirical formulas (such as CN 116539107 A, CN 118464129 A, and CN 120176630 A). These methods are typically based on Manning's formula or its variants. While they have a certain physical basis, their accuracy heavily depends on the accurate calibration of empirical parameters such as roughness and gradient. Significant errors occur when calibration data is lacking or when river conditions change. Furthermore, some methods require a high level of prior information such as cross-sectional morphology, resulting in poor applicability in areas lacking data.

[0004] The second category comprises purely data-driven machine learning / deep learning methods (such as CN 113641733 A and CN119810647 A). These methods uncover the complex nonlinear relationships between hydrological elements and flow rates through algorithms, but generally require a large amount of historical data to support model training. They are prone to overfitting under small sample conditions and have weak generalization ability. More importantly, their models are "black boxes," and the prediction results may violate basic hydraulic principles. Under extreme or unexperienced hydrological conditions, they are prone to physically unreasonable outputs, raising questions about their reliability.

[0005] The third category is hybrid methods that attempt to combine multiple technologies (such as CN 114463644 A and CN 117288283 A). Although these methods have made improvements in automation or data source integration, they have not fundamentally solved the inherent defects of the two routes mentioned above: they are either sensitive to parameters and rely on prior knowledge, or they have high requirements for data volume and insufficient physical consistency.

[0006] In summary, existing technologies face a common industry bottleneck: how to construct a traffic inversion model that has high prediction accuracy, ensures consistency with physical laws, and has good generalization ability under the condition that measured data (especially traffic data) is extremely scarce. Summary of the Invention

[0007] (a) Purpose of the invention.

[0008] This invention aims to overcome the shortcomings of existing technologies and provide a river flow inversion method based on physical constraints and a dual random forest cascade. Through an original "physical mechanism and data-driven dual-engine" architecture, this method achieves high-precision, high-physical-consistency, and strong-generalization ability flow inversion under conditions of minimal measured data, fundamentally solving the modeling challenges of small-sample hydrological monitoring.

[0009] (ii) Technical solution.

[0010] To achieve the above objectives, the present invention adopts the following technical solution.

[0011] A river flow inversion method based on physical constraints and a cascaded double random forest is proposed. Its core lies in using a cascaded architecture combining "physical mechanism guidance" and "data-driven learning" to decompose the complex flow inversion problem into two more easily solvable sub-problems. Furthermore, it leverages physical constraints to generate a large amount of synthetic data to overcome the bottleneck of sample scarcity. The method mainly includes steps such as data preprocessing, key parameter inversion, training of the first random forest model, generation of synthetic data under physical constraints, training of the second random forest model, and flow inversion.

[0012] The method introduces a physical consistency verification step for the velocity ratio κ between surface flow velocity and cross-sectional average flow velocity to ensure that all synthesized data and the final model conform to the basic principles of hydraulics, thereby guaranteeing the physical rationality of the prediction results.

[0013] The aforementioned dual random forest cascade design decouples the complex four-dimensional relationship between river width, water depth, surface velocity, and flow rate into two more correlated and stable mapping relationships: "river width-water depth → surface velocity" and "river width-surface velocity → flow rate". This significantly reduces the learning difficulty of the model and improves the training efficiency and model stability under small sample conditions.

[0014] The specific implementation steps of the technical solution of this invention are as follows.

[0015] S1: Data Acquisition and Preprocessing: Acquiring measured hydrological datasets of river cross sections. real The measured hydrological data includes: river width , water depth Surface flow rate and measured flow rate The measured hydrological data underwent quality checks and preprocessing, including missing value handling, outlier detection, and physical consistency verification (by verifying the flow velocity ratio). The values ​​are within a preset reasonable range; the preprocessed test dataset is randomly divided into training sets according to a preset ratio ( train ) and test set ( test ).

[0016] S2: Retrieve Manning coefficients and train the first random forest model. Model A: Based on the training set. train The Manning roughness coefficients corresponding to each sample were obtained by inverting the hydraulic formulas. and its empirical distribution; and with the training set train Using river width and water depth as input features and surface flow velocity as the prediction target, a first random forest model for predicting surface flow velocity is trained. .

[0017] S3: Generate synthetic data under physical constraints.

[0018] S31: Based on the training set train Based on the statistical characteristics, candidate data pairs for river width and water depth are generated within a reasonable physical range.

[0019] S32: Using the surface velocity prediction model The candidate data pairs are predicted to obtain the corresponding surface flow velocity values. .

[0020] S33: Based on the hydraulic Manning formula, and combined with the preset river channel slope and the Manning coefficient obtained from the inversion in the previous steps, calculate the average flow velocity of the candidate data at the corresponding cross-section. .

[0021] S34: Calculate surface flow velocity With cross-sectional average velocity ratio To obtain the flow rate ratio .

[0022] S35: Filter the flow rate ratio Data within a preset reasonable range; surface flow rate through filtered data. Random noise is added to simulate measurement errors, and physically consistent flow values ​​are calculated using the noise-added data, forming a physically constrained synthetic hydrological dataset. The number of samples in the synthetic hydrological dataset shall be no less than N times the number of samples in the measured hydrological data.

[0023] S4: Train the second random forest model: Use the tested training set... train Synthetic dataset with physical constraints Merge to form an enhanced hybrid training set Then, the parts are randomly divided according to a preset ratio. For the initial training set and optimization set; The second random forest model, Model B, is trained using the initial training set, with river width and surface flow velocity as input features and the corresponding flow rate as the prediction target. Hyperparameters are optimized through grid search and cross-validation. Then, the reserved [data / ... The optimized dataset was used for validation and tuning, and the final traffic inversion model was obtained after training. .

[0024] S5: Model performance evaluation: using the reserved test set test The trained flow inversion model To perform a performance evaluation, calculate three key metrics: R 2 (Coefficient of determination), RMSE (root mean square error), and MAPE (mean absolute percentage error) are used to quantify the model's generalization ability and prediction accuracy.

[0025] S6: Practical Prediction Application and Reliability Assessment: Input the river width and surface velocity of the river section to be measured into the flow inversion model. The output yields the predicted flow rate. Q pred And assess the reliability of the prediction results.

[0026] Furthermore, the physical consistency verification The formula for calculating the value is: ,in , n This is the Manning coefficient. R For hydraulic radius, S The riverbed slope; the reasonable flow velocity ratio The preset reasonable range is [1.1, 1.4].

[0027] Furthermore, in step S2, the key physical parameter Manning roughness coefficient is inverted based on the Manning formula. n This allows us to determine its empirical distribution; specifically, through the formula... , ,in A i The cross-sectional area of ​​the water passage is... R i For hydraulic radius, S For the river slope, For the river width, The water is deep.

[0028] Furthermore, in step S31, when generating candidate data pairs for river width and water depth, a method based on the measured training set is used. trainThe data are sampled from a truncated normal distribution with mean and standard deviation.

[0029] Further, in step S35: the surface flow rate value Add random noise to simulate measurement error, using the following formula: , ,in .

[0030] Furthermore, step S35 also includes the synthetic dataset. The size N is the measured hydrological dataset. real The sample size is more than 100 times larger than m to ensure sufficient training and generalization ability of the model.

[0031] Furthermore, in step S4, the random division according to a preset ratio The initial training set and the optimization set are preferably in a ratio of 80%:20%.

[0032] Further, in step S6, the reliability assessment of the prediction result specifically includes: calculating the confidence interval of the predicted flow value, and determining the reliability level based on the ratio of the width of the confidence interval to the predicted flow value.

[0033] Furthermore, the confidence interval for the predicted flow rate value is calculated by analyzing the input point in the mixed training set. The prediction residuals of the nearest neighbors in the feature space are used to calculate the confidence interval of the current predicted flow rate based on the statistical distribution of the prediction residuals, which serves as a quantitative indicator of its reliability.

[0034] Furthermore, the reliability level of the prediction result is determined based on the ratio (%) of the confidence interval width to the predicted flow value, and is specifically divided into: very reliable: W<5%; very reliable: 5%≤W<10%; reliable: 10%≤W<20%; moderately reliable: 20%≤W<30%; limited reliable: W≥30%.

[0035] (iii) Beneficial effects.

[0036] Compared with the prior art, the technical solution provided by the present invention has the following outstanding advantages.

[0037] Solving the problem of few-shot learning: Through a synthetic data generation mechanism under physical constraints, tens of thousands of high-quality training samples can be derived from dozens of sets of real-world data, fundamentally solving the problem that data-driven methods cannot be effectively trained under scarce data conditions.

[0038] Ensuring physical consistency: The hydraulic formula is innovatively embedded as a strong constraint into the data generation loop. By dynamically verifying the velocity ratio κ value and filtering non-physical data, it is ensured that the synthesized data and the final model output strictly follow the laws of hydraulics, which significantly improves the reliability and interpretability of the model.

[0039] Innovative dual-model cascade architecture: By adopting a dual random forest cascade architecture, the complex four-dimensional flow inversion problem of "river width, water depth, surface velocity, and flow rate" is decoupled into two more stable and easier-to-learn sub-problems, which reduces the difficulty of model learning and improves the training success rate and generalization ability under small sample conditions.

[0040] Highly practical for engineering applications: This method has low dependence on prior knowledge, is easy to automate, and provides an efficient and reliable technical tool for river flow monitoring in areas with no or scarce data.

[0041] Attached image description.

[0042] Figure 1 This is a flowchart illustrating the overall process of the river flow inversion method of the present invention.

[0043] Figure 2 A schematic diagram illustrating the principle of dual random forest cascade and physical constraint data generation.

[0044] Figure 3 Inverted Manning coefficient distribution diagram.

[0045] Figure 4 A comparison chart of river width between synthetic data and measured training data.

[0046] Figure 5 Model performance evaluation analysis and comparison chart of predicted and actual traffic.

[0047] Detailed implementation method.

[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0049] This invention provides a method for river flow inversion based on physical constraints and a double random forest cascade, the overall process of which is as follows: Figure 1 As shown. The following is a specific illustration using a section of the upper reaches of the Fen River as an example, but the scope of protection of this invention is not limited to the following embodiments.

[0050] Example 1.

[0051] (1) Data acquisition and preprocessing.

[0052] Thirty-one sets of measured cross-sectional data were collected from a regular section of the upper reaches of the Fen River (river width ranging from 20 to 45 meters, water depth ranging from 0.1 to 3.0 meters) to form a measured hydrological dataset. real The data includes four parameters: river width (B), water depth (D), surface velocity (Vs), and flow rate (Q).

[0053] For dataset real Quality checks were performed, including missing value and outlier detection, as well as physical consistency verification based on the Manning formula (calculating the flow rate ratio κ to ensure it falls within a reasonable range of [1.1, 1.4]). All data in this embodiment passed the verification.

[0054] The 31 sets of data were randomly divided into training sets in an 8:2 ratio. train (25 groups) and test set test (6 sets). The training set is used for model training and parameter inversion, while the test set is strictly isolated and used for the final model performance evaluation.

[0055] (2) Key parameter inversion and training of the first random forest model (Model A).

[0056] Based on training set train via Manning's formula The empirical distribution of the Manning roughness coefficient n is obtained by inversion, see... Figure 3 As shown. The cross-sectional area of ​​the water passage is... hydraulic radius The river slope S was set to the default value of 0.00092 based on topographic data. The inversion results show that the peak value of the Manning coefficient is 0.0338, with a 95% confidence interval of [0.028, 0.048].

[0057] Subsequently, using the river width (B) and water depth (D) from the training set as input features and surface velocity (Vs) as the prediction target, the first random forest model (Model A) was trained. Hyperparameters were optimized through grid search and 5-fold cross-validation, and the final optimal parameter combination was determined as follows: number of decision trees (n_estimators) = 100, maximum depth (max_depth) = 5, minimum number of samples for internal node splits (min_samples_split) = 2, and minimum number of samples for leaf nodes (min_samples_leaf) = 1.

[0058] Model A was trained using the optimal parameters and evaluated on an independent validation set. Its coefficient of determination R² reached 0.89 and the root mean square error RMSE was 1.24 m / s, indicating that the model successfully learned the nonlinear relationship between river width, water depth and surface velocity.

[0059] The parameters described above are merely preferred examples for specific data in this embodiment and are not intended to limit the invention. In practical applications, they can be adjusted according to the size and complexity of the dataset.

[0060] (3) Generation of synthetic data under physical constraints.

[0061] The procedure for this step is as follows: Figure 2 As shown. First, within the physical range of river width [20m, 45m] and water depth [0.1m, 3.0m], based on the training set... train The mean and standard deviation of the data were used to generate candidate river width-depth data pairs by sampling from a truncated normal distribution.

[0062] Predict the initial surface velocity values ​​for each candidate data pair using the trained Model A. By combining the inverted Manning coefficient distribution and the river slope S, the corresponding cross-sectional average velocity is calculated using the Manning formula. .

[0063] Next, a core physical consistency check is performed: the flow rate ratio is calculated. Only candidate samples with κ values ​​within a preset reasonable range [1.1, 1.4] are retained to ensure that they conform to the vertical velocity distribution law of natural river channels.

[0064] To simulate actual measurement errors, random noise is added to the surface flow velocity values ​​of the selected samples: ,in , .

[0065] Finally, based on the surface velocity, river width, and water depth after adding noise, physically consistent flow values ​​were calculated using the Manning formula, ultimately generating a synthetic dataset containing 50,000 samples. Its size is approximately 1610 times that of the original measured data. A comparison of the synthetic data and the measured training data river width can be found in [the original data]. Figure 4 As shown.

[0066] (4) Training and flow inversion of the second random forest model (Model B).

[0067] The actual training set train With synthetic datasets Merge to form an enhanced hybrid training set .

[0068] by A second random forest model (Model B) was trained using 80% random data. This model used river width (B) and (noise-added) surface flow velocity. As input features, the theoretical flow rate is calculated. As the prediction target, the key hyperparameters of Model B were determined through grid search as follows: number of decision trees 300, maximum depth 15.

[0069] Use the remaining 20% The data was used as a validation set for model tuning, ultimately resulting in the traffic inversion model. .

[0070] (5) Model performance evaluation.

[0071] Use strictly isolated test sets test (6 sets of data) Evaluation model Performance. Results are as follows: Figure 5 As shown, the predicted flow rate and the measured flow rate are in high agreement, with a coefficient of determination (R²) as high as 0.93 and a root mean square error (RMSE) of 1.65 m³ / s. This indicates that the method of the present invention has successfully trained a high-precision flow rate inversion model under the condition of a very small sample size (31 sets) of measured data.

[0072] (6) Predictive application and reliability assessment.

[0073] The trained Model B is deployed to the application system. For a new cross-section to be measured, the system can output the predicted flow rate by inputting the river width and surface velocity obtained on site. Q pred .

[0074] To evaluate the reliability of a single prediction result, this invention also provides a confidence interval estimation method. Specifically, it involves using an enhanced hybrid training set... Find the K nearest neighbors (K=5 in this example) of the current prediction input (river width, surface velocity) in the feature space; calculate the prediction residual of Model B for these K samples. ; Calculate the current predicted flow based on the statistical distribution of the residuals (such as standard deviation). Q pred The 95% confidence interval.

[0075] Based on the relative width of the confidence interval The reliability level is determined by the ratio of the interval width to the predicted value: W < 5 is "very reliable"; 5% ≤ W <10% is considered "very reliable"; 10% ≤ W<20% is considered "reliable", 20% ≤ W <30% is considered "generally indicative". W ≥30% indicates "limited reference value".

[0076] Application Example 1: Input river width B = 28 m, surface velocity Vs = 0.35 m / s, model predicts flow rate. Q =8.5 m³ / s. The calculated 95% confidence interval is [8.376, 8.624] m³ / s, with a relative width... W 2.9% < 5%, rated as "very reliable".

[0077] Application Example 2: Input river width B = 36 m, surface velocity Vs = 0.95 m / s, model predicts flow rate. Q pred =28.8 m³ / s. The calculated 95% confidence interval is [28.031, 29.569] m³ / s, with a relative width of... W 5.34, meeting the criteria of 5% ≤ W < 10%, is assessed as "very reliable".

[0078] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A river flow inversion method based on physical constraints and a double random forest cascade, characterized in that, Includes the following steps: Obtain measured hydrological data of river cross sections, including river width, water depth, surface velocity, and measured flow rate, and perform quality checks and preprocessing on the data, then randomly divide it into training and test sets; Based on the training set, the Manning roughness coefficient corresponding to each sample is inverted using hydraulic formulas. Then, the first random forest model is trained with river width and water depth as input features and surface velocity as the prediction target. Generate synthetic hydrological datasets under physical constraints, specifically including: Based on the statistical characteristics of the training set, candidate data pairs for river width and water depth are generated within a reasonable physical range; The first random forest model is used to predict the surface flow velocity corresponding to each candidate data pair; The average flow velocity of each candidate data point is calculated based on hydraulic formulas, and the velocity ratio of the surface flow velocity to the average flow velocity of the cross section is calculated. Retain candidate data pairs whose flow rate ratio is within a preset reasonable range; Random noise was added to the surface velocity data to simulate measurement error, resulting in simulated surface velocity. The corresponding flow rate was then calculated by combining the river width, forming a physically consistent synthetic hydrological dataset. By fusing the training set and the synthetic hydrological dataset, a hybrid training set is constructed. Using river width and simulated surface velocity as input features and flow rate as the prediction target, a second random forest model is trained for river flow rate inversion.

2. The method according to claim 1, characterized in that, The velocity ratio of the surface flow velocity to the cross-sectional average flow velocity is preset to a reasonable range of 1.1 to 1.

4.

3. The method according to claim 1, characterized in that, The Manning roughness coefficient is calculated using hydraulic formulas based on the cross-sectional area of ​​the water passage, the hydraulic radius, the river slope, and the measured flow rate.

4. The method according to claim 1, characterized in that, When generating candidate data pairs for the river width and water depth, a truncated normal distribution is used for sampling, and its distribution parameters are determined based on the mean and standard deviation of the training set.

5. The method according to claim 1, characterized in that, The random noise is added according to a normal distribution, with a standard deviation ranging from 0.05 to 0.

10.

6. The method according to claim 1, characterized in that, The number of samples in the synthetic hydrological dataset is no less than 100 times the number of samples in the measured hydrological data.

7. The method according to claim 1, characterized in that, It also includes evaluating the performance of the second random forest model by calculating three key metrics: the coefficient of determination, the root mean square error, and the mean absolute percentage error.

8. The method according to claim 1, characterized in that, It also includes a reliability assessment of the flow prediction results of the second random forest model, specifically including: For the river width and surface velocity to be predicted, the nearest samples in the feature space are retrieved from the hybrid training set. Based on the statistical distribution of the prediction residuals of the multiple samples, calculate the confidence interval corresponding to the current predicted flow rate; The reliability level of the prediction result is determined based on the ratio of the confidence interval width to the predicted flow rate.

Citation Information

Patent Citations

  • River section flow real-time intelligent calculation method

    CN113641733A

  • River flow remote sensing monitoring method and device

    CN114463644A

  • River flow measurement side-sweeping radan flow inversion method and river flow measurement side-sweeping radan flow inversion system

    CN116539107A

  • Video-based river flow rate and flow velocity monitoring method and system

    CN117288283A

  • River flow calculation method based on partial measured data in emergency scene

    CN118464129A