Rainwater pump station forebay water level auxiliary correction method and system based on improved YOLOv8

By improving the YOLOv8 algorithm, combining the convolutional attention module and Focal-EIoU loss, the water level in the forebay of the rainwater pumping station is monitored in real time, solving the problem that traditional water level meters are easily affected by the environment, and realizing high-precision automatic water level correction and intelligent management.

CN120707804APending Publication Date: 2025-09-26ZHEJIANG UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510745670.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

The existing water level monitoring equipment in the forebay of rainwater pumping stations is easily affected by the environment, resulting in low measurement accuracy. In addition, it lacks real-time and continuous automatic correction methods, which may cause misoperation of rainwater pumps and affect the safety of urban drainage systems.

Method used

An improved YOLOv8 algorithm, combined with the convolutional attention module (CBAM) and Focal-EIoU loss, is used to monitor the water level in real time through image processing technology, calculate the unsubmerged length of the ruler, and realize non-contact measurement and automatic correction of the water level.

Benefits of technology

It improves the accuracy of water level monitoring, prevents misoperation, enhances the intelligent management level of rainwater pumping stations, and realizes real-time, continuous water level monitoring and automatic correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120707804A_ABST
    Figure CN120707804A_ABST
Patent Text Reader

Abstract

The invention discloses a rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8. The method comprises the steps that an internal image and a scale image of a rainwater pump station forebay are collected; in a head structure of the YOLOv8 model, a convolution attention module is added to a C2f module, loss of the YOLOv8 model is replaced, and an improved YOLOv8 model is obtained and trained; segmenting a scale area by using the training model, and calculating the length of an unsubmerged scale by identifying the alternating times of black and white color blocks; combining the forebay depth, the unsubmerged scale length and the distance from the top end to the upper edge of the scale to establish a water level calculation model; and finally, by comparing the real-time water level data with the reading of the water level meter, evaluating the measurement deviation and triggering calibration early warning. The problem of measurement misalignment caused by the fact that a traditional water level meter is prone to being affected by the environment is solved, pump set misoperation caused by water level misjudgment is effectively prevented, reliable guarantee is provided for safe operation of an urban drainage system, and real-time and continuous water level monitoring and automatic correction are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of rainwater pump station optimization and control, and in particular relates to a rainwater pump station forebay water level auxiliary correction method and system based on improved YOLOv8. Background Art

[0002] Accurately monitoring the water level in the forebay is crucial for the operation and management of stormwater pumping stations. This precise monitoring of the forebay water level is directly related to the proper start and stop of stormwater pumps, and is crucial for the proper operation of urban drainage systems and flood control and drainage efforts.

[0003] Water level is a fundamental hydrological element of rivers, lakes, and reservoirs. Continuous and reliable water level monitoring is crucial for water resource management and flood and drought prevention. Traditional water level monitoring relies primarily on various water level gauges, such as ultrasonic, pressure, and float-type gauges. Ultrasonic water level gauges use the transit time and speed of sound waves between the probe and the water surface to calculate distance and convert it into water level. However, since the speed of sound waves in air is significantly affected by ambient temperature, and temperature distribution is often difficult to accurately determine, measurement accuracy is limited over a wide range. Pressure-type water level gauges convert water level values ​​by sensing the pressure generated at varying water depths. However, these sensors must be placed deep within the water body, and measurement accuracy is susceptible to impurities and sediment content. Float-type water level gauges use a weight to drive a float to sense the rise and fall of the water level and employ a photoelectric encoder to quantify the water level. While they offer the advantages of high accuracy and reliability, they typically require a logging room, which is costly. Furthermore, their measurement accuracy can gradually degrade over time and with environmental changes, leading to inaccuracies. The manual method of regularly measuring the actual water depth and making corrections is not only cumbersome and time-consuming, but also difficult to achieve real-time continuous monitoring.

[0004] In actual operation, if the inaccuracy of the water level meter is not discovered and corrected in time, it may lead to misoperation of the rainwater pump, such as starting the water pump when the water level has not actually reached the pump start level, resulting in energy waste; or failing to start multiple water pumps in time when the water level has exceeded the warning level, causing the forebay to overflow, affecting the normal operation of the urban drainage system, and may even cause serious problems such as urban waterlogging.

