A method for calculating water level using real-time AI technology

By combining lightweight deep learning algorithms, including BiseNetV2, yolov8 and RepVGG, the problem of illumination effects and real-time performance in water gauge water level calculation is solved, and water gauge water level calculation with high accuracy and timeliness is achieved, which is suitable for edge computing devices. .

CN118366168BActive Publication Date: 2024-09-10XIAN CENTN TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410775804.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-09-10
Estimated Expiration
2044-06-17

AI Technical Summary

Technical Problem

The existing water gauge water level calculation method in the water conservancy industry is affected by complex lighting conditions such as lighting and reflection, and has large errors. Deep learning methods are not fully applied, resulting in inaccurate and real-time calculations.

Method used

A combination of lightweight deep learning algorithms is used, including BiseNetV2 for water surface position recognition, yolov8 for water gauge position and character detection, RepVGG for character scale recognition, and combined with the EMA attention mechanism and MPDIoU boundary loss function to improve algorithm performance and real-time performance.

Benefits of technology

It achieves high-accuracy and high-timeliness calculation of water gauge water level values, facilitates deployment on edge computing devices, and improves the reliability and real-time performance of hydrological monitoring and management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118366168B
    Figure CN118366168B
Patent Text Reader

Abstract

The present invention belongs to the technical field of hydrological monitoring in the water conservancy industry, and relates to a method for calculating a water level of a water gauge using real-time AI technology. The method adopts all deep learning methods to segment the water surface, detect the position of the water gauge, and recognize character scales, so as to give full play to the advantage of high calculation accuracy of deep learning. For the character scale detection algorithm, the 10 categories 0 to 9 on the water gauge are normalized into one category to perform single target detection to improve the detection accuracy, and then the character scale value is determined by a classification algorithm to improve the recognition accuracy. The lightweight segmentation algorithm BiseNetV2, the lightweight detection algorithm yolov8, and the lightweight classification algorithm RepVGG are adopted to improve the real-time performance of the water gauge water level calculation. The present invention can calculate the water gauge water level value with high accuracy and timeliness, and is convenient for deployment on edge computing devices. The algorithm of the present invention is safe and reliable, and is easy to maintain, and can be widely used in hydrological monitoring, reservoir scheduling management, irrigation management and scheduling of irrigation areas, and other industries.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of hydrological monitoring in the water conservancy industry, and specifically relates to a method for calculating a water level of a water gauge using real-time AI technology. Background Art

[0002] At present, the water conservancy industry basically uses traditional methods based on computer vision to calculate water levels in rivers and channels. The image segmentation, character scale recognition, water gauge position recognition and other traditional methods are easily affected by complex lighting conditions such as water surface illumination and reflection, and the error in calculating water levels is large.

[0003] With the development of deep learning technology, some deep learning methods are applied to the calculation of water level in water gauges. Basically, only some functions use deep learning methods, not all of them. For example, some only use deep learning methods for image segmentation, and some only use deep learning methods for character scale recognition, which does not give full play to the advantages of high accuracy of deep learning calculation.

[0004] For character scale recognition, some perform multi-target detection on the 10 categories of 0 to 9 on the water gauge based on target detection algorithms, which results in large errors. Some recognize the "E" character on the water gauge based on target detection algorithms. The "E" character on the water gauge has two representations, opening to the left and opening to the right, which results in large recognition errors. In addition, it takes time to recognize the "E" character and then convert it into a specific scale value, which affects the real-time performance of the water gauge water level calculation.

[0005] The conventional segmentation algorithm is used for the image segmentation algorithm, and no real-time segmentation algorithm is adopted, which affects the real-time calculation of the water gauge and water level and is difficult to deploy on edge computing devices.

[0006] Therefore, the currently used method for calculating the water level of the water gauge has obvious shortcomings and defects. Summary of the invention

[0007] The present invention provides the following technical solution: a method for calculating the water level of a water gauge using real-time AI technology, comprising the following steps:

[0008] Step 1: Clean the water gauge image and create a water surface position recognition data set using annotation tools; train the water surface position recognition data set based on the lightweight segmentation algorithm BiseNetV2 to obtain a water surface position recognition model file;

[0009] Step 2: Clean the water gauge image data and use the annotation tool to create a water gauge position recognition data set; based on the lightweight detection algorithm yolov8, train the water gauge position recognition data set to obtain the water gauge position recognition model file; for the yolov8 algorithm, in order to facilitate real-time and high efficiency on resource-constrained devices, the backbone network uses the MobileNetV2 algorithm to replace the Darknet53 algorithm; add the EMA attention mechanism, which has multi-scale characteristics and cross-space learning characteristics, can better retain the information of each channel, reduce computational overhead, and improve algorithm performance; use the MPDIoU boundary loss function instead of the original loss function CIoU to improve the network bounding box regression performance and the detection effect of small targets;

