Water body information extraction method and device based on remote sensing data, equipment and medium

By constructing a water body mask image and iteratively updating the threshold population, combined with a random forest model, the tedious and time-consuming problem of water body information extraction in existing technologies is solved, and efficient and accurate water body object extraction is achieved.

CN117197174BActive Publication Date: 2026-05-26BEIJING AEROSPACE HONGTU INFORMATION TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING AEROSPACE HONGTU INFORMATION TECH
Filing Date
2023-09-18
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing technologies for rapidly extracting water body information require manual selection of wavebands and thresholds based on water body index methods, and have weak ability to distinguish complex land features. Supervised classification methods require a large amount of sample data and training time, and need to be retrained or have parameters adjusted when adapting to different scenarios or time-phase data.

Method used

A water body information extraction method based on remote sensing data is adopted. By acquiring multispectral image data, a water body mask image is constructed, a threshold population is initialized and iteratively updated to determine the target segmentation threshold, a binary image of the water body is generated, and a random forest model is used to extract water body objects, avoiding the tedious and time-consuming manual labeling of samples.

Benefits of technology

It enables the automated generation of high-precision sample images, improves sample annotation efficiency and water object extraction accuracy, and significantly enhances the automation and accuracy of water information extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117197174B_ABST
    Figure CN117197174B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, device, and medium for extracting water body information based on remote sensing data, comprising: acquiring multispectral image data of a target area; constructing a water body mask image corresponding to the target area based on the multispectral image data; initializing a threshold population corresponding to the water body mask image, iteratively updating the threshold population, and determining a target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population; generating a binary image of the water body corresponding to the target area based on the target segmentation threshold; and constructing sample data based on the binary image of the water body, so as to extract water body objects contained in the target area based on the sample data using a water body information extraction model. This invention can automatically generate high-precision sample images, thereby improving the tedious and time-consuming problems caused by manual sample annotation, improving sample annotation efficiency, and significantly improving the accuracy of water body object extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water body information extraction technology, and in particular to a method, apparatus, equipment and medium for extracting water body information based on remote sensing data. Background Technology

[0002] Water bodies are a vital component of Earth's life support system and play a crucial role in sustainable development. Water body information extraction is the process of acquiring parameters such as location, area, shape, and water quality of water bodies from satellite imagery using remote sensing technology. Rapid extraction of water body information allows for timely monitoring of dynamic changes in water bodies, providing data support for water resource management and protection. For example, methods for rapid water body information extraction can promptly detect increases or decreases in water area, changes in water quality, and fluctuations in water levels, assessing water supply and demand and formulating reasonable water resource utilization and protection measures. Simultaneously, it can effectively forecast and assess natural disasters, providing information support for disaster prevention and relief efforts. Rapid water body information extraction can also enable timely monitoring of the occurrence and development of natural disasters such as floods, droughts, and landslides, assessing the scope and severity of their impact, and guiding disaster prevention and relief work. Furthermore, it can reflect the ecological environment status of water bodies, providing a basis for ecological protection and restoration. For example, timely monitoring of indicators such as the degree of pollution, nutrient content, and suspended solids concentration in water bodies can assess eutrophication and pollution risks, guiding water quality improvement and pollution prevention efforts. It can also promote the development and innovation of remote sensing technology, providing more possibilities for various fields. Methods for rapidly extracting water body information can advance and optimize remote sensing data processing and analysis technologies, such as deep learning, data fusion, and knowledge distillation. Simultaneously, these methods can also provide data and model support for other fields, such as land classification, wetland protection, and military reconnaissance.

[0003] Current research commonly employs methods for rapidly extracting water body information, primarily based on water index methods and supervised classification methods. Water index-based methods utilize the reflectance characteristics of water bodies across different spectral bands, constructing a water index by calculating the differences or ratios between certain bands, and then using the index magnitude to determine water and non-water body regions. This method requires manual selection of appropriate bands and thresholds and has weak discrimination capabilities for complex features or mixed pixels. Supervised classification methods utilize machine learning algorithms, training on samples with known labels and then classifying pixels with unknown labels to delineate water and non-water body regions. This method can fully leverage multispectral data and ground feature features, improving the accuracy and robustness of water body extraction. However, this method requires a large amount of sample data and training time, and may require retraining or parameter adjustment for data from different scenarios or time periods. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a method, apparatus, device and medium for extracting water body information based on remote sensing data, which can automatically generate high-precision sample images, thereby improving the problems of tediousness and time consumption caused by manual sample annotation, improving sample annotation efficiency, and significantly improving the accuracy of extracting water body objects.

[0005] In a first aspect, embodiments of the present invention provide a training method for a water body information extraction model, comprising:

[0006] Acquire multispectral image data of the target area;

[0007] Construct a water mask image corresponding to the target area based on the multispectral image data;

[0008] Initialize the threshold population corresponding to the water body mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population;

[0009] Generate a binary image of the water body corresponding to the target region based on the target segmentation threshold;

[0010] Sample data is constructed based on the binary image of the water body, and the water body objects contained in the target area are extracted based on the sample data using a water body information extraction model.

[0011] In one implementation, constructing a water mask image corresponding to the target area based on the multispectral image data includes:

[0012] The multispectral image data is preprocessed to obtain the atmospheric reflectance data of the target area; wherein, the preprocessing includes radiometric calibration, atmospheric correction and cropping.

[0013] Based on the atmospheric bottom reflectance data, multiple water body indices corresponding to the target area are determined;

[0014] The water index image corresponding to the target area is extracted using each of the water indexes, and the comprehensive water index image corresponding to the target area is obtained by superimposing each of the water index images.

[0015] The comprehensive water index image is normalized to obtain the water mask image corresponding to the target area.

