CN115830514A - Method and system for calculating surface flow velocity of whole river section of riverway with curve - Google Patents
Method and system for calculating surface flow velocity of whole river section of riverway with curve Download PDFInfo
- Publication number
- CN115830514A CN115830514A CN202310044967.9A CN202310044967A CN115830514A CN 115830514 A CN115830514 A CN 115830514A CN 202310044967 A CN202310044967 A CN 202310044967A CN 115830514 A CN115830514 A CN 115830514A
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 71
- 238000005259 measurement Methods 0.000 claims abstract description 49
- 239000011159 matrix material Substances 0.000 claims abstract description 48
- 230000003287 optical effect Effects 0.000 claims abstract description 47
- 238000004364 calculation method Methods 0.000 claims abstract description 34
- 238000013145 classification model Methods 0.000 claims abstract description 21
- 238000012549 training Methods 0.000 claims description 13
- 238000007781 pre-processing Methods 0.000 claims description 11
- 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
- 238000002372 labelling 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
- 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 4
- 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
- 230000002123 temporal effect Effects 0.000 description 1
Images
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a method and a system for calculating the surface flow velocity of a whole river section applicable to a riverway with a curve, wherein a straight-way curve classification model is established by utilizing a deep learning method, the straight-way curve of a river is automatically judged, the straight-way curve is respectively calculated after the judgment is finished, a flow measurement image matrix corresponding to the river is subjected to grid division by adopting an improved interpolation grid method for the straight way, each grid comprises a plurality of characteristic points, each characteristic point is subjected to LK optical flow algorithm calculation of optical flow values, and the speed of the characteristic points is calculated according to the optical flow values; calculating the average river speed of each grid according to the speed of each characteristic point; and calculating the final river speed according to the average river speed of each grid, wherein the curved river channel can be converted into a straight river channel and then calculated, or other grid division forms are adopted 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 section of a curved river channel.
Background
With the development of the computer vision field, the method of calculating the river surface flow velocity through pictures is gradually applied to the actual scene. The optical flow method is a method for calculating a flow velocity by finding a correspondence between a previous frame and a current frame using a change in a temporal domain of a pixel in an image sequence and a correlation between adjacent frames. Because the flow velocities of all parts of the river are different, the middle is fast, the two sides are slow, the surface flow velocity of the whole river section needs to be obtained for integrally evaluating the river flow velocity, interpolation grid calculation is usually adopted when the surface flow velocity of the whole river section is calculated by using an optical flow method, but the method is only suitable for calculating the surface flow velocity of the whole river section of a straight river section and is not suitable for a curve section, and a large error can occur because the curve direction is not perpendicular to the river section. For a curved river channel with both straight sections and curved sections, the existing optical flow method based on the interpolation grid cannot distinguish the straight sections from the curved sections on one hand, and on the other hand, the error of the calculation result of the curved sections is large.
Disclosure of Invention
The invention provides a method and a system for calculating the surface flow velocity of a whole river reach suitable for a 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 technical problem, a first aspect of the present invention provides a method for calculating a surface flow velocity of a full river reach of a curved river channel, including:
collecting a river flow video, and extracting 1 frame from the collected river flow video at intervals of a preset time interval and a preset frame interval 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 flow measurement image matrix by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a bent river channel, and the pre-trained classification model is a deep learning model;
when the classification result is a straight river channel, carrying out grid division on a flow measurement image matrix corresponding to the river by adopting an improved interpolation grid method, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, each characteristic point is subjected to LK optical flow algorithm to calculate an optical flow value, and the speed of the characteristic points 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;
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 of the river channel judged to be bent from the image, selecting the part of the river channel, the distance of which is in accordance with the preset condition, and then calculating the river speed by using a calculation method of a straight river channel, wherein the second method comprises the following steps: dividing a large grid according to the coverage 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 from the diagonal of the square; each small grid comprises a plurality of feature points, each feature point adopts an LK optical flow algorithm to calculate an optical flow value, and the speed of the feature 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, the preprocessing of the image in the obtained flow measurement image matrix includes:
removing hue and saturation information of the image in the flow measurement image matrix, converting the color image into a gray scale image, adjusting the hue of the image by using a log correction method, and cutting the image boundary.
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 using the training set as input, judging the effect of the model by using the test set as input according to the evaluation factor, and adjusting the parameters of the model according to the result of the evaluation factor to obtain a pre-trained classification model.
In one embodiment, the average river speed for each grid is calculated from the speed of each feature point by:
wherein ,the number of feature points included in the a-th mesh,、the velocities of the 1 st and mth feature points in the a-th grid,is the average river speed of the a-th grid.
In one embodiment, the final river speed is calculated from the average river speed for each mesh in the manner:
calculate the average of river velocities for all grids:
wherein ,is the average river speed of the 1 st grid,、the average river velocities of the a-th and f-th meshes respectively,is the total number of the grids,the average of the river velocities for all grids;
calculating the difference between the average river speed of each grid and the average of the river speeds of all the grids;
sorting the calculated difference values from high to low, and deleting the grids corresponding to the difference values meeting the preset conditions;
the average of river velocities is calculated for the remaining meshes as the final river velocity:
wherein ,as to the number of the remaining grids,the average river speed of the s-th mesh of the remaining meshes,the final river speed obtained by the method for calculating the straight river channel.
In one embodiment, the average river speed for each small grid is calculated from the speed of each feature point by:
wherein ,the number of feature points included in the b-th small mesh,、the velocities of the 1 st and z-th feature points of the b-th small grid respectively,is the average river speed of the b-th cell.
In one embodiment, the final river speed is calculated from the average river speed for each small grid by:
calculate the average of river velocities for all small grids:
wherein ,is the average river speed of the 1 st cell,、the average river velocities of the mth and qth small grids, respectively, q is the total number of grids,the average value of the river speeds of all the small grids;
calculating the difference between the average river speed of each small grid and the average river speed of all the small grids;
sorting the calculated difference values from high to low, and deleting the small grids corresponding to the difference values meeting the preset conditions;
the average of the river velocities is calculated for the remaining small meshes as the final river velocity:
wherein ,as to the number of the remaining grids,is the average river speed of the h-th mesh among the remaining meshes,
and calculating the final river speed for the method II of bending the river channel.
Based on the same inventive concept, the second aspect of the present invention provides a system for calculating surface flow velocity of a whole river reach suitable for a curved river course, comprising:
the video acquisition module is used for acquiring a river flow video, and extracting 1 frame from the acquired river flow video at intervals of a preset time interval and a preset frame interval 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 image in the obtained flow measurement image matrix;
the classification module is used for classifying the images in the flow measurement image matrix after pretreatment by utilizing a pre-trained classification model, and the classification result comprises a straight river channel and a bent river channel, wherein the pre-trained classification model is a deep learning model;
the straight river channel calculation module is used for dividing grids of a flow measurement image matrix corresponding to the river by adopting an improved interpolation grid method when the classification result is the straight river channel, the grids are the same in size, each grid comprises a plurality of feature points, an LK optical flow algorithm is adopted for each feature point to calculate an optical flow value, and the speed of the feature points is calculated according to the optical flow value; calculating the average river speed of each grid according to the speed of each feature 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 the curved river channel, wherein the first method is as follows: separating the part of the river channel which is judged to be the bent river channel from the image, selecting the part of which the distance from the flow measurement section meets the preset condition, and then calculating the river speed by using a calculation method of a straight river channel, wherein the second method comprises the following steps of: dividing a large grid according to the coverage condition of a curved river channel, wherein the length of a diagonal line of the large grid is the length of a section, determining the size of a square according to the length of the diagonal line, and then taking a small grid on the diagonal line of the square; each small grid comprises a plurality of feature points, each feature point adopts an LK optical flow algorithm to calculate an optical flow value, and the speed of the feature 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 advantages and beneficial technical effects as follows:
the invention provides a method for calculating the surface flow velocity of a whole river section with a curved river channel, which is suitable for calculating the flow velocity of the whole river section with the curved river channel. The method provided by the invention can realize the classification of the curved river channel and the straight river channel on one hand, and accelerate the speed of identifying the straight channel and the curved channel of the whole river section; on the other hand, the flow velocity calculation is carried out on the curved river channel and the straight river channel in a mode of combining the improved interpolation grid method and the optical flow algorithm, so that the calculation precision 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 used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flow chart of a method for calculating surface flow velocity of a whole river reach suitable for a curved river channel according to an embodiment of the present invention;
fig. 2 is a block diagram of a system for calculating surface flow velocity of a whole river reach suitable for a curved river channel according to an embodiment of the present invention.
Detailed Description
The invention aims to solve the technical problem of larger calculation result error in the prior art by providing a method and a system for calculating the surface flow velocity of a whole river section of a channel with a curve.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Example one
The embodiment of the invention provides a method for calculating the surface flow velocity of a whole river section suitable for a channel with a curve, which comprises the following steps:
collecting a river flow video, and extracting 1 frame from the collected river flow video at intervals of a preset time interval and a preset frame interval 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 flow measurement image matrix after pretreatment by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a bent river channel, and the pre-trained classification model is a deep learning model;
when the classification result is a straight river channel, carrying out grid division on a flow measurement image matrix corresponding to the river by adopting an improved interpolation grid method, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, each characteristic point is subjected to LK optical flow algorithm to calculate an optical flow value, and the speed of the characteristic points 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;
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 of the river channel judged to be bent from the image, selecting the part of the river channel, the distance of which is in accordance with the preset condition, and then calculating the river speed by using a calculation method of a straight river channel, wherein the second method comprises the following steps: dividing a large grid according to the coverage 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 from the diagonal of the square; each small grid comprises a plurality of feature points, each feature point adopts an LK optical flow algorithm to calculate an optical flow value, and the speed of the feature 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.
Fig. 1 is a flow chart of a method for calculating a surface flow velocity of a whole river reach suitable for a curved river channel according to an embodiment of the present invention.
In particular, the preset time intervalAnd a preset frame intervalCan be selected according to actual conditions to obtain a flow measurement image matrix ofI denotes the number of video frames (pictures) and n is the total number of video frames.
For a straight river channel, the calculation mode of the invention is to improve a grid interpolation method and calculate the river velocity by combining an LK optical flow algorithm. 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 between the average river speed of each grid and the overall average speed (the average speed of all grids), and then the river speed is calculated according to the rest grids, so that some grids with larger errors can be filtered, and the calculation accuracy is improved.
For the curved river channel, two calculation methods are adopted, one is to separate the part which is judged to be the curved river channel, rotate the part, select the part which is close to the flow measurement section, and then calculate the part in the same way as the straight river channel. And selecting the distance between the current measuring section and the current measuring section to be close, namely the distance is within a preset distance range, so that the preset condition is met. Secondly, firstly, large grids are taken, the number of the large grids is determined according to the covering condition of the curved river channel, the whole curve channel is covered optimally, the diagonal length of the large grids is set as the section length, the size of a square is determined according to the diagonal length, and then the small grids are taken on the diagonal of the square. The calculation is then performed in a manner similar to a straight-through.
In the specific implementation process, the light flow value of each feature point is calculated by adopting an LK light flow algorithm in the following implementation mode, and the preprocessed flow measurement image matrix is subjected to Lucas-Kanade light flow algorithmProcessing, and dividing the flow measurement chart in a pyramid layering modeImage matrixZooming each image layer by layer, the resolution of the bottom layer image is maximum, the resolution of the top layer image is minimum, and performing feature detection by using a feature detection algorithm from the top layer image to obtain a kth frameAnd the (k + 1) th frameThe characteristic points are subjected to characteristic matching to obtain a light stream value of each corner point in a top layer image, a light stream value of a next layer is estimated according to the light stream value in the top layer image, the light stream value is estimated to serve as an initial light stream value of the next layer, an actual light stream value of the next layer is calculated by utilizing a method for calculating the light stream value of the top layer image according to the initial light stream value of the next layer, and the steps are repeated from this step to this step until a bottommost light stream value (namely, an original image light stream value) is calculated, and a light stream value of a measurement image matrix is obtainedThe optical flow values of the measured image matrix represent the movement of feature points between image frames in the flow-measuring image matrix, wherein,is a component in a direction parallel to the cross section of the river,is a component in a direction perpendicular to the cross section of the river.
The velocities of the feature points are then calculated from the optical flow values, as follows:
based on the optical flow value of the flow measurement image matrix, the offset of the characteristic point in the flow measurement image matrix can be obtained,Then calculating according to Euclidean distanceObtaining the offset value of the characteristic point in the flow measurement image matrix:
And calculating the speed of each filtered feature point according to the time of the video corresponding to the flow measurement image matrix, namely the river speed of the feature point in a pixel coordinate system:
wherein ,for each filtered feature point river velocity in the pixel coordinate system,for the time of the video corresponding to the side-stream image matrix,is an offset value. The above-described manner is adopted for all the feature points in each mesh.
In one embodiment, the preprocessing of the image in the obtained flow measurement image matrix includes:
removing hue and saturation information of the image in the flow measurement image matrix, converting the color image into a gray scale image, adjusting the hue of the image by using a log correction method, and cutting the image boundary.
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 using the training set as input, judging the effect of the model by using the test set as input according to the evaluation factor, and adjusting the parameters of the model according to the result of the evaluation factor to obtain a pre-trained classification model.
In the specific implementation process, manual labeling is respectively carried out on pictures of a straight river channel and a curved river channel, a labelme is used for labeling a water body, the pictures are divided into a water body and a background, label files in a json format can be generated after labeling is finished, the label files in the json format are interpreted into label pictures in a png format, due to the fact that pixel values of different ground object types are different, the value of the pixel value of each label picture is only 0,1, wherein 0 represents a non-water body background part, 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.
Dividing each data set into a training set and a testing set according to k-fold cross validation: and dividing the data set into k groups, and selecting a k-1 group as a training set and a 1 group as a test set each time.
The resnet can be used as a basic network of a full convolution neural network to be built, a training set is used as an input training model, convolution operation is carried out on images, a full connection layer in the resnet network also replaces a convolution layer, after picture features are obtained, the pictures can be gradually reduced due to convolution, deconvolution operation is carried out on the pictures, the pictures are enabled to be restored to the original size, a straight/curve classification model is obtained, a test set is used as input, the effect of the model is judged according to evaluation factors, parameters of the model are adjusted according to the results of the evaluation factors, and a proper classification model is obtained. In a specific example, the evaluation factor is a kappa coefficient, and the calculation formula is as follows:
TABLE 1
wherein ,t1 When the actual class is 0, the number of samples whose prediction class is also 0 (correct classification), s 1 When the actual class is 0, the number of samples with the prediction class of 1, t 2 The number of samples for predicting class 0, s, when the actual class is 1 2 When the actual class is 1, the number of samples whose class is 1 (correct classification) is predicted.
In one embodiment, the average river speed for each grid is calculated from the speed of each feature point by:
wherein ,the number of feature points included in the a-th mesh,、the velocities of the 1 st and mth feature points in the a-th grid,is the average river speed of the a-th grid.
In one embodiment, the final river speed is calculated from the average river speed for each mesh in the manner:
calculate the average of river velocities for all grids:
wherein ,is the average river speed of the 1 st grid,、the average river velocities of the a-th and f-th meshes respectively,is the total number of the grids,the average of the river velocities for all grids;
calculating the difference between the average river speed of each grid and the average of the river speeds of all the grids;
sorting the calculated difference values from high to low, and deleting the grids corresponding to the difference values meeting the preset conditions;
the average of river velocities is calculated for the remaining grids as the final river velocity:
wherein ,as to the number of the remaining grids,the average river speed of the s-th mesh of the remaining meshes,the final river speed obtained by the method for calculating the straight river channel.
In a specific implementation process, the grids corresponding to the difference values meeting the preset condition may be grids ranked in the top order according to the size of the difference values, for example, grids ranked in the top 10%, 15%, or 20%. After the partial meshes are deleted, the average values are again obtained for the remaining meshes, so that the accuracy of calculation can be improved.
In one embodiment, the average river speed for each small grid is calculated from the speed of each feature point by:
wherein ,the number of feature points included in the b-th small mesh,、the velocities of the 1 st and z-th feature points of the b-th small grid respectively,is the average river speed of the b-th cell.
In one embodiment, the final river speed is calculated from the average river speed for each small grid by:
calculate the average of river velocities for all small grids:
wherein ,is the average river speed of the 1 st cell,、the average river velocities of the mth and qth small grids, respectively, q is the total number of grids,the average value of the river speeds of all the small grids;
calculating the difference between the average river speed of each small grid and the average river speed of all the small grids;
sorting the calculated difference values from high to low, and deleting the small grids corresponding to the difference values meeting the preset conditions;
the average of the river velocities is calculated for the remaining small meshes as the final river velocity:
wherein ,as to the number of the remaining grids,the average river speed for the h-th mesh among the remaining meshes,
and calculating the final river speed for the method II of bending the river channel.
Specifically, similar to the calculation method of the straight river channel, after the average value of the river velocities of all the small grids is calculated, the small grids are screened according to the difference value between the average value and the average value of the river velocities of all the small grids, and after a part of the small grids are deleted, the average value is obtained again, so that the river velocity of the curved river channel can be obtained.
Example two
Based on the same inventive concept, the present embodiment provides a system for calculating the surface flow velocity of a whole river reach of a curved river channel, please refer to fig. 2, and the system includes:
the video acquisition module 201 is configured to acquire a river flow video, and extract 1 frame from the acquired river flow video at intervals of a preset time interval and a preset frame interval to obtain a flow measurement image matrix, where the flow measurement image matrix includes a plurality of images;
the preprocessing module 202 is configured to preprocess an image in the obtained flow measurement image matrix;
the classification module 203 is used for classifying the images in the pretreated flow measurement image matrix by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a bent river channel, and the pre-trained classification model is a deep learning model;
a straight river channel calculation module 204, configured to, when the classification result is a straight river channel, perform mesh division on a flow measurement image matrix corresponding to the river by using an improved interpolation grid method, where the meshes are the same in size, each mesh includes a plurality of feature points, and for each feature point, calculate an optical flow value 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;
a curved river calculation module 205, configured to perform calculation by using one of two methods when the classification result is a curved river, where the first method is: separating the part of the river channel judged to be bent from the image, selecting the part of the river channel, the distance of which is in accordance with the preset condition, and then calculating the river speed by using a calculation method of a straight river channel, wherein the second method comprises the following steps: dividing a large grid according to the coverage condition of a curved river channel, wherein the length of a diagonal line of the large grid is the length of a section, determining the size of a square according to the length of the diagonal line, and then taking a small grid on the diagonal line of the square; each small grid comprises a plurality of feature points, each feature point adopts an LK optical flow algorithm to calculate an optical flow value, and the speed of the feature 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.
Since the system described in the second embodiment of the present invention is a system adopted for implementing the method for calculating the surface flow velocity of the whole river reach of the curved river channel in the first embodiment of the present invention, a person skilled in the art can understand the specific structure and deformation of the system based on the method described in the first embodiment of the present invention, and thus the details are not described herein. All systems adopted by the method in the first embodiment of the invention belong to the protection scope of the 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. Therefore, it is intended that the appended claims be interpreted as including 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 in 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 of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.
Claims (8)
1. A method for calculating the surface flow velocity of a whole river section applicable to a riverway with a curve is characterized by comprising the following steps of:
collecting a river flow video, and extracting 1 frame from the collected river flow video at intervals of a preset time interval and a preset frame interval 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 flow measurement image matrix by using a pre-trained classification model, wherein the classification result comprises a straight river channel and a bent river channel, and the pre-trained classification model is a deep learning model;
when the classification result is a straight river channel, carrying out grid division on a flow measurement image matrix corresponding to the river by adopting an improved interpolation grid method, wherein the grids are the same in size, each grid comprises a plurality of characteristic points, each characteristic point is subjected to LK optical flow algorithm to calculate an optical flow value, and the speed of the characteristic points is calculated according to the optical flow value; calculating the average river speed of each grid according to the speed of each feature 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 of the river channel judged to be bent from the image, selecting the part of the river channel, the distance of which is in accordance with the preset condition, and then calculating the river speed by using a calculation method of a straight river channel, wherein the second method comprises the following steps: dividing a large grid according to the coverage 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 from the diagonal of the square; each small grid comprises a plurality of feature points, each feature point adopts an LK optical flow algorithm to calculate an optical flow value, and the speed of the feature 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 velocity of the whole river reach suitable for the riverway with the curve as claimed in claim 1, wherein the preprocessing of the image in the obtained flow measurement image matrix comprises:
removing hue and saturation information of the image in the flow measurement image matrix, converting the color image into a gray scale image, adjusting the hue of the image by using a log correction method, and cutting the image boundary.
3. The method for calculating the surface flow velocity of the whole river reach suitable for the riverway with the curve as claimed in claim 1, wherein the pre-trained classification model is obtained by the following steps:
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 using the training set as input, judging the effect of the model by using the test set as input according to the evaluation factor, and adjusting the parameters of the model according to the result of the evaluation factor to obtain a pre-trained classification model.
4. The method for calculating the surface flow velocity of the whole river reach suitable for the channel with the curve as claimed in claim 1, wherein the average river velocity of each grid is calculated according to the velocity of each feature point by:
5. The method for calculating the surface flow velocity of the whole river reach suitable for the channel with the curve as claimed in claim 1, wherein the final river speed is calculated according to the average river speed of each grid by:
calculate the average of river velocities for all grids:
wherein ,is the average river speed for the 1 st grid,、the average river velocities for the a-th and f-th meshes respectively,is the total number of the grids,the average of the river velocities for all grids;
calculating the difference between the average river speed of each grid and the average of the river speeds of all the grids;
sorting the calculated difference values from high to low, and deleting the grids corresponding to the difference values meeting the preset conditions;
the average of river velocities is calculated for the remaining meshes as the final river velocity:
6. The method for calculating the surface flow velocity of the whole river reach suitable for the channel with the curve as claimed in claim 1, wherein the average river velocity of each small grid is calculated according to the velocity of each feature point by:
7. The method for calculating the surface flow velocity of the whole river reach suitable for the riverway with the curve as claimed in claim 1, wherein the final river speed is calculated according to the average river speed of each small grid by:
calculate the average of river velocities for all small grids:
wherein ,is the average river speed of the 1 st cell,、the average river velocities of the mth and qth small grids, respectively, q is the total number of grids,the average value of the river speeds of all the small grids;
calculating the difference between the average river speed of each small grid and the average river speed of all the small grids;
sorting the calculated difference values from high to low, and deleting the small grids corresponding to the difference values meeting the preset conditions;
the average of the river velocities is calculated for the remaining small meshes as the final river velocity:
8. A full river reach surface velocity calculation system suitable for taking crooked river course, characterized in that includes:
the video acquisition module is used for acquiring a river flow video, and extracting 1 frame from the acquired river flow video at intervals of a preset time interval and a preset frame interval 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 image in the obtained flow measurement image matrix;
the classification module is used for classifying the images in the flow measurement image matrix after pretreatment by utilizing a pre-trained classification model, and the classification result comprises a straight river channel and a bent river channel, wherein the pre-trained classification model is a deep learning model;
the straight river channel calculation module is used for dividing grids of a flow 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 and each grid comprises a plurality of feature points, calculating an optical flow value by adopting an LK optical flow algorithm for each feature point, and calculating the 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 channel calculation module is used for calculating by adopting one of two methods when the classification result is the curved river channel, wherein the first method is as follows: separating the part of the river channel which is judged to be the bent river channel from the image, selecting the part of which the distance from the flow measurement section meets the preset condition, and then calculating the river speed by using a calculation method of a straight river channel, wherein the second method comprises the following steps of: dividing a large grid according to the coverage condition of a curved river channel, wherein the length of a diagonal line of the large grid is the length of a section, determining the size of a square according to the length of the diagonal line, and then taking a small grid on the diagonal line of the square; each small grid comprises a plurality of feature points, each feature point adopts an LK optical flow algorithm to calculate an optical flow value, and the speed of the feature 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 true CN115830514A (en) | 2023-03-21 |
CN115830514B 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) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116222676A (en) * | 2023-05-08 | 2023-06-06 | 成都赐华科技有限公司 | Millimeter wave water flow monitoring method and system with accurate positioning |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106683114A (en) * | 2016-12-16 | 2017-05-17 | 河海大学 | Fluid motion vector estimation method based on feature optical flow |
US20180029839A1 (en) * | 2016-07-29 | 2018-02-01 | Otis Elevator Company | Speed detection system of passenger conveyor and speed detection method thereof |
CN112560595A (en) * | 2020-11-30 | 2021-03-26 | 武汉大学 | River cross section flow calculation method based on river surface flow velocity |
CN113012195A (en) * | 2021-03-04 | 2021-06-22 | 西安电子科技大学 | Method for estimating river surface flow velocity 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
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180029839A1 (en) * | 2016-07-29 | 2018-02-01 | Otis Elevator Company | Speed detection system of passenger conveyor and speed detection method thereof |
CN106683114A (en) * | 2016-12-16 | 2017-05-17 | 河海大学 | Fluid motion vector estimation method based on feature optical flow |
CN112560595A (en) * | 2020-11-30 | 2021-03-26 | 武汉大学 | River cross section flow calculation method based on river surface flow velocity |
CN113012195A (en) * | 2021-03-04 | 2021-06-22 | 西安电子科技大学 | Method for estimating river surface flow velocity 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 |
Non-Patent Citations (1)
Title |
---|
赵浩源等: ""基于河流表面时空图像识别的测流方法"", 《水资源研究》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116222676A (en) * | 2023-05-08 | 2023-06-06 | 成都赐华科技有限公司 | Millimeter wave water flow monitoring method and system with accurate positioning |
CN116222676B (en) * | 2023-05-08 | 2023-07-28 | 成都赐华科技有限公司 | Millimeter wave water flow monitoring method and system with accurate positioning |
Also Published As
Publication number | Publication date |
---|---|
CN115830514B (en) | 2023-05-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110189255B (en) | Face detection method based on two-stage detection | |
CN111429403B (en) | Automobile gear finished product defect detection method based on machine vision | |
CN110705457A (en) | Remote sensing image building change detection method | |
CN111160249A (en) | Multi-class target detection method of optical remote sensing image based on cross-scale feature fusion | |
CN112861729B (en) | Real-time depth completion method based on pseudo-depth map guidance | |
CN111768388A (en) | Product surface defect detection method and system based on positive sample reference | |
CN103093458B (en) | The detection method of key frame and device | |
CN110675374B (en) | Two-dimensional image sewage flow detection method based on generation countermeasure network | |
CN107341508B (en) | Fast food picture identification method and system | |
CN112818969A (en) | Knowledge distillation-based face pose estimation method and system | |
CN113313031B (en) | Deep learning-based lane line detection and vehicle transverse positioning method | |
CN109165603B (en) | Ship detection method and device | |
CN115147418B (en) | Compression training method and device for defect detection model | |
CN110728269B (en) | High-speed rail contact net support pole number plate identification method based on C2 detection data | |
CN114913498A (en) | Parallel multi-scale feature aggregation lane line detection method based on key point estimation | |
CN116703885A (en) | Swin transducer-based surface defect detection method and system | |
CN115830514B (en) | Whole river reach surface flow velocity calculation method and system suitable for curved river channel | |
CN114596316A (en) | Road image detail capturing method based on semantic segmentation | |
CN111291818B (en) | Non-uniform class sample equalization method for cloud mask | |
CN116188943A (en) | Solar radio spectrum burst information detection method and device | |
CN111027508A (en) | Remote sensing image coverage change detection method based on deep neural network | |
CN108154199B (en) | High-precision rapid single-class target detection method based on deep learning | |
CN112924037A (en) | Infrared body temperature detection system and detection method based on image registration | |
CN117593601A (en) | Water gauge tide checking method based on deep learning | |
CN117274355A (en) | Drainage pipeline flow intelligent measurement method based on acceleration guidance area convolutional neural network and parallel multi-scale unified network |
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 |