[0005] Currently, many important water-level observation points in China are equipped with video surveillance systems and standard water gauges, providing favorable conditions for video-based water-level measurement. The image-based method uses an image sensor instead of the human eye to capture the water gauge image. Using image processing techniques, the corresponding reading of the water level line is detected, automatically acquiring water-level information.

[0006] For example, Chinese patent document CN102494733A discloses a water level monitoring system and method based on image processing, which includes a water level scale, a water level image processing module, a wireless communication module and a central management server module. The water level is marked by using the water level scale and the water level image marked by the water level scale is collected by a camera. The water level image processing module then automatically locates, tilt-corrects and identifies the water level scale in the water level image to obtain water level data, and sends the water level data to the wireless communication module via a wireless communication network. The wireless communication module then sends the received water level data to the central management server module. The central management server module saves the received water level data in a computer database, draws the current water level curve in real time, and issues an alarm message when the preset water level is exceeded, thereby realizing automatic monitoring of the water level.

[0007] Chinese patent document CN108921165A discloses a water level recognition method based on water gauge images, including: binarization processing; morphological analysis; image clipping; slope measurement; position correction; precise positioning; image cutting; neural recognition; and water level determination steps, which realizes non-contact automatic recognition of on-site water levels and provides accurate recognition results.

[0008] Therefore, to improve the accuracy and reliability of water level monitoring in the forebay of stormwater pumping stations, reduce the burden of manual correction, and achieve real-time, continuous water level monitoring and automatic correction, it is necessary to develop new auxiliary correction methods and systems. With the rapid development of improved YOLOv8 technology and deep learning algorithms, the use of image recognition technology for water level monitoring has become a promising solution. The YOLOv8 algorithm excels in object detection. By improving it and applying it to the monitoring and correction of water levels in the forebay of stormwater pumping stations, it is expected to achieve more efficient and accurate auxiliary water level correction, providing strong support for the intelligent management of stormwater pumping stations. Summary of the Invention

[0009] The present invention provides a rainwater pump station forebay water level auxiliary correction method and system based on improved YOLOv8, which can obtain long-term data of the rainwater pump station forebay water level in real time and accurately, evaluate the current water level meter inaccuracy, and remind operation and maintenance personnel to calibrate the water level meter in time to prevent misoperation of the rainwater pump due to forebay water level measurement deviation.

[0010] An auxiliary correction method for the water level of a rainwater pump station forebay based on improved YOLOv8 includes the following steps: (1) Determine the depth of the forebay of the rainwater pumping station. Insert a ruler into the forebay of the rainwater pumping station and measure the distance from the top of the ruler to the upper edge of the forebay of the rainwater pumping station. (2) Install a high-definition camera to collect images of the interior of the rainwater pump station forebay. The images of the interior of the rainwater pump station forebay include scale images. The scale range is marked according to the scale images, and a YOLOv8 model dataset is established. (3) In the head structure of the YOLOv8 model, the convolutional attention module is added to the C2f module and the loss of the YOLOv8 model is replaced to obtain the improved YOLOv8 model; (4) After training the improved YOLOv8 model, the internal image of the rainwater pumping station forebay is used as input to segment the scale image of the internal image of the rainwater pumping station forebay, and the number of alternations between black and white blocks in the scale image is calculated; (5) Calculate the length of the unsubmerged scale based on the number of alternating black and white blocks. Calculate the water level in the forebay of the rainwater pumping station based on the depth of the forebay of the rainwater pumping station, the length of the unsubmerged scale, and the distance from the top of the scale to the upper edge of the forebay of the rainwater pumping station. (6) By monitoring the water level feedback of the forebay of the rainwater pumping station in real time, the current inaccuracy of the water level meter is assessed and the operation and maintenance personnel are reminded to calibrate the water level meter in a timely manner.

[0011] In one embodiment, in step (1), the ruler has black and white scales.

