A highly generalizable water body extraction method and system based on remote sensing images
By employing a SAM model that combines multi-source remote sensing image data annotation, data augmentation, and two-stage fine-tuning, the accuracy and robustness of water body extraction methods in complex environments have been addressed. This model achieves highly generalizable water body extraction and supports high-precision monitoring across regions, seasons, and sensors.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2026-04-03
AI Technical Summary
Existing methods for water body extraction from remote sensing images have poor accuracy and robustness in complex backgrounds and diverse environments, especially in terms of insufficient generalization ability in cross-regional, cross-seasonal, and cross-sensor scenarios.
A highly generalizable water body extraction method is constructed using a SAM model with multi-source remote sensing image data annotation, data augmentation, band transformation, inter-class variance screening, and two-stage fine-tuning. This method includes data preprocessing, parallel convolutional neural network, and fine-tuning of the SAM model to generate a water body sensitive image encoder and a mask decoder.
It improves the accuracy and stability of water body extraction, and achieves high-performance extraction in complex backgrounds, across regions, seasons, and sensor scenarios, providing an automated, efficient, and low-cost water resource monitoring solution.
Smart Images

Figure CN120612606B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of remote sensing image processing technology, and in particular to a highly generalizable water body extraction method and system based on remote sensing images. Background Technology
[0002] Surface water, encompassing rivers, lakes, and swamps, plays a crucial role in agriculture, industrial production, aquaculture, and aquatic and terrestrial ecosystems. Fluctuations in water body area have a profound impact on environmental factors such as ecological balance and biogeochemical cycles. However, due to climate change, seasonal changes, and human activities, the area of surface water bodies is constantly changing, posing significant challenges to water resource monitoring and management. Remote sensing technology, with its advantages of a macroscopic perspective, dynamic monitoring, and high cost-effectiveness, has become an important tool for monitoring water resource changes, assessing water quality, and monitoring flood disasters. Remote sensing data, with its wide coverage, short update cycle, and large information volume, has been widely used in various fields such as water resource change monitoring, water quality assessment, flood disaster monitoring, and loss assessment. Extracting surface water information from remote sensing imagery, especially from satellite imagery, is widely considered an efficient and effective method.
[0003] However, despite the invaluable information resources that remote sensing imagery provides for water body monitoring, existing water extraction methods still have limitations in terms of different remote sensing data sources, band selection, and extraction techniques. Existing water extraction methods can be mainly divided into three categories: thresholding methods based on single-band images, identification methods based on spectral indices, and image classification-based techniques. While these methods can achieve certain extraction results under specific conditions, they still have significant shortcomings, especially in complex backgrounds and diverse remote sensing image environments, where their accuracy and robustness are poor.
[0004] First, thresholding methods based on single-band imagery extract water bodies by utilizing their spectral characteristics. However, this method is affected by mixed pixels (i.e., multiple land features contained in the same pixel), often leading to significant errors in water body boundary extraction, especially in complex terrain or background environments. Determining the threshold depends on the specific characteristics of the image, such as band selection and threshold setting, and typically requires extensive experimentation and manual intervention, which greatly reduces the automation level and operational efficiency of the method.
[0005] Secondly, water body identification methods based on spectral indices employ specifically designed spectral indices, such as NDWI, to extract water body information. While these methods are effective in certain scenarios, due to the complexity of the background environment and the diversity of spectral variations, a single spectral index method cannot adapt well to changes in different scenarios. In complex environments, especially under the influence of different lighting conditions, seasonal variations, or sensor differences, the accuracy of water body extraction decreases significantly, and the model's generalization ability is poor, failing to effectively cope with changing natural conditions.
[0006] Third, water body extraction methods based on remote sensing image classification often rely on large-scale labeled datasets for training deep learning models. While these methods can automatically learn features from the data, the need for a large amount of labeled training data leads to high costs and time consumption for data annotation. Moreover, current deep learning models often cannot handle small sample data well, especially in low-dimensional or high-noise data, resulting in unstable extraction performance and poor results. Furthermore, existing models generally lack good cross-sensor generalization ability when processing images from different remote sensing data sources and sensors, failing to achieve unified processing of remote sensing images from various sources. Although remote sensing images provide extremely valuable information resources for water body monitoring, their accuracy and robustness are poor in complex backgrounds and diverse remote sensing image environments.
[0007] Therefore, in the face of diverse environments involving complex backgrounds, cross-regional, cross-seasonal, and cross-sensor conditions, improving the accuracy and generalization ability of water body extraction is a technical problem that urgently needs to be solved. Summary of the Invention
[0008] To improve the accuracy and generalization ability of water body extraction, this application provides a highly generalizable water body extraction method and system based on remote sensing images.
[0009] Firstly, this application provides a highly generalizable water body extraction method based on remote sensing imagery, employing the following technical solution:
[0010] A highly generalizable water body extraction method based on remote sensing imagery, the extraction method comprising:
[0011] Acquire multi-source remote sensing image data and annotate water bodies to generate a labeled remote sensing image dataset;
[0012] The labeled remote sensing image dataset is cropped into image blocks of a preset size to generate the corresponding original image block dataset and labeled image block dataset;
[0013] Data augmentation processing is performed on the original image patch dataset and the labeled image patch dataset to generate an augmented dataset;
[0014] The enhanced dataset is subjected to band transformation processing, the inter-class variance between water bodies and non-water bodies is calculated, the band combination with the largest inter-class variance is selected, and the optimal augmented dataset is generated.
[0015] The expanded dataset is preprocessed to generate a vector format dataset, which is then divided into a training set, a validation set, and a test set.
[0016] A pre-built SAM model and a parallel convolutional neural network are used; the SAM model includes an image encoder, a cue encoder, and a mask decoder.
[0017] The cue encoder and mask decoder of the SAM model are frozen. The image encoder is fine-tuned in the first stage based on the training set and validation set. The remote sensing image features extracted by the parallel convolutional neural network are fused to generate a water-sensitive image encoder.
[0018] Freeze the water-sensitive image encoder, and perform a second-stage fine-tuning of the mask decoder based on the training set and validation set to obtain the fine-tuned water extraction professional model.
[0019] The water extraction model was tested based on the test set, and performance evaluation results were obtained.
[0020] The remote sensing image data to be extracted is input into the water body extraction professional model, and the water body extraction result small image is output and stitched together to obtain the full-size water body extraction result image.
[0021] By adopting the above technical solution, based on multi-source remote sensing imagery, and through systematic data construction, band selection, model fine-tuning, and inference strategies, the accuracy and stability of water body extraction are effectively improved. Compared with traditional deep models that rely on large sample training and have insufficient generalization ability, this method adapts to the differences in multi-source data through a fine-tuning mechanism, fully leveraging the model's feature extraction capabilities and decoding performance, achieving high-performance extraction under the condition of "small sample + large model". Regardless of complex backgrounds, cross-regional, cross-seasonal, or cross-sensor scenarios, this method maintains excellent extraction results, providing an automated, efficient, and low-cost solution for surface water resource monitoring.
[0022] Optionally, the steps of performing band transformation processing on the enhanced dataset, calculating the inter-class variance between water bodies and non-water bodies, selecting the band combination with the largest inter-class variance, and generating the band-optimal augmented dataset include:
[0023] Receive the enhanced dataset and the corresponding binarized labeled image blocks; in the binarized labeled image blocks, water areas are labeled as 1, and non-water areas are labeled as 0;
[0024] A candidate band set is generated according to preset rules, including single-band combinations, multi-band weighted fusion combinations, and spectral index combinations; each combination in the candidate band set is traversed to generate a corresponding single-channel grayscale image, thus generating a grayscale image set; for each grayscale image in the grayscale image set, water body pixel set and non-water body pixel set are segmented according to the binarized label image block, and the inter-class variance is calculated to generate a mapping relationship between band combinations and inter-class variance;
[0025] The band combination with the largest inter-class variance is selected as the optimal band combination. The grayscale image corresponding to the optimal band combination is used to replace the original multi-band input data to generate an expanded dataset with optimal bands.
[0026] By employing the aforementioned technical solutions, problems such as multi-band redundancy, lack of feature prominence, and severe background interference in remote sensing imagery are systematically addressed. By introducing inter-class variance, a statistically based indicator, quantitative analysis is performed on different types of band representations, including single-band, weighted combinations, and spectral indices, to select the combinations with the strongest discriminative power for water bodies. This method not only enhances the spectral sensitivity of the model's input data but also maintains the spatial structure and semantic consistency of the augmented dataset, laying a more solid data foundation for subsequent model training. The resulting optimal band augmented dataset can significantly improve the accuracy, robustness, and computational efficiency of remote sensing water body extraction tasks in practical applications.
[0027] Optionally, the single-band combination is selected from a single band in the visible light band, near-infrared band, or short-wave infrared band; the multi-band weighted fusion combination is a linear weighted combination of two or more bands; and the spectral index combination includes the normalized difference water index and the improved water index.
[0028] By employing the above technical solutions, the single-band combination method provides preliminary discrimination capability with low computational cost, the multi-band weighted fusion scheme enhances spectral expressiveness in complex scenes through linear combination, and the spectral index combination enhances the discrimination strength of water targets against background features through ratio normalization, exhibiting strong generalization ability and stability. This band combination method forms a highly scalable remote sensing band selection strategy with physical spectral basis and statistical optimization mechanism, providing solid and reliable data support and technical path for remote sensing water body extraction tasks.
[0029] Optionally, the step of preprocessing the augmented dataset to generate a vector format dataset includes:
[0030] The remote sensing image data sources in the expanded dataset are normalized to generate normalized image data.
[0031] The normalized image data is resized based on a preset size to obtain standardized image data.
[0032] Standardized image data is adapted for channels and mapped to pixel values to generate preprocessed data.
[0033] The preprocessed data is feature-encoded to generate an intermediate dataset containing embedded features;
[0034] Based on the labeled image patch dataset, the bounding box coordinates of the water body area are extracted, and the coordinate points of the water body and non-water body areas are randomly selected to generate bounding box cue and point cue data;
[0035] The embedded features, bounding box hints, dot hints data, and labeled image patch datasets are assembled into a vector format dataset.
[0036] By employing the above technical solutions, an efficient transformation process from raw enhanced remote sensing imagery to structured deep learning training data was achieved. Data normalization ensures the numerical uniformity of input features, while size standardization and channel adaptation provide format guarantees for model input. The SAM encoder extracts high-level semantic features, bounding boxes and point cues provide guidance mechanisms, and the final constructed vector dataset forms an end-to-end data structure that can be directly used for segmentation task training. This preprocessing strategy is not only highly adaptable to the target model architecture (such as SAM), but also possesses strong versatility and flexibility, capable of addressing the multi-scale, multi-source, and diverse challenges faced in remote sensing water body extraction.
[0037] Optionally, the first-stage fine-tuning parameters are configured as follows: the optimizer is Adamw_torch, and the learning rate is 5x10. -5 The LoraRank is 8, the Lora scaling factor is 16, the maximum context length is 1024, the batch size is 16, and the training epochs are 50.
[0038] Optionally, the parallel convolutional neural network includes four layer modules, each of which sequentially performs 3×3 convolution, ReLU activation, and 2×2 max pooling operations, and the output features are concatenated with the 1024-dimensional features of the water-sensitive image encoder of the SAM model.
[0039] Optionally, the second-stage fine-tuning parameters are configured as follows: the optimizer is Adamw_torch, and the learning rate is 1x10. -5 The batch size is 16, and the number of training rounds is 50.
[0040] Secondly, this application provides a highly generalizable water body extraction system based on remote sensing images, employing the following technical solution:
[0041] A highly generalizable water body extraction system based on remote sensing imagery, the extraction system comprising:
[0042] The data annotation module is used to acquire multi-source remote sensing image data and annotate water bodies to generate a labeled remote sensing image dataset; the cropping module is used to crop the labeled remote sensing image dataset into image blocks of a preset size to generate the corresponding original image block dataset and labeled image block dataset.
[0043] The data augmentation module is used to perform data augmentation processing on the original image patch dataset and the labeled image patch dataset to generate an augmented dataset;
[0044] The optimal band selection module is used to perform band transformation processing on the enhanced dataset, calculate the inter-class variance between water bodies and non-water bodies, select the band combination with the largest inter-class variance, and generate the optimal augmented dataset.
[0045] The data preprocessing module is used to preprocess the expanded dataset to generate a vector format dataset and divide it into a training set, a validation set, and a test set.
[0046] A building module is used to pre-build a SAM model and a parallel convolutional neural network; the SAM model includes an image encoder, a cue encoder, and a mask decoder.
[0047] The first fine-tuning module is used to freeze the cue encoder and mask decoder of the SAM model, perform a first-stage fine-tuning of the image encoder based on the training set and validation set, and fuse the remote sensing image features extracted by the parallel convolutional neural network to generate a water-sensitive image encoder.
[0048] The second fine-tuning module is used to freeze the water-sensitive image encoder and perform a second-stage fine-tuning of the mask decoder based on the training set and validation set to obtain the fine-tuned water extraction professional model.
[0049] The performance testing module is used to test the water body extraction professional model based on the test set and obtain performance evaluation results; the water body extraction module is used to input the remote sensing image data to be extracted into the water body extraction professional model, output the water body extraction result thumbnail and stitch it together to obtain the full-size water body extraction result image.
[0050] Thirdly, this application provides a computer device, which adopts the following technical solution:
[0051] A computer device includes a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to perform the steps of the method as described in the first aspect.
[0052] Fourthly, this application provides a computer-readable storage medium, which adopts the following technical solution:
[0053] A computer-readable storage medium storing a computer program that can be loaded by a processor and executed as in any of the methods in the first aspect.
[0054] In summary, this application includes at least one of the following beneficial technical effects: By using a two-stage fine-tuning segmentation basic model (SAM) combined with a small-sample training strategy for multi-source remote sensing data, a highly generalizable professional model for water body extraction is constructed, solving the problems of traditional methods relying on large-scale labeled data, poor cross-source adaptability, and low accuracy in complex scenes. The technical solution of this application achieves end-to-end high-precision water body extraction while reducing labor costs, supporting cross-source remote sensing image processing in large-scale, long-term, and complex environments, significantly improving robustness and efficiency, and eliminating the need for manual intervention in threshold setting or feature design. Attached Figure Description
[0055] Figure 1 This is a schematic diagram of the first process of a highly generalizable water extraction method according to one embodiment of this application.
[0056] Figure 2 This is a flowchart of one embodiment of the present application, which combines a parallel convolutional neural network to perform the first-stage fine-tuning of the SAM image encoder.
[0057] Figure 3 This is a flowchart of a second-stage fine-tuning of the mask decoder according to one embodiment of this application.
[0058] Figure 4 This is a schematic diagram of the second process of a highly generalizable water extraction method according to one embodiment of this application.
[0059] Figure 5 This is a diagram illustrating remote sensing images of different bands, representing one embodiment of this application.
[0060] Figure 6 This is a schematic diagram of the third process of a highly generalizable water extraction method according to one embodiment of this application.
[0061] Figure 7 This is a quantitative comparison of the extraction results of the embodiments of this application and mainstream segmentation methods in the same study area.
[0062] Figure 8 This is a qualitative comparison of the results of this application's embodiments with other segmentation methods in a specific research area. Detailed Implementation
[0063] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figure 1-8 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.
[0064] This application discloses a highly generalizable water body extraction method based on remote sensing images.
[0065] Reference Figure 1 A highly generalizable water body extraction method based on remote sensing imagery, the extraction method includes:
[0066] Step S101: Acquire multi-source remote sensing image data and annotate water bodies to generate a labeled remote sensing image dataset;
[0067] In the water body extraction task, acquiring high-quality remote sensing image data and accurately labeling it is the first step. The core objective of this process is to generate a clearly labeled remote sensing image dataset that corresponds to actual water bodies and non-water areas. At this stage, raw images need to be extracted from different remote sensing data sources, commonly including satellite remote sensing data or aerial photographs. After acquiring these raw images, annotation tools (such as Labelme) can be used to visually interpret the water bodies in the images, generating binary label maps. Specifically, water areas are labeled with "1", and non-water areas are labeled with "0". This label data forms the basis for subsequent model training.
[0068] In this embodiment of the application, raw data of multi-source remote sensing images can be obtained from 45 locations with typical water bodies across the country on Google Earth, thereby improving the model's adaptability and generalization ability under complex conditions such as cross-sensor, cross-time, and cross-regional.
[0069] Step S102: The labeled remote sensing image dataset is cropped into image patches of a preset size to generate the corresponding original image patch dataset and labeled image patch dataset.
[0070] Remote sensing images often have extremely high spatial dimensions. To accommodate the input requirements of deep learning models and avoid excessive computational resource consumption, this step divides the entire remote sensing image into multiple small image blocks. Typically, a size of 256×256 or 512×512 pixels is used, as this size preserves sufficient spatial semantic information while keeping memory usage within a reasonable range during model training.
[0071] Understandably, deep neural networks have a limited receptive field for images. Images that are too large will prevent the model from capturing enough features, while images that are too small may lose contextual information. By simultaneously cropping the original image and its corresponding label image, semantic consistency between samples can be maintained, ensuring that each image patch has a complete input-output correspondence.
[0072] Step S103: Perform data augmentation on the original image patch dataset and the labeled image patch dataset to generate the augmented dataset;
[0073] Specifically, in remote sensing image processing, different imaging angles, seasonal changes, and climatic conditions can all lead to variations in the spectral representation and structural features of images. To simulate these variations, enhancement methods generally include rotation (45°, 90°, 135°), mirroring, image blurring (simulating the effects of different sensors or weather), and noise addition (simulating system noise or background complexity). The Gaussian noise addition operation used here is a means of simulating the unavoidable sensor errors and electromagnetic interference behavior of remote sensing imaging systems during the acquisition process.
[0074] It's important to note that a key aspect of augmentation is maintaining synchronization between the image and its label. For example, if an image is rotated 90° clockwise, its corresponding label image must also rotate synchronously to avoid training errors caused by label misalignment.
[0075] Step S104: Perform band transformation processing on the enhanced dataset, calculate the inter-class variance between water bodies and non-water bodies, select the band combination with the largest inter-class variance, and generate the optimal augmented dataset.
[0076] In remote sensing images, different spectral bands represent the reflection or radiation response of electromagnetic waves at different wavelengths. Water bodies exhibit significant differences in reflectivity between the visible and near-infrared bands, particularly in the near-infrared region where water bodies possess extremely low reflectivity, while vegetation, soil, and other ground features have higher reflectivity. Therefore, the spectral differences between water bodies and non-water bodies can be distinguished by analyzing the inter-class variance between spectral bands.
[0077] In this embodiment, the principle of "maximizing inter-class variance" can be adopted. Its basic principle originates from the Otsu method, a classic strategy used in image segmentation to find the optimal segmentation threshold. After converting the images with different band combinations into grayscale histograms, the variance of pixel grayscale values between the water and non-water classes is calculated. The larger the inter-class variance, the stronger the ability of the band combination to distinguish between water and non-water bodies. In band combination selection, spectral indices (such as NDWI, MNDWI) can be constructed, or combinations can be analyzed directly in the original band space, such as (Red, NIR), (Green, SWIR), etc.
[0078] Step S105: Perform data preprocessing on the expanded dataset to generate a vector format dataset, and divide it into a training set, a validation set, and a test set;
[0079] This involves constructing a data input structure suitable for fine-tuning the SAM model. The SAM model (Segment Anything Model) requires input not only image embedding but also auxiliary prompts such as bounding box prompts and point prompts. Therefore, the image data needs to be processed by embedding, normalized, and sized (e.g., adjusted to 1024×1024) and encapsulated in a SAM-specific format.
[0080] In this embodiment, the obtained augmented dataset is subjected to embedding processing, data normalization is achieved through Min-Max standardization, the data scale is transformed to 1024*1024 using the ResizeLongestSiuze method, data preprocessing is performed using Sam_model.preprocess, and encoding operation is performed using Sam_model.image_encoder, resulting in an npz format dataset containing embedding and GT (tags).
[0081] Furthermore, based on the obtained npz format dataset containing embeddings and ground truth (GT) labels, the data format required for the model was developed. Bounding box cues were obtained from the GT, and then GT-selected points were used as point cues. The vector fields of embed, bounding box cues, point cues, and GT were assembled into a vector format to obtain the dataset required for SAM model fine-tuning. This dataset was then divided into training, validation, and test sets in a 6:2:2 ratio for SAM model fine-tuning.
[0082] Step S106: Pre-build the SAM model and the parallel convolutional neural network;
[0083] The SAM model includes an image encoder, a cue encoder, and a mask decoder.
[0084] Specifically, the SAM (Segmentation and Masking) model is adopted as the basic framework. The SAM model consists of an image encoder, a cue encoder, and a mask decoder. The image encoder is responsible for extracting low-level features from remote sensing images, while the cue encoder enhances the focus of the image encoder by providing guidance and cues. The mask decoder generates the final segmentation result based on the features extracted by the encoder. Furthermore, to compensate for the insufficient feature extraction capability of the SAM model's image encoder in the initial stage, a parallel convolutional neural network (CNN) is introduced for feature extraction.
[0085] Step S107: Freeze the cue encoder and mask decoder of the SAM model, perform the first stage fine-tuning of the image encoder based on the training set and validation set, and fuse the remote sensing image features extracted by the parallel convolutional neural network to generate a water-sensitive image encoder.
[0086] Among them, the SAM model, as a pre-trained large model, has a powerful general image representation capability in its image encoder, but it lacks sensitivity to specific semantics (such as water bodies) in remote sensing images. Therefore, LoRA (Low-Rank Adaptation) technology can be used to perform lightweight fine-tuning of the image encoder. The principle of LoRA is to tune parameters by inserting a low-rank matrix into the original model parameter matrix, thereby achieving task adaptation without changing the model structure, and the number of parameters is much smaller than that of full fine-tuning.
[0087] In one embodiment of this application, LoRA technology is employed to fine-tune the image encoder portion of the SAM model using training and validation sets. The parameters required for the first stage of fine-tuning are set, wherein the optimizer is Adamw_torch and the learning rate is 5x10. -5 The LoraRank is 8, the Lora scaling factor is 16, the maximum context length is 1024, the batch size is 16, and the training epochs are 50.
[0088] Furthermore, since remote sensing images are characterized by multi-scale and complex texture details, a parallel CNN network is added for local texture feature extraction. This network is used in conjunction with the output of the SAM image encoder through feature fusion to improve the model's ability to perceive water details.
[0089] Reference Figure 2 This is a flowchart illustrating the first-stage fine-tuning of the SAM image encoder using a parallel convolutional neural network, as described in one embodiment of this application. Specifically, the parallel convolutional neural network (CNN) in this embodiment comprises multiple convolutional and pooling layers, effectively enhancing the model's ability to extract water features. For example, the CNN includes four hierarchical modules, each consisting of two 3×3 convolutional layers, followed by a ReLU linear unit and a 2×2 max pooling layer with a stride of 2. Each hierarchical module sequentially performs 3×3 convolution, ReLU activation, and 2×2 max pooling operations, and the output features are concatenated with the 1024-dimensional features of the SAM model's water-sensitive image encoder.
[0090] Step S108: Freeze the water-sensitive image encoder, and perform a second-stage fine-tuning of the mask decoder based on the training set and validation set to obtain the fine-tuned water extraction professional model.
[0091] The decoder determines the final segmentation performance of the model. After freezing the image encoder, targeted fine-tuning of the mask decoder can enhance its ability to map water semantic vectors. The decoder fine-tuning process keeps the input structure unchanged and optimizes only the output prediction, avoiding disturbance to the existing feature extraction foundation.
[0092] Reference Figure 3 This is a flowchart illustrating the second-stage fine-tuning of the mask decoder according to one embodiment of this application. The parameters required for the second-stage fine-tuning are set, with a learning rate of 1x10. -5 The batch size is 16, the number of training epochs is 50, and the optimizer is Adamw_torch. By setting appropriate learning rate, number of training epochs, optimizer, and other parameters, the model can gradually fit the pixel distribution characteristics of the water body region and effectively suppress misclassification of non-water body regions, thus obtaining a fine-tuned professional water extraction model.
[0093] Step S109: Test the water extraction professional model based on the test set to obtain performance evaluation results;
[0094] The performance evaluation metrics include Precision, Recall, F1 score, and Mean Intersection over Union (mIoU). These metrics comprehensively evaluate the model's performance in positive class identification, false negatives, false positives, and overall accuracy. In particular, mIoU, as a core metric in semantic segmentation, measures the degree of overlap between the predicted region and the ground truth label region.
[0095] Understandably, testing on a test set not used in training can accurately reflect the model's generalization ability. If metrics such as mIoU and F1-score remain at high levels, it indicates that the model is not only suitable for the training data environment but can also handle complex real-world remote sensing scenarios well.
[0096] Specifically, the formulas for calculating precision, recall, F1 score, and mean intersection over union (MIU) in performance evaluation metrics are as follows:
[0097]
[0098] In the above formula, TP indicates that the prediction is correct, the predicted result is positive, and the actual result is positive; FP (false positive) indicates that the prediction is incorrect, the predicted result is positive, and the actual result is negative; FN (false negative) indicates that the prediction is incorrect, the predicted result is negative, and the actual result is positive; TN (true negative) indicates that the prediction is correct, the predicted result is negative, and the actual result is negative; P stands for Precision, R stands for Recall, and F1 stands for Balanced Score.
[0099] Step S110: Input the remote sensing image data to be extracted into the water body extraction professional model, output the water body extraction result thumbnail and stitch it together to obtain the full-size water body extraction result image.
[0100] The process involves inputting the remote sensing image data to be processed into a trained water extraction model to generate water extraction results. Since the model typically runs on small images, the output results need to be stitched together to restore the original image, ultimately resulting in a water extraction image of the same size as the original remote sensing image.
[0101] In this embodiment, since the model input size is fixed, to adapt to the processing requirements of the entire remote sensing image, a method of slice input, small-map inference, and full-image stitching can be adopted. The image segmentation module processes the image block by block to maintain consistency in accuracy; the stitching module restores the prediction results into a complete image with the same size and geographic spatial structure as the original image. In addition, this process also requires smoothing the map tile boundaries or overlapping prediction to avoid edge prediction errors caused by slicing.
[0102] In the above embodiments, based on multi-source remote sensing imagery, a systematic approach to data construction, band selection, model fine-tuning, and inference strategies effectively improves the accuracy and stability of water body extraction. Compared with traditional deep models that rely on large-sample training and lack generalization ability, this method adapts to the differences in multi-source data through a fine-tuning mechanism, fully leveraging the model's feature extraction capabilities and decoding performance, achieving high-performance extraction under the condition of "small sample + large model". Regardless of complex backgrounds, cross-regional, cross-seasonal, or cross-sensor scenarios, this method maintains excellent extraction results, providing an automated, efficient, and low-cost solution for surface water resource monitoring.
[0103] Reference Figure 4 As one implementation of step S104, the steps of performing band transformation processing on the enhanced dataset, calculating the inter-class variance between water bodies and non-water bodies, selecting the band combination with the largest inter-class variance, and generating the band-optimal augmented dataset include:
[0104] Step S201: Receive the enhanced dataset and the corresponding binarized labeled image blocks;
[0105] In the binarized labeled image patch, water areas are marked as 1, and non-water areas are marked as 0. The enhanced remote sensing image dataset refers to the image set expanded through operations such as rotation, mirroring, and adding noise, with the aim of simulating different imaging conditions and environmental changes to improve the model's generalization ability. The labeled image patch is a binary image precisely labeled using visualization tools, where all pixels identified as water are assigned a value of 1, and non-water areas are assigned a value of 0, to facilitate subsequent statistical analysis based on pixel classification.
[0106] Understandably, this combination of "enhancement + labeling" constitutes the standard data structure in remote sensing imagery tasks. The labels, serving as classification criteria, are a reference for subsequent band optimization processes, including category statistics and calculation of inter-class differences. This data structure ensures supervision and accuracy during the band optimization process.
[0107] Step S202: Generate a candidate band set including single-band combinations, multi-band weighted fusion combinations, and spectral index combinations according to preset rules;
[0108] In remote sensing image processing, different bands record the reflectivity information of ground features to electromagnetic waves of different wavelengths. Water bodies exhibit significant characteristics in the visible light bands (such as Green), near-infrared (NIR), and short-wave infrared (SWIR): especially in the NIR and SWIR bands, water bodies have extremely low reflectivity, while ground features such as soil and vegetation have relatively high reflectivity. Therefore, selecting appropriate band combinations is crucial for enhancing water body identification capabilities.
[0109] In one embodiment of this application, the construction of the candidate band set typically includes three categories:
[0110] Single-band combination: This method selects a single band as the basis for analysis, such as Green, NIR, or SWIR. This method is simple and fast, but it is easily affected by background interference.
[0111] Multi-band weighted fusion: By linearly weighting multiple bands (e.g., 0.4×Green + 0.6×NIR), the characteristics of different bands are integrated, further improving separability. The weights can be set empirically or dynamically adjusted to meet the reflectance differences required in specific geographical scenarios.
[0112] Combinations of spectral indices, such as NDWI (Normalized Difference Water Index) and MNDWI (Modified Normalized Difference Water Index), effectively amplify the spectral differences between water bodies and the background through ratio calculations, and are a classic method for remote sensing water body identification.
[0113] Step S203: Traverse each combination in the candidate band set to generate the corresponding single-channel grayscale image and generate a grayscale image set.
[0114] This process involves transforming and compressing multi-band remote sensing data into a single grayscale image, i.e., a two-dimensional matrix. The grayscale value of each pixel represents the comprehensive reflectance or spectral response of that location under a specific combination of bands. Whether using single-band selection, weighted combination, or spectral index, the final result is a grayscale image with "inter-class difference mapping capability."
[0115] For example, using the NDWI formula to calculate (Green-NIR) / (Green+NIR) can make the value for water areas approach 1 and non-water areas approach 0. After standardizing the result and mapping it to the 0-255 or 0-1 range, a single-channel grayscale image can be constructed. This process is called "band synthesis" or "band transformation" in the field of image processing, and its purpose is to extract a more discriminative single representation through information fusion.
[0116] Step S204: For each grayscale image in the grayscale image set, divide the water body pixel set and the non-water body pixel set according to the binarized label image block, calculate the inter-class variance, and generate the mapping relationship between band combination and inter-class variance.
[0117] Inter-class variance measures the ratio of the difference in mean between two classes (in this case, water and non-water) to their internal variance, and is used to characterize the separability of two classes on a given feature dimension.
[0118] Specifically, in each grayscale image, pixels are divided into water body category (label=1) and non-water body category (label=0) based on the label image. The average grayscale values (μ1, μ2) and variances of the two categories are then calculated. Then, calculate the inter-class variance using the following formula:
[0119] S=(μ1-μ2) 2 / (σ1 2 +σ2 2 );
[0120] The essence of the above formula is the core idea of the Otsu method: the larger the difference between the means of the two classes and the smaller the intra-class variance, the better the segmentation effect. Among them, the inter-class variance, as a mathematical quantitative indicator, objectively evaluates the ability of each band combination to distinguish between water bodies and non-water bodies, providing a unified and comparable standard for band optimization, and has high repeatability and numerical interpretability.
[0121] Step S205: Select the band combination with the largest inter-class variance as the optimal band combination, replace the original multi-band input data with the grayscale image corresponding to the optimal band combination, and generate the band-optimal extended dataset.
[0122] After evaluating the inter-class variance, the band combination corresponding to the maximum value is selected, indicating that this combination best distinguishes water bodies from non-water bodies at the pixel level. This is not merely about selecting the optimal feature dimension, but also about providing the most spectrally sensitive input channel for subsequent deep learning model training, thereby maximizing the model's ability to perceive the target category.
[0123] Reference Figure 5 The image shown is a remote sensing image of different bands according to an embodiment of this application. The variances between water bodies and non-water bodies are calculated and are 32.54, 853.72, 805.20 and 3521.00 from left to right.
[0124] Specifically, the core logic of replacing the original multi-band input data is dimensionality reduction, replacing the redundant representation of the original data with a more refined information representation, and maintaining consistency with the spatial structure (resolution, size) of the label graph to ensure spatial consistency during subsequent model training.
[0125] Understandably, the band selection and input replacement guided by inter-class variance greatly improve the discriminative information density of the data and the signal-to-noise ratio of the model input, providing more optimized and discriminative training samples for subsequent water body extraction models, and improving the clarity of spectral semantics while maintaining the spatial distribution.
[0126] The above implementation systematically addresses issues such as multi-band redundancy, lack of feature prominence, and severe background interference in remote sensing imagery. By introducing inter-class variance, a statistically based indicator, quantitative analysis is performed on different types of band representations, including single-band, weighted combinations, and spectral indices, to select the combinations most discriminative for water bodies. This method not only enhances the spectral sensitivity of the model's input data but also maintains the spatial structure and semantic consistency of the augmented dataset, laying a more solid data foundation for subsequent model training. The resulting optimal band augmented dataset significantly improves the accuracy, robustness, and computational efficiency of remote sensing water body extraction tasks in practical applications.
[0127] As one implementation of the candidate band set in step S202, the single band combination is selected from a single band in the visible light band, near-infrared band, or short-wave infrared band; the multi-band weighted fusion combination is a linear weighted combination of two or more bands, and the spectral index combination includes the normalized difference water index and the improved water index.
[0128] Single-band combination refers to directly extracting a specific band from a remote sensing image as the basis for water body identification. The theoretical basis for this method stems from the differences in electromagnetic wave reflectance characteristics of ground features in remote sensing spectroscopy. Water bodies exhibit significantly different reflectance characteristics compared to other ground features (such as vegetation, soil, and buildings) in the visible light band (especially the green band), near-infrared (NIR) band, and short-wave infrared (SWIR) band. Particularly in the NIR and SWIR bands, the reflectance of water bodies approaches zero, while other ground features maintain high reflectance values. Therefore, selecting any one of these bands as a single-band combination can, to a certain extent, separate water bodies from non-water bodies.
[0129] For example, the NIR band can be used as the basis for generating a single-channel grayscale image. Water areas will show low grayscale values, while vegetation and ground will show high grayscale values. The Green band also has a certain separation capability because water still has a low reflectivity in the Green band.
[0130] Multi-band weighted fusion refers to linearly weighting two or more bands according to a certain ratio to generate a fused expression, aiming to achieve a stronger ability to identify water bodies. The logical basis of this method is that different bands have different responses to water and non-water bodies; fusing them can utilize the complementarity between multiple bands to extract the most sensitive feature representations for the target features. The weights can be determined based on prior knowledge, expert experience, or statistical methods, often assigning higher weight coefficients to bands with greater discriminative power. For example, if the combined weights of the Green band and the NIR band are 0.4 and 0.6 respectively, it indicates that we believe the NIR band is more sensitive to water body identification.
[0131] For example, 0.5×Green+0.5×NIR emphasizes the contrast between green and near-infrared, while 0.3×Red+0.4×Green+0.3×SWIR emphasizes the combined advantages of multiple bands, making it easier to identify water bodies in shallow water areas or under complex backgrounds.
[0132] In addition, spectral index combination refers to the use of mathematical functions to perform ratios, differences, and other operations on remote sensing bands to form a standardized index expression, which is used to enhance the characteristics of target features (such as water bodies). The most representative examples of this method are the Normalized Difference Water Index (NDWI) and the Modified Difference Water Index (MNDWI), which are core indicators in remote sensing water body extraction research.
[0133] The formula for calculating NDWI (Normalized Difference Water Index) is: NDWI = (Green - NIR) / (Green + NIR). The index enhances the water body signal by the difference in reflection between the green band and the near-infrared band. Because water has moderate reflection of the Green band and almost no reflection of the NIR band, the NDWI value is usually close to 1 in water areas, while the value is close to or less than 0 in non-water areas.
[0134] MNDWI (Modified NDWI) further utilizes SWIR instead of NIR to enhance the ability to identify urban water bodies or water bodies with complex boundaries: MNDWI = (Green - SWIR) / (Green + SWIR). SWIR bands have high reflectivity for non-water areas such as buildings and soil, while water bodies still exhibit low reflectivity. Therefore, in MNDWI representation, the response of water areas is more prominent, making it particularly suitable for water body extraction against the background of complex land cover types.
[0135] In the above embodiments, the single-band combination method provides preliminary discrimination capability with low computational cost, the multi-band weighted fusion scheme enhances spectral expressiveness in complex scenes through linear combination, and the spectral index combination enhances the discrimination strength of water targets against background features through ratio normalization, exhibiting strong generalization ability and stability. This band combination method forms a highly scalable remote sensing band selection strategy with physical spectral basis and statistical optimization mechanism, providing solid and reliable data support and technical path in remote sensing water body extraction tasks.
[0136] Reference Figure 6 As one implementation of step S105, the step of preprocessing the expanded dataset to generate a vector format dataset includes:
[0137] Step S301: Normalize the remote sensing image data sources in the expanded dataset to generate normalized image data;
[0138] Normalization eliminates the absolute dimensional differences in data distribution, making the feature representations of different samples consistent and comparable, and providing standardized and more stable input data for model training.
[0139] Step S302: Adjust the size of the normalized image data based on the preset size to obtain standardized image data;
[0140] One approach is the "ResizeLongestSide" method, which maintains the original image's aspect ratio while scaling the longer side to a preset length (e.g., 1024 pixels), proportionally adjusting the shorter side, and then using zero-padding to fill the shorter side to the target size. This method preserves spatial structure features better than simple stretching and scaling, and is particularly advantageous for remote sensing tasks with high precision requirements for geometric boundaries (such as water body shapes). For example, a 384×512 pixel image can be scaled to 768×1024, then padded with 128 pixels top and bottom to generate a standard 1024×1024 image.
[0141] Step S303: Perform channel adaptation and pixel value mapping on the standardized image data to generate preprocessed data;
[0142] After standardizing the image, it needs to be further converted into an image format acceptable to the model. In particular, when compatible with the SAM model structure, it must meet its requirements for the format and numerical range of the input data. If the input is a single-channel image (e.g., grayscale), it needs to be expanded to three channels (RGB) by channel duplication, which is a common input format requirement for deep models.
[0143] In addition, the pixel values also need to be further linearly amplified, and the [0,1] pixel range after the previous normalization is remapped to the integer image range of [0,255]. This conversion ensures consistency with standard image encoding and facilitates subsequent image normalization and enhancement processing.
[0144] Step S304: Perform feature encoding on the preprocessed data to generate an intermediate dataset containing embedded features;
[0145] The preprocessed image is input into the image encoder module of SAM (Segment Anything Model). This encoder uses a deep neural network structure, typically a Vision Transformer (ViT) architecture, to segment the image into patches and then encode them into fixed-length embeddings. Each embedding represents the semantic features of a portion of the image region. Prior to this, the image undergoes internal preprocessing within SAM, such as mean / variance normalization, to ensure it conforms to the standard normal distribution requirement of the model input. Finally, the encoder outputs a high-dimensional feature representation (e.g., 1024-dimensional), used by subsequent segmentation decoders or cue-guided structures for further decision-making. For example, encoding a 1024×1024 image using ViT outputs an embedding matrix of size (64, 1024), where each vector corresponds to the semantic representation of an image region.
[0146] Step S305: Extract the bounding box coordinates of the water body area based on the labeled image patch dataset, and randomly select coordinate points of the water body and non-water body areas to generate bounding box cue and point cue data;
[0147] The model employs several techniques: **Box Prompt:** By extracting connected regions (i.e., connected pixels in the water body) from the label image and calculating their minimum bounding rectangle as the bounding box, this information indicates the spatial range the model should focus on, helping to focus on the prediction area and suppress background interference. **Point Prompt:** This involves randomly sampling positive points in the water body regions and randomly sampling negative points in the non-water body regions. Each point includes its coordinates and a label (1 for water, 0 for non-water). This prompt simulates user click guidance, effectively improving the model's recognition rate for small or edge regions. For example, in a label image containing three independent water body regions, one bounding box and one center point prompt will be generated for each region, while an equal number of negative points will be randomly generated in the other background regions.
[0148] Step S306: Assemble the embedded features, bounding box cue data, point cue data, and labeled image patch dataset into a vector format dataset.
[0149] This involves packaging all key information into a structured input file with a unified format, typically stored in NumPy compression format (.npz), facilitating batch reading, efficient training, and index management. By constructing a structured vector dataset, a bridge is established between remote sensing imagery as raw data and deep model input, significantly reducing the data processing complexity during subsequent training and fine-tuning, and improving the automation and engineering practicality of the entire model training system.
[0150] The above implementation achieves an efficient transformation process from raw enhanced remote sensing imagery to structured deep learning training data. Data normalization ensures the numerical uniformity of input features, while size standardization and channel adaptation provide format guarantees for model input. The SAM encoder extracts high-level semantic features, bounding boxes and point cues provide guidance mechanisms, and the final constructed vector dataset forms an end-to-end data structure that can be directly used for segmentation task training. This preprocessing strategy is not only highly adaptable to the target model architecture (such as SAM), but also possesses strong versatility and flexibility, capable of addressing the multi-scale, multi-source, and diverse challenges faced in remote sensing water body extraction.
[0151] Reference Figure 7 The figure shows a quantitative comparison of the extraction results of this application and mainstream segmentation methods (such as PSP, Segformer, DeepLabv3+ and SAM) in the same study area. It can be seen that this application has the highest mIoU, that is, the best performance in water extraction.
[0152] Reference Figure 8 This document provides a qualitative comparison of the results of this application's embodiments with other segmentation methods in a specific research area. Each column represents a remote sensing image of a different scene, and each row represents the water extraction results of different methods. The first row represents the original multi-source remote sensing image, the second row represents the water body label map corresponding to the original multi-source remote sensing image, the third row represents the extraction result image of this application, the fourth row represents the extraction result image of DeepLabV3+, the fifth row represents the extraction result image of Segformer, the sixth row represents the extraction result image of PSP, and the seventh row represents the extraction result image of SAM. Based on the above data, it can be demonstrated that the extraction results of this application are optimal, with the highest recognition rate for water body edges and small water bodies, and the lowest false recognition rate for non-water bodies.
[0153] In summary, this application addresses the problems of low accuracy, poor cross-source adaptability, and high resource consumption in existing remote sensing water body extraction technologies. By constructing a highly generalizable professional model based on fine-tuning of a fundamental large model, combined with multi-source data augmentation and adaptive band optimization, it achieves high-precision identification of water body boundaries and stable extraction of cross-source remote sensing images in complex scenarios. This technical solution provides a standardized solution for scenarios such as dynamic water resource monitoring, flood disaster assessment, and ecological protection, significantly improving the efficiency of large-scale, long-term water body monitoring, reducing the cost of manual intervention, and promoting the in-depth application of remote sensing technology in fields such as digital twins and environmental management.
[0154] This application also discloses a highly generalizable water body extraction system based on remote sensing images.
[0155] A highly generalizable water body extraction system based on remote sensing imagery, the extraction system comprising:
[0156] The data annotation module is used to acquire multi-source remote sensing image data and annotate water bodies to generate a labeled remote sensing image dataset; the cropping module is used to crop the labeled remote sensing image dataset into image blocks of a preset size to generate the corresponding original image block dataset and labeled image block dataset.
[0157] The data augmentation module is used to perform data augmentation processing on the original image patch dataset and the labeled image patch dataset to generate an augmented dataset;
[0158] The optimal band selection module is used to perform band transformation processing on the enhanced dataset, calculate the inter-class variance between water bodies and non-water bodies, select the band combination with the largest inter-class variance, and generate the optimal augmented dataset.
[0159] The data preprocessing module is used to preprocess the expanded dataset, generate a vector format dataset, and divide it into training, validation, and test sets.
[0160] Build modules are used to pre-build the SAM model and parallel convolutional neural network; the SAM model includes an image encoder, a cue encoder, and a mask decoder.
[0161] The first fine-tuning module is used to freeze the cue encoder and mask decoder of the SAM model. It performs the first stage of fine-tuning of the image encoder based on the training set and validation set, and fuses the remote sensing image features extracted by the parallel convolutional neural network to generate a water-sensitive image encoder.
[0162] The second fine-tuning module is used to freeze the water-sensitive image encoder and perform a second-stage fine-tuning of the mask decoder based on the training set and validation set to obtain the fine-tuned water extraction professional model.
[0163] The performance testing module is used to test the water extraction professional model based on the test set and obtain performance evaluation results;
[0164] The water extraction module is used to input the remote sensing image data to be extracted into the water extraction professional model, output the water extraction result thumbnails and stitch them together to obtain the full-size water extraction result image.
[0165] The highly generalizable water body extraction system based on remote sensing imagery according to this application embodiment can implement any of the above extraction methods, and the specific working process of each module in the extraction system can refer to the corresponding process in the above method embodiments.
[0166] In the several embodiments provided in this application, it should be understood that the provided methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for example, the division of a certain module is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed.
[0167] This application also discloses a computer device.
[0168] A computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a highly generalizable water body extraction method based on remote sensing imagery as described above.
[0169] This application also discloses a computer-readable storage medium.
[0170] A computer-readable storage medium storing a computer program that can be loaded by a processor and executed as described above in any of the highly generalizable water body extraction methods based on remote sensing images.
[0171] The computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device; the program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0172] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0173] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Any feature disclosed in this specification (including the abstract and drawings) may be replaced by other equivalent or similar features unless specifically stated otherwise. That is, unless specifically stated otherwise, each feature is only one example of a series of equivalent or similar features.
Claims
1. A highly generalizable water body extraction method based on remote sensing imagery, characterized in that, The extraction method includes: Acquire multi-source remote sensing image data and annotate water bodies to generate a labeled remote sensing image dataset; The labeled remote sensing image dataset is cropped into image blocks of a preset size to generate the corresponding original image block dataset and labeled image block dataset; Data augmentation processing is performed on the original image patch dataset and the labeled image patch dataset to generate an augmented dataset; The enhanced dataset is subjected to band transformation processing, the inter-class variance between water bodies and non-water bodies is calculated, the band combination with the largest inter-class variance is selected, and the optimal augmented dataset is generated. The expanded dataset is preprocessed to generate a vector format dataset, which is then divided into a training set, a validation set, and a test set. A pre-built SAM model and a parallel convolutional neural network are used; the SAM model includes an image encoder, a cue encoder, and a mask decoder. The cue encoder and mask decoder of the SAM model are frozen. The image encoder is fine-tuned in the first stage based on the training set and validation set. The remote sensing image features extracted by the parallel convolutional neural network are fused to generate a water-sensitive image encoder. Freeze the water-sensitive image encoder, and perform a second-stage fine-tuning of the mask decoder based on the training set and validation set to obtain the fine-tuned water extraction professional model. The water extraction model was tested based on the test set, and performance evaluation results were obtained. The remote sensing image data to be extracted is input into the water body extraction professional model, and the water body extraction result small image is output and stitched together to obtain the full-size water body extraction result image.
2. The highly generalizable water body extraction method based on remote sensing imagery according to claim 1, characterized in that, The steps of performing band transformation processing on the enhanced dataset, calculating the inter-class variance between water bodies and non-water bodies, selecting the band combination with the largest inter-class variance, and generating the optimal augmented dataset include: Receive the enhanced dataset and the corresponding binarized labeled image blocks; in the binarized labeled image blocks, water areas are labeled as 1, and non-water areas are labeled as 0; A candidate band set is generated based on preset rules, including single-band combinations, multi-band weighted fusion combinations, and spectral index combinations. Traverse each combination in the candidate band set to generate the corresponding single-channel grayscale image, and generate a grayscale image set; For each grayscale image in the grayscale image set, the water body pixel set and the non-water body pixel set are segmented according to the binarized label image block, and the inter-class variance is calculated to generate the mapping relationship between band combination and inter-class variance. The band combination with the largest inter-class variance is selected as the optimal band combination. The grayscale image corresponding to the optimal band combination is used to replace the original multi-band input data to generate an expanded dataset with optimal bands.
3. The highly generalizable water body extraction method based on remote sensing imagery according to claim 2, characterized in that, The single-band combination is selected from a single band in the visible light band, near-infrared band, or short-wave infrared band; the multi-band weighted fusion combination is a linear weighted combination of two or more bands; and the spectral index combination includes the normalized difference water index and the improved water index.
4. The highly generalizable water body extraction method based on remote sensing imagery according to claim 1, characterized in that, The steps for preprocessing the augmented dataset to generate a vector format dataset include: The remote sensing image data sources in the expanded dataset are normalized to generate normalized image data. The normalized image data is resized based on a preset size to obtain standardized image data. Standardized image data is adapted for channels and mapped to pixel values to generate preprocessed data. The preprocessed data is feature-encoded to generate an intermediate dataset containing embedded features; Based on the labeled image patch dataset, the bounding box coordinates of the water body area are extracted, and the coordinate points of the water body and non-water body areas are randomly selected to generate bounding box cue and point cue data; The embedded features, bounding box hints, dot hints data, and labeled image patch datasets are assembled into a vector format dataset.
5. The highly generalizable water body extraction method based on remote sensing imagery according to claim 1, characterized in that, The first stage of fine-tuning parameters is configured as follows: optimizer is Adamw_torch, learning rate is 5x10. -5 The LoraRank is 8, the Lora scaling factor is 16, the maximum context length is 1024, the batch size is 16, and the training epochs are 50.
6. The highly generalizable water body extraction method based on remote sensing imagery according to claim 5, characterized in that, The parallel convolutional neural network includes four layer modules. Each layer module sequentially performs 3×3 convolution, ReLU activation, and 2×2 max pooling operations, and the output features are concatenated with the 1024-dimensional features of the water-sensitive image encoder of the SAM model.
7. The highly generalizable water body extraction method based on remote sensing imagery according to claim 1, characterized in that, The second-stage fine-tuning parameters are configured as follows: the optimizer is Adamw_torch, and the learning rate is 1x10. -5 The batch size is 16, and the number of training rounds is 50.
8. A highly generalizable water body extraction system based on remote sensing imagery, characterized in that, The extraction system includes: The data annotation module is used to acquire multi-source remote sensing image data and annotate water bodies to generate a labeled remote sensing image dataset. The cropping module is used to crop the labeled remote sensing image dataset into image blocks of a preset size, generating the corresponding original image block dataset and labeled image block dataset; The data augmentation module is used to perform data augmentation processing on the original image patch dataset and the labeled image patch dataset to generate an augmented dataset; The optimal band selection module is used to perform band transformation processing on the enhanced dataset, calculate the inter-class variance between water bodies and non-water bodies, select the band combination with the largest inter-class variance, and generate the optimal augmented dataset. The data preprocessing module is used to preprocess the expanded dataset to generate a vector format dataset and divide it into a training set, a validation set, and a test set. A building module is used to pre-build a SAM model and a parallel convolutional neural network; the SAM model includes an image encoder, a cue encoder, and a mask decoder. The first fine-tuning module is used to freeze the cue encoder and mask decoder of the SAM model, perform a first-stage fine-tuning of the image encoder based on the training set and validation set, and fuse the remote sensing image features extracted by the parallel convolutional neural network to generate a water-sensitive image encoder. The second fine-tuning module is used to freeze the water-sensitive image encoder and perform a second-stage fine-tuning of the mask decoder based on the training set and validation set to obtain the fine-tuned water extraction professional model. The performance testing module is used to test the water extraction professional model based on the test set and obtain performance evaluation results; The water extraction module is used to input the remote sensing image data to be extracted into the water extraction professional model, output the water extraction result thumbnail, and stitch and restore it to obtain the full-size water extraction result image.
9. A computer device, characterized in that: The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer program is stored that can be loaded by a processor and executed as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Surface water body extraction method, system and equipment based on improved Segform network and remote sensing image and medium
CN116612387A
Water body extraction method based on Ka-band radar satellite image
CN118397468A