Water gauge water level identification method for riverway, reservoir and impounding reservoir
By collecting water body video data and using lightweight models to identify water level, the existing water level monitoring technology is solved, and the problems of low efficiency, high maintenance cost and susceptibility to environmental interference are achieved, and efficient and accurate water level monitoring is achieved.
Patent Information
- Application Number
- CN202411581326.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-25
AI Technical Summary
The existing water level monitoring technology has problems such as low efficiency, high maintenance costs and susceptibility to environmental interference.
By collecting water body video data, the water level level recognition of the trained Nanodet model, Picodet model and VGG16 model is used to calculate the water level height based on the distance proportional parameters.
It realizes automated and real-time water level monitoring, improves monitoring efficiency and accuracy, reduces maintenance costs and manpower requirements, and is suitable for water level monitoring in multiple scenarios.
Smart Images

Figure CN119516375A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of water conservancy monitoring, and in particular relates to a method for identifying a water level of a river, a reservoir or a storage tank. Background Art
[0002] Water level monitoring is an important part of water resource management and flood prevention and early warning, and plays a vital role in ensuring public safety and rationally allocating water resources. Currently, there are three main methods of water level monitoring: manual inspection, mechanical / electronic water level gauges, and intelligent water level monitoring systems based on visual recognition technology.
[0003] The manual inspection method relies on staff to regularly measure water levels on site and record data. Although this method is simple and intuitive, it has obvious shortcomings due to its complete reliance on manpower: low efficiency, especially in vast waters, which requires a lot of manpower; it is easily affected by human factors, resulting in inaccurate data; it cannot achieve continuous monitoring, and can only provide intermittent data, which makes it difficult to reflect water level changes in a timely manner. Mechanical or electronic water level gauges are a relatively advanced automated monitoring tool that can automatically measure and record water level data, greatly reducing the need for manpower. However, these devices also have their own limitations: they need regular maintenance to prevent failures; they are easily damaged in extreme weather; and their deployment and maintenance costs are high in remote areas or areas with weak infrastructure. The intelligent water level monitoring system based on visual recognition technology uses a camera installed in a fixed position to regularly capture water gauge images, and analyzes the water level marks in the image through computer vision algorithms to automatically obtain water level information. Although this method has the advantages of non-contact and low cost, it faces the challenge of environmental factors such as light and water surface reflection interfering with image quality, and requires a stable network connection and sufficient training data to maintain accuracy and robustness.
[0004] In summary, although the existing water level monitoring technologies have their own characteristics, they all have certain limitations in practical applications. Therefore, a water level identification method for a water gauge is urgently needed to solve the problems existing in the above-mentioned water level monitoring technologies. Summary of the invention
[0005] The present invention provides a method for identifying the water level of a river, a reservoir or a water storage tank, which solves the technical problems that manual inspection is inefficient and cannot be continuously monitored, mechanical or electronic water level gauges have high maintenance costs and are easily damaged, and intelligent systems based on visual recognition are easily affected by environmental interference.
[0006] The present invention provides a method for identifying the water level of a river, a reservoir or a storage tank, comprising the following steps:
[0007] Step S101, collecting water body video data;
[0008] Step S102, performing a preprocessing procedure on the collected video data to obtain a feature image;
[0009] Step S103, using the trained Nanodet model, Picodet model and VGG16 model, respectively recognize the feature images to determine the position of the water gauge and the water surface, the scale on the water gauge and the numbers on the scale;
[0010] Step S104, activate the above-mentioned trained models in sequence to obtain the position of the water gauge and the water surface, the scale on the water gauge and the numbers on the scale, and calculate the height of the water level through a pre-set calculation formula combined with a distance ratio parameter.
[0011] Furthermore, the step of preprocessing the video data includes:
[0012] Step S201, extracting key frames from video data at preset time intervals;
[0013] Step S202, detecting similarities between adjacent frames using an image similarity algorithm, and deleting duplicate images;
[0014] Step S203, removing the blurred image based on the Laplace operator;
[0015] Step S204, performing enhancement processing such as random scaling, random cropping, random rotation, etc. on the key frame to obtain a feature image.
[0016] Furthermore, the step S202 specifically includes:
[0017] Step S2021, converting two adjacent frames of images into grayscale images;
[0018] Step S2022, comparing the difference between the two images pixel by pixel, and calculating the mean square error;
[0019] Step S2023: If it is determined that the mean square error value is lower than the first threshold, the two images are considered similar and one of them is deleted.
[0020] Furthermore, the step S203 specifically includes:
[0021] Step S2031, converting the image into a grayscale image;
[0022] Step S2032, using the Laplacian operator on the grayscale image to obtain an edge information image;
[0023] Step S2033, calculating the variance of the edge information graph;
[0024] Step S2034: remove images whose variance of the edge information graph is lower than the second threshold.
[0025] Furthermore, the torch framework is used to train the target detection model Nanodet, the paddlepaddle framework is used to train the target detection model Picodet, and the paddlepaddle framework is used to train the image classification model VGG16 and then convert onnx.
[0026] Furthermore, manual labeling is used as sample labels for the Nanodet model, the Picodet model, and the VGG16 model.
[0027] Furthermore, the distance ratio parameter is preset according to the relative position between the camera and the water ruler, the shooting angle and the focal length.
[0028] Furthermore, a generative adversarial network model is constructed to generate label data for training the Nanodet model, the Picodet model, and the VGG16 model; the steps of using the generative adversarial network model include:
[0029] Step S301, using the feature image as a training set for a generative adversarial network model;
[0030] Step S302, designing a generator and a discriminator of a generative adversarial network model; the generator is responsible for converting input noise or random vectors into realistic water gauges and water surface images, while the discriminator is responsible for distinguishing whether the input image is real data or forged data generated by the generator;
[0031] Step S303, iteratively training the generative adversarial network model;
[0032] Step S304, combining the image data generated by the generative adversarial network model with the existing feature images to jointly train the Nanodet model, the Picodet model and the VGG16 model.
[0033] The present invention provides an electronic device, comprising a processor and a memory storing a computer program, wherein the processor implements the above-mentioned water level identification method for a river, a reservoir or a storage tank when executing the computer program.
[0034] The present invention provides a computer-readable storage medium storing instructions. When the instructions are executed on a computer, the computer executes the water level identification method for a river, a reservoir or a storage tank as described above.
[0035] The beneficial effects of the present invention are as follows: the present invention collects video streams, constructs three independent lightweight models, and automatically completes water level monitoring, which not only improves the efficiency and accuracy of monitoring, but also significantly reduces maintenance costs and manpower requirements; the three models of the present invention adopt different reasoning frameworks, and immediately release the memory resources occupied by the models after the reasoning is completed, which solves the problem of resource preemption and ensures that the system can run efficiently; the present invention supports applications in multiple scenarios, has high reusability, and has a wide range of application scenarios. By collecting real-time video streams, the present invention can quickly and accurately identify water levels, has strong real-time performance, and is particularly suitable for environments with rapid water level changes (such as rainstorm or flood monitoring); and by using reasonable distance ratio parameters, the present invention can accurately convert pixel information in the image into actual physical water level height, ensure the accuracy of water level identification, and is suitable for emergency scenarios such as disaster warning and real-time monitoring. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a flow chart of a method for identifying the water level of a river, a reservoir or a storage tank according to the present invention;
[0037] Figure 2 It is a structural diagram of video data acquisition and processing of the present invention;
[0038] Figure 3 It is a structural schematic diagram of the model selection and training of the present invention. DETAILED DESCRIPTION
[0039] The subject matter described herein will now be discussed with reference to example embodiments. It should be understood that the discussion of these embodiments is only to enable those skilled in the art to better understand and implement the subject matter described herein, and the functions and arrangements of the elements discussed may be changed without departing from the scope of protection of the contents of this specification. Each example may omit, replace or add various processes or components as needed. In addition, the features described relative to some examples may also be combined in other examples.
[0040] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in one or more embodiments of the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in one or more embodiments of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0041] like Figure 1-Figure 3 As shown, a method for identifying the water level of a river, a reservoir, or a storage tank comprises the following steps:
[0042] Step S101, collecting water body video data;
[0043] Step S102, performing a preprocessing procedure on the collected video data to obtain a feature image;
[0044] Step S103, using the trained Nanodet model, Picodet model and VGG16 model, respectively recognize the feature images to determine the position of the water gauge and the water surface, the scale on the water gauge and the numbers on the scale;
[0045] Step S104, activate the above-mentioned trained models in sequence to obtain the position of the water gauge and the water surface, the scale on the water gauge and the numbers on the scale, and calculate the height of the water level through a pre-set calculation formula combined with a distance ratio parameter.
[0046] In one embodiment of the present invention, video data is collected regularly by installing cameras in monitoring scenes such as rivers, reservoirs, and reservoirs. These videos may include scenes in different time periods (such as daytime and nighttime) and different weather conditions.
[0047] In one embodiment of the present invention, the step of preprocessing the video data includes:
[0048] Step S201, extracting key frames from video data at preset time intervals;
[0049] Step S202, detecting similarities between adjacent frames using an image similarity algorithm, and deleting duplicate images;
[0050] Step S203, removing the blurred image based on the Laplace operator;
[0051] Step S204, performing enhancement processing such as random scaling, random cropping, random rotation, etc. on the key frame to obtain a feature image.
[0052] In one embodiment of the present invention, step S202 specifically includes:
[0053] Step S2021, converting two adjacent frames of images into grayscale images;
[0054] Step S2022, compare the difference between the two images pixel by pixel, and calculate the mean square error; the formula for the mean square error is: Where I1(i, j) and I2(i, j) represent the values of the pixels with coordinates (i, j) of the first and second images respectively, and m and n represent the height and width of the images respectively; through this formula, a value can be obtained, which reflects the overall difference between the two images;
[0055] Step S2023: If it is determined that the mean square error value is lower than the first threshold, the two images are considered similar and one of them is deleted.
[0056] In one embodiment of the present invention, step S203 specifically includes:
[0057] Step S2031, converting the image into a grayscale image;
[0058] Step S2032, using the Laplacian operator on the grayscale image to obtain an edge information image;
[0059] Step S2033, calculating the variance of the edge information map; the larger the variance, the more significant the gradient change in the image, and the clearer the image; the smaller the variance, the less edge information in the image, and the more blurred the image;
[0060] Step S2034: remove images whose variance of the edge information graph is lower than the second threshold.
[0061] In one embodiment of the present invention, the torch framework is used to train the target detection model Nanodet, the paddlepaddle framework is used to train the target detection model Picodet, and the paddlepaddle framework is used to train the image classification model VGG16 and then convert onnx.
[0062] In one embodiment of the present invention, manual labeling is used as sample labels for the Nanodet model, the Picodet model, and the VGG16 model.
[0063] In one embodiment of the present invention, the distance ratio parameter is preset according to the relative position between the camera and the water ruler, the shooting angle and the focal length.
[0064] The Nanodet is a FCOS-style single-stage anchor-free target detection model, which uses ATSS for target sampling and uses the GFL loss function to perform classification and bounding box regression. GFL is a combination of QFL, DFL and GIOU; the mathematical expression of the loss function includes:
[0065]
[0066] L Q =QFL;
[0067] L D =DFL(F n ,F n+1 )=-((y n+1 -y)×log(F n )+(yy n )×log(F n+1 ));
[0068]
[0069] Where a represents the number of frames, N pos represents the number of positive samples; λ0, λ1 represent L U , L D The balance weight of ,λ0=2, Average in four directions; calculate this sum over all positions; use the quality score to balance L during training U , L D ;m c Indicates BOX and BOX pre The extra edges after the intersection are regarded as the extended frame drawn by the extension line; Mc = S (m c )The area of the extended box is Mc; u represents S(BOX pre ∩Box), the area of the intersection of the predicted box and the true box; y represents the probability distribution of the true value, y n and n+1 Represents the probability distribution of the predicted values.
[0070] The Picodet model improves the PAN structure in the neck and adopts CSP-PAND. It uses 1x1 convolution to reduce the number of model parameters while also improving the model's feature extraction. It uses 5x5 depthwise separable convolution to replace 3x3 separable convolution to improve the field of view. It uses the weighted sum of zoom loss and GIOU calculation cost to improve accuracy without reducing efficiency. The activation function RELU is replaced by H-SWISH, which has a significant performance improvement. The learning rate is reduced using the cosine learning rate, which can effectively train even when the training batch is large. VFL+GIOU+DFL is used to calculate the loss. The mathematical expression of the loss function is:
[0071]
[0072] Where p represents the predicted value, g is the target IOU score, α represents the parameter to prevent the model from being over-suppressed, and γ represents the parameter to reduce the contribution of negative samples to the model.
[0073] In one embodiment of the present invention, the trained Nanodet model is run to obtain water gauge detection information and water surface detection information, which are respectively denoted as DB and SB; DB is represented by: DB = d c ,d s ,d x ,d y ,d w ,d h ), where d c Indicates the water gauge type, d s Indicates the water scale frame score, d x Indicates the horizontal coordinate of the water gauge frame, d y Indicates the vertical coordinate of the water gauge frame, d w Indicates the width of the water gauge frame, d h Indicates the height of the water gauge frame; SB is expressed as: SB = (u c ,u s ,u x ,u y ,u w ,u h ), where u c Indicates the water surface category, u s represents the water surface frame score, u x Indicates the horizontal coordinate of the water surface frame, u y Indicates the vertical coordinate of the water surface frame, u w Indicates the width of the water surface frame, u h Indicates the height of the water surface frame; take the average value of DB to obtain the water gauge position information SDB in the image, SDB is expressed as:
[0074] SDB=(d x ,d y ,d x2 ,dy2 );
[0075] d x2 =d x +d w ;
[0076] d y2 =d y +d h ;
[0077] Then take the average value of SB to get the center point of the water surface CP, which is expressed as:
[0078] CP=(U x ,U y );
[0079]
[0080] SDB and CP are passed downward, and the original image position is taken with SDB to obtain the water scale map, which is used to perform the Picodet model inference operation to obtain the scale detection information and digital detection information, which are recorded as SM and NM respectively. The mathematical expressions of SM and NM are:
[0081] SM=[(k c ,k s ,k x ,k y ,k w ,k h )……];
[0082] NM=[(n c ,n s ,n x ,n y ,n w ,n h )……];
[0083] By SM i With NM j The intersection score obtained by calculating the intersection is recorded as X i , and then according to the value X i ≥1 to get the digital information to get the set NM t , X i and NM t The mathematical expression is:
[0084]
[0085] NM t ={Xi=1|NM i};
[0086] Then take the two digital boxes closest to CP and record them as NMdm , N.M. dm The mathematical expression is:
[0087] NM dm =NM t -CP;
[0088]
[0089] Then NM dm The water gauge position is obtained by taking a digital image, and the digital image is used to identify the third number to obtain number1 and number2. The calculation formula for the size of the water gauge output is:
[0090] L=min(number1,number2)+S*|number1-number2|.
[0091] In one embodiment of the present invention, a generative adversarial network model is constructed to generate label data for training a Nanodet model, a Picodet model, and a VGG16 model; the steps of using the generative adversarial network model include:
[0092] Step S301, using the feature image as a training set for a generative adversarial network model;
[0093] Step S302, designing a generator and a discriminator of a generative adversarial network model; the generator is responsible for converting the input noise or random vector into a realistic water gauge and water surface image, while the discriminator is responsible for distinguishing whether the input image is real data or forged data generated by the generator.
[0094] Step S303, iteratively training the generative adversarial network model;
[0095] Step S304, combining the image data generated by the generative adversarial network model with the existing feature images to jointly train the Nanodet model, the Picodet model and the VGG16 model.
[0096] Well-trained generative adversarial network models can generate very realistic images with a variety of different feature changes, such as different lighting, backgrounds, and water levels, allowing the Nanodet model, Picodet model, and VGG16 model to face more diverse data.
[0097] In one embodiment of the present invention, three independent lightweight models are used, each model adopts a different reasoning framework, and the content resources occupied by the model are released immediately after the reasoning is completed, thereby solving the problem of resource preemption.
[0098] In one embodiment of the present invention, the present invention can not only realize real-time reasoning on edge devices, but also meet long-term monitoring needs by coordinating with the cloud to process complex computing tasks or store large amounts of historical data. On the edge side, the system uses an optimized lightweight model to directly process images captured by the camera, quickly obtain water level information, and ensure response speed and real-time performance. For tasks that require higher computing power or accumulated historical data, they are uploaded to the cloud for in-depth analysis and long-term storage. This architecture not only reduces the burden on edge devices, but also makes full use of the powerful processing power and storage capacity of cloud computing to achieve efficient data management and continuous monitoring.
[0099] An embodiment of the present invention provides an electronic device, including a processor and a memory storing a computer program. When the processor executes the computer program, a water level identification method for a river, a reservoir, or a storage tank provided in the above embodiments is implemented.
[0100] An embodiment of the present invention also provides a computer-readable storage medium storing instructions, which, when executed on a computer, enables the computer to execute the water level identification method for a river, a reservoir, or a storage tank as described above.
[0101] The above describes an embodiment of the present embodiment, but the present embodiment is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present embodiment, ordinary technicians in this field can also make many forms, all of which are within the protection of the present embodiment.
Claims
1. A method for identifying the water level of a river, reservoir or impoundment, characterized in that: The following steps are involved: Step S101, collecting water body video data; Step S102, performing a preprocessing procedure on the collected video data to obtain a feature image; Step S103, using the trained Nanodet model, Picodet model and VGG16 model, respectively recognize the feature images to determine the position of the water gauge and the water surface, the scale on the water gauge and the numbers on the scale; Step S104, activate the above-mentioned trained models in sequence to obtain the position of the water gauge and the water surface, the scale on the water gauge and the numbers on the scale, and calculate the height of the water level through a pre-set calculation formula combined with a distance ratio parameter.
2. A method for identifying water level of a river, reservoir or storage tank according to claim 1, characterized in that: The step of preprocessing the video data comprises: Step S201, extracting key frames from video data at preset time intervals; Step S202, detecting similarities between adjacent frames using an image similarity algorithm, and deleting duplicate images; Step S203, removing the blurred image based on the Laplace operator; Step S204, performing enhancement processing such as random scaling, random cropping, random rotation, etc. on the key frame to obtain a feature image.
3. A method for identifying water level of a river, reservoir or storage tank according to claim 2, characterized in that: The step S202 specifically includes: Step S2021, converting two adjacent frames of images into grayscale images; Step S2022, comparing the difference between the two images pixel by pixel, and calculating the mean square error; Step S2023: If it is determined that the mean square error value is lower than the first threshold, the two images are considered similar and one of them is deleted.
4. A method for identifying water level of a river, reservoir or storage tank according to claim 2, characterized in that: The step S203 specifically includes: Step S2031, converting the image into a grayscale image; Step S2032, using the Laplacian operator on the grayscale image to obtain an edge information image; Step S2033, calculating the variance of the edge information graph; Step S2034: remove images whose variance of the edge information graph is lower than the second threshold.
5. A method for identifying water level of a river, reservoir or storage tank according to claim 1, characterized in that: Use the torch framework to train the target detection model Nanodet, use the paddlepaddle framework to train the target detection model Picodet, and use the paddlepaddle framework to train the image classification model VGG16 and then convert it to onnx.
6. A method for identifying water level of a river, reservoir or storage tank according to claim 1, characterized in that: Manual labeling is used as sample labels for the Nanodet model, Picodet model, and VGG16 model.
7. A method for identifying water level of a river, reservoir or storage tank according to claim 1, characterized in that: The distance ratio parameter is preset according to the relative position between the camera and the water ruler, the shooting angle and the focal length.
8. A method for identifying water level of a river, reservoir or storage tank according to claim 1, characterized in that: Generate label data by building a generative adversarial network model to train the Nanodet model, Picodet model, and VGG16 model; The steps to using a generative adversarial network model include: Step S301, using the feature image as a training set for a generative adversarial network model; Step S302, designing a generator and a discriminator of a generative adversarial network model; the generator is responsible for converting input noise or random vectors into realistic water gauges and water surface images, while the discriminator is responsible for distinguishing whether the input image is real data or forged data generated by the generator; Step S303, iteratively training the generative adversarial network model; Step S304, combining the image data generated by the generative adversarial network model with the existing feature images to jointly train the Nanodet model, the Picodet model and the VGG16 model.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the method for identifying the water level of a river, a reservoir or a storage tank according to any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, which, when executed by a processor, implements a method for identifying a water level of a river, a reservoir, or a storage tank as described in any one of claims 1 to 8.