Face clustering method and device, electronic equipment and computer readable storage medium

By constructing a feature matrix and using a ramp coefficient for evaluation, the most accurate face clustering results are determined, which solves the problem of low face clustering accuracy in existing technologies and achieves higher clustering accuracy.

CN115862092BActive Publication Date: 2026-02-17ISA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211441293.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2026-02-17
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

The accuracy of face clustering results in existing technologies is relatively low.

Method used

By determining the predicted number of faces and the feature matrix of the face sample image set, a clustering algorithm is used to perform clustering, and the accuracy of the clustering results is evaluated using the slope coefficient. Finally, the clustering result corresponding to the target slope coefficient is determined as the most accurate clustering result.

Benefits of technology

This improves the accuracy of face clustering and ensures the accuracy and reliability of the clustering results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115862092B_ABST
    Figure CN115862092B_ABST
Patent Text Reader

Abstract

The application discloses a face clustering method and device, electronic equipment and a computer readable storage medium. The method comprises the following steps: determining a face sample image set to be clustered and a predicted face quantity set of the face sample image set; determining a face feature corresponding to a face sample image in the face sample image set; constructing a feature matrix corresponding to the face sample image set according to the face feature; clustering the feature matrix by using a clustering algorithm according to the predicted face quantity set, obtaining a face clustering result corresponding to a plurality of quantities in the predicted face quantity set; evaluating the face clustering result to obtain a slope coefficient corresponding to the face clustering result; and determining a clustering result corresponding to a target slope coefficient as a target face clustering result. The application solves the technical problem of low accuracy of the clustering result in the related art.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of face clustering, in particular to a face clustering method and device, electronic equipment and a computer readable storage medium. BACKGROUND

[0002] Face clustering has received great attention in the past few decades and has a wide range of applications in personal photo management and entertainment. The purpose of face clustering is to group face images with the same identity into a group, while distinguishing different identities through different clustering labels. However, when performing face clustering in the related art, there is a problem of low accuracy of clustering results.

[0003] For the above problems, no effective solution has been proposed so far. SUMMARY

[0004] The embodiments of the present application provide a face clustering method, device, electronic equipment and computer readable storage medium to at least solve the technical problem of low accuracy of clustering results when performing face clustering in the related art.

[0005] According to an aspect of an embodiment of the present application, a face clustering method is provided, comprising: determining a face sample image set to be clustered and a predicted face number set of the face sample image set, wherein the predicted face number set comprises a plurality of numbers; determining face features corresponding to face sample images in the face sample image set; constructing a feature matrix corresponding to the face sample image set according to the face features; clustering the feature matrix according to the predicted face number set using a clustering algorithm to obtain face clustering results corresponding to the plurality of numbers in the predicted face number set respectively; evaluating the face clustering results to obtain slope coefficients corresponding to the face clustering results respectively, wherein the slope coefficients are used to evaluate the accuracy of the face clustering results; determining the clustering result corresponding to the target slope coefficient as the target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients.

[0006] Optionally, the constructing a feature matrix corresponding to the face sample image set according to the face features comprises: constructing a similarity matrix corresponding to the face sample image set according to the cosine similarity between each face feature in the face features and each face feature in the face features; constructing an adjacency matrix corresponding to the face sample image set using a sliding window method according to the similarity matrix; and constructing the feature matrix corresponding to the face sample image set according to the adjacency matrix.

[0007] Optionally, the constructing the adjacency matrix corresponding to the face sample image set according to the similarity matrix comprises: determining a predetermined number of target row vectors according to the similarity matrix; determining a sliding window width corresponding to each of the predetermined number of target row vectors respectively; determining a window mean value, a tail mean value and a tail variance corresponding to each of the predetermined number of target row vectors according to the sliding window width corresponding to each of the predetermined number of target row vectors respectively; determining a candidate threshold value corresponding to each of the predetermined number of target row vectors according to the window mean value, the tail mean value and the tail variance corresponding to each of the predetermined number of target row vectors respectively; determining a target threshold value from the candidate threshold value corresponding to each of the predetermined number of target row vectors respectively, the target threshold value being the maximum threshold value; and constructing the adjacency matrix corresponding to the face sample image set according to the target threshold value corresponding to each of the predetermined number of target row vectors.