[0012] In one embodiment, in step (3), the convolutional attention module includes: a channel attention submodule and a spatial attention submodule; The channel attention submodule is used to take the scale range as input, use maximum pooling and average pooling operations to capture the maximum activation value and average response in the scale range respectively, concatenate the maximum activation value and average response and pass them to the multi-layer perceptron network, and output a channel attention vector. Each element of the channel attention vector corresponds to a channel in the scale range, which is used to represent the importance weight of the channel. The calculation formula is as follows: , in, Represents the scale range feature map, is the channel attention map of the scale range, Represents the sigmoid operation, is the average pooling operation, is the maximum pooling operation, is the weight parameter of the first layer of the multilayer perceptron, is the weight parameter of the second layer of the multilayer perceptron, is the channel average pooling feature of the scale range, is the channel maximum pooling feature of the scale range; The spatial attention submodule is used to obtain a spatial attention matrix from the input scale range through stacking and convolution operations, and then normalize the spatial attention matrix and multiply it by the input feature map to emphasize more important areas in the scale range. The calculation formula is as follows: , in, Represents the scale range feature map, is the spatial attention map of the scale range, represents the convolution kernel size, is the height of the convolution kernel, is the convolution kernel width, is the average pooling operation, is the maximum pooling operation, is the spatial average pooling feature of the scale range, is the spatial maximum pooling feature of the scale range.

[0013] In one embodiment, in step (3), replacing the loss function of the YOLOv8 model includes: replacing the original CIoU loss of the YOLOv8 model with the Focal-EIoU loss, where the Focal-EIoU loss includes the EIoU loss and the Focal loss.

[0014] In one embodiment, the EIoU loss adds a center point distance penalty and an aspect ratio penalty to the standard IoU loss, and calculates the penalty terms in exponential form. The calculation formula is as follows: , in, The IoU loss represents the degree of overlap between the predicted box and the real box. is the distance penalty term, is the aspect ratio penalty term, Represents the center point of the prediction box The center point of the real frame The square of the Euclidean distance between and The width and height of the minimum bounding box covering the predicted box and the real box, is the prediction box width With the actual frame width The square of the difference, is the predicted box height With the actual frame width The square of the difference.

[0015] In one embodiment, the Focal-EIoU loss is based on the EIoU loss by weighting the cross entropy loss value to adjust the loss contribution. The calculation formula is as follows: , in, is the Focal-EIoU loss, is the focusing coefficient, which is used to adjust the loss weights of easy samples and difficult samples; easy samples include the background or large targets in the scale range image, and difficult samples include small targets or occluded targets in the scale range image.

[0016] In one embodiment, the specific process of step (4) is as follows: Based on the segmented scale image of the interior image of the rainwater pump station forebay, the non-transparent area, i.e., the outline of the scale image, is obtained from the alpha channel. This is then binarized and noise removed to obtain a denoised image. Based on the denoised image, the top and bottom points of the ruler image's outline are determined, and a straight line is drawn. The pixel values ​​of the straight line are extracted to establish a pixel sampling line. Based on the changes in the values ​​of adjacent pixels in the pixel sampling line, the number of alternations between black and white blocks in the ruler image is calculated.

[0017] In one embodiment, when binarization is performed, the variance of the foreground and background of the ruler image is maximized, and a threshold that maximizes the difference between the two categories is found as the binarization threshold. The variance of the foreground and background of the ruler image is calculated as follows: , Where, is the between-class variance, is the average gray value of the background, is the average gray value of the foreground, is the probability that the background pixel occupies the image, is the probability of the foreground pixel occupying the image, the gray value of the background category , the grayscale value of the foreground category , is the binarization threshold.

[0018] In one embodiment, in step (5), calculating the length of the unsubmerged ruler based on the number of alternations of the black and white blocks includes: determining the length of each scale in the ruler, and multiplying the number of alternations of the black and white blocks by the length of each scale to obtain the length of the unsubmerged ruler.