[0016] In one implementation, the process includes initializing a threshold population corresponding to the water mask image, iteratively updating the threshold population, and determining a target segmentation threshold corresponding to the water mask image based on the iteratively updated threshold population, including:

[0017] The water mask image is divided into multiple sub-images;

[0018] For each sub-image, a threshold population corresponding to that sub-image is set; wherein, the threshold population includes multiple threshold particles;

[0019] During the current iteration update process, based on the historical best position vector of the threshold population, and the velocity vector and position vector of each particle in the threshold population at the time of the previous iteration update, the velocity vector and position vector of each threshold particle in the threshold population are iteratively updated until the iteration update stops;

[0020] The target segmentation threshold corresponding to the sub-image is determined based on the inner and outer variances of the threshold population after iterative updates.

[0021] In one implementation, determining the target segmentation threshold corresponding to the sub-image based on the inner variance and outer variance of the threshold population after iterative updates corresponding to the sub-image includes:

[0022] Determine the number of water-type pixels, the gray value of water-type pixels, the number of non-water-type pixels, the gray value of non-water-type pixels, and the total number of pixels in the threshold population corresponding to the sub-image after iterative update;

[0023] The ratio of the number of water-type pixels to the total number of pixels is determined as the water-type pixel percentage, and the ratio of the number of non-water-type pixels to the total number of pixels is determined as the non-water-type pixel percentage.

[0024] The global average gray value is determined based on the product of the proportion of water-type pixels and the gray value of the water-type pixels, and the product of the proportion of non-water-type pixels and the gray value of the non-water-type pixels.

[0025] Based on the global average gray value, the proportion of water-type pixels, the proportion of non-water-type pixels, the gray value of water-type pixels, and the gray value of non-water-type pixels, determine the inner variance and outer variance of the threshold population corresponding to the sub-image after iterative update;

[0026] The target segmentation threshold corresponding to the sub-image is determined based on the inner and outer variances of the threshold population after iterative updates.

[0027] In one implementation, generating a binary image of the water body corresponding to the target region based on the target segmentation threshold includes:

[0028] For each sub-image, if the pixel value in the water mask image corresponding to the sub-image is greater than the target segmentation threshold, the pixel value is set to 1; if the pixel value in the water mask image corresponding to the sub-image is less than the target segmentation threshold, the pixel value is set to 0, thus obtaining a binary sub-image.

[0029] Each of the binary sub-images is stitched together to form a binary image of the water body corresponding to the target region.

[0030] In one implementation, the water body information extraction model includes a random forest model; sample data is constructed based on the binary image of the water body, and the water body information extraction model extracts water body objects contained in the target area based on the sample data.

[0031] Convert the binary image of the water body from raster data to vector data;

[0032] The location, area, and shape of each water body object in the vector data are statistically analyzed, and sample data is generated based on the location, area, and shape of the water body.

[0033] Call the predict method, using the sample data as input to the random forest model, to obtain the prediction results of the random forest model;

[0034] Based on the prediction results, extract the water bodies contained in the target area.

[0035] In one embodiment, the method further includes:

[0036] The water samples were divided into training and testing sets.

[0037] Create a random forest model using the RandomForestClassifier class from the sklearn library, and set the parameters of the random forest model;

[0038] Call the fit method, taking the features and labels of the training set as input, to train the random forest model;

[0039] The predict method is called, taking the features of the test set as input, to obtain the prediction results of the random forest model;

[0040] The method further includes:

[0041] Using the metrics module in the sklearn library, the evaluation metrics of the random forest model are calculated based on the prediction results, and the performance of the random forest model is analyzed using visualization tools.

[0042] Secondly, embodiments of the present invention also provide a training device for a water body information extraction model, comprising:

[0043] The first data acquisition module is used to acquire multispectral image data of the target area;

[0044] A mask image determination module is used to construct a water body mask image corresponding to the target area based on the multispectral image data.

[0045] The segmentation threshold determination module is used to initialize the threshold population corresponding to the water body mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population.

[0046] The binary image determination module is used to generate a binary image of the water body corresponding to the target region based on the target segmentation threshold.

[0047] The information extraction module is used to construct sample data based on the binary image of the water body, and to extract water objects contained in the target area based on the sample data through the water body information extraction model.

[0048] Thirdly, embodiments of the present invention also provide an electronic device, including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method described in any of the first aspects.

[0049] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the method described in any of the first aspects.

[0050] This invention provides a method, apparatus, device, and medium for extracting water body information based on remote sensing data. First, multispectral image data of the target area is acquired. Then, a water body mask image corresponding to the target area is constructed based on the multispectral image data. A threshold population corresponding to the water body mask image is initialized, and the threshold population is iteratively updated. Based on the iteratively updated threshold population, a target segmentation threshold corresponding to the water body mask image is determined. Next, a binary image of the water body corresponding to the target area is generated based on the target segmentation threshold. Sample data is then constructed based on the binary image. Finally, a water body information extraction model is used to extract water body objects contained in the target area based on the sample data. This method can automatically generate high-precision binary images of water bodies to construct the samples needed for extracting water body objects. The water body information extraction model then extracts water body objects based on the binary image, avoiding the tedious and time-consuming problems of manual sample annotation, significantly improving sample annotation efficiency, and effectively improving the accuracy of water body object extraction.

[0051] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0052] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0053] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0054] Figure 1 A flowchart illustrating a method for extracting water body information based on remote sensing data, provided in an embodiment of the present invention;

[0055] Figure 2 A flowchart illustrating another method for extracting water body information based on remote sensing data provided in an embodiment of the present invention;

[0056] Figure 3 This is a schematic diagram of a water body information extraction device based on remote sensing data provided in an embodiment of the present invention;

