1. Introduction
As one of the key natural elements of the Earth’s surface, water plays a vital role in climate regulation, ecological balance, and human production and daily life [
1,
2,
3]. However, due to the complexity of the surface environment and a variety of interfering factors, the extraction of information regarding water bodies still faces numerous challenges. Consequently, achieving high-precision segmentation and dynamic monitoring of water bodies is of particular importance, as it helps to improve water resource management and mitigate associated risks.
Satellite remote sensing is capable of providing stable and comprehensive data support for water body monitoring. Currently, multi-source remote sensing imagery from Landsat, Sentinel, Gaofen, and other sources has been widely used in studies on water body segmentation [
4,
5]. As a critical component of remote sensing data interpretation, water body segmentation is of great importance for accurately identifying the extent of water bodies. However, water bodies in karst landscapes typically take on elongated and fragmented spatial forms, and are affected by topographical shadows and vegetation cover, which increases the difficulty of segmentation [
6,
7,
8].
Traditional methods for water body segmentation rely primarily on the spectral characteristics and indices of remote sensing imagery, using thresholds to distinguish between water body and non-water body [
9,
10]. For instance, methods based on the Normalized Difference Water Index (NDWI) and its improved variants are widely used for water body segmentation in multi-source remote sensing imagery [
11,
12]. In addition, the researchers incorporated multispectral data and spatial information, employing strategies such as regional growth, edge detection, and object-oriented classification to improve segmentation performance [
13,
14]. However, the spectral response of water bodies varies significantly across different environments and is easily affected by factors such as shading and vegetation cover. Traditional methods are often sensitive to threshold settings, leading to misclassifications and missed classifications in complex surface conditions, such as bare rock and dark-colored features in karst regions. This limits their generalizability [
15].
In recent years, the rapid development of deep learning technology has overcome the limitations of traditional methods. It has gradually become the primary approach for water-ground segmentation using multi-source data [
16,
17,
18,
19,
20]. For example, Li et al. [
21] proposed DeepUNet, a deep U-Net architecture based on fully convolutional networks, for achieving pixel-level land-sea segmentation [
22]. Wang et al. [
23] proposed a U-Net-based convolutional neural network, TSAE-UNet, which achieves accurate detection of water bodies across multiple scenes and time phases by incorporating space–time feature extraction and attention mechanisms. However, the aforementioned methods rely primarily on local convolutional operations, making it difficult to fully extract deep global features of water bodies in complex scenes, which consequently limits segmentation performance to some extent. To address this issue, Wang et al. [
24] proposed MSLWENet, a deep learning network for lake water body extraction. By introducing multi-scale feature fusion and feature enhancement mechanisms, it effectively enhances the model’s ability to characterize water bodies and improve segmentation accuracy in complex backgrounds. Furthermore, Zhang et al. [
25] utilized rich convolutional neural network features to achieve fine-grained segmentation of water bodies in high-resolution aerial and satellite imagery, which further validates the effectiveness of deep feature representation in water body extraction tasks [
26]. Although methods based on CNN have made significant progress in the task of water segmentation, their inherent local receptive fields limit their ability to capture long-range dependencies and global contextual information [
27,
28].
Recently, Transformer models have gradually been adopted in the field of remote sensing image segmentation due to their superior global feature modeling capabilities [
29,
30,
31,
32]. For instance, Kang et al. [
33] proposed WaterFormer, a coupled model that integrates Transformers with convolutional neural networks, achieving effective segmentation of water bodies in optical remote sensing imagery by combining global and local features. Subsequently, Wang et al. [
34] designed MHNet, a mask-guided hybrid network that enhances feature representation in key regions by introducing a masking mechanism, thereby improving the robustness of water body segmentation. Furthermore, Tian et al. [
35] developed WB-Former, which deeply integrates CNNs and Transformers for water body segmentation in complex scenes, significantly enhancing the model’s adaptability to complex backgrounds. Transformers still exhibit high computational complexity when processing high-resolution remote sensing imagery.
The Mamba architecture, which is based on state-space models, has been increasingly applied to semantic segmentation tasks due to its efficient modeling of long sequences [
5,
36,
37,
38]. The original Mamba model was used for processing one-dimensional data, such as in natural language processing (NLP) [
39]. Liu et al. [
40] designed a two-dimensional state-space model (2D-SSM) to enable Mamba to process two-dimensional image data. Based on this, Cai et al. [
41] proposed CM-UNet++, a multi-layer information optimization network which, through the introduction of multi-scale feature fusion and structural improvements, effectively enhanced the accuracy of urban water body extraction from high-resolution remote sensing imagery. Li et al. [
42] improved the accuracy of small water body detection through transfer learning between Sentinel-2 and PlanetScope, whilst the introduction of V-Mamba further enhanced the model’s ability to capture long-range dependencies and multi-scale spatial features. Liu et al. [
43] proposed the SWD-Net dataset to provide a unified benchmark for small water body detection, and Mamba U-Net further improved the performance of high-resolution remote sensing water body segmentation by enhancing the modelling of long-range dependencies. Hong et al. [
44] combined the red-blue normalized difference index with a state-space model for sea ice segmentation, effectively improving the accuracy of segmentation at the ice–water boundary. Furthermore, Liu et al. [
45] proposed HyMambaNet, which combines state-space models with multi-scale features, thereby enhancing the model’s ability to characterize water bodies in complex scenes whilst maintaining computational efficiency.
However, existing methods still suffer from shortcomings such as the failure to detect small-scale water bodies and inaccurate boundary identification in karst landscapes. To address this, this paper proposes MESA-Net, a hybrid CNN–Mamba segmentation network designed for the segmentation of water bodies in complex karst landscapes. Within the MESA-Net framework, we introduce a Cross-Scale Adaptive Feature Fusion (CAFF) module to enhance the model’s ability to extract discriminative features for small, fragmented water bodies. An Omnidirectional Global–Local Mamba Block (OGLMB) is embedded in the decoder to improve the model’s capacity to capture the multi-directional structure and global consistency of water bodies. Furthermore, considering that water bodies in karst landscapes are influenced by topography and often exhibit a certain degree of directionality, we have additionally designed a Directional Gradient Histogram Edge-Guided Fusion Module (DGHEF) to capture multi-directional boundary information of water bodies, thus enhancing the model’s ability to delineate water body boundaries in complex backgrounds.
In summary, the main contributions of this paper are as follows:
- (1)
A CNN–Mamba hybrid segmentation network, named MESA-Net, has been proposed for the segmentation of water bodies in complex karst landscapes. Whilst ensuring low computational complexity, the network achieves a synergistic representation of both the local details and global structure of water bodies, significantly improving segmentation performance in complex scenarios.
- (2)
To address the challenge of identifying small water bodies in karst regions, where water bodies vary greatly in size and are distributed in a fragmented manner, a Cross-scale Adaptive Feature Fusion (CAFF) module has been designed. By employing cross-scale feature fusion and a dynamic weight allocation mechanism, this module enhances the network’s ability to detect small-scale water body targets.
- (3)
To effectively capture the long-range spatial dependencies arising from the elongated structures and multi-directional extent of karst water bodies, an Omni-directional Global-Local Mamba Block (OGLMB) with an 8-directional scanning mechanism has been designed, significantly enhancing the network’s ability to capture the structural continuity and global consistency of water bodies extending in multiple directions.
- (4)
To address the issue of blurred and fragmented water boundaries caused by mountain shadows and vegetation occlusion, a Directional Gradient Histogram Edge-Guided Fusion (DGHEF) module has been designed. This module utilises a gradient direction histogram to explicitly model boundary information, whilst incorporating an edge-guided mechanism to enhance the representation of multi-directional boundary features. It effectively suppresses false responses caused by shadows and occlusion, thereby further improving the accuracy of water segmentation in complex scenes.
2. Materials and Methods
2.1. Overall Architecture
The MESA-Net proposed in this paper adopts an encoder–decoder architecture, as shown in
Figure 1. It is composed of three main parts: (1) a lightweight CNN-based encoder network—ResNet18; (2) a decoder network comprising an adaptive cross-scale feature aggregation module, an omnidirectional Mamba module for global and local features, and a directional gradient histogram edge-guided fusion module; (3) a residual stem (Residual Stem) based on residual blocks.
In particular, the encoder comprises four lightweight residual convolutional layers, ResBlock1–4, which progressively extract local features of the water body through downsampling. Furthermore, to unify the number of channels across different scales and reduce the computational cost of the model, we have designed an RD (Reduction) convolutional module. Through a series of convolutional operations within this module, the outputs α1–α4 from ResBlock1–4 are unified into 64 channels.
The decoder is organized into four stages corresponding to the encoder layers in a vertical manner. Specifically, CAFF1–CAFF4 perform spatial alignment on the multi-scale encoder features β1–β4 and adaptively learn fusion weights, thereby effectively integrating contextual information of karst water bodies across different scales. This process enhances the network’s perception of large-area water regions and improves robustness against interference from mountain shadows. The output γ4 of CAFF4 is further fed into OGLMB4 for feature refinement, strengthening the interaction between global and local context information. Subsequently, the outputs γ1–γ3 from CAFF1–CAFF3, together with the outputs of OGLMB2–OGLMB4, are jointly fed into the DGHEF module. By incorporating differentiable HOG-based gradient priors and a gating mechanism, the model effectively enhances boundary representation capability.
In addition, water bodies in karst terrains typically exhibit elongated and fragmented spatial structures. During repeated downsampling and upsampling operations, a large amount of fine-grained information, such as boundaries and textures, may be lost. To address this issue, an additional local feature extraction branch, called the Residual Stem, is introduced. Specifically, the original image is simultaneously fed into the Residual Stem, where fine-grained water-body features are extracted via a 3 × 3 convolution followed by two residual blocks.
Finally, the output a0 from the Residual Stem and the output a1 from the OGLMB module are further fused through the DGHEF module, which effectively restores the model’s ability to preserve fine-grained water body features. The fused features and the outputs from the four decoding stages are fed into the segmentation head to generate five prediction maps, denoted as X0–X4. Among them, X1–X4 are used during the training stage for auxiliary supervision, while only the final prediction map X0 is produced during the testing stage.
2.2. Cross-Scale Adaptive Feature Fusion (CAFF)
In karst terrains, water bodies typically exhibit significant scale variations and spatial fragmentation. Small-scale water bodies are often distributed as discrete patches and tend to present weak response signals in complex backgrounds, making them highly susceptible to being overlooked. To overcome this challenge, a Cross-scale Adaptive Feature Fusion module (CAFF) is proposed. By performing feature fusion across different encoding levels and incorporating a dynamic weight allocation mechanism, the proposed module effectively strengthens the network’s capability to perceive small-scale water-body targets. The overall structure of the CAFF module is illustrated in
Figure 2.
Concretely, the proposed module takes the multi-scale feature maps from the four encoder stages, denoted as β
1–β
4, as input. Spatial alignment across different scales is achieved through upsampling and downsampling operations, thereby establishing a unified multi-scale feature representation. Bilinear interpolation was used for upsampling, whilst max-pooling was employed for downsampling during cross-scale feature alignment. Building upon this, to enhance feature discriminative power, a channel attention mechanism is introduced to adaptively recalibrate features at different scales, which strengthens responses related to water bodies while suppressing redundant background information. This can be expressed as follows:
where
denotes a scale alignment operation,
denotes the SE attention mapping function,
is the target level,
represents element-wise multiplication,
denotes the output of the encoder for the corresponding layer.
Subsequently, considering the varying importance of multi-scale features at each spatial location, a Softmax-normalized dynamic weighting mechanism is designed to perform pixel-wise weighted fusion across different scales, thereby enabling adaptive aggregation of cross-scale information. The process can be expressed as follows:
where
denotes the fused feature at level
,
denotes the index of the input feature scale,
is the summation index used for normalization,
denotes the exponential function,
and
denotes learnable weight generation functions with different indices.
Furthermore, a multi-branch dynamic convolution structure is introduced to capture contextual information of multi-scale features by enlarging the receptive field. An input-driven weight generation mechanism is employed to adaptively weight each branch, thereby further enhancing the representation of local details in the fused features. Finally, channel fusion is performed using pointwise convolution, producing enhanced feature representations that incorporate both multi-scale semantic information and fine-grained local details, which improves the network’s capability to perceive small-scale water bodies. This process can be defined as:
where
denotes the depthwise separable convolution branch,
denotes the branch weights generated adaptively.
2.3. Omni-Directional Global-Local Mamba Block (OGLMB)
In karst regions, water body structures often exhibit elongated and anisotropic distribution characteristics. Existing models struggle to capture long-range spatial dependencies without sacrificing fine-grained features. To address this issue, this paper proposes an omnidirectional global–local feature Mamba module with an eight-directional scanning mechanism (OGLMB), which enables efficient modeling of complex water body structures and significantly enhances the representation of structural continuity and global consistency of water bodies. As illustrated in
Figure 3, the OGLMB mainly consists of two branches: a global branch and a local branch.
The global branch employs a Mamba module with an eight-directional scanning mechanism to extract global water body features from eight directions. Specifically, the input features are first transformed into a sequential representation. Subsequently, the 8D-SSM performs bidirectional traversal of the feature maps along horizontal, vertical, and diagonal directions, thereby significantly enhancing the network’s ability to capture the anisotropic spatial structures of water bodies. Finally, the features are reshaped back to their original form for output. This process can be formulated as:
where
denotes layer normalization,
denotes the scanning operation along the
direction,
denotes the state-space modeling along the corresponding direction,
indicates the rearrangement and fusion of multi-directional features,
denotes the input feature,
is a learnable residual scaling parameter.
denotes the output of the global branch.
On this basis, to compensate for the insufficient representation of local details in purely global modeling, the module introduces a local branch constructed using multi-scale convolutions with kernel sizes
. This design enables the extraction of fine-grained spatial information under different receptive fields. The process can be formulated as:
where
represents the input projection operation,
represents the convolution with the kernel
,
represents the number of branches,
represents the output of the local branch.
Furthermore, a cross-branch interaction mechanism is introduced, in which the local features are treated as queries, while the global features serve as keys and values for cross-attention modeling. This design enables deep fusion of global and local information, allowing local details to adaptively acquire complementary information from the global context. The process can be expressed as:
where
denotes the Softmax,
,
and
denote the trainable projection matrix,
denotes the dimension of the query and the key.
In addition, to further enhance the network’s representation capability for water body features, an adaptive gating strategy is adopted to dynamically adjust the contribution weights of the two types of features. This process can be formulated as:
where
represents the gated weight generation function composed of convolutional layers,
represents feature merging,
and
represent the adaptive weights for the global branch and the local branch.
Finally, to further refine the multi-scale features of the water body and highlight the key characteristics of the water regions, the fused features are further enhanced through channel-space attention. This process can be expressed as:
where
denotes channel-spatial attention,
denotes the output mapping,
is the learnable residual scaling coefficient.
2.4. Directional Gradient Histogram Edge-Guided Fusion (DGHEF)
To address the issue that water body boundaries in karst terrains are prone to blurring and fragmentation due to mountain shadows and vegetation occlusion, this paper proposes a Directional Gradient Histogram Edge-Guided Fusion module (DGHEF). The module explicitly models multi-directional boundary information of water bodies using directional gradient histograms and incorporates an edge-guided mechanism to enhance the network’s representation of water boundary features. The overall architecture of the module is illustrated in
Figure 4.
First, the shallow features from the encoder
and the decoder features
are linearly projected to obtain a unified representation:
where
and
denote the feature projection function consisting of a 1 × 1 convolution and normalization.
Meanwhile, considering that shallow features contain rich boundary information, the Sobel operator is employed to compute the gradient magnitude and orientation of the feature
. Based on this, multi-directional gradient histograms are constructed to achieve explicit modeling of boundary orientation information. This process can be formulated as:
where
represents the gradient magnitude computed based on the Sobel operator,
denotes the bin corresponding to the pixel orientation,
represents the indicator function used for assignment,
represents the cell region,
denotes the number of bins.
Subsequently, the gradient orientation features are projected into a high-dimensional feature space and fused with the original features. A lightweight edge convolution structure is then employed to enhance the feature responses along the horizontal and vertical directions, respectively. This operation further strengthens the model’s representation of water body directional information. This process can be expressed as:
where
denotes 1 × 1 Conv,
denotes horizontal depthwise convolution,
denotes vertical depth convolution,
denotes the learnable factor.
In addition, to suppress pseudo-edge responses caused by shadows or noise, a boundary-guided gating mechanism based on decoder semantic information is designed to adaptively filter boundary features. This mechanism highlights real water body boundaries while suppressing interference information. Finally, residual connections are introduced to preserve shallow, detailed information, enabling fine-grained characterization of complex boundaries. This process can be formulated as:
3. Results
3.1. Dataset
To validate the effectiveness and robustness of MESA-Net, a dedicated dataset for water body segmentation in karst terrains, named LJ-Water, is constructed in this study. Furthermore, to comprehensively evaluate the performance of the proposed network, two publicly available datasets with similar water body characteristics (Water-CD and LoveDA) are additionally selected for comparative experiments. The three datasets are compared in terms of data source, spatial resolution, categories, image size, and the number of images, as summarized in
Table 1. The following subsections provide a detailed description of each dataset.
3.1.1. LJ-Water Dataset
Currently, most datasets used for semantic segmentation research are designed for general purposes, while dedicated datasets for water body segmentation remain relatively scarce. Moreover, datasets specifically targeting water bodies in karst terrains are almost nonexistent. Therefore, this study constructs a novel dataset based on Sentinel-2 imagery for karst water bodies in the Lijiang River Basin, Guilin, Guangxi, China, as illustrated in
Figure 5. Specifically, multi-temporal Sentinel-2 images within the study area are first collected and preprocessed, including cloud removal, band registration, and cropping to the region of interest. Subsequently, water body regions are annotated at the pixel level through visual interpretation of remote sensing images, followed by manual cross-validation to ensure label quality. After data cleaning and patch extraction, a total of 1930 image samples with a size of 256 × 256 are obtained. The LJ-Water dataset utilizes the R (red), G (green), and NIR (near-infrared) bands from Sentinel-2 imagery as input to effectively characterize the spectral differences between water bodies and background land cover.
In addition, compared with the Water-CD and LoveDA datasets, the LJ-Water dataset is more challenging in two aspects: (1) water bodies in different regions exhibit significant variations in scale, reflectance, and shape, as shown in
Figure 5a,b; and (2) under the influence of karst terrain, the image background becomes more complex, including factors such as mountain shadows and vegetation, as illustrated in
Figure 5c,d.
3.1.2. Water-CD Dataset
Water-CD is a multi-purpose dataset designed for water body segmentation and change detection [
46]. As illustrated in
Figure 6, the dataset consists of multiple Sentinel-2 satellite images with a spatial resolution of 10 m. The study areas cover seasonal water bodies in the Yangtze River Basin in China and multiple regions along the Jamuna River in South Asia. These images include three bands: R (red), G (green), and NIR (near-infrared). In this study, images with annotation errors and those without water bodies are removed. The filtered dataset contains a total of 1149 images with a size of 512 × 512. In addition, data augmentation is performed through rotation as well as horizontal and vertical flipping.
3.1.3. LoveDA Dataset
The LoveDA dataset consists of 5987 images collected from three cities: Nanjing, Changzhou, and Wuhan [
47]. As shown in
Figure 7, each image is sourced from Google Earth with a spatial resolution of 0.3 m and includes three bands: R (red), G (green), and B (blue). The annotation labels cover seven land cover categories, including background, buildings, roads, water bodies, bare soil, forest, and farmland. According to the requirements of our task, these seven categories are reclassified into two classes, namely water and non-water. Similarly, after data filtering and augmentation, the resulting dataset contains a total of 4191 images with a size of 1024 × 1024.
3.2. Experimental Environment
3.2.1. Implementation Details
Experiments are conducted on the Water-CD, LoveDA, and LJ-Water datasets. Each dataset is randomly split into training, validation, and test sets with a ratio of 7:1.5:1.5 using a fixed random seed. All experiments are implemented based on PyTorch 2.1.1 and Python 3.10 on a single NVIDIA GeForce RTX 4060 GPU with 8 GB memory (NVIDIA Corporation, Santa Clara, CA, USA). Regarding training strategies, the Adam optimizer is adopted. The ResNet-18 encoder was initialized using ImageNet pre-trained weights. The initial learning rate is set to 0.0005, and a polynomial decay strategy is employed to dynamically adjust the learning rate for improved training performance. The batch size is set to 4, and the model is trained for 100 epochs.
3.2.2. Evaluation Metrics
To quantitatively compare the results, four commonly used metrics are adopted in this study: Intersection over Union (IoU), F1 score, Precision (P), and Recall (R). IoU is used to assess the spatial overlap consistency between the predicted water body regions and the ground truth masks. The F1 score provides a comprehensive measure of the model’s accuracy and completeness in water body segmentation, representing the harmonic mean of Precision and Recall. The specific formulas are as follows:
where
denotes the number of pixels correctly predicted as water,
denotes the number of non-water pixels incorrectly predicted as water,
denotes the number of actual water pixels incorrectly predicted as background.
3.3. Comparison with Representative Segmentation Methods
To validate the effectiveness of the proposed method, seven advanced segmentation approaches and three water-specific segmentation approaches are selected for comparative experiments, including (1) CNN-based methods, such as U-Net [
22], DeepLabV3+ [
48], SFFNet [
49], Res-UNet++ [
50], MECNet [
25], and BiSeNet [
51]; (2) Transformer-based methods, such as MF_Seg [
52] and CTCFNet [
53]; (3) Mamba-based methods, such as AfaMamba [
54] and MF-Mamba [
55].
3.3.1. Experimental Results on the LJ-Water Dataset
To validate the effectiveness of the proposed method, experiments are first conducted on the constructed LJ-Water dataset. As shown in
Table 2, MESA-Net achieves significant performance improvements over all comparative methods, reaching 84.59% IoU and 91.65% F1, respectively. Compared with the second-best segmentation network, DeepLabV3+, the proposed method improves IoU by 1.51% and F1 by 0.89%. Furthermore, compared with advanced Transformer- or Mamba-based networks such as CTCFNet, AfaMamba, and MF-Mamba, MESA-Net demonstrates stronger robustness under complex background conditions. This indicates that relying solely on global modeling or long-range dependency modeling remains insufficient to fully address the challenges of fragmented water boundaries, elongated targets, and severe background interference in karst regions.
In addition, compared with dedicated water body segmentation networks, although BiSeNet, MECNet, and MF_Seg are specifically designed for water segmentation tasks, they achieve only 77.72%, 78.55%, and 68.60% IoU on the LJ-Water dataset, respectively, which are substantially inferior to the proposed method. This indicates that these water segmentation approaches suffer notable performance degradation when confronted with complex backgrounds in karst regions, such as mountain shadows and vegetation occlusion, leading to evident false positives and missed detections.
To better evaluate the segmentation performance of the model under complex karst terrain scenarios, five representative examples from the LJ-Water dataset are selected for visualization, as shown in
Figure 8. As illustrated in
Figure 8a, water bodies in karst terrains often exhibit irregular boundary patterns extending in multiple directions, which impose higher demands on the model’s boundary representation capability. The proposed method demonstrates superior performance in extracting such irregularly extended water bodies compared with other approaches. As shown in
Figure 8b, the red box contains two small and scattered water bodies. Most comparative methods suffer from missed detections, particularly SFFNet, MF_Seg, and MF-Mamba, whereas the proposed method successfully identifies these water bodies and accurately delineates their boundary structures. As illustrated in
Figure 8c–e, in scenarios involving narrow and meandering rivers, all competing models exhibit varying degrees of discontinuity or over-segmentation, while MESA-Net maintains good continuity of water bodies and remains robust against complex background interference, such as mountains and shadows. In summary, MESA-Net demonstrates strong robustness to background interference, superior capability in preserving the continuity of elongated water bodies, and enhanced performance in detecting small-scale water bodies in complex karst terrains.
3.3.2. Experimental Results on the Water-CD Dataset
To further validate the effectiveness and robustness of the proposed method, comparative experiments are conducted on the Water-CD dataset, and the results are presented in
Table 3. Compared with the second-best compared segmentation network, DeepLabV3+, the proposed method improves IoU by 2.34% and F1 by 1.30%, demonstrating the superior performance of MESA-Net for water body segmentation on this dataset. Compared with the Transformer-based network CTCFNet, MESA-Net also shows significant advantages in both IoU and F1. When dealing with the Water-CD dataset, which contains a large number of small water bodies and fine-grained boundaries, Transformer-based models tend to overlook these fine-scale features, resulting in reduced segmentation accuracy. This is mainly because such models place greater emphasis on global feature modeling.
In addition, compared with dedicated water body segmentation networks, MESA-Net achieves superior performance over BiSeNet, MECNet, and MF_Seg. Among them, MECNet is the best-performing baseline, achieving 89.61% IoU and 94.52% F1, whereas the proposed method reaches 92.15% and 95.91%, yielding improvements of 2.54% in IoU and 1.39% in F1. Meanwhile, BiSeNet and MF_Seg obtain IoU scores of 87.58% and 88.52%, respectively, which are still lower than those of the proposed method. This indicates that there remains a noticeable performance gap among different dedicated water body segmentation models.
To better illustrate the segmentation performance of different networks on water bodies of varying scales, five representative examples from the Water-CD dataset are selected for visualization, as shown in
Figure 9. Specifically, as shown in
Figure 9a,b, most CNN-based methods are able to extract the main regions of water bodies; however, they exhibit limitations in maintaining the continuity of slender water bodies and in distinguishing spectrally similar land cover, resulting in fragmented predictions and misclassification. In contrast, Transformer-based and Mamba-based methods such as CTCFNet, AfaMamba, and MF-Mamba, due to their strong global feature modeling capability, tend to produce more false predictions. As highlighted in the red boxes in
Figure 9c,d, these misclassifications become more pronounced. Furthermore, as shown in
Figure 9e, most methods fail to detect the small water bodies within the red box and produce incorrect predictions, whereas the proposed method is still able to stably segment these small targets. In summary, compared with the competing models, the proposed method is capable of maintaining better water body continuity while effectively suppressing misclassification caused by spectrally similar land cover. The experimental results demonstrate that MESA-Net achieves superior performance in water body segmentation under complex backgrounds, particularly in scenarios involving both intricate environments and small-scale water bodies in the Water-CD dataset.
3.3.3. Experimental Results on the LoveDA Dataset
To further validate the effectiveness and robustness of the proposed method, comparative experiments are also conducted on the LoveDA dataset, and the results are presented in
Table 4. The proposed method still achieves the best performance on this dataset, with an IoU of 69.83% and an F1 score of 82.24%. Compared with the second-best compared segmentation network, the proposed method improves IoU by 1.73% and F1 by 1.22%, further demonstrating its effectiveness and robustness across different temporal and scene conditions. Since the LoveDA dataset contains a large number of elongated water bodies, Transformer-based and Mamba-based segmentation networks such as CTCFNet, AfaMamba, and MF-Mamba perform worse than CNN-based methods in this scenario. Nevertheless, the proposed method, by incorporating a residual stem, a boundary refinement module, and omnidirectional Mamba for long-range modeling, still achieves strong segmentation performance. MESA-Net achieves Precision and Recall of 83.09% and 81.40%, respectively, demonstrating that it is capable of adequately identifying water bodies whilst minimizing false positives, thereby exhibiting superior predictive balance.
In addition, compared with dedicated water body segmentation networks, MESA-Net also outperforms BiSeNet, MECNet, and MF_Seg on the LoveDA dataset. Among them, the best-performing baseline, MECNet, achieves 65.28% IoU and 78.99% F1, whereas the proposed method reaches 69.83% and 82.24%, yielding improvements of 4.55% and 3.25%, respectively, indicating a more pronounced advantage. Meanwhile, BiSeNet and MF_Seg achieve IoU scores of 63.55% and 63.33%, respectively, reflecting relatively lower overall performance. These results demonstrate that the proposed method is not only effective for karst water body scenarios but also generalizes well to water segmentation tasks in high-resolution and complex surface environments. This can be attributed to the targeted design of the proposed method in three aspects: boundary enhancement, small-object perception, and continuity modeling of elongated structures, enabling the model to better preserve water body integrity and reduce both false positives and missed detections under complex background interference.
To better evaluate the performance of the model, five representative prediction results from the LoveDA dataset are also presented for comparison, as shown in
Figure 10. As illustrated in
Figure 10a, only the CNN-based SFFNet and MECNet successfully extract the slender water bodies within the red box; however, due to the spectral similarity between farmland and water, slight misclassification occurs. In contrast, the proposed method demonstrates more accurate segmentation without erroneous predictions. As shown in
Figure 10b,c, for small water body segmentation, the CNN-based U-Net and the proposed method achieve relatively better results, while other comparative methods suffer from both false positives and missed detections. In
Figure 10d, the water bodies located within farmland appear dark green, making their spectral characteristics similar to vegetation, and thus most comparative methods fail to identify them effectively. Furthermore, as shown in
Figure 10e, due to the high spectral similarity between roads and water bodies, some models incorrectly classify roads as water. The proposed method performs well in both scenarios, further demonstrating the strong robustness of MESA-Net against interference and its capability in extracting slender water bodies. Overall, under complex scenarios involving spectral similarity and elongated water bodies, the proposed method achieves higher segmentation accuracy and robustness. Moreover, it effectively preserves the structural integrity of water bodies under complex background interference, while reducing both false positives and missed detections.
3.4. Cross-Validation on Different Datasets
To further evaluate the generalization capability of the proposed model under different data distribution conditions, cross-dataset experiments are conducted in this study. Specifically, LJ-Water, Water-CD, and LoveDA are each used as training sets, while the remaining datasets are used for testing, forming multiple cross-domain experimental settings. The results are presented in
Table 5. Under cross-dataset evaluation scenarios, all methods exhibit performance degradation to varying degrees, which is mainly attributed to differences in imaging conditions, spatial resolution, and land cover distribution across datasets. However, compared with other methods, the proposed MESA-Net demonstrates superior stability and robustness in most cross-domain settings. For example, under the setting of training on LJ-Water and testing on Water-CD, MESA-Net achieves an IoU of 88.70% and an F1 score of 94.01%, significantly outperforming other methods. Under the setting of training on LoveDA and testing on Water-CD, although the overall accuracy decreases, the proposed method still maintains relatively strong performance. In contrast, other methods suffer more severe performance degradation in cross-dataset scenarios. For instance, Res-UNet++ achieves high accuracy on the in-domain dataset but shows a dramatic drop in IoU from 85.78% to 29.89% during cross-domain testing, indicating high sensitivity to distribution shifts. In addition, the Transformer-based water segmentation network MF_Seg exhibits unstable performance under cross-domain settings, with IoU mostly below 50%, suggesting that its global modeling capability is insufficient for effective transfer under distribution shifts.
Further analysis of the generalization differences across datasets reveals that model performance is closely related to the consistency of data sources. When the training and testing datasets share similar sensor types and spectral characteristics, such as LJ-Water and Water-CD, the model can more easily learn transferable features, resulting in smaller performance degradation. In contrast, when there are significant differences between data sources such as LoveDA and Water-CD, variations in spatial resolution and imaging mechanisms limit the model’s generalization ability, leading to more pronounced performance decline.
Overall, although performance degradation is inevitable in cross-dataset evaluation, the proposed method maintains strong stability and relatively small performance fluctuations under different data distribution conditions, demonstrating competitive cross-region generalization capability in complex remote sensing scenarios. This finding is consistent with previous studies, which report that although cross-domain performance typically decreases, robust models can still retain comparative advantages.
3.5. Ablation Experiments
To validate the contribution of each module to the proposed MESA-Net for water body segmentation, ablation experiments are conducted on four components: Residual Stem, OGLMB, CAFF, and DGHEF. Specifically, eight groups of module ablation experiments are performed on the LJ-Water dataset, as shown in
Table 6. From No. 1, it can be observed that the baseline model ResNet18 achieves an IoU of 58.34% and an F1 score of 73.69% on the LJ-Water dataset. Furthermore, as shown in No. 2–No. 4 and No. 8, with the progressive incorporation of Residual Stem, OGLMB, CAFF, and DGHEF, the model performance improves steadily. When all four modules are integrated, the model achieves the best performance. In addition, removal-based ablation experiments are conducted, where each module is removed individually from the full model. The results are presented in No. 4–No. 7 of
Table 6. It can be observed that removing any single module leads to a noticeable decline in performance, indicating that each component contributes positively to the overall model. Among them, the removal of CAFF or DGHEF results in more significant performance degradation, highlighting the critical role of multi-scale feature fusion and boundary enhancement in water body segmentation under complex scenarios. Meanwhile, OGLMB and Residual Stem further enhance the model’s capability in capturing global structural information and fine-grained details. Overall, the four modules exhibit strong complementarity, jointly contributing to the performance improvement of the proposed model.
To further validate the effectiveness of each module, five groups of ablation results are selected for visual comparison, as shown in
Figure 11. As illustrated in
Figure 11a,b, the baseline model produces relatively scattered responses and obvious low-confidence transition regions around water boundaries, indicating insufficient discrimination between water bodies and complex backgrounds. The comparison between No. 4 and No. 8 further shows that, after introducing DGHEF, the boundary responses become noticeably sharper and more continuous, while the ambiguous transition regions are significantly reduced. In particular, irregular and elongated boundary structures are better preserved in No. 8, demonstrating enhanced capability in fine-grained boundary representation under complex karst scenes. The final predictions of MESA-Net are highly consistent with the ground truth (GT) in both shape and extent, and the background is effectively suppressed to low responses. Furthermore, as shown in
Figure 11d, the baseline model is almost incapable of effectively responding to small water bodies, producing only sparse local activations. With the incorporation of modules such as CAFF and OGLMB, small water bodies are progressively activated and form continuous structures, indicating a significant improvement in capturing fine-grained features. In addition, as shown in
Figure 11e, in complex background scenarios (including buildings, bare land, and shadows), the baseline model assigns low confidence to water regions. As more modules are introduced, the confidence of water regions increases while background interference is gradually suppressed.
A comparison among different module combinations (such as No. 4–No. 7) further reveals the complementary roles of each component. As shown in
Figure 11c, configurations No. 4–No. 6 perform well in small-object detection but still suffer from background noise. In contrast, as shown in
Figure 11c,d, No. 7 is more effective in suppressing false positives but is less sensitive to small water bodies and boundary details. The final model (MESA-Net) integrates the strengths of all modules, achieving the best consistency and discriminative capability across large-scale water bodies, small elongated structures, and complex background scenarios.
3.6. Results of Traditional Indexing Methods
To further validate the necessity of employing a deep learning framework in complex karst terrains, four representative traditional water extraction indices, including NDWI [
11], MNDWI [
12], AWEI [
10], and WRI [
56], were selected for comparison experiments on the LJ-Water dataset. For NDWI, MNDWI, and AWEI, the segmentation threshold was uniformly set to 0, where pixels with index values greater than 0 were classified as water bodies. For WRI, the threshold was set to 1 after threshold tuning, where pixels with values greater than 1 were regarded as water bodies.
As shown in
Table 7, traditional index-based methods exhibit relatively limited performance on the LJ-Water dataset. Among them, NDWI achieves the best performance, with 65.05% IoU and 76.00% F1, while MNDWI and WRI obtain even lower results. Although AWEI is designed to suppress shadow interference, its segmentation accuracy remains unsatisfactory under complex karst conditions. This is mainly because water bodies in karst regions are often affected by mountain shadows, vegetation occlusion, bare rocks, and spectrally similar dark objects, which makes fixed-threshold spectral indices prone to false positives and missed detections.
In contrast, the proposed MESA-Net achieves 84.59% IoU and 91.65% F1 on the same dataset, significantly outperforming all traditional index-based methods. Compared with the best-performing traditional method (NDWI), MESA-Net improves IoU and F1 by 19.54% and 15.65%, respectively. These results demonstrate that simple threshold-based spectral indices are insufficient for accurately segmenting fragmented, elongated, and small-scale water bodies in complex karst terrains. Benefiting from multi-scale feature fusion, global-local dependency modeling, and edge-aware enhancement mechanisms, the proposed method is more capable of suppressing background interference while preserving water-body continuity and boundary details.
In addition, we have selected five groups of prediction results for comparison, as shown in
Figure 12. As shown in
Figure 12a, the spectral characteristics of water bodies and mountain vegetation are highly similar. The traditional index method exhibits discontinuities when extracting elongated water bodies. In contrast, the proposed method successfully segments the water bodies in a relatively complete manner. As shown in
Figure 12b, there is a bridge in the river; MNDWI, AWEI, and WRI incorrectly identify the bridge as water. Although NDWI avoids the bridge to some extent, the segmentation of the boundary region between the water and the bridge remains unsatisfactory. MESA-Net effectively avoids false positives for the bridge and demonstrates good boundary extraction performance. As shown in
Figure 12c, traditional methods exhibit severe false segmentation in built-up areas, whereas the proposed method effectively mitigates this phenomenon. As shown in
Figure 12d,e, tributaries extending from the main, elongated river channel penetrate deep into the valley. Traditional index-based methods all exhibit varying degrees of omission when segmenting these tributaries. MESA-Net successfully segments the tributary within the red box. Overall, in karst terrain, the traditional water body index method is prone to missing segmentation and incorrect segmentation, and its segmentation effect is inferior compared to the proposed method and other representative deep learning methods.
3.7. Comparison of Parameters
To further investigate the model complexity, comparative experiments are conducted under the same experimental settings. Two key aspects are evaluated, namely the number of parameters (Params) and floating-point operations (FLOPs).
As shown in
Figure 13a, the proposed method requires 7.18 G FLOPs, which is slightly higher than AfaMamba (7.01 G FLOPs). Although AfaMamba has a lower computational cost, its water segmentation performance is inferior to that of the proposed method. Traditional CNN-based methods, such as U-Net and DeepLabV3+, exhibit significantly higher computational complexity, reaching 81.7 G and 45.68 G FLOPs, respectively. In addition, Transformer-based methods such as MF_Seg and CTCFNet also incur high computational cost due to their complex architectures, with FLOPs of 81.87 G and 111.16 G, respectively. Compared with dedicated water segmentation models such as BiSeNet and MECNet, the proposed model achieves clear advantages in terms of FLOPs. As shown in
Figure 13b, in terms of parameter scale, Transformer-based methods such as CTCFNet have a relatively large number of parameters, reaching 68.64 M. Res-UNet++ introduces residual connections on top of UNet++, which significantly reduces the parameter size to 4.06 M. Mamba-based methods, such as AfaMamba and MF-Mamba, incorporate state space models, resulting in parameter sizes of 13.48 M and 11.27 M, respectively. In comparison, the proposed model still maintains advantages over dedicated water segmentation networks in terms of parameter efficiency.
Overall, the proposed model achieves a better balance among parameter size, computational cost, and segmentation performance. Specifically, MESA-Net has 12.47 M parameters and requires 7.18 G FLOPs. While maintaining relatively low complexity, it is still capable of achieving strong segmentation performance, demonstrating high potential for practical deployment.
4. Discussion
From the analysis in
Section 3.1 on Water-CD, LoveDA, and the karst water body dataset LJ-Water constructed in this study, it can be observed that significant differences exist among these datasets in terms of water body scale distribution, background complexity, and types of interference. Specifically, water boundaries in Water-CD are relatively clear, whereas LoveDA and LJ-Water contain a large number of small, elongated water bodies affected by shadows, bare rocks, and vegetation interference. Combined with the experimental results in
Section 3.3, it can be found that the proposed method not only outperforms advanced general deep learning segmentation networks (DL) on all three datasets, but also consistently surpasses water-specific segmentation methods (WS). This demonstrates that the method possesses strong robustness and generalization capabilities in complex backgrounds and across diverse scenarios, such as karst landscapes. Further analysis based on comparative results shows that, as illustrated in
Figure 8, CNN-based methods exhibit advantages in local edge and texture extraction; however, their limited receptive fields restrict effective modeling of slender water bodies and long-range continuous structures. Hybrid CNN–Transformer methods enhance global contextual representation but still suffer from insufficient preservation of small-scale water bodies and high-frequency boundary details. As shown in
Figure 10, CNN–Mamba hybrid methods perform well in long-range dependency modeling and computational efficiency, yet they remain insufficient in capturing boundary information and weak target features under complex backgrounds. From the perspective of dedicated water segmentation networks, although existing methods are specifically designed for water body extraction, they still struggle to simultaneously address multi-scale perception, boundary refinement, and structural continuity when dealing with karst environments, fragmented small-scale water bodies, and high-resolution complex surfaces. Moreover, as observed from the visualization results in
Figure 8,
Figure 9 and
Figure 10, the proposed method demonstrates more stable performance in maintaining the continuity of slender water bodies and suppressing complex background interference. This can be mainly attributed to the DGHEF module, which enhances boundary representation through gradient priors while suppressing pseudo-edge responses, and the OGLMB module, which establishes effective collaboration between global and local features. This enables the model to maintain overall consistency while strengthening fine-grained detail representation. The complementary interactions among different modules further improve the model’s adaptability across multiple scales and complex scenarios.
Although the proposed method generally achieves good segmentation results in complex remote sensing scenarios, minor local misclassifications or omissions may still occur in certain challenging cases.
Figure 14 shows typical examples from the LJ-Water, Water-CD, and LoveDA datasets. As shown in
Figure 14a, although the proposed method successfully preserves the overall structure of mountainous water bodies, a small number of mountain shadows with spectral characteristics similar to those of water bodies are incorrectly identified as water. In
Figure 14b, the model accurately extracts the main river structure in the confluence area; however, due to sediment accumulation and spectral discontinuities, a very narrow segment of the water body is partially omitted, resulting in minor discontinuities in the local area. As shown in
Figure 14c, under vegetation interference, the proposed method still maintains accurate segmentation for most water bodies, but minor omissions occur near the boundaries of shadows, as shadows alter the spectral response of the water surface. Overall, these results indicate that the proposed method maintains good robustness and structural continuity under complex background conditions; however, it still faces challenges in extremely difficult scenarios involving minute water bodies, severe spectral confusion, and highly irregular boundary details. Future work will focus on enhancing the ability to characterize fine-scale structures and improving robustness against complex illumination and shadow interference, thereby further improving segmentation accuracy in challenging remote sensing environments.
In addition, the current model is based on single-temporal remote sensing imagery and therefore lacks the ability to capture the temporal dynamics of water bodies. The generalization performance may also degrade under cross-sensor or multi-source data scenarios due to differences in spatial resolution, imaging conditions, and spectral characteristics across datasets. To address these issues, future work will further explore multi-temporal modeling, multi-source information fusion, and domain adaptation strategies to enhance the robustness and generalization capability of the model. In particular, unsupervised domain adaptation and domain generalization strategies could be introduced to alleviate distribution discrepancies caused by differences in spatial resolution, imaging conditions, and spectral characteristics across datasets. In addition, feature alignment and adversarial adaptation methods may help improve the transferability of the proposed model under cross-region and cross-sensor scenarios.
5. Conclusions
To address the challenges of object segmentation in karst regions, such as significant variations in scale, ambiguous boundaries, and severe background interference, this paper proposes a multi-directional edge-aware network with scale adaptation suitable for complex scenarios, named MESA-Net. By integrating the Cross-scale Adaptive Feature Fusion module, the Directional Gradient Histogram Edge-guided Fusion module, and the Omni-directional Global–Local Mamba Block, the proposed method effectively improves segmentation accuracy and stability in complex environments.
In terms of network architecture, ResNet-18 is adopted as the encoder to construct an encoder–decoder framework. In the decoding stage, a Cross-scale Adaptive Feature Fusion module (CAFF) is introduced, which performs multi-scale feature fusion and dynamic weight allocation across different encoder layers. This enables effective integration of multi-scale contextual information and enhances the model’s ability to perceive both large water bodies and small-scale targets in karst regions. To address the issue of boundary interference in complex backgrounds, a Directional Gradient Histogram Edge-guided Fusion module (DGHEF) is designed. By incorporating explicit gradient histogram representations and boundary-guided mechanisms, it significantly improves fine-grained boundary delineation while suppressing pseudo-edge responses. Furthermore, an Omni-directional Global–Local Mamba Block (OGLMB) is proposed, which leverages omni-directional state space modeling and cross-attention mechanisms to achieve effective collaboration between global semantic information and local detail features. This enhances the model’s capability in preserving structural continuity, particularly in karst scenes featuring elongated water bodies and multiple objects. In addition, the LJ-Water dataset constructed in this study focuses on the characteristics of karst water bodies, such as fragmentation, elongation, and high confusion, providing a challenging benchmark for water segmentation in complex scenarios and enabling a more comprehensive evaluation of model performance in real-world applications.
Extensive experiments were conducted on the self-constructed LJ-Water dataset as well as public datasets Water-CD and LoveDA. The results demonstrate that MESA-Net outperforms a variety of advanced general-purpose deep learning segmentation networks and dedicated water segmentation methods in terms of IoU and F1 scores. Specifically, it achieves 84.59% IoU and 91.65% F1 on LJ-Water, 92.15% IoU and 95.91% F1 on Water-CD, and 69.83% IoU and 82.24% F1 on LoveDA. These results not only validate the effectiveness of each module in multi-scale feature fusion, boundary enhancement, and global dependency modeling but also demonstrate the robustness and generalization capability of the proposed method under complex backgrounds and cross-region scenarios. In terms of model complexity and inference efficiency, MESA-Net has only 12.47 M parameters and a computational complexity of 7.18 GFLOPs, indicating that it strikes a good balance between lightweight design and feature representation capabilities, and thus holds significant potential for practical deployment.
Overall, MESA-Net exhibits superior performance in water body segmentation tasks under complex remote sensing environments, showing clear advantages in maintaining the continuity of slender water bodies, detecting small water targets, and suppressing background interference. Future work will further explore multi-temporal remote sensing data and multi-source information fusion to enhance the model’s adaptability and practical value in dynamic environments.