CN114639064B - Water level identification method and device - Google Patents

Water level identification method and device Download PDF

Info

Publication number
CN114639064B
CN114639064B CN202210535926.5A CN202210535926A CN114639064B CN 114639064 B CN114639064 B CN 114639064B CN 202210535926 A CN202210535926 A CN 202210535926A CN 114639064 B CN114639064 B CN 114639064B
Authority
CN
China
Prior art keywords
water level
scale
level gauge
gauge
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210535926.5A
Other languages
Chinese (zh)
Other versions
CN114639064A (en
Inventor
张亚辉
王书堂
胡志坤
张磊
王飞
方亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhiyang Innovation Technology Co Ltd
Original Assignee
Zhiyang Innovation Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhiyang Innovation Technology Co Ltd filed Critical Zhiyang Innovation Technology Co Ltd
Priority to CN202210535926.5A priority Critical patent/CN114639064B/en
Publication of CN114639064A publication Critical patent/CN114639064A/en
Application granted granted Critical
Publication of CN114639064B publication Critical patent/CN114639064B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A10/00TECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE at coastal zones; at river basins
    • Y02A10/40Controlling or monitoring, e.g. of flood or hurricane; Forecasting, e.g. risk assessment or mapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Measurement Of Levels Of Liquids Or Fluent Solid Materials (AREA)

Abstract

The invention relates to a water level identification method and a water level identification device, and belongs to the technical field of intelligent water conservancy. The identification method comprises the following steps: s1, acquiring a water level gauge image and constructing a water level gauge image data set; s2, constructing a water level gauge detection network model, and training the water level gauge detection network model by using a water level gauge image data set; s3, performing water level scale prediction on the water level scale image to be recognized by using the trained water level scale detection network model; and S4, performing post-processing analysis on the prediction result according to the water level scale prediction result to obtain the current water level. The invention can solve the defects in the prior art and accurately acquire the current water level value in real time in a complex natural environment.

Description

Water level identification method and device
Technical Field
The invention relates to the technical field of intelligent water conservancy, in particular to a water level identification method and device.
Background
The water level is one of basic hydrological elements of rivers, lakes and reservoirs, and continuous and reliable water level monitoring is of great significance to water resource management and comprehensive management of the drainage basin because the urban and irrigation areas generally need to obtain information such as water supply amount, rainstorm and flood flow, runoff sediment and nutrient transfer rate and the like according to water level measurement values.
At present, the method for monitoring water level in water conservancy industry includes automatic water level meter detection besides manual detection, wherein the automatic water level meter detection includes float type, pressure type, ultrasonic type, radar type and the like, and the traditional image recognition method can be adopted to monitor the water level. The methods have various defects in monitoring, for example, the manual monitoring has potential safety hazards, high labor intensity and low automation degree; various automatic water level gauges have high cost, the precision is easily influenced by the environment, and the maintenance cost is high; the traditional image identification method has high requirements on the installation angle and the position of each camera, and has poor adaptability.
Chinese patent CN114332870A discloses a water level identification method, device, equipment and readable storage medium, the preprocessing method of the patent is: a large number of complex preprocessing algorithms are adopted to eliminate the influence of external factors such as illumination, firstly, a candidate frame of the water level scale is obtained through an angular point and semantic information extraction network, then, a water level scale image is cut, and the water level scale image is input into a sequence text recognition model to obtain a reading result of each scale image; the post-treatment method comprises the following steps: and (3) sequentially arranging the reading result and the E characters according to the reading result of the scale value of the water level ruler, corresponding the E character at the lowest part to the Chinese character, and searching the Chinese character to obtain the final scale value. The technical scheme has the following defects: firstly, a large amount of work is done, including preprocessing, an angular point detection model and a sequence text recognition model, so that a final scale value result is obtained, and the processing process is very complicated. And secondly, sorting the results according to the position information directly without further processing the scale value information obtained by the model, and directly giving up the reading when a sorting error occurs, namely, the result obtained by the model detection is wrong. And thirdly, aiming at the incomplete E characters appearing in the detection result, the measures are taken that the incomplete E characters correspond to Chinese characters, and then the final scale value is obtained through Chinese character searching. The method is not strict, only the processing of incomplete E characters is explained, the processing method of incomplete scale value characters is not explained, and if the incomplete scale values exist, the reading error of the method is large.
Disclosure of Invention
The invention aims to provide a water level identification method and a water level identification device, which can solve the defects in the prior art, accurately identify the scale value of a water level gauge in real time under a complex natural environment and acquire the current water level value.
In order to achieve the purpose, the invention adopts the following technical scheme:
a water level identification method, the method comprising the steps of:
and S1, acquiring the water level scale image and constructing a water level scale image data set. Step S1 is to acquire the original water level gauge training image to obtain data satisfying the model training.
S2, constructing a water level gauge detection network model, and training the water level gauge detection network model by using the water level gauge image data set. The purpose of step S2 is to train the water gauge detection network model, so that the water gauge detection network model can detect the water gauge image to be recognized.
And S3, performing water level scale prediction on the water level scale image to be recognized by using the trained water level scale detection network model. The purpose of step S3 is to detect the water level scale image to be recognized by using the water level scale detection network model, so as to detect the water level scale, the scale value on the water level scale, the position of the inverted image of the water level scale and the scale value on the inverted image of the water level scale in the water level scale image to be recognized, and the type of the inverted image of the water level scale.
And S4, performing post-processing analysis on the prediction result according to the water level scale prediction result to obtain the current water level. The purpose of step S4 is to analyze and process the detected result to obtain the current water level reading result of the water level gauge image to be identified.
Further, the step S1 of "acquiring a water gauge image and constructing a water gauge image dataset" specifically includes the following steps:
s11, arranging a plurality of cameras on different river reach; the camera is used for shooting the water level gauge and the water area image near the water level gauge. Set up a plurality of camera through different river reach again, can gather diversified original water level gauge training video, and then obtain the data that can satisfy water level gauge detection network model training.
And S12, acquiring videos shot by each camera, and collecting video streams at different time periods. The purpose of step S12 is to collect original water level gauge training video to obtain diverse video that can satisfy water level gauge detection network model training.
S13, processing the collected video stream by adopting a frame extraction method to obtain a plurality of pictures; and the frame extraction time interval is 2s, and one picture is extracted from the video every 2 s. The purpose of step S13 is to extract a training image satisfying the requirement from the video to obtain data satisfying the training of the water gauge detection network model.
And S14, collecting all the collected pictures, and dividing the area of the water level gauge in each picture to manufacture a water level gauge data set. Considering that the water level gauge area is too small and the feature extraction is difficult, step S14 is a method for locally dividing the water level gauge area, so that the water level gauge network detection model can better extract features.
S15, marking the water level scale, the scale value on the water level scale, the inverted image of the water level scale and the scale value on the inverted image of the water level scale in each picture of the water level scale data set by using an open source marking tool Labelimg. The purpose of step S15 is to label the required data to obtain the data required by the water gauge detection network model training, and make a training data set.
S16, marking the water gauge data set according to the following steps: 1: 1, out-of-order into a training set, a test set, and a validation set. The water level gauge data set is divided into three types according to proportion, and the purpose is to supervise the model training process, so that the water level gauge detects better fitting data of the network model.
Further, the water gauge detection network model adopts an improved yolov5 target detection algorithm, improves the yolov5 target detection algorithm, and adds a self-adaptive feature fusion module to perform weighted fusion on the output features of the upper layer; the principle of the self-adaptive feature fusion module is as follows: using the formula
Figure DEST_PATH_IMAGE001
Input features of upper layers
Figure DEST_PATH_IMAGE002
Multiply by respectively correspondingWeight parameter
Figure DEST_PATH_IMAGE003
Obtaining the feature fusion map of the next layer
Figure DEST_PATH_IMAGE004
(ii) a Weight parameter
Figure DEST_PATH_IMAGE005
After dimension reduction, the ranges of the two are all [0,1 ] through a softmax function]Internal and the sum is 1. The subscript and the superscript in the formula represent the correspondence of different feature fusion graphs in front and back.
Further, the step S3, namely performing water gauge scale prediction on the water gauge image to be recognized by using the trained water gauge detection network model; ", specifically comprising the following steps:
s31, preprocessing the water level scale image to be identified acquired by the camera, dividing the area where the water level scale is located in the image, and adjusting the size of the divided image to obtain the preprocessed water level scale image. And (3) carrying out segmentation processing on the water level scale image to be identified, and adjusting the segmented image into the data size required by inference of the water level scale detection network model so as to better detect the processed image.
S32, inputting the preprocessed water level gauge image into a trained water level gauge detection network model, extracting the characteristics of the input image by the water level gauge detection network model, carrying out self-adaptive characteristic fusion on different output layers according to the extracted characteristics, and detecting the positions and the types of the water level gauge in the water level gauge image, the scale values on the water level gauge, the inverted shadow of the water level gauge and the scale values on the inverted shadow of the water level gauge to obtain the positions and the type information of the water level gauge in the water level gauge image, the scale values on the water level gauge, the inverted shadow of the water level gauge and the scale values on the inverted shadow of the water level gauge. The categories comprise a water level gauge, a water level gauge inverted image, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -4, -5, -6, -7 and-9, and 18 categories, wherein the digital category represents each scale value on the water level gauge, and the negative number represents each scale value on the inverted image water level gauge. The purpose of step S32 is to detect the water level scale, the scale value on the water level scale, the inverted image of the water level scale, the position of the scale value on the inverted image of the water level scale, and the type of the scale value in the pre-processed water level scale image to be identified.
Further, the step S4, where "performing post-processing analysis on the prediction result according to the water level scale prediction result to obtain the current water level" specifically includes the following steps:
s41, judging whether the water level scale type exists in the water level scale prediction result; if yes, go to step S42; if not, the post-processing analysis is finished. And reading the water level of the current water level gauge to be identified by combining with the relevant information of the inverted image of the water level gauge, and reading the water level by combining the information of the water level gauge with the inverted image information of the water level gauge.
S42, judging whether the water level scale inversion type exists in the water level scale prediction result, and acquiring a water level line according to the judgment result; the method comprises the following specific steps:
and if the water level scale reflection type does not exist, taking the bottom edge line of the water level scale type detection frame as the water level line.
If the inverted image type of the water level gauge exists, filtering the inverted image type of the water level gauge corresponding to the water level gauge and the water level gauge, keeping a detection frame with the highest confidence coefficient, then judging whether the distance between the bottom side line of the detection frame of the water level gauge and the top end line of the inverted image detection frame corresponding to the water level gauge is smaller than a pixels, and if so, taking the middle line between the bottom side line of the detection frame of the water level gauge and the top end line of the inverted image detection frame of the water level gauge as the water level line; if not, continuously judging whether the scale value on the water level gauge and the scale value on the inverted image of the water level gauge exist in pairs or not; if the water level scales exist in pairs, taking the average value of the median lines of scale values on all the water level scales existing in pairs and the inverted images thereof as the water level line; if the water level gauge exists in pairs, taking the bottom side line of the water level gauge detection frame as a water level line; wherein a is a positive integer, and the value of a is 5; the paired existence means that the scale values on the water level ruler and the corresponding scale values on the inverted image of the water level ruler exist simultaneously. The method for judging whether the water level ruler exists in pairs is to compare scales in the water level ruler with scale values in the inverted image of the water level ruler one by one, if the scales exist in pairs, the scale values are positive and negative, for example, 8 and-8 exist in pairs. If a plurality of scale values exist in pairs, the median line is required to be calculated for each pair of scale values, and then the average value of all the median lines is calculated to be used as the final water line. In step S42, the pixel distance of the water level line in the vertical direction is obtained from the information of the water level scale and its reflection, and the information of the scale value and its reflection, so as to obtain the water level line position.
And S43, traversing the scale values in the water level gauge according to the distance ratio between the scale values of the water level gauge, and correcting false detection and missed detection in the scale values to obtain a complete water level gauge detection result. And the complete water gauge detection result comprises the water gauge and the corrected scale value information of the water gauge. The scale values of the default water level gauge from top to bottom are sequentially decreased, partial scale value error detection or missing detection possibly exists in a target detection result from top to bottom, whether the false detection or missing detection exists or not is automatically judged through an algorithm, then the false detection or missing detection is corrected based on the priori knowledge that the scale values from top to bottom are sequentially decreased, the false detection is corrected, and the missing detection is added. Step S43 is to correct the false detection and the missed detection in the detection result, and combines the principle of descending order of scale values from top to bottom of the water gauge to correct the information of the scale values obtained by detection, and supplements the scale values of the missed detection with the information of the upper and lower scales.
S44, calculating the distance between the minimum scale in the water level gauge detection result obtained in the step S43 and the water level line scale obtained in the step S42, and calculating the scale value of the water level line according to the distance ratio to obtain the water level value. Step S44 obtains the scale information of the water level line by calculating the relationship between the water level line and the scale value.
The invention also relates to a water level recognition device, which comprises the following modules:
the video acquisition module is used for acquiring videos of the area where the water level gauge is located, and the videos of the area where the water level gauge is located comprise the water level gauge and image information of the water surface near the water level gauge. The water level gauge is installed on the bank side of the water area.
And the water level gauge prediction module is used for extracting a video frame image from the video of the area where the water level gauge is located, utilizing the trained water level gauge detection network model to perform target detection on the extracted image, and acquiring the water level gauge in the image, the scale value on the water level gauge, the inverted image of the water level gauge and the category and position information of the scale value on the inverted image of the water level gauge.
And the water level measuring and calculating module is used for measuring and calculating the current water level according to the water level gauge in the image, the scale value on the water level gauge, the inverted image of the water level gauge and the category and position information of the scale value on the inverted image of the water level gauge.
Compared with the prior art, the invention has the advantages that:
(1) the problem that in the prior art, "manual monitoring has potential safety hazards, labor intensity is high, and automation degree is low is solved; various automatic water level meters have high cost, high precision and high maintenance cost, and are easily influenced by the environment; the traditional image identification method has high requirements on the installation angle and the position of each camera, and has poor adaptability. The invention provides a water level identification method, which constructs a water level gauge detection network model, adds a self-adaptive feature fusion module in the existing yolov5 target detection algorithm to detect and identify a water level gauge image, and improves the accuracy and the real-time performance of the algorithm for target detection and identification. By adding the self-adaptive feature fusion module, the water level detection precision can be improved, and the detection precision is improved by 2% through experimental verification. The invention not only eliminates the potential safety hazard, reduces the labor intensity and improves the automation degree, but also has low maintenance cost and no environmental influence on the detection precision. In addition, different from the traditional image identification method, the method has low requirements on the installation angle and the position of each camera and has good adaptability.
(2) In order to solve the technical problem that the reading of the reading post-processing part of the water level gauge in the prior art is inaccurate and the problem that the Chinese patent CN114332870A mentioned in the background art exists, the invention adopts the technical means that corresponding processing methods are respectively designed aiming at different conditions in the detection result, such as the conditions that no water level gauge exists, no reflection occurs on the water level gauge, the reflection occurs on the water level gauge, and the like, firstly, the position information of the water level line is obtained, and then the reading information of the water level line is obtained by combining the corrected scale value information, so that the water level reading problem under various conditions can be processed, and the reading precision is higher. The invention combines the detection frame and the reflection information thereof, the scale value and the reflection information thereof in the target detection result to obtain the position information of the water level line, and finally obtains the reading result through the relative relation between the scale value and the water level line position.
(3) Aiming at the problem I of the Chinese patent CN114332870A mentioned in the background technology, the yolov5 target detection algorithm added with the self-adaptive feature fusion module is used as a water level gauge detection network model, the target detection is directly carried out on an input picture, the position and the reading result of a scale value are obtained, and water level gauge information and all information in a reflection are obtained.
(4) Aiming at the second problem of the Chinese patent CN114332870A mentioned in the background art, the invention designs strict reading logic at the post-processing part, firstly corrects the error detection and the omission of the detected scale value result, then obtains the position of the water line through the detection frame and the reflection information thereof, the scale value and the reflection information thereof, and finally obtains the reading result through the relative relation between the scale value and the water line position.
Drawings
FIG. 1 is a flow chart of a method of identifying water level according to the present invention; wherein, the ruler represents the class name of the water level ruler, and the _rulerrepresents the inverted image class name of the water level ruler;
FIG. 2 is a water gauge label chart in an embodiment of the invention;
FIG. 3 is an exemplary diagram of a water level gauge with no reflection in the embodiment of the present invention;
FIG. 4 is an exemplary diagram of a water level gauge and an inverted image without scales according to the detection result of the embodiment of the present invention;
FIG. 5 is an exemplary diagram of a water level gauge and an inverted image with scale according to the detection result of the embodiment of the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Examples
A certain river channel is monitored and shot in real time, and a water level gauge arranged on the side wall of the river channel bank and a video of a water area near the water level gauge are shot. After a plurality of pictures are extracted from a shot video stream at certain time intervals and sent to a target detection model (the target detection model is a water gauge detection network model) adopted by the invention, the target detection model detects target information at a certain moment. The target information comprises a water level gauge, scale values on the water level gauge, a water level gauge inverted image, and position and category information of the scale values on the water level gauge inverted image. And analyzing the detected target information, judging the water level information at the current moment, and acquiring the water level information in real time.
As shown in fig. 1, the water level identification method of the present invention includes the following steps:
and S1, acquiring the water level scale image and constructing a water level scale image data set. In the present embodiment, the collected water gauge image data has 833 pictures in total. S1 specifically includes the following steps:
and S11, arranging a plurality of cameras at different river reach. The camera is used for shooting the water level gauge and the water area image near the water level gauge.
And S12, acquiring videos shot by the cameras, and collecting video streams at different time periods.
And S13, processing the collected video stream by adopting a frame extraction method to obtain a plurality of pictures. And the frame extraction time interval is 2s, and one picture is extracted from the video every 2 s.
And S14, summarizing all the collected pictures, and dividing the regions of the water level gauges in all the pictures to manufacture a water level gauge data set.
S15, as shown in fig. 2, labeling each picture in the water gauge dataset by using the open source labeling tool Labelimg. In fig. 2, the water level gauge, the inverted image of the water level gauge, and the scale values on the water level gauge are marked by rectangular frames.
S16, according to the data set with the completed label, the data set is characterized in that: 1: 1, out-of-order into a training set, a test set, and a validation set.
S2, constructing a water level gauge detection network model, and training the water level gauge detection network model by using the water level gauge image data set.
The water gauge detection network model adopts an improved yolov5 target detection algorithm, improves the yolov5 target detection algorithm, adds a self-adaptive feature fusion module in the yolov5 target detection algorithm, and performs weighted fusion on the output features of the upper layer.
The principle of the self-adaptive feature fusion module is as follows:
using a formula
Figure 417141DEST_PATH_IMAGE001
Input features of upper layers
Figure 458915DEST_PATH_IMAGE002
Multiplying the weight parameters respectively
Figure 238653DEST_PATH_IMAGE003
Obtaining the feature fusion map of the next layer
Figure 633862DEST_PATH_IMAGE004
. Where the delta parameter represents the layer number in the next layer. Weight parameter
Figure 277595DEST_PATH_IMAGE003
By reducing the dimensionThen all the ranges are [0,1 ] through the softmax function]Internal and the sum is 1.
The self-adaptive feature fusion module is applied to the water level gauge detection network model, and in the process of detecting the water level gauge, the image features of the water level gauge can be better extracted, namely the features of the water level gauge and its inverted image, scale value and its inverted image are better extracted, so that the extracted image features of the water level gauge are more accurate, the detection result of the water level gauge detection network model is better, and the detection precision is higher.
The feature layer in the adaptive feature fusion module represents a feature map obtained by extracting features of an image by a deep learning network, and the feature fusion layer represents a fusion feature map obtained by performing corresponding calculation on different feature layers and adding results, namely the feature fusion layer. Since the feature maps of different layers have different sizes, but the size of the feature fusion layer is fixed, for different feature fusion layers, it is necessary to perform upsampling or downsampling on the feature map layer of the previous step to unify the size of the feature map to be the same as the size of the feature fusion layer, and then multiply the feature layers by the respective corresponding weight parameters α 3 ,β 3 And gamma 3 The method can better fuse the characteristics learned by the network, provide more effective characteristics for the next target detection process, and improve the detection precision of the target detection algorithm model.
Since the feature fusion maps of different layers have different sizes, the feature fusion maps need to be upsampled or downsampled according to specific requirements during operation.
And S3, performing water level scale prediction on the water level scale image to be recognized by using the trained water level scale detection network model.
And S4, performing post-processing analysis on the prediction result according to the water level scale prediction result to obtain the current water level.
S41, judging whether the water level scale type exists in the water level scale prediction result; if yes, go to step S42; if not, finishing the post-processing analysis;
s42, judging whether the water level scale inversion type exists in the water level scale prediction result, and acquiring a water level line according to the judgment result; the method comprises the following specific steps:
if the water level scale reflection type does not exist, the bottom edge line of the water level scale type is used as the water level line, as shown in fig. 3.
And if the water level ruler inverted image type exists, filtering the water level ruler and the inverted image type, keeping a frame with the highest confidence coefficient, and then judging whether the distance between the bottom edge line of the water level ruler and the top edge line of the inverted image is less than a pixels. If L1 represents the position of the bottom edge line of the water level gauge detection frame in the vertical direction and L2 represents the position of the top line of the water level gauge reflection detection frame in the vertical direction, it is determined whether | L1-L2| < a is true, and if the absolute value between L1 and L2 is less than a, the median line between the bottom edge line of the water level gauge detection frame and the top line of the water level gauge reflection detection frame is taken as the water level line, as shown in fig. 4.
If the absolute value between L1 and L2 is not less than a, whether the scale of the water level gauge and the scale in the inverted image of the water level gauge exist in pairs or not is continuously judged. If there are scale values existing in pairs, the average value of the median lines of all scale values on the water level ruler existing in pairs and the inverted image thereof is calculated as the water level line, as in the case shown in fig. 5. And if no water level scale value exists in pairs, taking the bottom edge line of the water level scale detection frame as the water level line. Wherein a is a positive integer, and the value of a is 5. If there are several scale values in pairs, the median line needs to be found for each pair of scale values, and then the average value of all the median lines is found as the final water line. In fig. 5, there are a plurality of scale values 5 and-5, 6 and-6 which exist in pairs, and if the water gauge detection frame and the water gauge reflection detection frame cannot determine the water level line when calculating the water level line, it is necessary to take the average value of the median lines of these pairs of scale values as the water level line.
And S43, traversing the scale values in the water level gauge according to the distance ratio between the scale values of the water level gauge, and correcting false detection and missed detection in the scale values to obtain a complete water level gauge detection result. And the complete water gauge detection result comprises the water gauge and the corrected scale value information of the water gauge. The scale values of the default water level gauge from top to bottom are sequentially decreased, partial scale value error detection or missing detection possibly exists in a target detection result from top to bottom, whether the false detection or missing detection exists is automatically judged through an algorithm, then the false detection or missing detection is corrected based on the principle that the scale values from top to bottom are sequentially decreased, the false detection is corrected, and the missing detection is added.
S44, calculating the distance between the minimum scale in the water level gauge detection result obtained in the step S43 and the water level line scale obtained in the step S42, and calculating the scale value of the water level line according to the distance ratio to obtain the water level value.
And (4) carrying out target detection by adopting a water level gauge target detection network model to obtain the position of the scale value of the water level gauge. And obtaining the distance ratio between different scale values according to the corresponding pixel point distance between the scale value positions. The calculation method of the lower distance ratio is illustrated by an example shown in fig. 5. As shown in fig. 5, if the scale values of the water gauge have detection frames of four scale values, i.e., 5, 6, 7, 8, and 9, the coordinates of the center position of each detection frame are represented by S5, S6, S7, S8, and S9 as the positions of the detection frames. The position of the water level line solved in the steps is represented by Sw, and the ratio of the distances between the adjacent scale values is equal within a certain error range due to the principle that the distances between the scale values of the water level scale are equally distributed. Namely, (S9-S8)/(S8-S7) ≈ (S8-S7)/(S7-S6) ≈ (S7-S6)/(S6-S5) ≈ (S6-S5)/(S5-S4), where S4 is position information of scale value 4 under the water surface, here an unknown number. By the known positions, the distance between S5 and S4, namely S5-S4, is solved, then S5-Sw represents the distance between the water level line and S5 since Sw is also known, and then 5- (S5-Sw)/(S5-S4) obtains the result corresponding to the water level line, namely the water level value. And (4) calculating a distance ratio, calculating to obtain a numerical value represented by the distance between the water surface and the lowest scale value, and then subtracting the scale value and the numerical value to obtain a final water level reading. And the scale value of the water level line is the current water level value.
The invention also relates to a water level identification device which comprises a video acquisition module, a water level gauge prediction module and a water level test module.
The video acquisition module is used for acquiring the video of the area where the water level gauge is located. The video of the area where the water level gauge is located comprises the water level gauge and image information of the water surface near the water level gauge. The water level gauge is installed on the shore of the water area.
The water level gauge prediction module is used for extracting video frame images from the video of the area where the water level gauge is located, processing the collected video stream by adopting a frame extraction method to obtain a plurality of pictures, summarizing all the collected pictures, and dividing the area where the water level gauge is located in all the pictures to manufacture a water level gauge data set; the method is also used for labeling each picture in the water level gauge data set by utilizing an open source labeling tool Labelimg, and labeling the labeled data set according to the following steps of 8: 1: 1, distributing the training set, the test set and the verification set out of order; the method is also used for constructing a water level gauge detection network model, training the model by adopting a water level gauge data set, performing target detection on the extracted image by utilizing the trained water level gauge detection network model, and acquiring the water level gauge in the image, the scale value on the water level gauge, the inverted image of the water level gauge and the category and position information of the scale value on the inverted image of the water level gauge. The water gauge detection network model adopts an improved yolov5 target detection algorithm, improves the yolov5 target detection algorithm, adds a self-adaptive feature fusion module, and performs weighted fusion on the output features of the upper layer.
The principle of the self-adaptive feature fusion module is as follows:
using a formula
Figure 100057DEST_PATH_IMAGE001
Input characteristics of upper layers
Figure 914561DEST_PATH_IMAGE002
Multiplying the weight parameters respectively
Figure 113461DEST_PATH_IMAGE003
Obtaining the feature fusion map of the next layer
Figure 906974DEST_PATH_IMAGE004
(ii) a Weight parameter
Figure 900337DEST_PATH_IMAGE005
After dimension reduction, the ranges of the two are all [0,1 ] through a softmax function]Internal and the sum is 1.
And the water level measuring and calculating module is used for measuring and calculating the current water level according to the water level gauge in the image acquired by the water level gauge predicting module, the scale value on the water level gauge, the inverted image of the water level gauge and the category and position information of the scale value on the inverted image of the water level gauge. The specific operation process of the water level test module is as described in steps S41-S44.
In the embodiment, the improved yolov5 target detection algorithm is used for identifying the water level, the water level detection model is pre-trained, the deep convolutional neural network algorithm is used, image features of a water level ruler, water level ruler scales and inverted images of the water level ruler and the water level ruler scales in a marked image are extracted in a supervised mode, the deep convolutional neural network algorithm is used for continuously fitting and learning the features of different targets in multiple iterations, and finally the water level detection network model meeting the expectation is obtained. The invention respectively designs corresponding processing methods aiming at the conditions of no water level gauge, no reflection of a water level gauge, reflection of a water level gauge and the like, realizes the accurate reading of the water level value and can process the water level reading problem under various conditions.
The invention needs to use a large amount of marked water level scale image data for pre-training, and can apply the algorithm to the prediction of unknown water level scale and water level on the basis of the pre-training, so the invention mainly comprises two parts: the method has the technical key points that the defects that an automatic water level meter is high in cost and easy to influence precision by the environment and a traditional image recognition method is low in flexibility can be overcome, and recognition flexibility and recognition precision are improved while water level recognition cost is reduced.
The detection object of the invention is the water level gauge and the scale value of the inverted image thereof, and the reading of the current water level of the water level gauge can be obtained by directly utilizing the detection result of the neural network by judging the position of the water level gauge and the scale position thereof without an image processing method. The invention obtains the water level gauge, the scale value on the water level gauge, the inverted image of the water level gauge, the category of the scale value on the inverted image of the water level gauge and the detection result of the position information through one-time target detection, and then obtains the position information of the water level line through a corresponding post-processing algorithm. The invention can correct and supplement missing missed detection scale values and false detection scale values by constructing the relationship between upper and lower scale values according to the detected numerical value results, finally obtains correct scale value distribution, and then obtains the final water level reading according to the relationship between the scale values and the water level line.
Compared with the prior art, the invention has the following innovation points:
(1) in order to solve the technical problems of complicated reading algorithm, low precision and low real-time performance of the water level gauge in the prior art, the invention adopts the technical means that the detection results of the water level gauge, the scale value on the water level gauge, the type of the scale value on the inverted image of the water level gauge and the position information are directly obtained by one-time target detection, and then the position information of the water level line is obtained by a corresponding post-processing algorithm.
(2) In order to solve the technical problem of large reading error under the condition that the water level gauge inclines, the technical means adopted by the invention is to judge the distance ratio between different scale values by utilizing an equal-proportion calculation method, so that the reading problem under the condition that the water level gauge inclines can be well solved, and the beneficial effects that the reading of the water level gauge can be continuously carried out under the condition that the water level gauge inclines, and the reading precision under the condition that the water level gauge inclines can also be ensured through the method are achieved. The invention does not need any prior knowledge, is also suitable for the small-amplitude water level gauge inclination condition, and does not influence the final reading. The invention determines the position and the reading of the water level scale value through an improved yolov5 target detection algorithm, can realize the accurate reading of the water level scale, and has the error of about 0.1.
(3) In order to solve the technical problem that the existing water level gauge reading algorithm needs to firstly perform inclination correction on the water gauge for the water level gauge reading in an inclined state, the technical means adopted by the invention is to judge the distance ratio between different scale values by using an equal proportion calculation method, and the water level value can still be read with high precision under the condition that the water level gauge is inclined. The invention does not need to correct the inclination of the water level scale, and the invention reads the water level scale under the inclination condition by judging the scale interval proportion, and does not need a further image processing method.
(4) In order to solve the technical problem that the current reading algorithm depends on the water level scale pattern, the technical means adopted by the invention is to utilize the strong feature extraction capability of a target detection network based on deep learning, the scale values on the water level scale, the reflection of the water level scale and the reflection of the water level scale can be extracted aiming at the water level scales with different patterns, the post-processing is based on the result obtained by inference of the target detection network, the reading is carried out without depending on the water level scale pattern, the beneficial effects that only the scale values on the water level scale are required to be met, and most of the water level scales meet the requirement, and the method is wider in application range.
(5) In order to solve the technical problem that the reading precision of the existing water level gauge reading algorithm is not high, the technical means adopted by the invention is to consider not only the water level gauge body but also the information on the reflection of the water level gauge. The beneficial effect who reaches is the information of make full use of water gauge in the picture, can satisfy the water gauge high accuracy reading under the multiple condition.
The above-mentioned embodiments are merely illustrative of the preferred embodiments of the present invention, and do not limit the scope of the present invention, and various modifications and improvements of the technical solution of the present invention by those skilled in the art should fall within the protection scope defined by the claims of the present invention without departing from the spirit of the present invention.