[0008] Optionally, the determining the predetermined number of target row vectors according to the similarity matrix comprises: normalizing the similarity matrix to obtain a normalized matrix; arranging vectors in each row of the normalized matrix in descending order to determine a predetermined number of initial row vectors of the normalized matrix; and first-order differentiating the initial row vectors to obtain the predetermined number of target row vectors, wherein the predetermined number is determined according to the number of rows of the normalized matrix.

[0009] Optionally, the constructing the feature matrix corresponding to the face sample image set according to the adjacency matrix comprises: constructing a transition matrix according to the adjacency matrix, wherein a feature vector of the transition matrix is related to the adjacency matrix; and constructing the feature matrix corresponding to the face sample image set according to the transition matrix by using a Laplace transform method.

[0010] Optionally, the determining the face feature corresponding to each face sample image in the face sample image set comprises: inputting the face sample image set into a face feature model to obtain a face feature corresponding to each face sample image in the face sample image set, wherein the face feature model is obtained by training a training sample, and the training sample comprises a face training sample image and a face feature corresponding to the face training sample image.

[0011] Optionally, the evaluating the face clustering result to obtain a slope coefficient corresponding to the face clustering result respectively comprises: determining an intra-class difference degree between each face sample image in the face clustering result and other face sample images in a current class, and an inter-class difference degree between each face sample image in the face clustering result and face sample images in other classes respectively; and obtaining the slope coefficient corresponding to the face clustering result respectively according to the intra-class difference degree and the inter-class difference degree.

[0012] According to an aspect of an embodiment of the present application, a face clustering device is provided, comprising: a first determining module configured to determine a face sample image set to be clustered and a predicted face quantity set of the face sample image set, wherein the predicted face quantity set comprises a plurality of quantities; a second determining module configured to determine face features corresponding to face sample images in the face sample image set; a constructing module configured to construct a feature matrix corresponding to the face sample image set according to the face features; a clustering module configured to cluster the feature matrix according to the predicted face quantity set by using a clustering algorithm to obtain face clustering results corresponding to the plurality of quantities in the predicted face quantity set respectively; an evaluating module configured to evaluate the face clustering results to obtain a slope coefficient corresponding to the face clustering result respectively, wherein the slope coefficient is used to evaluate the accuracy of the face clustering result; and a third determining module configured to determine a clustering result corresponding to a target slope coefficient as a target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficient.

[0013] According to an aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the face clustering method of any of the above.

[0014] According to an aspect of an embodiment of the present application, a computer readable storage medium is provided, when instructions in the computer readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the face clustering method of any of the above.

[0015] In the embodiment of the present application, the face sample image set to be clustered and the predicted face quantity set of the face sample image set are determined, wherein the predicted face quantity set comprises a plurality of quantities; the face features corresponding to the face sample images in the face sample image set are determined; then the feature matrix corresponding to the face sample image set is constructed according to the face features; the feature matrix is clustered by using a clustering algorithm according to the predicted face quantity set, to obtain a plurality of face clustering results respectively corresponding to the quantities in the predicted face quantity set; the face clustering results are evaluated to obtain a slope coefficient respectively corresponding to the face clustering results for evaluating the accuracy of the face clustering results; and the clustering result corresponding to the target slope coefficient is determined as the target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients. Since the slope coefficient is used to evaluate the accuracy of the face clustering result, the more accurate face clustering result can be determined according to the target slope coefficient, so that the face clustering result with higher accuracy is determined, thereby realizing the technical effect of determining the face clustering result with higher accuracy, and further solving the technical problem of low accuracy of the clustering result in the related art. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

[0017] Figure 1 is a flow chart of a face clustering method according to an embodiment of the present application;

[0018] Figure 2 is a structural block diagram of a face clustering device according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.

[0020] It is to be understood that the terms "first", "second", and the like, used in the description and the claims of the application and the above-described drawings, are used to distinguish between similar objects, and are not necessarily used to describe a particular sequential or chronological order. It is to be understood that the use of the terms so-termed "first", "second", and the like, can be interchanged, where appropriate, to refer to the same element in different embodiments of the application described herein, which can be implemented in other than the order described or illustrated herein. Furthermore, the terms "comprise" and "comprising", and any variation thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or apparatus that comprises a list of steps or units can not necessarily be limited to those steps or units which are clearly recited, but can include other steps or units that are not expressly listed or inherent to such process, method, product or apparatus.

[0021] Embodiment 1

[0022] According to an embodiment of the application, there is provided an embodiment of a face clustering method, it is to be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.

[0023] Figure 1 is a flowchart of a face clustering method according to an embodiment of the application, as shown in Figure 1 the method comprises the following steps:

[0024] Step S102, determining a face sample image set to be clustered and a predicted face number set of the face sample image set, wherein the predicted face number set comprises a plurality of numbers;

[0025] Step S104, determining a face feature corresponding to a face sample image in the face sample image set;

[0026] Step S106, constructing a feature matrix corresponding to the face sample image set according to the face feature;

[0027] Step S108, clustering the feature matrix by using a clustering algorithm according to the predicted face number set, to obtain a plurality of face clustering results respectively corresponding to the plurality of numbers in the predicted face number set;

[0028] Step S110, evaluating the face clustering results to obtain a slope coefficient corresponding to each face clustering result, wherein the slope coefficient is used to evaluate the accuracy of the face clustering result;

[0029] Step S112, determining a clustering result corresponding to a target slope coefficient as a target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients.

[0030] By the above steps, the face sample image set to be clustered and the predicted face number set of the face sample image set are determined, wherein the predicted face number set includes multiple numbers; the face features corresponding to the face sample images in the face sample image set are determined; then the feature matrix corresponding to the face sample image set is constructed according to the face features; the feature matrix is clustered by using a clustering algorithm according to the predicted face number set, to obtain face clustering results respectively corresponding to the multiple numbers in the predicted face number set; the face clustering results are evaluated to obtain slope coefficients respectively corresponding to the face clustering results for evaluating the accuracy of the face clustering results; and the clustering result corresponding to the target slope coefficient is determined as the target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients. Since the slope coefficients are used to evaluate the accuracy of the face clustering results, the target face clustering result with higher accuracy can be determined according to the target slope coefficient, so that the technical effect of determining the face clustering result with higher accuracy is achieved, and thus the technical problem of low accuracy of the clustering result in the related art is solved.

[0031] As an optional embodiment, the face sample image set to be clustered and the predicted face number set of the face sample image set are determined, wherein the predicted face number set includes multiple numbers, for example, N face sample images are determined as the face sample image set to be clustered, and the predicted face number set is a, b, and c, wherein a, b, and c are different positive integers, that is, the predicted face number set includes three numbers, which are a, b, and c. After the predicted face number set is determined, the face sample image set to be clustered can be divided into a clusters, or the face sample image set to be clustered can be divided into b clusters, or the face sample image set to be clustered can be divided into c clusters, and the numbers in the predicted face number set can be adaptively determined according to the number of face sample images in the face sample image set. By determining the predicted face number set, the number of clusters can be determined, so that the clustering result can be accurately determined.

[0032] As an optional embodiment, the face features corresponding to the face sample images in the face sample image set are determined, and by determining the face features, the face features on which the face clustering is based can be determined.

[0033] As an optional embodiment, there are various ways to determine the face features corresponding to the face sample images in the face sample image set. For example, the face sample image set can be input into a face feature model to obtain the face features corresponding to each face sample image in the face sample image set. The face feature model is obtained by training a training sample, and the training sample includes a face training sample image and a face feature corresponding to the face training sample image. Through the face feature model, the face features corresponding to the face sample images can be quickly and accurately determined.

[0034] As an optional embodiment, a feature matrix corresponding to the face sample image set is constructed according to the face features. Through the construction of the feature matrix, the face features can be quickly processed, and a quantifiable feature matrix can be obtained according to the face features.

[0035] As an optional embodiment, the feature matrix corresponding to the face sample image set can be constructed in various ways according to the face features. For example, a similarity matrix corresponding to the face sample image set can be constructed according to the cosine similarity between each face feature in the face features and each face feature in the face features. According to the similarity matrix, an adjacency matrix corresponding to the face sample image set is constructed by using a sliding window method. According to the adjacency matrix, a feature matrix corresponding to the face sample image set is constructed. In this way, the time complexity of the method provided in the present application can be reduced, and the feature matrix can be determined more quickly.

[0036] As an optional embodiment, there are various ways to construct the adjacency matrix corresponding to the face sample image set according to the similarity matrix by using the sliding window method. For example, a predetermined number of target row vectors can be determined according to the similarity matrix. The sliding window width corresponding to each target row vector is determined respectively. The window mean, tail mean and tail variance corresponding to each target row vector are determined according to the sliding window width corresponding to each target row vector respectively. The candidate threshold value corresponding to each target row vector is determined according to the window mean, tail mean and tail variance corresponding to each target row vector respectively. The maximum threshold value as a target threshold value is determined from the candidate threshold values corresponding to the predetermined number of target row vectors respectively. The adjacency matrix corresponding to the face sample image set is constructed according to the target threshold values corresponding to the predetermined number of target row vectors respectively. By determining the adaptive threshold value, the adjacency matrix is adjusted specifically, and the accuracy of face clustering is improved.

[0037] As an optional embodiment, the predetermined number of target row vectors can be determined in various ways according to the similarity matrix. For example, the initial row vectors can be determined by normalizing the similarity matrix to obtain a normalized matrix, arranging the vectors in each row of the normalized matrix in descending order, and first-order differentiating the initial row vectors to obtain the predetermined number of target row vectors, wherein the predetermined number is determined according to the number of rows of the normalized matrix. In this way, the initial row vectors are determined based on the normalized matrix, so that the initial row vectors are more ordered and more standardized. Then, the target row vectors are obtained by first-order differentiating the initial row vectors, so that the target row vectors can be quickly determined.

[0038] As an optional embodiment, the feature matrix corresponding to the face sample image set can be constructed in various ways according to the adjacency matrix. For example, a transition matrix can be constructed according to the adjacency matrix, wherein the eigenvectors of the transition matrix are related to the adjacency matrix. Then, the feature matrix corresponding to the face sample image set can be constructed by using the Laplace transform method based on the transition matrix, which can simplify the calculation in the method provided in the present application and reduce the calculation amount. In this way, the feature matrix that can reduce the calculation amount can be determined on the basis of ensuring accuracy, which is conducive to the implementation of the present application.

[0039] As an optional embodiment, the feature matrix can be clustered by using a clustering algorithm according to the predicted face number set to obtain face clustering results respectively corresponding to the plurality of numbers in the predicted face number set. The clustering algorithm can be various algorithms, for example, the K-means algorithm. When the predicted face number set has three numbers, three face clustering results respectively corresponding to the three numbers can be obtained. When the predicted face number set has five numbers, five face clustering results respectively corresponding to the five numbers can be obtained. In this way, a plurality of face clustering results can be determined, and then the face clustering result with the highest accuracy can be selected from the plurality of face clustering results as the final face clustering result. Moreover, the use of unsupervised clustering algorithm greatly reduces the cost of manual labeling.

[0040] As an optional embodiment, the face clustering results are evaluated to obtain slope coefficients respectively corresponding to the face clustering results, wherein the slope coefficients are used to evaluate the accuracy of the face clustering results. Through the slope coefficients, the accuracy of the plurality of face clustering results can be represented by numerical values, so that the accuracy of the plurality of face clustering results can be compared.

[0041] As an optional embodiment, when the face clustering result is evaluated to obtain the slope coefficients corresponding to the face clustering result respectively, a plurality of ways can be used, for example, the intra-class difference degree between each face sample image in the face clustering result and other face sample images in the current class, that is, the difference degree between an image and other images classified into the same class, can be determined, and the smaller the difference degree, the smaller the difference between the images, and the more accurate the classification. And the inter-class difference degree between each face sample image in the face clustering result and the face sample images in other classes, that is, the difference degree between an image and images in other classes, the greater the difference degree, the greater the difference between the images, and the more accurate the classification. According to the intra-class difference degree and the inter-class difference degree, the slope coefficients corresponding to the face clustering result respectively are obtained. In this way, the slope coefficients can be accurately determined.

[0042] As an optional embodiment, the clustering result corresponding to the target slope coefficient is determined as the target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients. Through the target slope coefficient, the target face clustering result determined is the face clustering result with the highest accuracy in the plurality of face clustering results.

[0043] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is specifically described as follows.

[0044] In the related art, when face clustering is performed, there is a technical problem that the accuracy of the clustering result is low.

[0045] In view of this, the present application provides a face clustering method in an optional embodiment, which can determine a face clustering result with high accuracy.

[0046] S1, for a set of N face sample images to be clustered, the features x of each face are extracted according to the face feature model i , which is expressed as

[0047] S2, according to the face feature , a similarity matrix S can be constructed N*N , wherein S(i,j)=D(x i ,x j ), i,j∈(1,N), D represents the cosine similarity, that is, the first row and the first column S(1,1) of the similarity matrix is the cosine similarity between x1 and x1, the first row and the second column S(1,2) of the similarity matrix is the cosine similarity between x1 and x2, and the similarity matrix S can be constructed N*N .

[0048] S3, normalizing the similarity matrix to obtain a normalized matrix P, the normalized matrix P can be determined by the following formula:

[0049]

[0050] In the formula, P N×N (i, j) represents the i-th row and j-th column of the normalized matrix P, and S(i, j) represents the i-th row and j-th column of the similarity matrix.

[0051] S4, arranging the vectors in each row of the normalized matrix in descending order to determine the initial row vectors of the normalized matrix, and first-order difference of the initial row vectors to obtain a predetermined number of target row vectors, wherein the predetermined number is determined according to the number of the normalized matrix, and the formula of the first-order difference is:

[0052]

[0053] In the formula, is the initial row vector obtained after arranging the i-th row of the normalized matrix P in descending order, is the j-th element of the initial row vector, is the j+1-th element of the initial row vector, is the j-th element of the target row vector obtained by first-order difference of the initial row vector. According to the formula and the initial row vector, the target row vector

[0054] S5, respectively determining the sliding window width ω corresponding to the target row vector, and sliding in the direction from back to front to determine the out-window mean tail mean tail variance The formula is as follows:

[0055]

[0056]

[0057]

[0058] Wherein, K=S=N.

[0059] S6, according to the window mean, tail mean and tail variance corresponding to the target row vector, respectively determining the candidate threshold value corresponding to the target row vector:

[0060]

[0061] Wherein, q=j+[w / 2], q is the threshold mark point.​

[0062] S7, find the position q where the maximum value in the candidate threshold corresponding to the target row vector is located * , respectively, determine the maximum threshold value in the candidate threshold corresponding to the target row vector as the target threshold value, and the similarity threshold value can also be called The adjacency matrix W is obtained according to the following formula:

[0063]

[0064] S8, the process of constructing the feature matrix F according to the adjacency matrix W is as follows:

[0065] The degree matrix is constructed according to the adjacency matrix W:

[0066]

[0067] Construct the normalized Laplacian matrix L=D-W, and calculate the eigenvectors f corresponding to the maximum k eigenvalues of X.

[0068] Standardize f to obtain the feature matrix F.

[0069] S9, use the K-means clustering algorithm to cluster F to obtain b-a+1 clustering results, that is, b-a+1 categories, wherein the predicted face quantity set has b-a+1 quantities.

[0070] The process of clustering evaluation for each face clustering result in the multiple face clustering results is as follows:

[0071] Suppose x j ,j=1,...,n, is divided into c categories, ω q ,q=1,...,c, wherein c=b-a+1, and x j ∈ω q , x j represents the jth face sample image, w q represents the qth category, and the jth face sample image is divided into the qth category.

[0072] The statistical quantity of the intra-class difference degree is a(j), and the intra-class difference degree represents the difference degree between the face sample images in each cluster. The smaller the intra-class difference degree, the smaller the difference between the face sample images in the cluster, that is, the cluster is more accurate. a(j) can be determined by the following formula:

[0073]

[0074] Where x≠x j , |ω q| represents the number of samples in the class.

[0075] The statistical quantity of the inter-class difference degree is b(j), and the inter-class difference degree represents the difference degree between the face sample images in different clusters. The smaller the inter-class difference degree is, the smaller the difference between the face sample images in one cluster and the face sample images in another cluster is, that is, the accuracy of the two clusters is lower. b(j) can be determined by using the following formula:

[0076]

[0077]

[0078] wherein x j represents the jth face sample image, w q represents the qth class, L(x j , ω t ) is used to describe the average distance between the jth sample and all samples in the tth class, the jth sample does not belong to the tth class, at this time, ω t is called the second class of x j . b(j) represents the average distance between x j and the second class ω t .

[0079] The statistical quantity of the cluster effect profile value s(j) can be calculated by the following formula:

[0080]

[0081] The value range of the profile value is [-1, 1], when b(j) >> a(j), the profile value is close to 1, at this time, the intra-class difference is very small. It is considered that the sample x j is divided into a suitable class. When b(j) ≈ a(j), the profile value is close to 0, at this time, the sample is uncertain whether it should be assigned to the qth class or should be assigned to the suboptimal tth class, because the distances to the two classes are equal. When b(j) << a(j), the profile value is close to -1, at this time, the intra-class difference with the second class w t is very small, and the intra-class difference with the belonging class w q is larger. It is considered that the sample is misclassified, x j should be divided into w t , and should not be divided into w q , and the usual clustering algorithm will obtain a local optimal solution.

[0082] S10, calculating the slope coefficient

[0083]

[0084] The slope coefficient is a further optimization of the silhouette coefficient. When the number of clusters reaches the maximum silhouette statistic, the silhouette statistic continues to increase as the number of clusters increases. Based on this idea, the slope coefficient is defined as:

[0085]

[0086] where p is a positive number used to adjust the weight between and .

[0087]

[0088] S11, calculate the corresponding slope coefficient after each clustering, select the maximum slope coefficient as the target slope coefficient, and determine the face clustering result corresponding to the target slope coefficient as the target face clustering result, wherein the target face clustering result is the most accurate face clustering result in the plurality of face clustering results.

[0089] Through the above optional implementation, at least the following beneficial effects can be achieved: the face clustering result with higher accuracy is determined.

[0090] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0091] Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and a general hardware platform as necessary, and of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the method of each embodiment of the present application.

[0092] Embodiment 2

[0093] According to the embodiments of the present application, a device for implementing the face clustering method is also provided, Figure 2 is a structural block diagram of the face clustering device according to the embodiments of the present application, as shown in Figure 2As shown, the apparatus comprises a first determining module 202, a second determining module 204, a constructing module 206, a clustering module 208, an evaluating module 210 and a third determining module 212, which are described in detail as follows.

[0094] The first determining module 202 is configured to determine a face sample image set to be clustered and a predicted face quantity set of the face sample image set, wherein the predicted face quantity set comprises a plurality of quantities. The second determining module 204 is connected to the first determining module 202 and configured to determine face features corresponding to face sample images in the face sample image set. The constructing module 206 is connected to the second determining module 204 and configured to construct a feature matrix corresponding to the face sample image set according to the face features. The clustering module 208 is connected to the constructing module 206 and configured to cluster the feature matrix according to the predicted face quantity set by using a clustering algorithm to obtain face clustering results respectively corresponding to the plurality of quantities in the predicted face quantity set. The evaluating module 210 is connected to the clustering module 208 and configured to evaluate the face clustering results to obtain slope coefficients respectively corresponding to the face clustering results, wherein the slope coefficients are used to evaluate the accuracy of the face clustering results. The third determining module 212 is connected to the evaluating module 210 and configured to determine a clustering result corresponding to a target slope coefficient as a target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients.

[0095] It should be noted that the first determining module 202, the second determining module 204, the constructing module 206, the clustering module 208, the evaluating module 210 and the third determining module 212 correspond to steps S102 to S112 in the face clustering method, and the plurality of modules have the same instances and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 1.

[0096] Embodiment 3

[0097] According to another aspect of the embodiments of the present application, an electronic device is further provided, comprising a processor and a memory for storing processor-executable instructions, wherein the processor is configured to execute the instructions to implement any of the face clustering methods.

[0098] Embodiment 4

[0099] According to another aspect of the embodiments of the present application, a computer-readable storage medium is further provided, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the face clustering methods.

[0100] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0101] In the above-mentioned embodiments of the present application, the description of each embodiment is focused on, and the part not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0102] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and in actual implementation, there can be another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, and can be electrical or other forms.

[0103] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed to a plurality of units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0104] In addition, each functional unit in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0105] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part of the prior art that contributes or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0106] The above-mentioned is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be regarded as the protection scope of the present application.

Claims

1. A face clustering method, characterized in that, The method comprises the following steps: determining a set of face sample images to be clustered and a set of predicted face numbers of the set of face sample images, wherein the set of predicted face numbers comprises a plurality of numbers; determining face features corresponding to face sample images in the set of face sample images; constructing a feature matrix corresponding to the set of face sample images according to the face features; performing clustering on the feature matrix by using a clustering algorithm according to the set of predicted face numbers, to obtain face clustering results corresponding to the plurality of numbers in the set of predicted face numbers respectively; evaluating the face clustering results to obtain slope coefficients corresponding to the face clustering results respectively, wherein the slope coefficients are used to evaluate the accuracy of the face clustering results; determining a clustering result corresponding to a target slope coefficient as a target face clustering result, wherein the target slope coefficient is the largest coefficient in the slope coefficients; wherein the constructing a feature matrix corresponding to the set of face sample images according to the face features comprises: constructing a similarity matrix corresponding to the set of face sample images according to the cosine similarity between each face feature in the face features and each face feature in the face features; determining a predetermined number of target row vectors according to the similarity matrix; determining a sliding window width corresponding to each of the predetermined number of target row vectors respectively; determining a window mean, a tail mean and a tail variance corresponding to each of the predetermined number of target row vectors respectively according to the sliding window width corresponding to each of the predetermined number of target row vectors respectively; determining a candidate threshold value corresponding to each of the predetermined number of target row vectors respectively according to the window mean, the tail mean and the tail variance corresponding to each of the predetermined number of target row vectors respectively; determining a maximum threshold value as a target threshold value from the candidate threshold values corresponding to each of the predetermined number of target row vectors respectively; constructing an adjacency matrix corresponding to the set of face sample images according to the target threshold value corresponding to each of the predetermined number of target row vectors respectively; and constructing the feature matrix corresponding to the set of face sample images according to the adjacency matrix.

2. The method of claim 1, wherein, The determining a predetermined number of target row vectors according to the similarity matrix comprises: normalizing the similarity matrix to obtain a normalized matrix; arranging the vectors in each row of the normalized matrix in descending order to determine a plurality of initial row vectors of the normalized matrix; first-order differentiating the initial row vectors to obtain the predetermined number of target row vectors, wherein the predetermined number is determined according to the number of the plurality of initial row vectors.

3. The method of claim 1, wherein, The constructing the feature matrix corresponding to the set of face sample images according to the adjacency matrix comprises: constructing a transition matrix according to the adjacency matrix, wherein the eigenvectors of the transition matrix are related to the adjacency matrix; constructing the feature matrix corresponding to the set of face sample images by using Laplace transform method according to the transition matrix.

4. The method of claim 1, wherein, The determining face features corresponding to face sample images in the set of face sample images comprises: inputting the set of face sample images into a face feature model to obtain a face feature corresponding to each face sample image in the set of face sample images, wherein the face feature model is obtained by training a training sample, and the training sample comprises a face training sample image and a face feature corresponding to the face training sample image.

5. The method according to any one of claims 1 to 4, characterized in that, The evaluating the face clustering result comprises: determining an intra-class difference between each face sample image in each class in the face clustering result and other face sample images in the current class, and an inter-class difference between each face sample image in each class in the face clustering result and face sample images in other classes; obtaining the slope coefficient corresponding to the face clustering result according to the intra-class difference and the inter-class difference.

6. A face clustering apparatus, characterized by comprising: comprise: a first determining module configured to determine a set of face sample images to be clustered and a set of predicted face numbers of the set of face sample images, wherein the set of predicted face numbers comprises a plurality of numbers; a second determining module configured to determine a face feature corresponding to a face sample image in the set of face sample images; a constructing module configured to construct a feature matrix corresponding to the set of face sample images according to the face feature; a clustering module configured to cluster the feature matrix by using a clustering algorithm according to the set of predicted face numbers to obtain a face clustering result corresponding to each number in the set of predicted face numbers; an evaluating module configured to evaluate the face clustering result to obtain a slope coefficient corresponding to the face clustering result, wherein the slope coefficient is used to evaluate the accuracy of the face clustering result; a third determining module configured to determine a clustering result corresponding to a target slope coefficient as a target face clustering result, wherein the target slope coefficient is a largest coefficient in the slope coefficient. The constructing module is further configured to construct a similarity matrix corresponding to the set of face sample images according to a cosine similarity between each face feature in the face feature and each face feature in the face feature, determine a predetermined number of target row vectors according to the similarity matrix, determine a sliding window width corresponding to each target row vector, respectively, determine a window mean value, a tail mean value and a tail variance corresponding to each target row vector according to the sliding window width corresponding to each target row vector, respectively, determine a candidate threshold value corresponding to each target row vector according to the window mean value, the tail mean value and the tail variance corresponding to each target row vector, respectively, determine a maximum threshold value as a target threshold value from the candidate threshold value corresponding to each target row vector, respectively, construct an adjacency matrix corresponding to the set of face sample images according to the target threshold value corresponding to each target row vector, respectively, and construct the feature matrix corresponding to the set of face sample images according to the adjacency matrix.

7. An electronic device, comprising: comprise: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the face clustering method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the face clustering method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Face clustering method and device, computer equipment and storage medium

    CN110889433A

  • Text clustering method based on improved spectral clustering algorithm

    CN112464638A