CN115761468A - Water level detection system and method based on image segmentation and target detection technology - Google Patents

Water level detection system and method based on image segmentation and target detection technology Download PDF

Info

Publication number
CN115761468A
CN115761468A CN202211477590.8A CN202211477590A CN115761468A CN 115761468 A CN115761468 A CN 115761468A CN 202211477590 A CN202211477590 A CN 202211477590A CN 115761468 A CN115761468 A CN 115761468A
Authority
CN
China
Prior art keywords
water level
level gauge
detection
image
pixel
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.)
Pending
Application number
CN202211477590.8A
Other languages
Chinese (zh)
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.)
Shandong Yimeng Pumped Storage Co ltd
State Grid Xinyuan Co Ltd
Original Assignee
Shandong Yimeng Pumped Storage Co ltd
State Grid Xinyuan 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 Shandong Yimeng Pumped Storage Co ltd, State Grid Xinyuan Co Ltd filed Critical Shandong Yimeng Pumped Storage Co ltd
Priority to CN202211477590.8A priority Critical patent/CN115761468A/en
Publication of CN115761468A publication Critical patent/CN115761468A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/30Assessment of water resources

Abstract

A water level detection system and method based on image segmentation and target detection technology belongs to the technical field of computer vision application, improves precision by comparing segmentation and detection results, utilizes a segmentation method to extract a contour of a water level gauge, can find the lowest point of the water level gauge even if a shielding object shields the water level gauge, and effectively calculates the height of the water level gauge shielded by dirt and further calculates the complete height of the water level gauge by segmenting and detecting the dirt which completely shields the water level gauge.

Description

