Water level detection method, device and electronic equipment

Through image recognition technology and linear regression model, the water level value is automatically calculated, which solves the problem of large errors in traditional water level detection methods and improves detection accuracy and reliability.

CN114998293BActive Publication Date: 2025-05-20CHANGSHA HISENSE INTELLIGENT SYST RES INST CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210708310.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-22
Publication Date
2025-05-20
Estimated Expiration
2042-06-22

AI Technical Summary

Technical Problem

Traditional water level detection methods rely on manual estimation, resulting in large errors. The existing image recognition methods are only suitable for orthophoto angles, and the on-site calibration is complex.

Method used

By acquiring water images, using the segmentation model and the identification model to segment and identify the scale symbols on the water ruler, combining the linear regression model to calculate the pixel height of the scale symbols where the water level lines intersect, and then calculate the distance from the water surface to the target scale symbol to determine the water level value.

Benefits of technology

It reduces the error caused by manual estimation, improves the accuracy and reliability of water level detection, and is suitable for water level detection at multiple angles.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114998293B_ABST
    Figure CN114998293B_ABST
Patent Text Reader

Abstract

The present invention first provides a water level detection method, device and electronic device. The method extracts the pixel coordinates of the scale symbol of the water gauge through image recognition, and establishes a linear regression model, determines the pixel height of the scale symbol intersecting the water level line through the linear regression model, and then uses the pixel height of the scale symbol intersecting the water level line and the corresponding real distance to calculate the distance between the water level line and the nearest complete scale symbol, thereby calculating the water level value, which can reduce the detection error caused by manual estimation and improve the accuracy and reliability of water level detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and particularly to a water level detection method, device and electronic device. Background Art

[0002] Traditional water level detection methods mainly include the water gauge method, which obtains water level information by reading the scale value of the water gauge set in the water area at the water surface. Currently, this method has been widely applied to major hydrological stations. The main detection steps of the water gauge method are as follows: first, read and locate the scale value closest to the water surface on the part of the water gauge exposed above the water surface, then estimate the distance between the scale value closest to the water surface and the water surface, and add this distance to the scale value closest to the water surface to obtain the final water level value. This method estimates the distance between the scale value closest to the water surface and the water surface manually, resulting in a large error.

[0003] With the development of deep learning and image recognition technologies, there has emerged a water level detection method that uses the above technologies to identify the water gauge in the water area image and thus obtain water level information. The method generally includes three key steps: segmentation, water level line detection, and water level value conversion. Most of the methods for water level value conversion start from the manual recording method. First, identify and locate the scale lines and characters on the water gauge, and calculate the water level value through interpolation. This method is only applicable to images taken from an orthographic perspective. There are also methods that establish a corresponding relationship through the camera imaging principle. For example, scale scaling, creating a segmented look-up table, and setting control points to establish a coordinate transformation relationship between the object plane and the image plane are used. However, on-site calibration for scale transformation is generally complex. Summary of the Invention

[0004] The purpose of the present invention is to provide a water level detection method that can reduce the detection error caused by manual estimation and improve the accuracy and reliability of water level detection.

[0005] To achieve the above purpose, the present invention first provides a water level detection method, including the following steps:

[0006] Obtain a water area image, where the water area image includes a water gauge, and the water gauge is provided with a plurality of scale symbols arranged in sequence from top to bottom and a plurality of scale values corresponding to the scale symbols;

[0007] Input the water area image into a preset segmentation model to segment out a first image, and the first image shows the part of the water gauge exposed above the water surface;

[0008] Input the first image into a trained recognition model to obtain first information, where the first information includes the pixel coordinate information of the scale symbols in the first image and the numerical information corresponding to the scale values;

[0009] Input the pixel coordinate information corresponding to the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbol intersecting the water level line;

[0010] Determine the complete scale symbol closest to the water surface as the target scale symbol, and calculate the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height of the scale symbol intersecting the water level line;

[0011] Determine the scale value with the smallest numerical value in the first information as the target scale value, and determine the water level value according to the target scale value and the distance from the water surface to the target scale symbol.

[0012] Optionally, inputting the pixel coordinate information corresponding to the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbol intersecting the water level line specifically includes:

