Image clustering method and device and computer readable storage medium
By dividing images into spatial neighborhoods and extracting connected center features to construct a similarity matrix, the problem of long image clustering calculation time and low accuracy in the existing technology is solved, and efficient image clustering is achieved.
Patent Information
- Application Number
- CN202410123362.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-29
- Publication Date
- 2024-10-22
AI Technical Summary
When the existing technology processes large-size, high-resolution images, the space complexity of constructing the similarity matrix is high, the calculation is time-consuming, and the spatial structure information between pixels is ignored, resulting in reduced accuracy of the clustering results.
Divide the image into multiple spatial neighborhoods, extract the connected center features of each spatial neighborhood, construct a similarity matrix, perform clustering through the connected center evolution method, and finally map the feature clustering results to all pixels of the image.
It reduces the space complexity, improves the ability to process large-size images, and utilizes the spatial information of pixels to improve the accuracy of clustering results.
Smart Images

Figure CN118823399A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of large model technology, and specifically to an image clustering method, an image clustering device, an electronic device, a chip, a computer-readable storage medium, and a computer program product. Background Art
[0002] Connection Center Evolution (CCE) requires all pixels of the image to participate in the construction of the similarity matrix. When the image has a large size, high resolution or more pixels, the constructed similarity matrix will have a high spatial complexity, resulting in insufficient computational memory. At the same time, in order to ensure that the CCE method can obtain clustering results at a sufficiently rich observation scale, it is necessary to perform multiple rounds of power iterations on the similarity matrix, which will also result in excessive computational time. In addition, the CCE method only uses the feature information of image pixels for clustering, ignoring the spatial structure information between pixels, resulting in reduced accuracy of its clustering results on image data. Summary of the invention
[0003] Embodiments of the present application provide an image clustering method, an image clustering device, an electronic device, a chip, a computer-readable storage medium, and a computer program product.
[0004] The image clustering method provided in the embodiment of the present application includes:
[0005] Dividing the first image into a plurality of spatial neighborhoods; wherein pixels in the same spatial neighborhood are homogeneous;
[0006] Determine a one-step connected center feature of each of the multiple spatial neighborhoods, and construct a first similarity matrix based on the one-step connected center feature of each of the multiple spatial neighborhoods; the one-step connected center feature represents a feature of the corresponding spatial neighborhood;
[0007] Based on the first similarity matrix, obtaining a first feature clustering result through a connected center evolution (CCE) operation;
[0008] The first feature clustering result is mapped to all pixels of the first image to obtain an image clustering result of the first image.
[0009] The image clustering device provided in the embodiment of the present application includes:
[0010] A processing unit: used for dividing the first image into a plurality of spatial neighborhoods; wherein pixels in the same spatial neighborhood are homogeneous;
[0011] The processing unit is further configured to determine a one-step connected center feature of each of the multiple spatial neighborhoods, and construct a first similarity matrix based on the one-step connected center feature of each of the multiple spatial neighborhoods; the one-step connected center feature represents a feature of the corresponding spatial neighborhood;
[0012] The processing unit is further configured to obtain a first feature clustering result through a connected center evolution (CCE) operation based on the first similarity matrix;
[0013] The processing unit is further used to map the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image.
[0014] The electronic device provided in the embodiment of the present application includes: a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute any image clustering method provided in the embodiment of the present application.
[0015] The chip provided in the embodiment of the present application includes: a processor, which is used to call and run a computer program from a memory, so that a device equipped with the chip executes any image clustering method provided in the embodiment of the present application.
[0016] The computer-readable storage medium provided in the embodiments of the present application is used to store a computer program, and the computer program enables a computer to execute any image clustering method provided in the embodiments of the present application.
[0017] The computer program product provided in the embodiments of the present application includes a computer program, characterized in that when the computer program is executed by a processor, it implements any image clustering method provided in the embodiments of the present application.
[0018] Through the image clustering method provided in the embodiment of the present application, the image is divided into multiple spatial neighborhoods, the spatial neighborhood information of the pixels is introduced, and the feature information is further introduced when extracting the one-step connected center features of each spatial neighborhood. The number of spatial neighborhoods is much smaller than the total number of pixels in the image. Compared with clustering with the features of all pixels, clustering with the features of a small number of spatial neighborhood objects will have lower spatial complexity and has the ability to process large-size images. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 Schematic diagram of the implementation process of the image clustering method provided in the embodiment of the present application Figure 1 ;
[0021] Figure 2 Schematic diagram of the implementation process of the image clustering method provided in the embodiment of the present application Figure 2 ;
[0022] Figure 3 Schematic diagram of the implementation process of the image clustering method provided in the embodiment of the present application Figure 3 ;
[0023] Figure 4 A schematic diagram of the structure of an image clustering device 400 provided in an embodiment of the present application;
[0024] Figure 5 A schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0025] Figure 6 A schematic structural diagram of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] It should be noted that in the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the embodiments of the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0028] In the description of the embodiments of the present application, the term "corresponding" may indicate a direct or indirect correspondence between two items, or an association relationship between the two items, or a relationship between indication and being indicated, configuration and being configured, and the like.
[0029] To facilitate understanding of the technical solutions of the embodiments of the present application, the relevant technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.
[0030] Image clustering is a classification technology based on image pixel features. It divides each pixel into a category by designing a certain rule to compare the similarity of pixel features, and then divides the image into multiple different areas. In practical applications, image clustering technology can reveal the approximate categories in the image, the distribution of image data, and other information without using any labeled pixel samples; it can even discover unknown patterns or categories in a variety of scenarios, such as identifying new surface structures in remote sensing images, or discovering new pathological features in medical images. In general, clustering analysis of images can not only provide image category information, but also provide support for subsequent processing and analysis of images. This makes image clustering have important research significance and application value in the fields of machine learning, computer vision, and image processing.
[0031] In the related technologies, clustering methods that can be used for image data can be roughly divided into four categories, namely centroid-based, density-based, hierarchy-based, and graph-based clustering methods. Among them, the graph-based clustering method has a nonlinear partitioning capability and is considered to be able to better capture the intrinsic relationship and structure between pixel data, and has received extensive attention in image clustering analysis.
[0032] The CCE method regards each pixel in the image as a node in the graph, and constructs a similarity matrix that describes the pixel similarity relationship by measuring the similarity between two nodes. Subsequently, the CCE method assigns new "k-order connectivity" and "k-order relative connectivity" attributes to each pixel by performing power iteration on the similarity matrix. By comparing the k-order connectivity attribute value of each pixel, the cluster center of all pixels at any observation scale can be directly determined. Subsequently, by comparing the k-order relative connectivity attribute value of non-cluster center pixels, the allocation method of all non-cluster center pixels is determined, and the image pixel clustering result corresponding to the observation scale is obtained. Finally, for multiple clustering results at multiple scales, the normalized cut index (Ncut) is introduced to determine the final unique clustering result as the output from multiple clustering results that meet the category number condition.
[0033] In the above CCE method, all image pixels are required to participate in the construction of the similarity matrix. When the image has a large size, a high resolution or a large number of pixels, the constructed similarity matrix will have a high spatial complexity, resulting in insufficient computational memory. At the same time, in order to ensure that the CCE method can obtain clustering results at a sufficiently rich observation scale, it is necessary to perform multiple rounds of power iterations on the similarity matrix, which will also result in excessive computational time. In addition, the CCE method only uses the feature information of image pixels for clustering, ignoring the spatial structure information between pixels, resulting in reduced accuracy of its clustering results on image data.
[0034] Figure 1 Schematic diagram of the implementation process of the image clustering method provided in the embodiment of the present application Figure 1 ,like Figure 1 As shown, the embodiment of the present application provides an image clustering method, the method comprising the following steps:
[0035] Step 101: Divide a first image into a plurality of spatial neighborhoods; wherein pixels in the same spatial neighborhood are homogeneous.
[0036] Exemplarily, the image is spatially divided into multiple homogeneous spatial neighborhoods. The neighborhood is used to maintain the spatial neighborhood information of the pixel. 1) Map all pixels of the image to a ten-dimensional feature space. For the input image data In order to preserve the spatial neighborhood information of each pixel in the image, it is necessary to i , i=1,…,N is spatially divided into multiple homogeneous spatial neighborhoods, where homogeneity means that the features of each pixel in the spatial neighborhood are similar. In order to obtain such a spatial division, the technology used needs to meet two requirements: one is the nonlinearity of the division technology to ensure that the spatial neighborhood is homogeneous; the other is the low complexity of the division technology to ensure that it can process all pixels of large-scale images. Usually, in order to meet these two requirements at the same time, it is necessary to first map the pixels to a higher-dimensional feature space. Because low-complexity linear division in a high-dimensional feature space is equivalent to high-complexity nonlinear division in the original feature space. For example, first map each pixel x in the image data X. i Mapped into a ten-dimensional feature space defined by Linear Spectral Clustering (LSC),
[0037]
[0038]
[0039] Where N is the number of all pixels contained in the image; L is the number of pixel features; is the pixel x i The component value after linear normalization in CIELAB color space is [0,1]; They are pixels x i The vertical and horizontal coordinates in the image; C c ,C s are the parameters that control the relative importance of color information and spatial information, that is, when C c <C s When the pixel x i The features in the ten-dimensional space will be mainly determined by its spatial neighborhood information, and vice versa. In the ten-dimensional feature space, the image is divided into multiple spatial neighborhoods through clustering algorithms.
[0040] In an optional implementation manner of the present application, dividing the first image into a plurality of spatial neighborhoods includes:
[0041] Mapping all pixels of the first image to a P-dimensional feature space, where P is a positive integer;
[0042] The first image is divided into a plurality of spatial neighborhoods in the P-dimensional feature space by using a clustering algorithm.
[0043] Exemplarily, the K-means clustering algorithm can be used for category division. 1) First, the image is evenly divided into u initial clusters, and u seed pixels are evenly sampled as the search center of each initial cluster. At the same time, the ten-dimensional feature vector of the u seed pixels is used as the weighted mean of the corresponding initial cluster. Then, in the ten-dimensional feature space, all the remaining pixels in the image are assigned to the initial cluster corresponding to the weighted mean closest to its feature, completing the initial spatial neighborhood division of the image. 2) After the initial spatial neighborhood division, all the pixels assigned to the cluster are used to recalculate the weighted mean of each cluster and update the corresponding search center. Then all pixels are reallocated to the clusters corresponding to each updated weighted mean to complete the update of the spatial neighborhood. Then, iteratively execute the above 1) and 2) until the weighted mean and search center of each cluster no longer change, so as to obtain the image u spatial neighborhoods {Y1,Y2,…,Y u}, which satisfies
[0044] Furthermore, a mapping relationship between spatial neighborhoods and image pixels can be established. For example, u spatial neighborhoods {Y1, Y2, ..., Y u} are homogeneous, that is, the features of the pixels in each spatial neighborhood are similar, so all pixels in each spatial neighborhood can be given a unified label to represent their spatial division relationship. Specifically, all u spatial neighborhoods {Y1,Y2,…,Y u} and all N pixels in the image X={x1,x2,…,x N}The partition mapping relationship in space (the third mapping relationship) is used to indicate the matrix express,
[0045] Step 102: Determine the one-step connected center feature of each spatial neighborhood in the multiple spatial neighborhoods, and construct a first similarity matrix based on the one-step connected center feature of each spatial neighborhood in the multiple spatial neighborhoods; the one-step connected center feature represents the feature of its corresponding spatial neighborhood.
[0046] Since the homogeneity within the divided spatial neighborhood will be affected by the number of spatial neighbors u, that is, when the number of spatial neighbors is small, some spatial neighborhood sizes are not small enough, and there may be a small amount of heterogeneity in the pixels inside, which can be considered as a kind of noise. In order to protect the feature extraction process from the influence of noise and let the neighborhood features be determined by the majority of homogeneous pixels, it is necessary to use a one-step connected center feature extraction method with higher robustness. Exemplarily, the following method is provided for extracting one-step connected center features of spatial neighborhoods: 1) Construct a similarity matrix of pixels in the spatial neighborhood. For u spatial neighborhoods {Y1, Y2, …, Y u}, each spatial neighborhood Y i Contains i pixels. i The similarity between pixels is measured by the Gaussian kernel function: ij =exp(-(x i -x j / σ) 2 )? (4), where σ is the scale adjustment factor parameter. The larger σ is, the stronger the discrimination of the feature difference between two pixels in equation (4) is, that is, two different pixels are more likely to be distinguished. Spatial neighborhood Y i All n i The pairwise similarity of pixels is determined by formula (4) to construct an n i ×n i The similarity matrix of : 2) Given a constant T, determine the one-step connected center of the spatial neighborhood. In the feature space, since the category containing more pixels has a higher density, the pixels in this category will also have a higher connectivity. The connectivity between pixels can be directly described by the power matrix of their similarity matrix, where different power matrices describe the connectivity between pixels at different scales. Therefore, it is necessary to find pixels with higher connectivity in the global scope at a large scale, and their features are used as the one-step connected center features of the spatial neighborhood. Specifically, first give a sufficiently large constant T→∞, and calculate the T-th power of the similarity matrix obtained in substep 1). in, is a matrix The value at the jkth index, same as s jk T to the power of By using formula (6), we can get the matrix describing the T-order connectivity between pixels. Next, we can determine the matrix The rows or columns that satisfy the weak diagonal dominance condition in get the pixel index with higher connectivity: Elements that satisfy formula (7) Its corresponding spatial neighborhood Y i The jth pixel x j , according to the pixel xj The original features in the color space get the spatial neighborhood Y i One-step connected center feature
[0047] Based on this, in an optional implementation manner of the present application, determining the one-step connected center feature of each of the multiple spatial neighborhoods includes:
[0048] Constructing a similarity matrix of pixels in each of the plurality of spatial neighborhoods;
[0049] Determine a plurality of first pixels based on a similarity matrix within each of the plurality of spatial neighborhoods; the plurality of first pixels correspond one-to-one to the plurality of spatial neighborhoods;
[0050] The original feature of each pixel in the plurality of first pixels in the color space is determined as a one-step connected center feature of its corresponding spatial neighborhood.
[0051] The scheme of the present application is highly robust to multiple parameters: the scheme of the present application mainly includes two types of parameters, one is the scale parameter σ introduced when using CCE to construct the similarity matrix, and the other is the parameter u of the number of spatial neighborhoods that needs to be determined when using LSC to divide the spatial neighborhood. The high robustness of the proposed method to the parameter σ is inherent in the CCE method itself. As for the parameter u, the smaller its value, the lower the similarity of the pixels inside the spatial neighborhood divided by LSC (the more heterogeneous), which intuitively affects the subsequent feature clustering results. However, the one-step connected center feature extraction method given in the embodiment of the present application can effectively avoid the influence of heterogeneous pixels, that is, noise, in the spatial neighborhood. Therefore, the proposed method is also highly robust to the parameter u.
[0052] Furthermore, the one-step connected center features {f1,f2,…,f u}, for example, using the Gaussian kernel function w ij =exp(-(f i -f j / σ) 2 ) Determine the similarity w between the spatial neighborhood features ij , and then construct a u×u similarity matrix:
[0053] Step 103: Based on the first similarity matrix, a first feature clustering result is obtained through a connected center evolution (CCE) operation.
[0054] Here, the cluster centers at multiple scales are determined according to the k-order connectivity of the spatial neighborhood features. The k-order connectivity con of the data to be clustered is (k)It is defined as the diagonal element value of the k-th power matrix of the data similarity matrix. Therefore, for the one-step connected center features {f1,f2,…,f u}, each feature f i The k-order connectivity can be expressed by the similarity matrix k-power matrix W k The diagonal elements of are determined by: According to the definition of cluster center in CCE, in the matrix W k In each row or column of , if the diagonal element is the largest in the row or column, the data corresponding to the index position of the row or column is a k-order cluster center. Therefore, for the similarity matrix and its power matrix W constructed by the spatial neighborhood features k , if the feature f i Satisfaction:con (k) (f i ,f i )>con (k) (f i ,f j ),j=1,…,u(j≠i)(10), then the feature f i Determine a k-order cluster center for all u spatial neighborhood features Then, all m k-order cluster centers of the spatial neighborhood features are determined by formula (10): Multiple similarity matrices W at different powers k k There will be multiple different rows or columns whose diagonal elements are the largest. Therefore, from different power matrices W k The cluster centers of each order and the number of cluster centers determined in are also different. A large number of cluster centers corresponds to a small observation scale, and a small number of cluster centers corresponds to a large observation scale. t (k1<k t )Continuously iterate the size of the similarity matrix power to obtain the similarity matrix under each power Then we can get the cluster centers at multiple scales. Where m1>m t .
[0055] Furthermore, the distribution of non-cluster centers at each scale is determined based on the k-order relative connectivity of the spatial neighborhood features. After determining the cluster centers of the spatial neighborhood features at multiple scales, the distribution of non-cluster center points is determined at each scale based on the definition of k-order relative connectivity in CCE: in, When the similarity matrix power is k, the non-cluster center f j Relative to the cluster center c i (k)The k-order relative connectivity of . The non-clustering centers f at each scale are converted into j Assigned to the cluster center c with the largest relative connectivity * k). Then all u spatial neighborhood features {f1,f2,…,f u} is divided into m clusters According to the number of target categories, from m clusters The feature clustering results that meet the number of categories are selected to form a feature clustering result set, and the first feature clustering result is determined from the feature clustering result set based on the Ncut indicator.
[0056] Based on this, in an optional implementation manner of the present application, obtaining a first feature clustering result through a connected center evolution CCE operation based on the first similarity matrix includes:
[0057] Processing the first similarity matrix through a CCE operation to obtain multiple feature clustering results of the multiple spatial neighborhoods at multiple scales;
[0058] Determining a feature clustering result set based on the number of target categories; the feature clustering result set includes one or more feature clustering results that meet the target category among the multiple feature clustering results;
[0059] The first feature clustering result is determined from the feature clustering result set based on the Ncut indicator.
[0060] Specifically, it is necessary to meet the requirements of m in multiple i =m opt The clustering result of A more reasonable result is determined in opt is the number of target categories. The rationality of the clustering result is measured by calculating the Ncut index of the clustering result:
[0061]
[0062]
[0063] in, yes exist The complement of ij is the spatial neighborhood feature f i and f j The similarity is determined by the Gaussian kernel function. Specifically, the smaller the Ncut index value, the higher the similarity of the elements within each cluster, the lower the similarity between the elements between clusters, and the more reasonable the partitioning result. Therefore, by calculating the Ncut index value of each cluster partitioning result, the result corresponding to the minimum Ncut index value is selected. As the final spatial neighborhood feature clustering result, that is, the first feature clustering result.
[0064] In actual application, the number of target categories can be a preset value, or can be determined by the number of elements in the feature clustering result set and the number of cluster centers contained in each feature clustering result in the feature clustering result set.
[0065] For example, due to There are multiple sets of cluster centers with different numbers, and then There are multiple groups of cluster division results with different numbers of categories. In order to finally obtain a unique set of cluster divisions, i.e. clustering results, two results need to be determined in sequence: first, a reasonable number of categories m needs to be determined. opt , then you need to satisfy m i =m opt Determine a more reasonable result from the cluster division results. For example, in, is the set of cluster centers The number of elements contained in is the number of cluster centers; the cluster center set The number of cluster centers contained is expressed as a set but Representing a collection Medium Element Frequency of occurrence.
[0066] Based on this, in an optional implementation manner of the present application, if the number of target categories is not a preset value, the method further includes:
[0067] The number of target categories is determined based on the number of elements in the feature clustering result set and the number of cluster centers contained in each feature clustering result in the feature clustering result set.
[0068] Step 104: Map the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image.
[0069] In an optional implementation manner of the present application, mapping the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image includes:
[0070] Establishing a first mapping relationship between each cluster in the first feature clustering result and a one-step connected center feature of each spatial neighborhood in the plurality of spatial neighborhoods;
[0071] Establishing a second mapping relationship between a one-step connected center feature of each of the plurality of spatial neighborhoods and each of the plurality of spatial neighborhoods;
[0072] Establishing a third mapping relationship between each spatial neighborhood in the plurality of spatial neighborhoods and each pixel in the first image;
[0073] Based on the first mapping relationship, the second mapping relationship and the third mapping relationship, the first feature clustering result is mapped to all pixels of the first image to obtain an image clustering result of the first image.
[0074] Here, all spatial neighborhood features are given a label to indicate their division relationship in terms of features. Specifically, the first feature clustering result is all m opt Cluster and all u spatial neighborhood features {f1,f2,…,f u} partition mapping relationship (first mapping relationship), indicated by the matrix express: According to all u spatial neighborhoods {Y1,Y2,…,Y u} and each spatial neighborhood one-step connected central feature {f1,f2,…,f u} (the second mapping relationship), and the indicator matrix in the form of a unit matrix is obtained According to all N pixels of the image {x1,x2,…,x N} and all u spatial neighborhoods {Y1,Y2,…,Y u} mapping relationship (third mapping relationship), and obtain the indicator matrix According to the first mapping relationship, the second mapping relationship and the third mapping relationship, all N pixels {x1, x2, ..., x N} and finally m opt Cluster division results The mapping relationship is: Label (k) =PIH (k) =PH (k) (16), where The category labels of all pixels in the image are given as the final clustering result output of the image.
[0075] Exemplary, reference Figure 2 , Figure 2 Schematic diagram of the implementation process of the image clustering method provided in the embodiment of the present application Figure 2 .like Figure 2 As shown, the following steps are included:
[0076] Step 201: Divide the image into multiple homogeneous small areas (corresponding to spatial neighborhoods) in space according to LSC.
[0077] Step 202: Extract one-step connected center features of all small regions.
[0078] Step 203: construct a similarity matrix based on the one-step connected center feature.
[0079] Step 204: Iterate the similarity matrix power according to CCE to find multiple clustering results at multiple scales.
[0080] Step 205: Is there any category number input?
[0081] Determine whether there is human input for the number of categories. If there is human input, use the input value as the target number of categories. If there is no human input, solve the target number of categories.
[0082] Step 206: Calculate the Ncut value of all clustering results under the target number of categories, take the minimum Ncut value as the feature clustering result, and obtain the small area category label.
[0083] Step 207: Map the small region category label to all pixels of the image.
[0084] In order to better understand the technical solution of the present application, the following is an illustration and steps for illustrative purposes. Figure 3 , Figure 3 Schematic diagram of the implementation process of the image clustering method provided in the embodiment of the present application Figure 3 .like Figure 3 As shown, the following steps are included:
[0085] Step 301: Divide the image into multiple homogeneous small areas (corresponding to spatial neighborhoods) in space according to LSC.
[0086] For the input color image, the image is spatially divided into u=9 spatial neighborhoods {Y1, Y2,…, Y9} according to LSC.
[0087] Step 302: Extract one-step connected center features of all small regions.
[0088] The one-step connected center features {f1,f2,…,f9} of the {Y1,Y2,…,Y9} cells are calculated.
[0089] Step 303: construct a similarity matrix based on the one-step connected center feature.
[0090] Construct a similarity matrix based on 9 features {f1,f2,…,f9}
[0091] Step 304: Iterate the similarity matrix power according to CCE to find multiple clustering results at multiple scales.
[0092] like Figure 3 As shown, different clusters in the matrix are divided by boxes with different grayscale and rough boundaries.
[0093] Step 305: Is there any category number input?
[0094] In this embodiment, there is no category number input, and the target category number is calculated to obtain the optimal category number m opt =2.
[0095] Step 306: Obtain the clustering result corresponding to the minimum Ncut value.
[0096] Calculate the Ncut value of all clustering results under the target category number, take the minimum Ncut value as the feature clustering result, and obtain the small area category label.
[0097] Calculate m opt =2, that is, all Ncut indicators containing two types of cluster partition clustering results, obtain a unique set of spatial neighborhood feature labels.
[0098] Step 307: Map the small region category label to all pixels of the image.
[0099] Map the spatial neighborhood feature labels to all pixels of the image to obtain the final image clustering result.
[0100] It should be noted that the specific implementation of steps 201 to 207 and steps 301 to 307 can be understood by referring to the description in the aforementioned embodiments, and will not be repeated here.
[0101] The image clustering method provided in the embodiment of the present application can process large-scale images: the number of spatial neighborhoods obtained based on LSC is far less than the total number of pixels in the image. Therefore, compared with clustering with the features of all pixels, clustering with the features of a small number of spatial neighborhood objects will have lower spatial complexity, so that the improved connected center evolution method has the ability to process large-size images. And the spatial information and feature information of image pixels can be used at the same time: the division of spatial neighborhoods represents the introduction of the spatial neighborhood information of pixels, and the one-step connected center feature extraction of the spatial neighborhood further introduces feature information. In addition, compared with traditional image clustering methods, the proposed method does not require artificial input of the number of categories.
[0102] The present application embodiment also provides an image clustering device 400, referring to Figure 4 The image clustering device 400 in this embodiment includes:
[0103] Processing unit 410: used to divide the first image into a plurality of spatial neighborhoods; wherein pixels in the same spatial neighborhood are homogeneous;
[0104] The processing unit 410 is further configured to determine a one-step connected center feature of each of the multiple spatial neighborhoods, and construct a first similarity matrix based on the one-step connected center feature of each of the multiple spatial neighborhoods; the one-step connected center feature represents a feature of the corresponding spatial neighborhood;
[0105] The processing unit 410 is further configured to obtain a first feature clustering result through a connected center evolution (CCE) operation based on the first similarity matrix;
[0106] The processing unit 410 is further configured to map the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image.
[0107] In the embodiment of the present application, the processing unit 410 is used to map all pixels of the first image to a P-dimensional feature space; P is a positive integer; and divide the first image into multiple spatial neighborhoods in the P-dimensional feature space through a clustering algorithm.
[0108] In an embodiment of the present application, the processing unit 410 is used to construct a similarity matrix of pixels in each of the multiple spatial neighborhoods; determine multiple first pixels based on the similarity matrix in each of the multiple spatial neighborhoods; the multiple first pixels correspond one-to-one to the multiple spatial neighborhoods; and determine that the original features of each pixel in the multiple first pixels in the color space are the one-step connected center features of the corresponding spatial neighborhood.
[0109] In an embodiment of the present application, the processing unit 410 is used to process the first similarity matrix through a CCE operation to obtain multiple feature clustering results of the multiple spatial fields at multiple scales; determine a feature clustering result set based on the number of target categories; the feature clustering result set includes one or more feature clustering results that meet the target category among multiple feature clustering results; and determine the first feature clustering result from the feature clustering result set based on the Ncut indicator.
[0110] In an embodiment of the present application, the processing unit 410 is used to determine the number of target categories based on the number of elements in the feature clustering result set and the number of clustering centers contained in each feature clustering result in the feature clustering result set if the number of target categories is not a preset value.
[0111] In an embodiment of the present application, the processing unit 410 is used to establish a first mapping relationship between each cluster in the first feature clustering result and the one-step connected central feature of each spatial neighborhood in the multiple spatial neighborhoods; establish a second mapping relationship between the one-step connected central feature of each spatial neighborhood in the multiple spatial neighborhoods and each spatial neighborhood in the multiple spatial neighborhoods; establish a third mapping relationship between each spatial neighborhood in the multiple spatial neighborhoods and each pixel in the first image; based on the first mapping relationship, the second mapping relationship and the third mapping relationship, map the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image.
[0112] Those skilled in the art should understand that Figure 4 The implementation functions of each unit in the image clustering device 400 shown can be understood by referring to the relevant description of the aforementioned method. Figure 4 The functions of the various units in the image clustering device 400 shown may be implemented by a program running on a processor, or may be implemented by a specific logic circuit.
[0113] Figure 5 It is a schematic structural diagram of an electronic device 500 provided in an embodiment of the present application. Figure 5 The electronic device 500 shown includes a processor 510, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0114] Alternatively, if Figure 5 As shown, the electronic device 500 may further include a memory 520. The processor 510 may call and run a computer program from the memory 520 to implement the method in the embodiment of the present application.
[0115] The memory 520 may be a separate device independent of the processor 510 , or may be integrated into the processor 510 .
[0116] Alternatively, if Figure 5 As shown, the electronic device 500 may further include a transceiver 530, and the processor 510 may control the transceiver 530 to communicate with other devices, specifically, may send information or data to other devices, or receive information or data sent by other devices.
[0117] The transceiver 530 may include a transmitter and a receiver. The transceiver 530 may further include an antenna, and the number of the antennas may be one or more.
[0118] The electronic device 500 may specifically be the image clustering device 400 of the embodiment of the present application, and the electronic device 500 may implement the corresponding processes implemented by the image clustering device 400 in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity.
[0119] Exemplarily, an embodiment of the present application further provides a computer program product, including a computer program, which can be executed by the processor 510 of the communication device 500 to complete the steps of any of the aforementioned methods.
[0120] Figure 6 It is a schematic structural diagram of the chip of an embodiment of the present application. Figure 6 The chip 600 shown includes a processor 610, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0121] Alternatively, if Figure 6 As shown, the chip 600 may further include a memory 620. The processor 610 may call and run a computer program from the memory 620 to implement the method in the embodiment of the present application.
[0122] The memory 620 may be a separate device independent of the processor 610 , or may be integrated into the processor 610 .
[0123] Optionally, the chip 600 may further include an input interface 630. The processor 610 may control the input interface 630 to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.
[0124] Optionally, the chip 600 may further include an output interface 640. The processor 610 may control the output interface 640 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.
[0125] The chip can be applied to the image clustering device 400 in the embodiment of the present application, and the chip can implement the corresponding processes implemented by the image clustering device 400 in each method of the embodiment of the present application, which will not be described here for the sake of brevity.
[0126] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0127] It should be understood that the processor of the embodiment of the present application may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and performed. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, and other mature storage media in the art. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0128] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0129] It should be understood that the above-mentioned memory is exemplary but not restrictive. For example, the memory in the embodiments of the present application may also be static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is to say, the memory in the embodiments of the present application is intended to include but not limited to these and any other suitable types of memory.
[0130] The embodiment of the present application also provides a computer-readable storage medium for storing a computer program. The computer-readable storage medium can be applied to the image clustering device 400 in the embodiment of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the image clustering device 400 in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity.
[0131] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0133] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0135] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0136] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or an image clustering device 400, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory,) ROM, random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0137] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. An image clustering method, It is characterized in that include: Dividing the first image into a plurality of spatial neighborhoods; wherein pixels in the same spatial neighborhood are homogeneous; Determine a one-step connected center feature of each of the multiple spatial neighborhoods, and construct a first similarity matrix based on the one-step connected center feature of each of the multiple spatial neighborhoods; the one-step connected center feature represents a feature of the corresponding spatial neighborhood; Based on the first similarity matrix, obtaining a first feature clustering result through a connected center evolution (CCE) operation; The first feature clustering result is mapped to all pixels of the first image to obtain an image clustering result of the first image.
2. The method according to claim 1, It is characterized in that The step of dividing the first image into a plurality of spatial neighborhoods comprises: Mapping all pixels of the first image to a P-dimensional feature space, where P is a positive integer; The first image is divided into a plurality of spatial neighborhoods in the P-dimensional feature space by using a clustering algorithm.
3. The method according to claim 2, It is characterized in that The step of determining the one-step connected center feature of each of the plurality of spatial neighborhoods comprises: Constructing a similarity matrix of pixels in each of the plurality of spatial neighborhoods; Determine a plurality of first pixels based on a similarity matrix within each of the plurality of spatial neighborhoods; the plurality of first pixels correspond one-to-one to the plurality of spatial neighborhoods; The original feature of each pixel in the plurality of first pixels in the color space is determined as a one-step connected center feature of its corresponding spatial neighborhood.
4. The method according to claim 3, It is characterized in that The obtaining a first feature clustering result through a connected center evolution (CCE) operation based on the first similarity matrix includes: Processing the first similarity matrix through a CCE operation to obtain multiple feature clustering results of the multiple spatial neighborhoods at multiple scales; Determining a feature clustering result set based on the number of target categories; the feature clustering result set includes one or more feature clustering results that meet the target category among the multiple feature clustering results; The first feature clustering result is determined from the feature clustering result set based on the Ncut indicator.
5. The method according to claim 4, It is characterized in that If the number of target categories is not a preset value, the method further includes: The number of target categories is determined based on the number of elements in the feature clustering result set and the number of cluster centers contained in each feature clustering result in the feature clustering result set.
6. The method according to any one of claims 1 to 5, It is characterized in that Mapping the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image includes: Establishing a first mapping relationship between each cluster in the first feature clustering result and a one-step connected center feature of each spatial neighborhood in the plurality of spatial neighborhoods; Establishing a second mapping relationship between a one-step connected center feature of each of the plurality of spatial neighborhoods and each of the plurality of spatial neighborhoods; Establishing a third mapping relationship between each spatial neighborhood in the plurality of spatial neighborhoods and each pixel in the first image; Based on the first mapping relationship, the second mapping relationship and the third mapping relationship, the first feature clustering result is mapped to all pixels of the first image to obtain an image clustering result of the first image.
7. An image clustering device, It is characterized in that include: A processing unit: used for dividing the first image into a plurality of spatial neighborhoods; wherein pixels in the same spatial neighborhood are homogeneous; The processing unit is further configured to determine a one-step connected center feature of each of the multiple spatial neighborhoods, and construct a first similarity matrix based on the one-step connected center feature of each of the multiple spatial neighborhoods; the one-step connected center feature represents a feature of the corresponding spatial neighborhood; The processing unit is further configured to obtain a first feature clustering result through a connected center evolution (CCE) operation based on the first similarity matrix; The processing unit is further used to map the first feature clustering result to all pixels of the first image to obtain an image clustering result of the first image.
8. An electronic device, It is characterized in that include: A processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory to execute the image clustering method according to any one of claims 1 to 6.
9. A chip, It is characterized in that include: A processor, used for calling and running a computer program from a memory, so that a device equipped with the chip executes the image clustering method according to any one of claims 1 to 6.
10. A computer-readable storage medium, It is characterized in that Used to store a computer program, wherein the computer program enables a computer to execute the image clustering method according to any one of claims 1 to 6.
11. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the computer program implements the image clustering method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Image clustering method based on matrix
CN112784859A
Automatic nuclei segmentation in histopathology images
US20190042826A1
