Water body extraction method and device, electronic equipment and storage medium
By using the random forest model and parallel computing technology, the problems of high computational cost and manual dependence in deep learning algorithms have been solved, achieving efficient and automated water body extraction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TSINGHUA UNIVERSITY
- Filing Date
- 2024-08-30
- Publication Date
- 2026-06-02
Smart Images

Figure CN119091320B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of remote sensing technology, and in particular to a water extraction method, apparatus, electronic device, and storage medium. Background Technology
[0002] Remote sensing technology has been widely used in water extraction research due to its advantages such as wide coverage and rich spectral information.
[0003] In related technologies, deep learning algorithms can be used to extract water bodies from remote sensing images with relatively high accuracy. However, deep learning algorithms are typically computationally intensive, requiring substantial computing resources to run. Furthermore, current mainstream water extraction algorithms are highly dependent on the user's expertise, necessitating manual intervention in their operation, which leads to low water extraction efficiency. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a water extraction method, apparatus, electronic device, and storage medium.
[0005] According to a first aspect of the present disclosure, a water extraction method is provided, comprising:
[0006] Acquire remote sensing images;
[0007] The remote sensing image is segmented to obtain a target sub-image, the target sub-image containing at least a portion of the water body area in the remote sensing image;
[0008] Calculate various water indices for the target sub-image to obtain initial feature data;
[0009] Based on the initial feature data and the ground feature sample data of the target sub-image, a random forest model is trained; wherein, the ground feature sample data is used to show the ground feature type of each grid in the target sub-image, the ground feature type includes water bodies and non-water bodies, and the random forest model is used to characterize the relationship between the various water body indices and the ground feature type;
[0010] Based on the importance scores of the various water body indices in the random forest model, at least one target index is determined from the various water body indices;
[0011] Calculate at least one target index in the remote sensing image to obtain target feature data;
[0012] The target feature data is input into the trained random forest model to obtain water body extraction results, which are used to show the water body regions in the remote sensing image.
[0013] In some embodiments, determining at least one target index from among the multiple water body indices based on their importance scores in the random forest model includes:
[0014] The importance scores of the various water body indices are obtained, and these importance scores are generated during the training of the random forest model.
[0015] The top N water body indices with the highest importance scores among the various water body indices are determined as the target indices, where N is a positive integer.
[0016] In some embodiments, the method further includes:
[0017] The at least one target index is screened based on the correlation coefficient between the at least one target index, so that no two screened target indices are correlated; wherein, the target indices whose correlation coefficients satisfy a preset condition are correlated.
[0018] If the number of target indices after screening is less than N, new target indices are determined from the various water body indices to ensure that there are N types of target indices and that no two target indices are correlated.
[0019] In some embodiments, the method further includes:
[0020] In the case where the remote sensing image is a remote sensing image acquired during the target time period, the first thermal radiation data of the remote sensing image is obtained, and the resolution of the first thermal radiation data is the same as the resolution of the target index of the remote sensing image.
[0021] The target feature data includes: at least one target index of the remote sensing image and the first thermal radiation data.
[0022] In some embodiments, acquiring the first thermal radiation data of the remote sensing image includes:
[0023] Among the various water body indices, the top M water body indices with the highest importance scores (excluding the target index) are determined as the first thermal inversion index, where M is a positive integer.
[0024] The first thermal inversion index of the remote sensing image is input into a pre-trained neural network model to obtain the first thermal radiation data.
[0025] In some embodiments, the training process of the neural network model includes:
[0026] Acquire second thermal radiation data of the remote sensing image, wherein the resolution of the second thermal radiation data is lower than that of the first thermal radiation data;
[0027] The first thermal inversion index of the remote sensing image is resampled to obtain a second thermal inversion index, the resolution of the second thermal inversion index being the same as the resolution of the second thermal radiation data;
[0028] Based on the second thermal inversion index and the second thermal radiation data, the neural network model is trained, wherein the trained neural network model is used to characterize the mapping relationship between the thermal inversion index and the thermal radiation data at the same resolution.
[0029] In some embodiments, the random forest model includes multiple decision trees that run in parallel, and the running data of each decision tree is stored in the CPU cache and / or the storage unit of the GPU.
[0030] The operational data includes at least one of the following:
[0031] The band information of the remote sensing image;
[0032] The parameters of each decision tree in the multiple decision trees;
[0033] The importance scores of the various water body indices;
[0034] The initial feature data; and
[0035] The target feature data.
[0036] According to a second aspect of the present disclosure, a water extraction apparatus is provided, comprising:
[0037] The acquisition module is used to acquire remote sensing images;
[0038] A segmentation module is used to segment the remote sensing image to obtain a target sub-image, wherein the target sub-image contains at least a portion of the water body area in the remote sensing image;
[0039] The first calculation module is used to calculate various water body indices of the target sub-image to obtain initial feature data;
[0040] The training module is used to train a random forest model based on the initial feature data and the ground feature sample data of the target sub-image; wherein, the ground feature sample data is used to show the ground feature type of each grid in the target sub-image, the ground feature type includes water body and non-water body, and the random forest model is used to characterize the relationship between the various water body indices and the ground feature type;
[0041] A determination module is used to determine at least one target index from the multiple water body indices based on their importance scores in the random forest model.
[0042] The second calculation module is used to calculate at least one target index of the remote sensing image to obtain target feature data;
[0043] The extraction module is used to input the target feature data into the trained random forest model to obtain water body extraction results, which are used to show the water body regions in the remote sensing image.
[0044] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0045] Processor; and
[0046] Memory for storing the executable instructions of the processor;
[0047] The processor is configured to execute the method described in the first aspect by executing the executable instructions.
[0048] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0049] This disclosure allows for the acquisition and segmentation of remote sensing images to obtain target sub-images, where each target sub-image contains at least a portion of the water body region within the remote sensing image. Multiple water body indices are calculated for each target sub-image to obtain initial feature data. A random forest model is trained based on the initial feature data and ground feature sample data from the target sub-image. At least one target index is determined from among the multiple water body indices according to their importance scores in the random forest model. Target feature data is obtained by calculating at least one target index for each remote sensing image. The target feature data is then input into the trained random forest model to obtain the water extraction result. Therefore, the solution provided by this disclosure improves the efficiency of water extraction and automatically completes the water extraction task for remote sensing images without requiring manual intervention. Attached Figure Description
[0050] Figure 1 A schematic flowchart of a water extraction method according to an embodiment of this disclosure is shown.
[0051] Figure 2 This diagram illustrates ground feature sample data for a target sub-region according to an embodiment of the present disclosure.
[0052] Figure 3This diagram illustrates the water extraction results of a target sub-region in an embodiment of the present disclosure.
[0053] Figure 4 This diagram illustrates a comparison of the operating efficiency of the embodiments of this disclosure when using CPU and GPU acceleration versus when not accelerating.
[0054] Figure 5 A schematic diagram of a water extraction device according to an embodiment of the present disclosure is shown.
[0055] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0057] First, this disclosure provides a water extraction method that can be performed by any electronic device.
[0058] Figure 1 This diagram illustrates a flow chart of a water extraction method according to an embodiment of the present disclosure, as shown below. Figure 1 As shown, the water extraction method provided in this embodiment includes the following steps S101 to S107.
[0059] S101, acquire remote sensing images.
[0060] It should be noted that remote sensing images can be acquired using satellites. For example, the Gaofen-1 (GF-1) satellite, the ZY-3 (ZY-3) satellite, and the Sentinel-2 (Sentinel-2) satellite.
[0061] For example, a remote sensing image can be a remote sensing image stitched together from multi-source remote sensing data, that is, it can include spectral information in different bands collected by multiple satellites.
[0062] S102, segment the remote sensing image to obtain the target sub-image.
[0063] It should be noted that the target sub-image is a partial sub-image segmented from the complete remote sensing image, and the size of the target sub-image can be much smaller than the size of the remote sensing image. For example, if the size of the complete remote sensing image is 300km × 300km, the size of the target sub-image can be 2km × 2km.
[0064] For example, embodiments of this disclosure can utilize target sub-images to train a random forest model. Since the target sub-images are taken from remote sensing images, the trained random forest model can extract water bodies from the areas shown in the remote sensing images with relatively high accuracy.
[0065] For example, in order for a random forest model to learn the water features of a region shown in a remotely sensed image, a target sub-image may include at least a portion of the water region in the remotely sensed image.
[0066] S103, calculate various water indices for the target sub-image to obtain initial feature data.
[0067] It should be noted that the index in remote sensing images is a type of value calculated from the spectral information of different bands in remote sensing data, and can be used to distinguish different types of land cover.
[0068] In some embodiments, this disclosure pre-maintains a River-based Multiscale Singularity Index (RMSI) database. The RMSI includes various indices related to water body extraction, such as the Normalized Difference Vegetation Index (NDVI) and the Enhanced Vegetation Index (EVI). The various water body indices in this disclosure are the various water body extraction-related indices included in the RMSI.
[0069] For example, the normalized difference vegetation index Here, NIR represents the spectral information in the near-infrared band, and Red represents the spectral information in the red band. This spectral information can be obtained from remote sensing images. By calculating the NDVI index of each grid in the remote sensing image, the type of land cover corresponding to the grid can be determined by setting a threshold.
[0070] Furthermore, it is worth noting that the various water body indices in this disclosure include remote sensing indices for various types (e.g., vegetation, buildings, bare soil, etc.), and are not merely remote sensing indices used to refer to water body types. In other words, the RMSI maintains remote sensing indices for various types related to water body extraction.
[0071] For example, the initial feature data can be a set of various water body indices of the target sub-image, where each water body index in the set has the same resolution. The resolution of the index can be understood as the precision of the index, or the precision of the corresponding remote sensing image; for example, the resolution of the index could be 2 meters.
[0072] S104: Train a random forest model based on initial feature data and ground feature sample data of target sub-images.
[0073] In some embodiments, land cover sample data is used to indicate the land cover type of each raster in the target sub-image. During the training of the random forest model, the land cover sample data can be recorded in a table in xls format, that is, the correspondence between each raster number (or coordinates) and the land cover type number is recorded separately. Land cover types include water bodies and non-water bodies; non-water bodies can be types such as farmland, buildings, mountains, and bare land.
[0074] For example, Figure 2 This diagram illustrates ground feature sample data for a target sub-region according to an embodiment of the present disclosure. Figure 2 In the target sub-region, different types of land features are shown in different colors. Specifically, pink is used to show land feature samples of bare land type, purple is used to show land feature samples of building type, yellow is used to show land feature samples of farmland type, green is used to show land feature samples of mountain type, and blue is used to show land feature samples of river (water body) type.
[0075] The ground feature sample data can be manually labeled or identified using ground feature recognition algorithms in related technologies. Understandably, because the target sub-image is relatively small, even if a ground feature recognition algorithm is used to completely identify all the ground features involved in the target sub-image, this can be completed quickly with minimal computational resources.
[0076] It should be noted that the random forest model is a bootstrap aggregating algorithm model composed of multiple decision trees. The random forest model can effectively handle problems with a large number of features (i.e., the various water body indices in this disclosure) and data, and does not require feature selection.
[0077] In this embodiment of the disclosure, by inputting initial feature data and land cover sample data into the random forest model, the random forest model can learn the relationship between various water body indices and land cover types. In other words, the trained random forest model can be used to characterize the relationship between various water body indices and land cover types.
[0078] For example, when segmenting the remote sensing image in S102, the land cover types contained in the segmented target sub-image can be the same as those contained in the remote sensing image. Land cover types include water bodies and non-water bodies; non-water bodies can be types such as farmland, buildings, mountains, and bare land.
[0079] Therefore, the random forest model can not only learn the relationship between various water body indices and water bodies, but also the relationship between various water body indices and various non-water body land features in remote sensing images.
[0080] In other words, when the trained random forest model is used to identify water bodies in complete remote sensing images, it can also identify various non-water features, avoiding the random forest model from confusing non-water features with water bodies. This can improve the accuracy of water body identification to a certain extent and reduce noise in the water body identification results.
[0081] S105, Based on the importance scores of multiple water body indices in the random forest model, determine at least one target index among multiple water body indices.
[0082] In some embodiments, the Gini index of the feature (water index) can be used as the importance score of the feature in the random forest model. The higher the Gini index value, the stronger the importance of the feature.
[0083] For example, the Gini index can be obtained during the training of a random forest. During the training of a random forest model, a subset of features is randomly considered each time a node splits. For each feature in this subset, the random forest model can obtain the Gini index of that feature by measuring its contribution to the node split.
[0084] For example, the average reduction in impurity and the reduction in out-of-bag error for each feature (water index) in the random forest model can also be used as the importance score for that feature. Since the method of scoring feature importance in the random forest model is common knowledge to those skilled in the art, it will not be elaborated upon in this disclosure for the sake of brevity.
[0085] In some embodiments, water body indices with higher importance scores can be selected from a variety of water body indices based on the importance score of each water body index, and these indices can be identified as target indices.
[0086] For example, importance scores for multiple water body indices can be obtained, and the top N water body indices with the highest importance scores among these indices can be identified as target indices, where N is a positive integer. The importance scores are generated during the training of the random forest model.
[0087] For example, the number of target indices (i.e., N) can be preset based on experience, or the importance scores of multiple water body indices can be ranked, and the number of water body indices before a sudden change in importance score in the sequence can be used as the number of target indices. For instance, assuming there are 50 water body indices, and these 50 indices are ranked from highest to lowest importance score, if a sudden change in the importance score of a water body index occurs between the 10th and 11th water body indices, then the number of target indices is 10.
[0088] This embodiment of the disclosure can quickly train a random forest model and determine the target index using a small-sized target sub-image. By applying the trained random forest model to a complete remote sensing image and using the target index of the remote sensing image as input to the random forest model, the efficiency of water body identification can be improved while ensuring the accuracy of water body identification.
[0089] S106, calculate at least one target index of the remote sensing image to obtain target feature data.
[0090] It should be noted that at least one target index of the remote sensing image is the target index determined in S105. For example, if the top 10 water body indices with the highest importance are determined as target indices in S105, then these 10 water body indices of the remote sensing image can be calculated separately to obtain target feature data.
[0091] S107. Input the target feature data into the trained random forest model to obtain the water body extraction results.
[0092] It should be noted that the water extraction results can be used to show water areas in remote sensing images.
[0093] For example, a random forest model can output the land cover type of each raster in a remote sensing image. By mapping the land cover type of each raster to the corresponding raster in the remote sensing image, the water body extraction result can be obtained.
[0094] For example, different land cover types can be distinguished by different colors. By filling each raster in the remote sensing image with the color of the corresponding land cover type (e.g., filling the raster identified as a water body with blue), a visualized water body extraction result can be obtained.
[0095] Therefore, the water extraction method provided in this disclosure improves the efficiency of water extraction by pre-training a random forest model using small-sized target sub-images and determining the target index, and then generalizing the trained random forest model and the determined target index to the complete remote sensing image for water extraction. Furthermore, the water extraction process requires no manual intervention and can automatically complete the water extraction task for the remote sensing image.
[0096] In some embodiments, post-processing can be performed on the visualized water extraction results to improve the quality of the water extraction results.
[0097] For example, the post-processing process may include two parts: noise reduction and shape correction.
[0098] Specifically, for denoising, river boundaries can be marked in the water body extraction results using river network buffer data of the region shown in the remote sensing image, and rasters outside the river boundaries that are identified as water bodies can be corrected to non-water bodies. Subsequently, denoising algorithms from related technologies can be used to remove random noise from the water body extraction results within the river boundaries.
[0099] For morphological correction, edge detection algorithms such as Canny can be used to accurately locate river boundaries, and based on the morphological features of the river, the truncated areas in the extraction results can be corrected (for example, the river shown in the remote sensing image may be truncated due to bridge / road obstruction), thereby further improving the accuracy of the extraction results.
[0100] The above describes the specific implementation process of the water body extraction method provided in this disclosure. In some embodiments, in the process of determining the target index, in addition to considering the importance score of the water body index, the correlation between the water body indices can also be combined to ensure that there is no correlation between any two determined target indices. This can reduce the risk of overfitting in the random forest model to a certain extent and improve the accuracy of the water body extraction results of the random forest model for remote sensing images.
[0101] For example, at least one target index can be screened based on the correlation coefficient between at least one target index determined in S105, so that no two screened target indices are correlated. The correlation coefficient between any two target indices can be obtained by calculating the R-squared value between the two target indices, or by calculating the Pearson correlation coefficient or Spearman correlation coefficient between the two target indices; this embodiment of the present disclosure does not limit this method.
[0102] For example, target indices whose correlation coefficients meet preset conditions are considered correlated. Taking R-squared as an example, a correlation threshold can be set; when the R-squared between two target indices is greater than the correlation threshold, it is determined that the two target indices are correlated.
[0103] For example, if the correlation coefficient between the first target index and the second target index of the target sub-image is greater than the preset correlation threshold, the first target index or the second target index can be redefined as a non-target index to ensure that there is no correlation between the various water body indices that are determined as target indices.
[0104] Based on this, at least one target index determined in S105 can be screened. If the number of target indices after screening is less than N, new target indices can be determined from multiple water body indices to ensure that the total number of target indices remains N, and that there is no correlation between any two target indices.
[0105] Where N represents the number of target indices initially determined in S105. In other words, if some target indices are reclassified as non-target indices during the screening process using correlation, new target indices can be determined from among various water body indices to keep the total number of target indices constant. When determining new target indices, in addition to considering the importance of the water body indices, the correlation between them also needs to be considered.
[0106] For example, when redetermining the target index, the water body indexes with higher importance scores (e.g., importance scores greater than a threshold / importance scores ranked within a specified range) and which are not correlated with any target index can still be prioritized as the target index, based on the importance of the water body index. Alternatively, the top K water body indices with the highest importance among those that are not correlated with any target index can be directly determined as the target index.
[0107] In some embodiments, in addition to the importance score of the index and the correlation between the indices, the type of the index (e.g., vegetation, buildings, bare soil, water bodies, etc.) can also be considered when determining the target index to avoid too many indices of the same type in the target index. For example, the proportion of each type of index in the target index can be pre-configured to ensure that the target index contains multiple types of indices.
[0108] By incorporating considerations of the relevance and type of the target index during the determination process, the final target index can reflect the characteristics of the water body from different perspectives, thereby improving the accuracy of water body extraction results.
[0109] In some embodiments, after determining the target index, the target index of the target sub-image can be input into the trained random forest model to pre-validate the accuracy of water extraction based on the target index within a small area shown in the target sub-image. If the accuracy is greater than a preset accuracy threshold, the target index of the remote sensing image is then input into the random forest model to obtain the water extraction result of the complete remote sensing image.
[0110] For example, Figure 3 A schematic diagram illustrating the water extraction results of a target sub-region in an embodiment of this disclosure is shown. Figure 3 In the image, the blue area represents the water extraction result obtained after inputting the target index of the target sub-image into the random forest model. This is compared with... Figure 3 The water extraction results shown are consistent with Figure 2 The consistency of the water body areas marked in the code can verify the accuracy of the identification results.
[0111] In some applications, remote sensing images may suffer from low resolution. For example, during the summer rainy season or dry season, due to the influence of cloudy weather or climate, remote sensing images may not accurately reflect the characteristics of water bodies, resulting in lower accuracy of water body extraction results.
[0112] Since the temperature of water bodies typically differs significantly from that of surrounding areas, remote sensing images can be used to display the region's thermal radiation data during water body identification. This addresses the issue of low identification accuracy at specific times. In other words, when it is visually impossible to clearly distinguish between water and non-water areas, thermal radiation data can be introduced to assist in water body identification by utilizing the temperature difference between the two regions.
[0113] For example, when the remote sensing image is a remote sensing image acquired during a target time period, first thermal radiation data of the remote sensing image (shown area) can be obtained. The resolution of the first thermal radiation data is the same as the resolution of the target index of the remote sensing image. In this case, the target feature data includes at least one target index of the remote sensing image and the first thermal radiation data.
[0114] In other words, the first thermal radiation data of the remote sensing image, combined with the target index of the remote sensing image, can be input into a pre-trained random forest model to obtain the water body extraction result.
[0115] Since the resolution of thermal radiation data directly acquired by satellite is usually lower than that of remote sensing images, it is necessary to downscale and invert the satellite-acquired thermal radiation data to make it have the same resolution as the target index of the remote sensing image, so that it can be combined with the target index of the remote sensing image and input into the random forest model.
[0116] For example, the first thermal radiation data of a remotely sensed image can be obtained by the following method:
[0117] Among various water body indices, the top M water body indices with the highest importance scores (excluding the target index) are determined as the first thermal inversion index. Here, M is a positive integer, and its value can be set empirically.
[0118] The first thermal inversion index of the remote sensing image is input into a pre-trained neural network model to obtain the first thermal radiation data.
[0119] For example, the neural network model can be an artificial neural network (ANN) model. For instance, the back propagation artificial neural network (BP-ANN) model.
[0120] In some embodiments, the training process of the neural network model may include:
[0121] Acquire second thermal radiation data from the remote sensing image. This second thermal radiation data is obtained directly from satellite-acquired thermal radiation data (e.g., TIRS band data from the Landsat 8 satellite), and its resolution is lower than that of the first thermal radiation data.
[0122] The first thermal inversion index of the remote sensing image is resampled to obtain the second thermal inversion index. The resampling method can be implemented using data processing software such as ArcGIS or ENVI, which will not be elaborated upon in this embodiment. The resolution of the resampled second thermal inversion index is the same as the resolution of the second thermal radiation data.
[0123] A neural network model can be trained based on the second thermal inversion index and the second thermal radiation data. The trained neural network model is used to represent the mapping relationship between the thermal inversion index and thermal radiation data at the same resolution. In other words, the neural network model in this embodiment can map the first thermal inversion index to the first thermal radiation data by learning the mapping relationship between the second thermal inversion index and the second thermal radiation data.
[0124] For example, during the training of a neural network model, a second thermal inversion index can be input into the neural network model to be trained to obtain predicted thermal radiation data. By calculating the loss between the predicted thermal radiation data and the second thermal radiation data, and updating the parameters of the neurons through the backpropagation algorithm, the training of the neural network model can be completed.
[0125] For example, the neural network model in this embodiment is a single-layer neural network model. Therefore, after determining the first thermal inversion index among multiple water body indices, the training process of the neural network model can be completed quickly so as to obtain the first thermal radiation data of the remote sensing image based on the neural network model.
[0126] This embodiment of the invention combines thermal radiation data with target indices for water body extraction, which can improve the accuracy of water body extraction during special periods (summer flood season, dry season).
[0127] In some embodiments, the random forest model includes multiple decision trees. In order to improve the training speed and computational efficiency of the random forest model in this disclosure, the multiple decision trees in the random forest model can be run in parallel.
[0128] Furthermore, in multiple decision trees running in parallel, the execution data of each decision tree can be stored in the Central Processing Unit (CPU) cache or in the Graphics Processing Unit (GPU) storage. Of course, depending on the specific needs, it can also be partially stored in the CPU cache and partially in the GPU storage.
[0129] For example, the running data may include at least one of the following: band information of remote sensing images, parameters of each decision tree in multiple decision trees, importance scores of multiple water body indices, initial feature data, and target feature data.
[0130] Therefore, the parallel computing capabilities of CPU and GPU can be fully utilized during the operation of the random forest model, thereby improving the computational efficiency of the random forest model.
[0131] For example, when using CPU to accelerate the computational efficiency of a random forest model, the running data can be stored in batches in a multi-core CPU cache, and the computational efficiency of the random forest model can be improved by multi-threaded parallel processing of the CPU.
[0132] For example, when using CPU to accelerate the computational efficiency of a random forest model, the running data can be stored in batches in a multi-core CPU cache, and the computational efficiency of the random forest model can be improved by multi-threaded parallel processing of the CPU.
[0133] For example, the advantages of both CPU and GPU can be combined to select the optimal parallel processing method at different computation stages. For instance, CPU cache has a small capacity but extremely fast read and write speeds, while GPU storage units have a large capacity but slower read and write speeds than CPU cache. Therefore, CPU cache can be used first when the amount of data is small (e.g., for computation of initial feature data), while GPU storage units can be used when the amount of data is large (e.g., for training random forest models).
[0134] Furthermore, based on leveraging CPU and GPU to accelerate random forest model computation, pre-experiments can be conducted to adjust the random forest model's parameters to further improve its operational efficiency. Examples include the number of decision trees, the depth of the decision trees, and the minimum number of split samples required for each node in the decision tree.
[0135] For example, a series of controlled experiments can be designed to evaluate the impact of different parameter combinations on water extraction performance, thereby determining the optimal parameter settings. During parameter adjustment, it is necessary to pay attention to the balance between the accuracy and execution efficiency of the random forest model. By reasonably adjusting the parameters, the random forest model can simultaneously achieve both accuracy and efficiency in water extraction.
[0136] For example, Figure 4 A comparison chart showing the running efficiency of embodiments of this disclosure with and without CPU and GPU acceleration is provided. Figure 4 As shown, the more decision trees in a random forest model, the more significant the acceleration effect when CPU cache and GPU storage units participate in computation.
[0137] Therefore, by storing the runtime data of the random forest model in the CPU cache and / or the storage unit of the GPU, the running efficiency of the random forest model can be effectively improved.
[0138] Based on the same inventive concept, this disclosure also provides a water extraction device, as shown in the following embodiment. Since the principle of this water extraction device embodiment in solving the problem is the same as that described above... Figure 1 The method embodiments shown are similar, therefore the implementation of this water extraction device embodiment can refer to the above. Figure 1 The implementation of the method embodiments shown will not be repeated here.
[0139] Figure 5 A schematic diagram of a water extraction device according to an embodiment of this disclosure is shown. This water extraction device can be applied to an electronic device, which includes multiple computing units.
[0140] Specifically, such as Figure 5 As shown, the water extraction device 500 includes: an acquisition module 501, a segmentation module 502, a first calculation module 503, a training module 504, a determination module 505, a second calculation module 506, and an extraction module 507.
[0141] The acquisition module 501 is used to acquire remote sensing images.
[0142] The segmentation module 502 is used to segment the remote sensing image to obtain a target sub-image, which contains at least a portion of the water body area in the remote sensing image.
[0143] The first calculation module 503 is used to calculate various water indices of the target sub-image to obtain initial feature data.
[0144] Training module 504 is used to train a random forest model based on initial feature data and ground feature sample data of the target sub-image. The ground feature sample data is used to indicate the ground feature type of each raster in the target sub-image, including water bodies and non-water bodies. The random forest model is used to characterize the relationship between various water body indices and ground feature types.
[0145] The determination module 505 is used to determine at least one target index among multiple water body indices based on the importance scores of multiple water body indices in the random forest model.
[0146] The second calculation module 506 is used to calculate at least one target index of the remote sensing image to obtain target feature data.
[0147] The extraction module 507 is used to input the target feature data into the trained random forest model to obtain the water body extraction result, which is used to show the water body area in the remote sensing image.
[0148] In some embodiments, the determining module 505 is specifically used to obtain importance scores for multiple water body indices, which are generated during the training of the random forest model. The top N water body indices with the highest importance scores among the multiple water body indices are determined as target indices, where N is a positive integer.
[0149] In some embodiments, the determining module 505 is further configured to screen at least one target index based on the correlation coefficient between at least one target index, so that no two screened target indices are correlated; wherein target indices whose correlation coefficients satisfy a preset condition are correlated. If the number of screened target indices is less than N, new target indices are determined from among the various water body indices, so that the total number of target indices is N, and no two target indices are correlated.
[0150] In some embodiments, the water extraction device 500 further includes a processing module (not shown) for acquiring first thermal radiation data of the remote sensing image when the remote sensing image is a remote sensing image acquired during a target time period. The resolution of the first thermal radiation data is the same as the resolution of the target index of the remote sensing image. In this case, the target feature data includes at least one target index of the remote sensing image and the first thermal radiation data.
[0151] In some embodiments, the processing module is further configured to: determine the top M water body indices with the highest importance scores (excluding the target index) among a variety of water body indices as the first thermal inversion index, where M is a positive integer; input the first thermal inversion index of the remote sensing image into a pre-trained neural network model to obtain the first thermal radiation data.
[0152] In some embodiments, the water extraction device 500 further includes: a neural network module (not shown) for acquiring second thermal radiation data from a remote sensing image, the resolution of which is lower than that of the first thermal radiation data. A first thermal inversion index of the remote sensing image is resampled to obtain a second thermal inversion index, the resolution of which is the same as that of the second thermal radiation data. Based on the second thermal inversion index and the second thermal radiation data, a neural network model is trained, wherein the trained neural network model is used to characterize the mapping relationship between the thermal inversion index and the thermal radiation data at the same resolution.
[0153] In some embodiments, the random forest model includes multiple decision trees that run in parallel, and the running data of each decision tree is stored in the CPU cache and / or the storage unit of the GPU.
[0154] The runtime data includes at least one of the following:
[0155] Band information of remote sensing images;
[0156] The parameters of each decision tree in a multi-decision-tree system;
[0157] Importance rating of various water body indices;
[0158] Initial feature data; and
[0159] Target feature data.
[0160] The following reference Figure 6 To describe an electronic device 600 capable of implementing embodiments of the present disclosure. Figure 6 The electronic device 600 shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0161] like Figure 6 As shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processor 610, at least one memory 620, and a bus 630 connecting different system components (including memory 620 and processor 610).
[0162] The memory stores program code that can be executed by the processor 610, causing the processor 610 to perform the steps described in the "Exemplary Methods" section of this disclosure according to various exemplary embodiments of this disclosure.
[0163] In some embodiments, the processor 610 may also perform the following steps of the above method embodiments:
[0164] Acquire remote sensing images;
[0165] The remote sensing image is segmented to obtain a target sub-image, which contains at least a portion of the water body area in the remote sensing image.
[0166] Calculate various water indices for the target sub-images to obtain initial feature data;
[0167] A random forest model is trained based on initial feature data and ground feature sample data of the target sub-image. The ground feature sample data is used to show the ground feature type of each grid in the target sub-image. The ground feature types include water bodies and non-water bodies. The random forest model is used to characterize the relationship between various water body indices and ground feature types.
[0168] Based on the importance scores of various water body indices in the random forest model, at least one target index is determined among the various water body indices;
[0169] Calculate at least one target index in the remote sensing image to obtain target feature data;
[0170] The target feature data is input into the trained random forest model to obtain water body extraction results, which are used to show the water body regions in the remote sensing image.
[0171] The memory 620 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include read-only memory (ROM) 6203.
[0172] The memory 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0173] Bus 630 can represent one or more of several types of bus structures, including a memory bus or memory controller, peripheral bus, graphics acceleration port, processor, or a local bus using any of the various bus structures.
[0174] Electronic device 600 can also communicate with one or more external devices 640 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Figure 6 As shown, network adapter 660 communicates with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0175] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0176] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this disclosure according to various exemplary embodiments of this disclosure.
[0177] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. A method of extracting a body of water, characterized in that, include: Acquire remote sensing images; The remote sensing image is segmented to obtain a target sub-image, the target sub-image containing at least a portion of the water body area in the remote sensing image; Calculate various water indices for the target sub-image to obtain initial feature data; Based on the initial feature data and the ground feature sample data of the target sub-image, a random forest model is trained; wherein, the ground feature sample data is used to show the ground feature type of each grid in the target sub-image, the ground feature type includes water bodies and non-water bodies, and the random forest model is used to characterize the relationship between the various water body indices and the ground feature type; Based on the importance scores of the various water body indices in the random forest model, at least one target index is determined from the various water body indices; Calculate at least one target index in the remote sensing image to obtain target feature data; The target feature data is input into the trained random forest model to obtain water body extraction results, which are used to show the water body regions in the remote sensing image. The step of determining at least one target index from among the multiple water body indices based on their importance scores in the random forest model includes: Obtain the importance scores of the various water body indices, which are generated during the training of the random forest model; determine the top N water body indices with the highest importance scores among the various water body indices as target indices, where N is a positive integer; The at least one target index is screened based on the correlation coefficient between the at least one target index, so that no two screened target indices are correlated; wherein, the target indices whose correlation coefficients satisfy a preset condition are correlated. If the number of target indices after screening is less than N, new target indices are determined from the various water body indices to ensure that there are N types of target indices and that no two target indices are correlated.
2. The method according to claim 1, characterized in that, The method further includes: In the case where the remote sensing image is a remote sensing image acquired during the target time period, the first thermal radiation data of the remote sensing image is obtained, and the resolution of the first thermal radiation data is the same as the resolution of the target index of the remote sensing image. The target feature data includes: at least one target index of the remote sensing image and the first thermal radiation data.
3. The method according to claim 2, characterized in that, The acquisition of the first thermal radiation data of the remote sensing image includes: Among the various water body indices, the top M water body indices with the highest importance scores (excluding the target index) are determined as the first thermal inversion index, where M is a positive integer. The first thermal inversion index of the remote sensing image is input into a pre-trained neural network model to obtain the first thermal radiation data.
4. The method according to claim 3, characterized in that, The training process of the neural network model includes: Acquire second thermal radiation data of the remote sensing image, wherein the resolution of the second thermal radiation data is lower than that of the first thermal radiation data; The first thermal inversion index of the remote sensing image is resampled to obtain a second thermal inversion index, the resolution of the second thermal inversion index being the same as the resolution of the second thermal radiation data; Based on the second thermal inversion index and the second thermal radiation data, the neural network model is trained, wherein the trained neural network model is used to characterize the mapping relationship between the thermal inversion index and the thermal radiation data at the same resolution.
5. The method according to claim 1, characterized in that, The random forest model includes multiple decision trees that run in parallel, and the running data of each decision tree is stored in the CPU cache and / or the storage unit of the GPU. The operational data includes at least one of the following: The band information of the remote sensing image; The parameters of each decision tree in the multiple decision trees; The importance scores of the various water body indices; The initial feature data; and The target feature data.
6. A water extraction device, characterized in that, include: The acquisition module is used to acquire remote sensing images; A segmentation module is used to segment the remote sensing image to obtain a target sub-image, wherein the target sub-image contains at least a portion of the water body area in the remote sensing image; The first calculation module is used to calculate various water body indices of the target sub-image to obtain initial feature data; The training module is used to train a random forest model based on the initial feature data and the ground feature sample data of the target sub-image; wherein, the ground feature sample data is used to show the ground feature type of each grid in the target sub-image, the ground feature type includes water body and non-water body, and the random forest model is used to characterize the relationship between the various water body indices and the ground feature type; A determination module is used to determine at least one target index from the multiple water body indices based on their importance scores in the random forest model. The second calculation module is used to calculate at least one target index of the remote sensing image to obtain target feature data; The extraction module is used to input the target feature data into the trained random forest model to obtain water body extraction results, which are used to show the water body regions in the remote sensing image. The determining module is used to obtain the importance scores of the various water body indices, which are generated during the training of the random forest model; to determine the top N water body indices with the highest importance scores as target indices, where N is a positive integer; to filter the at least one target index according to the correlation coefficient between them, so that no two target indices are correlated after filtering; wherein target indices whose correlation coefficients meet preset conditions are correlated; if the number of target indices after filtering is less than N, to determine new target indices from the various water body indices, so that there are N types of target indices and no two target indices are correlated.
7. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 5 by executing the executable instructions.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 5.