An image clustering method, device, electronic equipment and storage medium
By constructing a node similarity matrix and calculating the distance metric between a node and its neighboring nodes, the problem of poor recognition performance for clusters with small sample sizes or high sparsity in existing technologies is solved, achieving better image clustering results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING LONGZHI DIGITAL TECH CO LTD
- Filing Date
- 2023-03-01
- Publication Date
- 2026-05-08
AI Technical Summary
Existing image clustering methods perform poorly in identifying clusters with a small number of samples or high sparsity.
By acquiring multiple images to be clustered as graph nodes, node feature information is extracted, a node similarity matrix is constructed, and the distance metric between graph nodes and their neighboring nodes is calculated. Clustering is then performed based on the distance metric.
It effectively alleviates the problem of high sparsity or small sample size within clusters, and improves the clustering effect of clusters with small sample size or high sparsity.
Smart Images

Figure CN116246086B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to an image clustering method, apparatus, electronic device, and storage medium. Background Technology
[0002] Clustering is a fundamental and effective tool for processing large-scale unlabeled data, and image clustering is a basic task in image analysis with wide applications in image recognition, retrieval, and management.
[0003] Currently, how to improve the recognition of clusters with a small number of samples or high sparsity has become the core challenge of current image clustering algorithms.
[0004] However, existing image clustering methods generally perform poorly in identifying clusters with a small number of samples or high sparsity. Summary of the Invention
[0005] In view of this, the present disclosure provides an image clustering method, apparatus, electronic device and storage medium to solve the problem that the recognition effect of clusters with a small number of samples or high sparsity is generally poor in the prior art.
[0006] A first aspect of this disclosure provides an image clustering method, including:
[0007] Obtain multiple images to be clustered, where each image to be clustered is a graph node;
[0008] Extract the node feature information of each of the graph nodes;
[0009] Based on the node feature information, construct a node similarity matrix;
[0010] Based on the node similarity matrix, calculate the distance metric between each graph node and other graph nodes;
[0011] The images in the dataset to be clustered are classified according to the distance metric to obtain at least one cluster.
[0012] A second aspect of this disclosure provides an image clustering apparatus, comprising:
[0013] The acquisition module is configured to acquire multiple images to be clustered, where each image to be clustered is a graph node;
[0014] The extraction module is configured to extract node feature information for each of the graph nodes;
[0015] The construction module is configured to construct a node similarity matrix based on the node feature information;
[0016] The calculation module is configured to calculate the distance metric between each graph node and other graph nodes based on the node similarity matrix.
[0017] The classification module is configured to classify the images to be clustered in the image dataset according to the distance metric value, so as to obtain at least one cluster.
[0018] A third aspect of this disclosure 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 steps of the method described above.
[0019] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0020] Compared with the prior art, the beneficial effects of this disclosed embodiment include at least the following: by acquiring multiple images to be clustered, each image to be clustered is a graph node; extracting node feature information of each graph node; constructing a node similarity matrix based on the node feature information; calculating the distance metric between each graph node and other graph nodes based on the node similarity matrix; and classifying the images to be clustered in the image dataset to be clustered according to the distance metric to obtain at least one cluster. This can effectively alleviate the problem of high sparsity or small sample size within a cluster, and has a better clustering effect for clusters with small sample size or high sparsity. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart illustrating an image clustering method provided in an embodiment of this disclosure;
[0023] Figure 2 This is a schematic diagram of the point-edge connection structure of a graph node in an image clustering method provided in this disclosure embodiment;
[0024] Figure 3 Based on Figure 2 A schematic diagram of the sparse symmetric adjacency matrix A obtained by constructing the node-edge connection relationship structure of the graph nodes;
[0025] Figure 4 Based on Figure 2 and 3 The constructed degree matrix D A schematic diagram;
[0026] Figure 5 It is by Figure 3 Transformation of sparse symmetric adjacency matrix into matrix A schematic diagram of the conversion process;
[0027] Figure 6 It is by Figure 5 matrix Convert to matrix A schematic diagram of the conversion process;
[0028] Figure 7 This is a schematic diagram of the structure of an image clustering device provided in an embodiment of this disclosure;
[0029] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0030] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will understand that this disclosure may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this disclosure with unnecessary detail.
[0031] An image clustering method and apparatus according to embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings.
[0032] Figure 1 This is a flowchart illustrating an image clustering method provided in an embodiment of this disclosure. Figure 1 Image clustering methods can be executed by a server. For example... Figure 1 As shown, this image clustering method may specifically include:
[0033] Step S101: Obtain multiple images to be clustered, where each image to be clustered is a graph node.
[0034] Specifically, the images to be clustered can be pictures / images / photos / video frames captured by users using mobile phones, computers, or other shooting devices. For example, they can be pictures of people, animals, landscapes, etc. The images to be clustered can also be publicly available pictures / images / photos / video frames from the internet. Here, video frames typically refer to image frames obtained by segmenting a captured video stream (such as a video stream captured by video surveillance equipment), or images captured by a snapshot system (such as vehicle images).
[0035] To facilitate clustering, an image to be clustered can be initialized as a graph node. For example, if there are 100 images to be clustered, these 100 images can be initialized as 100 graph nodes, with one graph node corresponding to one image.
[0036] Step S102: Extract the node feature information of each graph node.
[0037] Specifically, commonly used image feature extraction networks can be used, such as... CNN (Convolutional Neural Networks) and other methods are used to extract the node feature information (i.e., the image feature information corresponding to each image to be clustered) for each graph node. The node feature information may include one or more of the following: key point coordinates, color features, texture features, shape features, and spatial relationship features of the image to be clustered corresponding to that graph node.
[0038] In one embodiment, there is provided N Given x images to be clustered, each image is initialized with a graph node. N For each graph node, an image feature extraction network (such as a convolutional neural network) is used to extract the node feature information of each graph node. F Each graph node has d A dimensional attribute vector, then .
[0039] Step S103: Construct a node similarity matrix based on the node feature information.
[0040] In some embodiments, step S103 may specifically include:
[0041] Based on the association relationships between the graph nodes, the node feature information of each graph node is updated to obtain the updated node feature information of each graph node.
[0042] Based on the updated node feature information, a node similarity matrix is constructed.
[0043] Specifically, based on the association relationships between the graph nodes, the node feature information of each graph node is updated to obtain the updated node feature information of each graph node. Specifically, this can be done by: constructing a sparse symmetric adjacency matrix based on the association relationships between the graph nodes; determining the neighboring nodes of each graph node based on the sparse symmetric adjacency matrix; aggregating the original node feature information of the graph node and the node feature information of its neighboring graph nodes, and overwriting the original node feature information of the graph node with the aggregated updated node feature information.
[0044] As an example, suppose there are 5 images to be clustered ( N First, initialize the five images to be clustered (i.e., 5), resulting in five graph nodes labeled a, b, c, d, and e. Then, extract the node feature information (i.e., image feature information) of the corresponding images to be clustered using an image feature extraction network. Next, based on the association relationships between the graph nodes (i.e., whether there is an association between the graph nodes), initialize the associated nodes to 1 and the unassociated nodes to 0, thereby constructing a sparse symmetric adjacency matrix.
[0045] For example, if the point-edge connection structure of the above 5 graph nodes is as follows: Figure 2 As shown, then according to Figure 2 The connection relationships shown can be initialized by setting each graph node associated with itself to 1 and unassociated nodes to 0, thereby constructing a graph like this. Figure 3 The sparse symmetric adjacency matrix A shown is, i.e. The neighboring nodes of each graph node can be determined using this sparse symmetric adjacency matrix A. Taking graph node a as an example, from... Figure 3 From the sparse symmetric adjacency matrix A, it can be seen that the graph nodes (neighboring nodes) associated with graph node a include graph node e. Taking graph node b as an example, from... Figure 3 As can be seen from the sparse symmetric adjacency matrix A, the graph nodes (neighboring nodes) associated with graph node b include graph node d and graph node e.
[0046] Typically, the expressive power of a single graph node's node feature information is limited. Clustering based solely on the node's own node feature information is easily affected by noise. This embodiment of the present disclosure aggregates the original node feature information of each graph node with the node feature information of its neighboring nodes (i.e., aggregating the node feature information of neighboring nodes and connecting it to the anchor feature), fully considering the nodes near each graph node. This allows each graph node to better perceive the relationship between itself and its surrounding nodes, thereby encoding more information and resulting in better feature representation for each graph node, which is beneficial for improving subsequent image clustering results.
[0047] As an example, graph convolutional networks (PCNNs) can be used. GCN The node feature information of each graph node is passed and aggregated to obtain the updated node feature information of each graph node. Specifically, the above sparse symmetric adjacency matrix and the node feature information of each graph node can be input into a graph convolutional network (PCNN). GCNThe process is performed on graph node b to obtain the updated node feature information for each graph node. The updated node feature information includes the original node feature information of the graph node itself and the node feature information of its neighboring nodes. Taking graph node b as an example, the updated node feature information of graph node b obtained by the above method includes the original node feature information of graph node b itself as well as the node feature information of graph nodes d and e (i.e., the neighboring nodes of graph node b).
[0048] Similarly, the updated node feature information for graph nodes a, c, d, and e can be obtained using the method described above.
[0049] In one embodiment, the updated node feature information of each graph node can be calculated according to the following formula (1). F' .
[0050] (1).
[0051] Wherein, in equation (1) F This represents the input node feature information. , I It is a unit diagonal matrix. It is a diagonalized degree matrix. , i The row index value of the matrix indicates the row number. i Each graph node j Here, represents the column index value of the matrix, and W represents the learning parameter. (·) represents a non-linear activation function, such as ReLU Activation function.
[0052] As an example, combined with Figure 2 and Figure 3 It is possible to construct such as Figure 4 The degree matrix shown D ,Right now degree matrix D This indicates how many graph nodes are associated with each graph node. For example, from this degree matrix... D The first line shows that graph node a is associated with 1 graph node; the second line shows that graph node b is associated with 2 graph nodes; and the third line shows that graph node c is associated with 2 graph nodes.
[0053] In the above example, combined Figure 5 identity diagonal matrix I am For sparse symmetric adjacency matrices A for and the unit diagonal matrix I By adding them together, we can obtain a matrix. Combining Figure 6 , by matrix The matrix can be obtained through matrix transformation. ,Right now From the matrix ,Right now This shows the number of nodes in each graph node itself and its neighboring nodes. Taking graph node a as an example, from the matrix... It can be seen from the graph that node a, including itself and its neighbors, has 2 nodes. Taking node b as an example, from the matrix... As can be seen from the graph, node b has 3 nodes, including itself and its neighboring nodes.
[0054] In some embodiments, a node similarity matrix is constructed based on the updated node feature information, specifically:
[0055] Calculate the similarity between the updated node feature information of each graph node and the updated node feature information of its neighboring graph nodes;
[0056] Based on the aforementioned similarity, a node similarity matrix is constructed.
[0057] Specifically, a fully connected neural network and the sigmoid function can be used to calculate the similarity between the updated node feature information of each graph node and the updated node feature information of its neighboring nodes, and a node similarity matrix can be constructed from the calculated similarity between each graph node and its neighboring nodes.
[0058] In this embodiment of the disclosure, the similarity between each graph node and its neighboring nodes can be calculated according to the following formula (2). S .
[0059] (2).
[0060] In equation (2), N i For the first i Each graph node For the first i The corresponding graph node is the first j 1 neighboring node, j=1,…,K ( K ≤N , N (The total number of all graph nodes). fc(·) Represents the fully connected layer function. relu (·) denotes a non-linear activation function. sigmod (·) represents the sigmod function.
[0061] The sigmod function in formula (2) above can normalize the similarity between each graph node and its neighboring nodes to a value between 0 and 1.
[0062] by Figure 2 Taking the five graph nodes a, b, c, d, and e as an example, the similarity between each graph node and its neighboring nodes can be calculated using the algorithm formula (2) in the fully connected neural network and sigmoid module. The similarity between each graph node and itself is 1, and the similarity between each graph node and its non-neighboring nodes is 0. The similarity between each graph node and its neighboring nodes can be directly represented by the calculated function value, which is a decimal greater than 0 and less than 1. Furthermore, a node similarity matrix is constructed accordingly. In this node similarity matrix, ae represents the similarity between graph node a and graph node e, bd represents the similarity between graph node b and graph node d, be represents the similarity between graph node b and graph node e, and so on, with ed representing the similarity between graph node e and graph node d.
[0063] Step S104: Based on the node similarity matrix, calculate the distance metric between each graph node and other graph nodes.
[0064] In some embodiments, step S104 may specifically include:
[0065] Determine the first i The graph node and the first Ni The common neighbor nodes of a graph node, among which... i for 1~N positive integers, N This represents the total number of all graph nodes.
[0066] Based on the common neighbor nodes and the node similarity matrix, calculate the first... i The graph node and the first Ni Distance metric between nodes in a graph.
[0067] Public neighbor nodes refer to the nodes that are the first... i The graph node and the first Ni A node in a graph has the same neighboring nodes. For example, in Figure 2 Among the five graph nodes a, b, c, d, and e shown ( N =5), respectively corresponding to i=1,2,3,4,5 , No. i (i=1) The graph node is graph node a, the th graph node. Ni (Right now j =2,3,4,5) graph nodes are graph nodes b, c, d, and e. Taking graph nodes a and b as an example, the neighboring nodes of graph node a include graph node e, and the neighboring nodes of graph node b include graph nodes d and e. Therefore, the common neighbor of graph nodes a and b is graph node e.
[0068] Next, the distance metric between graph node a and graph node b can be calculated based on the common neighbor nodes of graph node a and graph node b and the node similarity matrix in step S103 above.
[0069] set up Represents graph nodes i Graph Nodes j (j=Ni) The common neighborhood (i.e., common neighbor nodes) of the K nearest neighbors, where, Indicates the first i All neighboring nodes (i.e., nodes of the same category) of a graph node; Indicates the first j All neighboring nodes of a graph node. Then the graph node... i With graph nodes j The distance can be transformed into the distance between graph nodes. i Neighbor nodes and graph nodes j The similarity between neighboring nodes and their common neighboring nodes is represented by a distance metric (a measure of relevance).
[0070] In some embodiments, the first node is calculated based on the public neighbor nodes and the node similarity matrix. i The graph node and the first Ni The distance metric between graph nodes can specifically include:
[0071] Based on the node similarity matrix, determine the first... i The first similarity between a graph node and its common neighbor node, the first... Ni The second similarity between each graph node and its common neighbor nodes;
[0072] Based on the first similarity and the second similarity, calculate the first... i The graph node and the first Ni Distance metric between nodes in a graph.
[0073] Specifically, the first step can be calculated according to the following formula (3). i The graph node and the first Ni (Right now j Distance metric between graph nodes .
[0074] (3).
[0075] In equation (3), The value is a graph node. i Graph Nodes j The index value of the public neighbor node, The node similarity matrix constructed in step S103 above is the first node in the matrix. i Row (corresponding graph node)i The index value of the index, and the first similarity corresponding to the o-th column; The node similarity matrix constructed in step S103 above is the first node in the matrix. j Row (corresponding graph node) j (index value), and the second similarity corresponding to the o-th column.
[0076] Generally, if two graph nodes belong to the same category, they will inevitably have many common neighbor nodes, and their similarity will be high. Therefore, the sum of their similarity scores will be larger. By subtracting the sum of their similarity scores from 1, we can obtain the distance metric between the two graph nodes. (The more similar they are, the smaller their distance, so we need to subtract this value from 1). In other words, the smaller the distance metric between two graph nodes, the greater the likelihood that they belong to the same category.
[0077] As an example, take graph node a ( i =1) and graph node b ( j Taking (=2) as an example, their common neighbor node is graph node e, with a corresponding index value of 5. Based on the above node similarity matrix The similarity between graph node a and its common neighbor node (graph node e) can be determined. (Right now Let a be the similarity between graph node b and its common neighbor node (graph node e). (Right now Let be the distance between node a and node b. Then, substitute these values into formula (3) to obtain the distance metric between node a and node b. .
[0078] Similarly, the distance metric between graph node a and graph nodes c, d, and e can be calculated using the same method as the distance metric between graph node a and graph node b, and will not be repeated here.
[0079] Traditional image clustering methods, such as Euclidean distance, achieve good clustering results with smaller distances between nodes compared to dense clusters. However, for sparse clusters, the distances between nodes are larger, making it difficult to find a suitable distance threshold for clustering, resulting in poor clustering performance. In contrast to traditional distance calculation methods, this embodiment of the present disclosure uses statistical analysis of the correlation (similarity) between neighboring nodes of each graph node, without using the distance between nodes. This effectively alleviates the problem of data sparsity and provides better clustering results for clusters with small sample sizes or high sparsity.
[0080] Step S105: Classify the images to be clustered in the image dataset according to the distance metric value to obtain at least one cluster.
[0081] In some embodiments, step S105 may specifically include:
[0082] Compare the first i The graph node and the first Ni The distance metric between each graph node and the preset metric threshold;
[0083] The first one whose distance metric value is less than a preset metric threshold i The graph node and the first Ni Each graph node is grouped into the same category, resulting in a cluster.
[0084] As an example, when i=1 Then, based on the above steps, the distance metric between the first graph node and the second, third, fourth, and fifth graph nodes can be calculated. , , and Using the example above, compare the distance metrics between graph node a and graph node b. Distance metric between graph node a and graph node c Distance metric between graph node a and graph node d Distance metric between graph node a and graph node e And the size of the preset metric threshold. The distance metric value less than the preset metric threshold is... i The graph node and the first Ni If graph nodes are grouped into the same category, at least one cluster is obtained. For example, if the distance metric between graph node a and graph node b is... Distance metric between graph node a and graph node c All are less than the preset measurement threshold (which can be flexibly set according to actual conditions), while the distance measurement value between graph node a and graph node d Distance metric between graph node a and graph node e If all three nodes are less than the preset metric threshold, then graph node a, graph node b, and graph node c can be classified into the same category, forming a cluster.
[0085] For graph nodes d and e that do not form a cluster with graph nodes a, b, and c, the distance metric between graph node d and graph node e can be calculated using the method described above. And determine whether they can be classified into the same category, forming a cluster.
[0086] It should be noted that the number of clusters obtained varies depending on the preset metric threshold.1~N indivual, N The total number of images to be clustered.
[0087] The technical solution provided in this disclosure, on the one hand, updates the node feature information of each graph node according to the association relationships between each graph node, thereby obtaining a more robust node feature representation. On the other hand, by constructing a node similarity matrix based on the updated node feature information, and then calculating the distance metric between each graph node and other graph nodes based on this node similarity matrix, the distance metric used in this disclosure is based on the correlation between a graph node and its neighboring nodes, rather than the distance between nodes, which can effectively alleviate the problem of data sparsity and greatly improve the clustering effect of clusters with small sample sizes or high sparsity.
[0088] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.
[0089] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.
[0090] Figure 7 This is a schematic diagram of an image clustering device provided in an embodiment of this disclosure. Figure 7 As shown, the image clustering device includes:
[0091] The acquisition module 701 is configured to acquire multiple images to be clustered, wherein each image to be clustered is a graph node;
[0092] Extraction module 702 is configured to extract node feature information for each of the graph nodes;
[0093] The construction module 703 is configured to construct a node similarity matrix based on the node feature information;
[0094] The calculation module 704 is configured to calculate the distance metric between each graph node and other graph nodes based on the node similarity matrix.
[0095] The classification module 705 is configured to classify the images to be clustered in the image dataset according to the distance metric value to obtain at least one cluster.
[0096] In some embodiments, the above-described construction module 703 may specifically include:
[0097] The update unit is configured to update the node feature information of each graph node according to the association relationship between each graph node, so as to obtain the updated node feature information of each graph node.
[0098] The construction unit is configured to construct a node similarity matrix based on the updated node feature information.
[0099] In some embodiments, the above-mentioned updating unit may specifically include:
[0100] The building component is configured to construct a sparse symmetric adjacency matrix based on the association relationships between the graph nodes.
[0101] The component is configured to determine the neighboring nodes of each of the graph nodes based on the sparse symmetric adjacency matrix.
[0102] The update component is configured to aggregate the original node feature information of the graph node and the node feature information of its neighboring graph nodes, and to overwrite the original node feature information of the graph node with the aggregated updated node feature information.
[0103] In some embodiments, the above-mentioned building unit may specifically include:
[0104] The computing component is configured to calculate the similarity between the updated node feature information of each graph node and the updated node feature information of its neighboring graph nodes.
[0105] A matrix building component is configured to build a node similarity matrix based on the said similarity.
[0106] In some embodiments, the computing module 704 may specifically include:
[0107] The node determination unit is configured to determine the first node. i The graph node and the first Ni The common neighbor nodes of a graph node, among which... i for 1~N positive integers, N This represents the total number of all graph nodes.
[0108] The calculation unit is configured to calculate the first... i The graph node and the first Ni Distance metric between nodes in a graph.
[0109] In some embodiments, the above-mentioned computing unit may specifically include:
[0110] The similarity determination component is configured to determine the first node based on the node similarity matrix. i The first similarity between a graph node and its common neighbor node, the first... Ni The second similarity between each graph node and its common neighbor nodes;
[0111] The metric calculation component is configured to calculate the first similarity and the second similarity based on the first similarity and the second similarity. i The graph node and the first Ni Distance metric between nodes in a graph.
[0112] In some embodiments, the classification module 705 may specifically include:
[0113] The comparison unit is configured to compare the first... i The graph node and the first Ni The distance metric between each graph node and the preset metric threshold;
[0114] The classification unit is configured to classify the first group whose distance metric value is less than a preset metric threshold. i The graph node and the first Ni If all graph nodes are grouped into the same category, at least one cluster is obtained.
[0115] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.
[0116] Figure 8 This is a schematic diagram of the electronic device 8 provided in an embodiment of this disclosure. Figure 8 As shown, the electronic device 8 of this embodiment includes a processor 801, a memory 802, and a computer program 803 stored in the memory 802 and executable on the processor 801. When the processor 801 executes the computer program 803, it implements the steps in the various method embodiments described above. Alternatively, when the processor 801 executes the computer program 803, it implements the functions of each module / unit in the various device embodiments described above.
[0117] Electronic device 8 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 8 may include, but is not limited to, processor 801 and memory 802. Those skilled in the art will understand that... Figure 8 This is merely an example of electronic device 8 and does not constitute a limitation on electronic device 8. It may include more or fewer components than shown, or different components.
[0118] The processor 801 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0119] The memory 802 can be an internal storage unit of the electronic device 8, such as a hard disk or RAM of the electronic device 8. The memory 802 can also be an external storage device of the electronic device 8, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 8. The memory 802 can also include both internal and external storage units of the electronic device 8. The memory 802 is used to store computer programs and other programs and data required by the electronic device.
[0120] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0121] If integrated modules / units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0122] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure 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. Such 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 this disclosure, and should all be included within the protection scope of this disclosure.
Claims
1. An image clustering method, characterized in that, include: Obtain multiple images to be clustered, where each image to be clustered is a graph node; Extract the node feature information of each of the graph nodes; Based on the node feature information, construct a node similarity matrix; Based on the node similarity matrix, calculate the distance metric between each graph node and other graph nodes; The images to be clustered in the image dataset are classified according to the distance metric value to obtain at least one cluster. Based on the node feature information, a node similarity matrix is constructed, including: Based on the association relationships between the graph nodes, the node feature information of each graph node is updated to obtain the updated node feature information of each graph node. Based on the updated node feature information, a node similarity matrix is constructed; Based on the relationships between the graph nodes, the node feature information of each graph node is updated to obtain the updated node feature information of each graph node, including: Based on the relationships between the graph nodes, a sparse symmetric adjacency matrix is constructed. Based on the sparse symmetric adjacency matrix, determine the neighboring nodes of each graph node; The original node feature information of the graph node and the node feature information of its neighboring graph nodes are aggregated, and the updated node feature information obtained by aggregation is overwritten with the original node feature information of the graph node. The step of calculating the distance metric between every two graph nodes based on the node similarity matrix includes: Determine the first i The graph node and the first j The common neighbor nodes of a graph node, among which... i for 1~N positive integers, j for i After Ni A positive integer, N This represents the total number of all graph nodes. Based on the common neighbor nodes and the node similarity matrix, calculate the first... i The graph node and the first j Distance metric between nodes in a graph.
2. The method according to claim 1, characterized in that, Based on the updated node feature information, a node similarity matrix is constructed, including: Calculate the similarity between the updated node feature information of each graph node and the updated node feature information of its neighboring graph nodes; Based on the aforementioned similarity, a node similarity matrix is constructed.
3. The method according to claim 1, characterized in that, Based on the common neighbor nodes and the node similarity matrix, calculate the first... i The graph node and the first j Distance metrics between graph nodes include: Based on the node similarity matrix, determine the first... i The first similarity between a graph node and its common neighbor node, the first... j The second similarity between each graph node and its common neighbor nodes; Based on the first similarity and the second similarity, calculate the first... i The graph node and the first j Distance metric between nodes in a graph.
4. The method according to claim 3, characterized in that, The images to be clustered in the image dataset are classified according to the distance metric to obtain at least one cluster, including: Compare the first i The graph node and the first j The distance metric between each graph node and the preset metric threshold; The first one whose distance metric value is less than a preset metric threshold i The graph node and the first j If all graph nodes are grouped into the same category, at least one cluster is obtained.
5. An image clustering device, characterized in that, The image clustering device is used to implement the method as described in any one of claims 1 to 4; The image clustering device includes: The acquisition module is configured to acquire multiple images to be clustered, where each image to be clustered is a graph node; The extraction module is configured to extract node feature information for each of the graph nodes; The construction module is configured to construct a node similarity matrix based on the node feature information; The calculation module is configured to calculate the distance metric between each graph node and other graph nodes based on the node similarity matrix. The classification module is configured to classify the images to be clustered in the image dataset according to the distance metric value, so as to obtain at least one cluster.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Image clustering method, device and equipment and storage medium
CN111291827A