[0019] On the other hand, the present invention also provides a rainwater pumping station forebay water level auxiliary correction system based on improved YOLOv8, the rainwater pumping station forebay water level auxiliary correction system uses the rainwater pumping station forebay water level auxiliary correction method, including: The data acquisition module is used to determine the depth of the stormwater pump station forebay. A ruler is inserted into the forebay to measure the distance from the top of the ruler to the upper edge of the forebay. A high-definition camera is installed to capture images of the interior of the forebay. The images of the interior of the forebay include the ruler images. The ruler range is annotated based on the ruler images to create a YOLOv8 model dataset. The YOLOv8 model pre-training module is used to add the convolutional attention module to the C2f module in the YOLOv8 model head structure and replace the YOLOv8 model loss to obtain an improved YOLOv8 model, and then train the improved YOLOv8 model; The data processing module is used to input the internal image of the stormwater pumping station forebay into the trained improved YOLOv8 model, segment the internal image of the stormwater pumping station forebay into a scale image, and calculate the number of alternations between black and white blocks in the scale image; calculate the length of the unsubmerged scale based on the number of alternations between black and white blocks; and then calculate the water level in the stormwater pumping station forebay based on the depth of the stormwater pumping station forebay, the length of the unsubmerged scale, and the distance from the top of the scale to the upper edge of the stormwater pumping station forebay; The water level meter inaccuracy alarm module is used to evaluate the current water level meter inaccuracy by real-time monitoring of the water level feedback from the stormwater pump station forebay, and to remind operation and maintenance personnel to calibrate the water level meter in a timely manner.

[0020] Compared with the prior art, the present invention has the following beneficial effects: (1) By introducing the CBAM attention mechanism and Focal-EIoU loss to improve the YOLOv8 model, the innovative integration of computer vision and deep learning technology solves the problem of measurement inaccuracy caused by the traditional water level meter being easily affected by the environment, significantly improves the water level monitoring accuracy, effectively prevents the malfunction of the pump group caused by water level misjudgment, and provides reliable protection for the safe operation of the urban drainage system; (2) According to the characteristics of the unsubmerged scale image inside the forebay of the rainwater pumping station, the number of alternations of black and white blocks is calculated by comparing the changes in adjacent pixel values, thereby calculating the length of the scale that is not submerged. Since the position of the scale in the forebay is fixed, the water level of the forebay of the rainwater pumping station is indirectly calculated by subtracting the sum of the distance from the top of the scale to the upper edge of the forebay from the depth of the forebay and the length of the scale. This method has the technical advantages of non-contact measurement, strong anti-interference ability, and remote monitoring, which significantly improves the intelligent level of operation and maintenance of the rainwater pumping station.

[0021] (3) It can obtain long-term data of the water level in the forebay of the rainwater pumping station in real time and accurately, evaluate the current inaccuracy of the water level meter, and remind the operation and maintenance personnel to calibrate the water level meter in time to prevent the rainwater pump from being misoperated due to the deviation of the forebay water level measurement, thus realizing real-time and continuous water level monitoring and automatic correction. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a flowchart of a method for auxiliary correction of water level in the forebay of a rainwater pumping station based on improved YOLOv8 provided in an embodiment of the present invention.

[0023] Figure 2 A logical schematic diagram of image segmentation based on an improved YOLOv8 model for calculating the water level in the forebay of a rainwater pumping station provided in an embodiment of the present invention.

[0024] Figure 3 This is a structural schematic diagram of a rainwater pump station forebay water level auxiliary correction system based on improved YOLOv8 provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be described in further detail below with reference to the accompanying drawings and examples. It should be noted that the following examples are intended to facilitate understanding of the present invention and do not have any limiting effect on the present invention.

[0026] Aiming at the current situation that the water level correction of the forebay of rainwater pumping station mostly relies on manual correction, which has low accuracy and reliability and cannot realize real-time and continuous water level monitoring and automatic correction, this paper proposes an auxiliary correction method for the water level of the forebay of rainwater pumping station based on improved YOLOv8. Figure 1 The specific implementation steps are as follows: (1) Determine the depth of the forebay of the rainwater pumping station. Insert a ruler into the forebay of the rainwater pumping station and measure the distance from the top of the ruler to the upper edge of the forebay of the rainwater pumping station.

[0027] (2) Install a high-definition camera to collect images of the interior of the forebay of the rainwater pumping station. The images of the interior of the forebay of the rainwater pumping station include a scale image. The scale range is marked according to the scale image, and a YOLOv8 model dataset is established.