[0057] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0058] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0059] Currently, common methods for rapidly extracting water body information in research mainly include methods based on water body indices and methods based on supervised classification. Among these, methods based on water body indices require manual selection of appropriate bands and thresholds, and their ability to distinguish complex features or mixed pixels is weak; supervised classification methods require a large amount of sample data and training time, and may require retraining or parameter adjustment for data from different scenes or time periods. Therefore, this invention provides a method, apparatus, device, and medium for extracting water body information based on remote sensing data. This method can automatically generate high-precision sample images, thereby improving the tediousness and time-consuming nature of manual sample annotation, increasing sample annotation efficiency, and significantly improving the accuracy of water body object extraction.

[0060] To facilitate understanding of this embodiment, a method for extracting water body information based on remote sensing data, as disclosed in this embodiment of the invention, will first be described in detail. (See [link to relevant documentation]). Figure 1 The diagram shows a flow chart of a water body information extraction method based on remote sensing data. The method mainly includes the following steps S102 to S110:

[0061] Step S102: Obtain multispectral image data of the target area.

[0062] Optionally, multispectral image data of the target area can be acquired from a designated satellite (such as the Sentinel-2 satellite provided by the European Space Agency (ESA)). The multispectral image data includes multiple visible light, near-infrared bands, and short-wave infrared bands.

[0063] Step S104: Construct a water mask image corresponding to the target area based on multispectral image data.

[0064] Among them, the water body mask image is used to characterize the water body index of the target area, and the range of the water body index characterized in the water body mask image is limited to between 0 and 1.

[0065] In one implementation, multispectral image data can be preprocessed to obtain atmospheric reflectance data corresponding to the target area. Then, one or more water index algorithms can be used to determine multiple water index images corresponding to the target area based on the atmospheric reflectance data. All water index images can be overlaid and normalized to obtain a water mask image.

[0066] Step S106: Initialize the threshold population corresponding to the water mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water mask image based on the iteratively updated threshold population.

[0067] The threshold population includes multiple threshold particles, each representing a candidate segmentation threshold. The target segmentation threshold is used to binarize the water mask image.

[0068] In one implementation, the current iteration update can be performed based on the results of the previous iteration update and the historical best position vector of the threshold population to obtain the results of this iteration update (including the position vector and velocity vector of the threshold particles). When the iteration update ends, the target segmentation threshold corresponding to the water body mask image can be determined based on the number of water body pixels, the number of non-water body pixels, the gray value of water body pixels, and the gray value of non-water body pixels in the threshold population after the iteration update.

[0069] Step S108: Generate a binary image of the water body corresponding to the target region based on the target segmentation threshold.

[0070] In the binary image of water bodies, the pixel value is either 1 or 0. A pixel value of 1 indicates that the pixel is a water body, while a pixel value of 0 indicates that the pixel is not a water body.

[0071] In one implementation, if the pixel value in the water body mask image is greater than the target segmentation threshold, the pixel value is set to 1; conversely, if the pixel value in the water body mask image is less than the target segmentation threshold, the pixel value is set to 0, thereby obtaining a binary image of the water body.

[0072] Step S110: Construct sample data based on the binary image of the water body, and extract the water body objects contained in the target area based on the sample data using the water body information extraction model.

[0073] The sample data includes the location, area, and shape of each water body; the water information extraction model can be a random forest model.

[0074] In one implementation, the location, area, and shape of each water object within the target area can be statistically analyzed based on a binary image of the water body. A sample data table file (hereinafter referred to as sample data) is generated based on the above data. A random forest model is trained using the sample data table file. Then, the trained random forest model is used to accurately extract the water objects contained in the target area based on the sample data table file.

[0075] The water body information extraction method based on remote sensing data provided in this invention can automatically generate high-precision binary images of water bodies to construct the samples required for extracting water body objects. Thus, the water body objects are extracted based on the binary images of water bodies through the water body information extraction model, avoiding the tedious and time-consuming problems of manual sample annotation, significantly improving the sample annotation efficiency, and also effectively improving the accuracy of water body object extraction.

[0076] For ease of understanding, this embodiment of the invention provides a specific implementation method for water body information extraction based on remote sensing data.

[0077] Regarding the aforementioned step S102, when performing the step of acquiring multispectral image data of the target area, multispectral image data from the Sentinel-2 satellite can be acquired. Specifically, multispectral image data of the target area and the required time range are acquired from the Sentinel-2 satellite data center provided by the European Space Agency (ESA), including 10 visible and near-infrared bands (B2-B8) and 2 shortwave infrared bands (B11-B12).

[0078] For step S104 mentioned above, when performing the step of constructing the water mask image corresponding to the target area based on multispectral image data, please refer to steps a to d as follows:

[0079] Step a: Preprocess the multispectral image data to obtain the atmospheric reflectance data of the target area; the preprocessing includes radiometric calibration, atmospheric correction and cropping.

[0080] Specifically, see steps a1 to a3 below:

[0081] Step a1: Using ENVI software, input the acquired multispectral image data for radiometric calibration, and convert the digital values ​​into surface reflectance as the output result.

[0082] Step a2: Using the FLAASH model, input the surface reflectance for atmospheric correction to eliminate the effects of atmospheric scattering and absorption, and obtain atmospherically corrected atmospheric bottom reflectance data as the output result.

[0083] Step a3: Based on the target area and its range, perform image cropping on the atmospheric bottom reflectance data to obtain the atmospheric bottom reflectance data of the target area.

[0084] Step b: Based on atmospheric bottom reflectance data, determine multiple water body indices corresponding to the target area.

[0085] In one alternative implementation, the MNDWI (Modified Normalized Difference Water Index) and AWEI (Automated Water Extraction Index) methods can be used to extract water information from the atmospheric lower-level reflectance data, resulting in multiple water indices. The input data for this step is the atmospheric lower-level reflectance data for the desired region.

