Image surface water range automatic delineation method supported by k-means clustering
Through k-means clustering and deep learning technology, combined with SLIC segmentation and ViT network, the problem of insufficient threshold setting subjectivity and generalization ability in image surface water extraction is solved, and efficient and accurate automatic circuiting of image surface water is achieved.
Patent Information
- Application Number
- CN202411570940.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-01-03
AI Technical Summary
In the extraction of surface water of image in the state of art, there is strong subjectivity of threshold setting, low accuracy, and difficulty in extracting small water bodies and large-scale water bodies. In addition, deep learning methods rely on a large number of manual annotations and pseudo-label quality to be easily affected, resulting in generalization ability. insufficient.
Using the method supported by k-means clustering, deep features are extracted through SLIC superpixel segmentation and ViT network, and clustered using the k-means algorithm guided by the C-H criterion, combined with the CNN network for prediction, automatically enclosing the surface water range, reducing artificial Intervention.
Unsupervised sample clustering is realized, the sample generation efficiency and accuracy are improved, the automatic lamination accuracy and reliability of the image surface water range is enhanced, and labor costs are reduced.
Smart Images

Figure CN119251534A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of surface water delineation, and in particular relates to an image surface water range automatic delineation method supported by k-means clustering. Background Art
[0002] Surface water extraction is a key task in remote sensing environmental monitoring interpretation, which involves identifying and classifying water bodies in remote sensing images, such as rivers, lakes, canals, and ponds. Since the reflectivity of surface water bodies in the visible to near-infrared bands is much lower than that of other remote sensing environmental monitoring elements, this has become the main mechanism for extracting water bodies from optical remote sensing images. With the development of machine learning and deep learning, the accuracy and efficiency of image surface water extraction have been significantly improved, but the problem is that high-quality training samples are required. This shortcoming limits the algorithm and makes it more difficult to extract large-scale water bodies. In addition, in terms of data, existing data are mainly concentrated in specific areas and cannot cover the characteristics of large-scale water bodies.
[0003] At present, the importance of long-term monitoring of water changes in water resource management and flood monitoring is increasing, and the water resource survey tasks promoted at the national level urgently need to develop more efficient and practical image surface water extraction methods. Therefore, building a sample automatic generation technology system, conducting research on surface water rapid delineation methods, and improving the interpretation and generalization of perception capabilities in large areas and long-term will be the focus of future image surface water research.
[0004] In the prior art, the following problems still exist: First, the traditional water index method of extracting water bodies is to enhance the grayscale difference between water bodies and non-water bodies through algebraic operations between bands. In this process, the geometric shape of the ground objects, the correlation of adjacent pixels and other image information are not involved. At the same time, the setting of the threshold in the extraction method greatly affects the final separation result. If the threshold is too high, it will cause omissions, especially the omission of small water bodies. If it is too low, it will introduce a lot of noise. The artificial setting of the threshold is highly subjective. The OTSU algorithm and the histogram bimodal method are commonly used threshold segmentation algorithms, but they are not suitable for complex environments and still have certain limitations. In special scenes, especially the extraction of small water bodies, it is still difficult. Small water areas are often accompanied by a large number of mixed pixels. The deep characteristic information of tiny water bodies cannot be fully mined. The accuracy of the results of extracting water body spectral features alone is not satisfactory. The traditional water index method of extracting water bodies requires a lot of manpower, is time-consuming and labor-intensive, and the extraction results will have salt and pepper noise, omissions, etc., and the accuracy is not high. Therefore, in the automatic generation of water samples, the traditional sample extraction effect based on the water index still needs to be improved; Second, traditional machine learning methods are inherently subjective and uncertain because they require manual selection and design of features, and can often only extract surface feature information. Deep learning requires the model to be trained on a large number of manually annotated sample sets, which consumes a lot of manpower costs. Although semi-supervised learning can reduce the time and cost of manual labeling, the model accuracy is easily affected by the quality of pseudo-labels. In addition, most of the existing deep learning water body extraction methods are suitable for their respective research areas. Based on complex neural network models with fixed structures and empirical parameter settings, the extraction results are often easily affected by the sample distribution, resulting in overfitting of water body segmentation accuracy in a small range, and it is difficult to generalize it to a larger range of water body extraction applications such as various lakes and rivers, and the generalization ability is obviously insufficient. Summary of the invention
[0005] The purpose of the present invention is to provide a method for automatically defining the range of surface water in images supported by k-means clustering, which can...
[0006] The technical solution adopted by the present invention is as follows: A method for automatically defining the range of surface water in images based on k-means clustering, comprising: Collect remote sensing images of surface water and use the SLIC superpixel segmentation algorithm to perform multi-scale segmentation on high-resolution remote sensing images; The patch unit center point after multi-scale segmentation of the remote sensing image is used as a cropping seed point, and a scene sample is obtained by sample cropping; All scene samples obtained by sample cropping are input into the ViT network to extract deep features; The k-means algorithm guided by CH criterion is used to cluster the scene samples to obtain a scene sample set with category attributes; The scene sample set is input into the CNN network for training prediction, and the predicted water body sample points are obtained; The water body sample points are automatically delineated through coordinate transformation and sample size prior knowledge to obtain the surface water range.
[0007] In a preferred embodiment, the step of performing multi-scale segmentation of the high-resolution remote sensing image using the SLIC superpixel segmentation algorithm comprises: Acquiring multi-scale segmentation parameters of the remote sensing image, wherein the multi-scale segmentation parameters include segmentation scale, shape compactness and smoothness; Performing preliminary SLIC superpixel segmentation on the remote sensing image to generate an initial segmentation result; According to the initial segmentation result, each superpixel is evaluated to determine whether it meets the scale requirement of segmentation; If satisfied, the superpixel is retained; If it does not meet the scale requirement, it will be merged with the adjacent superpixels to form a new segmentation result until all superpixels meet the scale requirement.
[0008] In a preferred embodiment, the step of using the patch unit center point after multi-scale segmentation of the remote sensing image as a cropping seed point and obtaining a scene sample by sample cropping includes: Obtaining geographic coordinate information of the remote sensing image and corresponding ground resolution parameters; Calculate the actual ground coverage of each patch unit according to the geographic coordinate information and the ground resolution parameter; Combine the center point coordinates of each patch unit with the actual ground coverage to generate the corresponding cropping area; Image cropping is performed on each of the cropped areas to obtain scene samples containing surface water features, wherein the scene samples are normalized after being generated.
[0009] In a preferred solution, the step of inputting all scene samples obtained by sample cropping into the ViT network to extract deep features includes: Get the pre-trained ViT network model; Input the scene sample into the pre-trained ViT network model to extract the deep feature vector of each scene sample; The extracted depth feature vectors are analyzed to identify and distinguish different types of surface water characteristics.
[0010] In a preferred solution, the step of clustering scene samples using a k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes includes: Obtaining a deep feature vector of the scene sample, and performing k-means clustering to divide the scene sample into K clusters; Aggregating the scene samples into an initial sample set; Randomly select k points from the initial sample data set as the initial centroid ; Get sample points , and calculate the sample point to the initial centroid The distance between the sample points and the initial centroid From the nearest cluster, get the updated cluster; The distance metric function uses Euclidean distance: ; in, is the ith data point, is the jth centroid.
[0011] Calculate the new centroid of each update cluster as the average of all data points in the update cluster. For the jth update cluster , the new centroid The calculation formula is: ; In the formula, is the number of data points in the jth update cluster, Represents data points Belongs to the update cluster ; Repeat the calculation of new centroids and updated clusters until the centroid position no longer changes; The CH value is introduced to evaluate the quality of clustering results, and whether it is necessary to reselect the initial centroid or adjust the number of clusters K is determined according to the size of the CH value.
[0012] In a preferred embodiment, the K-means clustering is to minimize the sum of the square distances from all data points in the cluster to the centroid, and the objective function is: ; In the formula, is the objective function, is the number of clusters, is the jth cluster, is the centroid of the jth cluster. The value of the objective function is gradually reduced through continuous iteration of the algorithm, and finally converges to a local optimal solution.
[0013] In a preferred embodiment, the calculation formula of the CH value is as follows: ; In the formula, is the dispersion between clusters, that is, the sum of the variances between the cluster centers, is the dispersion within the cluster, which represents the sum of the variances between the data points in each cluster and the cluster center. k and n represent the number of clusters and the total number of data points, respectively. Among them, the larger the CH value, the better the clustering effect.
[0014] In a preferred embodiment, the step of automatically delineating the water body sample points through coordinate transformation and sample size prior knowledge to obtain the surface water range includes: Obtaining coordinate information of the surface water sample point; Determining the bounding box coordinates of each of the water body sample points based on prior knowledge of sample size; Convert the bounding box coordinates into the image coordinate system to obtain a preliminary range of surface water; Connected water areas within the preliminary extent of surface water are identified and output as the surface water extent.
[0015] The present invention also provides a system for automatically delineating the range of surface water in images supported by k-means clustering, using the above-mentioned method for automatically delineating the range of surface water in images supported by k-means clustering, comprising: An image segmentation module, wherein the image segmentation module is used to collect remote sensing images of surface water and perform multi-scale segmentation on high-resolution remote sensing images using a SLIC superpixel segmentation algorithm; A cropping module, wherein the cropping module is used to use the center point of the patch unit after multi-scale segmentation of the remote sensing image as a cropping seed point, and obtain a scene sample by sample cropping; A feature extraction module, wherein the feature extraction module is used to input all scene samples obtained by sample cropping into the ViT network to extract deep features; A clustering module, wherein the clustering module is used to cluster the scene samples using a k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes; A prediction module, wherein the prediction module is used to input the scene sample set into a CNN network for training prediction to obtain a water body sample point; The scope delineation module is used to automatically delineate the water body sample points to obtain the surface water range through coordinate conversion and sample size prior knowledge.
[0016] And, an electronic device, the electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for automatic delineation of surface water range in images supported by k-means clustering as described in any one of claims 1 to 8.
[0017] The technical effects achieved by the present invention are: The present invention uses a semi-supervised scene sample clustering method driven by deep learning (ViT) to realize unsupervised clustering of scene samples using deep learning, obtains water body and non-water body samples that can be used for training, introduces the CH criterion to automatically determine the optimal number of clusters, and finally automatically obtains water body samples without human intervention in the whole process, realizing the automatic delineation of surface water range. A scene sample automatic generation method based on the k-means clustering algorithm is proposed, which improves the efficiency and accuracy of sample generation. It combines deep learning feature extraction and cluster analysis to realize the automatic delineation of image surface water range, and optimizes the number of clusters through the CH index, thereby improving the reliability and accuracy of clustering results. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic flow chart of the method of the present invention; Figure 2 It is a schematic diagram of the system module of the present invention; Figure 3 It is a schematic diagram of the structure of an electronic device of the present invention. DETAILED DESCRIPTION
[0019] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0020] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0021] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure or characteristic that may be included in at least one implementation of the present invention. The phrase "in a preferred embodiment" that appears in different places in this specification does not refer to the same embodiment, nor is it a separate or selective embodiment that is mutually exclusive with other embodiments.
[0022] Secondly, the present invention is described in detail with reference to the schematic diagram. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0023] See also Figure 1 As shown, the present invention provides a method for automatically defining the range of surface water in images supported by k-means clustering, comprising: S1. Collect remote sensing images of surface water and use the SLIC superpixel segmentation algorithm to perform multi-scale segmentation on high-resolution remote sensing images; S2, taking the patch unit center point after multi-scale segmentation of the remote sensing image as the cropping seed point, and obtaining the scene sample through sample cropping; S3, input all scene samples obtained by sample cropping into the ViT network to extract deep features; S4, clustering the scene samples using the k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes; S5, inputting the scene sample set into the CNN network for training prediction, and obtaining the predicted water body sample point; S6. Automatically delineate the water body sample points through coordinate transformation and prior knowledge of sample size to obtain the surface water range.
[0024] As described in the above steps S1-S6, surface water monitoring is an important part of environmental monitoring and management. The importance of long-term monitoring of water changes in water resource management and flood monitoring is increasing. In this embodiment, it is first necessary to collect remote sensing image data of surface water. Remote sensing image data usually comes from satellite or aerial photography and can provide detailed information of surface water bodies. Then, these high-resolution remote sensing images are subjected to multi-scale segmentation processing using the SLIC superpixel segmentation algorithm. The SLIC algorithm can group the pixels in the image according to color and spatial information to form superpixels, thereby providing more refined units for subsequent processing. After the multi-scale segmentation is completed, the center point of each segmented patch unit is used as the cropping seed point, and a series of scene samples are cropped from the original image through the seed point. The scene sample contains rich information of the surface water body, which provides a basis for subsequent classification and recognition. Then, all the scene samples obtained by sample cropping are input into ViT (Vision Image Processing). In the Transformer network, the ViT network is a deep learning model based on the Transformer architecture, which can effectively extract deep features from scene samples. In order to further classify the scene samples, this embodiment adopts the k-means clustering algorithm. The k-means clustering algorithm is guided by the CH criterion (Calinski-Harabasz criterion) and can better identify scene sample sets with category attributes. The CH criterion is a clustering effectiveness indicator that can evaluate the quality of clustering results, thereby helping to determine the optimal number of clusters and category divisions. After obtaining the scene sample set with category attributes, the scene sample set is input into the CNN (Convolutional Neural Network) network for training and prediction. The CNN network predicts whether a new sample point belongs to a water body by learning the characteristics of the sample. Finally, the sample point predicted as a water body is automatically delineated through coordinate transformation and sample size prior knowledge, thereby obtaining the scope of surface water. The coordinate transformation is to transform the coordinates of the sample point from the image coordinate system to the actual geographic coordinate system, and the sample size prior knowledge is used to determine the actual area and boundary of the water body, so that the scope of surface water can be quickly and accurately delineated, providing important data support for water resources management and environmental protection.
[0025] In a preferred embodiment, the step of performing multi-scale segmentation of the high-resolution remote sensing image using the SLIC superpixel segmentation algorithm includes: S101, obtaining multi-scale segmentation parameters of the remote sensing image, wherein the multi-scale segmentation parameters include segmentation scale, shape compactness and smoothness; S102, performing preliminary SLIC superpixel segmentation on the remote sensing image to generate an initial segmentation result; S103, evaluating each superpixel according to the initial segmentation result to determine whether it meets the scale requirement of segmentation; If satisfied, the superpixel is retained; If it does not meet the scale requirement, it will be merged with the adjacent superpixels to form a new segmentation result until all superpixels meet the scale requirement.
[0026] As described in the above steps S101-S103, the present embodiment adopts the SLIC superpixel segmentation algorithm to implement multi-scale segmentation processing of high-resolution remote sensing images. First, it is necessary to obtain multi-scale segmentation parameters of the remote sensing image. The multi-scale segmentation parameters include the scale size, shape compactness and smoothness of the segmentation. The multi-scale segmentation parameters determine the fineness of the segmentation and the shape characteristics of the region. Then, the acquired remote sensing image is subjected to preliminary SLIC superpixel segmentation processing, and an initial segmentation result can be generated. After the initial segmentation result is generated, each superpixel needs to be evaluated accordingly. The purpose of the evaluation is to determine whether each superpixel meets the set segmentation scale requirement. If a superpixel meets the segmentation scale requirement, the superpixel will be retained. On the contrary, if a superpixel does not meet the scale requirement, it will be merged with the adjacent superpixel. Through this merging operation, a new segmentation result can be formed, thereby ensuring that all superpixels can meet the scale requirement until all superpixels meet the set scale requirement, so as to ensure that the final segmentation result not only meets the preset scale requirement, but also maintains the shape compactness and smoothness of the region, thereby achieving the best segmentation effect.
[0027] In a preferred embodiment, the step of using the patch unit center point after multi-scale segmentation of the remote sensing image as a cropping seed point and obtaining a scene sample by sample cropping includes: S201, obtaining geographic coordinate information of the remote sensing image and corresponding ground resolution parameters; S202, calculating the actual ground coverage of each patch unit according to the geographic coordinate information and the ground resolution parameter; S203, combining the center point coordinates of each patch unit with the actual ground coverage to generate a corresponding clipping area; S204: Perform image cropping on each of the cropping areas to obtain scene samples containing surface water features, wherein the scene samples are normalized after being generated.
[0028] As described in the above steps S201-S204, after multi-scale segmentation of the remote sensing image, the remote sensing image multi-scale segmentation technology is used to segment the image into multiple small patch units. In order to further extract and analyze the surface water characteristics in these patch units, the center point of each patch unit is selected as the cropping seed point. First, the geographic coordinate information of the remote sensing image needs to be obtained. The geographic coordinate information usually includes data such as longitude and latitude. At the same time, it is also necessary to understand the ground resolution parameters of the image, that is, the actual ground area represented by each pixel point. Secondly, the obtained geographic coordinate information and ground resolution parameters are used to calculate the specific range covered by each patch unit on the actual ground. The range is obtained by converting the geographic coordinates of each patch unit into It is determined by the actual geographic coordinates and the ground resolution parameters. The center point coordinates of each patch unit are then combined with its actual ground coverage to generate the corresponding cropping area. The cropping area is a rectangular area determined based on the center point coordinates and the actual coverage. It is used for subsequent image cropping operations. Then, image cropping operations are performed on each generated cropping area. In this way, scene samples containing surface water features can be extracted from the original remote sensing images as the basis for subsequent analysis and processing. Finally, in order to ensure the accuracy and consistency of subsequent processing, each scene sample will be normalized. Normalization usually includes adjusting image brightness, contrast and other parameters to make them meet a certain standard range, thereby facilitating subsequent analysis and processing.
[0029] In a preferred embodiment, the step of inputting all scene samples obtained by sample clipping into the ViT network to extract deep features includes: S301, obtaining a pre-trained ViT network model; S302, inputting the scene sample into the pre-trained ViT network model, and extracting the deep feature vector of each scene sample; S303: Analyze the extracted depth feature vectors to identify and distinguish different types of surface water features.
[0030] As described in the above steps S301-S303, when all scene samples obtained by the sample cropping technology are input into the network based on the visual transformer (ViT) to extract the deep features of these samples, a pre-trained ViT network model is first obtained. The ViT network model has been trained on a large-scale data set and has the corresponding feature extraction capability. Then, all scene samples obtained by the sample cropping technology are input into the pre-trained ViT network model one by one. During the input process, the ViT network will use its self-attention mechanism and multi-head attention mechanism to extract the deep features of each scene sample. This process involves decomposing the scene sample into a series of image blocks, encoding these image blocks, and finally generating a deep feature vector for each scene sample. Finally, the extracted deep feature vector is analyzed accordingly, so that different types of surface water features can be identified and distinguished, which is specifically achieved through the k-means clustering algorithm to ensure that the surface water features can be accurately classified.
[0031] In a preferred embodiment, the step of clustering scene samples using the k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes includes: S401, obtaining a deep feature vector of the scene sample, and performing k-means clustering to divide the scene sample into K clusters; S402, aggregating the scene samples into an initial sample set; S403: Randomly select k points from the initial sample data set as initial centroids ; S404, obtaining sample points , and calculate the sample point to the initial centroid The distance between the sample points and the initial centroid From the nearest cluster, get the updated cluster; The distance metric function uses Euclidean distance: ; in, is the ith data point, is the jth centroid.
[0032] S405. Calculate the new centroid of each updated cluster as the average value of all data points in the updated cluster. For the jth updated cluster , the new centroid The calculation formula is: ; In the formula, is the number of data points in the jth update cluster, Represents data points Belongs to the update cluster ; S406, repeat the calculation of the new centroid and the updated cluster until the centroid position no longer changes; S407, introducing the CH value to evaluate the quality of the clustering results, and determining whether it is necessary to reselect the initial centroid or adjust the number of clusters K according to the size of the CH value.
[0033] As described in the above steps S401-S407, in order to effectively cluster the scene samples, a k-means algorithm based on the CH criterion is used. First, the deep feature vectors of the scene samples are obtained. The deep feature vectors can capture the key information of the scene samples. Then, the k-means algorithm is used to perform cluster analysis on these feature vectors to divide the scene samples into K different clusters. Before clustering, all scene samples are aggregated into an initial sample set. The initial sample set contains all scene samples to be classified. In order to initialize the clustering process, k sample points are randomly selected from the initial sample data set as the initial centroids. The initial centroids will be used as the starting point for subsequent clustering, and then the iterative process can be started. For each sample point, its distance to each initial centroid is calculated and compared accordingly. Then, each sample point is assigned to the cluster represented by the nearest initial centroid, thereby obtaining a set of updated clusters, namely, updated clusters. In order to measure the distance between the sample point and the centroid, the Euclidean distance is used as the distance measurement function. Specifically, the distance between the i-th data point and the j-th centroid can be expressed as: ; Among them, data point i and centroid j represent the i-th data point and j-th centroid respectively; After all sample points are assigned to the corresponding clusters, the new centroid of each cluster needs to be calculated. The new centroid is obtained by calculating the average value of all data points in the updated cluster. For the jth updated cluster, the calculation formula of the new centroid is: ; in, is the number of data points in the jth update cluster, Represents data points Belongs to the update cluster ; Then repeat the process of calculating new centroids and updating clusters until the position of the centroid no longer changes. Once the position of the centroid is stable, the iteration can be stopped. Finally, in order to evaluate the quality of the clustering results, the CH value (Calinski-Harabasz index) is introduced to reflect the balance between the compactness within the cluster and the separation between clusters. According to the size of the CH value, it can be judged whether the current clustering result is ideal. If the CH value is low, it is necessary to reselect the initial centroid or adjust the number of clusters K to obtain better clustering effect.
[0034] In a preferred embodiment, the K-means clustering is to minimize the sum of the square distances from all data points in the cluster to the centroid, and the objective function is: ; In the formula, is the objective function, is the number of clusters, is the jth cluster, is the centroid of the jth cluster. The algorithm gradually reduces the value of the objective function through continuous iteration and eventually converges to a local optimal solution. The calculation formula of the CH value is as follows: ; In the formula, is the dispersion between clusters, that is, the sum of the variances between the cluster centers, is the dispersion within the cluster, which represents the sum of the variances between the data points in each cluster and the cluster center. k and n represent the number of clusters and the total number of data points, respectively. Among them, the larger the CH value, the better the clustering effect.
[0035] In this embodiment, the K-means clustering algorithm is implemented by minimizing the sum of the squared distances from all data points in the cluster to the centroid of each cluster, and its objective function can be expressed as: ; In the formula, is the objective function, is the number of clusters, is the jth cluster, is the centroid of the jth cluster; In addition, in order to evaluate the clustering effect, the CH value is introduced to evaluate the quality of the clustering effect. The calculation formula of the CH value is as follows: ; In the formula, is the dispersion between clusters, that is, the sum of the variances between the cluster centers, It is the dispersion within the cluster, which represents the sum of the variances between the data points in each cluster and the cluster center. k and n represent the number of clusters and the total number of data points, respectively. The larger the CH value, the better the clustering effect, that is, the greater the difference between clusters, and the more similar the data points in the clusters. By calculating the CH value, the quality of the clustering results can be quantitatively evaluated, thus providing a basis for subsequent data analysis and decision-making.
[0036] In a preferred embodiment, the step of automatically delineating the surface water range by using coordinate transformation and sample size prior knowledge of the water body sample points includes: S601, obtaining coordinate information of the surface water sample point; S602, determining the bounding box coordinates of each water body sample point according to prior knowledge of sample size; S603, converting the bounding box coordinates into an image coordinate system to obtain a preliminary range of surface water; S604: Identify the connected water areas within the preliminary range of surface water and output them as the surface water range.
[0037] As described in the above steps S601-S604, when the water body sample points are automatically delineated to obtain the surface water range through coordinate transformation and sample size prior knowledge, the coordinate information of the surface water sample points is first obtained, and the bounding box coordinates of each water body sample point are determined based on the sample size prior knowledge. The sample size prior knowledge refers to the general information about the size of the water body sample points that we know in advance. For example, different types of water bodies such as lakes, rivers and reservoirs usually have different size ranges. Through this prior knowledge, a reasonable bounding box can be set for each water body sample point to ensure that the bounding box can cover the entire water body area. Then, the bounding box coordinates are converted to the image coordinate system to obtain The preliminary scope of surface water. This conversion process usually involves a coordinate system conversion algorithm, such as conversion from a geographic coordinate system to an image coordinate system, or from one image coordinate system to another. The bounding box coordinates of the surface water sample points can be mapped to the image through conversion to obtain the preliminary scope of surface water. Finally, it is necessary to identify the connected water body areas within the preliminary scope of surface water and output them as the surface water scope. This can be achieved through image processing technology, such as using a connected area marking algorithm to identify and mark all connected water body areas, thereby ensuring that the output surface water scope is connected, avoiding the mistaken identification of scattered small water body areas as independent surface water scopes.
[0038] See also Figure 2 , a k-means clustering supported image surface water range automatic delineation system, using the above k-means clustering supported image surface water range automatic delineation method, including: An image segmentation module, wherein the image segmentation module is used to collect remote sensing images of surface water and perform multi-scale segmentation on high-resolution remote sensing images using a SLIC superpixel segmentation algorithm; A cropping module, wherein the cropping module is used to use the center point of the patch unit after multi-scale segmentation of the remote sensing image as a cropping seed point, and obtain a scene sample by sample cropping; A feature extraction module, wherein the feature extraction module is used to input all scene samples obtained by sample cropping into the ViT network to extract deep features; A clustering module, wherein the clustering module is used to cluster the scene samples using a k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes; A prediction module, wherein the prediction module is used to input the scene sample set into a CNN network for training prediction to obtain a water body sample point; The scope delineation module is used to automatically delineate the water body sample points to obtain the surface water range through coordinate conversion and sample size prior knowledge.
[0039] In the above, the delineation system includes image segmentation module, cropping module, feature extraction module, clustering module, prediction module and range delineation module. The main function of the image segmentation module is to collect remote sensing image data of surface water. In order to improve the accuracy and efficiency of segmentation, the SLIC superpixel segmentation algorithm is used to perform multi-scale segmentation on high-resolution remote sensing images, and effectively distinguish the surface water area in the image from other areas. The function of the cropping module is to use the center point of the patch unit obtained after multi-scale segmentation of the remote sensing image as the cropping seed point. In this way, scene samples containing surface water information can be further extracted. The scene samples will be used for subsequent feature extraction and clustering analysis. The feature extraction module is responsible for inputting all scene samples obtained by sample cropping into ViT (Vision The core function of the clustering module is to perform cluster analysis on scene samples using the k-means algorithm guided by the CH criterion. The CH criterion is a clustering effectiveness evaluation method that can help determine the optimal number of clusters, so that scene samples can be divided into multiple subsets with different category attributes, thereby providing a basis for subsequent water body identification. The main task of the prediction module is to input the scene sample set obtained through clustering analysis into the CNN (Convolutional Neural Network) network for training and prediction. Through training, the CNN network can identify which sample points are water sample points, thereby providing accurate prediction results for the delineation of the surface water range. The range delineation module automatically delineates the coordinates predicted as water sample points through coordinate transformation and sample size prior knowledge, thereby obtaining the range of surface water. This process not only improves the accuracy of delineation, but also greatly reduces the need for manual intervention, which significantly improves the degree of automation of the entire system.
[0040] See also Figure 3 , an electronic device, the electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned k-means clustering supported image surface water range automatic delineation method.
[0041] The above-mentioned electronic device may be a server, a personal computer or other types of computing devices. The processor of the electronic device may be a central processing unit (CPU), a graphics processing unit (GPU) or other types of dedicated processors. The memory may be a random access memory (RAM), a read-only memory (ROM), a solid-state drive (SSD), a hard disk drive (HDD) or other types of storage media. The computer program of the electronic device may include an operating system, application programs and middleware. The operating system is responsible for managing the hardware resources of the electronic device and providing a user interface. The electronic device may also include an operator, an input device and an output device. The operator is responsible for performing various computing tasks. The input device allows the user to interact with the electronic device, such as inputting information through a keyboard, a mouse or a touch screen. The output device is used to display the processing results, such as a display or a printer.
[0042] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0043] The above is only a preferred embodiment of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention. The structures, devices and operating methods not specifically described and explained in the present invention shall be implemented according to the conventional means in the art unless otherwise specified and limited.
Claims
1. A method for automatically defining the range of surface water in images based on k-means clustering, characterized by: include: Collect remote sensing images of surface water and use the SLIC superpixel segmentation algorithm to perform multi-scale segmentation on high-resolution remote sensing images; The patch unit center point after multi-scale segmentation of the remote sensing image is used as a cropping seed point, and a scene sample is obtained by sample cropping; All scene samples obtained by sample cropping are input into the ViT network to extract deep features; The k-means algorithm guided by CH criterion is used to cluster the scene samples to obtain a scene sample set with category attributes; The scene sample set is input into the CNN network for training prediction, and the predicted water body sample points are obtained; The water body sample points are automatically delineated through coordinate transformation and sample size prior knowledge to obtain the surface water range.
2. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 1, characterized in that: The step of performing multi-scale segmentation of the high-resolution remote sensing image using the SLIC superpixel segmentation algorithm comprises: Acquiring multi-scale segmentation parameters of the remote sensing image, wherein the multi-scale segmentation parameters include segmentation scale, shape compactness and smoothness; Performing preliminary SLIC superpixel segmentation on the remote sensing image to generate an initial segmentation result; According to the initial segmentation result, each superpixel is evaluated to determine whether it meets the scale requirement of segmentation; If satisfied, the superpixel is retained; If it does not meet the scale requirement, it will be merged with the adjacent superpixels to form a new segmentation result until all superpixels meet the scale requirement.
3. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 1, characterized in that: The step of using the patch unit center point after multi-scale segmentation of the remote sensing image as a cropping seed point and obtaining a scene sample by sample cropping includes: Obtaining geographic coordinate information of the remote sensing image and corresponding ground resolution parameters; Calculate the actual ground coverage of each patch unit according to the geographic coordinate information and the ground resolution parameter; Combine the center point coordinates of each patch unit with the actual ground coverage to generate the corresponding cropping area; Image cropping is performed on each of the cropped areas to obtain scene samples containing surface water features, wherein the scene samples are normalized after being generated.
4. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 1, characterized in that: The step of inputting all scene samples obtained by sample cropping into the ViT network to extract deep features includes: Get the pre-trained ViT network model; Input the scene sample into the pre-trained ViT network model to extract the deep feature vector of each scene sample; The extracted depth feature vectors are analyzed to identify and distinguish different types of surface water characteristics.
5. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 4, characterized in that: The step of clustering scene samples using the k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes includes: Obtaining a deep feature vector of the scene sample, and performing k-means clustering to divide the scene sample into K clusters; Aggregating the scene samples into an initial sample set; Randomly select k points from the initial sample data set as the initial centroid ; Get sample points , and calculate the sample point to the initial centroid The distance between the sample points and the initial centroid From the nearest cluster, get the updated cluster; The distance metric function uses Euclidean distance: ; in, is the ith data point, is the jth centroid; Calculate the new centroid of each update cluster as the average of all data points in the update cluster. For the jth update cluster , the new centroid The calculation formula is: ; In the formula, is the number of data points in the jth update cluster, Represents data points Belongs to the update cluster ; Repeat the calculation of new centroids and updated clusters until the centroid position no longer changes; The CH value is introduced to evaluate the quality of clustering results, and whether it is necessary to reselect the initial centroid or adjust the number of clusters K is determined according to the size of the CH value.
6. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 1, characterized in that: The K-means clustering method minimizes the sum of the squared distances from all data points in the cluster to the centroid, and the objective function is: ; In the formula, is the objective function, is the number of clusters, is the jth cluster, is the centroid of the jth cluster. The value of the objective function is gradually reduced through continuous iteration of the algorithm, and finally converges to a local optimal solution.
7. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 5, characterized in that: The calculation formula of the CH value is as follows: ; In the formula, is the dispersion between clusters, that is, the sum of the variances between the cluster centers, is the dispersion within the cluster, which represents the sum of the variances between the data points in each cluster and the cluster center. k and n represent the number of clusters and the total number of data points, respectively. Among them, the larger the CH value, the better the clustering effect.
8. The method for automatically defining the range of surface water in images based on k-means clustering according to claim 1, characterized in that: The step of automatically delineating the water body sample points through coordinate conversion and sample size prior knowledge to obtain the surface water range includes: Obtaining coordinate information of the surface water sample point; Determining the bounding box coordinates of each of the water body sample points based on prior knowledge of sample size; Convert the bounding box coordinates into the image coordinate system to obtain a preliminary range of surface water; Connected water areas within the preliminary extent of surface water are identified and output as the surface water extent.
9. An automatic surface water range delineation system based on images supported by k-means clustering, characterized by: The method for automatically defining the range of surface water in an image supported by k-means clustering according to any one of claims 1 to 8 comprises: An image segmentation module, wherein the image segmentation module is used to collect remote sensing images of surface water and perform multi-scale segmentation on high-resolution remote sensing images using a SLIC superpixel segmentation algorithm; A cropping module, wherein the cropping module is used to use the center point of the patch unit after multi-scale segmentation of the remote sensing image as a cropping seed point, and obtain a scene sample by sample cropping; A feature extraction module, wherein the feature extraction module is used to input all scene samples obtained by sample cropping into the ViT network to extract deep features; A clustering module, wherein the clustering module is used to cluster the scene samples using a k-means algorithm guided by the CH criterion to obtain a scene sample set with category attributes; A prediction module, wherein the prediction module is used to input the scene sample set into a CNN network for training and prediction, and obtain a water body sample point; The scope delineation module is used to automatically delineate the water body sample points to obtain the surface water range through coordinate conversion and sample size prior knowledge.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for automatic delineation of surface water range in images supported by k-means clustering as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Hyperspectral image semi-supervised classification method and system based on multi-scale homogeneous region
CN115908939A
Long-time-sequence land utilization classification method fusing multi-scale segmentation and super-pixel segmentation
CN116030352A
Photovoltaic scene division method and system
CN117408423A
Hyperspectral remote sensing image ground object clustering method of self-supervised double-branch Transform structure
CN118072059A