Water level detection system and method based on image segmentation and target detection technology
Technical Field
The invention relates to a water level detection system and method based on image segmentation and target detection technologies, and belongs to the technical field of computer vision application.
Background
With the development of artificial intelligence, the frequency of using intelligent devices to replace human labor in various fields is increasing gradually. The invention mainly focuses on the water conservancy industry, and due to the variability and uncertainty of the river water level, the timeliness and effectiveness cannot be ensured by acquiring the water level through manpower, and when special conditions occur, certain potential safety hazards also exist when the water level is monitored through the manpower.
The intelligent water level detection device can greatly solve the labor cost and some potential safety hazards caused by manual inspection through intelligent products. However, although the intelligent device can solve the problems caused by manual patrol, the problems of insufficient precision of detection results, poor anti-interference capability and the like are caused by equipment, special environmental problems and the like, and the intelligent product based on vision cannot effectively read the water level scale where the current water level is located when the water level scale is shielded.
For this reason, the prior art discloses the following patent documents:
chinese patent document CN112991342A discloses a water level line detection method based on a water level ruler image, and specifically discloses: s1, acquiring a water level image corresponding to the position of a water level gauge acquired in a water level detection scene, and acquiring the actual height y _ t 0 of the water level line during initialization by taking a first water level image I0 as a reference during initialization; s2, detecting the position of the water level gauge in the first water level image I0 by using a water level gauge detection model, and cutting out a corresponding water level gauge image J0; s3, detecting a relative coordinate y _ p 0 of a water level line in the water level gauge image J0 by using a water level line detection model; s4, obtaining an initial value K0 of a conversion rate K p of the actual height of the water level line and the relative coordinate according to the length M of the water level gauge, the relative coordinate y _ p 0 and the actual height y _ t 0 of the water level line during initialization; p represents a water line detection sequence, and the value of the water line detection sequence is a natural number which is greater than or equal to 0; when the value of p is 0, the initialization of the detection sequence is represented; s5, in the subsequent detection process, acquiring a water level image according to a set period, and detecting and outputting a relative coordinate y _ p n of a water level line by using a water level line detection model after the water level line detection is carried out on the water level image in the current frame by using the water level line detection model aiming at the water level image in the current frame, wherein n is a natural number which is more than or equal to 1; and S6, calculating the actual height y _ t n of the water level line corresponding to the water level image in of the current frame based on the relative coordinates y _ p n of the water level line and the conversion rate K n-1.
Chinese patent document CN113221898A discloses an automatic water level gauge reading method, and specifically discloses: the method comprises the following steps that S1, a graduated scale image is preprocessed, and a binary image is generated; wherein the graduated scale is a water level scale; s2, detecting the linear inclination angle of the edge of the graduated scale in the binary image through Hough transform, and adjusting the image according to the linear inclination angle; s3, performing pixel-level calculation on the aligned image to obtain a scale matrix; s4, judging whether the graduated scale matrix conforms to the priori knowledge or not, and if not, correcting the graduated scale matrix; and S5, determining the reading of the graduated scale based on the corrected graduated data.
Chinese patent document CN109543596A discloses a water level monitoring method, and specifically discloses: step S1, inputting a first image containing a water level gauge into a first convolution neural network model which is trained in advance, and determining first position information of a water level gauge prediction frame in the first image; s2, extracting a second image corresponding to the water level gauge from the first image according to the first position information, inputting the second image into a second convolutional neural network model trained in advance, determining second position information of digital prediction frames on the water level gauge in the second image, and identifying the number in each digital prediction frame according to the second position information; and S3, determining a target number corresponding to the water surface according to the recognized number, and determining the water level height according to the target number and the color of the target number.
In summary, when the current vision-based intelligent device realizes water level detection, the water level scale corresponding to the current water surface needs to be detected, and when the water level scale is shielded, the water level detection cannot be effectively realized, and the method for realizing the water level detection depends on the difference between different images, so that the anti-interference capability is poor, and if a camera shakes or the angle slightly changes, the detection result has certain error.
Disclosure of Invention
Aiming at the defects of the prior art, the invention discloses a water level detection system based on image segmentation and target detection technology.
The invention also discloses a water level detection method based on the image segmentation and target detection technology.
Aiming at the problems of insufficient precision, poor anti-interference capability, incapability of acquiring readings when a water level gauge is shielded and the like in the existing intelligent equipment, the invention realizes the detection of the water level by combining a segmentation technology and a target detection technology.
The detailed technical scheme of the invention is as follows:
a water level detection system based on image segmentation and target detection technology is characterized by comprising a fixed point position camera, a water level gauge and a platform with a water level detection algorithm based on image segmentation and target detection technology; and the fixed point position camera acquires the image of the water level gauge and then transmits the image to the platform through a wireless network, and finally the water level height is obtained.
A water level detection method based on image segmentation and target detection technology is characterized by comprising the following steps:
the method comprises the following steps of S1, acquiring a visible light image of a target scene, wherein the target scene at least comprises a river with a water gauge;
s2, processing the visible light image by adopting an image segmentation and detection model:
a mask image is obtained by the image segmentation,
obtaining a detection result through the detection model, wherein the detection result comprises a water level ruler coordinate, a position coordinate of water level ruler scales, a spot position coordinate on the water level ruler and corresponding confidence coefficient;
the image segmentation and detection model adopts an integrated neural network, and can also adopt an independent image segmentation network and an independent target detection network, wherein the image segmentation is used for segmenting the image to be detected into corresponding mask images, and the detection model is used for identifying the coordinates of a water level gauge, the position coordinates of scales of the water level gauge and the position coordinates of stains on the water level gauge; the image segmentation and detection model is a conventional neural network model in the prior art, and the technical characteristics of the invention are realized as long as the output of the mask image and the output of the target coordinate are realized;
s3, determining the accurate position of the water level gauge, wherein the accurate position comprises two information processing paths:
one path of the method comprises the steps of screening label information of the mask image, then carrying out binarization processing on the screened mask image to obtain a binarization mask image, and correspondingly obtaining position coordinate information of a water level ruler corresponding to the binarization mask image;
the other path of the detection result is obtained by acquiring the coordinate information of the water gauge;
performing cross comparison calculation on the position coordinates of one path of the water level gauge and the position coordinates of the water level gauge with the confidence coefficient greater than a preset confidence coefficient threshold value in the detection result, and selecting the position coordinates of the water level gauge corresponding to the maximum value of the cross comparison as an accurate position;
step S4, judging whether the water level gauge has stains or not, wherein the method comprises two information processing paths:
one path of the method comprises the steps of screening label information of a mask image, carrying out binarization processing on the screened mask image to obtain a binarization mask image, and correspondingly obtaining position coordinate information of stains corresponding to the binarization mask image;
the other path of the detection method is used for acquiring the stain coordinate information in the detection result;
judging whether the stains exist on the water level gauge or not by comparing the stains in the two paths;
and (3) calculating the pixel height of the water level gauge according to whether the water level gauge has the stain or not:
if the dirt exists, the pixel height of the water level gauge is the sum of the pixel height of the water level gauge and the pixel height of the dirt on the water level gauge;
if no dirt exists, the pixel distance of the height of the water level gauge is the pixel height of the water level gauge;
s5, screening and calibrating the detection result of the position coordinates of the water level scale scales, and correcting the center coordinates of all screened digital detection frames to the same straight line; calculating the pixel distance of the corrected adjacent numbers, removing outliers of the pixel distances of all the adjacent numbers, screening out values with overlarge distance deviation, and then calculating the average value of the residual pixel distances;
s6, calculating a mapping relation from the pixel distance to the actual distance based on the actual distance between the water level scale numbers; and mapping the pixel height of the water level gauge, and mapping the pixel height of the water level gauge to an actual distance to obtain the actual height of the water level gauge on the water surface.
Preferably, in step S2, the image segmentation and detection model is a YoloV5 neural network model loaded with a segmentation head, so as to implement segmentation and detection at the same time;
the specific steps of step S2 include:
training the image segmentation and detection model, identifying the visible light image to be detected and outputting a result;
the training of the image segmentation and detection model comprises steps S201 to S203:
step S201, acquiring water level ruler images in different scenes, respectively carrying out image segmentation annotation and target detection annotation through an annotation tool, and respectively generating annotation files of json type and xml type;
step S202, the image annotation files are respectively processed, mask images corresponding to the images are generated for the json type annotation files, and corresponding txt files are required to be generated for the xml type annotation files;
step S203, training the image segmentation and detection model by using the water level gauge images in different scenes and the corresponding processed annotation files;
identifying the visible light image to be detected and outputting a result:
and S204, recognizing the visible light image to be detected by using the trained image segmentation and detection model, and outputting a mask image, a water level ruler coordinate, a position coordinate of a water level ruler scale and a stain position coordinate on the water level ruler corresponding to the visible light image to be detected.
According to a preferred embodiment of the present invention, step S3 specifically includes:
step S301, screening the divided mask images by using RGB channels, and adding label information: the green part is a water level gauge, the blue part is the inverted image of the water level gauge, the gray part is dirt between the water level gauge and the joint of the water level, and the red part is a shelter between the water level gauge and the joint of the water level;
step S302, carrying out binarization processing on the screened mask image to obtain a binarized mask image;
step S303, carrying out contour search on the mask image after binaryzation, and preferably selecting a contour search function; preferably, the contour search function is a cv2.Findcountours function in Opencv;
step S304, solving the minimum external rectangle of the searched outline;
step S305, presetting a noise dot area threshold:
when the area of the minimum circumscribed rectangle is calculated to be smaller than or equal to the area threshold, judging as a noise point, and deleting the searched outline;
otherwise, storing the position coordinates of the minimum circumscribed rectangle in the mask image;
step S306, presetting a confidence coefficient threshold of a water gauge; and performing cross-over ratio calculation on the position coordinate of the minimum circumscribed rectangle and the position coordinate of the water level gauge with the confidence coefficient greater than the preset water level gauge confidence coefficient threshold value in the detection result, and selecting the water level gauge position coordinate corresponding to the maximum value of the cross-over ratio as an accurate position.
According to a preferred embodiment of the present invention, in the step S4, the specific method for judging whether the stain exists on the water level gauge by comparing the stains in the two paths includes:
step S401, presetting a stain confidence coefficient threshold; intersection and comparison calculation are carried out on the position coordinates of the minimum circumscribed rectangle and the position coordinates of the stains of which the confidence degrees are larger than a preset stain confidence degree threshold value in the detection result;
presetting a first stain intersection ratio threshold; and when the intersection ratio is larger than a preset first dirt intersection ratio threshold value, judging that dirt exists on the position on the water level gauge.
According to the present invention, in the step S4, the specific method for judging whether the stain exists on the water level gauge by comparing the stains in the two paths includes:
step S402, if the result of one of the two ways shows that the water level gauge is stained, calculating an intersection ratio according to the position coordinate of the stain and the position coordinate of the water level gauge:
presetting a second stain intersection ratio threshold value; and when the intersection ratio is larger than a preset second dirt intersection ratio threshold value, judging that dirt exists on the position on the water level ruler.
Preferably, in step S5, the step of screening and calibrating the detection result of the position coordinates of the water level scale mark includes:
step S501, a scale confidence coefficient threshold is preset; screening the detection frames of all scale numbers on the water level ruler detected by the detection module: discarding detection frames smaller than the scale confidence degree threshold value, and discarding detection frames not on the water level gauge;
step S502, performing linear fitting on the center coordinates of the screened scale number detection frame to form a fitting straight line;
step S503, calculating the projection of the center coordinate of the scale number detection frame to the fitting straight line so as to correct the position of the scale number detection frame;
step S504, calculating the pixel distance between the central points of the correction scale number detection frames to obtain the pixel distance of adjacent numbers;
step S505, calculating the average value of all pixel distances;
step S506, calculating the standard deviation between the distances of all pixels and the mean value;
step S507, when the difference between a certain pixel distance and the mean is greater than three times of the standard deviation σ, the pixel distance is an outlier, and outlier removal is a method, where the outlier refers to an abnormal value of the distance between the numbers of the neighboring points;
step S508, deleting all the pixel distances determined as outliers;
in step S509, the average value of all the remaining adjacent digital pixel distances is taken as the final pixel distance.
Preferably according to the present invention, the specific steps in step S6 include:
step S601, calculating a mapping relation f = l/c from the pixel distance to the actual distance based on the actual distance between the water level scale numbers, wherein c represents the pixel distance; l represents the actual distance between the scale numbers of the water level gauge, and the pixel distance refers to the average value after recalculation;
step S602, mapping the pixel height of the water level gauge, and mapping the pixel height of the water level gauge to an actual distance to obtain the actual height L = f C of the water level gauge on the water surface, wherein f is the mapping relation between the pixel distance and the actual distance; c represents the pixel distance of the water level gauge, wherein the actual length of the water level gauge is known, and the current water level height can be obtained by subtracting the actual height L of the water level gauge on the water surface from the actual length of the water level gauge.
Compared with the prior art, the invention has the advantages and positive effects that:
1. the segmentation algorithm and the detection algorithm are mutually compared, and the detection precision of the water gauge is improved.
2. The pixel height of the water level gauge is mapped to the actual height, so that the detection error caused by inaccurate reading can be avoided.
3. When the bottom of the water level gauge is provided with the shielding object, the water level gauge cannot read the water level, but the shape of the water level gauge has the lowest point, so that the problem that the water level gauge cannot read the water level due to the existence of the shielding object can be avoided to the greatest extent by the method.
4. When the water level ruler has the stain, the stain completely shields the reading of the water level ruler, and the invention solves the problem of inaccurate detection caused by invisible reading by detecting the stain on the water level ruler and calculating the pixel height.
5. The invention combines image segmentation and target detection technology to realize water level detection, improves precision by mutually contrasting segmentation and detection results, extracts the outline of the water level gauge by utilizing a segmentation method, can also find the lowest point of the water level gauge even if a shielding object shields the water level gauge, and effectively calculates the height of the water level gauge shielded by dirt by segmenting and detecting the dirt which completely shields the water level gauge so as to calculate the complete height of the water level gauge.
Drawings
FIG. 1 is a flow chart of an embodiment of a method for detecting a mud water level according to the present invention;
FIG. 2 is a diagram illustrating the result of target detection in the water level detection method according to the present invention;
FIG. 3 is a mask image of the water gauge processed after image segmentation in the water level detection method provided by the present invention;
FIG. 4 is a mask image of a water level bar inverted image after image segmentation in the water level detection method provided by the present invention;
fig. 5 is a mask image of the processed stains after image segmentation in the water level detection method provided by the present invention.
Detailed description of the invention
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and examples.
It should be noted that in the description of the present invention, the terms of direction or positional relationship indicated by the terms "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, which are only for convenience of description, and do not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Examples 1,
A water level detection system based on image segmentation and target detection technology comprises a fixed point position camera, a water level gauge and a platform with a water level detection algorithm based on image segmentation and target detection technology; and the fixed point position camera acquires the water level gauge image and transmits the image to the platform through a wireless network, and finally the water level height is obtained.
Examples 2,
As shown in fig. 1, a water level detection method based on image segmentation and target detection technology includes:
the method comprises the following steps of S1, acquiring a visible light image of a target scene, wherein the target scene at least comprises a river with a water gauge;
s2, processing the visible light image by adopting an image segmentation and detection model:
a mask image is obtained by the image segmentation,
obtaining a detection result through the detection model, wherein the detection result comprises a water level ruler coordinate, a position coordinate of water level ruler scales, a spot position coordinate on the water level ruler and corresponding confidence coefficient; as shown in fig. 2, the contents displayed from top to bottom are explained as follows:
"ruler 0.79" indicates that the confidence of the water level ruler is 0.79 in the detection result;
"9.84" indicates that the detection result is that the confidence coefficient of the water level scale 9 is 0.84;
"8.83" indicates that the detection result is that the confidence coefficient of the water level scale 8 is 0.83;
"7.71" indicates that the detection result is that the confidence coefficient of the water level scale 7 is 0.71;
"-ruler 0.78" indicates that the detection result is a water level bar reflection with a confidence of 0.78.
The image segmentation and detection model adopts an integrated neural network, and can also adopt an independent image segmentation network and an independent target detection network, wherein the image segmentation is used for segmenting the image to be detected into corresponding mask images, and the detection model is used for identifying the coordinates of a water level gauge, the position coordinates of scales of the water level gauge and the position coordinates of stains on the water level gauge; the image segmentation and detection model is a conventional neural network model in the prior art, and the technical characteristics of the invention are realized as long as the output of the mask image and the output of the target coordinate are realized;
s3, determining the accurate position of the water level gauge, wherein the accurate position comprises two information processing paths:
one path of the method comprises the steps of screening label information of the mask image, and then carrying out binarization processing on the screened mask image to obtain a binarization mask image, wherein the binarization mask image of a water level ruler is shown in a figure 3, the binarization mask image of a water level ruler inverted image is shown in a figure 4, and position coordinate information of the binarization mask image corresponding to the water level ruler is correspondingly obtained;
the other path of the detection result is obtained by acquiring the coordinate information of the water gauge;
performing cross comparison calculation on the position coordinates of one path of the water level gauge and the position coordinates of the water level gauge with the confidence coefficient greater than a preset confidence coefficient threshold value in the detection result, and selecting the position coordinates of the water level gauge corresponding to the maximum value of the cross comparison as an accurate position;
step S4, judging whether the water level gauge has stains or not, wherein the method comprises two information processing paths:
one path of the method is to screen the label information of the mask image, and then carry out binarization processing on the screened mask image to obtain a binarization mask image, as shown in figure 5, and correspondingly obtain the position coordinate information of the stain corresponding to the binarization mask image;
the other path of the detection method is used for acquiring the stain coordinate information in the detection result;
judging whether the water level ruler has the stains or not by comparing the stains in the two paths;
and (3) calculating the pixel height of the water level gauge according to whether the dirt exists on the water level gauge:
if the dirt exists, the pixel height of the water level gauge is the sum of the pixel height of the water level gauge and the pixel height of the dirt on the water level gauge;
if no dirt exists, the pixel distance of the height of the water level gauge is the pixel height of the water level gauge;
s5, screening and calibrating the detection result of the position coordinate of the water level scale, and correcting the center coordinates of all screened digital detection frames to be on the same straight line; calculating the pixel distance of the corrected adjacent numbers, removing outliers of the pixel distances of all the adjacent numbers, screening out values with overlarge distance deviation, and then calculating the average value of the residual pixel distances;
s6, calculating a mapping relation from the pixel distance to the actual distance based on the actual distance between the water level scale numbers; and mapping the pixel height of the water level gauge, and mapping the pixel height of the water level gauge to an actual distance to obtain the actual height of the water level gauge on the water surface.
Examples 3,
In the method according to embodiment 2, in step S2, the image segmentation and detection model is a YoloV5 neural network model loaded with a segmentation head, so as to implement segmentation and detection at the same time;
the specific steps of step S2 include:
training the image segmentation and detection model, identifying the visible light image to be detected and outputting a result;
the training of the image segmentation and detection model comprises steps S201 to S203:
step S201, acquiring water level ruler images in different scenes, respectively carrying out image segmentation annotation and target detection annotation through an annotation tool, and respectively generating annotation files of json type and xml type;
step S202, the image annotation files are respectively processed, mask images corresponding to the images are generated for the json type annotation files, and corresponding txt files are required to be generated for the xml type annotation files;
step S203, training the image segmentation and detection model by using the water level gauge images in different scenes and the corresponding processed annotation files;
identifying the visible light image to be detected and outputting a result:
and S204, recognizing the visible light image to be detected by using the trained image segmentation and detection model, and outputting a mask image, a water level ruler coordinate, a position coordinate of water level ruler scales and a stain position coordinate on the water level ruler corresponding to the visible light image to be detected.
Examples 4,
As in the method in embodiment 2, in step S3, the method specifically includes:
step S301, screening the segmented mask image by using an RGB channel, and adding label information: the green part is a water level gauge, the blue part is a reversed image of the water level gauge, the gray part is dirt between the water level gauge and the joint of the water level, and the red part is a shelter between the water level gauge and the joint of the water level;
step S302, performing binarization processing on the screened mask image to obtain a binarized mask image;
step S303, carrying out contour search on the mask image after binaryzation, and preferably selecting a contour search function; preferably, the contour search function is a cv2.Findcountours function in Opencv;
step S304, solving the minimum external rectangle of the searched outline;
step S305, presetting a noise dot area threshold:
when the area of the minimum circumscribed rectangle is calculated to be smaller than or equal to the area threshold, judging as a noise point, and deleting the searched outline;
otherwise, storing the position coordinates of the minimum circumscribed rectangle in the mask image;
step S306, presetting a confidence coefficient threshold of a water gauge; and performing cross-over ratio calculation on the position coordinate of the minimum circumscribed rectangle and the position coordinate of the water level gauge with the confidence coefficient greater than the preset water level gauge confidence coefficient threshold value in the detection result, and selecting the water level gauge position coordinate corresponding to the maximum value of the cross-over ratio as an accurate position.
Examples 5,
As in the method in embodiment 2, in step S4, the specific method for judging whether there is dirt on the water level gauge by comparing the dirt in the two paths includes:
step S401, presetting a stain confidence coefficient threshold; intersection comparison calculation is carried out on the position coordinate of the minimum circumscribed rectangle and the position coordinate of the stain with the confidence coefficient larger than a preset stain confidence coefficient threshold value in the detection result;
presetting a first stain intersection ratio threshold value; and when the intersection ratio is larger than a preset first dirt intersection ratio threshold value, judging that dirt exists on the position on the water level ruler.
Examples 6,
As in the method in embodiment 2, in step S4, the specific method for judging whether there is dirt on the water level gauge by comparing the dirt in the two paths includes:
step S402, if the result of one of the two ways shows that the water level gauge has dirt, calculating the intersection ratio according to the dirt position coordinate and the water level gauge position coordinate:
presetting a second stain intersection ratio threshold value; and when the intersection ratio is larger than a preset second dirt intersection ratio threshold value, judging that dirt exists on the position on the water level ruler.
Example 7,
As in the method of embodiment 2, in step S5, the specific steps of screening and calibrating the detection result of the position coordinates of the water level scale mark include:
step S501, a scale confidence coefficient threshold value is preset; screening the detection frames of all scale numbers on the water level ruler detected by the detection module: discarding the detection frames smaller than the scale confidence degree threshold value, and discarding the detection frames not on the water level gauge;
step S502, performing linear fitting on the center coordinates of the screened scale digital detection frame to form a fitting straight line;
step S503, calculating the projection of the center coordinate of the scale number detection frame to the fitting straight line so as to correct the position of the scale number detection frame;
step S504, calculating the pixel distance between the central points of the correction scale number detection frames to obtain the pixel distance of adjacent numbers;
step S505, calculating the mean value of all pixel distances;
step S506, calculating the standard deviation between the distances of all pixels and the mean value;
step S507, when the difference between a certain pixel distance and the mean is greater than three times of the standard deviation σ, the pixel distance is an outlier, and outlier removal is a method, where the outlier refers to an abnormal value of the distance between the numbers of the neighboring points;
step S508, deleting all the pixel distances determined as outliers;
in step S509, the average value of all the remaining adjacent digital pixel distances is taken as the final pixel distance.
Example 8,
As described in embodiment 2, the specific steps in step S6 include:
step S601, calculating a mapping relation f = l/c from the pixel distance to the actual distance based on the actual distance between the water level scale numbers, wherein c represents the pixel distance; l represents the actual distance between the scale numbers of the water level scale, and the pixel distance refers to the average value after recalculation;
step S602, mapping the pixel height of the water level gauge, and mapping the pixel height of the water level gauge to an actual distance to obtain the actual height L = f C of the water level gauge on the water surface, wherein f is the mapping relation between the pixel distance and the actual distance; c represents the pixel distance of the water level gauge, wherein the actual length of the water level gauge is known, and the current water level height can be obtained by subtracting the actual height L of the water level gauge on the water surface from the actual length of the water level gauge.
According to the embodiment, the water level gauges numbered 1, 2, 3 and 4 are read through the algorithm, and absolute errors are obtained through comparison and correspondence of the absolute errors and the manual readings, as shown in the table 1, so that the errors between the detection method and the manual readings are small, and the actual scene requirements are met.
TABLE 1 Water level ruler test results (reading refers to height of water level ruler above water surface)
Numbering 1 2 3 4
Manual reading/dm 41.90 15.60 18.10 11.50
Algorithm reading/dm 42.09 16.26 18.32 11.39
Absolute error/dm 0.19 0.46 0.22 0.11

Claims (8)

1. A water level detection system based on image segmentation and target detection technology is characterized by comprising a fixed point position camera, a water level gauge and a platform with a water level detection algorithm based on image segmentation and target detection technology; and the fixed point position camera acquires the water level gauge image and transmits the image to the platform through a wireless network, and finally the water level height is obtained.
2. The water level detection method based on image segmentation and target detection technology as claimed in claim 1, characterized by comprising:
the method comprises the following steps of S1, acquiring a visible light image of a target scene, wherein the target scene at least comprises a river with a water level gauge;
s2, processing the visible light image by adopting an image segmentation and detection model:
a mask image is obtained by the image segmentation,
obtaining a detection result through the detection model, wherein the detection result comprises a water level ruler coordinate, a position coordinate of water level ruler scales, a spot position coordinate on the water level ruler and corresponding confidence coefficient;
s3, determining the accurate position of the water level gauge, wherein the accurate position comprises two information processing paths:
one path of the method comprises the steps of screening label information of a mask image, carrying out binarization processing on the screened mask image to obtain a binarization mask image, and correspondingly obtaining position coordinate information of a water level gauge corresponding to the binarization mask image;
the other path of the detection result is obtained by acquiring the coordinate information of the water gauge;
performing cross comparison calculation on the position coordinates of one path of the water level gauge and the position coordinates of the water level gauge with the confidence coefficient greater than a preset confidence coefficient threshold value in the detection result, and selecting the position coordinates of the water level gauge corresponding to the maximum value of the cross comparison as an accurate position;
step S4, judging whether the water level gauge has stains or not, wherein the method comprises two information processing paths:
one path of the method comprises the steps of screening label information of a mask image, carrying out binarization processing on the screened mask image to obtain a binarization mask image, and correspondingly obtaining position coordinate information of stains corresponding to the binarization mask image;
the other path of the detection result is obtained by acquiring the stain coordinate information in the detection result;
judging whether the stains exist on the water level gauge or not by comparing the stains in the two paths;
and (3) calculating the pixel height of the water level gauge according to whether the water level gauge has the stain or not:
if the dirt exists, the pixel height of the water level gauge is the sum of the pixel height of the water level gauge and the pixel height of the dirt on the water level gauge;
if no dirt exists, the pixel distance of the height of the water level gauge is the pixel height of the water level gauge;
s5, screening and calibrating the detection result of the position coordinate of the water level scale, and correcting the center coordinates of all screened digital detection frames to be on the same straight line; calculating the pixel distance of the corrected adjacent numbers, removing outliers of the pixel distances of all the adjacent numbers, screening out values with overlarge distance deviation, and then calculating the average value of the residual pixel distances;
s6, calculating a mapping relation from the pixel distance to the actual distance based on the actual distance between the water level scale numbers; and mapping the pixel height of the water level gauge, and mapping the pixel height of the water level gauge to an actual distance to obtain the actual height of the water level gauge on the water surface.
3. The method for detecting water level based on image segmentation and object detection technology as claimed in claim 2, wherein in the step S2, the image segmentation and detection model is a YoloV5 neural network model loaded with a segmentation head to achieve segmentation and detection at the same time;
the specific steps of step S2 include:
training the image segmentation and detection model, identifying the visible light image to be detected and outputting a result;
the training of the image segmentation and detection model comprises steps S201 to S203:
step S201, acquiring water level ruler images in different scenes, respectively carrying out image segmentation annotation and target detection annotation through an annotation tool, and respectively generating annotation files of json type and xml type;
step S202, the image annotation files are respectively processed, mask images corresponding to the images are generated for the json type annotation files, and corresponding txt files are required to be generated for the xml type annotation files;
step S203, training the image segmentation and detection model by using the water level gauge images in different scenes and the corresponding processed annotation files;
identifying the visible light image to be detected and outputting a result:
and S204, recognizing the visible light image to be detected by using the trained image segmentation and detection model, and outputting a mask image, a water level ruler coordinate, a position coordinate of a water level ruler scale and a stain position coordinate on the water level ruler corresponding to the visible light image to be detected.
4. The method for detecting water level based on image segmentation and target detection technology as claimed in claim 2, wherein the step S3 specifically comprises:
step S301, screening the divided mask images by using RGB channels, and adding label information: the green part is a water level gauge, the blue part is the inverted image of the water level gauge, the gray part is dirt between the water level gauge and the joint of the water level, and the red part is a shelter between the water level gauge and the joint of the water level;
step S302, carrying out binarization processing on the screened mask image to obtain a binarized mask image;
step S303, carrying out contour search on the mask image after binarization, and preferably selecting a contour search function;
step S304, solving the minimum external rectangle of the searched outline;
step S305, presetting a noise dot area threshold:
when the area of the minimum circumscribed rectangle is calculated to be smaller than or equal to the area threshold, judging the minimum circumscribed rectangle as a noise point, and deleting the searched outline;
otherwise, storing the position coordinates of the minimum circumscribed rectangle in the mask image;
step S306, presetting a confidence threshold of a water level gauge; and performing cross-over ratio calculation on the position coordinate of the minimum circumscribed rectangle and the position coordinate of the water level gauge with the confidence coefficient greater than the preset water level gauge confidence coefficient threshold value in the detection result, and selecting the water level gauge position coordinate corresponding to the maximum value of the cross-over ratio as an accurate position.
5. The water level detection method based on image segmentation and target detection technology as claimed in claim 2, wherein in step S4, the specific method for judging whether the dirt exists on the water level gauge by comparing the dirt in the two paths comprises:
step S401, presetting a stain confidence coefficient threshold; intersection comparison calculation is carried out on the position coordinate of the minimum circumscribed rectangle and the position coordinate of the stain with the confidence coefficient larger than a preset stain confidence coefficient threshold value in the detection result;
presetting a first stain intersection ratio threshold value; and when the intersection ratio is larger than a preset first dirt intersection ratio threshold value, judging that dirt exists on the position on the water level ruler.
6. The water level detection method based on image segmentation and target detection technology as claimed in claim 2, wherein in step S4, the specific method for judging whether the dirt exists on the water level gauge by comparing the dirt in the two paths comprises:
step S402, if the result of one of the two ways shows that the water level gauge is stained, calculating an intersection ratio according to the position coordinate of the stain and the position coordinate of the water level gauge:
presetting a second stain intersection ratio threshold value; and when the intersection ratio is larger than a preset second dirt intersection ratio threshold value, judging that dirt exists on the position on the water level ruler.
7. The water level detection method based on image segmentation and target detection technology as claimed in claim 2, wherein in the step S5, the specific steps of screening and calibrating the detection result of the position coordinates of the water level scale comprise:
step S501, a scale confidence coefficient threshold value is preset; screening the detection frames of all scale numbers on the water level ruler detected by the detection module: discarding detection frames smaller than the scale confidence degree threshold value, and discarding detection frames not on the water level gauge;
step S502, performing linear fitting on the center coordinates of the screened scale number detection frame to form a fitting straight line;
step S503, calculating the projection of the center coordinate of the scale number detection frame to the fitting straight line so as to correct the position of the scale number detection frame;
step S504, calculating the pixel distance between the central points of the correction scale number detection frames to obtain the pixel distance of adjacent numbers;
step S505, calculating the mean value of all pixel distances;
step S506, calculating the standard deviation between the distances of all pixels and the mean value;
step S507, when the difference between a certain pixel distance and the mean value is greater than three times of the standard deviation σ, the pixel distance is an outlier;
step S508, deleting all the pixel distances determined as outliers;
in step S509, the average value of all the remaining adjacent digital pixel distances is taken as the final pixel distance.
8. The method for detecting water level based on image segmentation and object detection technology as claimed in claim 2, wherein the specific steps in step S6 include:
step S601, calculating a mapping relation f = l/c from the pixel distance to the actual distance based on the actual distance between the water level scale numbers, wherein c represents the pixel distance; l represents the actual distance between the scale numbers of the water level gauge;
step S602, mapping the pixel height of the water level gauge, and mapping the pixel height of the water level gauge to an actual distance to obtain the actual height L = f C of the water level gauge on the water surface, wherein f is the mapping relation between the pixel distance and the actual distance; and C represents a water level ruler pixel distance.
CN202211477590.8A 2022-11-23 2022-11-23 Water level detection system and method based on image segmentation and target detection technology Pending CN115761468A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211477590.8A CN115761468A (en) 2022-11-23 2022-11-23 Water level detection system and method based on image segmentation and target detection technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211477590.8A CN115761468A (en) 2022-11-23 2022-11-23 Water level detection system and method based on image segmentation and target detection technology