Claims (3)

1. A water level identification method is characterized in that: the method comprises the following steps:
s1, acquiring a water level scale image and constructing a water level scale image data set;
s2, constructing a water level gauge detection network model, and training the water level gauge detection network model by using a water level gauge image data set;
s3, performing water level scale prediction on the water level scale image to be recognized by using the trained water level scale detection network model;
s31, preprocessing the water level scale image to be identified acquired by the camera, dividing the area where the water level scale is located in the image, and adjusting the size of the divided image to obtain a preprocessed water level scale image;
s32, inputting the preprocessed water level gauge image into a trained water level gauge detection network model, extracting the characteristics of the input image by the water level gauge detection network model, carrying out self-adaptive characteristic fusion on different output layers according to the extracted characteristics, and detecting the positions and the types of the water level gauge in the water level gauge image, the scale values on the water level gauge, the inverted shadow of the water level gauge and the scale values on the inverted shadow of the water level gauge to obtain the positions and the type information of the water level gauge in the water level gauge image, the scale values on the water level gauge, the inverted shadow of the water level gauge and the scale values on the inverted shadow of the water level gauge;
s4, performing post-processing analysis on the prediction result according to the water level scale prediction result to obtain the current water level;
s41, judging whether the water level scale type exists in the water level scale prediction result; if yes, go to step S42; if not, finishing the post-processing analysis;
s42, judging whether the water level scale inversion type exists in the water level scale prediction result, and acquiring a water level line according to the judgment result; the method comprises the following specific steps:
if the water level scale inverted image type does not exist, taking the bottom edge line of the water level scale type detection frame as a water level line;
if the water level scale inverted image type exists, filtering the water level scale inverted image type corresponding to the water level scale and the water level scale, keeping the detection frame with the highest confidence coefficient, then judging whether the distance between the bottom side line of the water level scale detection frame and the top end line of the inverted image detection frame corresponding to the water level scale is smaller than a pixels, and if so, taking the middle line between the bottom side line of the water level scale detection frame and the top end line of the water level scale inverted image detection frame as the water level line; if not, continuously judging whether the scale value on the water level gauge and the scale value on the inverted image of the water level gauge exist in pairs or not; if the pair exists, calculating the middle bit lines readable by each pair of water level gauges and readable by the inverted image of each pair of water level gauges, and taking the average value of all the middle bit lines as the water level line; if the water level gauge exists in pairs, taking the bottom side line of the water level gauge detection frame as a water level line; wherein a is a positive integer, and the value of a is 5;
s43, traversing the scale values in the water level gauge according to the distance ratio between the scale values of the water level gauge, and correcting false detection and missed detection in the scale values to obtain a complete water level gauge detection result;
s44, calculating the distance between the minimum scale in the water level gauge detection result obtained in the step S43 and the water level line scale obtained in the step S42, and calculating the scale value of the water level line according to the distance ratio to obtain the water level value.
2. A water level recognition method according to claim 1, wherein: the step S1 of "acquiring a water gauge image and constructing a water gauge image dataset" specifically includes the steps of:
s11, arranging a plurality of cameras on different river reach; the camera is used for shooting the water level gauge and the water area image near the water level gauge;
s12, acquiring videos shot by each camera, and collecting video streams at different time periods;
s13, processing the collected video stream by adopting a frame extraction method to obtain a plurality of pictures; the frame extracting time interval is 2s, and one picture is extracted from the video every 2 s;
s14, collecting all the collected pictures, and dividing the area of the water level gauge in each picture to manufacture a water level gauge data set;
s15, marking the water level scale, the scale value on the water level scale, the inverted image of the water level scale and the scale value on the inverted image of the water level scale in each picture of the water level scale data set by using an open source marking tool Labelimg;
s16, marking the water gauge data set according to the following steps: 1: 1, out-of-order into a training set, a test set, and a validation set.
3. A water level recognition method according to claim 2, wherein: the water gauge detection network model adopts an improved yolov5 target detection algorithm, improves the yolov5 target detection algorithm, adds a self-adaptive feature fusion module, and performs weighted fusion on the output features of the upper layer; the principle of the self-adaptive feature fusion module is as follows: using the formula
Figure 512670DEST_PATH_IMAGE001
Input features of upper layer
Figure 235775DEST_PATH_IMAGE002
Multiplying the weight parameters respectively
Figure 50147DEST_PATH_IMAGE003
Obtaining the feature fusion map of the next layer
Figure 138189DEST_PATH_IMAGE004
(ii) a Weight parameter
Figure 608485DEST_PATH_IMAGE005
After dimension reduction, the softmax function makes the range of the softmax function be 0,1]Internal and the sum is 1.
CN202210535926.5A 2022-05-18 2022-05-18 Water level identification method and device Active CN114639064B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210535926.5A CN114639064B (en) 2022-05-18 2022-05-18 Water level identification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210535926.5A CN114639064B (en) 2022-05-18 2022-05-18 Water level identification method and device