[0010] Step 3: Clean the water gauge image, and use the annotation tool to create a data set for character position recognition of 0 to 9 on the water gauge, and mark it as a category; based on the lightweight detection algorithm yolov8, train the data set for character position recognition of 0 to 9 on the water gauge to obtain a model file for character position recognition of 0 to 9 on the water gauge;

[0011] Step 4: Create a data set of 10 character scale recognition data from 0 to 9 on the water gauge; based on the lightweight classification algorithm RepVGG, train the data set of 10 character scale recognition data from 0 to 9 to obtain the model file of the scale recognition of characters 0 to 9 on the water gauge; for the RepVGG algorithm, add the channel attention module ECA, adopt the local interaction strategy without dimensionality reduction, and adaptively select the convolution kernel size, so as to learn the information between channels and improve the algorithm performance;

[0012] Step 5, input the water level image of the water gauge to be identified, call the model files in steps 1 to 4 in sequence, identify the values ​​according to the water surface position and the scale of characters 0 to 9 on the water gauge, and then calculate the proportional relationship of the character pixel height to get the water level value of the water gauge.

[0013] Preferably, in step 1, the annotation tools used in preparing the water surface position recognition data set include the Labelme annotation tool; in step 2 and step 3, the annotation tools used in preparing the water gauge position recognition data set and preparing the water gauge character 0 to 9 position recognition data set include the LabelImage annotation tool.

[0014] Preferably, in step 1, the segmentation algorithm BiseNetV2 includes a detail branch and a semantic branch. The network channel capacity of the detail branch is high and the number of network layers is shallow, and it is used to obtain low-level features; the network channel capacity of the semantic branch is low and the number of network layers is deep, and it is used to obtain high-level features; the convolution layer of the detail branch is replaced with group convolution to ensure accuracy while reducing the amount of calculation, so as to achieve high efficiency on resource-constrained devices; a SENet channel attention module is added to the semantic branch, and an FCN feature fusion module is added at the end of the semantic branch to fuse high-level and low-level features, enhance the semantic branch features, and improve the algorithm performance.

[0015] Preferably, in step 4, the core of the classification algorithm RepVGG lies in its basic module, and the basic module consists of three parallel branches, and the three parallel branches include: a 3x3 convolution layer, a 1x1 convolution layer, and an identity mapping, wherein the activation function used is RELU, and the outputs of the three branches are connected together to form the final output.

[0016] Preferably, the specific steps of step 5 include:

[0017] Step 5-1, input the water level image to be identified, call the water surface position identification BiseNetV2 model file for model inference, and obtain the water surface position identification image;

[0018] Step 5-2, superimpose the water surface position recognition image obtained in step 5-1 onto the water gauge water level image to be recognized to synthesize a new image, and then call the water gauge position recognition yolov8 model file to perform model inference to obtain the water gauge position recognition image;

[0019] Step 5-3, the water gauge position recognition image obtained in step 5-2 is used to call the yolov8 model file for character 0-9 position recognition on the water gauge to perform model inference, and obtain the character 0-9 position recognition image on the water gauge;

[0020] Step 5-4, for all the characters in the position recognition image of the characters 0 to 9 on the water ruler obtained in step 5-3, respectively call the RepVGG model file for the scale recognition of the characters 0 to 9 on the water ruler to perform model inference, and obtain the scale values ​​of the characters 0 to 9 on the water ruler;

[0021] Step 5-5, calculate the water level value according to the water surface position and the values ​​obtained by identifying the characters 0 to 9 on the water ruler.

[0022] Preferably, in step 5, the position of the character closest to the water surface is obtained by sorting according to the positions of all the characters on the water gauge identified; the scale value of the character closest to the water surface is obtained according to the scale values ​​of all the characters on the water gauge identified. ; Assume that the upper left corner of the image is the coordinate origin (0,0), the upper right corner is the positive x-axis direction, and the lower left corner is the positive y-axis direction. According to the recognized characters and their positions , combined with the identified water surface position , the scale value corresponding to one pixel is v, and the water level value of the water gauge is obtained .

[0023] The beneficial effects of the present invention are:

