CN115083003B - Clustering network training and target clustering method, device, terminal and storage medium - Google Patents
Clustering network training and target clustering method, device, terminal and storage medium Download PDFInfo
- Publication number
- CN115083003B CN115083003B CN202211014416.XA CN202211014416A CN115083003B CN 115083003 B CN115083003 B CN 115083003B CN 202211014416 A CN202211014416 A CN 202211014416A CN 115083003 B CN115083003 B CN 115083003B
- Authority
- CN
- China
- Prior art keywords
- node
- clustering
- neighbor
- nodes
- graph
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/168—Feature extraction; Face representation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/762—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using clustering, e.g. of similar faces in social networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V2201/00—Indexing scheme relating to image or video recognition or understanding
- G06V2201/07—Target detection
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Software Systems (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- Computing Systems (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Life Sciences & Earth Sciences (AREA)
- Data Mining & Analysis (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Mathematical Physics (AREA)
- Human Computer Interaction (AREA)
- Computational Linguistics (AREA)
- Biomedical Technology (AREA)
- General Engineering & Computer Science (AREA)
- Image Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a method, a device, a terminal and a storage medium for clustering network training and target clustering, wherein the method for clustering network training comprises the steps of obtaining a training sample set, wherein the training sample set comprises a plurality of sample images containing target objects; processing the first K neighbor graph associated with each sample image based on a clustering network to obtain a type prediction result of a corresponding connecting edge between a main node and each neighbor node in the first K neighbor graph; substituting the type prediction result of the connecting edge and the clustering difficulty coefficient of the main node and/or the adjacent node connected with the connecting edge into a loss function to obtain a loss value, wherein the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient; and performing iterative training on the clustering network based on the loss value. According to the method and the device, the clustering network attaches more importance to the prediction accuracy of the sample image with the larger clustering difficulty coefficient, so that the compatibility of the clustering network to noise data is improved, and the clustering accuracy and the recall rate of the clustering network are improved.
Description
Technical Field
The invention relates to the technical field of image recognition, in particular to a clustering network training and target clustering method, a device, a terminal and a storage medium.
Background
With the rapid development of computer technologies, terminals with shooting functions, such as smart phones and cameras, gradually enter the lives of users, the users can shoot through the terminals to obtain videos, and in order to distinguish people appearing in the videos, identity labeling is often required to be performed on face images contained in the videos. When the user performs identity labeling on the face images contained in the video, the user can cluster a plurality of face images contained in the video, and then perform identity labeling according to the clustered face images, so that the labeling efficiency is improved.
In the process of face clustering, the face features of the face images and the corresponding K neighbor images are obtained based on a face clustering method and used as the input of the clustering method, so that the face images are clustered. Due to the fact that images of other people exist in the K neighbor image, the clustering effect of the face image clustering result is poor.
Disclosure of Invention
The invention mainly solves the technical problem of providing a clustering network training and target clustering method, a device, a terminal and a storage medium, and solves the problem of low recall rate of image clustering results in the prior art.
In order to solve the technical problems, the first technical scheme adopted by the invention is as follows: a clustering network training method is provided, and the training method comprises the following steps: acquiring a training sample set, wherein the training sample set comprises a plurality of sample images containing a target object, each sample image is respectively associated with a first K neighbor graph and a clustering difficulty coefficient, in the first K neighbor graph, the associated sample images are used as main nodes, a plurality of other sample images with the largest similarity are used as neighbor nodes, the main nodes and the neighbor nodes are connected through connecting edges, when the main nodes and the neighbor nodes belong to the same target object, the connecting edges are positive edges, otherwise, the connecting edges are negative edges, and the larger the negative edge ratio of the first K neighbor graph is, the larger the corresponding clustering difficulty coefficient is; processing the first K neighbor graph associated with each sample image based on a clustering network to obtain a type prediction result of a corresponding connecting edge between a main node and each neighbor node in the first K neighbor graph; the type prediction result of the connecting edge is used for representing the probability value that the main node and/or the adjacent node connected with the connecting edge belong to the same target object; substituting the type prediction result of the connecting edge and the clustering difficulty coefficient of the main node and/or the adjacent node connected with the connecting edge into a loss function to obtain a loss value, wherein the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient; and performing iterative training on the clustering network based on the loss value.
The method for substituting the type prediction result of the connecting edge, the clustering difficulty coefficient of the main node and/or the neighboring node connected with the connecting edge into the loss function comprises the following steps: selecting a maximum value from the clustering difficulty coefficients of the main node and the adjacent nodes connected by the connecting edge; the maximum is substituted into the loss function.
Wherein the absolute value of the loss value is positively correlated with the power function of the substituted clustering difficulty coefficient.
The method includes the following steps that a type prediction result of a connecting edge and a clustering difficulty coefficient of a main node and/or a neighboring node connected with the connecting edge are substituted into a loss function to obtain a loss value, and the method further includes the following steps: and determining a loss value based on the hyper-parameters, the clustering difficulty coefficients of the main nodes and the adjacent nodes connected by the connecting edges and the probability value output by the clustering network.
The method for determining the clustering difficulty coefficient comprises the following steps: and determining the negative edge ratio of the master node based on the total number of the neighbor nodes in the first K neighbor graph and the number of the neighbor nodes belonging to the same target object with the master node, wherein the negative edge ratio is used as a clustering difficulty coefficient.
The clustering network comprises a graph convolution network and a neural network, wherein the graph convolution network is connected with the neural network; processing the first K neighbor graph based on the clustering network to obtain a type prediction result of the connecting edge, wherein the type prediction result comprises the following steps: performing feature fusion on the target feature maps of all the neighboring nodes in the first K neighboring map of the sample image through a map convolution network to obtain an updated feature map of the master node; and determining a type prediction result of a connection edge between the master node and the neighbor node through the neural network based on the updated feature graph of the master node and the updated feature graph of the neighbor node.
In order to solve the above technical problems, the second technical solution adopted by the present invention is: provided is a target clustering method including: generating a second K neighbor graph of each image to be clustered based on the obtained multiple images to be clustered, which contain the target; in the second K neighbor graph, the associated images to be clustered are taken as main nodes, a plurality of other images to be clustered with the largest similarity are taken as neighbor nodes, and the main nodes are connected with the neighbor nodes through connecting edges; processing the second K neighbor graph by adopting a clustering network, and determining a first detection result of a connecting edge between a main node corresponding to the second K neighbor graph and each neighbor node; the clustering network is obtained by training through the clustering network training method; and clustering the plurality of images to be clustered based on the first detection result of each connecting edge.
Wherein the first detection result of the connection edge comprises the credibility of the connection edge; clustering a plurality of images to be clustered based on the first detection result of each connecting edge, comprising: based on the credibility of each connecting edge, carrying out deletion processing on the second K neighbor graph of each main node to obtain a third K neighbor graph of each main node; clustering a plurality of images to be clustered to obtain a first clustering result based on the third K neighbor graph of each master node; the first clustering result includes a clustering category of each master node.
Based on the credibility of each connection edge, the deletion processing is performed on the second K neighbor graph of each master node, and the deletion processing comprises the following steps: in response to that the reliability of the connecting edge between the main node and the adjacent node is lower than a threshold value, deleting the connecting edge between the main node and the adjacent node; and in response to the credibility of the connecting edge between the main node and the adjacent node being lower than the threshold value, reserving the connecting edge between the main node and the adjacent node.
Wherein the first clustering result comprises at least one isolated node; the cluster type of the isolated node is different from the cluster types of other main nodes; the target clustering method further comprises: based on the second K neighbor graphs of the isolated nodes and the second K neighbor graphs of other main nodes except the isolated nodes in the first clustering result, purifying the second K neighbor graphs of the isolated nodes to obtain fourth K neighbor graphs of the isolated nodes; processing a fourth K neighbor graph of the isolated node by adopting a clustering network to obtain the credibility of connecting edges corresponding to the isolated node and each neighbor node in the fourth K neighbor graph; and determining whether the isolated node and the adjacent node corresponding to the highest reliability belong to the same clustering class based on the highest reliability in the fourth K adjacent graph.
The method for obtaining the fourth K neighbor graph of the isolated node by carrying out purification treatment on the second K neighbor graph of the isolated node based on the second K neighbor graph of the isolated node and the second K neighbor graphs of other main nodes except the isolated node in the first clustering result respectively comprises the following steps of: selecting a neighbor node of any isolated node in the second K neighbor graph of the isolated node as a selection node; judging whether the selected node is a neighboring node of the isolated node in the second K neighboring graph of the isolated node, and whether the isolated node is a neighboring node of the selected node in the second K neighboring graph of the selected node; if the isolated node is not the neighbor node of the selected node, disconnecting the connecting edge between the isolated node and the selected node in the second K neighbor graph of the isolated node; if the selected node is a neighbor node of the isolated node and the isolated node is a neighbor node of the selected node, reserving a connecting edge between the isolated node and the selected node; and traversing all the neighbor nodes of the isolated nodes, and determining the fourth K neighbor graph of the isolated nodes.
Determining whether the isolated node and the neighboring node corresponding to the highest reliability belong to the same cluster category based on the highest reliability in the fourth K neighboring graph, wherein the determining comprises the following steps: in response to the fact that the highest reliability in the fourth K neighbor graph of the isolated node exceeds the preset reliability, determining that the isolated node and the neighbor node corresponding to the highest reliability belong to the same cluster category; in response to the highest confidence level in the fourth K neighbor graph of isolated nodes not exceeding the preset confidence level, determining that the isolated node's neighbor node corresponding to the highest confidence level belongs to a different cluster category.
In order to solve the above technical problems, the third technical solution adopted by the present invention is: provided is a clustering network training device including: the acquisition module is used for acquiring a training sample set, the training sample set comprises a plurality of sample images containing a target object, each sample image is respectively associated with a first K neighbor graph and a clustering difficulty coefficient, in the first K neighbor graph, the associated sample images are used as main nodes, a plurality of other sample images with the maximum similarity are used as neighbor nodes, the main nodes and the neighbor nodes are connected through connecting edges, when the main nodes and the neighbor nodes belong to the same target object, the connecting edges are positive edges, otherwise, the connecting edges are negative edges, and the larger the negative edge ratio of the first K neighbor graph is, the larger the corresponding clustering difficulty coefficient is; the prediction module is used for processing the first K neighbor graph associated with each sample image based on the clustering network to obtain a type prediction result of a corresponding connecting edge between a main node and each neighbor node in the first K neighbor graph; the type prediction result of the connecting edge is used for representing the probability value that the main node and/or the adjacent node connected with the connecting edge belong to the same target object; the analysis module is used for substituting the type prediction result of the connecting edge and the clustering difficulty coefficient of the main node and/or the adjacent node connected with the connecting edge into a loss function to obtain a loss value, and the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient; and the training module is used for carrying out iterative training on the clustering network based on the loss value.
In order to solve the technical problems, the fourth technical scheme adopted by the invention is as follows: provided is a target clustering device including: the image acquisition module is used for generating a second K neighbor image of each image to be clustered based on the acquired images to be clustered, wherein the images to be clustered comprise targets; in the second K neighbor graph, the associated images to be clustered are used as main nodes, a plurality of other images to be clustered with the largest similarity are used as neighbor nodes, and the main nodes are connected with the neighbor nodes through connecting edges; the detection module is used for processing the second K neighbor graph by adopting a clustering network and determining a first detection result of a connecting edge between a main node corresponding to the second K neighbor graph and each neighbor node; the clustering network is obtained by training through the clustering network training method; and the clustering module is used for clustering the plurality of images to be clustered based on the first detection result of each connecting edge.
In order to solve the above technical problems, a fifth technical solution adopted by the present invention is: there is provided a terminal comprising a memory, a processor and a computer program stored in the memory and running on the processor, the processor being configured to execute the sequence data to implement the steps in the method for training a cluster network as described above; or to implement the steps in the object clustering method as described above.
In order to solve the technical problems, the sixth technical scheme adopted by the invention is as follows: providing a computer readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing the steps in the clustering network training method as described above; or to implement the steps in the object clustering method as described above.
The invention has the beneficial effects that: different from the situation of the prior art, the provided clustering network training and target clustering method, device, terminal and storage medium comprises the steps of obtaining a training sample set, wherein the training sample set comprises a plurality of sample images containing target objects, each sample image is respectively associated with a first K neighbor image and a clustering difficulty coefficient, in the first K neighbor image, the associated sample image is taken as a master node, a plurality of other sample images with the maximum similarity are taken as neighbor nodes, the master node and the neighbor nodes are connected through a connecting edge, when the master node and the neighbor nodes belong to the same target object, the connecting edge is a positive edge, otherwise, the connecting edge is a negative edge, and the larger the negative edge ratio of the first K neighbor image is, the larger the corresponding clustering difficulty coefficient is; processing the first K neighbor graph associated with each sample image based on a clustering network to obtain a type prediction result of a corresponding connecting edge between a main node and each neighbor node in the first K neighbor graph; substituting the type prediction result of the connecting edge and the clustering difficulty coefficient of the main node and/or the adjacent node connected with the connecting edge into a loss function to obtain a loss value, wherein the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient; and performing iterative training on the clustering network based on the loss value. According to the method and the device, the clustering network is trained on the sample images with different clustering difficulty coefficients, so that the clustering network attaches more importance to the prediction accuracy of the sample images with larger clustering difficulty coefficients, the compatibility of the clustering network for noise data is improved, and the clustering accuracy and the recall rate of the clustering network are improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a clustering network training method provided by the present invention;
FIG. 2 is a schematic flowchart of an embodiment of step S12 in the method for training a clustering network provided in FIG. 1;
FIG. 3 is a schematic flow chart of a target clustering method provided by the present invention;
FIG. 4 is a flowchart illustrating an embodiment of step S23 of the target clustering method provided in FIG. 3;
FIG. 5 is a flowchart illustrating an embodiment of step S233 in the target clustering method provided in FIG. 4;
FIG. 6 is a schematic block diagram of a clustering network training apparatus provided in the present invention;
FIG. 7 is a schematic block diagram of a target clustering apparatus provided in the present invention;
FIG. 8 is a schematic block diagram of one embodiment of a terminal provided by the present invention;
FIG. 9 is a schematic block diagram of one embodiment of a computer-readable storage medium provided by the present invention.
Detailed Description
The following describes in detail the embodiments of the present application with reference to the drawings attached hereto.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular system structures, interfaces, techniques, etc. in order to provide a thorough understanding of the present application.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship. Further, "plurality" herein means two or more than two.
The inventor researches and discovers that the current offline face clustering method based on supervised learning generally extracts the features of a face image by using a specific feature extraction model, and then takes the face features and a K Nearest Neighbor (KNN) graph corresponding to the face features as the input of a clustering algorithm. According to the role played by the KNN graph in the clustering process, the current face clustering method based on supervised learning can be divided into two types.
(1) For each face feature, a specific plurality of neighbor features are found out from the KNN image by designing a specific strategy, then the face feature is subjected to feature transformation in a self-adaptive manner by utilizing a supervised learning model according to information provided by the neighbor features, so that the distribution of the plurality of face features of the same person in a feature space after transformation is more compact, and finally face clustering is carried out according to the transformed face features by utilizing an unsupervised clustering algorithm.
(2) And (3) directly utilizing a supervised learning model to identify and remove undirected edges among feature nodes which do not belong to the same person in the KNN graph, so that the KNN graph is divided into a plurality of subgraphs, each subgraph represents a cluster, and the clustering of the human faces is completed.
In the task, due to the fact that noise nodes which do not belong to the main nodes exist in the KNN subgraph, the main node features are polluted by the node features of the non-same persons after the model is learned based on the KNN, and therefore the clustering effect is poor.
In order to better improve the accuracy and recall rate of clustering results, the inventor provides a clustering network training method and a target clustering method.
In order to make those skilled in the art better understand the technical solution of the present invention, the following describes a cluster network training method and a target clustering method provided by the present invention in further detail with reference to the accompanying drawings and the detailed description.
Referring to fig. 1, fig. 1 is a schematic flow chart of a cluster network training method according to the present invention. The embodiment provides a clustering network training method, which comprises the following steps.
S11: a training sample set is obtained.
Specifically, the training sample set comprises a plurality of sample images including a target object, each sample image is associated with a first K-nearest neighbor graph and a clustering difficulty coefficient, in the first K-nearest neighbor graph, the associated sample image is used as a master node, a plurality of other sample images with the largest similarity are used as nearest neighbor nodes, the master node and the nearest neighbor nodes are connected through a connecting edge, when the master node and the nearest neighbor nodes belong to the same target object, the connecting edge is a positive edge, otherwise, the connecting edge is a negative edge, and the larger the negative edge ratio of the first K-nearest neighbor graph is, the larger the corresponding clustering difficulty coefficient is.
Specifically, the sample image may be a face image. The plurality of face images may be images of different target objects from different perspectives.
And (3) extracting the features of each face image by adopting a feature extraction module of the face recognition model to obtain a face feature image of the face image. And further acquiring the face feature maps of all the face images in the training sample set, and calculating to obtain the similarity between the face feature maps. Specifically, the similarity between the face images can be determined by calculating cosine distances, euclidean distances, and the like between the face images and other face images.
And selecting a face image, and sequencing the similarity between the selected face image and other face images in the training sample set from large to small. And extracting the face images corresponding to the K similarity degrees in the front sequence as the neighbor images of the selected face images. Each face image is taken as a node. The selected face image is a master node, and the neighbor image of the selected face image is a neighbor node of the master node. And connecting the master node and the neighbor nodes through the undirected edge to obtain a first K neighbor graph of the master node.
And determining the first K neighbor map of each sample image in the training sample set by the method.
In one embodiment, each sample image in the training sample set is associated with a class label of the included target object. And determining the type of the connecting edge between the two sample images according to the class labels respectively corresponding to the two sample images. Determining that the connection edge between the nodes corresponding to the two sample images is a positive edge in response to the fact that the class labels corresponding to the two sample images are the same; and determining that the connection edge between the nodes corresponding to the two sample images is a negative edge in response to the fact that the class labels corresponding to the two sample images are different. That is, if two nodes connected by the connecting edge have the same class label, the connecting edge is determined to be a positive edge; and if the category labels corresponding to the two nodes connected by the connecting edge are different, determining that the connecting edge is a negative edge.
And determining the negative edge ratio of the master node based on the total number of the neighbor nodes in the first K neighbor graph and the number of the neighbor nodes belonging to the same target object with the master node, wherein the negative edge ratio is used as a clustering difficulty coefficient.
And determining the negative edge ratio of the sample image corresponding to the main node according to the connecting edge between the main node and the adjacent node in the first K adjacent graph corresponding to the sample image.
Specifically, the number of neighbor nodes in the first K neighbor graph is counted as a first number, and the number of positive edges in a connecting edge between the master node and each neighbor node in the first K neighbor graph is counted as a second number; and determining the negative edge ratio of the sample image corresponding to the main node based on the ratio of the difference value of the first quantity and the second quantity in the first quantity.
In a specific embodiment, the number of neighboring nodes of a master node in a first K-neighbor graph of a sample image is 80, the class label of a target object corresponding to the master node is a, the class label of a target object corresponding to 60 neighboring nodes in the first K-neighbor graph is a, the class label of a target object corresponding to 15 neighboring nodes is B, the class label of a target object corresponding to 5 neighboring nodes is C, wherein a connecting edge between the neighboring node of which the class label is B or C and the class label is a belongs to a negative edge, and the negative edge ratio of the master node is。
In another embodiment, the number of the neighboring nodes in the first K-neighbor graph is counted as a first number, and the number of the negative edges in the connecting edges between the master node and each neighboring node in the first K-neighbor graph is counted as a third number; and determining the negative edge ratio of the sample image corresponding to the main node based on the ratio of the third number to the first number.
The master node with the higher negative edge ratio is more likely to be polluted by noise points of neighboring nodes of the master node to the characteristic information of the target object, so that the target object cannot be recalled accurately. Therefore, the negative edge ratio represents the clustering difficulty coefficient of the node at the same time. The larger the clustering difficulty coefficient of the sample image is, the more error-prone the clustering result of the sample image is.
In another embodiment, the clustering difficulty coefficient of each sample image in the training sample set is compared with a preset value. And judging whether the number of the sample images corresponding to the clustering difficulty coefficient exceeding the preset value exceeds the preset number or not. If the number of the sample images corresponding to the clustering difficulty coefficient exceeding the preset value does not exceed the preset number, new sample images need to be supplemented in the original training sample set to supplement the sample images with the clustering difficulty coefficient exceeding the preset value, so that the clustering network is prevented from being dominated by a large number of image samples with the clustering difficulty coefficient not exceeding the preset value, and the prediction error probability of the sample images with the clustering difficulty coefficient exceeding the preset value is aggravated.
S12: and processing the first K neighbor graph associated with each sample image based on the clustering network to obtain a type prediction result of a corresponding connecting edge between the main node and each neighbor node in the first K neighbor graph.
Specifically, the clustering network comprises a graph volume network and a neural network, and the graph volume network and the neural network are connected. The type prediction result of the connection edge is used for representing the probability value that the main node and/or the adjacent node connected with the connection edge belong to the same target object.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating an embodiment of step S12 in the method for training a clustering network provided in fig. 1.
S121: and performing feature fusion on the target feature maps of all the neighboring nodes in the first K neighboring map of the sample image through a map convolution network to obtain an updated feature map of the master node.
Specifically, the Graph convolution network in this embodiment may be a GCN (Graph Convolutional Networks) model, or may be another Graph convolution model. The GCN constructs an adjacency matrix A based on the first K neighbor graph of the input sample image, and performs feature fusion and updating features on the target feature graph of each neighbor graph of the master node through the GCN to obtain an updated feature graph corresponding to the master node.
And traversing each sample image in the training sample set to obtain an updated feature map corresponding to each sample image.
S122: and determining a type prediction result of a connection edge between the master node and the neighbor node through the neural network based on the updated feature graph of the master node and the updated feature graph of the neighbor node.
Specifically, the neural network in this embodiment may be a Multilayer Perceptron (MLP) network, or may be another neural network. And splicing the updating characteristics of the master node and the updating characteristics of the adjacent nodes and inputting the spliced updating characteristics and the updating characteristics into the MLP network, wherein the MLP network determines the probability that the target objects respectively corresponding to the master node and the adjacent nodes belong to the same class label based on the updating characteristics of the master node and the updating characteristics of the adjacent nodes. And the probability that the update characteristics of the main node and the update characteristics of the adjacent nodes belong to the same class label is a class prediction result.
S13: and substituting the type prediction result of the connecting edge and the clustering difficulty coefficient of the main node and/or the adjacent node connected with the connecting edge into a loss function to obtain a loss value.
Specifically, the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient.
In one embodiment, the maximum value is selected from the clustering difficulty coefficients of the main node and the neighboring nodes connected by the connecting edge; and substituting the maximum value into a loss function to obtain a loss value.
In one embodiment, the loss value is determined based on the hyper-parameters, the clustering difficulty coefficients of the main node and the neighboring nodes connected by the connecting edge, and the probability value output by the clustering network.
In one embodiment, the loss function is shown in equation 1 below;
In the formula: loss represents a Loss value; alpha and gamma represent two preset hyper-parameters, and beta is the substituted clustering difficulty coefficient; when the class labels of the two nodes connected by the connecting edge are the same, p is a probability value output by the clustering network; and when the class labels of the two nodes connected by the connecting edge are different, subtracting the probability value output by the clustering network from p to 1. Namely, it is. That is, if the class labels of two nodes connected by the connecting edge are the same, the connecting edge between the two nodes is a positive edge, and p corresponding to the connecting edge is a probability value p output by the clustering network t . If the class labels of the two nodes connected by the connecting edge are different, the connecting edge between the two nodes is a negative edge, and the corresponding p of the connecting edge is 1 minus the probability value p output by the clustering network t 。
In one embodiment, when the loss value of the connection edge between the master node and a neighboring node is obtained by the calculation of formula 1,and one of t1 and t2 represents a master node and the other represents a neighbor node.
In another embodiment, α and γ are preset according to a specific application scenario and are used to regulate the loss difference of sample images with different clustering difficulty coefficients. For example, α =8 and γ =3. The numerical value may be set specifically according to the specific situation.
In this embodiment, the larger the clustering difficulty coefficient is, the larger the value of β is, that is, the loss value of the connection edge between the corresponding master node and the neighboring node is exponentially enhanced, so that the clustering network can attach importance to the accuracy of such sample images.
Compared with the traditional training, the embodiment provides a new loss function for supervised training, so that the compatibility of the GCN model to noise data can be improved without increasing extra calculation amount, and the accuracy and recall rate of the model are obviously improved.
S14: and performing iterative training on the clustering network based on the loss value.
Specifically, in a specific embodiment, a loss value between a real class result and a preset class result of a connection edge between two sample images in the same group is calculated based on the loss function of formula 1, and then the clustering network is iteratively trained based on the loss value.
In an optional embodiment, the result of the clustering network is propagated reversely, and the weight of the clustering network is modified according to the loss value between the real class result and the preset class result of the connecting edge between the two sample images in the same group, so that the training of the clustering network is realized. That is, the weights of the mutually connected GCN and MLP networks are corrected according to the loss value between the real class result and the preset class result of the connecting edge between two sample images in the same group, so as to realize the training of the GCN and the MLP networks.
A master node and a neighboring node are input into a clustering network, and the clustering network detects the category of a connecting edge between the master node and the neighboring node. And stopping training the clustering network when the loss value between the real class result and the preset class result of the connecting edge between the two sample images in the same group does not decrease along with the increasing of the training times.
The embodiment provides a clustering network training method, which comprises the steps of obtaining a training sample set, wherein the training sample set comprises a plurality of sample images containing a target object, each sample image is respectively associated with a first K neighbor graph and a clustering difficulty coefficient, in the first K neighbor graph, the associated sample image is used as a main node, a plurality of other sample images with the maximum similarity are used as neighbor nodes, the main node and the neighbor nodes are connected through a connecting edge, when the main node and the neighbor nodes belong to the same target object, the connecting edge is a positive edge, otherwise, the connecting edge is a negative edge, and the larger the negative edge ratio of the first K neighbor graph is, the larger the corresponding clustering difficulty coefficient is; processing the first K neighbor graph based on a clustering network to obtain a type prediction result of a connecting edge; substituting the type prediction result of the connecting edge and the clustering difficulty coefficient of the main node and/or the adjacent node connected with the connecting edge into a loss function to obtain a loss value, wherein the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient; and performing iterative training on the clustering network based on the loss value. According to the method and the device, the clustering network is trained on the basis of the sample images with different clustering difficulty coefficients, so that the clustering network can attach importance to the prediction accuracy of the sample images with larger clustering difficulty coefficients, the compatibility of the clustering network to noise data is improved, and the clustering accuracy and the recall rate of the clustering network are improved.
Referring to fig. 3, fig. 3 is a schematic flow chart of a target clustering method according to the present invention. The embodiment provides a target clustering method, and the specific steps of the target clustering method are as follows.
S21: and generating a second K neighbor graph of each image to be clustered based on the acquired images to be clustered containing the target.
Specifically, in the second K-nearest neighbor graph, the associated image to be clustered is used as a master node, and a plurality of other images to be clustered with the largest similarity are used as nearest neighbor nodes, and the master node and the nearest neighbor nodes are connected through connecting edges.
By the method for determining the first K nearest neighbor graph of each sample image based on all the sample images in the training sample set in the embodiment, the second K nearest neighbor graph of each image to be clustered in the multiple images to be clustered is determined.
S22: and processing the second K neighbor graph by adopting a clustering network, and determining a first detection result of a connecting edge between a main node corresponding to the second K neighbor graph and each neighbor node.
Specifically, the clustering network obtained through training in the above embodiment detects the connecting edges between the master node and each neighboring node in the second K neighboring graph of the image to be clustered, so as to obtain the credibility of the corresponding connecting edges between the nodes and each neighboring node.
S23: and clustering the plurality of images to be clustered based on the first detection result of each connecting edge.
Referring to fig. 4, fig. 4 is a flowchart illustrating an embodiment of step S23 in the target clustering method provided in fig. 3.
S231: and based on the credibility of each connecting edge, carrying out deletion processing on the second K neighbor graph of each main node to obtain a third K neighbor graph of each main node.
Specifically, in response to that the reliability of the connection edge between the master node and the adjacent node is lower than a threshold, deleting the connection edge between the master node and the adjacent node; and in response to the credibility of the connecting edge between the main node and the adjacent node being lower than the threshold value, reserving the connecting edge between the main node and the adjacent node.
In one embodiment, the confidence level is a confidence level. And comparing the confidence degree corresponding to the connecting edge with a confidence degree threshold value, and deleting the connecting edge between the main node and the adjacent node in response to the fact that the confidence degree of the connecting edge between the main node and the adjacent node is lower than the confidence degree threshold value. And in response to the confidence coefficient of the connecting edge between the main node and the adjacent node not being lower than the confidence coefficient threshold value, reserving the connecting edge between the main node and the adjacent node.
And screening the connecting edges in the second K neighbor images of the images to be clustered based on the confidence degrees of the connecting edges to obtain third K neighbor images corresponding to the images to be clustered.
The untrusted connecting edge between the main node and the adjacent nodes in the second K adjacent graph can be eliminated in other ways.
S232: and clustering the plurality of images to be clustered based on the third K neighbor graphs of the master nodes to obtain a first clustering result.
Specifically, the clustering results of all the images to be clustered are determined according to the third K neighbor images respectively corresponding to all the images to be clustered. Specifically, based on the conductivity of the clustering result, the connected graphs with the same images to be clustered are connected, and all the images to be clustered corresponding to the connected graphs belong to the same clustering category, so that the preliminary clustering of the images to be clustered is completed. The first clustering result includes a clustering category of each master node.
In an embodiment, the first clustering result does not include an isolated node, and the first clustering result is an optimal clustering result of the plurality of images to be clustered.
In another embodiment, the first clustering result includes at least one orphan node; the cluster category of the isolated node is different from the cluster categories of other main nodes.
The orphaned node is salvaged based on determining whether the orphaned node can belong to the same cluster class as the other master nodes.
S233: and responding to the fact that the first clustering result contains at least one isolated node, and based on the second K neighbor graphs of the isolated node and the second K neighbor graphs of other main nodes except the isolated node in the first clustering result, performing purification treatment on the second K neighbor graphs of the isolated node to obtain a fourth K neighbor graph of the isolated node.
Specifically, the specific steps of determining the fourth K neighbor graph of the isolated node based on the second K neighbor graphs of the isolated node and the second K neighbor graphs of the other master nodes except the isolated node in the first clustering result are as follows.
Referring to fig. 5, fig. 5 is a flowchart illustrating an embodiment of step S233 in the target clustering method provided in fig. 4.
S2331: and selecting the neighbor node of any isolated node in the second K neighbor graph of the isolated node as the selected node.
Specifically, in order to determine whether the isolated node and any one of the second K neighbor graphs of the isolated node belong to the same cluster category, any one of the neighbor nodes is selected from the second K neighbor graphs of the isolated node as a selected node, and then the second K neighbor graphs of the isolated node are optimized. The selected node may be any node except the isolated node in the first clustering result. For example, the selected nodes may be other isolated nodes and already clustered master nodes.
S2332: and judging whether the selected node is the adjacent node of the isolated node in the second K adjacent graph of the isolated node, and whether the isolated node is the adjacent node of the selected node in the second K adjacent graph of the selected node.
Specifically, a bidirectional neighbor principle is adopted, and whether the isolated node and the selected node are mutually neighbor nodes is determined based on the second K neighbor graph of the isolated node and the second K neighbor graph of the selected node.
If the selected node is not a neighbor node of the isolated node in the second K neighbor graph of the isolated node, or the isolated node is not a neighbor node of the selected node in the second K neighbor graph of the selected node, directly jumping to step S2333; if the selected node is a neighbor node of the isolated node in the second K-neighbor graph of the isolated node, and the isolated node is a neighbor node of the selected node in the second K-neighbor graph of the selected node, directly jumping to step S2334.
S2333: and disconnecting the connecting edge between the isolated node and the selected node in the second K adjacent graph of the isolated node.
Specifically, if the isolated node is not a neighbor node of the selected node, the connecting edge between the isolated node and the selected node in the second K neighbor graph of the isolated node is broken.
In one embodiment, assume node D is an orphaned node and node E is a selected node. For node D, in the second K neighbor graph of node D, node E is a neighbor node of node D; for node E, there are a number of nodes with higher similarity than node D, which is not a neighbor node of node E in the second K-neighbor graph of node E. Therefore, the isolated node D and the selected node E are judged to be incapable of establishing a connecting edge, and the connecting edge between the isolated node D and the selected node E in the second K neighbor graph of the isolated node D is disconnected.
S2334: and reserving the connecting edges between the isolated nodes and the selected nodes.
Specifically, if the selected node is a neighboring node of the isolated node and the isolated node is a neighboring node of the selected node, a connecting edge between the isolated node and the selected node is reserved.
In another embodiment, assume node D is an orphaned node and node E is a selected node. For node D, in the second K-neighbor graph of node D, node E is a neighbor node of node D; for node E, in the second K-neighbor graph of node E, node D is also a neighbor node of node E. Based on the principle of bidirectional neighbor, reserving a connecting edge between the isolated node D and the selected node E in the second K neighbor graph of the isolated node D.
S2335: and traversing all the neighbor nodes of the isolated node, and determining a fourth K neighbor graph of the isolated node.
Specifically, all the neighboring nodes of the isolated node are traversed, the connection relationship between the isolated node and the neighboring nodes is re-determined, and a fourth K neighboring graph corresponding to the isolated node is obtained. And the fourth K neighbor graph of the isolated node is a subgraph of the second K neighbor graph of the isolated node.
The number of noise nodes in the second K-neighbor graph of isolated nodes can be significantly reduced by the specific method of step S233.
S234: and processing the fourth K neighbor graph of the isolated node by adopting a clustering network to obtain the credibility of the connecting edges corresponding to the isolated node and each neighbor node in the fourth K neighbor graph.
Specifically, in order to further determine whether the isolated node has the same cluster type as other master nodes, the multiplexing clustering network processes the fourth K neighbor graph of the isolated node, and obtains the confidence of the connecting edge corresponding to each neighboring node in the isolated node and the fourth K neighbor graph.
S235: and determining whether the isolated node and the adjacent node corresponding to the highest reliability belong to the same clustering class based on the highest reliability in the fourth K adjacent graph.
Specifically, the nearest neighbor node with the highest reliability of the connecting edge with the isolated node in the fourth K-nearest neighbor graph after the clustering network processing and the reliability of the connecting edge between the nearest neighbor node and the isolated node are selected. And comparing the credibility with a preset credibility to further determine whether the isolated node belongs to the cluster category of the adjacent node. That is, it is determined whether the isolated node and the neighboring node are clustered to the same cluster class.
Specifically, in response to the highest confidence level in the fourth K neighbor graph of the isolated node exceeding the preset confidence level, it is determined that the neighboring node of the isolated node corresponding to the highest confidence level belongs to the same cluster class.
In response to the highest confidence level in the fourth K neighbor graph of the orphaned node not exceeding the preset confidence level, determining that the neighbor node of the orphaned node corresponding to the highest confidence level belongs to a different cluster class.
Based on the above steps S233 to S235, it is determined whether all the isolated nodes in the first clustering result belong to the same cluster as other nodes except the corresponding isolated node in the first clustering result, and have the same clustering category, so that remediation of the isolated nodes in the first clustering result is realized, and the accuracy and recall rate of the clustering result of the image to be clustered are improved.
In this embodiment, other clustering networks are not needed, but the clustering network in step S22 is reused, so that no additional workload is needed; and because the second K neighbor graph is obtained by the traditional method, the information contained in the graph is richer, and the recall rate of the master node can be improved. In this embodiment, the purified fourth K neighbor graph is used, so that the interference of the noise node on the master node feature graph can be avoided, the advantages brought by the rich information in the clustering network in step S22 can be utilized, and finally a higher recall rate is achieved.
The embodiment provides a target clustering method, which comprises the steps of generating a second K neighbor graph of each image to be clustered based on a plurality of acquired images to be clustered, wherein the images to be clustered comprise targets; in the second K neighbor graph, the associated images to be clustered are taken as main nodes, a plurality of other images to be clustered with the largest similarity are taken as neighbor nodes, and the main nodes are connected with the neighbor nodes through connecting edges; processing the second K neighbor graph by adopting a clustering network, and determining a first detection result of a connecting edge between a main node corresponding to the second K neighbor graph and each neighbor node; and clustering the plurality of images to be clustered based on the first detection result of each connecting edge. The second K neighbor graph is processed based on the clustering network to obtain a first detection result of a connecting edge between the main node and the neighbor nodes, the second K neighbor graph is purified to obtain a third K neighbor graph, and the third K neighbor graph based on purification is used for clustering the images to be clustered, so that the accuracy of clustering results can be improved, and meanwhile, the high recall rate of the clustering results can also be improved.
Referring to fig. 6, fig. 6 is a schematic block diagram of a cluster network training apparatus according to the present invention.
The embodiment provides a clustering network training device 60, and the clustering network training device 60 includes an obtaining module 61, a predicting module 62, an analyzing module 63, and a training module 64.
The obtaining module 61 is configured to obtain a training sample set, where the training sample set includes a plurality of sample images including a target object, each sample image is associated with a first K-nearest neighbor graph and a clustering difficulty coefficient, in the first K-nearest neighbor graph, the associated sample image is used as a master node, and a plurality of other sample images with the largest similarity are used as nearest neighbor nodes, the master node and the nearest neighbor nodes are connected by a connection edge, when the master node and the nearest neighbor nodes belong to the same target object, the connection edge is a positive edge, otherwise, the connection edge is a negative edge, and the larger the negative edge ratio of the first K-nearest neighbor graph is, the larger the corresponding clustering difficulty coefficient is.
The prediction module 62 is configured to process the first K-nearest neighbor graph associated with each sample image based on the clustering network to obtain a type prediction result of a corresponding connection edge between the master node and each nearest neighbor node in the first K-nearest neighbor graph; the type prediction result of the connection edge is used for representing the probability value that the main node and/or the adjacent node connected with the connection edge belong to the same target object.
The analysis module 63 is configured to substitute the type prediction result of the connection edge and the clustering difficulty coefficient of the master node and/or the neighboring node connected to the connection edge into a loss function to obtain a loss value, where an absolute value of the loss value is positively correlated to the substituted clustering difficulty coefficient.
The training module 64 is configured to iteratively train the clustering network based on the loss values.
The clustering network training device provided by the embodiment trains the clustering network based on the sample images with different clustering difficulty coefficients, so that the clustering network attaches more importance to the prediction accuracy of the sample images with larger clustering difficulty coefficients, the compatibility of the clustering network with noise data is improved, and the clustering accuracy and the recall rate of the clustering network are improved.
Referring to fig. 7, fig. 7 is a schematic block diagram of a target clustering apparatus according to the present invention.
The present embodiment provides an object clustering device 70, and the object clustering device 70 includes an image capturing module 71, a detecting module 72, and a clustering module 73.
The image acquisition module 71 is configured to generate a second K nearest neighbor map of each image to be clustered based on the acquired multiple images to be clustered, which include the target; in the second K neighbor graph, the associated images to be clustered are used as main nodes, a plurality of other images to be clustered with the largest similarity are used as neighbor nodes, and the main nodes are connected with the neighbor nodes through connecting edges.
The detection module 72 is configured to process the second K neighbor graph by using a clustering network, and determine a first detection result of a connection edge between a master node and each neighbor node corresponding to the second K neighbor graph; the clustering network is obtained by training through the clustering network training method.
The clustering module 73 is configured to cluster the multiple images to be clustered based on the first detection result of each connection edge.
The target clustering device provided by this embodiment processes the second K neighbor graph based on the clustering network to obtain the first detection result of the connecting edge between the master node and the neighbor nodes, and performs purification processing on the second K neighbor graph to obtain the third K neighbor graph, and clustering of the images to be clustered based on the purified third K neighbor graph can improve the accuracy of the clustering result, and can also improve the high recall rate of the clustering result.
Referring to fig. 8, fig. 8 is a schematic block diagram of a terminal according to an embodiment of the present invention. The terminal 80 includes a memory 81 and a processor 82 coupled to each other, and the processor 82 is configured to execute program instructions stored in the memory 81 to implement the steps of any of the above embodiments of the clustering network training method and the target clustering method. In one particular implementation scenario, the terminal 80 may include, but is not limited to: a microcomputer, a server, and in addition, the terminal 80 may further include a mobile device such as a notebook computer, a tablet computer, and the like, which is not limited herein.
In particular, the processor 82 is configured to control itself and the memory 81 to implement the steps of any of the above-described embodiments of the clustering network training method and the target clustering method. The processor 82 may also be referred to as a CPU (Central Processing Unit). The processor 82 may be an integrated circuit chip having signal processing capabilities. The Processor 82 may also be a general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 82 may be collectively implemented by an integrated circuit chip.
Referring to fig. 9, fig. 9 is a schematic block diagram of an embodiment of a computer-readable storage medium according to the present invention. The computer readable storage medium 90 stores program instructions 901 capable of being executed by a processor, the program instructions 901 are used for implementing the steps of any one of the above embodiments of the clustering network training method and the target clustering method.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and for specific implementation, reference may be made to the description of the above method embodiments, and for brevity, details are not described here again.
The foregoing description of the various embodiments is intended to highlight various differences between the embodiments, and the same or similar parts may be referred to each other, and for brevity, will not be described again herein.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is only one type of logical division, and other divisions may be implemented in practice, for example, the unit or component may be combined or integrated with another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some interfaces, and may be in an electrical, mechanical or other form.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
If the technical scheme of the application relates to personal information, a product applying the technical scheme of the application clearly informs personal information processing rules before processing the personal information, and obtains personal independent consent. If the technical scheme of the application relates to sensitive personal information, a product applying the technical scheme of the application obtains individual consent before processing the sensitive personal information, and simultaneously meets the requirement of 'express consent'. For example, at a personal information collection device such as a camera, a clear and significant identifier is set to inform that the personal information collection range is entered, the personal information is collected, and if the person voluntarily enters the collection range, the person is considered as agreeing to collect the personal information; or on the device for processing the personal information, under the condition of informing the personal information processing rule by using obvious identification/information, obtaining personal authorization by modes of popping window information or asking a person to upload personal information of the person by himself, and the like; the personal information processing rule may include information such as a personal information processor, a personal information processing purpose, a processing method, and a type of personal information to be processed.
The above description is only an embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent structures or equivalent processes performed by the present invention or directly or indirectly applied to other related technical fields are also included in the scope of the present invention.
Claims (14)
1. A method for cluster network training, the method comprising:
acquiring a training sample set, wherein the training sample set comprises a plurality of sample images containing a target object, each sample image is respectively associated with a first K neighbor graph and a clustering difficulty coefficient, in the first K neighbor graph, the associated sample image is used as a master node, a plurality of other sample images with the largest similarity are used as neighbor nodes, the master node is connected with the neighbor nodes through a connecting edge, when the master node and the neighbor nodes belong to the same target object, the connecting edge is a positive edge, otherwise, the connecting edge is a negative edge, and the larger the negative edge ratio of the first K neighbor graph is, the larger the corresponding clustering difficulty coefficient is;
processing a first K neighbor graph associated with each sample image based on a clustering network to obtain a type prediction result of the corresponding connecting edge between the main node and each neighbor node in the first K neighbor graph; the type prediction result of the connection edge is used for representing the probability value that the main node and the adjacent node connected with the connection edge belong to the same target object;
substituting the type prediction result of the connecting edge, the clustering difficulty coefficients of the main node and the neighboring nodes connected by the connecting edge into a loss function to obtain a loss value, wherein the absolute value of the loss value is positively correlated with the substituted clustering difficulty coefficient;
performing iterative training on the clustering network based on the loss value;
wherein the clustering network comprises a graph convolution network and a neural network, the graph convolution network and the neural network being connected,
the processing, based on a clustering network, of a first K-nearest neighbor graph associated with each sample image to obtain a type prediction result of the corresponding connecting edge between the master node and each nearest neighbor node in the first K-nearest neighbor graph includes:
performing feature fusion on the target feature map of each adjacent node in the first K adjacent map of the sample image through the graph convolution network to obtain an updated feature map of the master node; determining, by the neural network, a type prediction result for the connecting edge between the master node and the neighbor node based on the updated feature map of the master node and the updated feature map of the neighbor node;
the obtaining a loss value by substituting the type prediction result of the connection edge, the clustering difficulty coefficients of the master node and the neighboring nodes connected by the connection edge into a loss function, further comprising:
determining the loss value based on a hyper-parameter, the clustering difficulty coefficient of the master node and the neighboring node connected by the connecting edge, and the probability value output by the clustering network.
2. The method of claim 1, wherein the training of the clustering network is performed,
the substituting the type prediction result of the connection edge, the clustering difficulty coefficients of the master node and the neighbor nodes connected by the connection edge into a loss function comprises:
selecting a maximum value from the clustering difficulty coefficients of the master node and the neighbor nodes to which the connecting edge is connected;
substituting the maximum value into the loss function.
3. The method according to claim 1, wherein the absolute value of the loss value is positively correlated to the power function of the substituted clustering difficulty coefficient.
4. The method of cluster network training according to claim 1,
the method for determining the clustering difficulty coefficient comprises the following steps:
determining a negative edge ratio of the master node based on the total number of the neighbor nodes in the first K neighbor graph and the number of the neighbor nodes belonging to the same target object as the master node, the negative edge ratio being used as the clustering difficulty coefficient.
5. A target clustering method, characterized in that the target clustering method comprises:
generating a second K neighbor graph of each image to be clustered based on the acquired images to be clustered, wherein the images to be clustered comprise targets; in the second K neighbor graph, the associated image to be clustered is taken as a master node, a plurality of other images to be clustered with the largest similarity are taken as neighbor nodes, and the master node is connected with the neighbor nodes through connecting edges;
processing the second K neighbor graph by adopting a clustering network, and determining a first detection result of the connecting edge between the main node corresponding to the second K neighbor graph and each neighbor node; the clustering network is trained by the clustering network training method of any one of the claims 1~4;
and clustering the images to be clustered based on the first detection result of each connecting edge.
6. The method for clustering targets of claim 5, wherein the first detection result of the connecting edge comprises a reliability of the connecting edge;
the clustering the multiple images to be clustered based on the first detection result of each connecting edge comprises:
based on the credibility of each connecting edge, carrying out deletion processing on the second K neighbor graph of each main node to obtain a third K neighbor graph of each main node;
clustering the multiple images to be clustered to obtain a first clustering result based on the third K neighbor graph of each main node; the first clustering result includes a clustering category of each of the master nodes.
7. The method of clustering objects according to claim 6,
the pruning processing of the second K neighbor graph of each master node based on the credibility of each connecting edge includes:
deleting the connecting edge between the master node and the neighbor node in response to a trustworthiness of the connecting edge between the master node and the neighbor node being below a threshold;
responsive to a trustworthiness of the connection edge between the master node and the neighbor node being below the threshold, reserving the connection edge between the master node and the neighbor node.
8. The target clustering method of claim 6, characterized in that the first clustering result comprises at least one orphaned node; the cluster type of the isolated node is different from the cluster types of other main nodes;
the target clustering method further comprises the following steps:
based on the second K neighbor graphs of the isolated nodes and the second K neighbor graphs of other main nodes except the isolated nodes in the first clustering result, respectively, carrying out purification treatment on the second K neighbor graphs of the isolated nodes to obtain fourth K neighbor graphs of the isolated nodes;
processing a fourth K neighbor graph of the isolated node by adopting the clustering network to obtain the credibility of the isolated node and the connecting edge corresponding to each neighbor node in the fourth K neighbor graph;
the highest of the confidence levels in the fourth K neighbor graph, determining whether the orphan node corresponding to the highest confidence level is attributed to the same cluster class.
9. The method of object clustering according to claim 8,
the purifying the second K neighbor graphs of the isolated nodes to obtain fourth K neighbor graphs of the isolated nodes based on the second K neighbor graphs of the isolated nodes and the second K neighbor graphs of the other master nodes except the isolated nodes in the first clustering result respectively comprises:
selecting a neighbor node of any one isolated node in the second K neighbor graph of the isolated node as a selected node;
judging whether the selected node is a neighboring node of the isolated node in a second K neighboring graph of the isolated node and whether the isolated node is a neighboring node of the selected node in the second K neighboring graph of the selected node;
disconnecting the connecting edge between the isolated node and the selected node in a second K neighbor graph of the isolated node if the isolated node is not a neighbor node of the selected node;
if the selected node is a neighbor node of the isolated node and the isolated node is a neighbor node of the selected node, reserving the connecting edge between the isolated node and the selected node;
and traversing all the neighbor nodes of the isolated nodes, and determining a fourth K neighbor graph of the isolated nodes.
10. The method of clustering objects according to claim 8,
said determining, based on the highest of the confidence levels in the fourth K neighbor graph, whether the orphan node corresponding to the highest confidence level belongs to the same of the cluster classes comprises:
in response to the highest of the confidence levels in the fourth K neighbor graph of orphaned nodes exceeding a preset confidence level, determining that the neighbor nodes to which the orphaned nodes correspond with the highest confidence level belong to the same cluster class;
in response to the highest of the confidence levels in the fourth K neighbor graph of orphaned nodes not exceeding the preset confidence level, determining that the neighbor nodes to which the orphaned nodes correspond with the highest confidence level belong to the different cluster class.
11. A clustering network training apparatus, characterized in that the clustering network training apparatus comprises:
an obtaining module, configured to obtain a training sample set, where the training sample set includes a plurality of sample images including a target object, each sample image is associated with a first K-nearest neighbor graph and a clustering difficulty coefficient, in the first K-nearest neighbor graph, the associated sample image is used as a master node, a plurality of other sample images with the largest similarity are used as nearest neighbor nodes, and the master node and the nearest neighbor nodes are connected by a connecting edge;
the prediction module is used for processing a first K neighbor graph associated with each sample image based on a clustering network to obtain a type prediction result of the corresponding connecting edge between the main node and each neighbor node in the first K neighbor graph; the type prediction result of the connection edge is used for representing the probability value that the main node and the adjacent node connected with the connection edge belong to the same target object; the prediction module is further used for performing feature fusion on target feature maps of the adjacent nodes in a first K adjacent map of the sample image through the graph convolution network to obtain an updated feature map of the master node; determining, by the neural network, a type prediction result for the connecting edge between the master node and the neighbor node based on the updated feature map of the master node and the updated feature map of the neighbor node;
an analysis module, configured to substitute the type prediction result of the connection edge, and the clustering difficulty coefficients of the master node and the neighboring nodes connected by the connection edge into a loss function, so as to obtain a loss value, where an absolute value of the loss value is positively correlated to the substituted clustering difficulty coefficient; wherein the analysis module is further configured to determine the loss value based on a hyper-parameter, the clustering difficulty coefficients of the master node and the neighboring nodes connected by the connecting edge, and the probability value output by the clustering network;
and the training module is used for carrying out iterative training on the clustering network based on the loss value.
12. An object clustering apparatus, characterized in that the object clustering apparatus comprises:
the image acquisition module is used for generating a second K neighbor map of each image to be clustered based on the acquired images to be clustered, wherein the images to be clustered comprise targets; in the second K neighbor graph, the associated images to be clustered are used as main nodes, a plurality of other images to be clustered with the largest similarity are used as neighbor nodes, and the main nodes and the neighbor nodes are connected through connecting edges;
the detection module is used for processing the second K neighbor graph by adopting a clustering network and determining a first detection result of the connecting edge between the main node corresponding to the second K neighbor graph and each neighbor node; the clustering network is trained by the clustering network training method of any one of the claims 1~4;
and the clustering module is used for clustering the plurality of images to be clustered based on the first detection result of each connecting edge.
13. A terminal, comprising a memory, a processor and a computer program stored in the memory and running on the processor, the processor being configured to execute ordinal data to implement the steps in a method of cluster network training according to any of claims 1~4; or implementing the steps in the target clustering method as claimed in any one of claims 5 to 10.
14. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, implements the steps in the method for training a cluster network according to any one of claims 1~4; or implementing the steps in the target clustering method as claimed in any one of claims 5 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211014416.XA CN115083003B (en) | 2022-08-23 | 2022-08-23 | Clustering network training and target clustering method, device, terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211014416.XA CN115083003B (en) | 2022-08-23 | 2022-08-23 | Clustering network training and target clustering method, device, terminal and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115083003A CN115083003A (en) | 2022-09-20 |
CN115083003B true CN115083003B (en) | 2022-11-22 |
Family
ID=83244407
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211014416.XA Active CN115083003B (en) | 2022-08-23 | 2022-08-23 | Clustering network training and target clustering method, device, terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115083003B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110458078A (en) * | 2019-08-05 | 2019-11-15 | 高新兴科技集团股份有限公司 | A kind of face image data clustering method, system and equipment |
WO2020047854A1 (en) * | 2018-09-07 | 2020-03-12 | Intel Corporation | Detecting objects in video frames using similarity detectors |
CN112101086A (en) * | 2020-07-24 | 2020-12-18 | 南京航空航天大学 | Face clustering method based on link prediction |
CN112766421A (en) * | 2021-03-12 | 2021-05-07 | 清华大学 | Face clustering method and device based on structure perception |
CN114359605A (en) * | 2021-12-10 | 2022-04-15 | 浙江大华技术股份有限公司 | Face clustering method, device and equipment |
-
2022
- 2022-08-23 CN CN202211014416.XA patent/CN115083003B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020047854A1 (en) * | 2018-09-07 | 2020-03-12 | Intel Corporation | Detecting objects in video frames using similarity detectors |
CN110458078A (en) * | 2019-08-05 | 2019-11-15 | 高新兴科技集团股份有限公司 | A kind of face image data clustering method, system and equipment |
CN112101086A (en) * | 2020-07-24 | 2020-12-18 | 南京航空航天大学 | Face clustering method based on link prediction |
CN112766421A (en) * | 2021-03-12 | 2021-05-07 | 清华大学 | Face clustering method and device based on structure perception |
CN114359605A (en) * | 2021-12-10 | 2022-04-15 | 浙江大华技术股份有限公司 | Face clustering method, device and equipment |
Non-Patent Citations (2)
Title |
---|
"Learning to Cluster Faces via Confidence and Connectivity Estimation";Lei Yang et al.;《arXiv》;20200401;第1-10页 * |
"基于图神经网络的百万数据人脸聚类";何川 等;《微电子学与计算机》;20220731;第24-35页 * |
Also Published As
Publication number | Publication date |
---|---|
CN115083003A (en) | 2022-09-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109583332B (en) | Face recognition method, face recognition system, medium, and electronic device | |
CN110188829B (en) | Neural network training method, target recognition method and related products | |
CN111506773B (en) | Video duplicate removal method based on unsupervised depth twin network | |
CN111401344A (en) | Face recognition method and device and training method and device of face recognition system | |
CN111931859B (en) | Multi-label image recognition method and device | |
TWI780567B (en) | Object re-recognition method, storage medium and computer equipment | |
CN110175515B (en) | Face recognition algorithm based on big data | |
CN112163637B (en) | Image classification model training method and device based on unbalanced data | |
CN113850243A (en) | Model training method, face recognition method, electronic device and storage medium | |
CN114627406A (en) | Method, system, equipment and medium for identifying rapid crowd gathering behaviors | |
CN111062431A (en) | Image clustering method, image clustering device, electronic device, and storage medium | |
CN114299567B (en) | Model training method, living body detection method, electronic device, and storage medium | |
CN113076963B (en) | Image recognition method and device and computer readable storage medium | |
CN117523218A (en) | Label generation, training of image classification model and image classification method and device | |
CN109359689B (en) | Data identification method and device | |
CN113128526B (en) | Image recognition method and device, electronic equipment and computer-readable storage medium | |
CN114519863A (en) | Human body weight recognition method, human body weight recognition apparatus, computer device, and medium | |
CN113610770A (en) | License plate recognition method, device and equipment | |
Ramachandra et al. | Perceptual metric learning for video anomaly detection | |
CN115083003B (en) | Clustering network training and target clustering method, device, terminal and storage medium | |
CN117095460A (en) | Self-supervision group behavior recognition method and system based on long-short time relation predictive coding | |
CN114255360A (en) | Image clustering method and device and computer storage medium | |
CN111709473A (en) | Object feature clustering method and device | |
CN113128278A (en) | Image identification method and device | |
CN116246086A (en) | Image clustering method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |