A water level early warning method and a water level early warning system
By improving the water level segmentation model and edge computing equipment, and combining multi-branch networks and risk index calculation, the environmental interference problem of traditional water level monitoring has been solved, and high-precision and intelligent water level early warning and emergency response have been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA INST OF WATER RESOURCES & HYDROPOWER RES
- Filing Date
- 2026-05-28
- Publication Date
- 2026-06-30
AI Technical Summary
Traditional water level monitoring methods rely on manual observation or a single sensor, which are easily affected by weather and environmental interference, resulting in insufficient timeliness and accuracy of monitoring, making it difficult to meet the high precision and intelligent requirements of modern water conservancy monitoring.
An improved water level segmentation model is adopted in conjunction with edge computing devices. Real-time water level segmentation values are extracted through a multi-branch network architecture, and risk indices are calculated based on water level sensor data for early warning, thereby achieving multi-source data fusion and hierarchical early warning.
It improves the accuracy and stability of water level monitoring, reduces false alarm and missed alarm rates, enables more precise capture of water level change trends, achieves efficient emergency response and resource conservation, and enhances the effectiveness of water conservancy monitoring and emergency management.
Smart Images

Figure CN122313401A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and more specifically, to a water level early warning method and a water level early warning system. Background Technology
[0002] In the field of water conservancy monitoring, water level monitoring is a crucial link, and the accuracy of its data directly affects key decisions such as flood warning, water resource allocation, and urban flood control and drainage. Traditional water level monitoring mainly relies on manual observation or data collection using a single sensor.
[0003] However, the above-mentioned methods have significant drawbacks: manual observation is limited in timeliness and accuracy, and is susceptible to weather and human error. Furthermore, data from a single sensor is ill-suited to handle complex environmental interference, such as changes in lighting and water ripples, resulting in low monitoring accuracy. These shortcomings severely impact the timeliness and reliability of water level monitoring, making it difficult to meet the high-precision and intelligent requirements of modern water conservancy monitoring. Summary of the Invention
[0004] The purpose of this invention is to provide a water level early warning method and a water level early warning system to solve the above-mentioned technical problems.
[0005] In a first aspect, embodiments of the present invention provide a water level early warning method applied to an edge computing device. The method includes: acquiring a real-time image of a monitored water area; extracting real-time water level segmentation values from the real-time image using a pre-trained water level segmentation model; acquiring a real-time water level scalar value of the monitored water area; wherein the real-time water level scalar value is collected by at least one water level sensor deployed in the monitored water area; determining a risk index of the monitored water area based on the real-time water level segmentation value, historical water level segmentation values, the real-time water level scalar value, and the historical water level scalar value; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area; and issuing a water level early warning based on the risk index.
[0006] Furthermore, the pre-trained water level segmentation model includes: an input layer, a backbone network, an integral branch, a differential branch, a boundary-guided semantic enhancement module, and an output layer; the input ends of the backbone network and the differential branch are respectively connected to the input layer; the output end of the backbone network is connected to the input end of the integral branch; the output ends of the integral branch and the differential branch are respectively connected to the input end of the boundary-guided semantic enhancement module; the output end of the boundary-guided semantic enhancement module is connected to the output layer.
[0007] The step of extracting real-time water level segmentation values from the real-time image using a pre-trained water level segmentation model includes: inputting the real-time image into the input layer of the pre-trained water level segmentation model; inputting the real-time image from the input layer into the backbone network to obtain a multi-scale feature map; inputting the multi-scale feature map output by the backbone network into the integral branch to obtain an initial segmentation result; inputting the real-time image from the input layer into the boundary response main path of the differential branch to obtain a boundary heatmap; inputting the real-time image from the input layer into the detail-preserving auxiliary path of the differential branch to obtain a detail-enhancing feature map; and inputting the initial segmentation result, the boundary heatmap, and the detail-enhancing feature map into the boundary-guided semantic enhancement module to obtain the real-time water level segmentation value.
[0008] Furthermore, the backbone network includes a first lightweight residual module, a second lightweight residual module, and a lightweight pixel enhancement module, wherein the lightweight pixel enhancement module is disposed at the residual connection end of the first lightweight residual module and the second lightweight residual module;
[0009] The step of inputting the real-time image of the input layer into the backbone network to obtain multi-scale feature maps includes: inputting the real-time image of the input layer into the first lightweight residual module of the backbone network to obtain a first residual feature map; inputting the first residual feature map into the second lightweight residual module to obtain a second residual feature map; and inputting the second residual feature map into the lightweight pixel enhancement module to obtain multi-scale feature maps.
[0010] Furthermore, the integral branch includes a first downsampling module, a second downsampling module, a three-level parallel pooling module, and a segmentation head connected in sequence;
[0011] The step of inputting the multi-scale feature map output by the backbone network into the integral branch to obtain an initial segmentation result includes: inputting the multi-scale feature map output by the backbone network into the first downsampling module in the integral branch to obtain a first downsampling feature map; inputting the first downsampling feature map into the second downsampling module to obtain a second downsampling feature map; inputting the second downsampling feature map into the three-level parallel pooling module to obtain a multi-scale context fusion feature map; and inputting the multi-scale context fusion feature map into the segmentation head to obtain an initial segmentation result.
[0012] Furthermore, the boundary response main path in the differential branch includes a first depthwise separable convolution module, a pointwise convolution module, and an activation module connected in sequence; the detail-preserving auxiliary path includes a second depthwise separable convolution module, a coordinate attention module, and a bilinear upsampling module connected in sequence.
[0013] The step of inputting the real-time image of the input layer into the boundary response main path of the differential branch to obtain a boundary heatmap includes: inputting the real-time image of the input layer into the first depthwise separable convolution module of the boundary response main path to obtain a first spatial detail feature map; inputting the first spatial detail feature map into the pointwise convolution module to obtain a single-channel boundary feature map; and inputting the single-channel boundary feature map into the activation module to obtain a boundary heatmap.
[0014] The step of inputting the real-time image of the input layer into the detail-preserving auxiliary path of the differential branch to obtain a detail-enhanced feature map includes: inputting the real-time image of the input layer into the second depthwise separable convolution module of the detail-preserving auxiliary path to obtain a second spatial detail feature map; inputting the second spatial detail feature map into the coordinate attention module to obtain a detail feature map after spatial position weighting; and inputting the detail feature map into the bilinear upsampling module to obtain a detail-enhanced feature map.
[0015] Further, determining the risk index of the monitored water area based on the real-time water level segmentation value, historical water level segmentation value, real-time water level scalar value, and historical water level scalar value includes: obtaining the probability density distribution of each water level extreme value of the monitored water area based on the historical water level segmentation value; determining the water level value corresponding to a preset probability density in the probability density distribution to obtain a dynamic threshold; determining the degree of deviation between the real-time water level segmentation value and the mean of the historical water level segmentation value, and the severity index of the deviation relative to the dynamic threshold; determining the mean sensor data change rate of each water level sensor based on the data difference and time difference between the real-time water level scalar value and the historical water level scalar value within a preset time period; determining the average of the mean sensor data change rates of all water level sensors; and determining the risk index of the monitored water area based on the severity index and the average of the mean sensor data change rates.
[0016] Further, determining the risk index of the monitored water area based on the average of the deviation severity index and the average of the sensor data change rates includes: obtaining a first adaptive weight for the deviation severity index and a second adaptive weight for the average of the sensor data change rates based on the severity of water level changes in the monitored water area; wherein, the first adaptive weight is inversely proportional to the severity of water level changes in the monitored water area; and the second adaptive weight is directly proportional to the severity of water level changes in the monitored water area; and the risk index of the monitored water area is obtained by weighted summation of the average of the deviation severity index and the average of the sensor data change rates based on the first adaptive weight and the second adaptive weight.
[0017] Further, the water level warning based on the risk index includes: if the real-time water level segment value is greater than the average of the historical water level segment values, and the risk index is within a first preset range, then high-frame-rate monitoring is performed on the preset high-risk areas in the monitored water area; if both the real-time water level segment value and the historical water level segment value within a preset time period are not less than the dynamic threshold, and the risk index is within a second preset range, then cross-modal verification is performed on the real-time water level segment value and the real-time water level scalar value, and a water level warning is issued based on the verification result; if the risk index is greater than a third preset range, then a water level warning is issued directly; wherein, the cross-modal verification of the real-time water level segment value and the real-time water level scalar value includes: spatially aligning the real-time water level segment value and the real-time water level scalar value to obtain the alignment error; if the alignment error is greater than a preset error threshold, then manual review or drone inspection is performed.
[0018] The above-mentioned scheme, through an improved water level segmentation model combined with edge computing devices, achieves real-time image processing and water level segmentation value extraction. Compared with traditional manual observation or single-sensor monitoring, it can effectively resist environmental interference, improve the accuracy and stability of water level monitoring, and provide reliable data support for subsequent precise early warning. On the other hand, the above-mentioned scheme integrates multi-source data to calculate a risk index, comprehensively characterizing the degree of water level anomalies. Compared with early warning methods based on only a single data source, the above-mentioned scheme can more accurately capture water level change trends and potential risks, effectively reducing false alarm and missed alarm rates. Furthermore, by implementing a graded early warning strategy through the risk index, precise response measures can be taken for different risk levels. This not only focuses on key monitoring of high-risk areas but also achieves efficient emergency response, saving computing resources while maximizing the protection of life and property safety and improving the efficiency of water conservancy monitoring and emergency management. Moreover, the optimized design of the water level segmentation model reduces computational complexity while ensuring monitoring accuracy, making it easier to deploy on edge computing devices, broadening the application scenarios of the above-mentioned water level early warning method, and improving the intelligence and efficiency of water conservancy monitoring technology.
[0019] Secondly, embodiments of the present invention provide a water level early warning method applied to a central server. The method includes: acquiring a training set of a water level segmentation model; performing data augmentation processing on the training set; training the water level segmentation model using the data augmentation-processed training set to obtain a trained water level segmentation model; deploying the trained water level segmentation model to an edge computing device, so that the edge computing device can use the trained water level segmentation model to extract real-time water level segmentation values from real-time images; and acquiring a real-time water level scalar value of a monitored water area; wherein the real-time water level scalar value is collected by at least one water level sensor deployed in the monitored water area; determining a risk index of the monitored water area based on the real-time water level segmentation value, historical water level segmentation value, the real-time water level scalar value, and the historical water level scalar value; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area; and issuing a water level early warning based on the risk index.
[0020] Thirdly, embodiments of the present invention provide a water level early warning system, including a central server and at least one edge computing device communicatively connected to the central server, wherein: the central server is used to acquire a training set of a water level segmentation model; perform data augmentation processing on the training set; train the water level segmentation model using the data augmentation-processed training set to obtain a trained water level segmentation model; deploy the trained water level segmentation model to the edge computing device; the edge computing device is used to acquire real-time images of the monitored water area; extract real-time water level segmentation values from the real-time images using the pre-trained water level segmentation model; acquire real-time water level scalar values of the monitored water area; wherein the real-time water level scalar values are collected by at least one water level sensor deployed in the monitored water area; determine a risk index of the monitored water area based on the real-time water level segmentation values, historical water level segmentation values, the real-time water level scalar values, and historical water level scalar values; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area; and perform water level early warning based on the risk index.
[0021] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing embodiments of the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating a water level early warning method for edge computing devices provided in an embodiment of the present invention.
[0024] Figure 2 This is a schematic diagram of the structure of a three-level parallel pooling module provided in an embodiment of the present invention;
[0025] Figure 3 This is a flowchart illustrating a water level early warning method applied to a central server, as provided in an embodiment of the present invention.
[0026] Figure 4 This is a schematic diagram of the structure of a water level early warning system provided in an embodiment of the present invention. Detailed Implementation
[0027] The embodiments of the technical solution of the present invention will now be described in detail with reference to the accompanying drawings. These embodiments are merely illustrative of the technical solution of the present invention and are therefore intended to limit the scope of protection of the present invention.
[0028] Currently, in addition to manual observation or single-sensor data monitoring, the following technologies are also used for water level early warning:
[0029] Water level segmentation based on deep learning models and water level warning based on the segmentation results: This scheme can use conventional PIDNet to segment real-time images to obtain water level segmentation results. However, although conventional PIDNet has a three-branch structure of details, context, and boundaries, it often suffers from problems such as loss of local details and redundancy in multi-scale feature fusion in water level detection tasks. This makes PIDNet insufficiently accurate in grasping detailed information when dealing with complex water level scenes. For example, the model has difficulty accurately capturing and recognizing small changes or subtle fluctuations in local areas near the water level line, resulting in decreased segmentation accuracy and affecting the reliability of water level detection.
[0030] Water level prediction algorithms are used to predict water levels in real time for water level warnings. The water level prediction algorithms used in this scheme are mostly based on fixed threshold judgments and lack dynamic adjustment mechanisms. Once the water level changes abruptly, these algorithms are difficult to react in a timely and accurate manner, have poor adaptability, and cannot meet the needs of rapid early warning for water level change scenarios in practical applications.
[0031] In view of this, embodiments of the present invention provide a water level early warning method. This method, through an improved water level segmentation model combined with edge computing devices, achieves real-time image processing and water level segmentation value extraction. Compared with traditional manual observation or single sensor monitoring, it can effectively resist environmental interference, improve the accuracy and stability of water level monitoring, and provide reliable data support for subsequent accurate early warning. On the other hand, the above scheme integrates multi-source data to calculate a risk index, comprehensively characterizing the degree of water level anomalies. Compared with early warning methods based on only a single data source, the above scheme can more accurately capture water level change trends and potential risks, effectively reducing false alarm and missed alarm rates. Furthermore, by implementing a graded early warning strategy through the risk index, precise response measures are taken for different risk levels. This not only focuses on key monitoring of high-risk areas but also achieves efficient emergency response. While saving computing resources, it maximizes the protection of life and property safety and improves the efficiency of water conservancy monitoring and emergency management. Moreover, the optimized design of the water level segmentation model reduces computational complexity while ensuring monitoring accuracy, making it easier to deploy on edge computing devices, broadening the application scenarios of the above water level early warning method, and improving the intelligence and efficiency of water conservancy monitoring technology.
[0032] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.
[0033] Please see Figure 1 This invention provides a water level early warning method for edge computing devices, the method comprising:
[0034] Step S110: Acquire real-time images of the monitored water area.
[0035] It should be noted that step S110 above mainly relies on multiple cameras deployed around and at key locations of the monitored water area. These cameras continuously collect real-time images of the monitored water area at preset time intervals. The camera setup ensures that the collected images can fully cover the monitored area, including key areas such as sections of road prone to flooding, river embankments, and the area around reservoirs.
[0036] It should be further explained that during image acquisition, the raw images captured by the camera undergo preprocessing. Preprocessing steps include image grayscale conversion, noise removal, and resizing to ensure consistent image size and format, remove irrelevant information, and enhance contrast and clarity, thereby improving image quality and making it more suitable for subsequent water level segmentation model processing. This image data is then transmitted to an edge computing device as input to the water level segmentation model to extract real-time water level segmentation values.
[0037] Step S120: Extract real-time water level segmentation values from the real-time image using a pre-trained water level segmentation model.
[0038] Preferably, in one embodiment of the present invention, the pre-trained water level segmentation model includes: an input layer, a backbone network, an integral branch, a differential branch, a boundary-guided semantic enhancement module, and an output layer; the input ends of the backbone network and the differential branch are respectively connected to the input layer; the output end of the backbone network is connected to the input end of the integral branch; the output ends of the integral branch and the differential branch are respectively connected to the input end of the boundary-guided semantic enhancement module; the output end of the boundary-guided semantic enhancement module is connected to the output layer.
[0039] Step S120 above may include: inputting a real-time image into the input layer of a pre-trained water level segmentation model; inputting the real-time image from the input layer into the backbone network to obtain multi-scale feature maps; inputting the multi-scale feature maps output by the backbone network into the integral branch to obtain initial segmentation results; inputting the real-time image from the input layer into the boundary response main path of the differential branch to obtain a boundary heatmap; inputting the real-time image from the input layer into the detail-preserving auxiliary path of the differential branch to obtain detail-enhancing feature maps; and inputting the initial segmentation results, boundary heatmaps, and detail-enhancing feature maps into the boundary-guided semantic enhancement module to obtain real-time water level segmentation values.
[0040] It should be noted that the pre-trained water level segmentation model employs a complex yet efficient multi-branch network architecture, including an input layer, a backbone network, an integral branch, a differential branch, a boundary-guided semantic enhancement module, and an output layer. The inputs of the backbone network and the differential branch are connected to the input layer, receiving and processing the raw image data independently. The output of the backbone network is connected to the input of the integral branch, passing the extracted multi-scale feature maps to generate the initial segmentation result. Simultaneously, the output of the differential branch also passes its processing result to the boundary-guided semantic enhancement module, which combines information from the integral and differential branches to ultimately generate accurate water level segmentation values.
[0041] Specifically, step S120 involves inputting a real-time image into a pre-trained water level segmentation model. First, the real-time image is input into the model's input layer. Then, the input layer passes the image data to the backbone network, which is responsible for extracting multi-scale feature maps from the image. These feature maps capture detailed information at different scales in the image, such as edges near the water level and the texture of the water surface, providing rich feature representations for subsequent segmentation tasks. Next, the multi-scale feature maps extracted by the backbone network are input into the integral branch. The integral branch further processes these feature maps through its network structure to generate an initial segmentation result. This initial segmentation result contains a preliminary judgment of the water level position but may lack detailed or boundary information. At the same time, the real-time image from the input layer is also input into two sub-branches of the differential branch: the boundary response main path and the detail-preserving auxiliary path. The boundary response main path focuses on extracting boundary information in the image through a series of convolutional operations and activation functions, generating a boundary heatmap. The detail-preserving auxiliary path preserves and enhances the detailed features in the image through operations such as depthwise separable convolution, coordinate attention mechanism, and bilinear upsampling, generating a detail-enhanced feature map. Finally, the initial segmentation results, boundary heatmap, and detail enhancement feature map are jointly input into the boundary-guided semantic enhancement module. This module integrates this information, utilizing boundary information and detail features to optimize the initial segmentation results, thereby obtaining a more accurate and complete real-time water level segmentation value. This segmentation value can accurately identify the location and extent of the water level line in the image, providing crucial data support for subsequent water level monitoring and early warning.
[0042] It is understandable that the above water level segmentation model has at least the following advantages: (1) The synergistic advantage of the multi-branch structure: The backbone network and the differential branch respectively obtain image data from the input layer to realize multi-path feature extraction. The backbone network extracts multi-scale feature maps, which provide a basis for the integral branch to generate the initial segmentation results, covering the approximate information such as the position of the water level line. The boundary response main path and the detail preservation auxiliary path of the differential branch focus on boundary and detail features. The boundary response main path generates a boundary heat map to outline the edge of the water level line, and the detail preservation auxiliary path preserves image details through operations such as depthwise separable convolution. (2) The boundary-guided semantic enhancement module integrates the initial segmentation results, boundary heat map and detail enhancement feature map, and fuses semantic information and boundary details to optimize the segmentation effect. The initial segmentation results provide the approximate area, the boundary heat map clarifies the edge position, and the detail enhancement feature map supplements local texture and other details, making the real-time water level segmentation value more accurate and complete, and improving the accuracy of water level monitoring. (3) Improve model efficiency and performance: The lightweight design of the backbone network (lightweight residual module and pixel enhancement module) reduces the amount of computation, improves the operation speed, and meets the real-time monitoring requirements. The parallel processing structure of differential branches and operations such as depthwise separable convolution further optimize the allocation of computing resources, improve the model running efficiency, and broaden its application scenarios in resource-constrained environments such as complex waters in the wild.
[0043] Preferably, in one embodiment of the present invention, the backbone network includes a first lightweight residual module, a second lightweight residual module, and a lightweight pixel enhancement module, wherein the lightweight pixel enhancement module is disposed at the residual connection end of the first lightweight residual module and the second lightweight residual module.
[0044] The above-mentioned input of the real-time image of the input layer into the backbone network to obtain multi-scale feature maps includes: inputting the real-time image of the input layer into the first lightweight residual module of the backbone network to obtain a first residual feature map; inputting the first residual feature map into the second lightweight residual module to obtain a second residual feature map; and inputting the second residual feature map into the lightweight pixel enhancement module to obtain multi-scale feature maps.
[0045] It should be noted that the aforementioned backbone network employs a lightweight design, comprising a first lightweight residual module, a second lightweight residual module, and a lightweight pixel enhancement module. The lightweight pixel enhancement module is located at the end of the residual connections between the first and second lightweight residual modules. This module combination and layout aims to optimize the feature extraction process, ensuring reduced computational complexity while maintaining model performance. When real-time images are input into the backbone network, they are first processed by the first lightweight residual module to obtain a first residual feature map. This module extracts basic image features through convolution operations and utilizes residual connections to alleviate the gradient vanishing problem, helping to maintain the stability of model training and the effectiveness of feature extraction. Subsequently, the first residual feature map is input into the second lightweight residual module for further processing to obtain a second residual feature map. Building upon the feature extraction capabilities of the first module, the second lightweight residual module further mines deeper image features, enhancing the model's understanding and analysis capabilities of complex scenes. Finally, the second residual feature map is passed to the lightweight pixel enhancement module. This module aims to enhance the expressive power of feature maps by focusing on important feature information and suppressing irrelevant information, thereby improving the model's recognition accuracy for key features such as water levels. After processing by the lightweight pixel enhancement module, the output multi-scale feature maps contain rich spatial and semantic information, providing high-quality feature input for subsequent integral and differential branch processing, which helps to improve the performance and segmentation accuracy of the entire water level segmentation model.
[0046] Further explanation is needed: the above-mentioned lightweight residual module is an optimization and improvement of the traditional residual module. The lightweight residual module mainly includes: (1) 1×1 convolutional layer: used to reduce the number of channels in the input feature map, reduce the computational complexity, and perform preliminary linear combination of features. Working process: Assuming that the number of channels in the input feature map is C, the number of channels is reduced to C / 4 by 1×1 convolution, thereby reducing the computational amount of subsequent 3×3 convolution. (2) 3×3 depthwise separable convolutional layer: used to extract the spatial information of the feature map while reducing the computational amount. Depthwise separable convolution decomposes the standard convolution into depthwise convolution and pointwise convolution, which significantly reduces the computational parameters. Working process: 3×3 depthwise separable convolution is performed on the dimensionality-reduced feature map to keep the spatial size of the feature map unchanged. (3) 1×1 convolutional layer: used to restore the number of channels in the feature map to the original C, so as to perform residual connection with the input feature map. Working process: The number of channels is restored from C / 4 to C using a 1×1 convolution, ensuring that the number of channels in the output feature map matches the number of channels in the input feature map. Figure 1 To.
[0047] It should be further noted that the above-mentioned lightweight pixel enhancement module is mainly used to enhance the expressive power of the feature map, mainly including: (1) Global average pooling layer: used to compress the spatial dimension of the feature map to 1×1, generate channel global descriptors, and capture the global information of the feature map. Working process: for the input feature map (1) Global average pooling is performed on the channel global descriptor (size is H / 16×W / 16×128), and the output channel global descriptor has a size of 1×1×128. (2) Dimension compression layer: used to adjust the dimension of the channel global descriptor to make it suitable for subsequent one-dimensional dynamic convolution operation. Working process: Adjust the dimension of the channel global descriptor to 1×128. (3) One-dimensional dynamic convolution layer: used to generate channel attention weights, highlight important feature channels, and suppress unimportant feature channels. Working process: Perform one-dimensional dynamic convolution on the channel global descriptor after adjusting the dimension, and output channel attention weights with a size of 1×128. (4) Sigmoid function mapping layer: used to map the channel attention weights to The interval is defined to represent the importance score for each channel. The process involves using the Sigmoid function to perform a non-linear mapping on the channel attention weights, ensuring that the weight values fall within a certain range. Within the range, and by adjusting the dimensions to match the original input, a channel attention weight map is obtained. The dimension is 128×1×1. (5) Feature enhancement layer: used to multiply the channel attention weights with the original feature map channel by channel to achieve feature enhancement. Working process: multiply the channel attention weight map (Dimensions: 128×1×1) and the original feature map Channel-by-channel multiplication yields the enhanced feature map. The output dimension remains H / 16×W / 16×128. (The above feature map...) The calculation method is as follows:
[0048]
[0049] It is understandable that the aforementioned backbone network employs a lightweight residual module, comprising a first lightweight residual unit, a second lightweight residual unit, and a lightweight pixel enhancement module. Features are progressively extracted through two levels of residual modules, and then optimized by the pixel enhancement module, outputting multi-scale feature maps that retain rich details and semantic information, enhancing the model's ability to recognize key features such as water levels. Furthermore, the lightweight residual module replaces the original four-layer standard residual block with a combination of 1×1 convolutional dimensionality reduction, 3×3 depthwise separable convolutional spatial feature extraction, and 1×1 convolutional channel recovery, reducing computational complexity, parameter count, and computational load, accelerating computation speed, improving model efficiency, and meeting real-time monitoring requirements. Moreover, the lightweight pixel enhancement module integrates operations such as global average pooling, one-dimensional dynamic convolution, and the sigmoid function, adaptively learning the correlation between channels and generating attention weights to achieve adaptive feature enhancement, improving the model's generalization ability and adaptability to different scenarios, and reducing the risk of overfitting.
[0050] Preferably, in one embodiment of the present invention, the above-mentioned integral branch includes a first downsampling module, a second downsampling module, a three-level parallel pooling module, and a segmentation head connected in sequence.
[0051] The above-mentioned inputting the multi-scale feature map output by the backbone network into the integral branch to obtain the initial segmentation result includes: inputting the multi-scale feature map output by the backbone network into the first downsampling module in the integral branch to obtain the first downsampling feature map; inputting the first downsampling feature map into the second downsampling module to obtain the second downsampling feature map; inputting the second downsampling feature map into the three-level parallel pooling module to obtain the multi-scale context fusion feature map; and inputting the multi-scale context fusion feature map into the segmentation head to obtain the initial segmentation result.
[0052] Further explanation is needed: Please refer to Figure 2 The aforementioned three-level parallel pooling module is designed to capture contextual information from different scales, enhancing the expressive power of feature maps. This module includes three parallel pooling branches, each operating with pooling kernels of different sizes: 4×4, 2×2, and 1×1, as shown in the attached figure.
[0053] First, the second downsampled feature map is input into each pooling branch. Each pooling branch first performs a pooling operation to reduce the spatial resolution of the feature map and extract contextual information at different scales. Then, the output feature map of each branch is subjected to a 1×1 convolution to compress the number of channels and reduce redundant information. The compressed feature map is then restored to the original spatial resolution through an upsampling operation. Specifically: (1) Branch with a 4×4 pooling kernel: A 4×4 pooling operation is performed on the input feature map to extract a larger range of contextual information, and then the number of channels is reduced through a 1×1 convolution and upsampling is performed to restore the spatial resolution. (2) Branch with a 2×2 pooling kernel: A 2×2 pooling operation is performed on the input feature map to extract a medium range of contextual information, followed by a 1×1 convolution and upsampling. (3) Branch with a 1×1 pooling kernel: A 1×1 pooling operation is performed on the input feature map to preserve the original spatial resolution, and the number of channels is adjusted through a 1×1 convolution. Finally, the output feature maps from the three branches are concatenated along the channel dimension (channel concatenation), fusing contextual information at different scales together. The fused feature map is shown below. The channel information is further integrated through 1×1 convolution to obtain a multi-scale context fusion feature map with an output dimension of H / 64×W / 64×256. This design can effectively capture contextual information at different scales, thereby enhancing the semantic expressive power of the feature map and providing richer information for subsequent segmentation tasks.
[0054] Furthermore, the segmentation head processes the aforementioned fused feature map. The processing steps may include: 3×3 convolution (256 channels maintained) → BatchNorm → ReLU → 1×1 convolution (output channels maintained) → Bilinear upsampling to size H×W yields the segmentation result. .
[0055] It is understandable that the integral branch in the above scheme processes the multi-scale feature maps output by the backbone network step by step through the sequentially connected first downsampling module, second downsampling module, three-level parallel pooling module, and segmentation head. First, the first and second downsampling modules progressively reduce the spatial resolution of the feature maps while extracting higher-level semantic information. This allows the feature maps to capture richer global contextual information after two downsampling operations, contributing to more accurate water level segmentation. On the other hand, the three-level parallel pooling module performs parallel pooling operations on the feature maps using different pooling kernel sizes (e.g., 4×4, 2×2, 1×1) to capture contextual information at different scales. Each pooling branch is followed by a 1×1 convolution to compress the number of channels, reducing redundant information, and then upsampling restores the spatial resolution to a uniform level. Finally, the output feature maps of the three branches are concatenated along the channel dimension and fused using a 1×1 convolution to generate a multi-scale contextual fusion feature map. This multi-scale feature fusion mechanism effectively improves the expressive power of the feature maps, enhances the model's adaptability to complex scenes, and improves the accuracy of the initial segmentation results. On the other hand, the design of the entire integral branch focuses on optimizing computational efficiency while ensuring the effectiveness of feature extraction and fusion. The combination of the downsampling module and the pooling module can retain key information while reducing the amount of computation, avoiding redundant calculations. In addition, the lightweight design of the three-level parallel pooling module (such as using 1×1 convolution to compress the number of channels) further reduces the computational complexity, enabling the model to run efficiently on resource-constrained edge computing devices and meet the needs of real-time water level monitoring.
[0056] Preferably, in one embodiment of the present invention, the boundary response main path in the differential branch includes a first depthwise separable convolution module, a pointwise convolution module, and an activation module connected in sequence; the detail-preserving auxiliary path includes a second depthwise separable convolution module, a coordinate attention module, and a bilinear upsampling module connected in sequence.
[0057] The above-mentioned method of inputting the real-time image of the input layer into the boundary response main path of the differential branch to obtain the boundary heatmap includes: inputting the real-time image of the input layer into the first depthwise separable convolution module of the boundary response main path to obtain the first spatial detail feature map; inputting the first spatial detail feature map into the pointwise convolution module to obtain the single-channel boundary feature map; and inputting the single-channel boundary feature map into the activation module to obtain the boundary heatmap.
[0058] The above-mentioned input of the real-time image of the input layer into the detail-preserving auxiliary path of the differential branch to obtain the detail-enhanced feature map includes: inputting the real-time image of the input layer into the second depthwise separable convolution module of the detail-preserving auxiliary path to obtain the second spatial detail feature map; inputting the second spatial detail feature map into the coordinate attention module to obtain the detail feature map after spatial position weighting; and inputting the detail feature map into the bilinear upsampling module to obtain the detail-enhanced feature map.
[0059] It should be noted that the aforementioned differential branch is used to extract boundary and detail information from real-time images to enhance the accuracy of water level segmentation. The differential branch contains two main sub-branches: a boundary response main path and a detail-preserving auxiliary path.
[0060] The boundary response main route is composed of a first depthwise separable convolution module, a pointwise convolution module, and an activation module connected in sequence. Its function is to extract and generate a boundary heatmap to highlight the edge information of the water level line. Among them: (1) First depthwise separable convolution module: The input is a real-time image, and the depthwise separable convolution is used to extract preliminary spatial detail features. The depthwise separable convolution reduces the amount of computation while preserving the edge information of the image; the output is the first spatial detail feature map. (2) Pointwise convolution module: It is used to input the first spatial detail feature map into the pointwise convolution module, and the number of channels is mapped to a single channel through 1×1 convolution, and the multi-channel information is fused to output a single-channel boundary feature map. (3) Activation module: It is used to input the single-channel boundary feature map into the activation module (such as the Sigmoid function), and normalize the feature map value to The interval is used to generate a boundary heatmap. The output is a boundary heatmap, where high-value pixels represent the edge positions of the water level line.
[0061] The detail-preserving auxiliary path consists of a second depthwise separable convolutional module, a coordinate attention module, and a bilinear upsampling module connected in sequence. Its function is to preserve and enhance the detail features in the image, and to supplement the local information lost by the boundary response main path. Among them: (1) Second depthwise separable convolutional module: Input the real-time image, and apply depthwise separable convolution again to extract another set of spatial detail features; the output is the second spatial detail feature map. (2) Coordinate attention module: Used to input the second spatial detail feature map into the coordinate attention module, and to perform spatial weighting on the feature map by explicitly modeling the spatial position relationship. The output is the detail feature map after spatial position weighting, which enhances the feature expression of important regions. (3) Bilinear upsampling module: Used to input the weighted detail feature map into the bilinear upsampling module to restore the spatial resolution of the feature map. The output is the detail-enhanced feature map, which is used to supplement the detail information lost by the boundary response main path.
[0062] It should be further explained that the aforementioned differential branch extracts boundary information and detail features through the synergistic effect of the boundary response main path and the detail-preserving auxiliary path, respectively. The boundary heatmap generated by the boundary response main path is used to highlight the edges of the water level line, while the detail-preserving auxiliary path generates a detail-enhanced feature map to supplement local details. These two parts of features are ultimately input into the boundary-guided semantic enhancement module, fused with the initial segmentation result of the integral branch, to generate a more accurate real-time water level segmentation value. This design significantly improves the detection accuracy of the water level line, especially showing greater robustness in complex scenes (such as changes in lighting and water ripples).
[0063] It is understandable that the boundary response main path of the differential branch in the above scheme, through a first depthwise separable convolution module, a pointwise convolution module, and an activation module connected in sequence, can extract accurate boundary information from real-time images. The first depthwise separable convolution module effectively reduces the computational load while preserving the edge details of the image. The pointwise convolution module fuses multi-channel features into a single-channel boundary feature map, highlighting the edge position of the water level line. The activation module (such as the Sigmoid function) further normalizes the feature map into a boundary heatmap, making the boundary information clearer and more explicit, providing accurate edge guidance for subsequent water level segmentation. On the other hand, the detail-preserving auxiliary path, through a second depthwise separable convolution module, a coordinate attention module, and a bilinear upsampling module connected in sequence, can preserve and enhance the detailed features in the image. The second depthwise separable convolution module extracts the spatial detail features of the image again, ensuring that important information is not lost. The coordinate attention module enhances the feature map's feature representation by explicitly modeling spatial positional relationships and spatially weighting it. The bilinear upsampling module restores the spatial resolution of the feature map, making the detailed features richer and clearer, providing important supplementary information for subsequent segmentation tasks. On the other hand, the differential branch design prioritizes computational efficiency and resource optimization. The use of depthwise separable convolution significantly reduces computational load and parameter count, enabling the model to run efficiently on resource-constrained edge computing devices. Simultaneously, operations such as pointwise convolution and bilinear upsampling further optimize the allocation of computational resources, ensuring that the model maintains high performance while meeting the needs of real-time water level monitoring. This efficient design allows the model to operate stably even in complex scenarios (such as changes in lighting and water ripples), providing reliable water level segmentation results.
[0064] The working principle of the boundary-guided semantic enhancement module described above is introduced below:
[0065] The aforementioned boundary-guided semantic enhancement module determines the real-time water level segmentation value by fusing the initial segmentation result, boundary heatmap, and detail enhancement feature map. Specifically: the initial segmentation result, derived from the integral branch, provides the preliminary location and extent of the water level line, but may lack detailed and precise boundary information. The boundary heatmap, derived from the boundary response main path of the differential branch, highlights the edge location of the water level line, providing precise boundary information. The detail enhancement feature map, derived from the detail-preserving auxiliary path of the differential branch, supplements any local details that may have been lost in the initial segmentation result.
[0066] The boundary-guided semantic enhancement module integrates these three parts of information, mainly including: (1) Feature fusion: The initial segmentation result, boundary heatmap, and detail enhancement feature map are fused through a specific fusion mechanism (such as feature concatenation or element-wise operation). The boundary heatmap provides edge information, and the detail enhancement feature map supplements local details, jointly optimizing the initial segmentation result. (2) Boundary-guided semantic enhancement: The boundary information in the boundary heatmap is used to guide the semantic segmentation process to ensure the accuracy of the segmentation result at the boundary. The initial segmentation result is modulated by the boundary information to enhance the semantic information near the boundary, making the segmentation of the water level line more accurate. (3) Detail supplementation: The detail information in the detail enhancement feature map is integrated into the segmentation result, making the segmentation result more complete and detailed, especially in the complex area near the water level line.
[0067] The steps for the boundary-guided semantic enhancement module to obtain the final output may include: (1) obtaining the boundary probability map: obtaining the boundary heatmap through the boundary response main path in the differential branch. Each pixel value represents the probability that the location belongs to the boundary. (2) Binarization mask generation: The boundary heatmap B is binarized to generate a binary mask. The specific operation involves using the indicator function I to set pixel values in B that are greater than or equal to 0.5 to 1, and the rest to 0. (3) Attention enhancement: The initial segmentation result S is compared with the generated binary mask. In combination, an attention enhancement mechanism is used to improve the category confidence of boundary regions. The specific formula is: .in, This is a learnable parameter, and its initial value can be set to 0.5, which can be optimized through backpropagation. This indicates element-wise multiplication, which improves edge segmentation accuracy by enhancing the class confidence of the boundary region. (4) Generate the final output: the segmentation result after attention enhancement. This is the final output of the water level segmentation model described above. The category confidence of each pixel is adjusted, and the segmentation accuracy of the boundary region is improved, thereby achieving more accurate segmentation of key features such as water level lines. Indicates the segmentation category.
[0068] Finally, the boundary-guided semantic enhancement module outputs real-time water level segmentation values. These values combine global information from the initial segmentation results, precise boundaries from the boundary heatmap, and local details from the detail enhancement feature map, thus providing more accurate and detailed information on the location and range of the water level.
[0069] It should be further explained that the above water level segmentation model can be understood as an improved PIDNet model. Compared with the conventional PIDNet model, the improvements of the improved PIDNet model in this embodiment are at least as follows: (1) Lightweight residual modules are used: Conventional PIDNet uses standard residual blocks, while this invention replaces them with lightweight residual modules. Each lightweight residual module contains sequentially connected 1×1 convolutions (channels reduced to C / 4), 3×3 depthwise separable convolutions, and 1×1 convolutions (channels restored to C), and a lightweight pixel enhancement module is embedded at the end of the residual connection between the first and second lightweight residual modules. This design reduces the amount of computation and parameters, reduces the risk of overfitting, and improves the running efficiency of the model and the ability to identify key features. (2) Multi-scale attention mechanism is adopted: A lightweight pixel enhancement module is introduced into the backbone network. Through operations such as global average pooling, one-dimensional dynamic convolution and sigmoid function, the correlation between channels is adaptively learned and channel attention weights are generated to achieve adaptive enhancement of features, highlight important feature information, and suppress irrelevant feature information. This enables the model to better capture multi-scale features, improve the recognition accuracy of key features such as water level lines, and enhance the adaptability to water level changes at different scales. (3) A three-level parallel pooling module is adopted: In the integral branch, the original PIDNet's PAPPM is replaced with a three-level parallel pooling module. Three different sizes of pooling kernels (4×4, 2×2, 1×1) are used to perform parallel pooling operations on the feature map to capture contextual information at large, medium, and small scales respectively. Then, the number of channels is compressed by 1×1 convolution, and the spatial resolution is restored by bilinear interpolation upsampling. Finally, the output feature maps of the three branches are spliced and fused along the channel dimension. This design more effectively captures contextual information at different scales, enhances the semantic expressive power of the feature map, and improves the accuracy of the initial segmentation results. (4) A boundary-guided semantic enhancement module is adopted: A differential branch is introduced, which includes a boundary response main path and a detail-preserving auxiliary path. The boundary response main path extracts boundary information and generates a boundary heatmap through a first depthwise separable convolutional module, a pointwise convolutional module, and an activation module connected in sequence. The detail preservation auxiliary path preserves and enhances the detailed features in the image through a second depthwise separable convolutional module, a coordinate attention module, and a bilinear upsampling module connected in sequence. Then, the initial segmentation result, the boundary heatmap, and the detail enhancement feature map are input into the boundary-guided semantic enhancement module for fusion. By utilizing the boundary information and detail features, the initial segmentation result is optimized to obtain a more accurate and complete real-time water level segmentation value, improving segmentation accuracy and detail representation.(5) A dynamic risk assessment and multi-level early warning mechanism is adopted: Conventional PIDNet only outputs the segmentation results of the water level line, while this invention integrates visual segmentation results, sensor data, and historical water level trends to establish an early warning algorithm based on dynamic thresholds and multimodal decision-making. This reduces the false alarm rate of a single data source and enables tiered processing from low-risk monitoring to high-risk emergency response. This dynamic risk assessment and multi-level early warning mechanism allows the model to more comprehensively assess water level risks, improve the accuracy and timeliness of early warnings, and provide a more reliable basis for water level monitoring and early warning.
[0070] In addition, it should be noted that the improved PIDNet model in this embodiment replaces the P branch in the original PIDNet with the following modules: (1) Parallel pooling + differential dual-path structure: The parallel pooling module can capture multi-scale contextual information, and the boundary response main path and detail preservation auxiliary path in the differential branch can extract boundary information and detail features respectively. The combination of the two provides pixel-level boundary response and rich details, thereby replacing the role of the P branch in detail preservation. (2) Attention mechanism in lightweight residual unit: The coordinate attention layer (CoordAttention) is introduced in the lightweight residual unit, which can explicitly model spatial positional relationships, spatially weight the feature map, highlight the features of important regions, and compensate for the loss of details that may be caused by removing the P branch. (3) Boundary-guided semantic enhancement: The boundary heatmap and detail enhancement feature map generated by the differential branch are fused with the initial segmentation result of the integral branch through the boundary-guided semantic enhancement module. By using boundary mask modulation, the boundary information and detail features are integrated into the semantic segmentation process to achieve interactive enhancement of details and semantics, forming a "detail-semantic" interactive path similar to the P branch, which further optimizes the segmentation result.
[0071] In summary, the embodiments of the present invention, through the above three aspects of design, successfully replace the P branch in conventional PIDNet, not only preserving attention to detailed information but also improving the overall performance and efficiency of the model.
[0072] Understandably, the conventional PIDNet's P-branch preserves detail through high-resolution feature maps and boundary supervision, resulting in a relatively complex structure. The improved scheme, through parallel pooling and a dual-path differential structure, efficiently acquires multi-scale contextual information and pixel-level boundary responses while reducing model parameters and computational cost, thereby improving model efficiency and making it more suitable for resource-constrained edge computing devices. Furthermore, attention mechanisms (such as coordinate attention layers) in lightweight residual units can explicitly model spatial relationships, spatially weighting features and highlighting important regions. This compensates for detail loss after removing the P-branch and further enhances the model's ability to extract key features, making the model more accurate in recognizing detailed features such as water levels. The boundary-guided semantic enhancement mechanism, through boundary mask modulation, deeply fuses the boundary information and detailed features of the differential branch with the semantic information of the integral branch, forming a "detail-semantic" interaction path similar to the P-branch. This fusion method more effectively utilizes boundary and detailed information, improving the accuracy and completeness of the segmentation results. Compared to the original P branch, the improved scheme can achieve better detail preservation and semantic segmentation without increasing the computational burden, thus better meeting the needs of water level monitoring scenarios.
[0073] Step S130: Obtain the real-time water level scalar value of the monitored water area; wherein the real-time water level scalar value is collected by at least one water level sensor deployed in the monitored water area.
[0074] It should be noted that the aforementioned scalar water level values are collected in real time by at least one water level sensor deployed in the monitored water area. Water level sensors are devices specifically designed to measure water levels; they can operate based on various principles, such as pressure, ultrasound, radar, or capacitance, to sense changes in water level. These sensors are typically installed at key locations near the monitored water bodies, such as rivers, lakes, reservoirs, and urban drainage systems, to ensure accurate capture of real-time water level changes. The sensors convert the measured water level data into electrical or digital signals, which are then transmitted to edge computing devices or other data processing centers. These real-time scalar water level values complement the real-time water level segmentation values obtained through image processing, providing comprehensive data support for subsequent risk index calculations and water level early warnings, ensuring the system can respond to water level changes promptly and accurately. Furthermore, the data collected by the water level sensors in the above scheme is referred to as scalar data because its output only contains information about the magnitude or height of the water level, without involving other attributes such as direction. Scalar data is typically represented by a single numerical value, such as a water level height of 3.2 meters. In water level monitoring applications, sensors determine the water level by measuring physical quantities (such as pressure, ultrasonic reflection time, etc.) and converting them into specific numerical values. These values reflect the absolute position or changes in the water level, providing crucial quantitative data for subsequent water level analysis and early warning.
[0075] Step S140: Based on the real-time water level segmentation value, historical water level segmentation value, real-time water level scalar value, and historical water level scalar value, determine the risk index of the monitored water area; wherein, the risk index is used to characterize the degree of water level anomaly in the monitored water area.
[0076] Preferably, in one embodiment of the present invention, step S140 may include: obtaining the probability density distribution of each water level extreme value in the monitored water area based on historical water level segmentation values; determining the water level value corresponding to a preset probability density in the probability density distribution to obtain a dynamic threshold; determining the degree of deviation between the real-time water level segmentation value and the mean of the historical water level segmentation value, and the severity index of the deviation relative to the dynamic threshold; determining the mean sensor data change rate of each water level sensor based on the data difference and time difference between the real-time water level scalar value and the historical water level scalar value within a preset time period; determining the average value of the mean sensor data change rate of all water level sensors; and determining the risk index of the monitored water area based on the severity index of the deviation and the average value of the mean sensor data change rate.
[0077] It should be noted that the above-mentioned dynamic threshold calculation method can be as follows: Based on historical water level segmentation values, obtain the probability density distribution of each water level extreme value in the monitored water area. This step constructs a probability density distribution model of water level extreme values through statistical analysis of historical water level data, which can reflect the probability of water level occurrence at different values, providing a basis for subsequently determining the dynamic threshold. The water level value corresponding to the preset probability density in this probability density distribution is determined and used as the dynamic threshold. The preset probability density can be set according to the actual application scenario and risk preference, for example, selecting the water level value corresponding to the 95th or 99th percentile as the dynamic threshold. The dynamic threshold will automatically adjust according to the distribution of historical water level data, better adapting to the changing trend of water level and providing a more reasonable benchmark for risk assessment. Through the above steps, the calculation of the dynamic threshold is realized, which can automatically adjust according to historical water level data, providing a dynamic and highly adaptable benchmark value for water level risk assessment. The aforementioned probability density distribution can be obtained using a nonparametric kernel density estimation model. A nonparametric kernel density estimation model is a statistical method used to estimate probability density functions. It belongs to the nonparametric category, meaning it does not assume that the data follows a specific distribution form (such as a normal distribution, Poisson distribution, etc.). The core idea of this method is to estimate the probability density through the kernel function surrounding the data points, thereby flexibly fitting distributions of various shapes. It is understood that the aforementioned nonparametric kernel density estimation model is a relatively mature and well-known technology; its specific implementation can be found in related technologies, and will not be elaborated further in this embodiment.
[0078] It should be further explained that after determining the average rate of change of data from each water level sensor in the above scheme, the average of the average rates of change of data from all water level sensors is further determined to integrate data from multiple sensors, thereby reflecting the water level change trend of the entire monitoring area more comprehensively and accurately. The average rate of change of data from a single sensor only represents the water level change in its local area and may have certain limitations and biases. By calculating the average of all sensors, the data from multiple sensors can be integrated, smoothing out local abnormal fluctuations and obtaining a more representative overall trend. This helps to improve the understanding of the overall water level changes in the monitored water area, enhance the reliability and stability of the system, and provide a more comprehensive basis for water level early warning.
[0079] Understandably, the above scheme, by obtaining dynamic thresholds based on historical water level segmentation values, allows the thresholds to be automatically adjusted according to historical data, better adapting to water level change trends and providing a more reasonable benchmark for risk assessment. On the other hand, determining the deviation severity index quantifies the degree of deviation between real-time water level segmentation values and historical averages, reflecting the risk level of water level anomalies. Furthermore, by calculating the average of the average rate of change of sensor data from all water level sensors, data from multiple sensors is integrated, providing a more comprehensive reflection of the overall water level change trend in the monitored area. Finally, determining the risk index based on the deviation severity index and the average of the average rate of change of sensor data comprehensively considers the degree and rate of water level deviation, more accurately reflecting the degree of water level anomalies in the monitored area and providing a scientific basis for water level early warning.
[0080] Preferably, in one embodiment of the present invention, determining the risk index of the monitored water area based on the average of the deviation severity index and the mean of the sensor data change rate includes: obtaining a first adaptive weight for the deviation severity index and a second adaptive weight for the average of the sensor data change rate based on the severity of water level changes in the monitored water area; wherein the first adaptive weight is inversely proportional to the severity of water level changes in the monitored water area; and the second adaptive weight is directly proportional to the severity of water level changes in the monitored water area; and the risk index of the monitored water area is obtained by weighted summation of the deviation severity index and the mean of the sensor data change rate based on the first and second adaptive weights. An example of this implementation is:
[0081] The risk index is calculated using the following formula. :
[0082]
[0083] in, This represents the real-time water level segmentation value; The average of historical water level values; For dynamic thresholds; This represents the average of the mean rates of change of sensor data. and These are the first adaptive weight and the second adaptive weight, respectively.
[0084] It should be noted that the adaptive weights in the above scheme can be obtained through at least one or more of the following methods:
[0085] The first method of acquisition: adaptive weighting based on the degree of water level change, mainly including:
[0086] Based on the data difference and time difference between real-time water level scalar values and historical water level scalar values within a preset time period, the average rate of change of sensor data for each water level sensor is determined. The average of the average rate of change of sensor data for all water level sensors is calculated as a quantitative indicator of the severity of water level changes. According to the severity of water level changes, a first adaptive weight for deviation from the severity index and a second adaptive weight for the average rate of change of sensor data are dynamically adjusted. The first adaptive weight is inversely proportional to the severity of water level changes, while the second adaptive weight is directly proportional to the severity of water level changes. In this way, when water level changes are severe, the above scheme will place more emphasis on the average rate of change of sensor data; when water level changes are gradual, it will place more emphasis on the severity index of deviation.
[0087] The second acquisition method: adaptive weight determination based on meteorological data, mainly includes:
[0088] By combining meteorological data (such as rainfall forecasts and weather predictions), the trend and extent of water level changes are estimated. During the flood season, due to heavy rainfall and drastic water level changes, the α value is set to 0.4 to reduce the confidence weight of the segmentation results and focus on the sensor's rate of change. During the dry season, with less rainfall and more gradual water level changes, the α value is set to 0.6 to increase the confidence weight of the segmentation results and focus on historical bias.
[0089] In this way, the above scheme can dynamically adjust the emphasis on different indicators according to the characteristics of water level changes in different seasons, thereby improving the adaptability of the model and the accuracy of early warning.
[0090] The third method of acquisition: Determined by a comprehensive adaptive weighting of water level fluctuations and meteorological data, mainly including:
[0091] Simultaneously considering the severity of water level changes and meteorological data, an adaptive weighting system can be comprehensively adjusted. A comprehensive weighting adjustment model can be established, using the severity of water level changes and meteorological data as input variables, and outputting adaptive weights that deviate from the severity index and the average of the sensor data change rate. For example, machine learning algorithms (such as linear regression, neural networks, etc.) can be used to train the weighting adjustment model, enabling it to automatically learn weighting adjustment rules based on historical data.
[0092] By employing the aforementioned adaptive weighting methods, these schemes can flexibly adjust the emphasis on the average value of deviation severity indicators and the average value of sensor data change rates based on different monitoring conditions and data characteristics. This allows for a more accurate determination of the risk index and timely early warning of abnormal water levels.
[0093] Understandably, the above scheme, by introducing an adaptive weighting mechanism, can dynamically adjust the emphasis on the severity of deviation indicators and the average of the mean rate of change of sensor data based on the drastic changes in water level in the monitored water area. When water level changes drastically, the model places greater emphasis on the average of the mean rate of change of sensor data, thus more sensitively capturing rapid water level changes and promptly reflecting sudden water level anomalies. On the other hand, when water level changes are gradual, the model places greater emphasis on the severity of deviation indicators, highlighting the degree of deviation of the current water level from the historical average level, which helps to discover potential, slowly developing water level anomalies. This adaptive weighting adjustment mechanism makes the calculation of the risk index more flexible and intelligent, adapting to the complex and variable conditions of different monitored water areas. Furthermore, by weighting and summing the two based on the first and second adaptive weights, the degree of deviation and the rate of change of water level are comprehensively considered, thus more accurately reflecting the degree of water level anomalies in the monitored water area. This comprehensive evaluation method improves the accuracy and reliability of the risk index, provides a more scientific basis for water level early warning, helps to achieve timely early warning of water level anomalies, and ensures the timeliness and reliability of water conservancy monitoring.
[0094] Step S150: Issue a water level warning based on the risk index.
[0095] Preferably, in one embodiment of the present invention, step S150 may include: if the real-time water level segmentation value is greater than the average of the historical water level segmentation values and the risk index is within a first preset range, then high-frame-rate monitoring is performed on the preset high-risk area in the monitored water area; if the real-time water level segmentation value and the historical water level segmentation value within a preset time period are both not less than a dynamic threshold and the risk index is within a second preset range, then cross-modal verification is performed on the real-time water level segmentation value and the real-time water level scalar value, and a water level warning is issued based on the verification result; if the risk index is greater than a third preset range, a water level warning is issued directly; wherein, cross-modal verification of the real-time water level segmentation value and the real-time water level scalar value includes: spatially aligning the real-time water level segmentation value and the real-time water level scalar value to obtain the alignment error; if the alignment error is greater than a preset error threshold, then manual review or drone inspection is performed.
[0096] The above solution can be configured with the following three-level alarm mechanism:
[0097] Level 1 Alarm: When the real-time water level segment value is greater than the average of historical water level segment values, and the risk index is within the first preset range (e.g., Risk < 0.3), the regional ROI tracking algorithm is activated. High-frame-rate monitoring is only performed on preset high-risk areas in the monitored water area (such as bridges, dams, and other critical locations). By increasing the monitoring frequency of these areas, subtle changes in water level can be captured in a timely manner, enabling a rapid response when the risk escalates further.
[0098] The aforementioned ROI (Region of Interest) tracking algorithm is a technique for real-time monitoring and tracking of a specific region. This algorithm is a relatively mature and well-known technology, and its specific implementation can be found in related technologies. The embodiments of this invention will not be described in detail here.
[0099] This approach allows for concentrated resource monitoring of key areas in situations where the risk is relatively low but attention is still required, effectively reducing the computing power consumption of edge devices and improving monitoring efficiency.
[0100] Level 2 Alarm: If the real-time water level segmentation value and the historical water level segmentation value within the recent preset time period are both not less than the dynamic threshold, and the risk index is within the second preset range (e.g., When the real-time water level segment value and the real-time water level scalar value are spatially aligned, the alignment error is obtained. If the alignment error is greater than a preset error threshold (e.g., 3cm), manual review or drone inspection is performed. If the verification fails, the water level anomaly is determined to exist, and the data for the abnormal period is immediately uploaded to the water conservancy supervision platform, a temporary monitoring report is generated, and a water level rise SMS notification is sent to mobile phones within 500 meters via edge computing devices to remind nearby personnel to pay attention to safety.
[0101] Level 3 Alarm: When the risk index exceeds the third preset range (e.g., Risk ≥ 0.8), a water level warning is issued directly. At this point, the water level risk is extremely high and may have a serious impact on the surrounding area. The system will coordinate with the city's drainage system (e.g., automatically start pumping stations) to drain water and alleviate flooding. The warning will also be sent to the traffic management platform to close flooded road sections, prevent vehicles and pedestrians from entering dangerous areas, and ensure public safety.
[0102] Through the above-mentioned multi-level alarm triggering logic, corresponding measures can be taken according to different risk levels, so as to achieve refined management and efficient early warning of water level risks.
[0103] Understandably, the above solution, by setting up a multi-level early warning mechanism, can take corresponding early warning measures according to different ranges of the risk index. When the risk is low (risk index within the first preset range), high-frame-rate monitoring is only performed on preset high-risk areas, concentrating resources on close monitoring of key areas, effectively reducing the computing power consumption of edge devices and improving monitoring efficiency. On the other hand, when the risk is moderate (risk index within the second preset range), cross-modal verification of real-time water level segmentation values and real-time water level scalar values ensures the accuracy of the early warning. Cross-modal verification, through spatial alignment and error calculation, can trigger manual review or drone inspection when the segmentation results are inconsistent with sensor data, avoiding false alarms and improving the reliability of the early warning. Furthermore, when the risk is extremely high (risk index greater than the third preset range), a water level early warning is directly issued, which can quickly link the urban drainage system and traffic management platform to take timely emergency measures, such as activating pumping stations for drainage and closing flooded road sections, minimizing losses caused by abnormal water levels and ensuring public safety.
[0104] Please see Figure 3 Based on the same inventive concept, embodiments of the present invention also provide a water level early warning method applied to a central server, comprising:
[0105] Step S210: Obtain the training set of the water level segmentation model.
[0106] It should be noted that the training set mentioned above can be obtained from river videos captured by surveillance cameras deployed in key areas such as urban waterways and reservoir spillways. The training set for training the water level segmentation model is obtained by extracting 1080P video frames from the captured videos, performing data segmentation and annotation using the labelme software.
[0107] Step S220: Perform data augmentation on the training set.
[0108] It should be noted that step S220 above can perform data augmentation on the labeled data using an asymmetric random cropping algorithm, generating multi-scale samples of [512×512, 1024×768] that retain the boundary regions. Specifically, the asymmetric random cropping algorithm can crop the image at different scales while maintaining the integrity of the image content, to simulate water level scenes at different viewpoints and resolutions. In this way, the diversity of the training dataset can be expanded, allowing the model to be exposed to more diverse image features during training, thereby improving the model's adaptability to different scales and complex scenes. The expanded training data is used to train the water level segmentation model on the central server, enabling it to better cope with various situations in real-world applications, ultimately achieving efficient deployment at the edge.
[0109] Step S230: Train the water level segmentation model using the data augmentation-processed training set to obtain the trained water level segmentation model.
[0110] It should be noted that the training loss function of the above water level segmentation model... It can be designed as:
[0111]
[0112]
[0113]
[0114] in, For semantic segmentation loss; The height of the image; The width of the image; The number of segmentation categories represents the number of water level categories that the model needs to distinguish. For position This belongs to the category The actual label value (0 or 1); The segmentation result predicted by the model at the location This belongs to the category The probability value;
[0115] For boundary detection loss; For position The weight values at each location can be used to adjust the loss contribution at different locations (e.g., dynamically adjusting weights through hard example mining). For position The boundary true label (0 or 1); The boundary heatmap predicted by the model at location The value at that position represents the probability that the position belongs to the boundary.
[0116] Furthermore, the aforementioned 0.7 and 0.3 represent semantic segmentation losses, respectively. and boundary detection loss The weighting coefficients can be used to characterize the relative importance of the loss term in the total loss.
[0117] Step S240: Deploy the trained water level segmentation model to an edge computing device, so that the edge computing device can use the trained water level segmentation model to extract real-time water level segmentation values from real-time images; and obtain real-time water level scalar values of the monitored water area; wherein the real-time water level scalar values are collected by at least one water level sensor deployed in the monitored water area; based on the real-time water level segmentation values, historical water level segmentation values, real-time water level scalar values, and historical water level scalar values, determine the risk index of the monitored water area; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area; and conduct water level early warning based on the risk index.
[0118] Please see Figure 4 Based on the same inventive concept, embodiments of the present invention also provide a water level early warning system 300, which includes: a central server 310 and at least one edge computing device 320 communicatively connected to the central server 310, wherein:
[0119] The central server 310 is used to acquire the training set of the water level segmentation model; perform data augmentation processing on the training set; train the water level segmentation model using the data augmentation training set to obtain the trained water level segmentation model; and deploy the trained water level segmentation model to the edge computing device 320.
[0120] Edge computing device 320 is used to acquire real-time images of the monitored water area; extract real-time water level segmentation values from the real-time images using a pre-trained water level segmentation model; acquire real-time water level scalar values of the monitored water area; wherein the real-time water level scalar values are collected by at least one water level sensor deployed in the monitored water area; determine a risk index of the monitored water area based on the real-time water level segmentation values, historical water level segmentation values, real-time water level scalar values, and historical water level scalar values; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area; and conduct water level early warning based on the risk index.
[0121] It should be noted that the aforementioned edge computing device 320 refers to a device that performs data processing and analysis at the edge location, close to the data source or data usage point. They can preprocess, analyze, and filter data, reducing latency and bandwidth requirements for data transmission to the cloud or central data center. In a water level monitoring system, edge computing devices can be industrial control computers, embedded computers, single-board computers, programmable logic controllers (PLCs), and smart cameras, etc.
[0122] The above description is merely an embodiment of the present invention and is not intended to limit the scope of protection of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A water level early warning method, characterized in that, Applied to edge computing devices, the method includes: Acquire real-time images of the monitored water area; Using a pre-trained water level segmentation model, real-time water level segmentation values are extracted from the real-time image. The real-time water level scalar value of the monitored water area is obtained; wherein the real-time water level scalar value is collected by at least one water level sensor deployed in the monitored water area; Based on the real-time water level segmentation value, the historical water level segmentation value, the real-time water level scalar value, and the historical water level scalar value, a risk index for the monitored water area is determined; wherein, the risk index is used to characterize the degree of water level anomaly in the monitored water area. Water level warnings are issued based on the aforementioned risk index.
2. The water level early warning method according to claim 1, characterized in that, The pre-trained water level segmentation model includes: an input layer, a backbone network, an integral branch, a differential branch, a boundary-guided semantic enhancement module, and an output layer; the input terminals of the backbone network and the differential branch are respectively connected to the input layer; the output terminal of the backbone network is connected to the input terminal of the integral branch; the output terminals of the integral branch and the differential branch are respectively connected to the input terminal of the boundary-guided semantic enhancement module; the output terminal of the boundary-guided semantic enhancement module is connected to the output layer. The step of extracting real-time water level segmentation values from the real-time image using a pre-trained water level segmentation model includes: The real-time image is input into the input layer of the pre-trained water level segmentation model; The real-time image from the input layer is input into the backbone network to obtain multi-scale feature maps. The multi-scale feature map output by the backbone network is input into the integral branch to obtain the initial segmentation result; The real-time image of the input layer is input into the boundary response main path of the differential branch to obtain the boundary heat map; The real-time image from the input layer is input into the detail-preserving auxiliary path of the differential branch to obtain a detail-enhanced feature map. The initial segmentation result, the boundary heatmap, and the detail enhancement feature map are input into the boundary-guided semantic enhancement module to obtain the real-time water level segmentation value.
3. The water level early warning method according to claim 2, characterized in that, The backbone network includes a first lightweight residual module, a second lightweight residual module, and a lightweight pixel enhancement module. The lightweight pixel enhancement module is disposed at the residual connection end of the first lightweight residual module and the second lightweight residual module. The step of inputting the real-time image from the input layer into the backbone network to obtain multi-scale feature maps includes: The real-time image of the input layer is input into the first lightweight residual module of the backbone network to obtain the first residual feature map; The first residual feature map is input into the second lightweight residual module to obtain the second residual feature map; The second residual feature map is input into the lightweight pixel enhancement module to obtain a multi-scale feature map.
4. The water level early warning method according to claim 2, characterized in that, The integral branch includes a first downsampling module, a second downsampling module, a three-level parallel pooling module, and a segmentation head connected in sequence. The step of inputting the multi-scale feature map output by the backbone network into the integral branch to obtain the initial segmentation result includes: The multi-scale feature map output by the backbone network is input into the first downsampling module in the integral branch to obtain the first downsampling feature map; The first downsampled feature map is input into the second downsampled module to obtain the second downsampled feature map; The second downsampled feature map is input into the three-level parallel pooling module to obtain a multi-scale context fusion feature map; The multi-scale context fusion feature map is input into the segmentation head to obtain the initial segmentation result.
5. The water level early warning method according to claim 2, characterized in that, The boundary response main path in the differential branch includes a first depthwise separable convolution module, a pointwise convolution module, and an activation module connected in sequence; the detail-preserving auxiliary path includes a second depthwise separable convolution module, a coordinate attention module, and a bilinear upsampling module connected in sequence. The step of inputting the real-time image of the input layer into the boundary response main path of the differential branch to obtain the boundary heatmap includes: The real-time image of the input layer is input into the first depthwise separable convolutional module of the boundary response main path to obtain the first spatial detail feature map; The first spatial detail feature map is input into the pointwise convolution module to obtain a single-channel boundary feature map. The single-channel boundary feature map is input into the activation module to obtain the boundary heat map; The step of inputting the real-time image from the input layer into the detail-preserving auxiliary path of the differential branch to obtain a detail-enhanced feature map includes: The real-time image of the input layer is input into the second depthwise separable convolutional module of the detail-preserving auxiliary path to obtain a second spatial detail feature map; The second spatial detail feature map is input into the coordinate attention module to obtain a detail feature map after spatial position weighting. The detailed feature map is input into the bilinear upsampling module to obtain a detailed enhancement feature map.
6. The water level early warning method according to any one of claims 1 to 5, characterized in that, The determination of the risk index of the monitored water area based on the real-time water level segmentation value, the historical water level segmentation value, the real-time water level scalar value, and the historical water level scalar value includes: Based on historical water level segmentation values, the probability density distribution of each extreme water level value in the monitored water area is obtained; In the probability density distribution, determine the water level value corresponding to the preset probability density, and obtain the dynamic threshold; Determine the degree of deviation between the real-time water level segment value and the mean of the historical water level segment value, as well as the severity index of the deviation relative to the dynamic threshold; Based on the data difference and time difference between the real-time water level scalar value and the historical water level scalar value within a preset time period, the average sensor data change rate of each water level sensor is determined. Determine the average of the average rate of change of the sensor data from all the water level sensors; The risk index of the monitored water area is determined based on the average of the deviation severity index and the mean of the sensor data change rate.
7. The water level early warning method according to claim 6, characterized in that, The determination of the risk index of the monitored water area based on the average of the deviation severity index and the mean of the sensor data change rate includes: Based on the severity of water level changes in the monitored water area, a first adaptive weight for the severity of deviation index and a second adaptive weight for the average of the mean change rates of the sensor data are obtained; wherein, the first adaptive weight is inversely proportional to the severity of water level changes in the monitored water area; and the second adaptive weight is directly proportional to the severity of water level changes in the monitored water area. Based on the first adaptive weight and the second adaptive weight, the average of the deviation severity index and the mean of the sensor data change rate is weighted and summed to obtain the risk index of the monitored water area.
8. The water level early warning method according to claim 6, characterized in that, The water level warning based on the risk index includes: If the real-time water level segmentation value is greater than the average of the historical water level segmentation values, and the risk index is within a first preset range, then high-frame-rate monitoring will be performed on the preset high-risk areas in the monitored water area. If the real-time water level segment value and the historical water level segment value within the near preset time period are both not less than the dynamic threshold, and the risk index is within the second preset range, then cross-modal verification is performed on the real-time water level segment value and the real-time water level scalar value, and a water level warning is issued based on the verification result. If the risk index is greater than the third preset range, a water level warning will be issued directly. The cross-modal verification of the real-time water level segment value and the real-time water level scalar value includes: Spatially align the real-time water level segment value and the real-time water level scalar value to obtain the alignment error; If the alignment error is greater than a preset error threshold, then manual verification or drone inspection will be performed.
9. A water level early warning method, characterized in that, Applied to a central server, the method includes: Obtain the training set for the water level segmentation model; Perform data augmentation processing on the training set; The water level segmentation model is trained using the training set after data augmentation to obtain the trained water level segmentation model. The trained water level segmentation model is deployed to an edge computing device, enabling the edge computing device to extract real-time water level segmentation values from real-time images using the trained water level segmentation model; and to obtain real-time water level scalar values of the monitored water area; wherein the real-time water level scalar values are collected by at least one water level sensor deployed in the monitored water area; based on the real-time water level segmentation values, historical water level segmentation values, the real-time water level scalar values, and historical water level scalar values, a risk index for the monitored water area is determined; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area; and based on the risk index, a water level early warning is issued.
10. A water level early warning system, characterized in that, It includes a central server and at least one edge computing device communicatively connected to the central server, wherein: The central server is used to acquire the training set of the water level segmentation model; perform data augmentation processing on the training set; train the water level segmentation model using the data augmentation-processed training set to obtain the trained water level segmentation model; and deploy the trained water level segmentation model to the edge computing device. The edge computing device is used to acquire real-time images of the monitored water area; extract real-time water level segmentation values from the real-time images using the pre-trained water level segmentation model; acquire real-time water level scalar values of the monitored water area; wherein the real-time water level scalar values are collected by at least one water level sensor deployed in the monitored water area; and determine a risk index of the monitored water area based on the real-time water level segmentation values, historical water level segmentation values, the real-time water level scalar values, and historical water level scalar values; wherein the risk index is used to characterize the degree of water level anomaly in the monitored water area. Water level warnings are issued based on the aforementioned risk index.