[0086] For details, please refer to Method 1 and Method 2 below:

[0087] Method 1: Calculate the MNDWI water index:

[0088] The reflectance ratio of the green band (B3) and the shortwave infrared band (B11) is used to distinguish water bodies from other land features. The calculation formula is as follows:

[0089] ;

[0090] Method 2: Calculate the AWEI water index:

[0091] The reflectance differences of the green band (B3), near-infrared band (B8), shortwave infrared band (B11), and shortwave infrared band (B12) are used to distinguish water bodies from other land features. The calculation formula is as follows:

[0092] .

[0093] Step c: Extract the water index image corresponding to the target area using each water index, and then overlay the water index images to obtain the comprehensive water index image corresponding to the target area.

[0094] In one implementation, a composite water index image is obtained by adding the water index images extracted from the two water index extraction methods. Specifically, a logical AND operation is performed on the water index images obtained by the MNDWI and AWEI water index extraction methods to obtain a composite water index image.

[0095] Step d: Normalize the comprehensive water index image to obtain the water mask image corresponding to the target area.

[0096] In one implementation, the comprehensive water index image is normalized, limiting its value range to between 0 and 1, and a normalized water mask image is output.

[0097] Regarding the aforementioned step S106, when initializing the threshold population corresponding to the water mask image, iteratively updating the threshold population, and determining the target segmentation threshold corresponding to the water mask image based on the iteratively updated threshold population, the improved OTSU (Otsu Thresholding) algorithm and Particle Swarm Optimization (PSO) algorithm can be used to automatically find the target segmentation threshold. Specifically, please refer to steps 1 to 4 below:

[0098] Step 1: Divide the water mask image into multiple sub-images.

[0099] In one implementation, a quadtree segmentation algorithm can be used to divide the water mask image into blocks. Specifically, see steps 1.1 to 1.3 below:

[0100] Step 1.1: Perform quadtree segmentation on the normalized water mask image, setting the segmentation parameters as follows: minimum region size is 64×64 pixels, and maximum standard deviation is 0.1.

[0101] Step 1.2: Save the multiple sub-regions obtained after quadtree segmentation as separate sub-image files. Each sub-image file contains water mask data for one sub-region.

[0102] Step 1.3: Name and number each sub-image file.

[0103] Step 2: For each sub-image, set the threshold population corresponding to that sub-image; wherein, the threshold population includes multiple threshold particles.

[0104] In one implementation, the parameters of the particle swarm optimization (PSO) algorithm are set as follows: population size is 20, maximum number of iterations is 100, inertia weight is 0.8, and learning factor is 2; 2) Initialize a random threshold population using the particle swarm optimization (PSO) algorithm, where each threshold particle represents a candidate threshold.

[0105] Step 3: In the current iteration update process, based on the historical best position vector of the threshold population, and the velocity vector and position vector of each particle in the threshold population at the time of the previous iteration update, the velocity vector and position vector of each threshold particle in the threshold population are iteratively updated until the iteration update stops.

[0106] In one implementation, the velocity vector and position vector of each threshold particle are updated based on inertia weights, a learning factor, and a random factor. Let d represent the velocity vector of the threshold particle i in the (k+1)th iteration, and let d represent the direction and distance the threshold particle moves in the next iteration. The inertial weight represents the influence of the velocity of the previous generation threshold particle on the velocity of the current generation threshold particle. Let d represent the velocity vector of threshold particle i in the k-th iteration, and let d represent the current motion state of the threshold particle. The individual learning factor represents the thinking of the threshold particle itself, that is, the part of the threshold particle's own experience. Let be the position vector of the threshold particle i in the k-th iteration, representing a solution to the problem. This represents the historical best position of threshold particle i, that is, the best solution obtained by the i-th threshold particle (individual) in all iterations; This represents the historical best position of the threshold population, i.e., the best solution in the entire threshold population across all iterations. Position vector. The calculation formula is:

[0107] .

[0108] Repeat this process until the position vector is obtained. Once the value stabilizes, iterative updates will cease.

[0109] Step 4: Determine the target segmentation threshold corresponding to the sub-image based on the inner and outer variances of the threshold population after iterative update.

[0110] In one implementation, the target segmentation threshold corresponding to the sub-image can be determined according to steps 4.1 to 4.5 as follows:

[0111] Step 4.1: Determine the number of water-type pixels, the grayscale value of water-type pixels, the number of non-water-type pixels, the grayscale value of non-water-type pixels, and the total number of pixels in the threshold population corresponding to the sub-image after iterative update.

[0112] The total number of non-target pixels (i.e., non-water body pixels) is: The average gray value of non-target pixels (i.e., the gray value of non-water body pixels) is The total number of target class pixels (i.e., water body class pixels) is: The average grayscale value of the target class pixels (i.e., the grayscale value of the water body class pixels) is The total number of pixels is m×n.

[0113] Step 4.2: Determine the ratio of water-type pixels to total pixels as the water-type pixel percentage, and determine the ratio of non-water-type pixels to total pixels as the non-water-type pixel percentage.

[0114] In the actual implementation, the proportion of target class pixels (i.e., the proportion of water body pixels) is determined according to the following formula. The proportion of non-target pixels (i.e., the proportion of non-water body pixels). :

[0115] ;

[0116] ;

[0117] ;

[0118] .

[0119] Step 4.3: Determine the global average gray value based on the proportion of water-type pixels and the product of the gray values ​​of water-type pixels, as well as the proportion of non-water-type pixels and the product of the gray values ​​of non-water-type pixels.

[0120] In practical implementation, the global average grayscale value is determined according to the following formula. :

[0121] .