Publications (2)

Publication Number Publication Date
CN114639064A CN114639064A (en) 2022-06-17
CN114639064B true CN114639064B (en) 2022-09-02

Family

ID=81953016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210535926.5A Active CN114639064B (en) 2022-05-18 2022-05-18 Water level identification method and device

Country Status (1)

Country Link
CN (1) CN114639064B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115082598B (en) * 2022-08-24 2023-07-11 北京百度网讯科技有限公司 Text image generation, training, text image processing method and electronic equipment
CN116129430B (en) * 2023-01-28 2023-06-27 武汉大水云科技有限公司 Self-adaptive environment water level identification method, device and equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347827A (en) * 2019-08-06 2021-02-09 东北大学秦皇岛分校 Automatic detection method and system for ship water gauge
CN112556795A (en) * 2020-12-13 2021-03-26 南京宥安传感科技有限公司 Water level height measurement system based on deep learning

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2619444B1 (en) * 1987-08-13 1992-04-17 France Etat Armement DEVICE FOR PUNCTUAL MEASUREMENT OF THE HEIGHT OF A GROUND OF STIRRING WATER, PARTICULARLY BY SWELL
JP6224061B2 (en) * 2015-12-22 2017-11-01 株式会社プロドローン Water level measurement system, water level control system, and water level measurement method and water level control method using the same
CN107506798B (en) * 2017-08-31 2020-07-10 四创科技有限公司 Water level monitoring method based on image recognition
CN109508630B (en) * 2018-09-27 2021-12-03 杭州朗澈科技有限公司 Method for identifying water level of water gauge based on artificial intelligence
CN109443480B (en) * 2018-11-02 2020-05-26 南京邮电大学 Water level scale positioning and water level measuring method based on image processing
CN110458019B (en) * 2019-07-10 2023-03-24 哈尔滨工程大学 Water surface target detection method for eliminating reflection interference under scarce cognitive sample condition
CN110443243B (en) * 2019-08-07 2022-06-07 浙江大华技术股份有限公司 Water level monitoring method, storage medium, network device and water level monitoring system
CN110909640A (en) * 2019-11-11 2020-03-24 浙江大华技术股份有限公司 Method and device for determining water level line, storage medium and electronic device
CN111223071A (en) * 2019-11-20 2020-06-02 智洋创新科技股份有限公司 Power transmission line scene semantic understanding method based on deep learning technology
CN112036409A (en) * 2020-08-13 2020-12-04 浙江大华技术股份有限公司 Reading identification method and device of liquid level meter
CN112215125A (en) * 2020-10-09 2021-01-12 武汉科技大学 Water level identification method based on YOLOv3
CN112729477A (en) * 2021-01-13 2021-04-30 南京宥安传感科技有限公司 Novel water level height measurement system based on deep learning
CN112766274B (en) * 2021-02-01 2023-07-07 长沙市盛唐科技有限公司 Water gauge image water level automatic reading method and system based on Mask RCNN algorithm
CN113971779B (en) * 2021-10-29 2022-07-01 中国水利水电科学研究院 Water gauge automatic reading method based on deep learning

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347827A (en) * 2019-08-06 2021-02-09 东北大学秦皇岛分校 Automatic detection method and system for ship water gauge
CN112556795A (en) * 2020-12-13 2021-03-26 南京宥安传感科技有限公司 Water level height measurement system based on deep learning