[0024] Compared with the existing water gauge water level calculation method, the water gauge water level calculation method of the present invention adopts real-time AI technology, which can calculate the water gauge water level value with high accuracy and timeliness, and is convenient for deployment on edge computing devices; the algorithm of the present invention is safe and reliable, easy to maintain, and can be widely used in hydrological monitoring, reservoir scheduling management, irrigation area irrigation management and scheduling and other industries. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 It is a flow chart of a method for calculating the water level of a water gauge using real-time AI technology;

[0026] Figure 2 This is the structure diagram of the water surface segmentation algorithm BiseNetV2;

[0027] Figure 3 This is the core structure diagram of the water gauge position detection algorithm yolov8;

[0028] Figure 4 This is the core structure diagram of the yolov8 algorithm for detecting the position of characters on the water ruler;

[0029] Figure 5 This is the basic module structure diagram of the character scale recognition algorithm RepVGG on the water gauge;

[0030] Figure 6 It is a water level position map. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the relevant technologies in the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0032] This implementation aims to provide a method for calculating the water level of a water gauge using real-time AI technology. This method uses all deep learning methods to perform water surface segmentation, water gauge position detection, and character scale recognition, giving full play to the advantages of high accuracy of deep learning calculations. For the character scale detection algorithm, the 10 categories 0 to 9 on the water gauge are normalized into one category to perform single target detection to improve detection accuracy, and then the character scale value is determined through a classification algorithm to improve recognition accuracy. The lightweight segmentation algorithm BiseNetV2, the lightweight detection algorithm yolov8, and the lightweight classification algorithm RepVGG are used to improve the real-time performance of the water gauge water level calculation and facilitate deployment on edge computing devices.

[0033] This implementation is achieved through the following technical solutions.

[0034] The water gauge image is cleaned and the water surface position recognition dataset is produced using the Labelme annotation tool.

[0035] Based on the lightweight segmentation algorithm BiseNetV2, the water surface position recognition dataset is trained to obtain the water surface position recognition model file.

[0036] The water gauge image is cleaned and the water gauge position recognition dataset is produced using the LabelImage annotation tool.

[0037] Based on the lightweight detection algorithm yolov8, the water gauge position recognition dataset is trained to obtain the water gauge position recognition model file.

[0038] The water gauge image is cleaned, and the LabelImage annotation tool is used to create a data set for character position recognition from 0 to 9 on the water gauge, which is labeled as a category.

[0039] Based on the lightweight detection algorithm yolov8, the data set of character 0-9 position recognition on the water gauge is trained to obtain the model file of character 0-9 position recognition on the water gauge.

[0040] Create a data set of 10 characters 0 to 9 on the water gauge.

[0041] Based on the lightweight classification algorithm RepVGG, the 10 character data sets from 0 to 9 are trained to obtain the character 0 to 9 scale recognition model file on the water ruler.

[0042] The value is obtained by identifying the water surface position and the character scale 0 to 9 on the water gauge, and then the water level value of the water gauge is obtained by calculating the proportional relationship between the character pixel height.

[0043] Figure 2The BiseNetV2 segmentation algorithm for the implementation scheme consists of a detail branch with shallow layers and wide channels to capture low-level details and generate high-resolution feature representations; a semantic branch with deep layers and narrow channels to obtain high-level semantic context. The semantic branch is lightweight due to the reduced channel capacity and fast downsampling strategy; a guided aggregation layer to enhance the interconnection and fuse the two types of feature representations; and an auxiliary training strategy to improve segmentation performance without adding additional inference cost. Figure 3 The core structure of the water gauge position detection algorithm yolov8 is implemented. The yolov8 algorithm has the characteristics of higher accuracy, faster speed, better generalization ability, lightweight model, and better real-time performance. Figure 4 The core structure of the YOLOv8 algorithm for detecting the position of characters on a water ruler is implemented. The YOLOv8 algorithm has the characteristics of higher accuracy, faster speed, better generalization ability, lighter model, and better real-time performance. Figure 5 The basic module structure of the RepVGG algorithm for character scale recognition on a water ruler is shown in the implementation method. The core of the RepVGG algorithm lies in its basic module. This basic module consists of three parallel branches, a 3x3 convolution layer, a 1x1 convolution layer, and an identity mapping. The activation function used is RELU. The outputs of these three branches will be connected together to form the final output. This structure can learn nonlinear transformations during training, and can fold the network into a simple 3x3 convolution layer during inference, greatly reducing the amount of calculation and model size, which not only ensures the training effect, but also improves the inference speed and has better real-time performance. Figure 6 It is the water level line position of the water gauge in the implementation mode.

