CN115830514B - Whole river reach surface flow velocity calculation method and system suitable for curved river channel - Google Patents
Whole river reach surface flow velocity calculation method and system suitable for curved river channel Download PDFInfo
- Publication number
- CN115830514B CN115830514B CN202310044967.9A CN202310044967A CN115830514B CN 115830514 B CN115830514 B CN 115830514B CN 202310044967 A CN202310044967 A CN 202310044967A CN 115830514 B CN115830514 B CN 115830514B
- Authority
- CN
- China
- Prior art keywords
- river
- speed
- grid
- average
- calculating
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000004364 calculation method Methods 0.000 title claims abstract description 30
- 238000000034 method Methods 0.000 claims abstract description 76
- 238000005259 measurement Methods 0.000 claims abstract description 55
- 239000011159 matrix material Substances 0.000 claims abstract description 50
- 230000003287 optical effect Effects 0.000 claims abstract description 48
- 238000013145 classification model Methods 0.000 claims abstract description 22
- 238000012549 training Methods 0.000 claims description 13
- 238000007781 pre-processing Methods 0.000 claims description 12
- 238000011156 evaluation Methods 0.000 claims description 9
- 238000012360 testing method Methods 0.000 claims description 9
- 238000013136 deep learning model Methods 0.000 claims description 6
- 230000000694 effects Effects 0.000 claims description 5
- 238000002790 cross-validation Methods 0.000 claims description 4
- 238000005452 bending Methods 0.000 claims description 3
- 238000012937 correction Methods 0.000 claims description 3
- 238000002372 labelling Methods 0.000 claims description 3
- 238000013135 deep learning Methods 0.000 abstract 1
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 5
- 230000008569 process Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a method and a system for calculating the surface flow rate of a whole river segment suitable for a river channel with a curve, which are characterized in that a straight-channel curve classification model is established by a deep learning method, the straight-channel curve of the river is automatically judged, the straight-channel curve is calculated after the judgment is finished, a flow measurement image matrix corresponding to the river is divided into grids by adopting an improved interpolation grid method for the straight channel, each grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each grid according to the speed of each characteristic point; and then calculating the final river speed according to the average river speed of each grid, and converting the curved river channel into a straight river channel for calculation or adopting other grid division modes for calculation.
Description
Technical Field
The invention relates to the technical field of flow field measurement, in particular to a method and a system for calculating the surface flow velocity of a whole river segment suitable for a river channel with a curve.
Background
With the development of the field of computer vision, a method for calculating river surface flow rate through pictures is gradually applied to actual scenes. The optical flow method is a method for calculating a flow rate by finding a correspondence between a previous frame and a current frame using a change in a time domain of pixels in an image sequence and a correlation between adjacent frames. Because the flow rates of all parts of the river are different, the middle part is fast, and the two sides are slow, in order to integrally evaluate the flow rate of the river, the flow rate of the whole river is required to be obtained, when the flow rate of the whole river is calculated by using an optical flow method, interpolation grid calculation is usually adopted, but the method is only suitable for calculating the flow rate of the whole river of a straight river, and is not suitable for curve sections, because the curve direction is not perpendicular to the section of the river, and larger errors can occur. For a curved river channel with straight sections and curved sections, the existing optical flow method based on interpolation grids cannot distinguish the straight sections from the curved sections on one hand, and the error of the calculation result of the curved sections is larger on the other hand.
Disclosure of Invention
The invention provides a method and a system for calculating the surface flow velocity of a whole river section suitable for a river channel with a curve, which are used for solving or at least partially solving the technical problem of larger calculation result error in the prior art.
In order to solve the above technical problems, a first aspect of the present invention provides a method for calculating a surface flow rate of a whole river segment suitable for a curved river channel, including:
collecting river flow video, and extracting 1 frame from the collected river flow video at intervals of preset time intervals and preset frame intervals to obtain a flow measurement image matrix, wherein the flow measurement image matrix comprises a plurality of images;
preprocessing an image in the obtained flow measurement image matrix;
classifying images in the preprocessed current measurement image matrix by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a curved river channel, and the pre-trained classification model is a deep learning model;
when the classification result is a straight river channel, adopting an improved interpolation grid method to grid-divide a current measurement image matrix corresponding to the river channel, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, calculating a light flow value for each characteristic point by adopting an LK light flow algorithm, and calculating the speed of the characteristic point according to the light flow value; calculating the average river speed of each grid according to the speed of each characteristic point; calculating the final river speed according to the average river speed of each grid;
when the classification result is a curved river channel, one of two methods is adopted for calculation, wherein the first method is as follows: separating the part judged to be the curved river channel from the image, selecting the part which accords with the preset condition with the section distance of the side-by-side river channel, and then calculating the river speed by using a straight river channel calculating method, wherein the second method is as follows: dividing a large grid according to the covering condition of the curved river channel, wherein the diagonal length of the large grid is the section length, determining the size of a square according to the diagonal length, and then taking a small grid on the diagonal of the square; each small grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each small grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each small grid.
In one embodiment, preprocessing an image in the obtained current measurement image matrix includes:
and eliminating hue and saturation information of the image in the current measurement image matrix, converting the color image into a gray level image, adjusting the hue of the image by using a log correction method, and cutting the boundary of the image.
In one embodiment, the pre-trained classification model is obtained by:
collecting a large number of river surface images, labeling the collected river surface images, and constructing an experimental data set;
dividing the constructed experimental data set into a training set and a testing set according to k-fold cross validation;
and training the model by taking the training set as input, taking the test set as input, judging the effect of the model according to the evaluation factors, and adjusting the parameters of the model according to the result of the evaluation factors to obtain a pre-trained classification model.
In one embodiment, the average river velocity for each grid is calculated from the velocities of each feature point by:
wherein ,for the number of feature points contained in the a-th grid,/->、/>The speeds of the 1 st feature point and the m-th feature point in the a-th grid, respectively,/>Is the average river speed of the a-th grid.
In one embodiment, the final river speed is calculated from the average river speed of each grid by:
the average of river velocities for all grids was calculated:
wherein ,for the average river speed of grid 1, +.>、/>Average river speeds for the a-th and f-th grids, respectively, +.>For the total number of grids, +.>Is the average of river speeds for all grids;
calculating the difference between the average river speed of each grid and the average of the river speeds of all grids;
sorting the calculated differences from high to low, and deleting grids corresponding to the differences meeting preset conditions;
the average of the river velocities is calculated for the remaining grids as the final river velocity:
wherein ,for the number of remaining meshes +.>For the average river velocity of the s-th grid of the remaining grids,the final river speed obtained by the straight river channel calculation method is obtained.
In one embodiment, the average river speed of each small grid is calculated from the speed of each feature point by:
wherein ,for the number of feature points contained in the b-th cell, +.>、/>Speed of 1 st feature point and z-th feature point of b-th small grid, respectively, +.>Mean for the b-th cellRiver speed.
In one embodiment, the final river speed is calculated from the average river speed of each cell by:
the average of river velocities for all cells was calculated:
wherein ,for average river speed of 1 st small grid, +.>、/>Average river speeds for the b-th and q-th cells, respectively, q being the total number of cells, +.>Is the average value of river speeds of all small grids;
calculating the difference between the average river speed of each small grid and the average value of the river speeds of all the small grids;
sorting the calculated difference values from high to low, and deleting small grids corresponding to the difference values meeting preset conditions;
the average of the river velocities was calculated for the remaining cells as the final river velocity:
wherein ,for the number of remaining cells, +.>For the remaining smallAverage river velocity of the h-th grid of the grids,
and calculating the final river speed for the second method of bending the river channel.
Based on the same inventive concept, a second aspect of the present invention provides a system for calculating the surface flow rate of a whole river segment suitable for a river channel with a curve, comprising:
the video acquisition module is used for acquiring river flow videos, extracting 1 frame from the acquired river flow videos at intervals of preset time intervals and preset frame intervals to obtain a flow measurement image matrix, wherein the flow measurement image matrix comprises a plurality of images;
the preprocessing module is used for preprocessing the images in the obtained flow measurement image matrix;
the classification module is used for classifying the images in the preprocessed current measurement image matrix by utilizing a pre-trained classification model, wherein the classification result comprises a straight river channel and a curved river channel, and the pre-trained classification model is a deep learning model;
the straight river channel calculation module is used for dividing the grid of the current measurement image matrix corresponding to the river by adopting an improved interpolation grid method when the classification result is the straight river channel, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each grid according to the speed of each characteristic point; calculating the final river speed according to the average river speed of each grid;
the curved river channel calculation module is used for calculating by adopting one of two methods when the classification result is a curved river channel, wherein the first method is as follows: separating the part judged to be the curved river channel from the image, selecting the part which accords with the preset condition with the section distance of the side-by-side river channel, and then calculating the river speed by using a straight river channel calculating method, wherein the second method is as follows: dividing a large grid according to the covering condition of the curved river channel, wherein the diagonal length of the large grid is the section length, determining the size of a square according to the diagonal length, and then taking a small grid on the diagonal of the square; each small grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each small grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each small grid.
Compared with the prior art, the invention has the following advantages and beneficial technical effects:
the invention provides a method for calculating the surface flow velocity of a whole river section suitable for a curved river channel, which comprises the steps of firstly constructing a pre-trained classification model, classifying the curved river channel and a straight river channel, so as to realize the recognition of the river channel, dividing a current measurement image matrix into a plurality of grids by adopting a grid division mode for the straight river channel after classifying, calculating a light flow value by adopting an LK light flow algorithm for characteristic points in each grid, wherein the light flow value represents the movement condition of the characteristic points between image frames in the current measurement image matrix, calculating the speed of the characteristic points according to the calculated light flow value, further calculating the speed of a river, and calculating the river speed by adopting two different methods for the curved river channel. The method provided by the invention can realize classification of the curved river channel and the straight river channel on one hand, and speeds up the recognition of the straight channel curve of the whole river segment; on the other hand, the improved interpolation grid method and the optical flow algorithm are combined to calculate the flow velocity for the curved river channel and the straight river channel, so that the calculation accuracy is improved, and the calculation error of the existing method is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for calculating the surface flow rate of a whole river based on a river suitable for a river with a curve according to the embodiment of the invention;
FIG. 2 is a block diagram of a computing system for the surface flow rate of a whole river based on a channel with curves according to an embodiment of the present invention.
Detailed Description
The invention aims to provide a method and a system for calculating the surface flow velocity of a whole river reach suitable for a river reach with a curve, which are used for solving the technical problem of larger calculation result error in the prior art.
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
The embodiment of the invention provides a method for calculating the surface flow velocity of a whole river section suitable for a river channel with a curve, which comprises the following steps:
collecting river flow video, and extracting 1 frame from the collected river flow video at intervals of preset time intervals and preset frame intervals to obtain a flow measurement image matrix, wherein the flow measurement image matrix comprises a plurality of images;
preprocessing an image in the obtained flow measurement image matrix;
classifying images in the preprocessed current measurement image matrix by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a curved river channel, and the pre-trained classification model is a deep learning model;
when the classification result is a straight river channel, adopting an improved interpolation grid method to grid-divide a current measurement image matrix corresponding to the river channel, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, calculating a light flow value for each characteristic point by adopting an LK light flow algorithm, and calculating the speed of the characteristic point according to the light flow value; calculating the average river speed of each grid according to the speed of each characteristic point; calculating the final river speed according to the average river speed of each grid;
when the classification result is a curved river channel, one of two methods is adopted for calculation, wherein the first method is as follows: separating the part judged to be the curved river channel from the image, selecting the part which accords with the preset condition with the section distance of the side-by-side river channel, and then calculating the river speed by using a straight river channel calculating method, wherein the second method is as follows: dividing a large grid according to the covering condition of the curved river channel, wherein the diagonal length of the large grid is the section length, determining the size of a square according to the diagonal length, and then taking a small grid on the diagonal of the square; each small grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each small grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each small grid.
Referring to fig. 1, a flowchart of a method for calculating a surface flow rate of a whole river segment based on a river channel with a curve according to an embodiment of the present invention is shown.
Specifically, a preset time intervalAnd preset frame interval +.>Can be selected according to actual conditions, and the obtained current measurement image matrix is +.>I represents the sequence number of video frames (images) and n is the total number of video frames.
For straight river channels, the calculation mode of the invention improves the grid interpolation method and combines LK optical flow algorithm to calculate river velocity. The improvement point is mainly that when the final river speed is calculated according to the average river speed of each grid, the grids are screened according to the difference value of the average river speed of each grid and the overall average speed (average speed of all grids), and then the river speed is calculated according to the rest grids, so that grids with larger errors can be filtered out in the mode, and the calculation accuracy is improved.
For the curved river, the calculation method includes two methods, namely separating the part judged as the curved river, rotating, selecting a part close to the flow measurement section, and calculating in the same way as the straight river. And selecting a close distance to the flow measurement section, namely, a distance within a preset distance range, and then meeting a preset condition. Secondly, firstly, large grids are taken, the number of the large grids is determined according to the covering condition of a curved river channel, the whole curved river channel is covered optimally, the diagonal length of the large grids is set to be the section length, the size of a square is determined according to the diagonal length, and then small grids are taken on the diagonal of the square. The calculation is then performed in a manner similar to a straight-line.
In the specific implementation process, the implementation mode of calculating the light value by adopting the LK light flow algorithm for each characteristic point is as follows, and the Lucas-Kanade light flow algorithm is utilized for preprocessing the flow measurement image matrixProcessing, namely, a current measurement image matrix is treated by pyramid layering>Each image in the image is scaled layer by layer, the resolution of the bottommost image is the largest, the resolution of the topmost image is the smallest, and from the topmost image, the feature detection algorithm is utilized to perform feature detection to obtain a kth frame->And (k+1) th frame->Feature matching is carried out to obtain the feature points of theEstimating the optical flow value of the next layer according to the optical flow value in the top layer image, estimating the optical flow value as the initial optical flow value of the next layer, calculating the actual optical flow value of the next layer according to the initial optical flow value of the next layer by using a method for calculating the optical flow value of the top layer image, and reciprocating until the optical flow value of the bottommost layer (namely the original image optical flow value) is calculated, thereby obtaining the optical flow value of the measured image matrix>The optical flow values of the measurement image matrix represent the movement of the feature points between the image frames in the measurement image matrix, wherein +.>As a component in the direction parallel to the river cross section, +.>Is a component perpendicular to the river cross section.
And then calculating the speed of the feature points according to the optical flow values, wherein the implementation mode is as follows:
based on the optical flow value of the current measurement image matrix, the offset of the characteristic points in the current measurement image matrix can be obtained,Then, the offset value of the characteristic point in the current measurement image matrix is calculated according to the Euclidean distance>:
Calculating the speed of each filtered characteristic point according to the time of the video corresponding to the current measurement image matrix, namely the river speed of the characteristic point under the pixel coordinate system:
wherein ,for the river speed of each filtered feature point in the pixel coordinate system, +.>Time of video corresponding to the current image matrix, +.>Is the offset value. The calculation is performed in the above manner for all feature points in each grid.
In one embodiment, preprocessing an image in the obtained current measurement image matrix includes:
and eliminating hue and saturation information of the image in the current measurement image matrix, converting the color image into a gray level image, adjusting the hue of the image by using a log correction method, and cutting the boundary of the image.
In one embodiment, the pre-trained classification model is obtained by:
collecting a large number of river surface images, labeling the collected river surface images, and constructing an experimental data set;
dividing the constructed experimental data set into a training set and a testing set according to k-fold cross validation;
and training the model by taking the training set as input, taking the test set as input, judging the effect of the model according to the evaluation factors, and adjusting the parameters of the model according to the result of the evaluation factors to obtain a pre-trained classification model.
In the specific implementation process, pictures of straight river channels and curved river channels are marked manually, labelme is used for marking water bodies, the pictures are divided into two types of water bodies and backgrounds, label files in json format are generated after marking is completed, the label files in json format are interpreted as label pictures in png format, and the pixel values of the label pictures are only 0 and 1 because the pixel values of different ground object types are different, wherein 0 represents a background part of a non-water body, 1 represents a water body part, and the display result in the label pictures is as follows: the background part is black, and the water body part is red.
Each dataset was divided into training and testing sets according to k-fold cross validation: the dataset was divided into k groups, each time k-1 groups were selected as training sets and 1 group as test sets.
The method comprises the steps of adopting a resnet as a basic network of a full convolution neural network to be built, taking a training set as an input training model, carrying out convolution operation on an image, replacing a full connection layer in the resnet network with a convolution layer, after obtaining picture features, carrying out deconvolution operation on the picture to restore the picture to the original size as the picture features are gradually reduced, obtaining a straight/curve classification model, taking a test set as an input, judging the effect of the model according to an evaluation factor, and adjusting parameters of the model according to the result of the evaluation factor to obtain a proper classification model. In a specific example, the evaluation factor is a kappa coefficient, and the calculation formula is:
wherein Total sum of number of samples per class of correctly classified/total number of samples, see table 1:
TABLE 1
Then the first time period of the first time period,、/>the calculation formula of (2) is as follows:
wherein ,t1 When the actual class is 0, the number of samples with the predicted class also being 0 (correctly classified), s 1 When the actual class is 0, predicting the number of samples with class 1, t 2 When the actual class is 1, predicting the number of samples with class 0, s 2 When the actual class is 1, the number of samples with class 1 (correctly classified) is predicted.
In one embodiment, the average river velocity for each grid is calculated from the velocities of each feature point by:
wherein ,for the number of feature points contained in the a-th grid,/->、/>The speeds of the 1 st feature point and the m-th feature point in the a-th grid, respectively,/>Is the average river speed of the a-th grid.
In one embodiment, the final river speed is calculated from the average river speed of each grid by:
the average of river velocities for all grids was calculated:
wherein ,for the average river speed of grid 1, +.>、/>Average river speeds for the a-th and f-th grids, respectively, +.>For the total number of grids, +.>Is the average of river speeds for all grids;
calculating the difference between the average river speed of each grid and the average of the river speeds of all grids;
sorting the calculated differences from high to low, and deleting grids corresponding to the differences meeting preset conditions;
the average of the river velocities is calculated for the remaining grids as the final river velocity:
wherein ,for the number of remaining meshes +.>For the average river velocity of the s-th grid of the remaining grids,the final river speed obtained by the straight river channel calculation method is obtained.
In a specific implementation process, the grid corresponding to the difference value meeting the preset condition may be a grid with the difference value ranked at the front, for example, a grid ranked at the front 10%, 15% or 20%. After deleting part of the grids, the average value is calculated again for the rest grids, so that the accuracy of calculation can be improved.
In one embodiment, the average river speed of each small grid is calculated from the speed of each feature point by:
wherein ,for the number of feature points contained in the b-th cell, +.>、/>Speed of 1 st feature point and z-th feature point of b-th small grid, respectively, +.>The average river speed for the b-th trawl.
In one embodiment, the final river speed is calculated from the average river speed of each cell by:
the average of river velocities for all cells was calculated:
wherein ,for average river speed of 1 st small grid, +.>、/>Average river speeds for the b-th and q-th cells, respectively, q being the total number of cells, +.>Is the average value of river speeds of all small grids;
calculating the difference between the average river speed of each small grid and the average value of the river speeds of all the small grids;
sorting the calculated difference values from high to low, and deleting small grids corresponding to the difference values meeting preset conditions;
the average of the river velocities was calculated for the remaining cells as the final river velocity:
wherein ,for the number of remaining cells, +.>For the average river velocity of the h-th grid of the remaining small grids,
and calculating the final river speed for the second method of bending the river channel.
Specifically, similarly to the straight river course, after calculating the average value of the river velocities of all the small grids, the small grids are screened according to the difference between the average value and the average value of the river velocities of all the small grids, and after deleting part of the small grids, the average value is calculated again, thereby obtaining the river velocity of the curved river course.
Example two
Based on the same inventive concept, this embodiment provides a system for calculating the surface flow rate of a whole river segment suitable for a river channel with a curve, referring to fig. 2, the system includes:
the video acquisition module 201 is configured to acquire a river flow video, extract 1 frame from the acquired river flow video at intervals of a preset time interval and a preset frame interval, and obtain a current measurement image matrix, where the current measurement image matrix includes a plurality of images;
a preprocessing module 202, configured to preprocess an image in the obtained current measurement image matrix;
the classification module 203 is configured to classify images in the preprocessed current measurement image matrix by using a pre-trained classification model, where the classification result includes a straight river channel and a curved river channel, and the pre-trained classification model is a deep learning model;
the straight river channel calculation module 204 is configured to, when the classification result is a straight river channel, perform grid division on a current measurement image matrix corresponding to the river channel by using an improved interpolation grid method, where the grids have the same size, each grid includes a plurality of feature points, calculate an optical flow value for each feature point by using an LK optical flow algorithm, and calculate a speed of the feature point according to the optical flow value; calculating the average river speed of each grid according to the speed of each characteristic point; calculating the final river speed according to the average river speed of each grid;
the curved river calculation module 205 is configured to calculate, when the classification result is a curved river, by adopting one of two methods, where the first method is: separating the part judged to be the curved river channel from the image, selecting the part which accords with the preset condition with the section distance of the side-by-side river channel, and then calculating the river speed by using a straight river channel calculating method, wherein the second method is as follows: dividing a large grid according to the covering condition of the curved river channel, wherein the diagonal length of the large grid is the section length, determining the size of a square according to the diagonal length, and then taking a small grid on the diagonal of the square; each small grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each small grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each small grid.
Because the system described in the second embodiment of the present invention is a system for implementing the method for calculating the surface flow velocity of the whole river section with a curved river channel in the first embodiment of the present invention, based on the method described in the first embodiment of the present invention, a person skilled in the art can know the specific structure and deformation of the system, and therefore, the detailed description thereof is omitted herein. All systems used in the method of the first embodiment of the present invention are within the scope of the present invention.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims and the equivalents thereof, the present invention is also intended to include such modifications and variations.
Claims (8)
1. The method for calculating the surface flow velocity of the whole river reach suitable for the curved river course is characterized by comprising the following steps:
collecting river flow video, and extracting 1 frame from the collected river flow video at intervals of preset time intervals and preset frame intervals to obtain a flow measurement image matrix, wherein the flow measurement image matrix comprises a plurality of images;
preprocessing an image in the obtained flow measurement image matrix;
classifying images in the preprocessed current measurement image matrix by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a curved river channel, and the pre-trained classification model is a deep learning model;
when the classification result is a straight river channel, adopting an improved interpolation grid method to grid-divide a current measurement image matrix corresponding to the river channel, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, calculating a light flow value for each characteristic point by adopting an LK light flow algorithm, and calculating the speed of the characteristic point according to the light flow value; calculating the average river speed of each grid according to the speed of each characteristic point; calculating the final river speed according to the average river speed of each grid, wherein the improved interpolation grid method can screen the grids according to the difference value between the average river speed of each grid and the overall average speed when calculating the final river speed according to the average river speed of each grid, and then calculating the river speed according to the rest grids;
when the classification result is a curved river channel, one of two methods is adopted for calculation, wherein the first method is as follows: separating the part which is judged to be the curved river channel from the image, selecting the part which accords with the preset condition with the distance between the part and the flow measurement section, and then calculating the river speed by using a straight river channel calculating method, wherein the distance between the part and the flow measurement section accords with the preset condition and is within the preset distance range, and the second method is as follows: dividing a large grid according to the covering condition of the curved river channel, wherein the diagonal length of the large grid is the section length, determining the size of a square according to the diagonal length, and then taking a small grid on the diagonal of the square; each small grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each small grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each small grid.
2. The method for calculating the surface flow rate of a whole river reach with a curved river course according to claim 1, wherein the preprocessing of the image in the obtained current measurement image matrix comprises the following steps:
and eliminating hue and saturation information of the image in the current measurement image matrix, converting the color image into a gray level image, adjusting the hue of the image by using a log correction method, and cutting the boundary of the image.
3. The method for calculating the surface flow rate of a whole river reach with curved river course according to claim 1, wherein the pre-trained classification model is obtained by:
collecting a large number of river surface images, labeling the collected river surface images, and constructing an experimental data set;
dividing the constructed experimental data set into a training set and a testing set according to k-fold cross validation;
and training the model by taking the training set as input, taking the test set as input, judging the effect of the model according to the evaluation factors, and adjusting the parameters of the model according to the result of the evaluation factors to obtain a pre-trained classification model.
4. The method for calculating the surface flow rate of a whole river reach with curved river course according to claim 1, wherein the average river velocity of each grid is calculated according to the velocity of each characteristic point by:
5. The method for calculating the surface flow rate of a whole river reach with curved river course according to claim 1, wherein the final river velocity is calculated according to the average river velocity of each grid by:
the average of river velocities for all grids was calculated:
wherein ,for the average river speed of grid 1, +.>、/>Average river speeds for the a-th and f-th grids, respectively, +.>For the total number of grids, +.>Is the average of river speeds for all grids;
calculating the difference between the average river speed of each grid and the average of the river speeds of all grids;
sorting the calculated differences from high to low, and deleting grids corresponding to the differences meeting preset conditions, wherein the differences meeting the preset conditions are differences of the differences between the average river speeds of the grids and the average river speeds of all grids, and the sorting is in a preset proportion range;
the average of the river velocities is calculated for the remaining grids as the final river velocity:
6. The method for calculating the surface flow rate of a whole river reach with curved river course according to claim 1, wherein the average river velocity of each small grid is calculated according to the velocity of each characteristic point by:
7. The method for calculating the surface flow rate of a whole river reach with curved river course according to claim 1, wherein the final river velocity is calculated according to the average river velocity of each small grid by:
the average of river velocities for all cells was calculated:
wherein ,for average river speed of 1 st small grid, +.>、/>Average river speeds for the b-th and q-th cells, respectively, q being the total number of cells, +.>Is the average value of river speeds of all small grids;
calculating the difference between the average river speed of each small grid and the average value of the river speeds of all the small grids;
sorting the calculated differences from high to low, and deleting small grids corresponding to the differences meeting preset conditions, wherein the differences meeting the preset conditions are differences of the differences between the average river speeds of the grids and the average value of the river speeds of all the grids, and the sorting is in a preset proportion range;
the average of the river velocities was calculated for the remaining cells as the final river velocity:
8. A full-river-segment surface flow velocity computing system suitable for a curved river channel, comprising:
the video acquisition module is used for acquiring river flow videos, extracting 1 frame from the acquired river flow videos at intervals of preset time intervals and preset frame intervals to obtain a flow measurement image matrix, wherein the flow measurement image matrix comprises a plurality of images;
the preprocessing module is used for preprocessing the images in the obtained flow measurement image matrix;
the classification module is used for classifying the images in the preprocessed current measurement image matrix by utilizing a pre-trained classification model, wherein the classification result comprises a straight river channel and a curved river channel, and the pre-trained classification model is a deep learning model;
the straight river channel calculation module is used for dividing the grid of the current measurement image matrix corresponding to the river by adopting an improved interpolation grid method when the classification result is the straight river channel, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each grid according to the speed of each characteristic point; calculating the final river speed according to the average river speed of each grid, wherein the improved interpolation grid method can screen the grids according to the difference value between the average river speed of each grid and the overall average speed when calculating the final river speed according to the average river speed of each grid, and then calculating the river speed according to the rest grids;
the curved river channel calculation module is used for calculating by adopting one of two methods when the classification result is a curved river channel, wherein the first method is as follows: separating the part which is judged to be the curved river channel from the image, selecting the part which accords with the preset condition with the distance between the part and the flow measurement section, and then calculating the river speed by using a straight river channel calculating method, wherein the distance between the part and the flow measurement section accords with the preset condition and is within the preset distance range, and the second method is as follows: dividing a large grid according to the covering condition of the curved river channel, wherein the diagonal length of the large grid is the section length, determining the size of a square according to the diagonal length, and then taking a small grid on the diagonal of the square; each small grid comprises a plurality of characteristic points, an LK optical flow algorithm is adopted for each characteristic point to calculate an optical flow value, and the speed of the characteristic point is calculated according to the optical flow value; calculating the average river speed of each small grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each small grid.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310044967.9A CN115830514B (en) | 2023-01-30 | 2023-01-30 | Whole river reach surface flow velocity calculation method and system suitable for curved river channel |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310044967.9A CN115830514B (en) | 2023-01-30 | 2023-01-30 | Whole river reach surface flow velocity calculation method and system suitable for curved river channel |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115830514A CN115830514A (en) | 2023-03-21 |
CN115830514B true CN115830514B (en) | 2023-05-09 |
Family
ID=85520655
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310044967.9A Active CN115830514B (en) | 2023-01-30 | 2023-01-30 | Whole river reach surface flow velocity calculation method and system suitable for curved river channel |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115830514B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116222676B (en) * | 2023-05-08 | 2023-07-28 | 成都赐华科技有限公司 | Millimeter wave water flow monitoring method and system with accurate positioning |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107664705A (en) * | 2016-07-29 | 2018-02-06 | 奥的斯电梯公司 | The speed detection system and its speed detection method of passenger conveyor |
CN106683114B (en) * | 2016-12-16 | 2019-08-20 | 河海大学 | Fluid motion vector estimating method based on characteristic light stream |
CN112560595B (en) * | 2020-11-30 | 2022-04-29 | 武汉大学 | River cross section flow calculation method based on river surface flow velocity |
CN113012195B (en) * | 2021-03-04 | 2024-02-06 | 西安电子科技大学 | Method for river surface flow velocity estimation based on optical flow calculation and readable storage medium |
CN113781528A (en) * | 2021-08-26 | 2021-12-10 | 山东新一代信息产业技术研究院有限公司 | River surface flow velocity measuring and calculating method based on optical flow calculation |
CN114119670A (en) * | 2021-11-30 | 2022-03-01 | 中国地质大学(武汉) | Flow velocity measuring method for acquiring river video based on smart phone |
-
2023
- 2023-01-30 CN CN202310044967.9A patent/CN115830514B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN115830514A (en) | 2023-03-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111325203B (en) | American license plate recognition method and system based on image correction | |
CN110119728B (en) | Remote sensing image cloud detection method based on multi-scale fusion semantic segmentation network | |
CN111027547B (en) | Automatic detection method for multi-scale polymorphic target in two-dimensional image | |
CN106960195B (en) | Crowd counting method and device based on deep learning | |
CN108564085B (en) | Method for automatically reading of pointer type instrument | |
CN110287826B (en) | Video target detection method based on attention mechanism | |
CN111160249A (en) | Multi-class target detection method of optical remote sensing image based on cross-scale feature fusion | |
CN111626993A (en) | Image automatic detection counting method and system based on embedded FEFnet network | |
CN113554629A (en) | Strip steel red rust defect detection method based on artificial intelligence | |
CN112818969A (en) | Knowledge distillation-based face pose estimation method and system | |
CN111310756A (en) | Damaged corn particle detection and classification method based on deep learning | |
CN110246171B (en) | Real-time monocular video depth estimation method | |
CN112365497A (en) | High-speed target detection method and system based on Trident Net and Cascade-RCNN structures | |
CN110827312A (en) | Learning method based on cooperative visual attention neural network | |
CN115147418B (en) | Compression training method and device for defect detection model | |
CN115830514B (en) | Whole river reach surface flow velocity calculation method and system suitable for curved river channel | |
CN111291818B (en) | Non-uniform class sample equalization method for cloud mask | |
CN113111716A (en) | Remote sensing image semi-automatic labeling method and device based on deep learning | |
CN113139489A (en) | Crowd counting method and system based on background extraction and multi-scale fusion network | |
CN115909006A (en) | Mammary tissue image classification method and system based on convolution Transformer | |
CN110728269B (en) | High-speed rail contact net support pole number plate identification method based on C2 detection data | |
CN115661459A (en) | 2D mean teacher model using difference information | |
CN116342894A (en) | GIS infrared feature recognition system and method based on improved YOLOv5 | |
CN106529441A (en) | Fuzzy boundary fragmentation-based depth motion map human body action recognition method | |
CN110458019B (en) | Water surface target detection method for eliminating reflection interference under scarce cognitive sample condition |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |