A method and system for spectral clustering of raster data with integrated spatial constraints

By applying spatial constraints and similarity threshold filtering to the spectral clustering algorithm, the problem of poor spatial continuity in raster data processing of traditional spectral clustering algorithms is solved, and efficient clustering results with spatial continuity and attribute similarity are achieved.

CN120744556BActive Publication Date: 2026-07-17BEIJING NORMAL UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING NORMAL UNIVERSITY
Filing Date
2025-05-21
Publication Date
2026-07-17

Smart Images

  • Figure CN120744556B_ABST
    Figure CN120744556B_ABST
Patent Text Reader

Abstract

This invention provides a method and system for spectral clustering of raster data with integrated spatial constraints, comprising: acquiring different attribute layers of raster data to be classified; determining the number of clusters based on the attribute layers, and clustering the raster data using a preset algorithm to calculate a similarity threshold; constructing a clustering network based on the similarity threshold according to raster attributes and spatial adjacency relationships and generating an initial similarity matrix; reducing the similarity graph constructed from the initial similarity matrix and removing outlier nodes to obtain a pruned similarity matrix; and inputting the pruned similarity matrix as a parameter into a preset spectral clustering algorithm to obtain clustering results. This invention, based on existing spectral clustering methods, applies spatial constraints to obtain a similarity threshold when creating a similarity graph between data nodes, and deletes edges with low similarity to reduce the computational load of spectral clustering. It overcomes the shortcomings of existing spectral clustering methods in failing to consider spatial continuity, and balances the spatial continuity and attribute similarity of raster data clustering results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spatial data processing technology, and in particular to a method and system for spectral clustering of raster data with integrated spatial constraints. Background Technology

[0002] Spatial clustering, also known as spatial partitioning, is a traditional research topic in geography. It not only reveals the common processes and characteristics within clusters but also highlights the differences between clusters, giving new clusters richer geographical meaning and providing a foundation for further comprehensive research. Spatial clustering methods group spatial units with similar attributes into the same cluster and impose spatial continuity constraints to ensure the accuracy of the clustering results. This constraint can be strict, requiring spatial units in the cluster to be spatially continuous, or it can be non-strict, requiring only that most spatial units are continuous. However, the weighting of geographical coordinates or location dissimilarity is crucial to the clustering results. Excessive location weights can lead to significant attribute differences in the clustering results, while insufficient location weights can result in spatially dispersed clusters with poor continuity.

[0003] Spectral clustering is an unsupervised clustering algorithm based on graph theory. It achieves data clustering by representing data samples as nodes in a graph and performing clustering on the graph. Specifically, spectral clustering treats data samples as nodes in a graph and represents their similarity as the edge weights between nodes. It then computes the Laplacian matrix of the graph and obtains the clustering results by performing eigenvalue decomposition on the Laplacian matrix. Spectral clustering not only effectively handles non-convex and complex-shaped data clusters, but it also exhibits good scalability when dealing with large-scale datasets. Furthermore, because spectral clustering is based on graph theory, it can naturally handle complex situations such as weighted graphs, noisy datasets, and multi-view datasets. Traditional spectral clustering algorithms, when constructing similarity graphs for spatially characteristic sample data, only consider the attribute relationships of the sample data, ignoring the spatial features inherent in the data itself. Therefore, its clustering results fail to reflect the spatial relationships between the research objects, and when dealing with large-scale raster data, the size of the similarity graphs becomes too large, making further clustering difficult.

[0004] In summary, by combining the advantages of spatial clustering and spectral clustering algorithms, and focusing on raster data, we have researched and proposed a spectral clustering method for raster data that integrates spatial constraints. This method is of great significance for revealing the spatial clustering characteristics of the multidimensional attributes of research objects expressed based on raster data models. Summary of the Invention

[0005] This invention provides a spectral clustering method and system for raster data with integrated spatial constraints. Based on the original spectral clustering method, spatial constraints are applied when creating similarity graphs between data nodes, and the elbow rule is used to obtain a similarity threshold. This threshold is then used to simplify the similarity graph, deleting edges with low similarity to reduce the computational load of spectral clustering. Ultimately, this invention overcomes the shortcomings of existing spectral clustering methods that cannot take into account spatial continuity, and balances the spatial continuity and attribute similarity of raster data clustering results.

[0006] This invention provides a method for spectral clustering of raster data with integrated spatial constraints, comprising: Obtain different attribute layers of the raster data to be classified; The number of clusters is determined based on the attribute layer, and the raster data is clustered using a preset algorithm to calculate the similarity threshold. Based on the similarity threshold, a clustering network is constructed according to grid attributes and spatial adjacency relationships, and an initial similarity matrix is ​​generated; The similarity graph constructed from the initial similarity matrix is ​​reduced and abnormal nodes are removed to obtain the pruned similarity matrix; The trimmed similarity matrix is ​​input as a parameter into a preset spectral clustering algorithm to obtain the clustering results.

[0007] According to the spectral clustering method for raster data with integrated spatial constraints provided by the present invention, the step of obtaining different attribute layers of the raster data to be classified specifically includes: Obtain the input raster data, wherein the raster data should be located in the same area and the number of rows and columns of the corresponding raster data should be the same; The size of the three-dimensional matrix representing the raster is determined based on the different attribute layers of the raster data to be classified.

[0008] According to the present invention, a method for spectral clustering of raster data with integrated spatial constraints is provided, wherein determining the number of clusters based on attribute layers, clustering the raster data using a preset algorithm, and calculating a similarity threshold specifically includes: The number of clusters can be obtained by specifying the attribute layer or by using a preset algorithm; Based on cluster numbers The algorithm clusters raster data to obtain different clusters, calculates the similarity between all elements in each cluster, and determines the similarity threshold by sorting.

[0009] According to the present invention, a spectral clustering method for raster data with integrated spatial constraints is provided, wherein the step of constructing a clustering network based on the similarity threshold according to raster attributes and spatial adjacency relationships and generating an initial similarity matrix specifically includes: Map at least one raster cell in the raster data to a set of nodes, define the neighborhood range with the central raster as the reference, and generate the adjacency relationship covering the raster window; Based on the adjacency relationship, all nodes are traversed to calculate the similarity of nodes within the neighborhood. An edge set is constructed based on the similarity threshold to form a clustering network, and an initial similarity matrix is ​​constructed simultaneously.

[0010] According to the spectral clustering method for raster data with integrated spatial constraints provided by the present invention, the step of reducing the similarity graph within the initial similarity matrix and removing outlier nodes to obtain a pruned similarity matrix specifically includes: The initial similarity matrix is ​​traversed to detect isolated nodes; If the isolated node meets the preset conditions, it will be added to the abnormal node set; A node pruning operation is performed based on the set of abnormal nodes to remove abnormal nodes and generate a pruned similarity matrix.

[0011] According to the present invention, a spectral clustering method for raster data with integrated spatial constraints is provided, wherein the step of inputting the trimmed similarity matrix as a parameter into a preset spectral clustering algorithm to obtain the clustering result specifically includes: The pruned similarity matrix is ​​input into the spectral clustering algorithm to obtain the clustering results of all non-abnormal nodes; The clustering results of non-abnormal nodes are restored to the initial raster nodes, while abnormal nodes are marked in the initial raster, thus obtaining the clustering results of all raster nodes.

[0012] The present invention also provides an integrated spatially constrained raster data spectral clustering system, the system comprising: The raster data acquisition module is used to acquire different attribute layers of the raster data to be classified. The similarity calculation module is used to determine the number of clusters based on the attribute layer, and to cluster the raster data using a preset algorithm to calculate the similarity threshold; An initial similarity matrix generation module is used to construct a clustering network and generate an initial similarity matrix based on the similarity threshold according to grid attributes and spatial adjacency relationships; The matrix pruning module is used to reduce the similarity graph constructed from the initial similarity matrix and remove abnormal nodes to obtain the pruned similarity matrix; The clustering module is used to input the trimmed similarity matrix as a parameter into a preset spectral clustering algorithm to obtain the clustering results.

[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the integrated spatial constraint raster data spectral clustering method as described above.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the raster data spectral clustering method with integrated spatial constraints as described above.

[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a raster data spectral clustering method with integrated spatial constraints as described above.

[0016] This invention provides a spectral clustering method and system for raster data with integrated spatial constraints. By clustering raster data and applying spatial constraints, a similarity threshold is obtained. The similarity threshold is used to simplify the similarity graph, and edges with low similarity are deleted to reduce the computational load of spectral clustering. The similarity graph is pruned, and the pruned similarity matrix is ​​used as a parameter to input into a preset spectral clustering algorithm to obtain the clustering results. This avoids the defect of spectral clustering methods that cannot take into account spatial continuity, and takes into account both the spatial continuity and attribute similarity of the raster data clustering results. Attached Figure Description

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

[0018] Figure 1 This is a flowchart illustrating the integrated spatial constraint raster data spectral clustering method provided by the present invention.

[0019] Figure 2 This is a schematic diagram of the grid attributes provided by the present invention.

[0020] Figure 3 This is a schematic diagram of the elbow rule provided by the present invention.

[0021] Figure 4 This is a schematic diagram of the grid neighborhood range and adjacent nodes provided by the present invention.

[0022] Figure 5 This is a schematic diagram of the similarity graph threshold screening and refining process provided by the present invention.

[0023] Figure 6 This is the raster data clustering result provided by the present invention.

[0024] Figure 7 This is a schematic diagram of the module connections of the integrated spatially constrained raster data spectral clustering system provided by the present invention.

[0025] Figure 8This is a schematic diagram of the structure of the electronic device provided by the present invention.

[0026] Figure label: 110: Raster data acquisition module; 120: Similarity calculation module; 130: Initial similarity matrix generation module; 140: Matrix pruning module; 150: Clustering module; 810: Processor; 820: Communication interface; 830: Memory; 840: Communication bus. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0028] The following is combined with Figure 1 The present invention describes a raster data spectral clustering method with integrated spatial constraints, comprising: step 100, obtaining different attribute layers of the raster data to be classified.

[0029] Specifically, the input raster data is obtained, wherein the raster data should be located in the same area and the number of rows and columns of corresponding raster data is the same. The size of the three-dimensional matrix representing the raster is determined based on the different attribute layers of the raster data to be classified.

[0030] In this invention, taking soil attribute raster data from a certain location as an example, the implementation scheme of a raster data spectral clustering method integrating spatial constraints is described. For the input raster data, it is ensured that they are located in the same area, and the number of rows and columns of corresponding raster data should be the same. The raster data to be classified can be considered as... A three-dimensional matrix, in which The number of rows and columns of the raster data to be classified. The number of attributes of the raster data to be classified; in this embodiment, the input raster is... A three-dimensional matrix, with specific properties as follows Figure 2 As shown.

[0031] Step 200: Determine the number of clusters based on the attribute layer, and cluster the raster data using a preset algorithm to calculate the similarity threshold.

[0032] Specifically, the number of clusters is obtained by specifying the attribute layer or by using a preset algorithm; Based on cluster numbers The algorithm clusters raster data to obtain different clusters, calculates the similarity between all elements in each cluster, and determines the similarity threshold by sorting.

[0033] In this invention, the number of clusters can be directly specified. Alternatively, the elbow rule based on the k-means algorithm can be used to determine the number of clusters for raster data. .use The algorithm clusters raster data to obtain For each of the n clusters, the similarity between all elements within that cluster is calculated. The similarities between elements within each cluster are then sorted from smallest to largest, and the first quartile of the similarity is selected. The mean of the first quartiles of all n clusters is then taken to obtain the similarity threshold. .

[0034] In one specific embodiment, the number of clusters can be specified directly. Alternatively, the number of clusters for raster data can be determined using the elbow rule. In this embodiment, the elbow rule is used to determine the number of clusters. First, the range of the number of clusters is set to... Then for each given number of clusters The K-means algorithm was used to obtain... For each cluster, calculate the sum of squared distances (SSE) from all samples to their respective cluster centers; plot a curve with the number of clusters on the x-axis and SSE on the y-axis. Observe the curve and find a clear inflection point, such as... Figure 3 The inflection point represents the determined number of clusters; in this embodiment, the number of clusters is 6.

[0035] The K-means algorithm was used to cluster the example raster data, resulting in 6 clusters. The similarity between all elements within each cluster was calculated using formula (1). The similarity between elements within each cluster was sorted, and the first quartile of the similarity was selected to obtain the first quartile of the 6 clusters. The average of these six values ​​was taken as the similarity threshold. In this embodiment, the similarity threshold is... .

[0036] (1) in, For node attribute vectors, The modulus between the attribute vectors of the two nodes. As a hyperparameter, it is set in this embodiment. It is set to 1, but its value can be changed according to the data distribution in actual operation.

[0037] Step 300: Based on the similarity threshold, construct a clustering network according to grid attributes and spatial adjacency relationships, and generate an initial similarity matrix.

[0038] Specifically, at least one raster cell in the raster data is mapped to a set of nodes, the neighborhood range is defined with the central raster as the reference, and the adjacency relationship covering the raster window is generated; The similarity between nodes in the neighborhood is calculated by traversing all nodes. An edge set is constructed based on the similarity threshold to form a clustering network, and an initial similarity matrix is ​​constructed simultaneously.

[0039] In this invention, Each grid cell is mapped to a set of nodes. With the central grid Define the benchmark Neighborhood range, generate coverage Adjacency relationships of the grid window. Traverse all nodes. Calculate the nodes in its neighborhood. Similarity: (2) in For similarity calculation function, For node attribute vectors, The cell row and column number of the raster node. Let the neighborhood size be [value]. Retain [values ​​that satisfy]... edge Constructing edge sets To form a clustering network Synchronous construction similarity matrix Its row and column indices correspond to the raster numbers, and non-empty elements store valid similarity values.

[0040] In one specific embodiment, reference Figure 4 Each grid cell is mapped to a node to construct a node set. ,initialization 1-th order sparse matrix .by Define the neighborhood range to form a central grid. With core Adjacency window. When traversing all grid nodes, for each center grid... Calculate adjacent grid cells within the calculation window similarity Calculate according to formula (2). (Retain) The edges form the edge set The final diagram and the corresponding 31820th order similarity matrix The matrix row and column indices correspond to the raster numbers, and non-empty elements record the valid similarity.

[0041] Step 400: Reduce the similarity graph constructed from the initial similarity matrix and remove abnormal nodes to obtain the pruned similarity matrix.

[0042] See Figure 5 Specifically, the initial similarity matrix is ​​traversed to detect isolated nodes; If the isolated node meets the preset conditions, it will be added to the abnormal node set; A node pruning operation is performed based on the set of abnormal nodes to remove abnormal nodes and generate a pruned similarity matrix.

[0043] In this invention, clustering networks are detected. Set of isolated nodes ,in This is an indicator function that takes the value 1 if the condition is true and 0 otherwise, achieved through matrix pruning operations. Generate Refined Matrix , The set difference operation represents the set of nodes after removing anomalies, and the graph structure is updated synchronously as follows: .

[0044] In a specific embodiment, by traversing Detecting isolated nodes, when a node satisfy When this happens, add it to the exception set. Perform node pruning operation. To obtain the refined similarity matrix .

[0045] Step 500: Input the trimmed similarity matrix as a parameter into the preset spectral clustering algorithm to perform clustering and obtain the clustering results.

[0046] Specifically, the pruned similarity matrix is ​​input into the spectral clustering algorithm to obtain the clustering results of all non-abnormal nodes; The clustering results of non-abnormal nodes are restored to the initial raster nodes, while abnormal nodes are marked in the initial raster, thus obtaining the clustering results of all raster nodes.

[0047] In this invention, the similarity matrix is ​​used. Construct the non-regularized Laplacian matrix (L), and calculate the Laplacian matrix (L) as shown in formula (3). (3) in, For Laplace matrix, For degree matrix, It is a diagonal matrix, and the diagonal elements , It is a similar matrix.

[0048] After constructing the Laplace matrix, solve the generalized eigenvalue problem. Obtain the eigenvectors corresponding to the k smallest eigenvalues. .

[0049] Based on the feature vector Constructing a matrix .

[0050] matrix Each row is treated as a data point, and the k-means algorithm is used to analyze it. Clustering is performed to obtain the cluster label for each data point.

[0051] The clustering results of all non-abnormal nodes are used to convert all cluster labels into a two-dimensional matrix based on the correspondence between raster rows and columns and data points. This matrix is ​​then restored to the initial raster nodes, while the set of abnormal nodes is also included. By restoring all nodes to the raster and labeling them, the clustering result of all raster nodes can be obtained. In this embodiment, the clustering result is as follows: Figure 6 As shown.

[0052] The present invention provides a spectral clustering method for raster data with integrated spatial constraints. By clustering raster data and applying spatial constraints, a similarity threshold is obtained. The similarity threshold is used to simplify the similarity graph, and edges with low similarity are deleted to reduce the computational load of spectral clustering. The similarity graph is pruned, and the pruned similarity matrix is ​​used as a parameter to input into a preset spectral clustering algorithm to obtain the clustering result. This avoids the defect of spectral clustering methods that cannot take into account spatial continuity, and takes into account both the spatial continuity and attribute similarity of the raster data clustering result.

[0053] refer to Figure 7 The present invention also discloses an integrated spatially constrained raster data spectral clustering system, the system comprising: Raster data acquisition module 110 is used to acquire different attribute layers of the raster data to be classified. The similarity calculation module 120 is used to determine the number of clusters based on the attribute layer, and to cluster the raster data using a preset algorithm to calculate the similarity threshold. The initial similarity matrix generation module 130 is used to construct a clustering network and generate an initial similarity matrix based on the similarity threshold according to the grid attributes and spatial adjacency relationship; The matrix trimming module 140 is used to reduce the similarity graph constructed from the initial similarity matrix and remove abnormal nodes to obtain the trimmed similarity matrix. Clustering module 150 is used to input the trimmed similarity matrix as a parameter into a preset spectral clustering algorithm to obtain clustering results.

[0054] Specifically, obtaining different attribute layers of the raster data to be classified includes: Obtain the input raster data, wherein the raster data should be located in the same area and the number of rows and columns of the corresponding raster data should be the same; The size of the three-dimensional matrix representing the raster is determined based on the different attribute layers of the raster data to be classified.

[0055] The number of clusters is determined based on the attribute layer, and the raster data is clustered using a preset algorithm to calculate a similarity threshold, specifically including: The number of clusters can be obtained by specifying the attribute layer or by using a preset algorithm; Based on cluster numbers The algorithm clusters raster data to obtain different clusters, calculates the similarity between all elements in each cluster, and determines the similarity threshold by sorting.

[0056] Based on the similarity threshold, a clustering network is constructed according to grid attributes and spatial adjacency relationships, and an initial similarity matrix is ​​generated. Specifically, this includes: Map at least one raster cell in the raster data to a set of nodes, define the neighborhood range with the central raster as the reference, and generate the adjacency relationship covering the raster window; The similarity between nodes in the neighborhood is calculated by traversing all nodes. An edge set is constructed based on the similarity threshold to form a clustering network, and an initial similarity matrix is ​​constructed simultaneously.

[0057] The similarity graph within the initial similarity matrix is ​​reduced and outlier nodes are removed to obtain a pruned similarity matrix, specifically including: The initial similarity matrix is ​​traversed to detect isolated nodes; If the isolated node meets the preset conditions, it will be added to the abnormal node set; A node pruning operation is performed based on the set of abnormal nodes to remove abnormal nodes and generate a pruned similarity matrix.

[0058] The trimmed similarity matrix is ​​used as a parameter to input into a preset spectral clustering algorithm to obtain the clustering results, specifically including: The pruned similarity matrix is ​​input into the spectral clustering algorithm to obtain the clustering results of all non-abnormal nodes; The clustering results of non-abnormal nodes are restored to the initial raster nodes, while abnormal nodes are marked in the initial raster, thus obtaining the clustering results of all raster nodes.

[0059] Based on the spectral clustering system for raster data with integrated spatial constraints provided by this invention, the system clusters raster data, applies spatial constraints, obtains a similarity threshold, simplifies the similarity graph using the similarity threshold, deletes edges with low similarity to reduce the computational load of spectral clustering, trims the similarity graph, and inputs the trimmed similarity matrix as a parameter into a preset spectral clustering algorithm to obtain the clustering results. This avoids the defect of spectral clustering methods that cannot take into account spatial continuity, and takes into account both the spatial continuity and attribute similarity of the raster data clustering results.

[0060] Figure 8 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 8 As shown, the electronic device may include a processor 810, a communications interface 820, a memory 830, and a communication bus 840, wherein the processor 810, communications interface 820, and memory 830 communicate with each other via the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute a raster data spectral clustering method with integrated spatial constraints. This method includes: acquiring different attribute layers of the raster data to be classified; determining the number of clusters based on the attribute layers, and clustering the raster data using a preset algorithm, calculating a similarity threshold; constructing a clustering network based on the similarity threshold according to raster attributes and spatial adjacency relationships, and generating an initial similarity matrix; reducing the similarity graph constructed from the initial similarity matrix and removing outlier nodes to obtain a pruned similarity matrix; and inputting the pruned similarity matrix as a parameter into a preset spectral clustering algorithm to obtain clustering results.

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

[0062] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the integrated spatial constraint raster data spectral clustering method provided by the above methods. The method includes: acquiring different attribute layers of raster data to be classified; determining the number of clusters based on the attribute layers and clustering the raster data using a preset algorithm, and calculating a similarity threshold; constructing a clustering network based on the similarity threshold according to raster attributes and spatial adjacency relationships and generating an initial similarity matrix; reducing the similarity graph constructed from the initial similarity matrix and removing abnormal nodes to obtain a pruned similarity matrix; and inputting the pruned similarity matrix as a parameter into a preset spectral clustering algorithm to perform clustering and obtain clustering results.

[0063] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a raster data spectral clustering method with integrated spatial constraints provided by the methods described above. The method includes: acquiring different attribute layers of raster data to be classified; determining the number of clusters based on the attribute layers and clustering the raster data using a preset algorithm, and calculating a similarity threshold; constructing a clustering network based on the similarity threshold according to raster attributes and spatial adjacency relationships and generating an initial similarity matrix; reducing the similarity graph constructed from the initial similarity matrix and removing outlier nodes to obtain a pruned similarity matrix; and inputting the pruned similarity matrix as a parameter into a preset spectral clustering algorithm to perform clustering and obtain clustering results.

[0064] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A spectral clustering method for raster data with integrated spatial constraints, characterized in that, include: Obtain different attribute layers of the raster data to be classified; wherein, the raster data is soil raster data; The number of clusters is determined based on the attribute layer, and the raster data is clustered using a preset algorithm to calculate the similarity threshold. Based on the similarity threshold, a clustering network is constructed according to grid attributes and spatial adjacency relationships, and an initial similarity matrix is ​​generated; The similarity graph constructed from the initial similarity matrix is ​​reduced and abnormal nodes are removed to obtain the pruned similarity matrix; The trimmed similarity matrix is ​​input as a parameter into a preset spectral clustering algorithm to obtain the clustering results; Specifically, obtaining different attribute layers of the raster data to be classified includes: Obtain the input raster data, wherein the raster data should be located in the same area and the number of rows and columns of the corresponding raster data should be the same; The size of the three-dimensional matrix representing the raster is determined based on the different attribute layers of the raster data to be classified; Specifically, the step of constructing a clustering network based on the similarity threshold according to grid attributes and spatial adjacency relationships and generating an initial similarity matrix includes: Map at least one raster cell in the raster data to a set of nodes, define the neighborhood range with the central raster as the reference, and generate the adjacency relationship covering the raster window; Based on the adjacency relationship, all nodes are traversed to calculate the similarity of nodes within the neighborhood. An edge set is constructed based on the similarity threshold to form a clustering network, and an initial similarity matrix is ​​constructed simultaneously.

2. The integrated spatially constrained raster data spectral clustering method according to claim 1, characterized in that, The process of determining the number of clusters based on attribute layers, clustering raster data using a preset algorithm, and calculating a similarity threshold specifically includes: The number of clusters can be obtained by specifying the attribute layer or by using a preset algorithm; Based on cluster numbers The algorithm clusters raster data to obtain different clusters, calculates the similarity between all elements in each cluster, and determines the similarity threshold by sorting.

3. The integrated spatially constrained raster data spectral clustering method according to claim 1, characterized in that, The process of reducing the similarity graph within the initial similarity matrix and removing outlier nodes to obtain the pruned similarity matrix specifically includes: The initial similarity matrix is ​​traversed to detect isolated nodes; If the isolated node meets the preset conditions, it will be added to the abnormal node set; A node pruning operation is performed based on the set of abnormal nodes to remove abnormal nodes and generate a pruned similarity matrix.

4. The integrated spatially constrained raster data spectral clustering method according to claim 1, characterized in that, The step of inputting the trimmed similarity matrix as a parameter into a preset spectral clustering algorithm to obtain clustering results specifically includes: The pruned similarity matrix is ​​input into the spectral clustering algorithm to obtain the clustering results of all non-abnormal nodes; The clustering results of non-abnormal nodes are restored to the initial raster nodes, while abnormal nodes are marked in the initial raster, thus obtaining the clustering results of all raster nodes.

5. A raster data spectral clustering system with integrated spatial constraints, characterized in that, The system includes: The raster data acquisition module is used to acquire different attribute layers of the raster data to be classified; wherein, the raster data is soil raster data; The similarity calculation module is used to determine the number of clusters based on the attribute layer, and to cluster the raster data using a preset algorithm to calculate the similarity threshold; An initial similarity matrix generation module is used to construct a clustering network and generate an initial similarity matrix based on the similarity threshold according to grid attributes and spatial adjacency relationships; The matrix pruning module is used to reduce the similarity graph constructed from the initial similarity matrix and remove abnormal nodes to obtain the pruned similarity matrix; The clustering module is used to input the trimmed similarity matrix as a parameter into a preset spectral clustering algorithm to obtain clustering results; Specifically, obtaining different attribute layers of the raster data to be classified includes: Obtain the input raster data, wherein the raster data should be located in the same area and the number of rows and columns of the corresponding raster data should be the same; The size of the three-dimensional matrix representing the raster is determined based on the different attribute layers of the raster data to be classified; Specifically, the step of constructing a clustering network based on the similarity threshold according to grid attributes and spatial adjacency relationships and generating an initial similarity matrix includes: Map at least one raster cell in the raster data to a set of nodes, define the neighborhood range with the central raster as the reference, and generate the adjacency relationship covering the raster window; Based on the adjacency relationship, all nodes are traversed to calculate the similarity of nodes within the neighborhood. An edge set is constructed based on the similarity threshold to form a clustering network, and an initial similarity matrix is ​​constructed simultaneously.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the raster data spectral clustering method with integrated spatial constraints as described in any one of claims 1 to 4.

7. A non-transitory 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 raster data spectral clustering method with integrated spatial constraints as described in any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the raster data spectral clustering method with integrated spatial constraints as described in any one of claims 1 to 4.