A method for extracting a basin boundary based on RBM-SegNet

By combining the RBM-SegNet model with various terrain features and post-processing methods, the accuracy and stability issues in watershed boundary extraction are resolved, achieving high-precision and highly applicable watershed boundary extraction, suitable for narrow continuous boundary structures under complex terrain conditions.

CN122116126APending Publication Date: 2026-05-29NORTHWEST A & F UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHWEST A & F UNIV
Filing Date
2026-01-31
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies suffer from insufficient accuracy and poor stability in watershed boundary extraction, especially when dealing with narrow and continuous terrain structures, where boundary breaks and missing details are common. Furthermore, existing deep learning methods lack effective means for fusing multiple terrain features and ensuring hydrological consistency.

Method used

The RBM-SegNet model is adopted. By constructing a semantic segmentation network containing encoder and decoder, residual connections, bottleneck attention modules and multi-feature fusion modules are introduced. Combined with various terrain features such as slope, aspect and mountain shadow, watershed boundaries are extracted. The boundary probability map is optimized by post-processing methods to ensure the completeness of the extraction results and the hydrological rationality.

Benefits of technology

It improves the accuracy and applicability of watershed boundary extraction, enhances the ability to express narrow continuous boundary structures under complex terrain conditions, reduces the impact of manual parameter settings on the results, and ensures the accuracy and continuity of the extraction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122116126A_ABST
    Figure CN122116126A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on RBM-SegNet's watershed boundary extraction method, device, medium and equipment, comprising: obtaining target area digital elevation model data and carrying out spatial resampling;With SegNet as base model, construct RBM-SegNet semantic segmentation model, its encoder uses residual network as main stem and introduces residual connection, encoder and decoder multilevel embedding bottleneck attention module, decoder specific upsampling stage is equipped with multiple feature fusion module;Four-channel topographic feature input data is handled using the model trained, and boundary probability graph is output and optimized, finally, the watershed boundary that conforms to topographic feature and hydrology rationality is obtained.The method reduces parameter dependence, improves boundary extraction accuracy and integrity under complex terrain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer vision technology, and in particular to a method, apparatus, medium and device for watershed boundary extraction based on RBM-SegNet. Background Technology

[0002] As a fundamental spatial unit in hydrological modeling and environmental management, a watershed is a region defined by highland watersheds. These watersheds separate adjacent areas and cause precipitation to flow into different river systems. Accurate extraction of watershed boundaries (i.e., watershed delineation) is crucial for conducting reliable hydrological analysis.

[0003] Early watershed boundary extraction relied primarily on manual interpretation of topographic maps, with professionals interpreting contour lines and terrain features. This method was highly experience-dependent, inefficient, and unsuitable for large areas. With the development of remote sensing technology and geographic information systems, Digital Elevation Models (DEMs) have gradually become the main data source for watershed boundary extraction. Existing DEM-based watershed boundary extraction methods mainly include automated methods based on surface runoff simulation and improved methods incorporating complex terrain features. Surface runoff simulation-based methods typically determine the river network by calculating flow direction and runoff accumulation, relying on set runoff thresholds. While these methods have relatively fixed procedures, they are highly sensitive to threshold parameters, often requiring repeated parameter adjustments for different regions. To improve applicability, some methods introduce automated threshold setting strategies or preprocess the DEM using methods such as river system etching. However, they still struggle to accurately reflect the true watershed boundaries in flat terrain, areas with lakes, dense river networks, or reclaimed areas. Another type of method improves the watershed boundary extraction results by introducing multiple types of terrain data. Although this improves the rationality of the boundary to some extent, this type of method usually requires the integration of multi-source terrain data, which has high requirements for data quality and preprocessing procedures. The method is complex and its versatility and generalizability are limited.

[0004] In recent years, with the rapid development of deep learning technology, its application in terrain analysis and hydrological information extraction has been increasing. Deep learning models can automatically learn features from raw data, reducing reliance on manual feature design. Among them, semantic segmentation technology has pixel-level classification capabilities and shows great potential in extracting spatially continuous geographic elements. Current research has attempted to apply semantic segmentation to water system extraction or terrain feature recognition, but existing models still generally suffer from boundary fragmentation, missing details, and insufficient adaptability to complex terrain when dealing with narrow and continuous terrain structures such as watershed boundaries. In addition, existing deep learning-based methods still have room for improvement in model structure design, input feature selection, and post-processing, especially in how to fully integrate multiple terrain features, enhance the expression of key boundary information, and ensure the hydrological consistency of the results. There is still a lack of a well-structured, highly accurate, and adaptable watershed boundary extraction method. Summary of the Invention

[0005] The main objective of this application is to provide a watershed boundary extraction method, apparatus, medium, and device based on RBM-SegNet, aiming to address the shortcomings of existing technologies in terms of accuracy and stability of watershed boundary extraction.

[0006] To achieve the above objectives, this application provides a watershed boundary extraction method based on RBM-SegNet, comprising: Acquire digital elevation model data of the target area, perform spatial resampling processing on the digital elevation model data, and obtain resampled DEM data with a preset spatial resolution; Using SegNet as the base model, an RBM-SegNet semantic segmentation model is constructed, which includes an encoder module and a decoder module. The RBM-SegNet semantic segmentation model is used to process four-channel terrain feature input data and outputs a boundary probability map. The encoder module adopts a residual network as the backbone structure and introduces residual connections. Bottleneck attention modules are embedded in multiple layers of the encoder and decoder modules. The decoder includes multiple decoding layers. Each decoding layer includes a bottleneck attention module, an upsampling module, and a convolution operation module with dependencies. Multi-feature fusion modules are set in the upsampling stages of the second, third, and fourth layers of the decoder module. The trained RBM-SegNet semantic segmentation model was used to extract the boundaries of the resampled DEM data, and the output boundary probability map was optimized to obtain the watershed boundary that conforms to the topographic features and hydrological rationality.

[0007] Optionally, before using the trained RBM-SegNet semantic segmentation model to extract boundaries from the resampled DEM data, the method includes: Based on resampled DEM data, three types of terrain feature data, namely slope, aspect and mountain shadow, are calculated respectively. The digital elevation model data is combined with the three types of terrain feature data to obtain four-channel terrain feature input data. The watershed boundary vector data corresponding to the target area is rasterized to generate watershed boundary label data with the same spatial resolution and spatial range as the four-channel terrain feature input data. The four-channel terrain feature input data and watershed boundary label data are matched one-to-one according to spatial location, and are cropped into data blocks using a sliding window. After data augmentation, they are divided into training set, validation set and test set. The training set is input into the RBM-SegNet semantic segmentation model. The combination of the Dice loss function and the binary cross-entropy loss function of the RBM-SegNet semantic segmentation model is used as the optimization objective of the semantic segmentation model. An adaptive convergence mechanism is introduced in the validation set, and the learning rate strategy is adjusted based on the loss value of the training set to obtain the trained RBM-SegNet semantic segmentation model. The semantic segmentation model is tested on the test set to obtain the trained RBM-SegNet semantic segmentation model.

[0008] Optionally, the boundary probability map includes continuous boundary probability maps and broken boundary probability maps. Optimization of the output boundary probability map includes: Thresholding is performed on the continuous boundary probability map, and the centerline of the watershed boundary is extracted through the skeletonization function to generate the watershed boundary skeleton. Boundary probability diagram for fracture: Morphological closing operations are used to repair small fracture boundaries in the boundary probability map; Large fracture boundaries in the boundary probability map are corrected by combining cumulative flow values ​​and the D8 algorithm; The validity of each boundary pixel in the probability map of the broken boundary is checked by examining the 8-neighborhood. Fragmented boundaries that are valid and have a length less than a preset pixel threshold are removed to eliminate noise and artifacts caused by misclassification or boundary fragmentation.

[0009] Optionally, the formula for calculating the attention weights of the bottleneck attention module is:

[0010] The weighted feature is represented as follows:

[0011] in, It is the Sigmoid activation function. This is a channel attention map. This is a spatial attention map. This is an element-wise multiplication operation. This is the input feature map.

[0012] Optionally, the fusion expression of the multi-feature fusion module is:

[0013] in, This represents the encoder feature map at the current decoding stage. This represents the output of the decoder. This represents the output of the previous multi-feature fusion module. and Represents the fusion coefficient. This indicates that a 1×1 convolution is performed on the output of the previous multi-feature fusion module.

[0014] Optionally, the Adam optimizer is used to train the model, an adaptive convergence mechanism is introduced on the validation set, and the learning rate strategy is adjusted based on the training set loss value, including: The training process is terminated early when the decrease in the validation set loss does not exceed the first preset value within a preset number of consecutive training rounds. When the training set loss value is higher than the historical minimum loss value, the learning rate is reduced by a second preset value, and training continues from the optimal model state of the previous round.

[0015] Alternatively, the expression for calculating the slope is:

[0016] in, For elevation in x , y First-order partial derivative in the direction, z Elevation values ​​for the digital elevation model: The expression for calculating slope aspect is:

[0017] in, and These represent the digital elevation model in x and y Elevation gradient in direction, It is the arctangent function; The formula for calculating the shadow of a mountain is:

[0018] in, Indicates the solar altitude angle. Indicates the azimuth angle of the sun. Indicates the slope angle. Indicates the slope angle.

[0019] Furthermore, to achieve the above objectives, this application also provides a watershed boundary extraction device based on RBM-SegNet, comprising: The resampling module is used to acquire digital elevation model data of the target area, perform spatial resampling processing on the digital elevation model data, and obtain resampled DEM data with a preset spatial resolution. The processing module is used to construct an RBM-SegNet semantic segmentation model based on SegNet, which includes an encoder module and a decoder module. The RBM-SegNet semantic segmentation model is used to process four-channel terrain feature input data and output a boundary probability map. The encoder module adopts a residual network as the backbone structure and introduces residual connections. Bottleneck attention modules are embedded in multiple layers of the encoder and decoder modules. The decoder includes multiple decoding layers. Each decoding layer includes a bottleneck attention module, an upsampling module, and a convolution operation module with interdependent connections. Multi-feature fusion modules are set in the upsampling stages of the second, third, and fourth layers of the decoder module. The optimization module is used to optimize the output boundary probability map to obtain a watershed boundary that conforms to the terrain features and hydrological rationality. To achieve the above objectives, this application also provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the watershed boundary extraction method based on RBM-SegNet provided in the above embodiments.

[0020] To achieve the above objectives, this application also provides an electronic device, which includes: at least one processor, a memory, and an input / output unit; wherein the memory is used to store a computer program, and the processor is used to call the computer program stored in the memory to execute the watershed boundary extraction method based on RBM-SegNet provided in any of the foregoing embodiments.

[0021] This application proposes a watershed boundary extraction method, apparatus, medium, and device based on RBM-SegNet. The method acquires digital elevation model (DEM) data of the target area, performs spatial resampling on the DEM data to obtain resampled DEM data with a preset spatial resolution, and constructs an RBM-SegNet semantic segmentation model containing an encoder module and a decoder module using SegNet as the base model. The RBM-SegNet semantic segmentation model processes four-channel terrain feature input data and outputs a boundary probability map. The encoder module uses a residual network as the backbone structure and introduces residual connections. Bottleneck attention modules are embedded in multiple layers of the encoder and decoder modules. The decoder includes multiple decoding layers, each including a bottleneck attention module, an upsampling module, and a convolution operation module. Multi-feature fusion modules are set in the upsampling stages of the second, third, and fourth layers of the decoder module. The trained RBM-SegNet semantic segmentation model is used to extract the boundary from the resampled DEM data, and the output boundary probability map is optimized to obtain a watershed boundary that conforms to terrain features and hydrological rationality. This invention uses DEM data as a foundation and integrates multiple terrain features as model inputs. It introduces residual connections, bottleneck attention mechanisms, and multi-feature fusion modules into the SegNet semantic segmentation framework to construct a deep semantic segmentation model suitable for watershed boundary extraction. Simultaneously, post-processing methods are used to validate and optimize the segmentation results to ensure the completeness and hydrological rationality of the extraction results. This invention learns key features of watershed boundaries through semantic segmentation, effectively reducing the impact of manual parameter settings on the results, enhancing the model's ability to express narrow, continuous boundary structures under complex terrain conditions, and improving the accuracy and applicability of watershed boundary extraction. Attached Figure Description

[0022] Figure 1 is a model structure diagram provided in an embodiment of the watershed boundary extraction method of RBM-SegNet in this application; Figure 2 This is a digital elevation model map provided as an embodiment of the watershed boundary extraction method of RBM-SegNet in this application; Figure 3 The figure shows the experimental results of different input combinations provided in one embodiment of the watershed boundary extraction method of RBM-SegNet in this application; Figure 4 The figures show experimental results for different module combinations provided in one embodiment of the watershed boundary extraction method of RBM-SegNet in this application; Figure 5 The figure shows experimental results comparing the watershed boundary extraction method of RBM-SegNet in this application with different semantic segmentation methods. Figure 6The figure shows experimental results comparing the watershed boundary extraction method of RBM-SegNet in this application with different traditional methods. Figure 7 This application provides an embodiment of the watershed boundary extraction method of RBM-SegNet. Figure 6 Magnified experimental results; Figure 8 This is a flowchart illustrating an embodiment of the watershed boundary extraction method using RBM-SegNet in this application.

[0023] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0024] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0025] Reference Figure 8 The watershed boundary extraction method based on RBM-SegNet provided in the first embodiment of this application may include: S101. Obtain digital elevation model data of the target area, perform spatial resampling processing on the digital elevation model data, and obtain resampled DEM data with a preset spatial resolution. In this embodiment, digital elevation model (DEM) data of the study area is first acquired as the basic topographic data. Considering the differences in the representation of topographic details and the continuity of watershed boundaries between DEMs with different spatial resolutions, this embodiment performs spatial resampling on the original DEM data. By comparing the degree of preservation and smoothing effect of topographic relief features at different resolutions, the original DEM data is uniformly resampled to a spatial resolution of 60 m.

[0026] This resolution effectively reduces the interference of minor undulations and shallow depressions in high-resolution DEMs on the confluence structure, while avoiding the loss of boundary information caused by excessive smoothing of low-resolution DEMs, thus obtaining terrain representation results with better continuity and structural stability.

[0027] Given that single DEM data lacks sufficient information to characterize complex terrain structures, this embodiment further extracts various terrain feature information based on resampled DEM data to enhance the model's ability to identify watershed boundary features.

[0028] In one embodiment of this application, before using the trained RBM-SegNet semantic segmentation model to extract boundaries from the resampled DEM data, the method includes: Based on resampled DEM data, three types of terrain feature data, namely slope, aspect and mountain shadow, are calculated respectively. The digital elevation model data is combined with the three types of terrain feature data to obtain four-channel terrain feature input data. The expression for calculating the slope is as follows:

[0029] in, For elevation in x , y First-order partial derivative in the direction, z Elevation values ​​for the digital elevation model: Slope data calculated from DEM data can be used to characterize the degree of inclination of the land surface relative to the horizontal plane. The slope calculation is based on the elevation change rate of the DEM in the horizontal direction. The slope value corresponding to each pixel is obtained through the above calculation, and invalid values ​​generated during the calculation process are uniformly processed to form slope raster data consistent with the spatial resolution of the DEM.

[0030] The expression for calculating slope aspect is:

[0031] in, and These represent the digital elevation model in x and y Elevation gradient in direction, The arctangent function is used to characterize the direction of maximum descent of the slope, i.e., the slope orientation. Based on DEM data, the slope aspect is calculated using the gradient relationship of elevation in the horizontal direction. The slope aspect result is usually expressed in angle form, and its value ranges from [value missing]. Starting from due north, the direction increases clockwise.

[0032] The formula for calculating the shadow of a mountain is:

[0033] in, Indicates the solar altitude angle. Indicates the azimuth angle of the sun. Indicates the slope angle. Indicates the slope angle.

[0034] To enhance the visualization of terrain undulations and highlight terrain structural features, this embodiment calculates mountain shadow data based on DEM data. Mountain shadows are obtained by simulating the surface illumination under specific light source conditions, and their calculation process is based on the geometric relationship between slope, aspect, and illumination parameters. In this invention, the solar azimuth angle is set to 315°, and the solar altitude angle is set to 45°, thereby forming mountain shadow raster data.

[0035] By comparing and analyzing different combinations of input features, this embodiment selects four terrain features—digital elevation model, slope, mountain shadow, and aspect—to form a multi-channel input combination, generating four-channel terrain feature input data to enhance the model's comprehensive perception of watershed boundary structure and detailed features.

[0036] S102. Using SegNet as the base model, construct an RBM-SegNet semantic segmentation model that includes an encoder module and a decoder module. Use the RBM-SegNet semantic segmentation model to process four-channel terrain feature input data and output a boundary probability map. The encoder module adopts a residual network as the backbone structure and introduces residual connections. Bottleneck attention modules are embedded in multiple layers of the encoder and decoder modules. The decoder includes multiple decoding layers. Each decoding layer includes a bottleneck attention module, an upsampling module, and a convolution operation module with interdependent connections. Multi-feature fusion modules are set in the upsampling stages of the second, third, and fourth layers of the decoder module. In one embodiment of this application, the formula for calculating the attention weight of the bottleneck attention module is as follows:

[0037] The weighted feature is represented as follows:

[0038] in, It is the Sigmoid activation function. This is a channel attention map. This is a spatial attention map. This is an element-wise multiplication operation. This is the input feature map.

[0039] In one embodiment of this application, the fusion expression of the multi-feature fusion module is as follows:

[0040] in, This represents the encoder feature map at the current decoding stage. This represents the output of the decoder. This represents the output of the previous multi-feature fusion module. and Represents the fusion coefficient. This indicates that a 1×1 convolution is performed on the output of the previous multi-feature fusion module.

[0041] This embodiment constructs a semantic segmentation network based on an encoder-decoder structure, RBM-SegNet, to achieve pixel-level recognition of watershed boundaries. The RBM-SegNet network uses SegNet as its base model and includes an encoder module and a decoder module. The encoder is used to extract multi-level terrain semantic features step by step, and the decoder is used to restore the spatial resolution of the feature map step by step and reconstruct the watershed boundary structure.

[0042] like Figure 1 As shown, the RBM-SegNet network takes four-channel terrain features—DEM, slope, aspect, and hill shadow—as input and employs a residual network as the backbone of the encoder. By introducing residual connections into the encoder, the feature information attenuation problem caused by multiple convolutions and downsampling processes in deep networks is effectively alleviated, thereby enhancing the ability to preserve terrain details. Bottleneck Attention Modules (BAMs) are introduced in multiple layers of the encoder and decoder. By jointly modeling the feature maps in both channel and spatial dimensions, the network can adaptively enhance key information related to watershed boundaries and suppress redundant features. As the downsampling process progresses, the spatial resolution of the feature maps gradually decreases to 1 / 32 of the original input, while the number of channels gradually increases to capture more abstract and deeper semantic information. In the decoding stage, the decoder consists of multiple decoding layers. Each decoding layer sequentially includes the BAM module, upsampling operations, and 3×3 convolution operations to progressively restore the spatial resolution of the feature maps and optimize feature representation. To address the issue of semantic information loss that traditional upsampling processes often lead to, this invention introduces a Multi-Feature Fusion Module (MFFM) in the second, third, and fourth upsampling stages of the decoder. The MFFM module jointly fuses downsampled features from the encoder, features from the current decoding layer, and the output of the previous fusion module, constructing a cross-layer information transmission path. This allows for the reconstruction of the spatial structure while preserving rich semantic information, resulting in clearer and more detailed watershed boundary predictions.

[0043] Furthermore, given that watershed boundaries typically exhibit a narrow and elongated structure at the pixel level, with an uneven distribution of positive and negative samples, this embodiment employs a combination of the Dice loss function and the binary cross-entropy (BCE) loss function as an optimization objective during model training. This aims to enhance the model's ability to learn minority class boundary pixels and improve the overall accuracy and stability of watershed boundary extraction.

[0044] To enhance the semantic segmentation network's ability to focus on key terrain features such as watershed boundaries, this embodiment introduces bottleneck attention modules at multiple levels of the encoder and decoder. These bottleneck attention modules adaptively weight input features by combining channel attention and spatial attention mechanisms, thereby improving the model's sensitivity to salient regions and suppressing redundant feature information.

[0045] The channel attention module is used to evaluate the relative importance of each channel in the overall semantic representation. Given the input feature map... First, the context information of each channel is extracted using global average pooling to obtain the channel description vector. This vector is then fed into a multilayer perceptron with a single hidden layer to model the dependencies between channels. To reduce computational cost, the hidden layer dimension is compressed to [value missing]. , where r is the compression ratio. The resulting channel attention weights are located in the range [0,1] and are used to represent the importance of each channel. These weights are broadcast to each spatial location of the feature map and multiplied channel-by-channel with the input feature map to enhance salient channels and suppress redundant features.

[0046] The spatial attention module aims to highlight discriminative spatial regions in the feature map. First, a 1×1 convolution is applied to the input feature map F to reduce the number of channels and computational cost. Then, two consecutive 3×3 dilated convolutions are used to expand the receptive field and capture richer contextual information. Finally, a 1×1 convolution compresses the features into a single-channel spatial attention map. The final attention map M(F) is obtained by element-wise addition of the channel attention map and the spatial attention map, followed by sigmoid normalization. To address the issues of insufficient semantic information transmission and incomplete feature reconstruction in the decoding stage of the SegNet network, this embodiment introduces a multi-feature fusion module (MFFM) to fuse feature information from different network layers and construct a cross-layer feature transmission path. This invention introduces a MFFM module to effectively integrate features from different encoding and decoding layers, thereby alleviating the inherent information flow limitations in the SegNet framework. MFFM fuses encoder features, decoder features, and the output of the previous MFFM layer in the current decoding stage, establishing a pathway for enhanced feature representation across layers. Specifically, let the encoder feature map in the current decoding stage be E(A), the decoder output be D(B), and the output of the previous MFFM module be M(C). The fusion process can be represented as:

[0047] in, and This is the fusion coefficient, used to balance the contributions of features from the current layer and features from other layers. Through experimental tuning, its optimal value was set to [value missing]. and . This indicates that a 1×1 convolution is performed on the previous MFFM output to reduce the channel dimension and enhance feature representation capabilities, thereby improving the non-linear expression effect. To ensure the correctness of the fusion, all feature maps must be aligned in terms of channel number and spatial size before fusion. The final fused feature map is obtained. It will be passed as input to the next decoding layer.

[0048] In one embodiment of this application, the training process of the RBM-SegNet semantic segmentation model includes: The watershed boundary vector data corresponding to the target area is rasterized to generate watershed boundary label data with the same spatial resolution and spatial range as the four-channel terrain feature input data. The four-channel terrain feature input data and watershed boundary label data are matched one-to-one according to spatial location, and are cropped into data blocks using a sliding window. After data augmentation, they are divided into training set, validation set and test set. The training set is input into the RBM-SegNet semantic segmentation model. The combination of the Dice loss function and the binary cross-entropy loss function of the RBM-SegNet semantic segmentation model is used as the optimization objective of the semantic segmentation model. An adaptive convergence mechanism is introduced in the validation set, and the learning rate strategy is adjusted based on the loss value of the training set to obtain the trained RBM-SegNet semantic segmentation model. The semantic segmentation model is tested on the test set to obtain the trained RBM-SegNet semantic segmentation model.

[0049] In this embodiment, after completing DEM resampling and multi-channel terrain feature calculation, this embodiment further constructs a training dataset for watershed boundary extraction, specifically including the following steps: (1) Obtain watershed boundary vector data corresponding to the study area, and perform rasterization on the watershed boundary vector data so that it is consistent with the resampled DEM data and multi-channel terrain feature data in terms of spatial resolution and spatial range, and generate watershed boundary label data, which is used as supervised learning labels for semantic segmentation model.

[0050] (2) Combine the four types of terrain feature data, namely DEM, slope, aspect and mountain shadow, according to the channel dimension to form four-channel terrain feature input data, and ensure that the input data corresponds one-to-one with the corresponding watershed boundary label data in spatial location.

[0051] (3) Several large-scale regions were randomly selected within the study area as sample regions, with 90% of the sample regions used for model training and validation, and 10% used for model testing. For the sample regions, a sliding window clipping method was used to clip the four-channel terrain feature input data and its corresponding watershed boundary labels into 512-pixel × 512-pixel data blocks to reduce the computational complexity of model training and inference while ensuring sufficient terrain spatial context information. To improve the generalization ability and robustness of the model, data augmentation was performed on the training and validation data. Data augmentation methods included, but were not limited to, rotating the data blocks by 90°, 180°, and 270°, as well as horizontal flipping.

[0052] (4) Divide the completed dataset into training set, validation set and test set according to a preset ratio. Preferably, the training set accounts for 80% of the training and validation samples, the validation set accounts for 20%, and the test set is used to evaluate the watershed boundary extraction performance of the model in areas not involved in the training.

[0053] In one embodiment of this application, the Adam optimizer is used to train the model, an adaptive convergence mechanism is introduced in the validation set, and the learning rate strategy is adjusted based on the training set loss value, including: The training process is terminated early when the decrease in the validation set loss does not exceed the first preset value within a preset number of consecutive training rounds. When the training set loss value is higher than the historical minimum loss value, the learning rate is reduced by a second preset value, and training continues from the optimal model state of the previous round.

[0054] In this embodiment, all experiments were conducted on a computer equipped with an NVIDIA GeForce RTX 3090 graphics card with 24 GB of video memory, running Ubuntu 18.04 LTS. The model was based on Python 3.8.2 and built using PyTorch 1.7.2 as the deep learning framework. The main Python libraries used in the experiments included scikit-image 0.18.1, scikit-learn 0.24.0, Rtree 0.9.4, GDAL 3.0.2, and NumPy 1.19.4, and the software runtime environment was managed using Anaconda 4.10.0.

[0055] The constructed dataset is input into the deep learning model for training. The Adam optimizer is used to train the model, with an initial learning rate of 0.00001, a batch size of 8, and a maximum number of training epochs of 100. To obtain a more stable model, an adaptive convergence mechanism is introduced: training is terminated early when the validation set loss decreases by no more than 0.1 over 10 consecutive training epochs. Furthermore, when the training set loss value is higher than the historical minimum loss value, the learning rate is reduced by 20%, and training continues from the optimal model state of the previous epoch.

[0056] S103. The trained RBM-SegNet semantic segmentation model is used to extract the boundaries of the resampled DEM data, and the output boundary probability map is optimized to obtain the watershed boundary that conforms to the terrain features and hydrological rationality.

[0057] In one embodiment of this application, the boundary probability map includes continuous boundary probability maps and broken boundary probability maps. Optimization of the output boundary probability map includes: Thresholding is performed on the continuous boundary probability map, and the centerline of the watershed boundary is extracted through the skeletonization function to generate the watershed boundary skeleton. Boundary probability diagram for fracture: Morphological closing operations are used to repair small fracture boundaries in the boundary probability map; Large fracture boundaries in the boundary probability map are corrected by combining cumulative flow values ​​and the D8 algorithm; The validity of each boundary pixel in the probability map of the broken boundary is checked by examining the 8-neighborhood. Fragmented boundaries that are valid and have a length less than a preset pixel threshold are removed to eliminate noise and artifacts caused by misclassification or boundary fragmentation.

[0058] Specifically, the semantic segmentation model first generates an initial prediction of the watershed boundary, namely a boundary probability map, where each pixel value represents the Softmax probability of its class. To further optimize the boundary prediction, this application first thresholds the probability map and uses Python's skeletonization function to extract the boundary centerline, generating the watershed boundary skeleton.

[0059] To address potential fracture boundaries in the prediction results, we employ a two-step preprocessing strategy. For minor fractures, morphological closing operations in Python are used to repair slight discontinuities; for larger fractures, flow accumulation values ​​(FAs) are introduced for auxiliary correction. Specifically, we identify the intersection points between the predicted watershed boundary and the FA data, and then perform reverse tracing along the flow direction based on the D8 algorithm. If the tracing paths lead to different intersection points, they are classified into different watersheds. Subsequently, starting from the endpoint of the fracture boundary segment, we trace along the boundary region between adjacent watershed labels to fill in missing parts and ensure the overall continuity of the watershed boundary. To further improve boundary accuracy, we examine the 8-neighborhood of each boundary pixel: if multiple watershed labels exist, the pixel is considered a valid boundary location; otherwise, it is replaced with the pixel with the highest elevation in the neighborhood. Furthermore, to eliminate noise and artifacts caused by misclassification or boundary fragmentation, this application removes boundaries shorter than 30 pixels.

[0060] (1) Experimental data This experiment uses the high-resolution product (spatial resolution of 10 m) of the National Hydrography Dataset Plus (NHDPlus) for the contiguous United States to train and initially evaluate the proposed framework. This dataset primarily utilizes raster data from the 3D Elevation Program (3DEP). Figure 2 (a) and resampled it to a spatial resolution of 60 m. In addition, the vector data in the Water Boundary Vector Dataset (WBD) was rasterized and used as watershed mask labels.

[0061] During model training, 46 large-scale regions were randomly cropped from the study area, with 90% used for training and validation, and the remaining 10% for testing. Given the large scale of the cropped regions, a sliding window method was used to further divide them into 512×512 pixel data blocks. To improve the model's generalization ability, data augmentation was performed on the training and validation sets, including rotating the images by 90°, 180°, and 270°, and horizontally flipping them. Finally, 80% (2952 samples) of the cropped image blocks were randomly selected as the training set, and 20% (738 samples) as the validation set.

[0062] (2) Experimental scheme The experiments were conducted on a computer equipped with an NVIDIA GeForce RTX 3090 graphics card with 24 GB of video memory, running Ubuntu 18.04 LTS. The model was built using Python 3.8.2 and PyTorch 1.7.2 as the deep learning framework. The main Python libraries used in the experiments included scikit-image 0.18.1, scikit-learn 0.24.0, Rtree 0.9.4, GDAL 3.0.2, and NumPy 1.19.4. The software runtime environment was managed using Anaconda 4.10.0.

[0063] The constructed dataset is input into the deep learning model for training. The Adam optimizer is used to train the model, with an initial learning rate of 0.00001, a batch size of 8, and a maximum number of training epochs of 100. To obtain a more stable model, an adaptive convergence mechanism is introduced: training is terminated early when the validation set loss decreases by no more than 0.1 over 10 consecutive training epochs. Furthermore, when the training set loss value is higher than the historical minimum loss value, the learning rate is reduced by 20%, and training continues from the optimal model state of the previous epoch.

[0064] This application also provides several comparative embodiments to demonstrate the effectiveness of the present invention.

[0065] Comparative Example 1: This comparative example presents a watershed boundary extraction method based on semantic segmentation, and a comparative experiment was conducted on the RBM-SegNet network model by combining multi-channel information (slope, aspect, and mountain shadow).

[0066] Results analysis: Table 1 and Figure 3 The results demonstrate the watershed boundary extraction performance for different input combinations. Experimental results show that, in the dual-channel input setting, the combination containing only mountain shadow features performs best. Mountain shadows can capture the boundaries between different slopes by simulating lighting conditions, a characteristic that is particularly important for adapting to terrain variations in complex environments. Furthermore, the accuracy of watershed boundary extraction is significantly improved when slope and aspect information are combined. Slope helps the model accurately identify ridge protrusions, while aspect, by describing the orientation of the terrain, provides a powerful supplement to the extraction of mountain shadow features. Ultimately, the four-channel input DEM, slope, aspect, and mountain shadow performs best in the watershed boundary extraction task. Compared to other settings, Method 8 outperforms all other settings on all evaluation metrics and shows a significant improvement in reducing misclassification.

[0067] Table 1. Results of watershed boundary extraction for different input combinations in Comparative Example 1

[0068] Comparative Example 2: This comparative example presents a watershed boundary extraction method based on semantic segmentation. This comparative example removes the residual connection, bottleneck attention mechanism and multi-feature fusion module in step four of the RBM-SegNet network model. Results analysis: Table 2. Results of watershed boundary extraction for different module combinations in Comparative Example 2

[0069] As shown in Table 2, the baseline SegNet performed stably across all evaluation metrics, providing a solid foundation for subsequent improvements. After introducing the residual block, all performance metrics showed consistent improvement, with the F1-score increasing to 62.60% and mIoU increasing to 54.47%. This indicates that the module effectively mitigates feature information loss during forward propagation. By introducing forward propagation, the residual structure alleviates the gradient vanishing problem in deep networks, enabling the network to efficiently learn meaningful features at deeper levels. Figure 4 As shown, the model incorporating residual blocks achieves smoother boundaries and more complete watershed delineation results during watershed boundary extraction, indicating that this module has a positive effect on segmentation continuity. Further introduction of BAM significantly improves the model's accuracy. The attention mechanism enables the network to focus more precisely on key regions such as watershed boundaries, thereby enhancing boundary sensitivity and delineation accuracy. Figure 4 As shown, the model incorporating BAM generates more detailed and better-closed boundary lines. However, its performance is slightly insufficient in relatively flat terrain areas, indicating that a single structural improvement is not enough to achieve global stability and consistency, and further optimization with other modules is still needed. After introducing MFFM, the model continues to improve on multiple evaluation metrics. MFFM effectively enhances feature transfer and semantic fusion capabilities by fusing encoder features, decoder features, and the output of the previous fusion module from different levels. This design establishes a cross-level semantic information transfer pathway, significantly alleviating the problem of limited information flow in the original SegNet architecture. The multi-scale feature fusion mechanism strengthens the interaction between high-level semantic information and low-level spatial details, enabling the full integration of information at different scales during decoding. Figure 4 As shown, the model incorporating MFFM significantly reduces misclassification in the watershed's internal regions and achieves more continuous and consistent boundary delineation results. This indicates that multi-level feature fusion significantly enhances the model's ability to perceive complex spatial structures, enabling it to better capture fine-grained features.

[0070] Ultimately, the RBM-SegNet network model, integrating residual structure, BAM, and MFFM, achieved the best performance across all evaluation metrics. This demonstrates that the three modules complement and synergize in feature extraction, attention allocation, and multi-scale information fusion, jointly constructing a closed-loop optimization framework that enables efficient feature selection and continuous information transfer. This mechanism effectively overcomes the shortcomings of traditional SegNet, such as insufficient fine-grained feature representation and limited context awareness.

[0071] Comparative Example 3: To verify the effectiveness of this invention, comparative experiments were conducted between the semantic segmentation method of this invention and several mainstream deep learning methods. Deep learning models such as U-Net, SegNet, CGNet, UNetFormer, and MVANet were constructed as comparison methods. All comparison models were trained and tested using the aforementioned unified standard dataset, and the input layer structure of each model was adjusted accordingly to enable them to receive four-channel input data. Each model was trained under the same training strategy and experimental conditions.

[0072] Results analysis: Table 3. Watershed boundary extraction results of different semantic segmentation models in Comparative Example 3

[0073] Table 3 and Figure 5The performance metrics and boundary extraction results of each model are presented. RBM-SegNet, by introducing a residual connection structure and BAM, effectively enhances the model's ability to extract boundary features in complex backgrounds. Combined with MFFM, the model significantly reduces information loss during upsampling, improving its ability to predict clear structures and details. Compared to other models, RBM-SegNet extracts boundaries with better coherence and accuracy, especially in complex terrain areas such as wide river channels, where its extraction results are more consistent with the actual terrain morphology, the error area is significantly reduced, and the detail preservation effect is more prominent. In contrast, while U-Net can roughly extract watershed boundaries at a large scale, the boundary lines often exhibit discontinuities and high-frequency artifacts due to the loss of some detailed features during the upsampling stage. CGNet uses a lightweight structure, which has advantages in computational efficiency, but its network depth and receptive field are limited, and its feature fusion ability is weak, making it prone to misclassification and local false boundaries. The overall boundary continuity and closure are poor, with an mIoU of only 44.56%. UNetFormer significantly enhances global spatial modeling capabilities by introducing a Transformer encoder, but because its decoder still relies on sampling to recover spatial details, it still produces slight blurring and discontinuities in local edge regions. MVANet achieves high overall pixel classification accuracy and generates relatively smooth watershed boundaries through multi-view learning and cross-attention mechanisms, but visible discontinuities still exist in local regions, indicating that it is still insufficient in capturing complete boundary structures.

[0074] Comparative Example 4: To verify the effectiveness of this invention, a comparative experiment was conducted with traditional watershed boundary extraction methods. Two comparative methods were constructed: a D8 flow path method and a D8 flow path method incorporating flow combustion. All comparative methods were tested using the aforementioned unified standard dataset, and the applicability of the model was verified in both mountainous and flat regions.

[0075] Results analysis: Table 4. Watershed boundary extraction results in Comparative Example 4 compared to the traditional method.