[0028] In the embodiment, when collecting images of the interior of the forebay of the rainwater pumping station, it is necessary to include images under different lighting conditions to increase the diversity of the training data, which is conducive to improving the robustness of the segmentation model. Figure 2 As shown in the figure, the internal image of the forebay of the rainwater pumping station contains a scale image and annotates the scale range. The scale range is used as the dataset and divided into a training set and a validation set for subsequent improvement or training of the YOLOv8 model.

[0029] (3) In the head structure of the YOLOv8 model, the convolutional attention module is added to the C2f module and the loss of the YOLOv8 model is replaced to obtain the improved YOLOv8 model.

[0030] Specifically, in the embodiment, taking the YOLOv8n-seg model as an example, in the head structure of the YOLOv8n-seg model, after the convolutional attention module (CBAM attention mechanism) is added to the C2f structure, the CBAM module structure includes two parallel attention sub-modules: a channel attention sub-module and a spatial attention sub-module, which assign importance weights to the input feature maps from the channel dimension and the spatial dimension respectively.

[0031] The channel attention submodule uses max pooling and average pooling operations to capture the maximum activation value and average response in the scale-range feature map, respectively. These two pooling outputs are then concatenated and passed to a multilayer perceptron (MLP) network, which consists of two fully connected layers. The output is a channel attention vector, where each element of the vector corresponds to a channel in the scale-range feature map and represents the importance weight of that channel. By multiplying the input scale-range feature map by the channel attention vector, the model can selectively strengthen its attention to important channels in the scale-range feature map. The calculation formula for the entire process is as follows: , in, Represents the scale range feature map, is the channel attention map of the scale range, Represents the sigmoid operation, is the average pooling operation, is the maximum pooling operation, is the weight parameter of the first layer of the multilayer perceptron, is the weight parameter of the second layer of the multilayer perceptron, is the channel average pooling feature of the scale range, is the channel maximum pooling feature of the scale range.

[0032] The spatial attention submodule works similarly to the channel attention submodule, but with weights assigned to the spatial dimension. It first obtains a spatial attention matrix from the input scale-scale feature map through stacking and convolution operations. This matrix is ​​then normalized and multiplied by the input scale-scale feature map to emphasize more important regions in the scale-scale feature map. The calculation formula is as follows: , in, Represents the scale range feature map, is the spatial attention map of the scale range, represents the convolution kernel size, is the height of the convolution kernel, is the convolution kernel width, is the average pooling operation, is the maximum pooling operation, is the spatial average pooling feature of the scale range, is the spatial maximum pooling feature within the scale range. In this embodiment, the convolution kernel size is 7×7.

[0033] By cascading channel and spatial attention, the CBAM module can simultaneously enhance the attention to important channels and important areas, improving the expressiveness of the YOLOv8n-seg model.

[0034] Next, the original CIoU loss of the YOLOv8n-seg model is replaced with the Focal-EIoU loss. The Focal-EIoU loss organically combines the EIoU loss and the Focal loss to give full play to the advantages of both, achieving a better balance between accurately predicting bounding boxes and paying attention to difficult samples, thereby improving the robustness of the model in complex scenarios.

[0035] Specifically, the EIoU loss adds a center point distance penalty and an aspect ratio penalty to the standard IoU loss, thereby better constraining the geometric consistency between the predicted box and the true box. The EIoU loss uses an efficient exponential form to calculate the penalty term, reducing the computational complexity. It is defined as follows: , in, The IoU loss represents the degree of overlap between the predicted box and the real box. is the distance penalty term, is the aspect ratio penalty term, Represents the center point of the prediction box The center point of the real frame The square of the Euclidean distance between and The width and height of the minimum bounding box covering the predicted box and the real box, is the prediction box width With the actual frame width The square of the difference, is the predicted box height With the actual frame width The square of the difference.

[0036] Focal-EIoU loss is based on EIoU loss. It adjusts the loss contribution by weighting the cross entropy loss value, reducing the contribution of a large number of simple samples to the total loss, while increasing the impact of difficult samples, making the model pay more attention to difficult situations such as occluded targets. The calculation formula of Focal-EIoU loss is as follows: , in, is the Focal-EIoU loss, is the focusing coefficient, which is used to adjust the loss weights of easy samples and difficult samples; easy samples include the background or large targets in the scale range image, and difficult samples include small targets or occluded targets in the scale range image.