Publications (1)

Publication Number Publication Date
CN115761468A true CN115761468A (en) 2023-03-07

Family

ID=85336324

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211477590.8A Pending CN115761468A (en) 2022-11-23 2022-11-23 Water level detection system and method based on image segmentation and target detection technology

Country Status (1)

Country Link
CN (1) CN115761468A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115953454A (en) * 2023-03-10 2023-04-11 武汉大水云科技有限公司 Water level obtaining method, device and equipment based on image restoration and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115953454A (en) * 2023-03-10 2023-04-11 武汉大水云科技有限公司 Water level obtaining method, device and equipment based on image restoration and storage medium
CN115953454B (en) * 2023-03-10 2023-05-05 武汉大水云科技有限公司 Water level acquisition method, device, equipment and storage medium based on image restoration

Similar Documents

Publication Publication Date Title
CN109443480B (en) Water level scale positioning and water level measuring method based on image processing
CN109543596B (en) Water level monitoring method and device, electronic equipment and storage medium
CN106960208B (en) Method and system for automatically segmenting and identifying instrument liquid crystal number
CN110210477B (en) Digital instrument reading identification method
CN108133216B (en) Nixie tube reading identification method capable of realizing decimal point reading based on machine vision
CN110310255B (en) Point switch notch detection method based on target detection and image processing
CN111652213A (en) Ship water gauge reading identification method based on deep learning
CN112651968A (en) Wood board deformation and pit detection method based on depth information
CN110647795A (en) Form recognition method
CN110838097A (en) Conveyor belt offset measurement method based on machine vision
CN106709952B (en) A kind of automatic calibration method of display screen
CN111354047B (en) Computer vision-based camera module positioning method and system
CN111932504A (en) Sub-pixel positioning method and device based on edge contour information
CN114331986A (en) Dam crack identification and measurement method based on unmanned aerial vehicle vision
CN111861979A (en) Positioning method, positioning equipment and computer readable storage medium
CN115761468A (en) Water level detection system and method based on image segmentation and target detection technology
CN112686872B (en) Wood counting method based on deep learning
CN113592839A (en) Distribution network line typical defect diagnosis method and system based on improved fast RCNN
CN112036391B (en) Electronic inspection method and system based on shale gas field production station
CN114862761A (en) Power transformer liquid level detection method, device, equipment and storage medium
CN113902894A (en) Strip type level meter automatic reading identification method based on image processing
CN115170551A (en) Product detection and tracing method and system based on visual technology calibration
CN114638805A (en) Track slab crack detection method and system and storage medium
CN114092542A (en) Bolt measuring method and system based on two-dimensional vision
CN114529555A (en) Image recognition-based efficient cigarette box in-and-out detection method

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