[0122] Step 4.4: Based on the global average gray value, the proportion of water-type pixels, the proportion of non-water-type pixels, the gray value of water-type pixels, and the gray value of non-water-type pixels, determine the internal variance of the threshold population corresponding to the sub-image after iterative update. Sum of variances .

[0123] In practical implementation, the variance can be calculated using the following formula. :

[0124] ;

[0125] Alternatively, the global variance and population variance can be calculated using the following formula. :

[0126] .

[0127] Step 4.5: Determine the target segmentation threshold corresponding to the sub-image based on the inner variance and outer variance of the threshold population after iterative update corresponding to the sub-image.

[0128] Specifically, the target segmentation threshold corresponding to the sub-image can be determined using the following formula. :

[0129] .

[0130] Use this formula as the objective function of PSO to update the individual optimal solution and the global optimal solution for each threshold particle. 6) Output the global optimal solution as the target segmentation threshold (also known as the optimal threshold).

[0131] For the aforementioned step S108, when performing the step of generating the binary image of the water body corresponding to the target region based on the target segmentation threshold, please refer to the following (1) to (2):

[0132] (1) For each sub-image, if the pixel value in the water mask image corresponding to the sub-image is greater than the target segmentation threshold, the pixel value is set to 1; if the pixel value in the water mask image corresponding to the sub-image is less than the target segmentation threshold, the pixel value is set to 0, and a binary sub-image is obtained.

[0133] For details, please refer to (1.1) to (1.3) below:

[0134] (1.1) Use the optimal threshold to binarize each sub-image. Set the pixel values ​​in the water mask image that are greater than the threshold to 1 to represent water bodies; set the pixel values ​​that are less than or equal to the threshold to 0 to represent non-water bodies.

[0135] (1.2) Save the multiple sub-water body binary images obtained after binarization as separate sub-image files, each sub-image file containing the water body binary data of a sub-region;

[0136] (1.3) Name and number each sub-image file.

[0137] (2) Stitch each binary sub-image into a binary image of the water body corresponding to the target area. In the specific implementation, all the sub-water body binary images are stitched into a complete binary image of the water body, and then redundant boundaries are removed to obtain a more accurate binary image of the water body. The image is then saved as a separate image file and output, containing the binary data of the water body of the entire area.

[0138] For the aforementioned step S110, when performing the step of constructing sample data based on the binary image of the water body, and extracting water objects contained in the target area based on the sample data using the water body information extraction model, please refer to the following (a) to (c):

[0139] (a) Convert the binary image of the water body from raster data to vector data.

[0140] In practical implementation, a raster-to-vector conversion tool can be used to convert the raster data of the water body into vector data based on the binary image of the water body. During the conversion, the DN (Digital Number, remote sensing image pixel brightness) value needs to be set. Since the DN value of the water body is displayed as 1, the DN value is set to 1.

[0141] (b) Statistically analyze the location, area, and shape of each water body object in the vector data, and generate sample data based on the location, area, and shape of the water body.

[0142] In practical implementation, based on vector data, attribute statistics tools can be used to calculate the water body location (latitude and longitude coordinates of the center point of the water body), water body area (number of water body pixels multiplied by pixel size), water body shape (ratio of the perimeter of the water body outline to the area) of each water body object. These parameters are then used as attributes of the water body object and saved in a table file (i.e., a sample data table file) for output.

[0143] (c) Call the predict method, take the sample data as input to the random forest model, obtain the prediction results of the random forest model, and extract the water objects contained in the target area based on the prediction results.

[0144] Random Forest is an ensemble learning method based on multiple decision trees. It can handle high-dimensional, non-linear, and missing data problems and determine the parameters of the model. Input (c) is the generated sample dataset table file, and the Random Forest algorithm is used to output the prediction results.

[0145] In one example, the training and test sets are divided as follows: based on the amount of data in the input table file, a certain proportion of the data is randomly allocated as the training and test sets. In this embodiment of the invention, the ratio is set to 7:3, with the training set used to build the random forest model and the test set used to evaluate the model's accuracy and generalization ability.

[0146] In one example, the number of trees in the random forest model is determined based on the size and complexity of the training set. Care should be taken when setting parameter values ​​to avoid increasing computation time and memory consumption. In this embodiment, a value of 100 is chosen.

[0147] In one example, the depth of the tree in the random forest model is determined by setting the maximum depth of the decision tree based on the number and distribution of features in the training set. It is important to avoid overfitting and noise sensitivity while ensuring good fitting performance; in this embodiment, a depth of 10 is chosen.

[0148] In one example, the minimum number of samples required for a leaf node in a random forest model is determined by considering the number of samples in the training set and the noise level. In this embodiment, a minimum number of samples is chosen to be 5.

[0149] In one example, the determination of the minimum number of samples required for a split node in a random forest model is as follows: based on the number of samples in the training set and the noise level, the minimum number of samples required for a node to split is determined. In this embodiment of the invention, a value of 10 is selected.

[0150] Furthermore, this embodiment of the invention also provides an implementation method for training a random forest model, including the following steps (i) to (iv):

[0151] (i) Divide the water samples into training and testing sets. In practice, based on the amount of data in the input table file, a certain proportion of the data is randomly allocated as the training and testing sets. This scheme sets the ratio to 7:3, with the training set used to build the random forest model and the testing set used to evaluate the model's accuracy and generalization ability.

[0152] (ii) Create a random forest model using the RandomForestClassifier class in the sklearn library and set the parameters of the random forest model. In the specific implementation, create a random forest classifier object using the RandomForestClassifier class in the sklearn library and set relevant parameters, such as the number of trees, maximum depth, minimum number of samples, etc.

[0153] (iii) Call the fit method, take the features and labels of the training set as input, and train the random forest model.

[0154] (iv) Call the predict method, take the features of the test set as input, and obtain the prediction results of the random forest model.

[0155] Furthermore, the metrics module in the sklearn library can be used to calculate the evaluation metrics of the random forest model based on its prediction results, and visualization tools can be used to analyze the model's performance. Specifically, the metrics module in the sklearn library can be used to calculate evaluation metrics such as accuracy, recall, and F1 score, as well as visualization tools such as confusion matrix and ROC curve to analyze the model's performance.

[0156] Furthermore, if the model's performance is unsatisfactory, you can try adjusting the parameters or using methods such as grid search and cross-validation to optimize the model. If the model's performance meets expectations, you can save the model as a file for later use.

[0157] In summary, the water body information extraction method based on remote sensing data provided in this embodiment of the invention has at least the following characteristics:

[0158] (1) The present invention uses a water body information extraction method to generate a relatively accurate sample set, which avoids the tediousness and time-consuming process of manually labeling samples and improves the efficiency of sample labeling.

[0159] (2) The embodiments of the present invention combine the improved OTSU method and particle swarm optimization (PSO) algorithm, which can automatically find the optimal threshold according to different image data, realize the rapid extraction of water body information, and reduce the computation time and complexity compared with the original OTSU method;

[0160] (3) The embodiments of the present invention use the random forest algorithm to classify or regress water objects, which can handle the problems of high-dimensional, nonlinear and missing data, enhance the accuracy and generalization ability of the model, and improve the accuracy of water information extraction compared with traditional classification or regression methods.

[0161] To facilitate understanding, this embodiment of the invention provides another implementation of the water body information extraction method based on remote sensing data. This embodiment of the invention uses high-resolution Sentinel-2 optics as the main data source, extracts water body indices using MNDWI and AWEI, determines a threshold using an improved OTSU method as a more accurate sample dataset, and then inputs it into a random forest algorithm to obtain high-precision results, thereby achieving rapid extraction of water body information.

[0162] For details, see Figure 2 The diagram shows another method for extracting water body information based on remote sensing data. This method mainly includes the following steps S202 to S220:

[0163] Step S202: Acquire multispectral image data from Sentinel-2 satellite and perform preprocessing;

[0164] Step S204: Output atmospheric bottom reflectivity data;

[0165] Step S206: Extract water body information using MNDWI and AWEI water body index extraction methods;

[0166] Step S208: Output the water body mask image;

[0167] Step S210: The water mask image is segmented using a quadtree image segmentation algorithm. In specific implementation, the quadtree image segmentation algorithm is used to segment the water mask image to obtain multiple sub-images. For each sub-image, the improved OTSU method combined with particle swarm optimization (PSO) is used to determine the optimal threshold. The sub-image is then binarized to obtain a sub-water body binary image. All sub-water body binary images are then stitched together to form a complete water body binary image.

[0168] Step S212: Output a binary image of the water body;

[0169] Step S214: Extract parameters such as water body location, water body area, and water body shape;

[0170] Step S216: Create a sample dataset to input into the random forest model;

[0171] Step S218: Output the prediction results of the random forest model;

[0172] Step S220: Based on the prediction results, extract the water bodies contained in the target area.

[0173] This invention proposes a method for rapidly labeling water body information extraction by first determining a threshold using water body indices, and then inputting the data into a random forest algorithm to improve the accuracy of the water body information. This method improves both the efficiency and accuracy of water body information extraction. The water body indices selected are MNDWI and AWEI, constructed using green bands, near-infrared bands, and shortwave infrared bands. These indices effectively distinguish water bodies from other land features. Only one calculation of the water body index is needed, and then a threshold is used to determine water and non-water body areas. This process is very simple and fast. The threshold determination adopts an adaptive threshold water body information extraction method proposed by Xu Hongwei et al., which constructs the threshold using internal and external variances, and further refines it using the PSO algorithm. This improved OTSU algorithm is more efficient than the basic OTSU algorithm.

[0174] This invention fully leverages the advantages of the water body index method and supervised classification to improve the recognition efficiency of water body information extraction. Through water body index extraction, the quadtree image segmentation algorithm and the improved OTSU method combined with particle swarm optimization (PSO) can adaptively determine the optimal threshold, improving the accuracy and robustness of water body segmentation while significantly reducing the efficiency of sample labeling, minimizing human intervention and errors. Subsequently, the random forest algorithm further enhances the accuracy and robustness of water body information extraction, achieving high-efficiency and high-precision water body information extraction.

[0175] Regarding the water body information extraction method based on remote sensing data provided in the foregoing embodiments, this invention provides a water body information extraction device based on remote sensing data. (See [link]). Figure 3 The diagram shows a water body information extraction device based on remote sensing data. The device mainly includes the following parts:

[0176] The first data acquisition module 302 is used to acquire multispectral image data of the target area;

[0177] The mask image determination module 304 is used to construct a water body mask image corresponding to the target area based on multispectral image data;

[0178] The segmentation threshold determination module 306 is used to initialize the threshold population corresponding to the water body mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population.

[0179] Binary image determination module 308 is used to generate a binary image of the water body corresponding to the target region based on the target segmentation threshold;

[0180] The information extraction module 310 is used to construct sample data based on the binary image of the water body, so as to extract the water body objects contained in the target area based on the sample data through the water body information extraction model.

[0181] The water body information extraction device based on remote sensing data provided in this invention can automatically generate high-precision binary images of water bodies to construct samples required for extracting water body objects. Thus, water body objects are extracted based on the binary images of water bodies through a water body information extraction model, avoiding the tedious and time-consuming problems of manual sample annotation, significantly improving sample annotation efficiency, and also effectively improving the accuracy of water body object extraction.

[0182] In one embodiment, the mask image determination module 304 is further configured to:

[0183] Multispectral image data is preprocessed to obtain atmospheric reflectance data corresponding to the target area; the preprocessing includes radiometric calibration, atmospheric correction and cropping.

[0184] Based on atmospheric reflectivity data, multiple water body indices corresponding to the target area were determined.

[0185] The water index image corresponding to the target area is extracted using each water index, and the images of each water index are superimposed to obtain the comprehensive water index image corresponding to the target area.

[0186] The comprehensive water index image is normalized to obtain the water mask image corresponding to the target area.

[0187] In one embodiment, the segmentation threshold determination module 306 is further configured to:

[0188] The water mask image is divided into multiple sub-images;

[0189] For each sub-image, a threshold population corresponding to that sub-image is set; wherein, the threshold population includes multiple threshold particles;

[0190] In the current iteration update process, based on the historical best position vector of the threshold population, and the velocity vector and position vector of each particle in the threshold population at the time of the previous iteration update, the velocity vector and position vector of each threshold particle in the threshold population are iteratively updated until the iteration update stops.

[0191] The target segmentation threshold corresponding to the sub-image is determined based on the inner and outer variances of the threshold population after iterative updates.

[0192] In one embodiment, the segmentation threshold determination module 306 is further configured to:

[0193] Determine the number of water-type pixels, the grayscale value of water-type pixels, the number of non-water-type pixels, the grayscale value of non-water-type pixels, and the total number of pixels in the threshold population corresponding to the sub-image after iterative update;

[0194] The ratio of water-type pixels to total pixels is defined as the water-type pixel percentage, and the ratio of non-water-type pixels to total pixels is defined as the non-water-type pixel percentage.

[0195] The global average gray value is determined based on the proportion of water-type pixels and the product of the gray values ​​of water-type pixels, as well as the proportion of non-water-type pixels and the product of the gray values ​​of non-water-type pixels.

[0196] Based on the global average gray value, the proportion of water-type pixels, the proportion of non-water-type pixels, the gray value of water-type pixels, and the gray value of non-water-type pixels, determine the inner variance and outer variance of the threshold population corresponding to the sub-image after iterative update;

[0197] The target segmentation threshold corresponding to the sub-image is determined based on the inner and outer variances of the threshold population after iterative updates.

[0198] In one implementation, the binary image determination module 308 is further configured to:

[0199] For each sub-image, if the pixel value in the water mask image corresponding to the sub-image is greater than the target segmentation threshold, the pixel value is set to 1; if the pixel value in the water mask image corresponding to the sub-image is less than the target segmentation threshold, the pixel value is set to 0, thus obtaining a binary sub-image.

[0200] Each binary sub-image is stitched together to form a binary image of the water body corresponding to the target region.

[0201] In one embodiment, the water body information extraction model includes a random forest model; the information extraction module 310 is further configured to:

[0202] Convert binary images of water bodies from raster data to vector data;

[0203] The statistical vector data includes the location, area, and shape of each water body object, and sample data is generated based on the location, area, and shape of the water body.

[0204] Call the predict method, using the sample data as input to the random forest model, to obtain the prediction results of the random forest model;

[0205] Based on the prediction results, extract the water bodies contained in the target area.

[0206] In one implementation, a model training module is also included, for:

[0207] The water samples were divided into training and testing sets.

[0208] Create a random forest model using the RandomForestClassifier class from the sklearn library, and set the parameters of the random forest model;

[0209] Call the fit method, taking the features and labels of the training set as input, to train the random forest model;

[0210] The predict method is called, taking the features of the test set as input, to obtain the prediction results of the random forest model;

[0211] In one implementation, a model evaluation module is also included, for:

[0212] Using the metrics module in the sklearn library, the evaluation metrics of the random forest model are calculated based on the prediction results, and the performance of the random forest model is analyzed using visualization tools.

[0213] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0214] This invention provides an electronic device, specifically, the electronic device includes a processor and a storage device; the storage device stores a computer program, and the computer program, when run by the processor, executes the method described in any of the above embodiments.

[0215] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 100, which includes a processor 40, a memory 41, a bus 42 and a communication interface 43. The processor 40, the communication interface 43 and the memory 41 are connected through the bus 42. The processor 40 is used to execute executable modules, such as computer programs, stored in the memory 41.

[0216] The memory 41 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 43 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc.

[0217] Bus 42 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0218] The memory 41 is used to store programs. After receiving an execution instruction, the processor 40 executes the program. The method executed by the device for defining the flow process disclosed in any of the foregoing embodiments of the present invention can be applied to the processor 40 or implemented by the processor 40.

[0219] Processor 40 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 40 or by instructions in software form. Processor 40 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 41. The processor 40 reads the information in memory 41 and, in conjunction with its hardware, completes the steps of the above method.

[0220] The computer program product of the readable storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, please refer to the foregoing method embodiments, which will not be repeated here.

[0221] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0222] Finally, it should be noted that the above-described embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for extracting water body information based on remote sensing data, characterized in that, include: Acquire multispectral image data of the target area; Construct a water mask image corresponding to the target area based on the multispectral image data; Initialize the threshold population corresponding to the water body mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population; Generate a binary image of the water body corresponding to the target region based on the target segmentation threshold; Sample data is constructed based on the binary image of the water body, and the water body objects contained in the target area are extracted based on the sample data using a water body information extraction model. Initialize a threshold population corresponding to the water body mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population, including: The water mask image is divided into multiple sub-images; For each sub-image, a threshold population corresponding to that sub-image is set; wherein, the threshold population includes multiple threshold particles; During the current iteration update process, based on the historical best position vector of the threshold population, and the velocity vector and position vector of each particle in the threshold population at the time of the previous iteration update, the velocity vector and position vector of each threshold particle in the threshold population are iteratively updated until the iteration update stops. Based on the inner and outer variances of the threshold population after iterative updates corresponding to the sub-image, the target segmentation threshold for the sub-image is determined, including: determining the number of water-type pixels, the grayscale value of water-type pixels, the number of non-water-type pixels, the grayscale value of non-water-type pixels, and the total number of pixels in the threshold population after iterative updates corresponding to the sub-image; determining the ratio of the number of water-type pixels to the total number of pixels as the water-type pixel proportion, and determining the ratio of the number of non-water-type pixels to the total number of pixels as the non-water-type pixel proportion; based on the water-type pixel proportion... The global average gray value is determined by multiplying the gray values ​​of the water-type pixels and the proportion of non-water-type pixels and the product of their gray values. Based on the global average gray value, the proportion of water-type pixels, the proportion of non-water-type pixels, the gray values ​​of the water-type pixels, and the gray values ​​of the non-water-type pixels, the inner and outer variances of the threshold population after iterative updates corresponding to the sub-image are determined. Based on the inner and outer variances of the threshold population after iterative updates corresponding to the sub-image, the target segmentation threshold for the sub-image is determined.

2. The method for extracting water body information based on remote sensing data according to claim 1, characterized in that, Constructing a water mask image corresponding to the target area based on the multispectral image data includes: The multispectral image data is preprocessed to obtain the atmospheric reflectance data of the target area; wherein, the preprocessing includes radiometric calibration, atmospheric correction and cropping. Based on the atmospheric bottom reflectance data, multiple water body indices corresponding to the target area are determined; The water index image corresponding to the target area is extracted using each of the water indexes, and the comprehensive water index image corresponding to the target area is obtained by superimposing each of the water index images. The comprehensive water index image is normalized to obtain the water mask image corresponding to the target area.

3. The method for extracting water body information based on remote sensing data according to claim 1, characterized in that, Generating a binary image of the water body corresponding to the target region based on the target segmentation threshold includes: For each sub-image, if the pixel value in the water mask image corresponding to the sub-image is greater than the target segmentation threshold, the pixel value is set to 1; if the pixel value in the water mask image corresponding to the sub-image is less than the target segmentation threshold, the pixel value is set to 0, thus obtaining a binary sub-image. Each of the binary sub-images is stitched together to form a binary image of the water body corresponding to the target region.

4. The method for extracting water body information based on remote sensing data according to claim 1, characterized in that, The water body information extraction model includes a random forest model; sample data is constructed based on the binary image of the water body, and the water body information extraction model extracts water objects contained in the target area based on the sample data, including: Convert the binary image of the water body from raster data to vector data; The location, area, and shape of each water body object in the vector data are statistically analyzed, and sample data is generated based on the location, area, and shape of the water body. Call the predict method, using the sample data as input to the random forest model, to obtain the prediction results of the random forest model; Based on the prediction results, extract the water bodies contained in the target area.

5. The method for extracting water body information based on remote sensing data according to claim 1, characterized in that, The method further includes: The water samples were divided into training and testing sets. Create a random forest model using the RandomForestClassifier class from the sklearn library, and set the parameters of the random forest model; Call the fit method, taking the features and labels of the training set as input, to train the random forest model; The predict method is called, taking the features of the test set as input, to obtain the prediction results of the random forest model; The method further includes: Using the metrics module in the sklearn library, the evaluation metrics of the random forest model are calculated based on the prediction results, and the performance of the random forest model is analyzed using visualization tools.

6. A water body information extraction device based on remote sensing data, characterized in that, include: The first data acquisition module is used to acquire multispectral image data of the target area; A mask image determination module is used to construct a water body mask image corresponding to the target area based on the multispectral image data. The segmentation threshold determination module is used to initialize the threshold population corresponding to the water body mask image, iteratively update the threshold population, and determine the target segmentation threshold corresponding to the water body mask image based on the iteratively updated threshold population. The binary image determination module is used to generate a binary image of the water body corresponding to the target region based on the target segmentation threshold. The information extraction module is used to construct sample data based on the binary image of the water body, so as to extract the water body objects contained in the target area based on the sample data through the water body information extraction model; The segmentation threshold determination module is specifically used for: The water mask image is divided into multiple sub-images; For each sub-image, a threshold population corresponding to that sub-image is set; wherein, the threshold population includes multiple threshold particles; During the current iteration update process, based on the historical best position vector of the threshold population, and the velocity vector and position vector of each particle in the threshold population at the time of the previous iteration update, the velocity vector and position vector of each threshold particle in the threshold population are iteratively updated until the iteration update stops. Based on the inner and outer variances of the threshold population after iterative updates corresponding to the sub-image, the target segmentation threshold for the sub-image is determined, including: determining the number of water-type pixels, the grayscale value of water-type pixels, the number of non-water-type pixels, the grayscale value of non-water-type pixels, and the total number of pixels in the threshold population after iterative updates corresponding to the sub-image; determining the ratio of the number of water-type pixels to the total number of pixels as the water-type pixel proportion, and determining the ratio of the number of non-water-type pixels to the total number of pixels as the non-water-type pixel proportion; based on the water-type pixel proportion... The global average gray value is determined by multiplying the gray values ​​of the water-type pixels and the proportion of non-water-type pixels and the product of their gray values. Based on the global average gray value, the proportion of water-type pixels, the proportion of non-water-type pixels, the gray values ​​of the water-type pixels, and the gray values ​​of the non-water-type pixels, the inner and outer variances of the threshold population after iterative updates corresponding to the sub-image are determined. Based on the inner and outer variances of the threshold population after iterative updates corresponding to the sub-image, the target segmentation threshold for the sub-image is determined.

7. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method described in any one of claims 1 to 5.