[0013] Obtain the pixel coordinates [x i , y i , w i , h i of each scale symbol, where x i and y i are the coordinates of the upper left corner of the detection box corresponding to the i-th scale symbol, and w i and h i are the width and height of the detection box corresponding to the i-th scale symbol;

[0014] Select the three scale symbols with the smallest detection box height among all scale symbols. The pixel coordinates of the three scale symbols with the smallest detection box height are [x 1 , y 1 , w 1 , h 1 , [x 2 , y 2 , w 2 , h 2 , [x 3 , y 3 , w 3 , h 3 , where h 3 < h 2 < h 1 ;

[0015] Calculate the pixel height of the scale symbol intersecting the water level line according to the pixel coordinates of the three scale symbols with the smallest detection box height and a preset pixel height algorithm. The pixel height algorithm is:

[0016] D = ;

[0017] Wherein, D is the pixel height corresponding to the scale symbol intersecting with the water level line.

[0018] Optionally, the multiple scale symbols include multiple first scale symbols and multiple second scale symbols;

[0019] On the water gauge, the multiple scale values and the multiple first scale symbols are alternately arranged in a column from bottom to top, the multiple second scale symbols are arranged at intervals in another column, the multiple first scale symbols and the multiple second scale symbols are staggered in the row direction, and each scale value corresponds to a second scale symbol in the same row.

[0020] Optionally, the formula for calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height corresponding to the scale symbol intersecting with the water level line is:

[0021] ;

[0022] Wherein, y d =H-(y L +h L ), H is the pixel height of the part of the water gauge exposed above the water surface, y L is the ordinate of the upper left corner of the detection frame of the target scale symbol, h L is the height of the detection frame of the target scale symbol, D is the pixel height corresponding to the scale symbol intersecting with the water level line, is the distance from the water surface to the target scale symbol.

[0023] Optionally, determining the water level value according to the target scale value and the distance from the water surface to the target scale symbol specifically includes:

[0024] Judging whether there are complete scale symbols between the target scale value and the water surface;

[0025] If so, the water level value is S-(0.5 + ∆d), where S is the numerical value of the target scale value, is the distance from the water surface to the target scale symbol;

[0026] If not, the water level value is S-∆d.

[0027] Optionally, the training process of the recognition model includes:

[0028] Collecting multiple training images including different lights, different times, different weathers and different degrees of damage, and the training images include water gauges;

[0029] Labeling the water gauges in the training images, bounding the scale symbols and scale values on the water gauges, and keeping the size of the bounding box of the scale symbols consistent with the size of the scale symbols;

[0030] Train the recognition model with the labeled training images to obtain a trained recognition model.

[0031] Optionally, the determining the complete scale symbol closest to the water surface as the target scale symbol and the determining the scale value with the smallest numerical value in the first information as the target scale value specifically include:

[0032] Store the pixel coordinate information of the scale symbols in the first image in the first information in the first container, and store the numerical information corresponding to the scale values in the first image in the second container;

[0033] Sort the scale symbols in the first container in ascending order according to the height of the detection frames of each scale symbol, and determine the scale symbol with the smallest detection frame height as the complete scale symbol closest to the water surface, that is, the target scale symbol;

[0034] In the second container, screen the numerical information corresponding to the scale values in the first image by the bubble sort method to obtain the scale value with the smallest numerical value in the first information, that is, the target scale value.

[0035] Optionally, the recognition model is an anchor_free based object detection model.

[0036] The present invention also provides a water level detection device, including:

[0037] An acquisition unit for acquiring a water area image, where the water area image includes a water gauge, and the water gauge is provided with a plurality of scale symbols arranged in sequence from top to bottom and a plurality of scale values corresponding to the scale symbols;

[0038] A segmentation unit for inputting the water area image into a preset segmentation model to segment out a first image, and the first image shows the part of the water gauge exposed above the water surface;

[0039] A recognition unit for inputting the first image into a trained recognition model to obtain first information, where the first information includes the pixel coordinate information of the scale symbols in the first image and the numerical information corresponding to the scale values;

[0040] A first calculation unit for inputting the pixel coordinate information corresponding to the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbol intersecting with the water level line;

[0041] A second calculation unit for determining the complete scale symbol closest to the water surface as the target scale symbol, and calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height of the scale symbol intersecting with the water level line;

[0042] A water level calculation unit is configured to determine the scale value with the smallest numerical value in the first information as the target scale value, and determine the water level value according to the target scale value and the distance from the water surface to the target scale symbol.

[0043] The present invention also provides an electronic device, including: a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the steps of the above method.

[0044] Advantages of the present invention: The present invention provides a water level detection method, device and electronic device. The method includes the following steps: obtaining a water area image, where the water area image includes a water gauge; inputting the water area image into a preset segmentation model to segment out a first image, where the first image shows the part of the water gauge exposed above the water surface; inputting the first image into a trained recognition model to obtain first information, where the first information includes pixel coordinate information of scale symbols in the first image and numerical information corresponding to scale values; inputting the pixel coordinate information corresponding to the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbol intersecting with the water level line; determining the complete scale symbol closest to the water surface as the target scale symbol, and calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height of the scale symbol intersecting with the water level line; determining the scale value with the smallest numerical value in the first information as the target scale value, and determining the water level value according to the target scale value and the distance from the water surface to the target scale symbol, which can reduce the detection error caused by manual estimation and improve the accuracy and reliability of water level detection. Description of the Drawings

[0045] In order to further understand the features and technical content of the present invention, please refer to the following detailed description and drawings of the present invention. However, the drawings are only for reference and illustration, and are not used to limit the present invention.

[0046] In the drawings,

[0047] Figure 1 is a flowchart of the water level detection method of the present invention;

[0048] Figure 2 is a schematic diagram of a water area image in an embodiment of the water level detection method of the present invention;

[0049] Figure 3 is Figure 2 a schematic diagram of the rotated image in

[0050] Figure 4 is Figure 2 a schematic diagram of the segmented image in

[0051] Figure 5 Schematic diagram of a complete water gauge in the water level detection method of the present invention;

[0052] Figure 6 Schematic diagram of a first image in the water level detection method of the present invention;

[0053] Figure 7 Partial enlarged view of the first image in the water level detection method of the present invention;

[0054] Figure 8 Flowchart of step S4 in the water level detection method of the present invention;

[0055] Figure 9 Schematic diagram of the water level detection device of the present invention;

[0056] Figure 10 Schematic diagram of the electronic device of the present invention. Detailed implementation manners

[0057] To further elaborate on the technical means and effects adopted by the present invention, the following provides a detailed description in combination with the preferred embodiments of the present invention and their accompanying drawings.

[0058] Now, example embodiments will be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more complete and comprehensive, and will fully convey the concept of the example embodiments to those skilled in the art.

[0059] In addition, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the present disclosure.

[0060] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0061] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor are they necessarily executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to the actual situation.

[0062] Please refer to Figure 1 , the present invention first provides a water level detection method, including the following steps:

[0063] Step S1, please refer to Figure 2 , obtain a water area image, the water area image includes a water gauge, and the water gauge is provided with a plurality of scale symbols arranged in sequence from top to bottom and a plurality of scale values corresponding to the scale symbols.

[0064] Specifically, the method for obtaining the water area image is: extract several frames of images from the video stream captured by a camera arranged corresponding to the water area where the water gauge is located at a preset interval period, so as to obtain the water area image.

[0065] Furthermore, the picture displayed in each water area image includes the water surface and a water gauge arranged in the water surface.

[0066] Generally, in the preferred embodiment of the present invention, the scale symbols and scale values on the water gauge are arranged in the manner shown in Figure 5 , that is: on the water gauge, the plurality of scale values and a plurality of first scale symbols are alternately arranged in sequence from bottom to top in a column, the plurality of second scale symbols are arranged at intervals in another column, the plurality of first scale symbols and the plurality of second scale symbols are staggered in the row direction, and each scale value corresponds to a second scale symbol in the same row.

[0067] Furthermore, in the preferred embodiment of the present invention, both the first scale symbol and the second scale symbol are in the shape of "E", the opening of the first scale symbol faces right, while the opening of the second scale symbol faces left, the plurality of scale values include the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 arranged from bottom to top, each scale value and the second scale symbol are located in odd rows, and each second scale symbol is located in even rows.

[0068] Of course, in other embodiments of the present invention, the arrangement manner of the scale symbols and scale values on the water gauge can be changed according to needs, which will not affect the implementation of the present invention.

[0069] Step S2, as shown in Figure 3 and Figure 4 , input the water area image into a preset segmentation model to segment out a first image, and the first image shows the part of the water gauge exposed above the water surface.

[0070] Specifically, the segmentation model segments the first image from the water area image based on ROI (region of interest), and uses it as the input of the subsequent recognition model. The first image should clearly and completely show the part of the water gauge exposed above the water surface in the water area image, especially the scale symbols and scale values on the part of the water gauge exposed above the water surface. For example, Figure 4 As shown, it is from Figure 2 The first image segmented from the water area image shown.

[0071] Furthermore, as Figure 3 shown, before segmenting the water area image, the water area image will also be rotated to make the water gauge in a vertical state, so that the water gauge in the first image obtained during subsequent segmentation remains vertical.

[0072] Step S3: Input the first image into the trained recognition model to obtain first information, where the first information includes the pixel coordinate information of the scale symbols in the first image and the numerical information corresponding to the scale values.

[0073] Specifically, the first image needs to be preprocessed before being input into the recognition model. The preprocessing specifically includes adjusting the contrast, brightness, and size of the first image, so as to ensure that all the first images input into the recognition model have the same size and clear content.

[0074] Furthermore, the training process of the recognition model includes:

[0075] Collect multiple training images including different lighting conditions, different times, different weather conditions, and different degrees of damage. The training images include water gauges;

[0076] Label the water gauges in the training images, frame the scale symbols and scale values on the water gauges, and ensure that the size of the frame of the scale symbols is consistent with the size of the scale symbols;

[0077] Train the recognition model with the labeled training images to obtain the trained recognition model.

[0078] Preferably, considering the detection effect and detection speed comprehensively, the present invention selects an anchor_free-based object detection model to construct a character detection model, such as DenseBox, YOLO series (You Only Look Once), YOLOX, CornerNet, CenterNet, ExtremeNet, FSAF, FCOS (Fully Convolutional One-Stage Object Detection), FoveaBox (Beyond Anchor-based Object Detector), etc. Any anchor_free-based object detection model can be selected to construct the recognition model in the present invention.

[0079] Specifically, after obtaining the first information in step S3, the pixel coordinate information of the scale symbols in the first image in the first information will be stored in the first container, and the numerical information corresponding to the scale values in the first image will be stored in the second container, so as to facilitate the subsequent separate processing of the pixel coordinate information of the scale symbols and the numerical information corresponding to the scale values.

[0080] Step S4: Input the pixel coordinate information of the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbols intersecting with the water level line.

[0081] Specifically, as Figures 6 to 8 shown, inputting the pixel coordinate information of the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbols intersecting with the water level line specifically includes:

[0082] Step S41: Obtain the pixel coordinates [x i , y i , w i , h i of each scale symbol, where x i and y i are the coordinates of the upper left corner of the detection box corresponding to the i-th scale symbol, and w i and h i are the width and height of the detection box corresponding to the i-th scale symbol;

[0083] Step S42: Select the three scale symbols with the smallest detection box height among all scale symbols. The pixel coordinates of the three scale symbols with the smallest detection box height are [x 1 , y 1 , w 1 , h 1 , [x 2 , y 2 , w2 , h 2 , [x 3 , y 3 , w 3 , h 3 , where h 3 < h 2 < h 1 ;

[0084] Step S43: Calculate the pixel height corresponding to the scale symbol intersecting with the water level line according to the pixel coordinates of the three scale symbols with the smallest detection frame height among all the detected scale symbols and a preset pixel height algorithm. The pixel height algorithm is:

[0085] D = ;

[0086] where D is the pixel height corresponding to the scale symbol intersecting with the water level line.

[0087] Furthermore, the pixel height algorithm is derived based on the following principle. Assume that the changes in adjacent h 3 , h 2 and h 1 are linearly changing. [h 1 , h 2 , [h 2 , h 3 , [h 3 , D] are on a straight line. Based on this, a linear regression model can be established: y = kx + b;

[0088] The known points are [h 1 , h 2 , [h 2 , h 3 . Substitute them into the above linear regression model to calculate k and b, and then substitute [h 3 , D] into it. Finally, the linear regression model can be obtained:

[0089] D = .

[0090] Furthermore, the method for screening out the three scale symbols with the smallest detection frame height among all the scale symbols is: sort all the scale symbols in ascending order according to the height of their detection frames in the first container, and extract the three scale symbols with the smallest detection frame height

[0091] Step S5: Determine the complete scale symbol closest to the water surface as the target scale symbol, and calculate the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height corresponding to the scale symbol intersecting with the water level line.

[0092] Specifically, in step S5, in the first container, the height of the detection frames corresponding to each scale symbol is used to sort each scale symbol in ascending order, and the scale symbol with the smallest height of the detection frame is extracted as the complete scale symbol closest to the water surface, that is, the target scale symbol.

[0093] Specifically, as Figures 5 to 7 shown, in a preferred embodiment of the present invention, the difference between two adjacent scale values is "1", and there are two scale symbols between two adjacent scale values. Therefore, the height value of each scale symbol is "0.5". At this time, the formula for calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height of the scale symbol corresponding to the water level line is:

[0094] ;

[0095] where y d =H-(y L +h L ), H is the pixel height of the part of the water gauge exposed above the water surface, y L is the ordinate of the upper left corner of the detection frame of the target scale symbol, h L is the height of the detection frame of the target scale symbol, D is the pixel height of the scale symbol corresponding to the water level line, is the distance from the water surface to the target scale symbol. Correspondingly, in a preferred embodiment of the present invention, the y L and h L are y 3 and h 3 .

[0096] Step S6: Determine the scale value with the smallest numerical value in the first information as the target scale value, and determine the water level value according to the target scale value and the distance from the water surface to the target scale symbol.

[0097] Specifically, in step S6, in the second container, the numerical information corresponding to the scale values in the first image is screened by the bubble sort method to obtain the scale value with the smallest numerical value in the first information, that is, the target scale value.

[0098] Specifically, determining the water level value according to the target scale value and the distance from the water surface to the target scale symbol specifically includes:

[0099] Judging whether there is a complete scale symbol between the target scale value and the water surface;

[0100] If so, the water level value is S-(0.5 + ∆d), where S is the numerical value of the target scale value, is the distance from the water surface to the target scale symbol;

[0101] If not, the water level value is S - ∆d.

[0102] For example Figure 4 As shown, there is no complete scale symbol between the target scale value and the water surface. The specific value of the target scale value is "2". At this time, the water level value is 2 - ∆d.

[0103] Thus, the water level detection method of the present invention calculates the pixel height corresponding to the scale symbol intersecting the water level line in the first image by establishing a linear regression model, and then uses the pixel height and its corresponding true distance to calculate the distance between the water level line and the target scale symbol in the image, thereby calculating the water level value. It can accurately predict the current water level value by establishing a linear regression model with multiple known numerical information for uncertain numerical estimation, thus realizing water level conversion. This method reduces the error caused by manual estimation, improves the accuracy of the value, and improves the rationality and reliability of the water level value estimation.

[0104] Please refer to Figure 9 , the present invention also provides a water level detection device, including:

[0105] An acquisition unit 10 for acquiring a water area image, where the water area image includes a water gauge, and the water gauge is provided with a plurality of scale symbols arranged in sequence from top to bottom and a plurality of scale values corresponding to the scale symbols;

[0106] A segmentation unit 20 for inputting the water area image into a preset segmentation model to segment out a first image, and the first image shows the part of the water gauge exposed above the water surface;

[0107] An identification unit 30 for inputting the first image into a trained identification model to obtain first information, where the first information includes pixel coordinate information of the scale symbols in the first image and numerical information corresponding to the scale values;

[0108] A first calculation unit 40 for inputting the pixel coordinate information corresponding to the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height corresponding to the scale symbol intersecting the water level line;

[0109] A second calculation unit 50 for determining the complete scale symbol closest to the water surface as the target scale symbol, and calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height corresponding to the scale symbol intersecting the water level line;

[0110] A water level calculation unit 60 for determining the scale value with the smallest value in the first information as the target scale value, and determining the water level value according to the target scale value and the distance from the water surface to the target scale symbol.

[0111] Please refer to Figure 10, the present invention further provides an electronic device, including: a memory 200 and a processor 100, wherein the memory 200 stores a computer program, and when the computer program is executed by the processor 100, the processor 100 is caused to execute the steps of the above method.

[0112] In summary, the present invention provides a water level detection method, device and electronic device. The method includes the following steps: obtaining a water area image, where the water area image includes a water gauge; inputting the water area image into a preset segmentation model to segment out a first image, the first image showing the part of the water gauge exposed above the water surface; inputting the first image into a trained recognition model to obtain first information, the first information including pixel coordinate information of scale symbols in the first image and numerical information corresponding to scale values; inputting the pixel coordinate information of the scale symbols on the water gauge in the first image into a preset linear regression model to obtain the pixel height of the scale symbol intersecting with the water level line; determining the complete scale symbol closest to the water surface as the target scale symbol, and calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height of the scale symbol intersecting with the water level line; determining the scale value with the smallest numerical value in the first information as the target scale value, and determining the water level value according to the target scale value and the distance from the water surface to the target scale symbol, which can reduce the detection error caused by manual estimation and improve the accuracy and reliability of water level detection.

[0113] As described above, for those of ordinary skill in the art, various corresponding changes and deformations can be made according to the technical solutions and technical concepts of the present invention, and all such changes and deformations should fall within the protection scope of the claims of the present invention.

Claims

1. A water level detection method, characterized in that: The steps include: Acquire a water area image, wherein the water area image includes a water ruler, and the water ruler is provided with a plurality of scale symbols arranged in sequence from top to bottom and a plurality of scale values ​​set corresponding to the scale symbols; Inputting the water area image into a preset segmentation model to segment a first image, wherein the first image shows a portion of the water ruler exposed above the water surface; Inputting the first image into a trained recognition model to obtain first information, wherein the first information includes pixel coordinate information of scale symbols in the first image and numerical information corresponding to the scale values; Input the pixel coordinate information corresponding to the scale symbols on the water ruler in the first image into a preset linear regression model to obtain the pixel height corresponding to the scale symbols intersecting the water level line; specifically, the method includes: obtaining the pixel coordinates [x i ,y i ,w i ,h i ], where x i and i is the coordinate of the upper left corner of the detection box corresponding to the i-th scale symbol, w i and h i The width and height of the detection box corresponding to the i-th scale symbol; select the three scale symbols with the smallest detection box height among all scale symbols, and the pixel coordinates of the three scale symbols with the smallest detection box height are [x1, y1, w1, h1], [x2, y2, w2, h2], [x3, y3, w3, h3], where h3 < h2 < h1; the pixel height corresponding to the scale symbol intersecting the water level line is calculated according to the pixel coordinates of the three scale symbols with the smallest detection box height and a preset pixel height algorithm, and the pixel height algorithm is: Where D is the pixel height corresponding to the scale symbol intersecting the water level line; Determine the complete scale symbol closest to the water surface as the target scale symbol, and calculate the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height corresponding to the scale symbol intersecting the water level line; The scale value with the smallest numerical value in the first information is determined as the target scale value, and the water level value is determined according to the target scale value and the distance from the water surface to the target scale symbol.

2. The water level detection method according to claim 1, characterized in that: The plurality of scale marks include a plurality of first scale marks and a plurality of second scale marks; On the water ruler, the multiple scale values ​​and the multiple first scale symbols are alternately arranged in a column from bottom to top, and the multiple second scale symbols are alternately arranged in another column. The multiple first scale symbols and the multiple second scale symbols are staggered in the row direction, and each scale value corresponds to a second scale symbol in the same row.

3. The water level detection method according to claim 2, characterized in that: The formula for calculating the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height corresponding to the scale symbol intersecting the water level line is: Among them, y d =H-(y L +h L ), H is the pixel height of the part of the water ruler exposed above the water surface, y L is the ordinate of the upper left corner of the detection box of the target scale symbol, h L is the height of the detection frame of the target scale symbol, D is the pixel height corresponding to the scale symbol intersecting the water level line, and Δd is the distance from the water surface to the target scale symbol.

4. The water level detection method according to claim 2, characterized in that: Determining the water level value according to the target scale value and the distance from the water surface to the target scale symbol specifically includes: Determine whether there is a complete scale symbol between the target scale value and the water surface; if so, the water level value is S-(0.5+Δd), where S is the value of the target scale value and Δd is the distance from the water surface to the target scale symbol; If not, the water level value is S-Δd.

5. The water level detection method according to claim 1, characterized in that: The training process of the recognition model includes: Collecting a plurality of training images including images of different light, different time, different weather and different damage degree, wherein the training images include a water gauge; Annotate the water ruler in the training image, select the scale symbol and scale value on the water ruler by framing it, and keep the size of the frame marking the scale symbol consistent with the size of the scale symbol; The recognition model is trained using the labeled training images to obtain a trained recognition model.

6. The water level detection method according to claim 1, characterized in that: The step of determining the complete scale symbol closest to the water surface as the target scale symbol and the step of determining the scale value with the smallest value in the first information as the target scale value specifically includes: The pixel coordinate information of the scale symbol in the first image in the first information is stored in the first container, and the numerical value information corresponding to the scale value in the first image is stored in the second container; In the first container, the scale symbols are sorted in ascending order according to the heights of the detection frames of the scale symbols, and the scale symbol with the smallest detection frame height is determined as the complete scale symbol closest to the water surface, that is, the target scale symbol; In the second container, the numerical information corresponding to the scale values ​​in the first image is screened using the bubble sort method to obtain the scale value with the smallest numerical value in the first information, that is, the target scale value.

7. The water level detection method according to claim 1, characterized in that: The recognition model is an anchor_free based target detection model.

8. A water level detection device, characterized in that: include: An acquisition unit, used for acquiring a water area image, wherein the water area image includes a water ruler, and the water ruler is provided with a plurality of scale symbols arranged in sequence from top to bottom and a plurality of scale values ​​set corresponding to the scale symbols; A segmentation unit, used for inputting the water area image into a preset segmentation model to segment a first image, wherein the first image shows a portion of the water ruler exposed above the water surface; A recognition unit, configured to input the first image into a trained recognition model to obtain first information, wherein the first information includes pixel coordinate information of scale symbols in the first image and numerical information corresponding to the scale values; The first calculation unit is used to input the pixel coordinate information corresponding to the scale symbols on the water ruler in the first image into a preset linear regression model to obtain the pixel height corresponding to the scale symbols intersecting the water level line; specifically, it includes: obtaining the pixel coordinates [x i ,y i ,w i ,h i ], where x i and i is the coordinate of the upper left corner of the detection box corresponding to the i-th scale symbol, w i and h i The width and height of the detection box corresponding to the i-th scale symbol; select the three scale symbols with the smallest detection box height among all scale symbols, and the pixel coordinates of the three scale symbols with the smallest detection box height are [x1, y1, w1, h1], [x2, y2, w2, h2], [x3, y3, w3, h3], where h3 < h2 < h1; the pixel height corresponding to the scale symbol intersecting the water level line is calculated according to the pixel coordinates of the three scale symbols with the smallest detection box height and a preset pixel height algorithm, and the pixel height algorithm is: Where D is the pixel height corresponding to the scale symbol intersecting the water level line; A second calculation unit is used to determine the complete scale symbol closest to the water surface as the target scale symbol, and calculate the distance from the water surface to the target scale symbol according to the pixel coordinates of the target scale symbol and the pixel height corresponding to the scale symbol intersecting the water level line; The water level calculation unit is used to determine the smallest scale value in the first information as the target scale value, and determine the water level value according to the target scale value and the distance from the water surface to the target scale symbol.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Water gauge image water level automatic reading method and system based on Mask RCNN algorithm

    CN112766274A

  • Water level monitoring method for performing scale recognition on the basis of partitioning by clustering

    WO2021238030A1