Water body automatic extraction method based on decision tree and random forest

By combining decision tree and random forest algorithms, training samples are automatically selected and a multi-feature dataset is constructed, which solves the limitations of single methods and cloud interference in water body extraction. This achieves high-precision and interference-resistant automatic water body extraction, which is suitable for complex environments and large-scale remote sensing monitoring.

CN121147741APending Publication Date: 2025-12-16NAT SATELLITE METEOROLOGICAL CENT

Patent Information

Application Number
CN202511205821.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-27
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

Existing technologies for water extraction suffer from limitations such as single-method limitations, poor adaptability to complex environments, time-consuming and labor-intensive sample labeling, and severe cloud interference, making it difficult to achieve rapid and accurate automatic water extraction.

Method used

By combining decision tree and random forest algorithms, training samples are automatically selected through water index, slope calculation and texture features to construct a multi-feature dataset. The random forest model is used to classify water bodies and the decision tree threshold is dynamically adjusted to adapt to different satellite images.

Benefits of technology

It achieves end-to-end automation of water body extraction, improves classification accuracy, has strong anti-interference ability, is suitable for large-scale remote sensing monitoring, and is especially suitable for the precise extraction of lake water, reducing manual intervention and time costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121147741A_ABST
    Figure CN121147741A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic water body extraction method based on a decision tree and a random forest, and relates to the technical field of water body remote sensing monitoring, the method is based on multispectral remote sensing data, through water body index calculation, Hot index calculation and gradient calculation, rough classification results of water bodies, lands and clouds are extracted, and the rough classification results of the water bodies, the lands and the clouds are extracted; random sampling is carried out on the rough classification result to generate training samples of a water body, land and cloud; constructing a feature set containing spectral features, texture features and principal component transformation features; and inputting the training sample and the feature set, training a random forest model, and performing water body classification prediction on the remote sensing image by using the model. According to the method, a simple decision tree and a random forest are combined for water extraction, automatic extraction of samples is realized, automatic recognition of lake water is further realized, the water and shadows are effectively distinguished through gradient features and texture features, cloud and clear sky pixels are accurately separated by utilizing a hot index, the cloud is prevented from polluting training samples, and cloud layer interference is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of water body remote sensing monitoring, and particularly relates to a water body automatic extraction method based on a decision tree and a random forest. BACKGROUND

[0002] In the process of water resource monitoring and application, it is very crucial to analyze the spatial and temporal distribution characteristics of water bodies because water bodies may change greatly in different time and space due to human activities and natural factors. The emergence and development of satellite remote sensing data open up a new way for water body distribution research and are one of important data sources for identifying water bodies. Based on satellite remote sensing data, different parameters of water bodies are extracted, mainly including water body shape, position and area, etc. This method can effectively save manpower, ensure safety, and improve work efficiency. This way is very widely used at present and plays an important role in the process of water resource monitoring and application.

[0003] A large number of scholars at home and abroad have carried out in-depth research on how to use remote sensing satellites to quickly and accurately extract water body information, and have achieved certain results. Among them, the methods for extracting land surface water bodies according to visible light remote sensing data include the following types:

[0004] (1) Single-band threshold method: Because the surface water body will strongly absorb solar radiation in the near-infrared band, the near-infrared band data is used for threshold division, which can directly distinguish water bodies and non-water bodies. Frazier et al. used threshold method for water body extraction of Wagga Lake in Australia respectively for TM4, TM5 and TM7 bands, and the results showed that the result of TM5 single-band threshold method was better than that of the other two bands, but still could not extract small water bodies. The single-band method has been gradually replaced by the multi-band method, and most of the researches are to extract water body information by combining single-band method and multi-band method.

[0005] (2) Multi-band spectral relationship method: This method uses the differences of ground objects in each single band to establish various relationships, mainly through the superposition and comparison of different band values to strengthen the information of specific target bodies. Zhou Chenghu et al. used TM data to establish spectral relationship for water body extraction. The multi-band spectral relationship method usually uses more bands for comparison research, and the calculation is relatively simple, but it needs certain prior knowledge for judgment, which is not conducive to the development of automatic identification. For a specific region, the band combination and spectral relationship are relatively fixed, and it cannot be effectively extended to a wider region.

