Water level early warning method and system and computer medium
Image transformation is carried out through SIFT feature extraction and feature matching, and water surface segmentation is combined with DeepLabV3Plus_ResNet50 neural network, which solves the applicability and image alignment problems of existing water level monitoring and early warning systems in actual scenarios, real-time, accurate monitoring and timely early warning of water level changes.
Patent Information
- Application Number
- CN202510655165.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-06-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing water level monitoring and early warning system cannot be widely used in most practical scenarios for common river and lake water level monitoring scenarios, and cameras with fixed viewing angles and fixed focal lengths are prone to image alignment problems when installed incorrectly, resulting in position deviation of the warning line, which in turn affects the accuracy of early warning judgment.
Image transformation is performed using SIFT feature extraction and feature matching to achieve image alignment, and combined with DeepLabV3Plus_ResNet50 neural network for water surface segmentation, analyzing the relationship between the water segmentation mask image and the warning water level line for early warning.
Real-time and accurate monitoring of water level changes, and timely warnings are issued, improving the reliability and timeliness of early warnings, and is suitable for a variety of camera installation situations.
Smart Images

Figure CN120182919A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the technical field of water level warning, and particularly relates to a water level warning method, system and computer medium. Background Art
[0002] Currently, there are mainly three means for water level monitoring and warning: First, manually read and record the readings of the hydrological scale at regular intervals. This method requires a large amount of manpower and the hydrological scale as an auxiliary; Second, using high-precision sensor technologies such as ultrasonic sensors, laser rangefinders or pressure sensors, etc., which can accurately measure the water level height. This method not only improves the accuracy and real-time nature of the data, but also has characteristics such as waterproof and dustproof, ensuring stable operation even under bad weather and complex environmental conditions, but the equipment needs to be installed directly above the monitored river or lake water body; Third, through devices such as high-definition cameras, infrared thermal imagers, night vision cameras, etc., to achieve real-time monitoring of the water area, and combine image analysis technology to judge water level anomalies and trigger alarms; The water level monitoring and warning system based on video monitoring uses image processing technology to analyze and process the collected video images and issue warnings according to the water level information, mainly including water area boundary detection methods, hydrological scale detection and reading recognition methods, etc.; The water area boundary detection method generally uses edge detection and image segmentation algorithms to detect the water body area at the pixel level, including foreground extraction algorithms, FCN networks, DeepLabV3 networks, etc. After completing the water area boundary detection, warning water level information can be obtained by means such as setting reference targets, warning lines, virtual water level scales, etc.; This method does not require the assistance of a water level scale and relies on the user to set a virtual water level line to assist in realizing water level warning. Usually, the camera lens needs to be fixed (position and focal length fixed) and the camera has no jitter to obtain more accurate results. The hydrological scale reading recognition method generally uses object detection algorithms such as SSD networks and YOLO networks to detect the water scale and then recognize the water scale reading to obtain the water level information; This method can accurately obtain the water level information, but it requires the assistance of a water level scale and has certain requirements for the installation position of the camera; Water level monitoring and warning systems based on video images often rely on specific targets (such as riverbanks, floating objects, water level gauges, etc.) to achieve water level monitoring. In most practical scenarios, these targets in river and lake waters do not exist and vary greatly, and these methods cannot be generally applied to common river and lake water level monitoring scenarios. Additionally, most of the known systems use dedicated cameras with fixed perspectives and fixed focal lengths, and the jitter and movement of the images are not obvious. However, for cameras shared and used at high points on iron towers, the PTZ cumulative error caused by preset position switching and the image alignment problem caused by camera jitter cannot be ignored. This problem will lead to a serious position deviation of the warning line set by users, resulting in serious errors in warning judgment. Finally, the performance of the water area segmentation algorithm depends on the model design of the algorithm, the quantity, diversity, and quality of the training data. The known systems mostly use models such as UNet and DeepLabV3, and the diversity of the training data is also insufficient, which will lead to insufficient segmentation accuracy of the algorithm, poor generalization ability, and low adaptability. Summary of the Invention
[0003] To solve the above problems, the present disclosure provides a water level warning method, system, and computer medium. It uses SIFT feature extraction and feature matching to perform image transformation to achieve image alignment, combines a neural network for water surface segmentation, and conducts warnings by analyzing the relationship between the water area segmentation mask image and the warning water level line, capable of monitoring water level changes in real time and accurately and issuing warnings in a timely manner, improving the reliability and timeliness of warnings.
[0004] The following are the technical details of the present disclosure: A water level warning method, characterized by comprising: Obtain an image of the monitored water area, set a warning water level line and a water level rising reference direction in the image as a template image; Obtain an image of the monitored water area, perform SIFT feature extraction and feature matching with the template image, and perform image transformation according to the matching result; the image transformation aligns the image coordinates of the obtained monitored water area to the template image; Input the transformed image into a neural network for water surface segmentation, and output a water area segmentation mask image; Conduct water level position warnings according to the relationship between the water area segmentation mask image and the water level warning point where the warning water level line intersects with the water level rising direction.
[0005] Furthermore, The warning water level line is set on non-water area targets, including: Riverbanks, bridge piers, water level gauges, riverside buildings, tree trunks.
[0006] Furthermore, The neural network for water surface segmentation is the DeepLabV3Plus_ResNet50 network; In the decoder module of the DeepLabV3Plus_ResNet50 network, the fused features obtained after each feature fusion are input into a convolutional block attention module to output an attention map; The convolutional block attention module is used to calculate the attention map from two different dimensions: channel and space.
[0007] Furthermore, After outputting the water area segmentation mask image, morphological operations are performed on the obtained mask, including: Using the opening operation to remove small-scale misidentifications in the water area segmentation mask image, and then using the closing operation to fill the gaps in the image to obtain the water area segmentation mask image after morphological operations.
[0008] Furthermore, The water level position warning based on the relationship between the water area segmentation mask image and the water level warning points where the warning water level line intersects with the water level rising direction includes: If the water level warning point is located inside the water body mask, a water level position warning is issued.
[0009] Furthermore, It also includes: calculating the change amount of the water area segmentation mask in the water level rising direction as a reference for the water level rising speed, and if the change amount exceeds the threshold, triggering a water level rising speed warning.
[0010] A water level warning system, characterized by including: A data acquisition module, used to acquire images of the monitored water area, set a warning water level line and a water level rising reference direction in the image as a template image; A detection module, used to acquire images of the monitored water area, perform SIFT feature extraction and feature matching with the template image, and perform image transformation according to the matching result; the image transformation aligns the coordinates of the acquired monitored water area image to the template image; A water area segmentation module, used to input the transformed image into a neural network for water surface segmentation and output a water area segmentation mask image; A warning module, used to perform water level position warning according to the relationship between the water area segmentation mask image and the water level warning points where the warning water level line intersects with the water level rising direction.
[0011] Furthermore, In the water area segmentation module, the neural network for water surface segmentation is the DeepLabV3Plus_ResNet50 network; In the decoder module of the DeepLabV3Plus_ResNet50 network, the fused features obtained after each feature fusion are input into a convolutional block attention module to output an attention map. The convolutional block attention module is used to infer the attention map from two different dimensions: channel and space.
[0012] Furthermore, In the Encoder module of the DeepLabV3Plus_ResNet50 network, the minimum scale of the output feature map is selected as 1 / 16.
[0013] A computer storage medium stores executable instructions, which when executed by a processor cause the processor to implement the method described above.
[0014] Compared with the prior art, the present disclosure has the following advantages: This algorithm analyzes the collected images and issues a water level warning based on the water level line and the water level rising direction set by the user at any position on the template image. It supports the user to set multiple water level lines and water level rising directions in one image, and has low requirements for the installation and shooting direction of the camera, as long as the water surface and the reference background can be photographed. When the water level line and the water level rising direction set by the user shift or scale in the image, the water level warning point where they intersect will deviate from the originally set position in the image. By using SIFT feature extraction and feature matching, and performing image transformation based on the matching results to achieve image alignment, the problem of deviation of the water level line and the water level rising direction set by the user can be solved.
[0015] Other features and advantages of the present disclosure will be described in the subsequent specification, and some of them will become obvious from the specification, or be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure can be achieved and obtained through the structures pointed out in the specification, claims, and drawings. Brief Description of the Drawings
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 Shows a schematic diagram of the method of the present disclosure; Figure 2 Shows a schematic diagram of the operation logic of the present disclosure. Detailed Embodiments
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts belong to the scope of protection of the present disclosure.
[0019] Figure 1 shows a schematic diagram of the method according to the present disclosure, as Figure 2 shows a schematic diagram of the operation logic of the present disclosure. The specific implementation details of the present disclosure include: Step 1: Use a monitoring camera installed near the river or lake water area to collect template images. (An early warning water level line and a reference direction for water level rise are set on the template image) Among them, the early warning water level line can be set on any target in the non-water area (such as riverbanks, bridge piers, water level gauges, riverside buildings, tree trunks, etc.) The reference direction for water level rise is generally perpendicular to the early warning water level line, and the intersection point of the two is the water level monitoring warning point.
[0020] Step 2: Collect a large number of river and lake monitoring images in different scenarios, use annotation tools to trace the water surface area in the images, and obtain a mask of the water body area. These data will be used to train a convolutional neural network for water surface segmentation; Step 3: Design an improved DeepLabV3Plus network. The network structure is mainly designed as follows: ① The overall network architecture adopts DeepLabV3Plus_ResNet50, and no structural optimization is performed on the Encoder part; ② In the network decoder (Decoder) module, a convolutional block attention module (CBAM module) is added after each feature fusion, so that the fused features can infer the attention map from two different dimensions of channels and space, thereby performing adaptive feature refinement; ③ The minimum scale of the feature map output by the Encoder module is selected as 1 / 16 to achieve a balance between segmentation accuracy and calculation speed; (This improved DeepLabV3Plus image semantic segmentation network can perform pixel-level segmentation on the water area in the image) Among them, the Encoder module includes: a convolutional layer (Atrous Conv), which is used to perform convolutional operations by sliding a convolutional kernel on the image to extract local features in the image and output a feature map; A pooling layer, which is used to reduce the resolution of the feature map, reduce the amount of data, and retain important features to a certain extent; A normalization layer: which is used to normalize the input data.
[0021] The Encoder module adopts residual connections to solve the problems of vanishing gradients and exploding gradients in deep networks.
[0022] The Decoder module includes: A feature fusion layer for fusing different-level features output by the Encoder, combining the detailed information of shallow features and the semantic information of deep features, and outputting a fused feature map; A Convolutional Block Attention Module (CBAM module) for adaptively refining features in the channel and spatial dimensions after feature fusion, enhancing the expression of important features and suppressing the responses of unimportant features; An upsampling layer for gradually restoring the resolution of the feature map to match the size of the original input image and outputting a high-resolution feature map; A convolutional layer for further feature extraction and feature transformation of the feature map processed by the upsampling and CBAM modules, and outputting the final segmentation result; A normalization layer (such as Batch Normalization) for normalizing the feature map output by the convolutional layer.
[0023] The CBAM module includes: A channel attention module for weighting the channel dimension of the feature map, enhancing the feature expression of important channels and suppressing the feature responses of unimportant channels; A spatial attention module for weighting the spatial dimension of the feature map, focusing on important spatial regions in the feature map, and enhancing the feature expression ability.
[0024] Among them, the channel attention module includes: A global average pooling layer for performing average pooling on the input feature map in the spatial dimension, compressing the feature map into a vector in the channel dimension, and obtaining global channel information; A global max pooling layer for performing max pooling on the input feature map in the spatial dimension, compressing the feature map into a vector in the channel dimension, and obtaining the maximum response information of each channel in the feature map; A Multi-Layer Perceptron (MLP) for performing non-linear transformation on the channel vectors obtained by global average pooling and global max pooling, and learning the dependency relationships between channels; A Sigmoid activation function for mapping the output of the MLP to the interval [0, 1], generating a channel attention map, and weighting the channel dimension of the input feature map.
[0025] The spatial attention module includes: Average pooling and max pooling in the channel dimension are used to perform average pooling and max pooling on the input feature map in the channel dimension to obtain feature maps in two spatial dimensions; A concatenation operation is used to concatenate the two feature maps in the spatial dimensions obtained by average pooling and max pooling in the channel dimension in the channel dimension; A convolutional layer is used to perform a convolution operation on the concatenated feature map to extract spatial features; A Sigmoid activation function is used to map the output of the convolutional layer to the interval [0, 1] to generate a spatial attention map and weight the spatial dimension of the input feature map.
[0026] Word explanations: Encoder: Encoder; conv: Convolution; Decoder: Decoder; CBAM: Attention module.
[0027] Step 4: Use the collected and labeled data to train the network designed in Step 3 and save the trained network parameters.
[0028] Step 5: For the subsequently collected image data, perform SIFT feature extraction and feature matching with the template image collected in Step 1, and perform image transformation according to the matching result to align the image coordinates to the template image (eliminating the position deviation caused by image shift and scaling).
[0029] Specifically: SIFT feature extraction: The SIFT algorithm will detect key points in the image and generate a unique feature descriptor for each key point.
[0030] Feature matching: Use the generated feature descriptors to perform matching between the feature points of the on-site image and the template image. By calculating the distance between the feature descriptors (such as the Euclidean distance), find the most similar feature point pairs and determine the positional relationship of the corresponding features in the two images.
[0031] Image transformation: According to the feature matching result, calculate the transformation matrix of the on-site image relative to the template image. Use the transformation matrix to perform a geometric transformation on the on-site image to align the on-site image with the template image in space, thereby solving the problems of image offset and scaling caused by changes in the camera position and angle, and ensuring that the position of the warning water level line is relatively consistent in the two images.
[0032] Step 6: Input the image transformed in Step 5 into the neural network in Step 4 to obtain the water area segmentation mask in the image, and at the same time perform morphological operations on the obtained mask. Here, first perform an opening operation to remove small-scale misidentifications and then perform a closing operation to fill small gaps to obtain more accurate water body mask information; (Morphological operations can better ensure the continuity and consistency of the segmentation results) Step 7: Determine whether to issue a water level position warning based on the relative position relationship between the water level warning point where the warning water level line intersects with the water level rising direction and the water body mask; If the water level warning point is located inside the water body mask, it indicates that the water level has exceeded the warning point, and at this time, a water level position warning is issued; Step 8: According to the water area segmentation masks at different times, calculate the change amount of the water area mask in the water level rising direction as a reference for the water level rising speed. If the calculated value exceeds the warning value set by the user, trigger a water level rising speed warning. (According to the set water level rising direction and the segmented water area mask, calculate the water level rising speed to provide an additional indicator for water level warning) Based on the method of the present disclosure, the embodiments of the present disclosure further provide a system corresponding to the above method, which includes: A data acquisition module, configured to acquire an image of the monitored water area, and set a warning water level line and a water level rising reference direction in the image as a template image; A detection module, configured to acquire an image of the monitored water area, perform SIFT feature extraction and feature matching with the template image, and perform image transformation according to the matching result; the image transformation aligns the image coordinates of the acquired monitored water area image to the template image; A water area segmentation module, configured to input the transformed image into a neural network for water surface segmentation, and output a water area segmentation mask image; A warning module, configured to perform a water level position warning according to the relationship between the water area segmentation mask image and the water level warning point where the warning water level line intersects with the water level rising direction.
[0033] Based on the same inventive concept, the present disclosure also provides a computer storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor implements the above method.
[0034] Although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A water level early warning method, characterized in that: include: Obtain an image of the monitored water area, set the warning water level line and the reference direction of water level rise in the image as a template image; Acquire an image of the monitored water area, perform SIFT feature extraction and feature matching with the template image, and perform image transformation according to the matching result; the image transformation enables the acquired image coordinates of the monitored water area to be aligned with the template image; The transformed image is input into a neural network for water surface segmentation, and a water surface segmentation mask image is output; Water level position warning is carried out according to the relationship between the water area segmentation mask image and the water level warning point where the warning water level line intersects with the water level rising direction.
2. The water level early warning method according to claim 1, characterized in that: The warning water level line is set on the non-water area target, including: River banks, bridge piers, water level gauges, riverside buildings, and tree trunks.
3. The water level early warning method according to claim 1, characterized in that: The neural network used for water surface segmentation is DeepLabV3Plus_ResNet50 network; In the decoder module of the DeepLabV3Plus_ResNet50 network, the fused features obtained after each feature fusion are input into a convolutional block attention module, and an attention map is output; The convolutional block attention module is used to infer the attention map from two different dimensions: channel and space.
4. The water level early warning method according to claim 1, characterized in that: After outputting the water segmentation mask image, morphological operations are performed on the obtained mask, including: After using the opening operation to remove small-scale misidentification in the water segmentation mask image, the closing operation is used to fill the gaps in the image to obtain the water segmentation mask image after morphological operation.
5. The water level early warning method according to claim 1, characterized in that: The water level position warning is performed according to the relationship between the water area segmentation mask image and the water level warning point where the warning water level line intersects with the water level rising direction, including: If the water level warning point is located inside the water body mask, a water level position warning is issued.
6. The water level early warning method according to claim 1, characterized in that: Also includes: The change of the water segmentation mask in the direction of water level rise is calculated as a reference for the water level rise speed. If the change exceeds the threshold, a water level rise speed warning is triggered.
7. A water level early warning system, characterized in that: include: A data acquisition module is used to acquire an image of the monitored water area, and set a warning water level line and a reference direction of water level rise in the image as a template image; A detection module, used to obtain an image of the monitored water area, perform SIFT feature extraction and feature matching with the template image, and perform image transformation according to the matching result; the image transformation aligns the coordinates of the acquired image of the monitored water area with the template image; A water segmentation module, used for inputting the transformed image into a neural network for water surface segmentation and outputting a water segmentation mask image; The early warning module is used to issue a water level position early warning based on the relationship between the water area segmentation mask image and the water level warning point where the early warning water level line intersects with the water level rising direction.
8. The water level warning system according to claim 7, characterized in that: In the water segmentation module, the neural network used for water surface segmentation is the DeepLabV3Plus_ResNet50 network; In the decoder module of the DeepLabV3Plus_ResNet50 network, the fused features obtained after each feature fusion are input into a convolutional block attention module, and an attention map is output; The convolutional block attention module is used to infer the attention map from two different dimensions: channel and space.
9. The water level warning system according to claim 8, characterized in that: In the Encoder module of the DeepLabV3Plus_ResNet50 network, the minimum scale of the output feature map is selected as 1 / 16.
10. A computer storage medium having executable instructions stored thereon, wherein when the instructions are executed by a processor, the processor is enabled to implement the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Water level early warning monitoring method, device and equipment based on video stream image segmentation
CN116129355A
Method, system and equipment for identifying water level with scale and storage medium
CN117011319A
Water gauge-free water level identification method and device
CN117437519A
Video monitoring overflow identification method and system based on deep learning
CN119007093A