[0044] This implementation method is mainly carried out according to the following steps during implementation:

[0045] like Figure 1 As shown in the figure, the water gauge image is cleaned and the water surface position recognition dataset is produced by using the Labelme annotation tool. Based on the lightweight segmentation algorithm BiseNetV2, the water surface position recognition dataset is trained to obtain the water surface position recognition BiseNetV2 model file.

[0046] like Figure 1 As shown in the figure, the water gauge image is cleaned and the water gauge position recognition dataset is produced by using the LabelImage annotation tool. Based on the lightweight detection algorithm yolov8, the water gauge position recognition dataset is trained to obtain the water gauge position recognition yolov8 model file.

[0047] like Figure 1As shown in the figure, the water gauge image is cleaned, and the LabelImage annotation tool is used to create a dataset for character position recognition of 0 to 9 on the water gauge, which is labeled as a category. Based on the lightweight detection algorithm yolov8, the dataset for character position recognition of 0 to 9 on the water gauge is trained to obtain the yolov8 model file for character position recognition of 0 to 9 on the water gauge.

[0048] like Figure 1 As shown, a data set of 10 character scale recognition of characters 0 to 9 on a water gauge is produced. Based on the lightweight classification algorithm RepVGG, the data set of 10 character scale recognition of characters 0 to 9 is trained to obtain the RepVGG model file of the scale recognition of characters 0 to 9 on a water gauge.

[0049] like Figure 1 As shown in the figure, input the water level image to be identified, call the water surface position identification BiseNetV2 model file for model inference, and obtain the water surface position identification image. Figure 2 As shown, the white area in the output image represents the water surface.

[0050] like Figure 1 As shown in FIG. 1 , the water surface position recognition image is superimposed on the water level image to be recognized to synthesize a new image, such as Figure 3 As shown in the input image, the water gauge position recognition yolov8 model file is called for model inference to obtain the water gauge position recognition image. Figure 3 As shown, the black rectangular area in the output image represents the water gauge.

[0051] like Figure 1 As shown, the water gauge position recognition image is obtained, such as Figure 4 As shown in the input image, the yolov8 model file for character position recognition of 0 to 9 on the water ruler is called for model inference to obtain the character position recognition image of 0 to 9 on the water ruler. Figure 4 As shown, the black rectangular frame in the output image represents the character position recognition image on the water ruler, and the positions of the characters "7", "6", "5", "4", "3", and "2".

[0052] like Figure 1 As shown, all the characters in the position recognition image of the characters 0 to 9 on the water ruler are used to call the RepVGG model file for scale recognition of the characters 0 to 9 on the water ruler for model inference to obtain the scale values ​​of the characters 0 to 9 on the water ruler.

[0053] like Figure 1As shown, the water level value is calculated based on the water surface position and the values ​​of the characters 0 to 9 on the water ruler. In this embodiment, first, the position of the character closest to the water surface can be obtained by sorting according to the positions of all the characters on the water ruler that have been identified. Secondly, the scale value of the character closest to the water surface is obtained according to the scale values ​​of all the characters on the water ruler that have been identified, such as Figure 6 As shown in , this character is "2". Finally, based on the recognized character "2" and its position, combined with the recognized water surface position, Figure 6 The black horizontal line behind the character "2" is calculated through the proportional relationship of the character pixel height to obtain the water level value of the water gauge, such as Figure 6 As shown, the water level value of the water gauge in the figure is "1.95".

[0054] To sum up, compared with the existing water gauge water level calculation method, the present invention adopts real-time AI technology to calculate the water gauge water level method, which can calculate the water gauge water level value with high accuracy and timeliness, and is convenient for deployment on edge computing devices; the algorithm of the present invention is safe and reliable, easy to maintain, and can be widely used in hydrological monitoring, reservoir scheduling management, irrigation area irrigation management and scheduling and other industries.