[0006] (3) Water body index method: In 1996, McFeeters first proposed a normalized difference water index (NDWI) to enhance the gray difference between water bodies and other ground objects. The main principle is to enhance water information and weaken non-water information. In 2005, Xu analyzed the Landsat data in Xiamen area and modified the band combination based on Mcfeeters' normalized water index to form an improved normalized water index (MNDWI). MNDWI can suppress the shadow of high-rise buildings in urban areas to a certain extent. The threshold selection in the current index method mostly relies on the classification experience of researchers. In the calculation process, a large amount of artificial time is usually spent to determine the threshold, and the applicability is not high for large-area land surface water extraction.

[0007] (4) Object-oriented method: The basic unit of object-oriented analysis is a homogeneous "object" composed of many pixels containing the same information. Its extraction process includes two steps of image segmentation and image classification. Segmentation is to divide the image into different objects, so that the object maintains maximum homogeneity and the object maintains maximum heterogeneity, reducing the influence of "same spectrum different objects" and "different spectrum same objects", which is the key to object-oriented information extraction technology. Kaplan et al. used Sentinel-2 data to extract water information in two different regions of Macedonia, mountainous and urban areas, by combining NDWI and object-oriented method, and the accuracy of the research results was greatly improved.

[0008] (5) Machine learning-based water extraction method: mainly focuses on bionic intelligent algorithm, support vector machine (SVM), random forest, deep learning, etc. Through the collection of water samples and non-water samples, training data is established, and a training model is built through a programming language. After the training data is imported into the model, the model information is obtained, and then the water extraction of the to-be-identified region is carried out. The random forest algorithm has obvious advantages in feature selection and classification extraction, and is widely used in water classification. Rao Pinzeng applied the random forest method to the flood disaster monitoring of MODIS image, and the experiment showed that the water body recognition accuracy of the random forest method was higher than that of the traditional water body index method (NDVI, NDWI and MNDWI) and the common machine learning method (logistic regression and support vector machine); Wang Xinyu analyzed the importance of the WFV image features of Gaofen-1 satellite, optimized the model parameters of the random forest model, selected the effective input features of the random forest, and constructed a water body extraction model. The experiment showed that the water body extraction method based on random forest could accurately extract the small water body of the reservoir edge and the tail. With the continuous development of deep learning, especially in recent years, semantic segmentation makes remote sensing data have greater utilization value. Based on convolutional neural network, various net structures are used to carry out semantic segmentation, and the main semantic segmentation networks include Unet, Unet++, Segnet, FCN, and new network models continuously evolved and improved on such model structures. The machine learning method is currently widely used in many remote sensing image classifications. This method has certain requirements for sample selection, and needs to have a good understanding of the study area.

[0009] Overall, for complex land surface environment problems, single method for water extraction is limited, and with the continuous development of technology, researchers will carry out water extraction by comprehensively utilizing multiple methods to obtain more accurate results. At present, there is no universal optimal method for extracting water body information, and the accuracy of various classification algorithms will also differ according to different application scenarios. Most water extraction models based on supervised learning require a large number of high-quality training samples. Due to the influence of human, sensors and weather, the style of water in remote sensing images often differs greatly, and it is impossible to label a large amount of remote sensing data one by one. SUMMARY

[0010] Therefore, in order to solve the above problems, the purpose of the present application is to provide a water body automatic extraction method based on decision tree and random forest, which combines simple decision tree and random forest for water extraction, realizes automatic extraction of samples, and realizes automatic identification of lake water.

[0011] In order to achieve the above purpose, the present application provides the following technical scheme:

[0012] Based on the above purpose, the first aspect, the application provides a water body automatic extraction method based on decision tree and random forest, comprising the following steps:

[0013] Step 1) Automatic selection of training samples: based on multispectral remote sensing data, through water body index calculation, hot index calculation and slope calculation, the coarse classification results of water body, land and cloud are extracted, and the training samples of water body, land and cloud are randomly sampled on the coarse classification results;

[0014] Step 2) Construction of multi-feature data set: a feature set containing spectral features, texture features and principal component transformation features is constructed;

[0015] Step 3) Random forest classification: input the training samples and feature set, train the random forest model, and use the model to predict the water body classification of remote sensing image.

[0016] As a further scheme of the application, the automatic selection of training samples in step 1) comprises the following steps:

[0017] a) Cloud sample identification: separate cloud and clear sky pixels by hot index, and the hot index calculation formula is:

[0018] ;

[0019] In the formula, is the reflectivity of blue light band in the image, is the reflectivity of red light band in the image;

[0020] b) Water body and land sample identification: through normalized difference water body index (NDWI) and slope calculation, combined with preset threshold to distinguish water body sample, land sample and mixed pixel;

[0021] The normalized difference water body index (NDWI) calculation formula in the water body extraction model is:

[0022] ;

[0023] In the formula, is the reflectivity of green light band in the image, is the reflectivity of near-infrared band in the image, and the NDWI index can suppress the vegetation information to the greatest extent and highlight the water body features;

[0024] The horizontal increment and vertical increment are determined by the values of the center pixel and the eight adjacent pixels, and the slope is calculated, and the slope calculation formula is as follows:

[0025] ;

[0026] ;

[0027] ;

[0028] In the formula, is the slope component in the X direction, is the elevation value of the right adjacent point in the X direction, is the elevation value of the left adjacent point in the X direction, is the horizontal distance between the adjacent center pixels in the X direction, is the slope component in the Y direction, is the elevation value of the upper adjacent point in the Y direction, is the elevation value of the lower adjacent point in the Y direction, is the horizontal distance between the adjacent center pixels in the Y direction, is the final slope angle;

[0029] According to the NDWI and the slope calculation result, land and water are extracted by threshold value;

[0030] c) Random sampling: on the water, land and cloud rough classification result, a predetermined number N of sample points of each category are randomly sampled.

[0031] As a further scheme of the present application, the water and land classification in step b) is realized by a decision tree, and the decision tree is constructed based on the NDWI threshold value, the slope threshold value and the Hot index threshold value.

[0032] As a further scheme of the present application, the NDWI threshold value, the slope threshold value and the Hot index threshold value are dynamically adjusted according to the satellite image type.

[0033] As a further scheme of the present application, the random sampling process in step c) is only for water, land and cloud.

[0034] As a further scheme of the present application, in step 2), the spectral feature is the NDWI index, the texture feature is obtained by using a gray level co-occurrence matrix (GLCM), and the parameters of the texture feature include an angular second moment, a contrast, an entropy, a homogeneity and a correlation; wherein, the calculation formula of the angular second moment is:

[0035] ;

[0036] In the formula, represents the angular second moment value, is the gray level number of the image, represents the normalized gray level co-occurrence matrix, i and j represent the gray scale values of a pair of pixels (i is the gray scale of a reference pixel, and j is the gray scale of a neighboring pixel) for the coordinate index in the gray scale co-occurrence matrix;

[0037] The calculation formula of the contrast is as follows:

[0038] ;

[0039] In the formula, represents the contrast value, is the gray scale number of the image, is the absolute value of the gray scale difference, represents the conditional probability satisfying the specific gray scale difference n;

[0040] The calculation formula of the entropy is as follows:

[0041] ;

[0042] In the formula, represents the entropy value, is the gray scale number of the image, represents the normalized gray scale co-occurrence matrix element;

[0043] The calculation formula of the uniformity is as follows:

[0044] ;

[0045] In the formula, represents the uniformity value;

[0046] The calculation formula of the correlation is as follows:

[0047] ;

[0048] In the formula, represents the correlation value, represents the mean value in the row direction, represents the mean value in the column direction, represents the standard deviation in the row direction, represents the standard deviation in the column direction;

[0049] The correlation is used to reflect the similarity of the gray scales in the row or column direction of the image.

[0050] As a further scheme of the present application, the principal component transformation feature in step 2) is obtained by performing principal component analysis (PCA) on the remote sensing image, and includes:

[0051] An original image data matrix X is constructed, a covariance matrix S of the original image data matrix X is calculated, and the original data of the multi-band image is represented in the form of a matrix as follows:

[0052] ;

[0053] In the matrix X, m and n are the number of bands and the number of pixels in each image, respectively, represents the value of the i-th band at the j-th pixel position (i = 1,..., m; j = 1,..., n), and each row vector in the matrix represents an image of a band;

[0054] The covariance matrix S of the original image data matrix X is:

[0055] ;

[0056] ;

[0057] wherein, represents the band mean vector, , is the matrix transpose operator, is the total number of pixels, represents the mean of the n-th band, (the i-th band mean), represents the vector of the i-th band, is the pixel position index;

[0058] The eigenvalues and eigenvectors of the covariance matrix S are calculated, forming the transformation matrix T, and the characteristic equation is solved.

[0059] The eigenvalues are arranged in ascending order, and the unit eigenvectors corresponding to the respective eigenvalues are obtained ;

[0060] The matrix U is formed with as columns, and the transpose matrix of the matrix U is the transformation matrix T.

[0061] As a further scheme of the present application, each row variable of the new variable obtained after the principal component transformation is sequentially referred to as the first principal component and the second principal component,..., the n-th principal component, and the new variable is restored to a two-dimensional image and becomes an n principal component image.

[0062] As a further scheme of the present application, the random forest model in step 3) is composed of multiple decision trees, and the training process includes:

[0063] Independent and identically distributed training subsets are generated by the Bootstrap method;

[0064] Each decision tree is trained based on the training subset and randomly selected features;

[0065] The classification result is determined by voting of multiple decision trees, and the class with the highest votes is the final output.

[0066] As a further scheme of the present application, when the random forest model is trained, input the training data set and the feature set; randomly and with replacement, use the random forest to predict the data, each decision tree in the forest votes to select the classification result, and the final classification result is obtained.

[0067] Compared with the prior art, the water body automatic extraction method based on decision tree and random forest has the following beneficial effects:

[0068] 1. The present application realizes automatic selection of training samples through decision tree (NDWI, slope and Hot index), replaces the traditional manual sample labeling method, greatly reduces manual intervention and time cost, realizes end-to-end water body extraction automation in combination with random forest classification, is suitable for large-scale remote sensing monitoring scene; further enhances water body information through spectral feature, suppresses vegetation interference, compensates for spectral confusion defects through texture feature, effectively distinguishes same spectrum and different objects, highlights useful image information through principal component analysis, expands feature difference, realizes multi-feature collaborative optimization, has high classification precision and strong anti-interference ability, the voting mechanism of multiple decision trees reduces the risk of overfitting, is robust to noise and abnormal values, and improves complex environment.

[0069] 2. The present application also overcomes the problems of single index method, the traditional NDWI is easily disturbed by mountain shadow and building area, but the method of the present application effectively distinguishes water body and shadow through slope feature and texture feature, accurately separates cloud and clear sky pixels by using Hot index, prevents cloud pollution of training samples, avoids cloud interference, and the decision tree threshold can be dynamically adjusted according to different satellite images, is flexible and adaptive to multi-source data, is especially suitable for accurate extraction of lake water body, has important practical significance in flood monitoring and water resource management, provides a new technical idea for the field of water body remote sensing monitoring, and promotes the development of automation and intelligence.

[0070] These aspects or other aspects of the present application will be more apparent in the following description of the embodiments. It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS

[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the following will briefly introduce the drawings needed to be used in the exemplary embodiments or related art description. The drawings are used to provide further understanding of the present application, and constitute a part of the specification. The drawings together with the embodiments of the present application are used to explain the present application, and do not constitute a limitation of the present application. In the drawings:

[0072] Figure 1A pixel diagram for calculating slope in a water body automatic extraction method based on decision tree and random forest of an embodiment of the present application.

[0073] Figure 2 A decision tree diagram of a water body automatic extraction method based on decision tree and random forest of an embodiment of the present application.

[0074] Figure 3 A random sampling diagram in a water body automatic extraction method based on decision tree and random forest of an embodiment of the present application.

[0075] Figure 4 A flow chart for data prediction by random forest in a water body automatic extraction method based on decision tree and random forest of an embodiment of the present application. DETAILED DESCRIPTION

[0076] The specific embodiments of the present application are described below in detail with reference to the accompanying drawings, but the scope of protection of the present application is not limited by the specific embodiments.

[0077] Unless otherwise clearly indicated, in the entire specification and claims of the present application, the term "comprise" or its variants such as "comprises" or "comprising" will be understood to encompass the presence of stated elements or components, but not to preclude the presence of additional elements or components.

[0078] Due to the actual large-scale surface water monitoring and long time series analysis, most researchers tend to use various water indices to achieve automatic and rapid water extraction. The water index method is mostly based on the construction of mid-infrared and short-wave infrared bands. Some medium and high resolution remote sensing images cannot construct some water indices due to the absence of mid-infrared and short-wave infrared bands, resulting in confusion between water and shadow and inability to separate them. Moreover, high-quality training samples have always been the main obstacle and challenge for machine learning to identify water. There are three main methods to obtain training samples. One is to manually draw water sample labels by visual interpretation. Due to the influence of human factors, sensors and weather, as well as the irregular shape of water, the style of water in remote sensing images often varies greatly, and the characteristics of water in different regions may differ significantly, so that water samples in one region are not suitable for other regions, making it very time-consuming and laborious to produce a large number of samples. The second method is to obtain water-non-water rough extraction by simple water index calculation or supervised classification, and then manually correct the vector results after classification. This method uses simple water index for rough water extraction, which cannot suppress interference information such as mountain shadow, is not suitable for complex situations, and still needs manual correction, which is time-consuming. The third method is to use public training sample datasets, but with the continuous development of high-resolution remote sensing observation technology, the number of various remote sensing images increases, and the existing sample datasets are difficult to meet the demand and are difficult to obtain.

[0079] Based on this, the present application provides a water automatic extraction method based on decision tree and random forest, which realizes automatic extraction of samples and accurate identification of lake water.

[0080] As shown in Figures 1 to 4 , the embodiment of the present application provides a water automatic extraction method based on decision tree and random forest, which comprises the following steps:

[0081] Step S10, automatic selection of training samples: based on multispectral remote sensing data, water, land and cloud rough classification results are extracted by water index calculation, Hot index calculation and slope calculation, and water, land and cloud training samples are randomly sampled on the rough classification results.

[0082] In this step, referring to Figure 2 , the automatic selection of training samples comprises the following steps:

[0083] a) Cloud sample identification: first, identify the cloud sample according to the threshold of the Hot index. Considering that the spectral response of the cloud is different from that of most land surfaces in the blue and red bands, and the Hot value of the cloud pixel is usually greater than that of the clear sky pixel, the cloud and the clear sky pixel are separated. Among them, the cloud and the clear sky pixel are separated by the Hot index, and the Hot index calculation formula is:

[0084] ;

[0085] Rb is the reflectance of blue band in the image, Rr is the reflectance of red band in the image. Rr is the reflectance of red band in the image.

[0086] b) Water body and land sample identification: distinguish water body sample, land sample and mixed pixel through normalized difference water index (NDWI) and slope calculation, combined with preset threshold; wherein, the normalized difference water index (NDWI) is gradually weakened from visible light to mid-infrared band using water body reflection, and the water body has strong absorption in near-infrared band and strong reflectivity of vegetation. This index can well suppress vegetation information and enhance water body information. On the basis of water body index calculation result, by selecting a certain threshold T, the water body is satisfied with the formula, and the others are other ground objects.

[0087] The normalized difference water index (NDWI) calculation formula in the water body extraction model is:

[0088] ;

[0089] Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, NDWI index can maximize the suppression of vegetation information and highlight the water body characteristics;

[0090] The horizontal increment and the vertical increment are determined by the values of the center pixel and the eight adjacent pixels, wherein, referring to FIG. 1, the adjacent pixels are identified by letters e1 to e7, and e represents the pixel currently being calculated for the slope direction. When calculating the slope, the slope calculation formula is as follows: Figure 1

[0091] ;

[0092] ;

[0093] ;

[0094] Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image, Rb is the reflectance of blue band in the image,​ for the final slope angle;

[0095] According to the NDWI and slope calculation results, land and water bodies are extracted by threshold, and the decision tree is as shown in Figure 2

[0096] c) Random sampling: on the water body, land and cloud coarse classification results, a predetermined number N of sample points of each class are randomly sampled, as shown in Figure 3

[0097] In step b), the classification of water and land is realized by a decision tree, and the decision tree is constructed based on the NDWI threshold, the slope threshold and the Hot index threshold, and the NDWI threshold, the slope threshold and the Hot index threshold are dynamically adjusted according to the type of satellite image.

[0098] Step S20, multi-feature dataset construction: a feature set containing spectral features, texture features and principal component transformation features is constructed.

[0099] In this step, the multi-feature dataset construction can construct the feature set by the following three methods: one is to calculate the water body index according to the spectral features of the ground object, so that the water information is highlighted in the image, and other ground objects are inhibited to different degrees; another method is to use principal component analysis to transform the remote sensing image into a new feature space, highlight the useful information of the image in the new feature space, expand the difference between remote sensing images in different features, and improve the interpretation and analysis ability of remote sensing images. Three is to obtain texture features through a gray level co-occurrence matrix (GLCM).

[0100] Since the remote sensing image reflects the size value of the reflection of electromagnetic waves by various ground objects, it has rich texture features. These texture features reflect the homogeneity in the image, and also reflect the internal properties shared by the ground object surface, including important information about the arrangement of the surface structure of the ground object and their connection with the surrounding environment. Therefore, the texture information of the remote sensing image can make up for the shortcomings of using only spectral features.

[0101] In this embodiment, the spectral feature is the NDWI index, the texture feature is obtained by using a gray level co-occurrence matrix (GLCM), and the parameters of the texture feature include angular second moment, contrast, entropy, homogeneity and correlation. The calculation formula of the angular second moment is:

[0102]

[0103] In the formula,​​​ denotes an angular second moment value, denotes a number of gray levels of the image, denotes a normalized gray level co-occurrence matrix, denotes a coordinate index in the gray level co-occurrence matrix, i and j represent gray levels of a pair of pixels (i is a reference pixel gray level and j is a neighboring pixel gray level); wherein, the second moment of the angle, also known as energy, reflects the uniformity of the image gray level distribution and the roughness of the texture. When the values in the gray level co-occurrence matrix are similar, the energy is smaller and the texture is finer. If some values are larger and other values are smaller, the energy value is larger and the texture is coarser.

[0104] The calculation formula of the contrast is:

[0105] ;

[0106] In the formula, denotes a contrast value, denotes a number of gray levels of the image, denotes an absolute value of the gray level difference, denotes a conditional probability satisfying a specific gray level difference n; wherein, the contrast reflects the clarity of the image and the depth of the texture groove, the greater the contrast, the clearer the visual effect of the image; on the contrary, the contrast is small, the image is blurred. When the element value far from the diagonal line in the gray level co-occurrence matrix is larger, a larger contrast will be generated.

[0107] The calculation formula of the entropy is:

[0108] ;

[0109] In the formula, denotes an entropy value, denotes a number of gray levels of the image, denotes a normalized gray level co-occurrence matrix element; wherein, the entropy is a randomness measure of the amount of information contained in the image. When all values in the co-occurrence matrix are equal or the pixel values exhibit maximum randomness, the entropy is maximum; therefore, the entropy value indicates the complexity of the image gray level distribution, the greater the entropy value, the more complex the image.

[0110] The calculation formula of the uniformity is:

[0111] ;

[0112] In the formula, denotes a uniformity value, wherein, the uniformity reflects the size of the local change of the image texture, if the different regions of the image texture are relatively uniform and change slowly, the value of the uniformity will be larger, and vice versa.

[0113] The calculation formula of the correlation is:

[0114] ;

[0115] In the formula, represents a correlation value, represents a mean value in a row direction, represents a mean value in a column direction, represents a standard deviation in a row direction, represents a standard deviation in a column direction; the correlation is used to reflect the similarity of gray levels of the image in the row or column direction, and the size of the similarity value reflects the size of the local gray correlation.

[0116] In the embodiment, principal component analysis is performed on the image, the remote sensing image is transformed into a new feature space, the useful information of the image is highlighted in the new feature space, the difference between the remote sensing images in different features is enlarged, and the interpretation and analysis capability of the remote sensing image is improved. The principal component transformation feature is obtained by performing principal component analysis (PCA) on the remote sensing image, and includes:

[0117] An original image data matrix X is constructed, a covariance matrix S of the original image data matrix X is calculated, and the original data of the multi-band image is represented in the form of a matrix as follows:

[0118] ;

[0119] In the matrix X, m and n are respectively the number of bands and the number of pixels in each image, represents the value of the i-th band at the j-th pixel position (i=1,...,m; j=1,...,n), and each row vector in the matrix represents an image of a band;

[0120] Wherein, the principal component transformation of a general image can be represented by the following formula:

[0121] ;

[0122] Wherein, X is the image data matrix to be transformed, Y is the transformed data matrix, T is an orthogonal matrix composed of the eigenvectors of the covariance matrix S of the original image data matrix X, and each row vector of the data matrix after principal component analysis is a principal component of the principal component analysis.

[0123] The covariance matrix S of the original image data matrix X is:

[0124] ;

[0125] ;

[0126] In the formula, represents a band mean value vector, , is a matrix transposition operator, is the total number of pixels, represents the mean of the nth band, is the mean of the ith band, represents the vector of the ith band, is the pixel position index;

[0127] Eigenvalues of the covariance matrix S and eigenvectors form the transformation matrix T, and the eigen equation is solved ;

[0128] Eigenvalues are arranged in ascending order , and the unit eigenvector corresponding to the eigenvalue is obtained ;

[0129] Form a matrix U with as the column, and the transpose of the matrix U is the transformation matrix T.

[0130] In this embodiment, each row variable of the new variable obtained after the principal component transformation is sequentially referred to as the first principal component and the second principal component... the nth principal component, and the new variable is restored to a two-dimensional image and becomes an n principal component image.

[0131] Step S30, random forest classification: input the training sample and feature set, train the random forest model, and use the model to predict the water body classification of the remote sensing image.

[0132] In this step, the random forest model is composed of multiple decision trees, and the training process includes:

[0133] Independent and identically distributed training subsets are generated by the Bootstrap method;

[0134] Each decision tree is trained based on the training subset and randomly selected features;

[0135] The classification result is determined by voting of multiple decision trees, and the class with the highest votes is the final output.