Also Published As

Publication number Publication date
CN114639064A (en) 2022-06-17

Similar Documents

Publication Publication Date Title
WO2021238030A1 (en) Water level monitoring method for performing scale recognition on the basis of partitioning by clustering
CN107506798B (en) Water level monitoring method based on image recognition
CN114639064B (en) Water level identification method and device
US20210374466A1 (en) Water level monitoring method based on cluster partition and scale recognition
CN109508630B (en) Method for identifying water level of water gauge based on artificial intelligence
CN108875794B (en) Image visibility detection method based on transfer learning
CN110472636B (en) Deep learning-based water gauge E-shaped scale identification method
CN113065578B (en) Image visual semantic segmentation method based on double-path region attention coding and decoding
CN111598098B (en) Water gauge water line detection and effectiveness identification method based on full convolution neural network
CN109522889A (en) Hydrological ruler water level identification and estimation method based on image analysis
CN106875395A (en) Super-pixel level SAR image change detection based on deep neural network
CN109186706A (en) A method of for the early warning of Urban Storm Flood flooding area
Osorio et al. An algorithm for the measurement of shoreline and intertidal beach profiles using video imagery: PSDM
CN114067095B (en) Water level identification method based on water gauge character detection and identification
CN112734729B (en) Water gauge water level line image detection method and device suitable for night light supplement condition and storage medium
CN107016353A (en) A kind of method and system of variable resolution target detection and identification integration
CN115880571A (en) Water level gauge reading identification method based on semantic segmentation
Xu et al. Water level estimation based on image of staff gauge in smart city
CN115393700A (en) Water level height identification method and device, electronic equipment and storage medium
CN113469097B (en) Multi-camera real-time detection method for water surface floaters based on SSD network
CN111161264B (en) Method for segmenting TFT circuit image with defects
CN115830514B (en) Whole river reach surface flow velocity calculation method and system suitable for curved river channel
CN117152617A (en) Urban flood identification method and system
CN115578695B (en) Water gauge water level machine vision detection method and device with free shooting visual angle
CN115984360B (en) Method and system for calculating length of dry beach based on image processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant