A face image clustering method and device for link prediction based on self-attention mechanism
Through the link prediction method based on the self-attention mechanism, combined with the self-attention module and the union search algorithm, the problem of low face clustering accuracy in the existing technology is solved, and higher clustering accuracy and feature enhancement are achieved. Effect.
Patent Information
- Application Number
- CN202111512763.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-11
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-12-11
AI Technical Summary
Existing face clustering methods have low accuracy, low-discrimination sample features are difficult to predict directly, and traditional methods and deep learning methods are difficult to improve accuracy.
A link prediction method based on the self-attention mechanism is used to convert the clustering task into a classification task. The features of the original node are enhanced by extracting and combining the contextual information of some neighbor nodes to reduce the influence of low-discrimination samples. The self-attention module is used The union-find algorithm is used to merge clustering results.
It improves the accuracy of clustering results, reduces the negative impact of low-discrimination samples, enhances feature distribution, and improves the accuracy of face image clustering.
Smart Images

Figure FDA0003405835180000011 
Figure FDA0003405835180000012 
Figure FDA0003405835180000014
Abstract
Description
Technical Field
[0001] The present invention relates to the research fields of image recognition and image processing, and in particular to a face image clustering method and device for link prediction based on a self-attention mechanism. Background Art
[0002] As the scale of face datasets becomes increasingly large, manual labeling requires a lot of manpower and resources. Face clustering methods can greatly reduce the workload of data labeling.
[0003] In the process of realizing the present invention, the inventors found that there are at least the following problems in the prior art: the existing face clustering methods generally make different assumptions directly on the input features. For example, the DB-SCAN algorithm requires that the density of each cluster is greater than a specific threshold. Various clustering algorithms using a single dimension, such as: clustering schemes based on traditional clustering algorithms, face clustering schemes based on adjacency relationship metric distance, face clustering schemes based on hierarchical clustering, or a combination of several of these algorithms, have low accuracy. In addition, there are always samples with low discrimination, and the links between these sample features are usually difficult to predict directly. It is also difficult to improve the accuracy through traditional methods and recent deep learning methods. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the present invention provides a face image clustering method and device based on self-attention mechanism for link prediction. The clustering task can be converted into a classification task through link prediction, which can improve the accuracy of clustering results; by extracting and combining the context information of some neighbor nodes, the effect of enhancing the original node features can be achieved, reducing the negative impact of samples with low distinctiveness. The technical solution is as follows:
[0005] The present invention provides a face image clustering method for link prediction based on a self-attention mechanism, the method comprising the following steps:
[0006] Step 1: Select samples. Assuming that the total number of samples is N, extract features of the selected samples through the face recognition model to obtain face features of dimension D. For the i-th sample, extract the face identity feature f of dimension D through the face recognition model. i , i∈{1, 2, ... N}, then the face feature matrix F of all samples is obtained, F∈RN ×D .
[0007] Step 2: The face identity feature f of the i-th sample i , input the feature enhancement encoding module based on context information for enhancement. The specific steps are as follows:
[0008] For the i-th sample, select the first k1 samples with the highest feature similarity, that is, the first k1 neighbor nodes in the feature graph, to form candidate set ①: For the samples in candidate set ①, take the corresponding face features in the face feature matrix F to form the feature matrix
[0009] for For each sample, select the first k2 samples with the highest feature similarity, that is, the neighbor nodes in the feature graph, to form a candidate set ②: For the samples in candidate set ②, take the corresponding features in the face feature matrix F to form a new feature matrix
[0010] Will The features in and their corresponding candidate set ② Through e self-attention modules, the converted features are obtained Will With original features By normalizing and adding, we get Enhanced features That is, the candidate enhanced feature set of the i-th sample,
[0011] At the same time, for the i-th sample, select k2 samples with the highest feature similarity to form a candidate set, take the corresponding face features in the face feature matrix F, and form the feature matrix For the feature matrix of the i-th sample and the original eigenvector f i Through e self-attention modules, the converted features are obtained f i and Through normalization and addition operations, we get the relationship enhancement feature vector
[0012] Step 3: For the candidate enhanced feature set of the i-th sample Input it into the relation encoding module with self-attention to obtain the final set of all possible links l for the i-th sample i , the specific steps are as follows:
[0013] for Each enhanced feature in the candidate set ①, that is, the corresponding enhanced feature in the candidate set ①, passes through e self-attention modules to obtain the encoded feature matrix Encoding features The relationship between each vector of the original sample is enhanced by Concatenate them to get k1 final relation encoding vectors.
[0014] The final relation encoding vector is used as the input of the multi-layer perceptron, and the output is k1 links, which represent the links between the original sample and the k1 samples in the candidate set ①. Their set is l i .
[0015] Step 4: The link set of all samples {l1, l2, ...l N}, merge them through the union-find algorithm to get the final clustering result.
[0016] Preferably, among the e self-attention modules, e is determined by the data scale.
[0017] Compared with the prior art, one of the above technical solutions has the following beneficial effects: the facial features are passed through a self-attention-based encoder, and some samples with higher sample similarity are simultaneously used as the input of the encoder to obtain an enhanced facial feature of the sample, and the distribution of the feature reduces the impact of low discrimination to a certain extent. Multiple enhanced features are input into a prediction module, which includes a self-attention submodule and a fully connected network to predict the links between these samples. Finally, all links are merged through the union-find method to obtain the final clustering result. The clustering task can be converted into a classification task through link prediction, which can improve the accuracy of the clustering results; by extracting and combining the context information of some neighbor nodes, the effect of enhancing the original node features is achieved, reducing the negative impact of samples with low discrimination. DETAILED DESCRIPTION
[0018] In order to illustrate the technical solution and working principle of the present invention, the embodiments of the present invention will be described in further detail below. All the above optional technical solutions can be combined in any way to form optional embodiments of the present invention, which will not be described one by one here.
[0019] The terms "step 1", "step 2", "step 3", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those described herein.
[0020] In the first aspect, the present disclosure provides a face image clustering method for link prediction based on a self-attention mechanism, the method comprising the following steps:
[0021] Step 1: Select samples. Assuming that the total number of samples is N, extract features of the selected samples through the face recognition model to obtain face features of dimension D. For the i-th sample, extract the face identity feature f of dimension D through the face recognition model. i, i∈{1, 2, ... N}, then we get the face feature matrix F of all samples, F∈R N×D .
[0022] Step 2: The face identity feature f of the i-th sample i , input the feature enhancement encoding module based on context information for enhancement. The specific steps are as follows:
[0023] For the i-th sample, select the first k1 samples with the highest feature similarity, that is, the first k1 neighbor nodes in the feature graph, to form candidate set ①: For the samples in candidate set ①, take the corresponding face features in the face feature matrix F to form the feature matrix
[0024] for For each sample, select the first k2 samples with the highest feature similarity, that is, the neighbor nodes in the feature graph, to form a candidate set ②: For the samples in candidate set ②, take the corresponding features in the face feature matrix F to form a new feature matrix
[0025] Will The features in and their corresponding candidate set ② Through e self-attention modules (e is determined by the data scale, generally 2), the converted features are obtained Will With original features By normalizing and adding, we get Enhanced features That is, the candidate enhanced feature set of the i-th sample,
[0026] At the same time, for the i-th sample, select k2 samples with the highest feature similarity to form a candidate set, take the corresponding face features in the face feature matrix F, and form the feature matrix For the feature matrix of the i-th sample and the original eigenvector f i Through e self-attention modules, the converted features are obtained f i and Through normalization and addition operations, we get the relationship enhancement feature vector
[0027] Through step 2, the original sample and its corresponding sample in candidate set ① will use the features of some of its neighbor node samples as context information, so that their features are enhanced and the similar points between similar samples become more significant.
[0028] Step 3: For the candidate enhanced feature set of the i-th sample Input it into the relation encoding module with self-attention to obtain the final set of all possible links l for the i-th sample i , the specific steps are as follows:
[0029] for Each enhanced feature in the candidate set ①, that is, the corresponding enhanced feature in the candidate set ①, passes through e self-attention modules to obtain the encoded feature matrix Encoding features The relationship between each vector of the original sample is enhanced by Concatenate them to get k1 final relation encoding vectors.
[0030] The final relation encoding vector is used as the input of the multi-layer perceptron, and the output is k1 links, which represent the links between the original sample and the k1 samples in the candidate set ①. Their set is l i .
[0031] Through the self-attention operation in step 3, only the features of the samples in the candidate set ① are relationally encoded. After learning, self-attention weakens the negative impact of low-discrimination samples and improves the accuracy of predicting links.
[0032] Step 4: The link set of all samples {l1, l2, ...l N}, merge them through the union-find algorithm to get the final clustering result.
[0033] In the second aspect, an embodiment of the present disclosure provides a face image clustering device for link prediction based on a self-attention mechanism. Based on the same technical concept, the device can implement or execute a face image clustering method for link prediction based on a self-attention mechanism described in any one of all possible implementation methods.
[0034] The above-mentioned embodiment provides a face image clustering device for link prediction based on the self-attention mechanism and a face image clustering method for link prediction based on the self-attention mechanism, which belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0035] The present invention is described above by way of example. Obviously, the specific implementation of the present invention is not limited to the above-mentioned method. Any non-substantial improvements made by adopting the method concept and technical solution of the present invention; or directly applying the above-mentioned concept and technical solution of the present invention to other occasions without improvement or equivalent replacement, are all within the protection scope of the present invention.
Claims
1. A face image clustering method for link prediction based on self-attention mechanism, characterized in that: The method comprises the following steps: Step 1: Select samples. Assuming that the total number of samples is N, extract features of the selected samples through the face recognition model to obtain face features of dimension D. For the i-th sample, extract the face identity feature f of dimension D through the face recognition model. i , i∈{1, 2, ... N}, then we get the face feature matrix F of all samples, F∈R N×D ; Step 2: The face identity feature f of the i-th sample i , input the feature enhancement encoding module based on context information for enhancement. The specific steps are as follows: For the i-th sample, select the first k1 samples with the highest feature similarity, that is, the first k1 neighbor nodes in the feature graph, to form candidate set ①: For the samples in candidate set ①, take the corresponding face features in the face feature matrix F to form the feature matrix for For each sample, select the first k2 samples with the highest feature similarity, that is, the neighbor nodes in the feature graph, to form a candidate set ②: For the samples in candidate set ②, take the corresponding features in the face feature matrix F to form a new feature matrix Will The features in and their corresponding candidate set ② Through e self-attention modules, the converted features are obtained Will With original features By normalizing and adding, we get Enhanced features That is, the candidate enhanced feature set of the i-th sample, At the same time, for the i-th sample, select k2 samples with the highest feature similarity to form a candidate set, take the corresponding face features in the face feature matrix F, and form the feature matrix For the feature matrix of the i-th sample and the original eigenvector f i Through e self-attention modules, the converted features are obtained f i and Through normalization and addition operations, we get the relationship enhancement feature vector Step 3: For the candidate enhanced feature set of the i-th sample Input it into the relation encoding module with self-attention to obtain the final set of all possible links l for the i-th sample i , the specific steps are as follows: for Each enhanced feature in the candidate set ①, that is, the corresponding enhanced feature in the candidate set ①, passes through e self-attention modules to obtain the encoded feature matrix Encoding features The relationship between each vector of the original sample is enhanced by Concatenate and obtain k1 final relational encoding vectors; The final relation encoding vector is used as the input of the multi-layer perceptron, and the output is k1 links, which represent the links between the original sample and the k1 samples in the candidate set ①. Their set is l i ; Step 4: The link set of all samples {l1, l2, ...l N }, merge them through the union-find algorithm to get the final clustering result.
2. According to claim 1, a face image clustering method for link prediction based on self-attention mechanism is characterized in that: Among the e self-attention modules, e is determined by the data scale.
3. A face image clustering device for link prediction based on self-attention mechanism, characterized in that: The device can implement a face image clustering method for link prediction based on a self-attention mechanism as described in any one of claims 1-2.
Citation Information
Patent Citations
Multiple-target tracking method and device based on improved random forest
CN103400391A
Human face clustering method based on link prediction
CN112101086A
Human face-based unknown spoofing attack living body detection method and system
CN113312965A
Facial recognition method and apparatus, terminal, and computer readable storage medium
WO2020037937A1