[0076] Table 4 summarizes the accuracy metrics of the three methods relative to the reference boundary. To more intuitively compare the method performance, Figure 6 The visualization results for the three test areas are shown. Figure 7 Enlarged display Figure 6 Two typical problems arise in the river. In flat areas where the river channel is relatively wide ( Figure 6 (a) and Figure 6(b) The D8 algorithm often fails to identify the dominant slope aspect, instead assigning a pre-defined "default" flow direction, leading to unreasonable results in both flow paths and watershed boundaries. Furthermore, the D8 method uses a universal threshold, which cannot accurately delineate small sub-watersheds, such as... Figure 7 As shown in (c) and (d), this threshold is primarily applicable to large watersheds. While the flow-burning method improves local flow paths by lowering DEM elevations along predefined channels, its impact on overall watershed delineation remains limited. For large-scale watersheds, most raster cells eventually converge at the same outlet, and locally depressed channels only produce slight modifications to micro-topography, failing to significantly alter the overall flow structure. In regions with wide valleys and clearly defined elevation gradients in the original DEM, flow-burning has even more limited effectiveness in optimizing flow direction. Notably, in... Figure 7 In (e), the flow-burning process generates a finer river network, but this also results in more fragmented watershed divisions and a greater number of sub-watersheds. In contrast, the watershed boundaries extracted by RBM-SegNet effectively avoid the problem of unreasonable divisions in flat areas, and its results can better conform to the predefined division criteria. This shows that the model can effectively learn the geographical features of watershed boundaries and accurately capture their spatial distribution.

[0077] Based on the method embodiments, this application also provides a watershed boundary extraction device based on RBM-SegNet, comprising: a resampling module for acquiring digital elevation model data of the target area, performing spatial resampling processing on the digital elevation model data to obtain resampled DEM data with a preset spatial resolution; a processing module for constructing an RBM-SegNet semantic segmentation model containing an encoder module and a decoder module using SegNet as the base model, processing four-channel terrain feature input data using the RBM-SegNet semantic segmentation model, and outputting a boundary probability map; the encoder module adopts a residual network as the backbone structure and introduces residual connections, embedding bottleneck attention modules in multiple layers of the encoder module and decoder module, the decoder including multiple decoding layers, each decoding layer including a bottleneck attention module, an upsampling module, and a convolution operation module, and setting a multi-feature fusion module in the upsampling stage of the second, third, and fourth layers of the decoder module; and an optimization module for optimizing the output boundary probability map to obtain a watershed boundary that conforms to the terrain features and hydrological rationality.

[0078] This application also provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the watershed boundary extraction method based on RBM-SegNet provided in the above embodiments.

[0079] This application also provides an electronic device, which includes: at least one processor, a memory, and an input / output unit; wherein the memory is used to store a computer program, and the processor is used to call the computer program stored in the memory to execute the watershed boundary extraction method based on RBM-SegNet provided in any of the foregoing embodiments.

[0080] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A watershed boundary extraction method based on RBM-SegNet, characterized in that, include: Acquire digital elevation model data of the target area, perform spatial resampling processing on the digital elevation model data, and obtain resampled DEM data with a preset spatial resolution; Using SegNet as the base model, an RBM-SegNet semantic segmentation model containing encoder and decoder modules is constructed. The RBM-SegNet semantic segmentation model is used to process four-channel terrain feature input data and output a boundary probability map. The encoder module uses a residual network as the backbone structure and introduces residual connections. Bottleneck attention modules are embedded in multiple layers of the encoder and decoder modules. The decoder includes multiple decoding layers. Each decoding layer includes a bottleneck attention module, an upsampling module, and a convolution operation module connected in series. Multi-feature fusion modules are set in the upsampling stages of the second, third, and fourth layers of the decoder module. The trained RBM-SegNet semantic segmentation model was used to extract the boundaries of the resampled DEM data, and the output boundary probability map was optimized to obtain the watershed boundary that conforms to the topographic features and hydrological rationality.

2. The watershed boundary extraction method based on RBM-SegNet as described in claim 1, characterized in that, Before using the trained RBM-SegNet semantic segmentation model to extract boundaries from the resampled DEM data, the method includes: Based on resampled DEM data, three types of terrain feature data, namely slope, aspect and mountain shadow, are calculated respectively. The digital elevation model data is combined with the three types of terrain feature data to obtain four-channel terrain feature input data. The watershed boundary vector data corresponding to the target area is rasterized to generate watershed boundary label data with the same spatial resolution and spatial range as the four-channel terrain feature input data. The four-channel terrain feature input data and watershed boundary label data are matched one-to-one according to spatial location, and are cropped into data blocks using a sliding window. After data augmentation, they are divided into training set, validation set and test set. The training set is input into the RBM-SegNet semantic segmentation model. The combination of the Dice loss function and the binary cross-entropy loss function of the RBM-SegNet semantic segmentation model is used as the optimization objective of the semantic segmentation model. An adaptive convergence mechanism is introduced in the validation set, and the learning rate strategy is adjusted based on the loss value of the training set to obtain the trained RBM-SegNet semantic segmentation model. The semantic segmentation model is tested on the test set to obtain the trained RBM-SegNet semantic segmentation model.

3. The watershed boundary extraction method based on RBM-SegNet as described in claim 1, characterized in that, Boundary probability maps include continuous and fragmented boundary probability maps. Optimization of the output boundary probability map includes: Thresholding is performed on the continuous boundary probability map, and the centerline of the watershed boundary is extracted through the skeletonization function to generate the watershed boundary skeleton. Boundary probability diagram for fracture: Morphological closing operations are used to repair small fracture boundaries in the boundary probability map; Large fracture boundaries in the boundary probability map are corrected by combining cumulative flow values ​​and the D8 algorithm; The validity of each boundary pixel in the probability map of the broken boundary is checked by examining the 8-neighborhood. Fragmented boundaries that are valid and have a length less than a preset pixel threshold are removed to eliminate noise and artifacts caused by misclassification or boundary fragmentation.

4. The watershed boundary extraction method based on RBM-SegNet as described in claim 1, characterized in that, The formula for calculating the attention weight of the bottleneck attention module is: The weighted feature is represented as follows: in, It is the Sigmoid activation function. This is a channel attention map. This is a spatial attention map. This is an element-wise multiplication operation. This is the input feature map.

5. The watershed boundary extraction method based on RBM-SegNet as described in claim 1, characterized in that, The fusion expression for the multi-feature fusion module is: in, This represents the encoder feature map at the current decoding stage. This represents the output of the decoder. This represents the output of the previous multi-feature fusion module. and Represents the fusion coefficient. This indicates that a 1×1 convolution is performed on the output of the previous multi-feature fusion module.

6. The watershed boundary extraction method based on RBM-SegNet as described in claim 1, characterized in that, The model is trained using the Adam optimizer, an adaptive convergence mechanism is introduced on the validation set, and the learning rate strategy is adjusted based on the training set loss value, including: The training process is terminated early when the decrease in the validation set loss does not exceed the first preset value within a preset number of consecutive training rounds. When the training set loss value is higher than the historical minimum loss value, the learning rate is reduced by a second preset value, and training continues from the optimal model state of the previous round.

7. The watershed boundary extraction method based on RBM-SegNet as described in claim 1, characterized in that, The expression for calculating slope is: in, For elevation in x , y First-order partial derivative in the direction, z Elevation values ​​for the digital elevation model: The expression for calculating slope aspect is: in, and These represent the digital elevation model in x and y Elevation gradient in direction, It is the arctangent function. The formula for calculating the shadow of a mountain is: in, Indicates the solar altitude angle. Indicates the azimuth angle of the sun. Indicates the slope angle. Indicates the slope angle.

8. A watershed boundary extraction device based on RBM-SegNet, characterized in that, include: The resampling module is used to acquire digital elevation model data of the target area, perform spatial resampling processing on the digital elevation model data, and obtain resampled DEM data with a preset spatial resolution. The processing module is used to build an RBM-SegNet semantic segmentation model with an encoder module and a decoder module based on SegNet. It uses the RBM-SegNet semantic segmentation model to process four-channel terrain feature input data and outputs a boundary probability map. The encoder module uses a residual network as the backbone structure and introduces residual connections. Bottleneck attention modules are embedded in multiple layers of the encoder and decoder modules. The decoder includes multiple decoding layers. Each decoding layer includes a bottleneck attention module, an upsampling module, and a convolution operation module connected in series. Multi-feature fusion modules are set in the upsampling stages of the second, third, and fourth layers of the decoder module. The optimization module is used to optimize the output boundary probability map to obtain a watershed boundary that conforms to the terrain features and hydrological rationality.

9. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the watershed boundary extraction method based on RBM-SegNet according to any one of claims 1 to 7.

10. An electronic device, characterized in that, Electronic devices include: At least one processor, memory, and input / output unit; The memory is used to store computer programs, and the processor is used to call the computer programs stored in the memory to execute the watershed boundary extraction method based on RBM-SegNet according to any one of claims 1 to 7.