[0037] (4) After training the improved YOLOv8 model, the internal image of the rainwater pumping station forebay is used as input to segment the scale image of the internal image of the rainwater pumping station forebay, and the number of alternations between black and white blocks in the scale image is calculated.

[0038] In the embodiment, Figure 2 As shown, based on the segmented ruler image, the non-transparent area is obtained from the Alpha channel, and the outline of the non-transparent area, that is, the ruler image, is drawn.

[0039] Next, determine the top and bottom points of the contour, then take the average of the x-coordinates of these points to determine their centers, and use these center points as the starting and ending points of the subsequent straight line to draw the straight line.

[0040] The contour image of the ruler image is then converted into a grayscale image and binarized for subsequent pixel counting operations. Due to the different lighting conditions of the collected images of the interior of the forebay of the rainwater pumping station, there may be overexposure or underexposure in local areas, resulting in a decrease in the contrast and clarity of the segmented ruler image. Therefore, when binarizing the segmented ruler image, it is crucial to select an appropriate threshold. In the embodiment, the maximum inter-class variance method (Otsu algorithm) is used to adaptively determine the binarization threshold. The basic idea is to automatically select the threshold by maximizing the variance of the foreground and background of the ruler image and finding the threshold that maximizes the difference between the two classes. That is, the grayscale corresponding to the maximum inter-class variance is the binarization threshold, and the expression is as follows: , Where, is the between-class variance, is the average gray value of the background, is the average gray value of the foreground, is the probability that the background pixel occupies the image, is the probability of the foreground pixel occupying the image, the gray value of the background category , the grayscale value of the foreground category , is the binarization threshold.

[0041] Based on the denoised image, the pixel values ​​of the straight lines are extracted to establish pixel sampling lines. Based on the changes in the values ​​of adjacent pixels along the pixel sampling lines, the number of alternating black and white blocks in the scale image is calculated. A median filter is applied to remove noise from the binary image to obtain the denoised image.

[0042] (5) Calculate the length of the unsubmerged scale based on the number of alternations between the black and white blocks. Calculate the water level in the forebay of the rainwater pumping station based on the depth of the forebay of the rainwater pumping station, the length of the unsubmerged scale, and the distance from the top of the scale to the upper edge of the forebay of the rainwater pumping station.

[0043] In this embodiment, the length of each scale mark of the ruler is 5 cm, and the number of alternations of black and white blocks multiplied by 5 cm is the length of the ruler that is not submerged.

[0044] (6) By monitoring the water level in the forebay of the rainwater pumping station in real time, the current water level meter inaccuracy is assessed, and the operation and maintenance personnel are reminded to calibrate the water level meter in a timely manner to prevent the rainwater pump from being misoperated due to the deviation in the forebay water level measurement.

[0045] like Figure 3 As shown, the embodiment further provides a rainwater pump station forebay water level auxiliary correction system based on improved YOLOv8, including: The data acquisition module is used to determine the depth of the stormwater pump station forebay. A ruler is inserted into the forebay to measure the distance from the top of the ruler to the upper edge of the forebay. A high-definition camera is installed to capture images of the interior of the forebay. The images of the interior of the forebay include the ruler images. The ruler range is annotated based on the ruler images to create a YOLOv8 model dataset. The YOLOv8 model pre-training module is used to add the convolutional attention module to the C2f module in the YOLOv8 model head structure and replace the YOLOv8 model loss to obtain an improved YOLOv8 model, and then train the improved YOLOv8 model; The data processing module is used to input the internal image of the stormwater pumping station forebay into the trained improved YOLOv8 model, segment the internal image of the stormwater pumping station forebay into a scale image, and calculate the number of alternations between black and white blocks in the scale image; calculate the length of the unsubmerged scale based on the number of alternations between black and white blocks; and then calculate the water level in the stormwater pumping station forebay based on the depth of the stormwater pumping station forebay, the length of the unsubmerged scale, and the distance from the top of the scale to the upper edge of the stormwater pumping station forebay; The water level meter inaccuracy alarm module is used to evaluate the current water level meter inaccuracy by real-time monitoring of the water level feedback from the stormwater pump station forebay, and to remind operation and maintenance personnel to calibrate the water level meter in a timely manner.