[0055] It should be emphasized that the above are only preferred embodiments of the present invention and do not limit the present invention in any form. Any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A method for calculating water level using real-time AI technology, characterized in that: The following steps are involved: Step 1: Clean the water gauge image and create a water surface position recognition data set using annotation tools; train the water surface position recognition data set based on the lightweight segmentation algorithm BiseNetV2 to obtain the water surface position recognition BiseNetV2 model file; Step 2: Clean the water gauge image data and create a water gauge position recognition data set through annotation tools; based on the lightweight detection algorithm yolov8, train the water gauge position recognition data set to obtain the water gauge position recognition yolov8 model file; for the yolov8 algorithm, the backbone network uses the MobileNetV2 algorithm to replace the Darknet53 algorithm; add the EMA attention mechanism; use the MPDIoU boundary loss function instead of the original loss function CIoU; Step 3: Clean the water gauge image, and use the annotation tool to create a data set for character position recognition of 0 to 9 on the water gauge, and mark it as a category; based on the lightweight detection algorithm yolov8, train the data set for character position recognition of 0 to 9 on the water gauge, and obtain the yolov8 model file for character position recognition of 0 to 9 on the water gauge; Step 4: Create a dataset of 10 character scale recognition data from 0 to 9 on the water ruler; train the dataset of 10 character scale recognition data from 0 to 9 based on the lightweight classification algorithm RepVGG, and obtain the RepVGG model file for character scale recognition from 0 to 9 on the water ruler; for the RepVGG algorithm, add the channel attention module ECA, adopt a local interaction strategy without dimensionality reduction, and adaptively select the convolution kernel size, so as to learn the information between channels; Step 5, input the water level image of the water gauge to be identified, call the model files in steps 1 to 4 in sequence, identify the values ​​according to the water surface position and the scale of characters 0 to 9 on the water gauge, and then calculate the water level value of the water gauge through the proportional relationship of the character pixel height; The step 5 specifically includes: inputting the water level image to be identified, calling the water surface position identification BiseNetV2 model file to perform model reasoning, and obtaining the water surface position identification image; The water surface position recognition image is superimposed on the water gauge water level image to be recognized to synthesize a new image, and then the water gauge position recognition yolov8 model file is called to perform model inference to obtain the water gauge position recognition image; After obtaining the water gauge position recognition image, call the yolov8 model file for character 0-9 position recognition on the water gauge to perform model inference on the obtained water gauge position recognition image to obtain the character 0-9 position recognition image on the water gauge; Get all the characters in the position recognition image of the characters 0 to 9 on the water ruler, call the RepVGG model files for the scale recognition of the characters 0 to 9 on the water ruler for model inference, and get the scale values ​​of the characters 0 to 9 on the water ruler; The water level value is calculated based on the water surface position and the values ​​obtained by recognizing the scale values ​​of characters 0 to 9 on the water ruler. First, the position of the character closest to the water surface is obtained by sorting the positions of all the characters on the water ruler that have been recognized. Secondly, the scale value of the character closest to the water surface is obtained based on the scale values ​​of all the characters on the water ruler that have been recognized. Finally, the water level value of the water ruler is obtained based on the recognized characters and their positions, combined with the recognized water surface position, and calculated through the proportional relationship of the character pixel heights.

2. The method for calculating water level using real-time AI technology according to claim 1, characterized in that: In step 1, the labeling tools used in the preparation of the water surface position recognition data set include the Labelme labeling tool; in step 2 and step 3, the labeling tools used in the preparation of the water gauge position recognition data set and the preparation of the water gauge character 0 to 9 position recognition data set include the LabelImage labeling tool.

3. The method for calculating water level using real-time AI technology according to claim 1, characterized in that: In step 1, the segmentation algorithm BiseNetV2 includes a detail branch and a semantic branch. The detail branch has a high network channel capacity and a shallow network layer, and is used to obtain low-level features. The network channel capacity of the semantic branch is low, and the number of network layers is deep, which is used to obtain high-level features; Replace the convolution layer of the detail branch with grouped convolution; add the SENet channel attention module to the semantic branch, and add the FCN feature fusion module at the end of the semantic branch to fuse high-level and low-level features and enhance the semantic branch features.

4. The method for calculating water level using real-time AI technology according to claim 1, characterized in that: In step 4, the core of the classification algorithm RepVGG lies in its basic module, which consists of three parallel branches. The three parallel branches include: a 3x3 convolution layer, a 1x1 convolution layer, and an identity mapping, in which the activation function used is RELU. The outputs of the three branches are connected together to form the final output.

5. The method for calculating water level using real-time AI technology according to claim 1, characterized in that: In step 5, the position of the character closest to the water surface is obtained by sorting the positions of all the characters on the water gauge identified; the scale value of the character closest to the water surface is obtained according to the scale values ​​of all the characters on the water gauge identified. ; Assume that the upper left corner of the image is the coordinate origin (0,0), the upper right corner is the positive x-axis direction, and the lower left corner is the positive y-axis direction. According to the recognized characters and their positions , combined with the identified water surface position , the scale value corresponding to one pixel is v, and the water level value of the water gauge is obtained .