[0136] In this embodiment, the random forest is a set of a series of decision trees (h(x, ), k = 1, …), where is an independent and identically distributed random vector, and each tree casts a separate vote for which classification result the input variable x belongs to, and the final classification result is the one with the most votes. The number of tree-shaped classifiers k in the definition of random forest is the number of trees, x is the input sample vector, and the random vector is actually the parameter vector of the kth tree, and the training set obtained by the bootstrap method is independent and identically distributed, and the random vector Also independent and identically distributed vectors. In the prediction time is determined by the kth tree is used to make predictions on the input vector x. The predicted value y of the input value x is determined by the output results of all trees, and the algorithm principle is shown as follows In the prediction time is determined by the kth tree is used to make predictions on the input vector x. The predicted value y of the input value x is determined by the output results of all trees, and the algorithm principle is shown as follows Figure 4 In the prediction time is determined by the kth tree is used to make predictions on the input vector x. The predicted value y of the input value x is determined by the output results of all trees, and the algorithm principle is shown as follows

[0137] In some embodiments, the threshold values of the decision tree can be modified according to the satellite image used, and the present application is based on the spectral characteristics of the water body on the target image to construct a decision tree to extract water body samples, and combines the random forest algorithm to automatically identify the water body, thereby providing a new idea and method for automatic extraction of water body.

[0138] The present application realizes automatic selection of training samples through decision trees (NDWI, slope and Hot index), replaces the traditional manual sample labeling mode, greatly reduces manual intervention and time cost, realizes end-to-end water body extraction automation in combination with random forest classification, is suitable for large-scale remote sensing monitoring scenes, enhances water body information through spectral characteristics, suppresses vegetation interference, compensates for spectral confusion defects through texture characteristics, effectively distinguishes same-spectrum different objects, highlights useful image information through principal component analysis, expands feature differences, realizes multi-feature collaborative optimization, has high classification precision and strong anti-interference ability, the voting mechanism of multiple decision trees reduces the overfitting risk, is robust to noise and abnormal values, and improves complex environment.

[0139] The present application also overcomes the problems of the single index method, the traditional NDWI is easily disturbed by mountain shadows and building areas, the method of the present application effectively distinguishes water body and shadow through slope characteristics and texture characteristics, accurately separates cloud and clear sky pixels by using the Hot index, prevents cloud pollution of training samples, avoids cloud interference, and the threshold values of the decision tree can be dynamically adjusted according to different satellite images, which is flexible and adaptive to multi-source data, especially suitable for accurate extraction of lake water body, has important practical significance in flood monitoring and water resource management, provides a new technical idea for the field of water body remote sensing monitoring, and promotes the development of automation and intelligence.

[0140] It should be noted that the above-described figures are only schematic representations of the processes included in the method according to the exemplary embodiments of the present application, and are not for the purpose of limitation. It is easily understood that the processes shown in the above-described figures do not indicate or limit the time sequence of these processes. In addition, it is also easily understood that these processes can be executed synchronously or asynchronously, for example, in multiple modules.

[0141] It should be understood that, although the steps are described in a certain order, the steps are not necessarily executed in the order described above. Unless otherwise explicitly stated herein, the execution of the steps is not strictly limited in sequence, and the steps can be executed in other orders. Moreover, some steps of the embodiments can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of the steps or stages is not necessarily sequential, but can be alternately or alternately executed with at least part of other steps or steps or stages in other steps.

[0142] The above is the exemplary embodiment disclosed by the present application, but it should be noted that various changes and modifications can be made without departing from the scope of the embodiments disclosed by the present application defined by the claims. The functions, steps and / or acts of the method claims described herein need not be performed in any particular order. Furthermore, although the elements of the embodiments disclosed by the present application can be described or claimed in individual form, unless explicitly restricted, they can also be understood as plural.

[0143] Those skilled in the art will understand that the discussion of any of the above embodiments is merely exemplary and not intended to suggest that the scope of the embodiments disclosed by the present application (including the claims) is limited to these examples; the above embodiments or technical features among different embodiments can also be combined, and there are many other variations of the above aspects of the embodiments of the present application, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the embodiments of the present application.

[0144] The foregoing description of specific exemplary embodiments of the application is intended to be illustrative only and is not intended to limit the true scope of the application, which is defined in the claims. It is apparent that various modifications, adaptations, and variations can be made to the embodiments of the application without departing from the spirit and scope of the application. The exemplary embodiments are chosen and described in order to explain the principles of the application and its practical application to thereby enable others skilled in the art to best utilize the application. It is intended that the scope of the application be defined by the claims and their equivalents.

Claims

1. An automatic water body extraction method based on decision trees and random forests, characterized in that, The method includes the following steps: Step 1) Automatic selection of training samples: Based on multispectral remote sensing data, the coarse classification results of water, land and clouds are extracted through water index calculation, Hot index calculation and slope calculation, and training samples of water, land and clouds are generated by random sampling on the coarse classification results. Step 2) Construction of a multi-feature dataset: Construct a feature set that includes spectral features, texture features, and principal component transformation features; Step 3) Random Forest Classification: Input the training samples and feature set, train the random forest model, and use the model to perform water body classification prediction on remote sensing images.

2. The automatic water body extraction method based on decision tree and random forest as described in claim 1, characterized in that, Step 1) involves the automatic selection of training samples, including the following steps: a) Cloud sample identification: Separating cloud and clear sky pixels using the Hot index; b) Water and land sample identification: Water samples, land samples and mixed pixels are distinguished by normalized differential water index and slope calculation, combined with preset thresholds; c) Random sampling: Random sampling is performed on the coarse classification results of water bodies, land and clouds, for each category, a preset number N of sample points.

3. The automatic water body extraction method based on decision tree and random forest as described in claim 2, characterized in that, In step b), the classification of water bodies and land is achieved through a decision tree, which is constructed based on the NDWI threshold, slope threshold, and Hot index threshold.

4. The automatic water body extraction method based on decision tree and random forest as described in claim 3, characterized in that, The NDWI threshold, slope threshold, and Hot index threshold are dynamically adjusted according to the satellite image type.

5. The automatic water body extraction method based on decision tree and random forest as described in claim 2, characterized in that, The random sampling process in step c) is only for three types of land features: water, land, and clouds.

6. The automatic water body extraction method based on decision tree and random forest as described in claim 1, characterized in that, In step 2), the spectral feature is the NDWI index. The texture feature is obtained using the gray-level co-occurrence matrix. The parameters of the texture feature include the second moment of the angle, contrast, entropy, uniformity, and correlation.

7. The automatic water body extraction method based on decision tree and random forest as described in claim 6, characterized in that, Step 2) The principal component transformation features are obtained by performing principal component analysis on the remote sensing image, including: Construct the original image data matrix X, calculate the covariance matrix S of the original image data matrix X, and represent the original data of the multi-band image in matrix form as follows: ; In matrix X, m and n represent the number of bands and the number of pixels in each image, respectively. This represents the value of the i-th band at the j-th pixel position, and each row vector in the matrix represents an image of a band; The covariance matrix S of the original image data matrix X is: ; ; In the formula, Represents the band mean vector. , This is the matrix transpose operator. Total number of pixels This represents the mean of the nth band. , The vector representing the i-th band. For pixel position index; Find the eigenvalues ​​of the covariance matrix S and eigenvectors Form the transformation matrix T and solve the characteristic equation. ; Arrange the eigenvalues ​​in ascending order To obtain the unit eigenvectors of the corresponding eigenvalues. ; by As a column-forming matrix U, the transpose of matrix U is the transformation matrix T.

8. The automatic water body extraction method based on decision tree and random forest as described in claim 7, characterized in that, After the principal component transformation, each row of the new variables is sequentially called the first principal component, the second principal component, ..., the nth principal component. The new variables are restored to a two-dimensional image and become an image of n principal components.

9. The automatic water body extraction method based on decision tree and random forest as described in claim 1, characterized in that, In step 3), the random forest model consists of multiple decision trees, and the training process includes: Generate independent and identically distributed training subsets using the Bootstrap method; Each decision tree is trained based on a training subset and randomly selected features; The classification result is determined by voting from multiple decision trees, and the category with the most votes is the final output.

10. The automatic water body extraction method based on decision tree and random forest as described in claim 9, characterized in that, When training a random forest model, the input is a training dataset and a feature set; random sampling with replacement is used to predict the data; each decision tree in the forest votes on the classification result to obtain the final classification result.

Citation Information

Patent Citations

  • Aquatic vegetation remote-sensing classification threshold calculating method based on spectrum index ordering method

    CN107944413A

  • Method for determining the best feature subset

    CN109117956A

  • Rice planting area extraction method based on Sentinel-2A / B data

    CN113033670A

  • Remote sensing monitoring method for regional forest stock

    CN114624232A

  • Urban open space mapping method and device based on deep learning

    CN118247664A

Cited By

  • Micro water body refined extraction method based on multi-source collaboration and edge perception

    CN122244717A