[0046] The present invention improves the YOLOv8n-seg model by introducing the CBAM attention mechanism and Focal-EIoU loss. Based on the characteristics of the unsubmerged scale image inside the forebay of the rainwater pump station, the number of alternations of black and white blocks is calculated by comparing the changes in adjacent pixel values, thereby calculating the length of the scale where the scale is not submerged. Since the position of the scale in the forebay is fixed, the water level of the forebay of the rainwater pump station is indirectly calculated by subtracting the sum of the distance from the top of the scale to the upper edge of the forebay from the depth of the forebay and the length of the scale. The present invention can accurately obtain long-term data on the water level of the forebay of the rainwater pump station in real time, evaluate the current degree of inaccuracy of the water level meter, and remind operation and maintenance personnel to calibrate the water level meter in a timely manner to prevent misoperation of the rainwater pump due to deviation in the forebay water level measurement, thereby realizing real-time, continuous water level monitoring and automatic correction.

[0047] The embodiments described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8, characterized in that: The following steps are involved: (1) Determine the depth of the forebay of the rainwater pumping station. Insert a ruler into the forebay of the rainwater pumping station and measure the distance from the top of the ruler to the upper edge of the forebay of the rainwater pumping station. (2) Install a high-definition camera to collect images of the interior of the rainwater pump station forebay. The images of the interior of the rainwater pump station forebay include scale images. The scale range is marked according to the scale images, and a YOLOv8 model dataset is established. (3) In the head structure of the YOLOv8 model, the convolutional attention module is added to the C2f module and the loss of the YOLOv8 model is replaced to obtain the improved YOLOv8 model; (4) After training the improved YOLOv8 model, the internal image of the rainwater pumping station forebay is used as input to segment the scale image of the internal image of the rainwater pumping station forebay, and the number of alternations between black and white blocks in the scale image is calculated; (5) Calculate the length of the unsubmerged scale based on the number of alternating black and white blocks. Calculate the water level in the forebay of the rainwater pumping station based on the depth of the forebay of the rainwater pumping station, the length of the unsubmerged scale, and the distance from the top of the scale to the upper edge of the forebay of the rainwater pumping station. (6) By monitoring the water level feedback of the forebay of the rainwater pumping station in real time, the current inaccuracy of the water level meter is assessed and the operation and maintenance personnel are reminded to calibrate the water level meter in a timely manner.

2. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 1 is characterized in that: In step (1), the ruler has black and white scales.

3. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 1 is characterized in that: In step (3), the convolutional attention module includes: a channel attention submodule and a spatial attention submodule; The channel attention submodule is used to take the scale range as input, use maximum pooling and average pooling operations to capture the maximum activation value and average response in the scale range respectively, concatenate the maximum activation value and average response and pass them to the multi-layer perceptron network, and output a channel attention vector. Each element of the channel attention vector corresponds to a channel in the scale range, which is used to represent the importance weight of the channel. The calculation formula is as follows: , in, Represents the scale range feature map, is the channel attention map of the scale range, Represents the sigmoid operation, is the average pooling operation, is the maximum pooling operation, is the weight parameter of the first layer of the multilayer perceptron, is the weight parameter of the second layer of the multilayer perceptron, is the channel average pooling feature of the scale range, is the channel maximum pooling feature of the scale range; The spatial attention submodule is used to obtain a spatial attention matrix from the input scale range through stacking and convolution operations, and then normalize the spatial attention matrix and multiply it by the input feature map to emphasize more important areas in the scale range. The calculation formula is as follows: , in, Represents the scale range feature map, is the spatial attention map of the scale range, represents the convolution kernel size, is the height of the convolution kernel, is the convolution kernel width, is the average pooling operation, is the maximum pooling operation, is the spatial average pooling feature of the scale range, is the spatial maximum pooling feature of the scale range.

4. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 1 is characterized in that: In step (3), replacing the loss function of the YOLOv8 model includes: replacing the original CIoU loss of the YOLOv8 model with the Focal-EIoU loss, where the Focal-EIoU loss includes the EIoU loss and the Focal loss.

5. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 4 is characterized in that: The EIoU loss adds a center point distance penalty and an aspect ratio penalty to the standard IoU loss, and uses an exponential form to calculate the penalty. The calculation formula is as follows: , in, The IoU loss represents the degree of overlap between the predicted box and the real box. is the distance penalty term, is the aspect ratio penalty term, Represents the center point of the prediction box The center point of the real frame The square of the Euclidean distance between and The width and height of the minimum bounding box covering the predicted box and the real box, is the prediction box width With the actual frame width The square of the difference, is the predicted box height With the actual frame width The square of the difference.

6. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 5 is characterized in that: Focal-EIoU loss is based on EIoU loss and adjusts the loss contribution by weighting the cross entropy loss value. The calculation formula is as follows: , in, is the Focal-EIoU loss, is the focusing coefficient, which is used to adjust the loss weights of easy samples and difficult samples; easy samples include the background or large targets in the scale range image, and difficult samples include small targets or occluded targets in the scale range image.

7. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 1 is characterized in that: The specific process of step (4) is: Based on the segmented scale image of the interior of the rainwater pump station forebay, the non-transparent area, i.e., the outline of the scale image, is obtained from the alpha channel. This is then binarized and noise removed to obtain a denoised image. Based on the denoised image, the top and bottom points of the ruler image's outline are determined, and a straight line is drawn. The pixel values ​​of the straight line are extracted to establish a pixel sampling line. Based on the changes in the values ​​of adjacent pixels in the pixel sampling line, the number of alternations between black and white blocks in the ruler image is calculated.

8. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 7 is characterized in that: When binarization is performed, the threshold that maximizes the difference between the foreground and background of the ruler image is found by maximizing the variance of the two categories, which is the binarization threshold. The calculation formula for the variance of the foreground and background of the ruler image is as follows: , Where, is the between-class variance, is the average gray value of the background, is the average gray value of the foreground, is the probability that the background pixel occupies the image, is the probability of the foreground pixel occupying the image, the gray value of the background category , the grayscale value of the foreground category , is the binarization threshold.

9. The rainwater pump station forebay water level auxiliary correction method based on improved YOLOv8 according to claim 7 is characterized in that: In step (5), calculating the length of the unsubmerged ruler based on the number of alternations of the black and white blocks includes: determining the length of each scale in the ruler, and multiplying the number of alternations of the black and white blocks by the length of each scale to obtain the length of the unsubmerged ruler.

10. A rainwater pump station forebay water level auxiliary correction system based on improved YOLOv8, characterized in that: The rainwater pump station forebay water level auxiliary correction system uses the rainwater pump station forebay water level auxiliary correction method according to any one of claims 1 to 9, comprising: The data acquisition module is used to determine the depth of the stormwater pump station forebay. A ruler is inserted into the forebay to measure the distance from the top of the ruler to the upper edge of the forebay. A high-definition camera is installed to capture images of the interior of the forebay. The images of the interior of the forebay include the ruler images. The ruler range is annotated based on the ruler images to create a YOLOv8 model dataset. The YOLOv8 model pre-training module is used to add the convolutional attention module to the C2f module in the YOLOv8 model head structure and replace the YOLOv8 model loss to obtain an improved YOLOv8 model, and then train the improved YOLOv8 model; The data processing module is used to input the internal image of the stormwater pumping station forebay into the trained improved YOLOv8 model, segment the internal image of the stormwater pumping station forebay into a scale image, and calculate the number of alternations between black and white blocks in the scale image; calculate the length of the unsubmerged scale based on the number of alternations between black and white blocks; and then calculate the water level in the stormwater pumping station forebay based on the depth of the stormwater pumping station forebay, the length of the unsubmerged scale, and the distance from the top of the scale to the upper edge of the stormwater pumping station forebay; The water level meter inaccuracy alarm module is used to evaluate the current water level meter inaccuracy by real-time monitoring of the water level feedback from the stormwater pump station forebay, and to remind operation and maintenance personnel to calibrate the water level meter in a timely manner.

Citation Information

Patent Citations

  • Water level monitoring system based on image processing and method

    CN102494733A

  • Water level recognition method based on water gauge images

    CN108921165A

  • Method and equipment for identifying a water level

    CN111488846A

  • Novel strip-shaped water level gauge for measuring channel water level based on mobile phone scanning

    CN211477291U