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 PDF

Info

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
Application number
CN202310044967.9A
Other languages
Chinese (zh)
Other versions
CN115830514A (en
Inventor
刘炳义
李玉琳
嵇莹
刘维高
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Dashuiyun Technology Co ltd
Original Assignee
Wuhan Dashuiyun Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan Dashuiyun Technology Co ltd filed Critical Wuhan Dashuiyun Technology Co ltd
Priority to CN202310044967.9A priority Critical patent/CN115830514B/en
Publication of CN115830514A publication Critical patent/CN115830514A/en
Application granted granted Critical
Publication of CN115830514B publication Critical patent/CN115830514B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Whole river reach surface flow velocity calculation method and system suitable for curved river channel
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:
Figure SMS_1
wherein ,
Figure SMS_2
for the number of feature points contained in the a-th grid,/->
Figure SMS_3
、/>
Figure SMS_4
The speeds of the 1 st feature point and the m-th feature point in the a-th grid, respectively,/>
Figure SMS_5
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:
Figure SMS_6
wherein ,
Figure SMS_7
for the average river speed of grid 1, +.>
Figure SMS_8
、/>
Figure SMS_9
Average river speeds for the a-th and f-th grids, respectively, +.>
Figure SMS_10
For the total number of grids, +.>
Figure SMS_11
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:
Figure SMS_12
wherein ,
Figure SMS_13
for the number of remaining meshes +.>
Figure SMS_14
For the average river velocity of the s-th grid of the remaining grids,
Figure SMS_15
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:
Figure SMS_16
/>
wherein ,
Figure SMS_17
for the number of feature points contained in the b-th cell, +.>
Figure SMS_18
、/>
Figure SMS_19
Speed of 1 st feature point and z-th feature point of b-th small grid, respectively, +.>
Figure SMS_20
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:
Figure SMS_21
wherein ,
Figure SMS_22
for average river speed of 1 st small grid, +.>
Figure SMS_23
、/>
Figure SMS_24
Average river speeds for the b-th and q-th cells, respectively, q being the total number of cells, +.>
Figure SMS_25
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:
Figure SMS_26
wherein ,
Figure SMS_27
for the number of remaining cells, +.>
Figure SMS_28
For the remaining smallAverage river velocity of the h-th grid of the grids,
Figure SMS_29
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 interval
Figure SMS_30
And preset frame interval +.>
Figure SMS_31
Can be selected according to actual conditions, and the obtained current measurement image matrix is +.>
Figure SMS_32
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 matrix
Figure SMS_33
Processing, namely, a current measurement image matrix is treated by pyramid layering>
Figure SMS_34
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->
Figure SMS_35
And (k+1) th frame->
Figure SMS_36
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>
Figure SMS_37
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 +.>
Figure SMS_38
As a component in the direction parallel to the river cross section, +.>
Figure SMS_39
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
Figure SMS_40
Figure SMS_41
Then, the offset value of the characteristic point in the current measurement image matrix is calculated according to the Euclidean distance>
Figure SMS_42
Figure SMS_43
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:
Figure SMS_44
wherein ,
Figure SMS_45
for the river speed of each filtered feature point in the pixel coordinate system, +.>
Figure SMS_46
Time of video corresponding to the current image matrix, +.>
Figure SMS_47
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:
Figure SMS_48
wherein
Figure SMS_49
Total sum of number of samples per class of correctly classified/total number of samples, see table 1:
TABLE 1
Figure SMS_50
Then the first time period of the first time period,
Figure SMS_51
、/>
Figure SMS_52
the calculation formula of (2) is as follows:
Figure SMS_53
Figure SMS_54
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:
Figure SMS_55
wherein ,
Figure SMS_56
for the number of feature points contained in the a-th grid,/->
Figure SMS_57
、/>
Figure SMS_58
The speeds of the 1 st feature point and the m-th feature point in the a-th grid, respectively,/>
Figure SMS_59
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:
Figure SMS_60
wherein ,
Figure SMS_61
for the average river speed of grid 1, +.>
Figure SMS_62
、/>
Figure SMS_63
Average river speeds for the a-th and f-th grids, respectively, +.>
Figure SMS_64
For the total number of grids, +.>
Figure SMS_65
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:
Figure SMS_66
wherein ,
Figure SMS_67
for the number of remaining meshes +.>
Figure SMS_68
For the average river velocity of the s-th grid of the remaining grids,
Figure SMS_69
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:
Figure SMS_70
wherein ,
Figure SMS_71
for the number of feature points contained in the b-th cell, +.>
Figure SMS_72
、/>
Figure SMS_73
Speed of 1 st feature point and z-th feature point of b-th small grid, respectively, +.>
Figure SMS_74
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:
Figure SMS_75
wherein ,
Figure SMS_76
for average river speed of 1 st small grid, +.>
Figure SMS_77
、/>
Figure SMS_78
Average river speeds for the b-th and q-th cells, respectively, q being the total number of cells, +.>
Figure SMS_79
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:
Figure SMS_80
wherein ,
Figure SMS_81
for the number of remaining cells, +.>
Figure SMS_82
For the average river velocity of the h-th grid of the remaining small grids,
Figure SMS_83
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:
Figure QLYQS_1
wherein ,
Figure QLYQS_2
for the number of feature points contained in the a-th grid,/->
Figure QLYQS_3
、 />
Figure QLYQS_4
The speeds of the 1 st feature point and the m-th feature point in the a-th grid, respectively,/>
Figure QLYQS_5
Is the average river speed of the a-th grid. />
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:
Figure QLYQS_6
wherein ,
Figure QLYQS_7
for the average river speed of grid 1, +.>
Figure QLYQS_8
、/>
Figure QLYQS_9
Average river speeds for the a-th and f-th grids, respectively, +.>
Figure QLYQS_10
For the total number of grids, +.>
Figure QLYQS_11
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:
Figure QLYQS_12
wherein ,
Figure QLYQS_13
for the number of remaining meshes +.>
Figure QLYQS_14
For the average river speed of the s-th grid of the remaining grids,/>
Figure QLYQS_15
The final river speed obtained by the straight river channel calculation method is obtained.
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:
Figure QLYQS_16
wherein ,
Figure QLYQS_17
for the number of feature points contained in the b-th cell, +.>
Figure QLYQS_18
、/>
Figure QLYQS_19
Speed of 1 st feature point and z-th feature point of b-th small grid, respectively, +.>
Figure QLYQS_20
The average river speed for the b-th trawl.
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:
Figure QLYQS_21
wherein ,
Figure QLYQS_22
for average river speed of 1 st small grid, +.>
Figure QLYQS_23
、/>
Figure QLYQS_24
Average river speeds for the b-th and q-th cells, respectively, q being the total number of cells, +.>
Figure QLYQS_25
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:
Figure QLYQS_26
wherein ,
Figure QLYQS_27
for the number of remaining cells, +.>
Figure QLYQS_28
For the average river velocity of the h-th grid of the remaining small grids,
Figure QLYQS_29
and calculating the final river speed for the second method of bending the river channel.
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.
CN202310044967.9A 2023-01-30 2023-01-30 Whole river reach surface flow velocity calculation method and system suitable for curved river channel Active CN115830514B (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

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