Water level positioning method, device, system, electronic device and storage medium
By iteratively segmenting the water level detection images and applying a water surface classification model, the problem of low accuracy in water surface line detection was solved, achieving higher robustness and accuracy in water level positioning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2026-03-24
AI Technical Summary
In existing technologies, water surface segmentation methods are prone to misidentifying water areas as non-water areas when the water is too clear, resulting in decreased accuracy in determining the water surface line and low robustness in the detection scenario.
By dividing the current detection box in the image to be detected into at least two sub-detection boxes, the trained water surface classification model is used to determine whether a water surface detection box exists, and water level positioning is performed based on the preset reference line of the water surface detection box when the size requirements are met, thereby realizing iterative division of water body regions and non-water body regions.
It improves the accuracy of water level detection, enhances the robustness of the detection scenario, and ensures the accuracy of water level positioning.
Smart Images

Figure CN115222656B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing, and in particular to water level positioning methods, apparatus, systems, electronic devices, and storage media. Background Technology
[0002] With advancements in technology, image processing can improve the accuracy and safety of water level monitoring by detecting water levels. In scenarios involving objects in contact with water, such as water level detection, determining the boundary line between the water body and the object placed within it—the water surface line—plays a crucial role in the accuracy of water level detection algorithms.
[0003] Currently, water level detection using image processing technology often employs water surface segmentation. This segmentation method indirectly determines the position of the water surface line in the image by dividing the water surface into two categories: water surface and non-water surface. However, in cases where the water is too clear, this method can easily misclassify water areas as non-water areas. Figure 1a This diagram illustrates an application scenario of water surface segmentation methods in related technologies. It includes a water level gauge inserted into the water body for water level measurement. Figure 1b This is a schematic diagram illustrating the results of determining the water surface line based on water surface segmentation in related technologies. Combined with... Figure 1a and Figure 1b As can be seen, the above water surface segmentation method also identifies water areas in the image as non-water areas, which reduces the accuracy of water surface line determination and thus has low robustness to the detection scene.
[0004] There is currently no effective solution to the problem of low robustness of related technologies to detection scenarios. Summary of the Invention
[0005] This embodiment provides a water level positioning method, apparatus, system, electronic device, and storage medium to address the problem of low robustness in detection scenarios in related technologies.
[0006] Firstly, this embodiment provides a water level positioning method, including:
[0007] In response to the current detection box of a target object in the image to be detected meeting a preset first size requirement, the current detection box is divided into at least two sub-detection boxes based on the dividing objects in the current detection box; the target object includes a tool for measuring water level.
[0008] Determine whether a water surface detection frame exists in the at least two sub-detection frames, wherein the water surface detection frame is a sub-detection frame that includes a water surface line;
[0009] In response to the existence of the water surface detection frame and the size of the water surface detection frame meeting the second size requirement, water level positioning is performed based on the preset reference line of the water surface detection frame.
[0010] In some embodiments, the water level positioning method further includes:
[0011] In response to the existence of the water surface detection frame and the size of the water surface detection frame not meeting the second size requirement, the water surface detection frame is updated to the current detection frame.
[0012] In some embodiments, dividing the current detection box into at least two sub-detection boxes based on the partitioning object in the current detection box includes:
[0013] Based on at least one reference point of the current detection box, the current detection box is divided into at least two sub-detection boxes, wherein the reference point includes the length division point and / or the length midpoint of the current detection box.
[0014] In some embodiments, dividing the current detection box into at least two sub-detection boxes based on the partitioning object in the current detection box further includes:
[0015] Based on at least one reference line of the current detection box, the current detection box is divided into at least two sub-detection boxes, wherein the reference line includes a horizontal midpoint line and / or a horizontal bisector line.
[0016] In some embodiments, determining whether a water surface detection frame exists in the at least two sub-detection frames includes:
[0017] Based on the trained water surface classification model, the confidence level of the image within each of the at least two sub-detection boxes belonging to the water body region is obtained;
[0018] The sub-detection frames whose water confidence levels meet the preset confidence range are defined as water surface detection frames containing the water surface line.
[0019] In some embodiments, the water level positioning method further includes:
[0020] Establish a training dataset; wherein the training dataset includes a water body dataset and a non-water body dataset;
[0021] The preset water surface classification model is trained based on the training dataset to obtain the trained water surface classification model.
[0022] In some embodiments, the first size requirement includes the size of the current detection frame being greater than a preset first size threshold, and the second size requirement includes the size of the water surface detection frame being less than a preset second size threshold.
[0023] In some embodiments, the current detection box is an initial detection box. Before dividing the current detection box into at least two sub-detection boxes based on the dividing objects in the current detection box in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, the water level localization method further includes:
[0024] The image to be detected is input into the trained detection model to obtain an object detection box containing the target object.
[0025] The object detection box is expanded in length according to the size of the image to be detected to obtain the initial detection box.
[0026] Secondly, this embodiment provides a water level positioning device, including: a binary module, a determining module, and a positioning module; wherein:
[0027] The binary division module is used to divide the current detection box into at least two sub-detection boxes based on the dividing objects in the current detection box in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement; the target object includes a tool for measuring water level.
[0028] The determining module is used to determine whether there is a water surface detection frame in the at least two sub-detection frames, wherein the water surface detection frame is a sub-detection frame that includes a water surface line;
[0029] The positioning module is used to perform water level positioning based on a preset reference line of the water surface detection frame in response to the existence of the water surface detection frame and the size of the water surface detection frame meeting the second size requirement.
[0030] Thirdly, this embodiment provides a water level positioning system, including: an image acquisition device and a server device; wherein the image acquisition device is connected to the server device;
[0031] The image acquisition device is used to acquire an image to be detected containing the target object, and to transmit the image to be detected to the server device;
[0032] The server device is used to perform the water level positioning method described in the first aspect on the image to be detected.
[0033] Fourthly, this embodiment provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the water level positioning method described in the first aspect above.
[0034] Fifthly, this embodiment provides a storage medium storing a computer program that, when executed by a processor, implements the water level positioning method described in the first aspect above.
[0035] Compared with related technologies, the water level positioning method, apparatus, system, electronic device, and storage medium provided in this embodiment, in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, divides the current detection box into at least two sub-detection boxes based on the division objects in the current detection box; the target object includes a tool for measuring water level; it is determined whether a water surface detection box exists in the at least two sub-detection boxes, the water surface detection box being a sub-detection box containing a water surface line; in response to the existence of a water surface detection box and the size of the water surface detection box meeting a second size requirement, water level positioning is performed based on a preset reference line of the water surface detection box. This achieves iterative division of water and non-water areas within the detection box, thereby improving the accuracy of water surface line detection and thus enhancing robustness to the detection scenario.
[0036] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0037] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0038] Figure 1a This is an application scenario diagram of water surface segmentation methods in related technologies;
[0039] Figure 1b This is a schematic diagram of the result of determining the water surface line based on the water surface segmentation method in related technologies;
[0040] Figure 2 This is an application scenario diagram of the water level positioning method in this embodiment;
[0041] Figure 3 This is a flowchart of the water level positioning method in this embodiment;
[0042] Figure 4 This is a schematic diagram of a detection frame binary search process in this embodiment;
[0043] Figure 5a This is a schematic diagram of a detection frame in this embodiment;
[0044] Figure 5b This is a schematic diagram of a detection frame expansion in this embodiment;
[0045] Figure 6This is a flowchart of the water surface line determination method according to a preferred embodiment;
[0046] Figure 7 This is a schematic diagram of the water surface line detection results provided in this embodiment;
[0047] Figure 8 This is a structural block diagram of the water level positioning device in this embodiment;
[0048] Figure 9 This is a schematic diagram of the water level positioning system in this embodiment. Detailed Implementation
[0049] To better understand the purpose, technical solution, and advantages of this application, the application is described and explained below in conjunction with the accompanying drawings and embodiments.
[0050] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," and "third," etc., used in this application are merely for distinguishing similar objects and do not represent a specific ordering of the objects.
[0051] The method embodiments provided in this example can be executed on a terminal (such as a computer or a smart camera) or on a server. Figure 2 This diagram illustrates an application scenario of the water level positioning method described in this embodiment. The application scenario can be any situation requiring water level monitoring, such as groundwater level monitoring, river surface water level monitoring during the flood season, or waterway transportation water level monitoring. Figure 2As shown, the camera device installed in this application scenario acquires an image containing a water level gauge. If the current detection frame of the water level gauge in the image meets a preset first size requirement, the current detection frame is divided into at least two sub-detection frames based on the dividing object of the current detection frame. Then, it is determined whether a water surface detection frame containing a water surface line exists within these at least two sub-detection frames. If a water surface detection frame exists and its size meets a second size requirement, the water level is located based on a preset reference line of the water surface detection frame. After determining the position of the water surface line in the image, the water level in the current application scenario is determined according to the scale of the water level gauge.
[0052] This embodiment provides a water level positioning method. Figure 3 This is a flowchart of the water level positioning method in this embodiment, as follows: Figure 3 As shown, the process includes the following steps:
[0053] Step S310: In response to the current detection box of the target object in the image to be detected meeting the preset first size requirement, the current detection box is divided into at least two sub-detection boxes based on the dividing objects in the current detection box; the target object includes a tool for measuring water level.
[0054] In this context, the image to be detected is the image acquired by a camera device installed in the water level detection scenario, which is then used for water level positioning. The target object in the image to be detected can be any type of water level measuring tool; this embodiment does not impose any specific limitations. For ease of description, the following explanation will use a water level gauge as the target object. After obtaining the image to be detected, a water level gauge can be detected in the image based on a trained detection model, thereby drawing an initial detection box containing the water level gauge in the image. This initial detection box is then used as the current detection box to initiate the water level positioning process. Understandably, the current detection box is iteratively updated along with the processing flow of this embodiment.
[0055] The current detection frame meets a preset first size requirement, specifically, the size of the current detection frame conforms to the preset size requirement. For example, the length of the current detection frame exceeds a preset length threshold, or the length of the current detection frame conforms to a preset length range; or, for example, the area of the current detection frame exceeds a preset area threshold or conforms to a preset area range; or, for example, the diagonal length of the current detection frame meets a preset length threshold, or conforms to a preset length range. The dividing object of the current detection frame can specifically be a reference line or reference point within the current detection frame, such as one or more of the following: length dividing points, length midpoints, horizontal midpoint lines, and horizontal dividing lines.
[0056] For example, if the length of the current detection box exceeds a preset length threshold, the current detection box can be divided into upper and lower parts based on the horizontal midpoint line of the current detection box, resulting in an upper detection box and a lower detection box. Further, the length threshold can be predetermined to be 5 pixels. If the length of the current detection box exceeds 5 pixels, it is determined that the current detection box meets a preset first size requirement, and the current detection box is then divided into upper and lower detection boxes. Figure 4 This is a schematic diagram of a detection frame bisection process in this embodiment. Figure 4 As shown in the figure, the detection box a on the left is the current detection box. When the length of the current detection box a exceeds 5 pixels, it is divided into two parts based on the midpoint line of the length of the current detection box a, resulting in the upper detection box b and the lower detection box c.
[0057] Step S320: Determine whether there is a water surface detection box in at least two sub-detection boxes. The water surface detection box is a sub-detection box that contains the water surface line.
[0058] Specifically, any water surface detection method in image processing can be used to determine whether a sub-detection box containing a water surface line exists within the two sub-detection boxes. For example, the sub-detection boxes can be detected based on a trained classification model to determine whether a sub-detection box containing a water surface line exists. This water surface classification model can be any type of classification model, such as the ResNet (Residual Network) model, etc., and is not specifically limited in this embodiment. Wherein, at least one of the two sub-detection boxes contains a water surface line. Figure 4 As can be seen, the upper detection box b does not contain the water surface line, while the lower detection box c does. Therefore, by inputting the upper detection box b and the lower detection box c into the trained water surface classification model for detection, the lower detection box c can be identified as the water surface detection box based on the detection results.
[0059] Step S330: In response to the existence of a water surface detection frame and the size of the water surface detection frame meeting the second size requirement, water level positioning is performed based on the preset reference line of the water surface detection frame.
[0060] After selecting the water surface detection frame from the aforementioned sub-detection frames, it is further determined whether the size of the water surface detection frame meets the preset second size requirement. Similarly, the water surface detection frame meeting the preset second size requirement can mean that the area of the water surface detection frame meets a preset area requirement, the diagonal length of the water surface detection frame meets a preset length requirement, or the length of the water surface detection frame meets a preset length requirement, etc. For example, it is confirmed whether the length of the water surface detection frame is greater than 5 pixels. If so, it is determined that the water surface detection frame does not meet the second size requirement, and the water surface detection frame is taken as the current detection frame, and its sub-detection frames are further divided. Otherwise, the preset reference line of the water surface detection frame is directly output as the water surface line. Furthermore, the preset reference line of the water surface detection frame can be the horizontal midpoint line of the water surface detection frame or a predetermined bisector. Preferably, the preset reference line is the horizontal midpoint line of the water surface detection frame.
[0061] In steps S310 to S330 above, in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, the current detection box is divided into at least two sub-detection boxes based on the division objects in the current detection box. The target object includes a tool for measuring water level. It is determined whether a water surface detection box exists in the at least two sub-detection boxes. The water surface detection box is a sub-detection box containing a water surface line. In response to the existence of a water surface detection box and the size of the water surface detection box meeting a second size requirement, water level positioning is performed based on a preset reference line of the water surface detection box. This achieves iterative division of water and non-water areas in the detection box, thereby improving the accuracy of water surface line detection and thus improving robustness to the detection scene.
[0062] In one embodiment, the above-described water level positioning method may further include the following steps:
[0063] In step S340, in response to the existence of a water surface detection frame and the fact that the size of the water surface detection frame does not meet the second size requirement, the water surface detection frame is updated to the current detection frame.
[0064] For example, if the length of the water surface detection box exceeds 5 pixels, in order to improve the accuracy of water surface line positioning, the water surface detection box can be updated to the current detection box and further divided into sub-detection boxes to obtain a smaller water surface detection box, thereby improving the accuracy of water level positioning.
[0065] In one embodiment, based on step S310 above, the current detection box is divided into at least two sub-detection boxes based on the dividing object in the current detection box, which may specifically include the following steps:
[0066] Step S311: Based on at least one reference point of the current detection box, divide the current detection box into at least two sub-detection boxes. The reference points include the length division points and / or the length midpoints of the current detection box.
[0067] This process involves dividing the current detection frame into sub-detection frames based on predetermined rules. For example, the midpoint of the current detection frame's length can be used as a reference point, or other equally spaced points along the current detection frame's length can be selected for sub-detection frame division. Dividing the current detection frame into sub-detection frames based on reference points to obtain smaller sub-detection frames for water surface line positioning improves the accuracy of water surface line determination and, consequently, the accuracy of water level positioning.
[0068] In another embodiment, based on step S310 above, dividing the current detection box into at least two sub-detection boxes based on the division object in the current detection box may further include the following steps:
[0069] Step S312: Based on at least one reference line of the current detection box, divide the current detection box into at least two sub-detection boxes. The reference line includes a horizontal midpoint line and / or a horizontal bisector line.
[0070] For example, the current detection frame can be divided into two parts based on the horizontal midpoint line of the current detection frame according to a predetermined division rule. Alternatively, the current detection frame can be horizontally divided into three sub-detection frames based on the horizontal bisectors of the current detection frame. This embodiment divides the current detection frame into sub-detection frames based on at least one reference line to obtain smaller sub-detection frames for water surface line positioning, which improves the accuracy of water surface line determination and thus improves the accuracy of water level positioning.
[0071] In another embodiment, based on the above step S320, determining whether a water surface detection frame exists in at least two sub-detection frames may specifically include the following steps:
[0072] Step S321: Based on the trained water surface classification model, obtain the water body confidence score of the image in each of at least two sub-detection boxes that belongs to the water body region;
[0073] Step S322: Determine the sub-detection frames whose water confidence levels in at least two sub-detection frames meet the preset confidence level range as water surface detection frames containing the water surface line.
[0074] Furthermore, this water surface classification model can be used to detect whether an image belongs to a water body region and output a confidence score indicating that the image belongs to a water body region. The higher the confidence score, the higher the probability that the image belongs to a water body region; conversely, the lower the confidence score, the higher the probability that the image belongs to a non-water body region. Therefore, the confidence score output by the water surface classification model after detecting the sub-detection box can be used to determine whether it contains a water surface line. If the output confidence score exceeds a preset range, it indicates that the image within the detection box is either entirely a water body region or entirely a non-water body region, and therefore does not contain a water surface line.
[0075] For example, if the output confidence level is less than 10%, the image within the detection box can be considered to be entirely non-water areas; if the output confidence level is greater than 90%, the image within the detection box can be considered to be entirely water areas. In both cases, the detection box does not contain a water surface line. Only when the output confidence level meets a preset range, such as greater than 10% and less than 90%, can it be determined that the image within the detection box contains both water and non-water areas, and therefore, the detection box can be determined to contain a water surface line. Thus, based on the detection results of the water surface classification model, the detection boxes containing water surface lines in the above sub-detection boxes can be identified as water surface detection boxes.
[0076] Steps S321 to S322 above calculate the water body confidence score of the image within the sub-detection box to be a water body region, and select the detection box containing the water surface line from all sub-detection boxes based on the confidence score, thereby improving the accuracy of water surface line detection.
[0077] Furthermore, in one embodiment, the above-described water level positioning method may further include the following steps:
[0078] Step S323: Establish a training dataset; wherein the training dataset includes a water body dataset and a non-water body dataset. The water body dataset is the image dataset of the water body region, and the non-water body dataset is the image dataset of the non-water body region.
[0079] Step S324: Train the preset water surface classification model based on the training dataset to obtain the trained water surface classification model.
[0080] Steps S323 to S324 above train a preset water surface classification model based on the water body dataset and non-water body dataset, so that the trained water surface classification model can output the confidence that the image contains water, which makes it easier to distinguish the water surface detection boxes in all sub-detection boxes, thereby improving the accuracy of water surface line detection.
[0081] In another embodiment, the first size requirement includes the size of the current detection frame being greater than a preset first size threshold, and the second size requirement includes the size of the water surface detection frame being less than a preset second size threshold. By setting corresponding size thresholds for the current detection frame and the water surface detection frame, the range of the water surface line determination can be controlled, thereby improving the accuracy of the determined water surface line.
[0082] In another embodiment, based on step S310 above, if the current detection box is an initial detection box, before dividing the current detection box into at least two sub-detection boxes based on the dividing object in the current detection box in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, the above water level localization method may further include the following steps:
[0083] Step S350: Input the image to be detected into the trained detection model to obtain an object detection box containing the target object;
[0084] Step S360: Expand the object detection box in length according to the size of the image to be detected to obtain the initial detection box.
[0085] Specifically, the detection model can be any object detection model from related technologies. For example, it can be a first-order object detection model such as YOLO (YouOnly Look Once) or SSD (Single Shot MultiBox Detector), or a second-order object detection model such as Faster-RCNN (Faster-Region-CNN). The detection model can be trained on a training dataset containing the target object. By inputting the image to be detected, which contains the target object, into the trained detection model, the initial detection box for the target object can be obtained.
[0086] Alternatively, the distance between the object detection box and the upper and lower boundaries of the image to be detected can be calculated, and the length of the object detection box can be expanded by shortening the distance between the object detection box and the upper and lower boundaries of the image to be detected. Figure 5a This is a schematic diagram of a detection frame in this embodiment. Figure 5b This is a schematic diagram of a detection frame expansion according to this embodiment. (In conjunction with...) Figure 5a and Figure 5b It can be seen that the distance from the object detection box to the upper boundary of the image to be detected is d1. Therefore, the object detection box is expanded upward by 1 / 2 d1. The distance from the object detection box to the lower boundary of the image to be detected is d2. Therefore, the object detection box is expanded downward by 1 / 2 d2. By expanding the length of the object detection box, the initial detection box is obtained, which enables the initial detection box to include the actual water surface area, reducing the error of the detection model and thus improving the adaptability of water level localization to the detection scene.
[0087] The present embodiment will now be described and illustrated through preferred embodiments.
[0088] Figure 6 This is a flowchart of the water surface line determination method according to a preferred embodiment. Figure 6As shown, the method for determining the water level line includes the following steps:
[0089] Step S601: Train the detection model to complete the detection of target objects in the image to be detected and draw the object detection box;
[0090] Step S602: Calculate the distances from the top and bottom edges of the image to the object detection box, denoted as d1 and d2. Expand the top and bottom edges of the object detection box by 1 / 2d1 and 1 / 2d2 respectively to obtain the expanded current detection box.
[0091] Step S603: If the length of the current detection box is less than 5 pixels, proceed to step S604; otherwise, proceed to step S605.
[0092] Step S604: Output the water surface line as the horizontal line where the center point of the current detection frame is located;
[0093] Step S605: Divide the current detection box into an upper detection box and a lower detection box from the midpoint line;
[0094] Step S606: Create water body dataset and non-water body dataset, train the classification model, and obtain the trained classification model;
[0095] Step S607: Input the upper detection box and the lower detection box into the trained classification model, and output the confidence scores of the upper detection box and the lower detection box belonging to the water surface.
[0096] Step S608: The detection boxes with a confidence level greater than or equal to 10% and less than or equal to 90% in step S607 are taken as the current detection boxes;
[0097] Step S609: Repeat steps S603 to S608 until the length of the current detection box is less than 5 pixels.
[0098] Figure 7 This is a schematic diagram of the water level detection results provided in this embodiment. Figure 7 As shown, when the length of the current detection box containing the water surface line is less than the preset pixel, the midpoint line, i.e. the black line segment in the figure, can be directly output as the water surface line.
[0099] It should be noted that the steps shown in the above flowchart or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here. For example, steps S601 and S606.
[0100] This embodiment also provides a water level positioning device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. The terms "module," "unit," "subunit," etc., used below refer to combinations of software and / or hardware that implement a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0101] Figure 8 This is a structural block diagram of the water level positioning device 80 in this embodiment, as shown below. Figure 8 As shown, the water level positioning device 80 includes: a two-part module 82, a determining module 84, and a positioning module 86; wherein:
[0102] The binary module 82 is used to divide the current detection box into at least two sub-detection boxes based on the dividing object in the current detection box in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement; the target object includes a tool for measuring water level;
[0103] The determination module 84 is used to determine whether there is a water surface detection box in at least two sub-detection boxes, where the water surface detection box is a sub-detection box that contains the water surface line.
[0104] The positioning module 86 is used to perform water level positioning based on the preset reference line of the water surface detection frame in response to the existence of the water surface detection frame and the size of the water surface detection frame meeting the second size requirement.
[0105] The aforementioned water level positioning device 80, in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, divides the current detection box into at least two sub-detection boxes based on the division objects within the current detection box; the target object includes a tool for measuring water level; it determines whether a water surface detection box exists within the at least two sub-detection boxes, where the water surface detection box is a sub-detection box containing a water surface line; in response to the existence of a water surface detection box and the size of the water surface detection box meeting a second size requirement, it performs water level positioning based on a preset reference line of the water surface detection box. This achieves iterative division of water and non-water areas within the detection box, thereby improving the accuracy of water surface line detection and thus enhancing robustness to the detection scene.
[0106] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0107] This embodiment also provides a water level positioning system. Figure 9This is a schematic diagram of the water level positioning system 90 in this embodiment, as shown below. Figure 9 As shown, the water level positioning system 90 includes: an image acquisition device 92 and a server device 94; wherein, the image acquisition device 92 is connected to the server device 94;
[0108] Image acquisition device 92 is used to acquire an image to be detected containing the target object and transmit the image to be detected to server device 94;
[0109] Server device 94 is used to perform the water level positioning method provided in any of the above embodiments on the image to be detected.
[0110] The aforementioned water level positioning system 90 achieves iterative division of the water body area and non-water body area within the detection frame, thereby improving the accuracy of water surface line detection and thus enhancing robustness to the detection scenario.
[0111] This embodiment also provides an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0112] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0113] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0114] In response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, the current detection box is divided into at least two sub-detection boxes based on the dividing object in the current detection box; the target object includes a tool for measuring water level;
[0115] Determine whether a water surface detection box exists in at least two sub-detection boxes. A water surface detection box is a sub-detection box that includes the water surface line.
[0116] In response to the existence of a water surface detection frame and the size of the water surface detection frame meeting the second size requirement, water level positioning is performed based on the preset reference line of the water surface detection frame.
[0117] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated in this embodiment.
[0118] Furthermore, in conjunction with the water level positioning method provided in the above embodiments, this embodiment can also provide a storage medium for implementation. The storage medium stores a computer program; when executed by a processor, the computer program implements any of the water level positioning methods described in the above embodiments.
[0119] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0120] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.
[0121] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0122] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A water level positioning method, characterized in that, include: In response to the current detection box of a target object in the image to be detected meeting a preset first size requirement, the current detection box is divided into at least two sub-detection boxes based on the dividing objects in the current detection box; the target object includes a tool for measuring water level; the first size requirement includes the size of the current detection box being greater than a preset first size threshold. Determine whether a water surface detection frame exists in the at least two sub-detection frames, wherein the water surface detection frame is a sub-detection frame that includes a water surface line; In response to the existence of the water surface detection frame and the size of the water surface detection frame meeting the second size requirement, water level positioning is performed based on a preset reference line of the water surface detection frame; the second size requirement includes that the size of the water surface detection frame is less than a preset second size threshold; the preset reference line is the horizontal midpoint line of the water surface detection frame.
2. The water level positioning method according to claim 1, characterized in that, The method further includes: In response to the existence of the water surface detection frame and the size of the water surface detection frame not meeting the second size requirement, the water surface detection frame is updated to the current detection frame.
3. The water level positioning method according to claim 1, characterized in that, The process of dividing the current detection box into at least two sub-detection boxes based on the partitioning object in the current detection box includes: Based on at least one reference point of the current detection box, the current detection box is divided into at least two sub-detection boxes, wherein the reference point includes the length division point and / or the length midpoint of the current detection box.
4. The water level positioning method according to claim 1, characterized in that, The step of dividing the current detection box into at least two sub-detection boxes based on the partitioning object in the current detection box also includes: Based on at least one reference line of the current detection box, the current detection box is divided into at least two sub-detection boxes, wherein the reference line includes a horizontal midpoint line and / or a horizontal bisector line.
5. The water level positioning method according to claim 1, characterized in that, Determining whether a water surface detection frame exists in the at least two sub-detection frames includes: Based on the trained water surface classification model, the confidence level of the image within each of the at least two sub-detection boxes belonging to the water body region is obtained; The sub-detection frames whose water confidence levels meet the preset confidence range are defined as water surface detection frames containing the water surface line.
6. The water level positioning method according to claim 5, characterized in that, The method further includes: Establish a training dataset; wherein the training dataset includes a water body dataset and a non-water body dataset; The preset water surface classification model is trained based on the training dataset to obtain the trained water surface classification model.
7. The water level positioning method according to any one of claims 1 to 6, characterized in that, The current detection box is an initial detection box. Before dividing the current detection box into at least two sub-detection boxes based on the dividing object in the current detection box in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement, the method further includes: The image to be detected is input into the trained detection model to obtain an object detection box containing the target object. The object detection box is expanded in length according to the size of the image to be detected to obtain the initial detection box.
8. A water level positioning device, characterized in that, include: The module consists of a binary search module, a determination module, and a location module; among which: The binary segmentation module is used to divide the current detection box into at least two sub-detection boxes based on the division objects in the current detection box in response to the current detection box of the target object in the image to be detected meeting a preset first size requirement; the target object includes a tool for measuring water level; the first size requirement includes the size of the current detection box being greater than a preset first size threshold. The determining module is used to determine whether there is a water surface detection frame in the at least two sub-detection frames, wherein the water surface detection frame is a sub-detection frame that includes a water surface line; The positioning module is configured to perform water level positioning based on a preset reference line of the water surface detection frame in response to the existence of the water surface detection frame and the size of the water surface detection frame meeting a second size requirement; the second size requirement includes the size of the water surface detection frame being less than a preset second size threshold; the preset reference line is the horizontal midpoint line of the water surface detection frame.
9. A water level positioning system, characterized in that, include: An image acquisition device and a server device; wherein the image acquisition device is connected to the server device; The image acquisition device is used to acquire an image to be detected containing the target object, and to transmit the image to be detected to the server device; The server device is used to perform the water level positioning method according to any one of claims 1 to 7 on the image to be detected.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the water level positioning method according to any one of claims 1 to 7.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the water level positioning method according to any one of claims 1 to 7.
Citation Information
Patent Citations
An intelligent water gauge recognition method
CN109145830A
Water level acquisition method and device based on image recognition and electronic equipment
CN114543930A