Intelligent water conservancy image processing method and system
By using deep learning and temporal convolutional networks to process water conservancy images, the problem of inaccurate segmentation of features with similar gray values in water areas in complex environments has been solved, achieving high-precision water area monitoring and water level prediction, and improving the accuracy and timeliness of water conservancy image processing.
Patent Information
- Application Number
- CN202511734935.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2025-12-23
AI Technical Summary
Existing smart water conservancy image processing methods cannot effectively distinguish ground features with similar gray values to water bodies in complex environments, leading to missed or false detections in the segmentation results, which makes it difficult to meet the needs of high-precision water body monitoring.
A deep belief network is used to process water conservancy image sub-blocks, water area image sub-blocks are selected based on terrain features, and a semantic segmentation model for water conservancy images is constructed through deep learning algorithms. Water level prediction is performed by combining a temporal convolutional network model, and graded early warning is performed using terrain and water area similarity and real-time meteorological data.
It significantly reduced the false negative rate and the number of false positives, improved the accuracy and scene adaptability of water area contour extraction, enhanced the model's segmentation robustness and anti-interference ability in complex environments, and improved the accuracy of water level prediction and the timeliness of early warning.
Smart Images

Figure CN121190772A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a smart water conservancy image processing method and system. BACKGROUND
[0002] With the intensification of global climate change and the highlighting of the contradiction between water supply and demand, smart water conservancy construction has become the core direction of improving water resources regulation capacity and preventing water and flood disasters. At present, remote sensing technology has been widely used in water area monitoring, terrain analysis and other scenes in the field of water conservancy due to its wide range, high timeliness and multi-dimensional observation advantages. Through processing of remote sensing images, key requirements such as water area range identification and water level change tracking can be realized to provide data support for water conservancy decision-making. Under this background, how to accurately extract water area features from massive remote sensing data and efficiently analyze the change law of terrain and water area has become the core goal of the development of smart water conservancy image processing technology.
[0003] In the existing smart water conservancy image processing method, a threshold segmentation method based on RGB image is often used. This method first acquires the RGB remote sensing image of the target area, sets a fixed gray threshold through statistical analysis, and judges the pixels with a gray value lower than the threshold as water area and the pixels with a gray value higher than the threshold as land in the image. Then, the water area boundary is extracted through an edge detection algorithm, and finally the water area contour is obtained to provide basic data for subsequent water area change analysis. However, the threshold segmentation method based on RGB image excessively relies on the gray information of the image and cannot effectively distinguish the ground objects with similar gray values to the water area in complex environments, resulting in the problem that the segmentation result is prone to missed detection or false detection, which makes the extracted water area contour deviate from the actual terrain and is difficult to meet the demand of smart water conservancy for high-precision water area monitoring. SUMMARY
[0004] In view of the deficiencies of the prior art, the present application provides a smart water conservancy image processing method and system, which solves the problem that the ground objects with similar gray values to the water area in complex environments cannot be effectively distinguished, resulting in the problem that the segmentation result is prone to missed detection or false detection.
[0005] To achieve the above purpose, the present application realizes the following technical scheme: a smart water conservancy image processing method and system, comprising the following steps: Step S1: acquiring a water conservancy remote sensing image and dividing it into water conservancy image subblocks of a predetermined size, processing the water conservancy image subblocks through a deep belief network to obtain terrain features, and screening out water area image subblocks based on the terrain features; Step S2: obtaining a to-be-detected water area image based on the water area image sub-block, constructing a water conservancy image semantic segmentation model based on a deep learning algorithm, inputting the to-be-detected water area image into the water conservancy image semantic segmentation model, outputting a real-time water area image semantic segmentation result, and calculating a real-time terrain water area contour based on the real-time water area image semantic segmentation result; Step S3: obtaining a historical image set based on the water area image sub-block, inputting the historical image set into the water conservancy image semantic segmentation model, outputting a historical water area image semantic segmentation result, and calculating a template terrain water area contour based on the historical water area image semantic segmentation result; Step S4: calculating a terrain water area similarity based on the real-time terrain water area contour and the template terrain water area contour, comparing the terrain water area similarity with a preset threshold, and obtaining real-time water level data and real-time meteorological data when the terrain water area similarity is less than the preset threshold; Step S5: constructing a water level prediction model based on a time convolution network model, inputting the real-time water level data and the real-time meteorological data into the water level prediction model, outputting a water level prediction result, and performing hierarchical early warning based on the water level prediction result.
[0006] Preferably, the water conservancy remote sensing image is obtained and divided into water conservancy image sub-blocks of a preset size, and the water conservancy image sub-blocks are processed by a deep belief network to obtain terrain features, including: The water conservancy remote sensing image is obtained, and then preprocessed, divided into a plurality of water conservancy image sub-blocks each having a first preset pixel length and a second preset pixel width, so as to standardize the data input and improve the subsequent processing efficiency; After successfully dividing the water conservancy image sub-blocks, the core processing link is to extract and deeply analyze the hyperspectral data of each water conservancy image sub-block. The hyperspectral data is different from the ordinary RGB image, each pixel point of which records the spectral information of dozens to hundreds of continuous narrow wave bands from visible light to infrared light, thereby forming a three-dimensional data cube. The extraction process is to analyze these continuous spectral band data from each water conservancy image sub-block; Then, the hyperspectral data of each water conservancy image sub-block is extracted to form a three-dimensional data cube. The hyperspectral data is input into a pre-trained deep belief network (DBN) model. The DBN model is constructed for the purpose of terrain feature extraction, and is pre-trained and fine-tuned on a large number of hyperspectral sample libraries containing various typical terrains. The DBN model can automatically learn and output a probability distribution vector representing the terrain features from the input hyperspectral data. The terrain features output by the network are not specific classification labels, but a multi-dimensional feature vector. The value of each dimension in the vector represents the confidence probability that the content of the water conservancy image sub-block belongs to a specific terrain category. These probability values are computed by the Softmax activation function of the last layer of the network, whose mathematical expression is: ; ; where, is the raw score computed by the DBN network for the i-th terrain class before inputting into the Softmax layer; is the activation value vector of the L-th hidden layer, which is the last hidden layer of the DBN network, and this vector is the final high-level feature representation of the input hyperspectral data after all the nonlinear transformations of the previous hidden layers; is a weight vector connecting the last hidden layer to the p-th neuron of the output layer, which is learned during the training of the network; T is the matrix transpose; is the bias term of the p-th neuron of the output layer; denotes the dot product of the vectors and ; is the raw score computed by the DBN network for the j-th class, where j is the traversal index, which traverses from 1 to K, representing all the terrain classes; is the predicted probability that the current water image sub-block belongs to the i-th terrain class; K is the total number of terrain classes; e is the natural constant, and the aforementioned Softmax activation function formula has the effect of converting the raw score into a probability distribution whose sum of all class probabilities is 1, thereby obtaining the confidence of each class.
[0007] Preferably, the water area image sub-block is screened based on the terrain feature, comprising: Based on the terrain feature probability vector output by the deep belief network, the process enters the key screening stage; the feature vector corresponding to each water image sub-block is input into a pre-trained binary classifier for decision-making; The decision logic of the classifier is based on the confidence probability of the water area feature in the feature vector, and the preset rules are as follows: Set a decision threshold When the confidence P(water) of the water area class satisfies P(water)≥ , it is determined that the water image sub-block “has water area”; otherwise, when P(water) , it is determined as “not having water area”.
[0008] Preferably, the water area image to be detected is obtained based on a water area image sub-block, a water conservancy image semantic segmentation model is constructed based on a deep learning algorithm, the water area image to be detected is input into the water conservancy image semantic segmentation model, and a real-time water area image semantic segmentation result is output. Based on the spatial coordinates of the water area image sub-block obtained in step S1, the original RGB image and the thermal infrared image of the corresponding region are extracted from the original multi-spectral remote sensing data source; at the same time, in order to enhance the capture of edge information by the model, the binary water area image sub-block output in step S1 is subjected to symmetric non-separable wavelet decomposition, and a high-frequency sub-graph is extracted therefrom. The water area image to be detected is input into the constructed water conservancy image semantic segmentation model, and the processing procedure follows an encoder-decoder structure. The encoder first extracts multi-modal features through a double-branch, and performs feature fusion by using MAFM and MFIM modules. The decoder gradually restores the feature map size to the original image size through up-sampling operation, and finally outputs a pixel-level semantic segmentation result, i.e., each pixel is assigned a predefined semantic category.
[0009] Preferably, the real-time terrain water area contour is calculated based on the real-time water area image semantic segmentation result, and includes the following steps: Based on the segmentation result, the real-time terrain water area contour is calculated, and the calculation of the real-time terrain water area contour is based on post-processing of the semantic segmentation result, including the following three steps: binaryzation, binary graph generation and contour extraction. The binaryzation process is as follows: the semantic segmentation result is subjected to binaryzation processing, and a binary graph is generated for a specific category. The binaryzation formula uses a threshold method based on the probability output of the segmentation mask, and the formula is as follows:
[0010] Wherein, represents the pixel value of position (x, y) in the binary graph; is the probability that the pixel output by the semantic segmentation model belongs to the target category; and T is a decision threshold. The binary graph generation process is as follows: the binary graph is generated by traversing all pixels of the segmentation mask and applying the above binaryzation formula. For multi-class segmentation, binaryzation is performed on the land and water categories respectively, and two independent binary graphs are generated. The contour calculation process is described as follows: Firstly, the binary graph is subjected to connected component analysis to identify all connected regions; then, a contour tracking algorithm is applied to each connected region to extract a boundary point sequence; and the contour point set represents a closed contour, wherein is the number of boundary points; and the real-time terrain water area contour obtained after this step includes a real-time land contour and a real-time water area contour .
[0011] Preferably, step S3 includes: During the historical image acquisition stage, it is necessary to select a set of historical images from the historical database that match the spatial coordinates of the water area image sub-block region determined in step S1. These historical image sets must contain RGB images and thermal infrared images of the same region to ensure that their data modality is consistent with the input requirements of step S2. These historical images should cover different time periods, seasonal changes and lighting conditions to ensure the generalization ability of the template. During the preprocessing process, in order to ensure consistency with the model input in step S2, trimodal data needs to be constructed for each historical image. For RGB images, RGB band data obtained from the historical database is used directly; for thermal infrared images, thermal infrared band data obtained from the historical database is used directly; for the preprocessing of high-frequency sub-images, the RGB bands of the historical images are generated by applying the same symmetric inseparable additive wavelet decomposition method as in step S2. After preprocessing, a set of historical images containing high-frequency sub-images is input into a trained water conservancy image semantic segmentation model. The model outputs the semantic segmentation results of historical water area images. Then, the semantic segmentation results of historical water area images are binarized to generate a template binary image. Finally, a contour tracking algorithm is used to extract standardized wheels from the template binary image, and the template land contour is named... The template water area outline is named .
[0012] Preferably, calculating the terrain-water similarity based on the real-time terrain-water contour and the template terrain-water contour includes: First, calculate land similarity. This indicator quantifies the real-time land outline. With template land outline To ensure shape consistency between the elements, the intersection-union ratio method is used, as shown in the following formula:
[0013] in, This represents the similarity between landmasses, with values ranging from 0 to 1. A higher value indicates a higher degree of similarity. and These represent the binary regions corresponding to the real-time and template land contours, respectively, and their region sizes are... The intersection is obtained by counting the number of pixels. The overlapping portion of two regions is represented by a logical AND operation; the union is used for computation. The total coverage area of the two regions is calculated using a logical OR operation. Next, the similarity of the water areas is calculated. This indicator quantifies the real-time water area profile. With template water area outline The degree of overlap between them is also determined using the intersection-union ratio formula, as follows:
[0014] in, This represents the similarity between water bodies, with values ranging from 0 to 1. and These represent binary regions representing the real-time and template water area outlines, respectively; the intersection and union are calculated in the same way as land similarity, and parameters such as region size are derived from image resolution.
[0015] Preferably, the similarity between the terrain and water area is compared with a preset threshold. When the similarity between the terrain and water area is less than the preset threshold, the acquisition of real-time water level data and real-time meteorological data includes: After obtaining land similarity Similarity to water area Subsequently, the similarity of the overall topographic and water features is assessed based on these two indicators. This similarity is not a single numerical value, but a composite criterion, which applies if and only if the land similarity... Similarity to water area All are greater than the preset threshold Only when the terrain and water area similarity meets the requirements will the subsequent data acquisition process be triggered. Water level data includes two key parameters: water level height and flow velocity. Water level height is measured in meters using pressure or ultrasonic sensors, reflecting changes in water depth. Flow velocity is acquired using current meters or Doppler radar, measured in meters per second, indicating the intensity of water flow. Meteorological data includes precipitation and temperature. Precipitation is collected in millimeters using rain gauges or weather radar, with accumulated periods ranging from hours to days. Temperature is acquired using temperature sensors, measured in degrees Celsius, and used to assess environmental thermal conditions. Real-time data acquired from the sensor network requires calibration and verification to eliminate noise interference. All data is accompanied by timestamps and location tags to ensure spatiotemporal alignment with image data.
[0016] Preferably, a water level prediction model is constructed based on a temporal convolutional network model. Real-time water level data and real-time meteorological data are input into the water level prediction model, and the output water level prediction results include: In terms of model construction, the Temporal Convolutional Network TCN-CA with integrated channel attention CA mechanism is used as the core prediction model; The lag feature is obtained as follows: The lag time of upstream and downstream water level data is analyzed using the Pearson correlation coefficient, and the calculation formula is as follows:
[0017] in, It is the Pearson correlation coefficient with a lag step size of k. The closer the absolute value is to 1, the stronger the linear correlation between the historical data at time k and the current data. This refers to the water level data at time point t. It is a point in time. Water level data; is the mean of the water level time series; k is the number of lag steps; The seasonal characteristics are obtained in the following ways: The time-series data is decomposed using the Hodrick-Prescott filter, and the trend component is extracted as a seasonal feature. The formula is as follows:
[0018] in, These are the raw observations at time point t, from... ; It is the trend component at time t, that is, the extracted seasonal features, which are obtained by fitting through an algorithm; It is the trend component at time t+1; It is the trend component at time t-1; This is a smoothing parameter, set to 100, which controls the smoothness of the trend term. The larger the value, the smoother the trend; T is the total length of the time series; The TCN-CA model is used for prediction. The core of TCN uses causal convolution and dilated convolution to process time-series data, ensuring that predictions rely solely on historical information. The formula for dilated causal convolution is:
[0019] in, It is the convolution output at time point t; It is a clean dataset after feature engineering. The feature vector at time point t comes from the feature engineering process. k is the kernel size, k=3 to better capture local temporal patterns; d is the dilation coefficient, which increases exponentially with the number of network layers l to expand the receptive field; w(i) are the kernel weight parameters, learned through training, where i is the weight index inside the kernel, an integer from 0 to k-1, establishing the correspondence between the kernel weights and specific historical time points in the input sequence; to ensure the stability of the model when processing the start position of the sequence, causal padding is performed before the input sequence is fed into the TCN-CA model; The TCN-CA model introduces a channel attention mechanism to dynamically weight feature importance, with the following formula:
[0020] in, It is the channel attention weight vector, which is a vector with dimensions [C,1], where each value represents the weight of the corresponding channel; It is the input feature map, which is the output of the previous layer in the TCN network, and its dimensions are [batch size, number of channels, time step]; It is global average pooling, which averages the values of each channel across all time steps to obtain a vector of [C,1]. It is global max pooling, which takes the maximum value of each channel at all time steps; MLP is multilayer perceptron, which performs a non-linear transformation on the pooled vector to capture the complex relationships between channels; σ is the sigmoid activation function, which compresses the input value into the range (0,1); This model uses the Adam optimizer, therefore the loss function is the mean squared error (MSE), as shown in the following formula:
[0021] in, This is the actual water level value; It is a predicted water level value; It is the number of samples; The predicted output is the water level value P at a future time point.
[0022] A smart water conservancy image processing system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.
[0023] This invention provides a smart water conservancy image processing method, which involves machine learning and deep learning technologies, and has the following beneficial effects: (1) The intelligent water conservancy image processing method, through the proposed water conservancy image semantic segmentation model based on deep learning, can capture the difference features between water and land from multiple dimensions, avoiding the problem of missed detection and false detection caused by insufficient information dimensions in traditional single-modal methods. After verification in actual water monitoring scenarios, compared with the 15% missed detection rate of traditional methods, this method significantly reduces the missed detection rate to less than 3%, and the number of false detections also decreases from an average of 5 times per week to less than 1 time per week, which fully demonstrates its significant superiority in improving the accuracy of water contour extraction and scene adaptability.
[0024] (2) This intelligent water conservancy image processing method constructs a three-channel inseparable symmetric filter bank to perform wavelet decomposition on the binarized water area image sub-blocks, which can effectively separate the low-frequency smooth component and the high-frequency edge component of the water conservancy image, highlighting the detailed features at the boundary between water and land. By using this high-frequency sub-image as an additional modality input to the water conservancy image semantic segmentation model, the water area boundary can be identified more clearly, reducing the segmentation deviation caused by edge blurring. According to actual measurements, in complex scenes containing shadows and reflections, the introduction of the high-frequency sub-image improves the edge positioning accuracy by about 40%, and the water area contour intersection-union ratio increases from 89.2% to 95.1%, effectively enhancing the model's segmentation robustness and anti-interference ability in complex environments.
[0025] (3) The intelligent water conservancy image processing method, through the water level prediction model constructed by TCN-CA, can efficiently expand the receptive field and accurately capture the long-term temporal dependence of water level data through the causal convolution and dilatation convolution structure of TCN. Experiments show that in the 72-hour water level prediction task, the root mean square error of this model is reduced by 32% compared with the traditional LSTM model, and the proportion of samples with prediction deviation less than ±5cm is increased from 70% to 92%. In the extreme water situation simulation test, the prediction response time of flood peak water level is advanced by more than 4 hours, which significantly improves the early warning timeliness and prediction accuracy of key water events.
[0026] (4) Before inputting the water level prediction model, the intelligent water conservancy image processing method uses the isolated forest algorithm for anomaly detection and processing. By calculating the anomaly score of each data point of the water level data, abnormal data can be accurately identified, and data cleaning can be achieved by reasonable filling or removal. Actual deployment data shows that the algorithm has an anomaly detection rate of more than 96% for nonlinear and nonnormally distributed water conservancy data, and the false detection rate is controlled within 3%. After the cleaned data is input into the water level prediction model, the mean square error (MSE) of the prediction results decreases by about 25%, which effectively improves the stability and reliability of the water level forecast results. Attached Figure Description
[0027] Figure 1 This is a flowchart of a smart water conservancy image processing method proposed in this invention; Figure 2 This invention proposes a smart water conservancy image processing method to obtain a hierarchical map of topographic and water area similarity; Figure 3 This is a hierarchical diagram of the water level prediction results obtained in a smart water conservancy image processing method proposed in this invention. Detailed Implementation
[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] Please see Figures 1-3 This invention provides a technical solution: a smart water conservancy image processing method and system. Specifically, the smart water conservancy image processing method and system are provided below; please refer to [link / reference]. Figure 1 The method includes the following steps: Step S1: Acquire a water conservancy remote sensing image and divide it into water conservancy image sub-blocks of a preset size. Process the water conservancy image sub-blocks through a deep belief network to obtain topographic features, and filter out water area image sub-blocks based on the topographic features.
[0030] This step begins with acquiring remote sensing images of water resources. This scheme utilizes remote sensing images to leverage their large detection range and instantaneous imaging capabilities. Subsequently, the water resources remote sensing images are preprocessed, dividing them into multiple sub-blocks with a first preset length and a second preset width. This standardizes data input and improves subsequent processing efficiency. To accurately locate each sub-block, this scheme establishes a planar coordinate system with the boundary points of the water resources remote sensing image (such as the lower left corner) as the origin, thereby determining the specific location coordinates of each sub-block within the overall image. This division and localization process lays the foundation for subsequent targeted analysis, ensuring spatial consistency in data processing.
[0031] After successfully dividing the water resources image into sub-blocks, the core processing step is to extract and perform depth analysis on hyperspectral data for each sub-block. Hyperspectral data differs from ordinary RGB images; each pixel records spectral information across dozens to hundreds of continuous narrow bands from visible to infrared light, thus forming a three-dimensional data cube. This rich spectral information gives different land features (such as water bodies, vegetation, and soil) unique spectral response curves, providing a crucial basis for accurately distinguishing terrain categories. The extraction process involves parsing these continuous spectral band data from each water resources image sub-block.
[0032] Subsequently, hyperspectral data is extracted from each sub-block of the water conservancy image to form a three-dimensional data cube. The hyperspectral data is then input into a pre-trained Deep Belief Network (DBN) model. This DBN model is specifically designed for the aforementioned terrain feature extraction purpose. By pre-training and fine-tuning on a massive hyperspectral sample database containing various typical terrains (such as water bodies, vegetation, and bare land), it can automatically learn from the input hyperspectral data and output a probability distribution vector representing terrain features.
[0033] In this scheme, the DBN network architecture is specifically designed to process hyperspectral data cubes, and mainly includes the following key components: input layer, hidden layer, RBM layer, and output layer: The dimension of the input layer directly corresponds to the number of spectral bands in the hyperspectral data cube. For example, if each pixel has N consecutive spectral bands, the input layer is designed with N neurons, responsible for receiving the complete spectral information of all pixels in a sub-block of a hydrological image. The hidden layers are composed of multiple stacked RBMs. A DBN contains multiple hidden layers, each of which is an RBM. An RBM is a stochastic neural network with visible and hidden layers that learns the data distribution through algorithms such as energy functions and contrastive divergence. The first layer of the RBM learns low-order features from the raw hyperspectral input data, such as edges and the basic shape of the spectral curve. As the number of layers increases, each layer in subsequent multi-layer RBMs learns higher-order, more abstract combinations of features from the output of the previous layer. For example, a deep RBM might learn complex spectral feature patterns corresponding to specific terrain categories (such as the spectral absorption characteristics of water bodies or the "red edge" effect of vegetation). The number of hidden layers and the number of neurons in each layer are hyperparameters that need to be adjusted based on the specific task and data complexity. After multi-layer RBM pre-training, a final output layer is added on top of the DBN. This output layer is a classification layer with the number of neurons equal to the total number of preset terrain categories K (e.g., water, vegetation, bare land, etc.). The final terrain feature probability vector output by the network is based on the calculation results of this output layer.
[0034] The terrain features output by this network are not specific classification labels, but rather a multi-dimensional feature vector. The value of each dimension in the vector represents the confidence probability that the content of the water conservancy image sub-patch belongs to a specific terrain category (such as lakes, rivers, forests, bare land, etc.). These probability values are calculated using the Softmax activation function in the last layer of the network, and the mathematical expression is: ; ; in, It is the raw score calculated for the i-th terrain category in the last layer of the DBN network, i.e., before it is input to the Softmax layer; It is the activation value vector of the Lth layer of the last hidden layer of DBN. This vector is the final high-level feature representation obtained after the input hyperspectral data has undergone nonlinear transformation of all the previous hidden layers. It is a weight vector connected to the last hidden layer. The p-th neuron in the output layer is learned during network training; T is the matrix transpose. It is the bias term of the p-th neuron in the output layer; Representing vectors and The dot product; This is the raw score calculated by the DBN network for the j-th category, where j is the traversal index, ranging from 1 to K, representing traversing all terrain categories; is the predicted probability that the current water conservancy image sub-block belongs to the i-th terrain category; K is the total number of terrain categories; e is the natural constant. The aforementioned Softmax activation function formula is used to convert the original score... This is transformed into a probability distribution where the sum of the probabilities of all classes is 1, thus yielding the confidence score for each class. .
[0035] Based on the terrain feature probability vector output by the deep belief network, the process enters the crucial screening stage. The feature vector corresponding to each water conservancy image sub-block is input into a pre-trained binary classifier for decision-making. The classifier's decision logic is based on the confidence probability of water features in the feature vector, with the following preset rules: Set a decision threshold (As determined experimentally, for example, 0.5), when the confidence level P(water) of the water category satisfies P(water) ≥ When P(water) is true, the water conservancy image sub-block is determined to "have a water area"; otherwise, when P(water) is false... If a water area is found to be non-water-containing, it is determined to be "non-water-containing". For water-related image sub-blocks determined to be non-water-containing, their coordinate regions are marked as non-detection areas, and their grayscale values are uniformly set to 255 (white), thus excluding them in subsequent processing and significantly reducing computational load. For the selected water-related image sub-blocks, binarization preprocessing is performed, setting the grayscale of the water areas to 0 (black) and the grayscale of the land areas to 255 (white). The coordinate regions of these water-related image sub-blocks are then formally defined as the detection areas, providing a precise and focused data foundation for subsequent contour comparison and water level prediction analysis.
[0036] This step, through the aforementioned multi-level data preprocessing and intelligent filtering, effectively achieves efficient purification of massive image data and precise positioning of water areas. Its core function is to significantly reduce the computational load of subsequent steps (S2-S5) and provide an optimized and focused data foundation for subsequent precise contour comparison and water level prediction analysis, thereby ensuring the efficiency and reliability of the entire method.
[0037] Step S2: Obtain the water area image to be detected based on water area image sub-blocks, construct a water conservancy image semantic segmentation model based on deep learning algorithm, input the water area image to be detected into the water conservancy image semantic segmentation model, output the real-time water area image semantic segmentation result, and calculate the real-time terrain water area contour based on the real-time water area image semantic segmentation result.
[0038] This step aims to first acquire the image of the water body to be detected from water body image sub-blocks, then process the image using a water image semantic segmentation model, and finally calculate the real-time topographic water body contour based on the model output. The entire process consists of four main parts: First, the image of the water body to be detected is acquired based on water body image sub-blocks, and high-frequency sub-images are extracted using the symmetric inseparable additive wavelet decomposition method; second, a water image semantic segmentation model is constructed and improved, integrating wavelet technology to enhance edge information capture; third, the image of the water body to be detected is input into the model, and the real-time water body image semantic segmentation result is output; finally, binarization and contour calculation are performed based on the real-time water body image semantic segmentation result to obtain the real-time land contour and the real-time water body contour.
[0039] The process of obtaining the image to be detected based on water area image sub-blocks is as follows: First, based on the spatial coordinates of the water area image sub-blocks obtained in step S1, the original RGB image and thermal infrared image of the corresponding region are extracted from the original multispectral remote sensing data source. Simultaneously, to enhance the model's ability to capture edge information, the binarized water area image sub-blocks output in step S1 are subjected to symmetric inseparable additive wavelet decomposition to extract their high-frequency sub-images. Thus, the image set to be detected contains three modalities: RGB image, thermal infrared image, and high-frequency sub-images. The acquisition of these images is based on the symmetric inseparable additive wavelet decomposition method. This method uses a constructed three-channel inseparable symmetric filter bank to process the input image, i.e., the water area image sub-blocks, to extract high-frequency sub-images. These sub-images are rich in edge information and suitable as input for subsequent semantic segmentation. The core of wavelet decomposition lies in obtaining low-frequency components through a low-pass filter and calculating high-frequency components through difference, as shown in the following formula:
[0040] in, This represents the input image or low-frequency component of the (i-1)th layer. When i=1, The original input image is the binarized water area image sub-block output from step S1; It is the low-frequency component of the i-th layer, by Obtained by convolution with a low-pass filter; This is the high-frequency sub-image of the i-th layer; the parameter i represents the number of decomposition layers, starting from i=1 and iterating until the preset maximum decomposition layer r is reached. The coefficients of the low-pass filter are constructed by taking specific angle parameters a and b (e.g., a=π / 4, b=π / 3) to ensure its symmetry and indivisibility. By performing wavelet decomposition on the binarized image, the boundary between water and land can be further sharpened, highlighting the details of the contours and providing stronger edge guidance for subsequent semantic segmentation models. At the same time, this decomposition is isotropic and information-complete, effectively preserving the image contour details and high-frequency sub-images. The image is used as input for subsequent models.
[0041] The process of constructing a semantic segmentation model for water conservancy images is as follows: The semantic segmentation model for water conservancy images is built upon the MFFANet framework, an encoder-decoder structure specifically designed for semantic segmentation of visible-thermal infrared multimodal images. To enhance the model's ability to capture edge information, a symmetric inseparable additive wavelet technique is introduced, integrating the obtained high-frequency sub-images as additional input modalities into the model. The improved model includes key components and formulas such as an encoder module, a MFFANet module, and a multimodal feature interaction module. The encoder employs a dual-branch structure, processing RGB images, thermal infrared images, and high-frequency sub-images separately. Each branch performs feature extraction based on the ResNet-50 backbone network and incorporates a multi-level attention fusion module (MAFM) for feature enhancement.
[0042] The MAFM module combines channel and spatial attention mechanisms. The formula for calculating channel attention weights is as follows:
[0043] in, F is the channel attention weight vector; F is the input feature map. This indicates that global average pooling is performed on the input feature map F to obtain the average value vector for each channel; This indicates that global max pooling is performed on the feature map F, calculating the maximum value for each channel along spatial dimensions (such as height H and width W), and outputting a feature vector of dimension [C,1] (where C is the number of channels); MLP This indicates that the multilayer perceptron performs a nonlinear transformation on the input vector. It is the Sigmoid activation function. Parameters such as the output size of the pooling operation are automatically determined by the spatial dimension (H×W) of the feature map, and the hidden layer size of the MLP is set to C / r (where C is the number of channels and r is the compression ratio, which is 16).
[0044] The process of multi-scale contextual feature fusion is as follows: At the end of the encoder, the Residual Space Pooling Pyramid module (RASPP) is used for multi-scale context extraction, as shown in the following formula:
[0045] in, It is the feature map input to the RASPP module; Yes The multi-scale feature map obtained after performing dilated spatial pyramid pooling operation consists of multiple parallel dilated convolutions (with dilation rates of 3, 6, and 9) and global average pooling. This is the enhanced feature map. Parameters such as the dilation rate of the dilated convolution were set experimentally to balance the receptive field and computational efficiency.
[0046] The complementary information of RGB and thermal infrared modes is fused through a multimodal feature interaction module (MFIM), as shown in the following formula:
[0047] in, These are enhanced features obtained after interaction; It is a feature map extracted from the original RGB image; It is a feature map extracted from the original thermal infrared image; It is an RGB feature map enhanced by an attention mechanism; It is a thermal infrared feature map enhanced by an attention mechanism; This represents the element-wise multiplication operation; This indicates an element-wise addition operation. Parameters such as the size of the feature map are determined through the encoder's downsampling process.
[0048] Model training uses the cross-entropy loss function The optimized formula is as follows:
[0049] in, It is a one-hot vector of the real label, with a value of 0 or 1, indicating whether the pixel belongs to category c; This is the predicted probability output by the model through the Softmax layer, representing the likelihood that a pixel belongs to class c; N is the total number of classes. Parameters and The loss was calculated through forward propagation of the model and minimized using the stochastic gradient descent algorithm. The improved model enhances high-frequency information processing capabilities and improves edge segmentation accuracy by integrating wavelet technology.
[0050] The images of the water bodies to be detected (including high-frequency sub-images, RGB images, and thermal infrared images) are input into the constructed water conservancy image semantic segmentation model. The processing flow follows an encoder-decoder structure: the encoder first extracts multimodal features through a dual-branch approach and performs feature fusion using MAFM and MFIM modules; the decoder then gradually restores the feature map size to the original image size through upsampling operations (such as bilinear interpolation). The final output is a pixel-level semantic segmentation result, where each pixel is assigned a predefined semantic category (such as land, water, vegetation, etc.). The output is a segmentation mask with the same resolution as the input image, and the category probabilities are obtained by normalization through a Softmax layer.
[0051] The real-time terrain and water area contours are calculated based on the segmentation results. The calculation of the real-time terrain and water area contours is based on the semantic segmentation results and post-processing, including three steps: binarization, binary map generation, and contour extraction.
[0052] The binarization process involves binarizing the semantic segmentation results to generate binary images for specific categories (e.g., land or water). The binarization formula uses a thresholding method, referencing common image processing practices, but based on the probability output of the segmentation mask. The formula is as follows:
[0053] in, Represents the pixel value at position (x, y) in the binary image (1 represents the target category, 0 represents the background); T is the probability that a pixel output by the semantic segmentation model belongs to the target category (obtained through the Softmax layer); T is the decision threshold. In a specific embodiment, to optimize the decision threshold T, 500 precisely labeled water conservancy images are used as the validation set. On the trained semantic segmentation model, thresholds T ranging from 0.3 to 0.7 are tested with a step size of 0.05. The average intersection-over-union ratio (IoU) and average F1 score corresponding to each T value are calculated. Experimental results show that when T=0.5, the average IoU reaches 0.89 and the average F1 score reaches 0.92, both at their maximum values. When T is below 0.5, although the recall rate increases slightly, the precision rate decreases significantly, resulting in more noise in the contour map; when T is above 0.5, the precision rate increases but the recall rate decreases, resulting in broken contours of small water areas. Therefore, considering both contour accuracy and integrity, this invention selects T=0.5 as the optimal decision threshold.
[0054] The binary image generation process is as follows: The binary image is generated by traversing all pixels of the segmentation mask and applying the binarization formula described above. For multi-class segmentation, binarization is performed separately for the land and water categories, generating two independent binary images. The generation process is based on pixel-level operations, ensuring that each binary image contains only connected regions of the target category.
[0055] The contour calculation process is as follows: contours are extracted from the binary image using a boundary tracking algorithm. The contour calculation process is described as follows: First, connected component analysis is performed on the binary image to identify all connected regions; then, a contour tracking algorithm is applied to each connected region to extract the boundary point sequence. Contour point set Represents a closed contour, where This represents the number of boundary points. Parameters such as connectivity (using 8-connectivity) are preset by the algorithm to ensure the continuity and accuracy of the contour. This step yields the real-time terrain and water contour, including the real-time land contour. and real-time water contours .
[0056] This step, as the core of the entire image processing workflow, aims to achieve refined processing of water area image sub-blocks by integrating symmetric inseparable additive wavelet technology and a water image semantic segmentation model. First, wavelet decomposition is used to extract high-frequency sub-images as the images to be detected, effectively preserving edge details. Second, an improved MFFANet model is constructed, fusing RGB, thermal infrared, and high-frequency modal features, and enhancing segmentation accuracy through attention mechanisms and multi-scale context. Then, pixel-level semantic segmentation results are output, providing a foundation for subsequent contour calculation. This step not only improves the robustness and real-time performance of image segmentation but also lays the data foundation for subsequent real-time monitoring, decision support, or further analysis, ensuring efficient and accurate generation of land and water contours to support the in-depth development of subsequent application scenarios.
[0057] Step S3: Obtain a historical image set based on water area image sub-blocks, input the historical image set into the water conservancy image semantic segmentation model, output the historical water area image semantic segmentation result, and calculate the template terrain water area contour based on the historical water area image semantic segmentation result.
[0058] The core objective of this step is to establish a standardized template topographic and water area profile to provide a benchmark for subsequent real-time detection. This step ensures the accuracy and representativeness of the template topographic and water area profile through historical data processing.
[0059] During the historical image acquisition phase, a set of historical images matching the spatial coordinates of the water area image sub-blocks determined in step S1 needs to be selected from the historical database. This set of historical images must include RGB and thermal infrared images of the same area to ensure that its data modality is consistent with the input requirements of step S2. These historical images should cover different time periods, seasonal variations, and lighting conditions to ensure the template's generalization ability. Specific selection criteria include: time span (e.g., monthly data from the past year), spatial resolution (consistent with the water area image sub-blocks), and image quality (excluding images obscured by clouds or with severe noise interference).
[0060] During preprocessing, to ensure consistency with the model input in step S2, trimodal data needs to be constructed for each historical image. For RGB images, RGB band data obtained directly from the historical database is used; for thermal infrared images, thermal infrared band data obtained directly from the historical database is used; for high-frequency sub-images, the RGB bands of the historical images are preprocessed using the same symmetric inseparable additive wavelet decomposition method as in step S2 (using the same filter bank parameters and decomposition level r). Through these processes, the historical image set is converted into input data with a structure completely consistent with the image to be detected in step S2.
[0061] After preprocessing, a set of historical images containing high-frequency sub-images is input into a trained water conservancy image semantic segmentation model. The model outputs the semantic segmentation results of historical water conservancy images. Then, the semantic segmentation results of historical water conservancy images are binarized to generate a template binary image. Finally, a contour tracking algorithm is used to extract standardized contours from the template binary image. The template land contour is named... The template water area outline is named These template-based terrain and water area outlines will serve as a benchmark for subsequent real-time detection, providing a stable reference standard.
[0062] The entire process involves rigorous historical data screening and standardized preprocessing to ensure that the template's topographic and water area outlines retain necessary details while also being resistant to interference, laying a solid foundation for subsequent real-time comparative analysis.
[0063] Step S4: Calculate the terrain-water similarity based on the real-time terrain-water contour and the template terrain-water contour, compare the terrain-water similarity with a preset threshold, and obtain real-time water level data and real-time meteorological data when the terrain-water similarity is less than the preset threshold.
[0064] The core objective of this step is to assess the degree of change in the current terrain and water features by comparing the similarity between the real-time terrain and water features profile and the template terrain and water features profile, thereby deciding whether to acquire additional data to support further analysis. The real-time terrain and water features profile comes from the output of step S2 (including the real-time land features profile). and real-time water contours The template terrain and water area contours are derived from the output of step S3 (including the template land contours). and template water area outline All contours are represented as binary regions, and connected regions are generated through contour extraction algorithms.
[0065] First, calculate land similarity. This indicator quantifies the real-time land outline. With template land outline The shape consistency between them is ensured. The Intersection over Union (IoU) method is used, with the following formula:
[0066] in, This represents the similarity between landmasses, with values ranging from 0 to 1. A higher value indicates a higher degree of similarity. and These represent the binary regions corresponding to the real-time and template land contours, respectively, and their region sizes are... This is obtained by counting the number of pixels; for example, for an image size of H×W, the maximum number of pixels is H×W; intersection. The overlapping portion of two regions is represented by a logical AND operation; the union is used for computation. The total coverage area of the two regions is calculated using a logical OR operation. Parameters such as the number of pixels are determined based on the filling results of the contour point set, ensuring that the calculation reflects the actual shape matching degree.
[0067] Next, the similarity of the water areas is calculated. This indicator quantifies the real-time water area profile. With template water area outline The degree of overlap between them is also determined using the intersection-union ratio formula, as follows:
[0068] in, This represents the similarity between water bodies, with values ranging from 0 to 1. and These represent binary regions of the real-time and template water area contours, respectively. The intersection and union are calculated in the same way as for land similarity, with parameters such as region size derived from image resolution. This separate calculation method avoids interference from differences in contour shape and focuses on the independent variations of each region.
[0069] After obtaining land similarity Similarity to water area Subsequently, the similarity of the overall topographic and water features is assessed based on these two indicators. This similarity is not a single numerical value, but a composite criterion, which applies if and only if the land similarity... Similarity to water area All are greater than the preset threshold Only when the terrain and water area similarity meets the requirements is the subsequent data acquisition process determined.
[0070] In one specific embodiment, to determine a preset threshold The following operations were performed: An image from a typical calm date preceding the rainy season of the previous year was selected as the baseline template. Subsequently, from historical data spanning the past three years, 100 images from "normal" dates without extreme weather or water management were selected as a comparison sequence. The land similarity between these 100 historical images and the baseline template was calculated. Similarity to water area This yields two sets containing 100 data points each. and ; calculate separately and The 5th percentile. Calculated. =0.85, =0.88. To maintain system sensitivity, the smaller of the two values is taken, and a unified preset threshold is ultimately set. =0.85.
[0071] Comparison logic uses an AND condition: only if and Only when the terrain and water area similarity meets the overall condition is the data acquisition process initiated. Otherwise, the current state is maintained, and only the similarity results are recorded for subsequent analysis.
[0072] The data acquisition process is as follows: Once the conditions are met, a request is automatically sent to the sensor network via the built-in data interface module. Real-time data is acquired directly from the sensor network deployed at the monitoring points, including real-time water level data (such as current water level height and flow velocity) and real-time meteorological data (such as instantaneous precipitation and temperature). The sensors transmit data in real time via IoT technology to ensure the immediacy of the information. Request parameters include the target area coordinates, time range, and data accuracy requirements, which are seamlessly obtained through API calls or protocol communication (such as HTTP or MQTT).
[0073] Water level data includes two key parameters: water level height and flow velocity. Water level height is measured in meters using pressure or ultrasonic sensors, reflecting changes in water depth. Flow velocity is acquired using current meters or Doppler radar, measured in meters per second, indicating the intensity of water flow. Meteorological data includes precipitation and temperature. Precipitation is collected in millimeters using rain gauges or weather radar, with accumulated periods ranging from hours to days. Temperature is acquired using temperature sensors, measured in degrees Celsius, and used to assess environmental thermal conditions. Real-time data acquired from the sensor network undergoes calibration and verification to eliminate noise interference. All data is accompanied by timestamps and location tags to ensure spatiotemporal alignment with image data.
[0074] The acquired data is immediately fed into the data integration module for the fusion of real-time water level and meteorological data. The entire process is automated, improving real-time response capabilities and decision support efficiency, and providing reliable input for subsequent steps. The robustness of data acquisition benefits from multi-source verification and error handling mechanisms, ensuring stable operation in complex environments.
[0075] Step S5: Construct a water level prediction model based on a temporal convolutional network model, input real-time water level data and real-time meteorological data into the water level prediction model, output the water level prediction result, and conduct graded early warning based on the water level prediction result.
[0076] In this step, the input data (including water level data and meteorological data) is first anomaly detected and processed based on the isolated forest algorithm to ensure data quality; then, a temporal convolutional network (TCN) model is constructed to predict water levels; finally, a tiered early warning system is implemented based on the prediction results.
[0077] The anomaly detection and data processing process is as follows: First, the Isolation Forest algorithm is used to detect anomalies in the original input data. This algorithm identifies and processes outliers by calculating anomaly scores for each data point, ensuring the cleanliness of the input data for subsequent prediction models. Key formulas include the anomaly scoring formula:
[0078] in, It is the outlier score of data point x. The closer the score is to 1, the higher the probability that x is an outlier. x represents a data point (such as water level or meteorological value). The dataset size is E(h(x)); E(h(x)) is the average path length of data point x in all isolated trees, reflecting the ease with which x is isolated. The shorter the path length, the higher the probability of anomalies; c( ) is the normalization factor, whose value depends only on the size of the dataset. The decision is used to standardize path lengths, making anomaly scores comparable across different dataset sizes. The calculation formula is as follows:
[0079] Here, H(i) is the harmonic number, which can be approximated as H(i)≈ln(i)+0.5772156649, used to adjust the scoring scale. The derivation of this formula is based on the binary tree structure of an isolated forest, aiming to convert path length into probabilistic scores. This refers to the dataset size, which is determined by the dataset itself. In practice, a threshold is set. >0.6 Mark outliers: If If the value exceeds the threshold, x is considered an anomaly and is either padded or removed. The processed data is denoted as... This data will serve as input to the TCN model, ensuring that model training and prediction are not affected by anomalies and improving stability. This step enhances data quality and lays the foundation for subsequent model building.
[0080] The model building process is as follows: Use the processed data A TCN-based water level prediction model was constructed. The model included data preprocessing, feature engineering, network architecture design, and training optimization to capture temporal dependencies and achieve accurate predictions. Further preprocessing, such as normalization to the [0,1] range, is performed to accelerate training. Feature engineering aims to enhance temporal characteristics; this scheme mainly employs lag features and seasonal features to capture historical dependence and periodic variation patterns of water levels, respectively.
[0081] In the model building phase, the model is first trained based on historical data. The specific training process is as follows: Long-term water level and meteorological data are obtained from historical databases, covering hydrological change cycles across different seasons and years, ensuring the data possesses sufficient temporal characteristics and representative change patterns. The same anomaly detection process as for real-time data is applied to the historical dataset, using the Isolation Forest algorithm to identify and process outliers in the historical data, ensuring the quality of the training data. The processed historical dataset is denoted as […]. ;right Feature extraction, including lag features and seasonal features, is performed to construct a complete feature vector. The historical dataset is divided into a training set (samples from the first 80% of the time period) and a validation set (samples from the last 20% of the time period) to maintain temporal continuity. The TCN-CA model is trained using the training set data, and the mean squared error loss function is minimized using the Adam optimizer. During training, performance on the validation set is monitored in real time, and an early stopping strategy is employed to prevent overfitting. Training is stopped and the optimal model parameters are saved when the validation set loss no longer decreases for several consecutive epochs.
[0082] In terms of model construction, this scheme adopts the Temporal Convolutional Network TCN-CA with integrated channel attention CA mechanism as the core prediction model. This model can dynamically weight the importance of input features through the attention mechanism, paying particular attention to key moments such as sudden changes in water level, thereby improving prediction accuracy and response to extreme water conditions.
[0083] The lag characteristics are obtained as follows: the lag time of upstream and downstream water level data is analyzed using the Pearson correlation coefficient, and the calculation formula is as follows:
[0084] in, It is the Pearson correlation coefficient with a lag step size of k. The closer the absolute value is to 1, the stronger the linear correlation between the historical data at time k and the current data. This refers to the water level data at time point t. It is a point in time. Water level data; is the mean of the water level time series; k is the lag step.
[0085] The seasonal features are obtained as follows: The time-series data is decomposed using a Hodrick-Prescott filter, and the trend component is extracted as the seasonal feature. The formula is:
[0086] in, These are the raw observations at time point t, from... ; It is the trend component at time t, that is, the extracted seasonal features, which are obtained by fitting through an algorithm; It is the trend component at time t+1; It is the trend component at time t-1; This is a smoothing parameter, set to 100, which controls the smoothness of the trend term. The larger the value, the smoother the trend; T is the total length of the time series. This formula extracts seasonal patterns by minimizing the fitting error and the smoothness penalty term.
[0087] The TCN-CA model is used for prediction. The core of TCN uses causal convolution and dilated convolution to process time-series data, ensuring that predictions rely only on historical information. The formula for dilated causal convolution is:
[0088] in, It is the convolution output at time point t; It is a clean dataset after feature engineering. The feature vector at time point t comes from the feature engineering process. k is the kernel size, k=3 to better capture local temporal patterns; d is the dilation coefficient, which increases exponentially with the number of network layers l to expand the receptive field; w(i) are the kernel weight parameters, learned through training, where i is the weight index within the kernel, an integer from 0 to k-1, establishing the correspondence between the kernel weights and specific historical time points in the input sequence; to ensure the model's stability when processing the beginning of a sequence, causal padding is performed before inputting the input sequence into the TCN-CA model. Specifically, (k-1) padding is applied at the beginning of the input sequence. There are zero values, among which This is the inflation coefficient of the deepest layer in the network. After padding... Index in It always points to valid input data, thus ensuring the normal operation of convolution and the conservation of the output sequence length. This formula efficiently captures long-term dependencies through an inflation mechanism. The TCN-CA model introduces a channel attention (CA) mechanism to dynamically weight feature importance, with the formula:
[0089] in, It is the channel attention weight vector, which is a vector with dimensions [C,1], where each value represents the weight of the corresponding channel; It is the input feature map, which is the output of the previous layer in the TCN network, and its dimensions are [batch size, number of channels, time step]; It is global average pooling, which averages the values of each channel across all time steps to obtain a vector of [C,1]. It uses global max pooling, maximizing the value across all time steps for each channel. MLP (Multilayer Perceptron) performs a non-linear transformation on the pooled vector to capture the complex relationships between channels. σ is the Sigmoid activation function, which compresses the input values to the (0,1) range. Adding these functions together efficiently fuses GAP features (representing the overall background) and GMP features (representing salient features), generating a more comprehensive and robust description for each channel. Maintaining the vector dimension ensures a lightweight MLP structure, achieving high efficiency in parameters and computation, crucial for sequence models. This allows the model to focus on key features, such as sudden changes in water level.
[0090] This model uses the Adam optimizer, therefore the loss function is the mean squared error (MSE), as shown in the following formula:
[0091] in, This is the actual water level value; It is a predicted water level value; This refers to the number of samples. Early stopping is used during training to prevent overfitting, and the validation set monitors performance. The predicted output is the water level value P at a future time point.
[0092] The preset rules for implementing tiered early warning based on the prediction result P are as follows: Let the historical normal water level range be [ , The warning water level is ,in .
[0093] Low risk (safe), P The water level is within the normal range; Medium risk (caution) P The water level is above the normal range but below the warning line, requiring close monitoring; High risk (alert), P The water level has exceeded the warning level, and immediate action is required.
[0094] The core function of this step is to construct a water level prediction model that integrates anomaly detection and a temporal convolutional network (TCN). First, the isolated forest algorithm (BS-iForest) is applied to identify and process anomalies in the input data, ensuring data cleanliness and reliability. Then, the TCN-CA model is used for high-precision time-series prediction. Finally, a dynamic hierarchical early warning mechanism is implemented based on the prediction results. This step not only improves the robustness and accuracy of the model and enhances the overall process coherence through close integration of formulas, but also provides decision support for risk management strategies and practical applications.
[0095] This technical solution constructs a complete technical system from accurate water area identification to intelligent water level prediction by deeply integrating multi-source remote sensing data and deep learning algorithms. First, it uses hyperspectral data and deep belief networks to achieve intelligent screening of water areas. Then, it combines wavelet-enhanced multimodal semantic segmentation models to extract high-precision water area contours. Innovatively, it triggers a prediction mechanism by comparing the similarity between real-time and historical contours. Finally, it adopts a time-series prediction model with integrated anomaly detection to achieve accurate forecasting and graded early warning of water level changes. This effectively solves the pain points of low identification accuracy and poor prediction timeliness of traditional methods in complex environments, and provides reliable technical support for the construction of smart water conservancy.
[0096] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, the phrase "comprising an element defined as..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0097] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their likenesses.
Claims
1. A smart water conservancy image processing method, characterized in that, Includes the following steps: Step S1: Acquire a water conservancy remote sensing image and divide it into water conservancy image sub-blocks of a preset size. Process the water conservancy image sub-blocks through a deep belief network to obtain topographic features. Based on the topographic features, filter out water area image sub-blocks. Step S2: Obtain the water area image to be detected based on water area image sub-blocks, construct a water conservancy image semantic segmentation model based on deep learning algorithm, input the water area image to be detected into the water conservancy image semantic segmentation model, output the real-time water area image semantic segmentation result, and calculate the real-time terrain water area contour based on the real-time water area image semantic segmentation result. Step S3: Obtain a historical image set based on water area image sub-blocks, input the historical image set into the water conservancy image semantic segmentation model, output the historical water area image semantic segmentation result, and calculate the template terrain water area contour based on the historical water area image semantic segmentation result; Step S4: Calculate the terrain-water similarity based on the real-time terrain-water contour and the template terrain-water contour, compare the terrain-water similarity with a preset threshold, and obtain real-time water level data and real-time meteorological data when the terrain-water similarity is less than the preset threshold. Step S5: Construct a water level prediction model based on a temporal convolutional network model, input real-time water level data and real-time meteorological data into the water level prediction model, output the water level prediction result, and conduct graded early warning based on the water level prediction result.
2. The intelligent water conservancy image processing method according to claim 1, characterized in that, A water conservancy remote sensing image is acquired and divided into water conservancy image sub-blocks of a preset size. These sub-blocks are then processed using a deep belief network to obtain topographic features, including: The water conservancy remote sensing image is acquired, and then the water conservancy remote sensing image is preprocessed to divide it into multiple water conservancy image sub-blocks with a length of a first preset pixel and a width of a second preset pixel, so as to standardize the data input and improve the efficiency of subsequent processing. After successfully dividing the water conservancy image into sub-blocks, the core processing step is to extract and perform in-depth analysis of hyperspectral data for each sub-block. Hyperspectral data is different from ordinary RGB images. Each pixel of hyperspectral data records spectral information of dozens to hundreds of continuous narrow bands from visible light to infrared light, thus forming a three-dimensional data cube. The extraction process is to parse these continuous spectral band data from each sub-block of the water conservancy image. Subsequently, hyperspectral data is extracted from each water conservancy image sub-block to form a three-dimensional data cube. The hyperspectral data is then input into a pre-trained Deep Confidence Network (DBN) model. This DBN model is constructed for the purpose of terrain feature extraction. By pre-training and fine-tuning on a massive hyperspectral sample library containing various typical terrains, it can automatically learn from the input hyperspectral data and output a probability distribution vector representing terrain features. The terrain features output by the network are not specific classification labels, but a multi-dimensional feature vector. The value of each dimension in the vector represents the confidence probability that the content of the water conservancy image sub-block belongs to a specific terrain category. These probability values are calculated using the Softmax activation function of the last layer of the network, and the mathematical expression is: ; ; in, It is the raw score calculated for the i-th terrain category in the last layer of the DBN network, i.e., before it is input to the Softmax layer; It is the activation value vector of the Lth layer of the last hidden layer of DBN. This vector is the final high-level feature representation obtained after the input hyperspectral data has undergone nonlinear transformation of all the previous hidden layers. It is a weight vector connected to the last hidden layer. The p-th neuron in the output layer is learned during network training; T is the matrix transpose. It is the bias term of the p-th neuron in the output layer; Representing vectors and The dot product; This is the raw score calculated by the DBN network for the j-th category, where j is the traversal index, ranging from 1 to K, representing traversing all terrain categories; is the predicted probability that the current water conservancy image sub-block belongs to the i-th terrain category; K is the total number of terrain categories; e is a natural constant; and the aforementioned Softmax activation function formula is used to convert the original score... This is transformed into a probability distribution where the sum of the probabilities of all classes is 1, thus yielding the confidence score for each class. .
3. The intelligent water conservancy image processing method according to claim 2, characterized in that, Based on the aforementioned terrain features, water area image sub-blocks are selected, including: Based on the terrain feature probability vector output by the deep belief network, the process enters the critical screening stage; the feature vector corresponding to each water conservancy image sub-block is input into a pre-trained binary classifier for decision-making. The decision logic of this classifier is based on the confidence probability of water features in the feature vector, with the following preset rules: Set a decision threshold When the confidence level P(water) for a water category satisfies P(water) ≥ When P(water) is true, the water conservancy image sub-block is determined to "have a water area"; otherwise, when P(water) is false... If so, it is determined that "it does not have a body of water".
4. The intelligent water conservancy image processing method according to claim 3, characterized in that, The water area image to be detected is obtained based on sub-blocks of the water area image. A water conservancy image semantic segmentation model is constructed based on a deep learning algorithm. The water area image to be detected is input into the water conservancy image semantic segmentation model, and the real-time water area image semantic segmentation result is output, including: Based on the spatial coordinates of the water area image sub-blocks obtained in step S1, the original RGB image and thermal infrared image of the corresponding region are extracted from the original multispectral remote sensing data source. At the same time, in order to enhance the model's ability to capture edge information, the binarized water area image sub-blocks output in step S1 are subjected to symmetric inseparable additive wavelet decomposition to extract their high-frequency sub-images. The image of the water area to be detected is input into the constructed water conservancy image semantic segmentation model. The processing flow follows an encoder-decoder structure. The encoder first extracts multimodal features through a dual branch and performs feature fusion using MAFM and MFIM modules. The decoder then gradually restores the feature map size to the original image size through upsampling operations, and finally outputs a pixel-level semantic segmentation result, that is, each pixel is assigned a predefined semantic category.
5. The intelligent water conservancy image processing method according to claim 4, characterized in that, The real-time terrain water contour is calculated based on the semantic segmentation results of the real-time water image, including: The real-time terrain and water area contours are calculated based on the segmentation results. The calculation of the real-time terrain and water area contours is based on the semantic segmentation results and post-processing, including three steps: binarization, binary map generation, and contour extraction. The binarization process involves: binarizing the semantic segmentation results to generate a binary image for a specific category. The binarization formula uses a threshold method, based on the probability output of the segmentation mask, as shown in the following formula: ; in, Represents the pixel value at position (x, y) in the binary image; is the probability that a pixel output by the semantic segmentation model belongs to the target category; T is the decision threshold; The process of generating a binary image is as follows: The binary image is generated by traversing all pixels of the segmentation mask and applying the above binarization formula. For multi-class segmentation, binarization is performed on the land and water categories respectively to generate two independent binary images. The contour calculation process is described as follows: First, a connectivity analysis is performed on the binary graph to identify all connected regions. Then, a contour tracking algorithm is applied to each connected region to extract the boundary point sequence; the contour point set is then obtained. Represents a closed contour, where This step represents the number of boundary points; after this step, the real-time terrain and water area contours are obtained, including the real-time land contours. and real-time water contours .
6. The intelligent water conservancy image processing method according to claim 5, characterized in that, Step S3 includes: During the historical image acquisition stage, it is necessary to select a set of historical images from the historical database that match the spatial coordinates of the water area image sub-block region determined in step S1. These historical image sets must contain RGB images and thermal infrared images of the same region to ensure that their data modality is consistent with the input requirements of step S2. These historical images should cover different time periods, seasonal changes and lighting conditions to ensure the generalization ability of the template. During the preprocessing process, in order to ensure consistency with the model input in step S2, trimodal data needs to be constructed for each historical image. For RGB images, RGB band data obtained from the historical database is used directly; for thermal infrared images, thermal infrared band data obtained from the historical database is used directly; for the preprocessing of high-frequency sub-images, the RGB bands of the historical images are generated by applying the same symmetric inseparable additive wavelet decomposition method as in step S2. After preprocessing, a set of historical images containing high-frequency sub-images is input into a trained water conservancy image semantic segmentation model. The model outputs the semantic segmentation results of historical water area images. Then, the semantic segmentation results of historical water area images are binarized to generate a template binary image. Finally, a contour tracking algorithm is used to extract standardized wheels from the template binary image, and the template land contour is named... The template water area outline is named .
7. The intelligent water conservancy image processing method according to claim 6, characterized in that, The similarity between the real-time terrain and water features and the template terrain and water features is calculated, including: First, calculate land similarity. This indicator quantifies the real-time land outline. With template land outline To ensure shape consistency between the elements, the intersection-union ratio method is used, as shown in the following formula: ; in, This represents the similarity between landmasses, with values ranging from 0 to 1. A higher value indicates a higher degree of similarity. and These represent the binary regions corresponding to the real-time and template land contours, respectively, and their region sizes are... The intersection is obtained by counting the number of pixels. The overlapping portion of two regions is represented by a logical AND operation; the union is used for computation. The total coverage area of the two regions is calculated using a logical OR operation. Next, the similarity of the water areas is calculated. This indicator quantifies the real-time water area profile. With template water area outline The degree of overlap between them is also determined using the intersection-union ratio formula, as follows: ; in, This represents the similarity between water bodies, with values ranging from 0 to 1. and These represent binary regions representing the real-time and template water area outlines, respectively; the intersection and union are calculated in the same way as land similarity, and parameters such as region size are derived from image resolution.
8. The intelligent water conservancy image processing method according to claim 7, characterized in that, The terrain-water similarity is compared with a preset threshold. When the terrain-water similarity is less than the preset threshold, real-time water level data and real-time meteorological data are obtained, including: After obtaining land similarity Similarity to water area Subsequently, the similarity of the overall topographic and water features is assessed based on these two indicators. This similarity is not a single numerical value, but a composite criterion, which applies if and only if the land similarity... Similarity to water area All are greater than the preset threshold Only when the terrain and water area similarity meets the requirements will the subsequent data acquisition process be triggered. Water level data includes two key parameters: water level height and flow velocity. Water level height is measured in meters using pressure or ultrasonic sensors, reflecting changes in water depth. Flow velocity is acquired using current meters or Doppler radar, measured in meters per second, indicating the intensity of water flow. Meteorological data includes precipitation and temperature. Precipitation is collected in millimeters using rain gauges or weather radar, with accumulated periods ranging from hours to days. Temperature is acquired using temperature sensors, measured in degrees Celsius, and used to assess environmental thermal conditions. Real-time data acquired from the sensor network requires calibration and verification to eliminate noise interference. All data is accompanied by timestamps and location tags to ensure spatiotemporal alignment with image data.
9. The intelligent water conservancy image processing method according to claim 8, characterized in that, A water level prediction model is constructed based on a temporal convolutional network model. Real-time water level data and real-time meteorological data are input into the water level prediction model, and the output is the water level prediction result, including: In terms of model construction, the Temporal Convolutional Network TCN-CA with integrated channel attention CA mechanism is used as the core prediction model; The lag feature is obtained as follows: The lag time of upstream and downstream water level data is analyzed using the Pearson correlation coefficient, and the calculation formula is as follows: ; in, It is the Pearson correlation coefficient with a lag step size of k. The closer the absolute value is to 1, the stronger the linear correlation between the historical data at time k and the current data. This refers to the water level data at time point t. It is a point in time. Water level data; is the mean of the water level time series; k is the number of lag steps; The seasonal characteristics are obtained in the following ways: The time-series data is decomposed using the Hodrick-Prescott filter, and the trend component is extracted as a seasonal feature. The formula is as follows: ; in, These are the raw observations at time point t, from... ; It is the trend component at time t, that is, the extracted seasonal features, which are obtained by fitting through an algorithm; It is the trend component at time t+1; It is the trend component at time t-1; This is a smoothing parameter, set to 100, which controls the smoothness of the trend term. The larger the value, the smoother the trend; T is the total length of the time series; The TCN-CA model is used for prediction. The core of TCN uses causal convolution and dilated convolution to process time-series data, ensuring that predictions rely solely on historical information. The formula for dilated causal convolution is: ; in, It is the convolution output at time point t; It is a clean dataset after feature engineering. The feature vector at time point t comes from the feature engineering process. k is the kernel size, k=3 to better capture local temporal patterns; d is the dilation coefficient, which increases exponentially with the number of network layers l to expand the receptive field; w(i) are the kernel weight parameters, learned through training, where i is the weight index inside the kernel, an integer from 0 to k-1, establishing the correspondence between the kernel weights and specific historical time points in the input sequence; to ensure the stability of the model when processing the start position of the sequence, causal padding is performed before the input sequence is fed into the TCN-CA model; The TCN-CA model introduces a channel attention mechanism to dynamically weight feature importance, with the following formula: ; in, It is the channel attention weight vector, which is a vector with dimensions [C,1], where each value represents the weight of the corresponding channel; It is the input feature map, which is the output of the previous layer in the TCN network, and its dimensions are [batch size, number of channels, time step]; It is global average pooling, which averages the values of each channel across all time steps to obtain a vector of [C,1]. It is global max pooling, which takes the maximum value of each channel at all time steps; MLP is multilayer perceptron, which performs a non-linear transformation on the pooled vector to capture the complex relationships between channels; σ is the sigmoid activation function, which compresses the input value into the range (0,1); This model uses the Adam optimizer, therefore the loss function is the mean squared error (MSE), as shown in the following formula: ; in, This is the actual water level value; It is a predicted water level value; It is the number of samples; The predicted output is the water level value P at a future time point.
10. A smart water conservancy image processing system, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Intelligent water conservancy image processing method, device and system
CN115965639A
Crop growth monitoring method based on remote sensing of unmanned aerial vehicle
CN120375218A
Remote sensing target detection method and system for low-visibility image
CN120747487A
AU2020103901A4