Clustering method, device and computer readable storage medium

By reducing and screening image features, the efficiency and accuracy of image clustering are improved, and the problems of low clustering efficiency and insufficient accuracy in the prior art are solved.

CN114387461BActive Publication Date: 2025-04-29ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111454874.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-01
Publication Date
2025-04-29
Estimated Expiration
2041-12-01

AI Technical Summary

Technical Problem

When the prior art uses clustering algorithms to cluster images, the efficiency is low and the accuracy rate needs to be improved.

Method used

By performing dimensionality reduction processing on the original features of the to-cluster image, a second image feature with a dimension smaller than the original feature is obtained. The first image to-cluster that is most similar is initially screened out, and then the second image to-cluster whose similarity meets the preset requirements is screened based on the original features, and finally the clustering process is performed.

Benefits of technology

The efficiency and accuracy of clustering are improved, and the calculation amount is reduced by reducing dimensionality, ensuring the accuracy of clustering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114387461B_ABST
    Figure CN114387461B_ABST
Patent Text Reader

Abstract

The present application discloses a clustering method, device and computer-readable storage medium, the method comprising: extracting first image features of multiple images to be clustered respectively; encoding each first image feature respectively to obtain corresponding second image features, wherein the dimension of the second image feature is smaller than the dimension of the corresponding first image feature; searching for a preset number of first images to be clustered that are most similar to each image to be clustered in multiple images to be clustered based on the corresponding second image features; selecting second images to be clustered in a preset number of first images to be clustered corresponding to each image to be clustered respectively, wherein the similarity between the image to be clustered and the corresponding second images to be clustered based on the corresponding first image features meets a first preset requirement; clustering multiple images to be clustered according to the second images to be clustered corresponding to each image to be clustered. The clustering method of the present application can improve the efficiency and accuracy of clustering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image clustering, and in particular to a clustering method, device and computer-readable storage medium. Background Art

[0002] In the field of computer vision, clustering algorithms are needed to cluster a large number of images, for example, to group facial photos of the same person into one category.

[0003] However, currently, when clustering algorithms are used to cluster images, it takes a long time, the clustering efficiency is low, and the accuracy needs to be further improved. Summary of the invention

[0004] The present application provides a clustering method, device and computer-readable storage medium, which can improve the efficiency and accuracy of clustering.

[0005] A first aspect of an embodiment of the present application provides a clustering method, which includes: respectively extracting first image features of multiple images to be clustered; respectively encoding each of the first image features to obtain corresponding second image features, wherein the dimension of the second image features is smaller than the dimension of the corresponding first image features; based on the corresponding second image features, respectively searching for a preset number of first images to be clustered that are most similar to each of the multiple images to be clustered; respectively screening out second images to be clustered from the preset number of first images to be clustered corresponding to each of the images to be clustered, wherein the similarity between the images to be clustered and the corresponding second images to be clustered based on the corresponding first image features meets a first preset requirement; and clustering the multiple images to be clustered according to the second images to be clustered corresponding to each of the images to be clustered.

[0006] A second aspect of an embodiment of the present application provides a clustering device, which includes a processor, a memory, and a communication circuit. The processor is coupled to the memory and the communication circuit, respectively. Program data is stored in the memory. The processor implements the steps in the above method by executing the program data in the memory.

[0007] A third aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the steps in the above method.

[0008] The beneficial effect is as follows: the present application first performs dimensionality reduction processing on the original features (i.e., first image features) of the image to be clustered to obtain the corresponding second image features, and then for each image to be clustered, a preset number of first images to be clustered with the most similarity are initially screened out according to the second image features, and then for each image to be clustered, the second images to be clustered whose similarity meets the first preset requirements are screened out according to the original features (first image features), and finally, clustering processing is performed on multiple images to be clustered according to the results of the two screenings. Since the dimension of the second image feature is smaller than the dimension of the first image feature, the computational complexity of the first screening is small, which can reduce the computational complexity of the entire clustering process, and the second screening is based on the original features (first image features), so the accuracy of subsequent clustering can be guaranteed, so the method of the present application can both improve the efficiency of clustering and ensure the accuracy of clustering. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0010] Figure 1 It is a flow chart of an implementation method of the clustering method of the present application;

[0011] Figure 2 yes Figure 1 Schematic diagram of the process of step S150;

[0012] Figure 3 yes Figure 2 Schematic diagram of the process of step S153;

[0013] Figure 4 It is a structural schematic diagram of an implementation method of a clustering device of the present application;

[0014] Figure 5 It is a structural schematic diagram of another embodiment of the clustering device of the present application;

[0015] Figure 6 It is a structural schematic diagram of an implementation method of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0017] See also Figure 1 , Figure 1 : is a schematic diagram of a flow chart of an implementation method of a clustering method of the present application, the method comprising:

[0018] S110: Extract first image features of a plurality of images to be clustered respectively.

[0019] Among them, the purpose of this application is to cluster multiple images to be clustered and classify images belonging to the same target object into one category.

[0020] The first image feature of each image to be clustered is a multi-dimensional vector, and the first image feature of the image to be clustered is the original feature of the image to be clustered.

[0021] S120: Encode each first image feature respectively to obtain a corresponding second image feature, wherein the dimension of the second image feature is smaller than the dimension of the corresponding first image feature.

[0022] The first image feature is encoded to reduce the dimension of the first image feature, thereby reducing the amount of subsequent calculations and improving the clustering speed.

[0023] The second image feature is also a multidimensional vector, but the length of the second image feature is smaller than the length of the first image feature.

[0024] In this embodiment, step S120 specifically performs hash coding on the first image feature to obtain the corresponding second image feature.

[0025] After hash coding, the dimension of the obtained second image feature is smaller than the dimension of the first image feature, and the elements in the second image feature are either 0 or 1, thereby reducing the amount of subsequent calculations.

[0026] When performing hash coding on the first image feature, a traditional hash coding method may be used, or a method extended from the traditional hash coding method, such as a local sensitive hash coding method, may be used.

[0027] The process of performing hash coding on the first image feature belongs to the prior art, and the process is briefly introduced below:

[0028] Wherein, it is assumed that the first image features are x1, x2, x3, ... x n , where n is the number of images to be clustered, and the dimension of the first image features is d. In this case, the first image features are constructed into a matrix X, and X∈R n*d , where R n*d Represents a matrix with n rows and d columns.

[0029] A projection matrix W is determined in advance by the hashing method, W∈R d*k , then the matrix X is projected to obtain the matrix P, where P = XW, P∈R n*k , k<d, where R n*k Represents a matrix with n rows and k columns.

[0030] Then enter the quantization stage, quantize the matrix P into the matrix B, and define the matrix B∈R n*k , another B ij =Q(p ij ),in, Among them, t j is the jth bit threshold predetermined by the hash method, Q(p ij ) represents the value after the element in the i-th row and j-th column of the matrix P is transformed.

[0031] After the quantization stage, the elements in the matrix B are either 0 or 1, and the vector formed by the data of each row in the matrix B is the second image feature corresponding to the first image feature of the corresponding row in the matrix X.

[0032] Through the above steps, the second image feature corresponding to each first image feature is obtained.

[0033] It should be noted that, in other implementations, other encoding methods may be used to encode the first image feature to obtain the corresponding second image feature, such as pq quantization encoding.

[0034] S130: Based on the corresponding second image feature, searching for a preset number of first images to be clustered that are most similar to each image to be clustered in the plurality of images to be clustered.

[0035] After obtaining the second image feature corresponding to each image to be clustered, the distance between the second image features corresponding to any two images to be clustered is calculated, thereby obtaining the similarity between the two images to be clustered.

[0036] When the first image feature is hash-coded to obtain the corresponding second image feature, the distance between the two second image features is calculated by specifically calculating the Hamming distance between the two second image features, thereby obtaining the similarity between the corresponding two images to be clustered. Calculating the Hamming distance between the two second image features only has the time complexity of an XOR operation in a computer.

[0037] Calculating the distance between the two second image features may also be calculating the cosine distance, Euclidean distance or other distances between the two second images, which is not limited here.

[0038] After obtaining the similarity between any two images to be clustered, for each image to be clustered, sort its similarity with all other images to be clustered, and then find a preset number of images to be clustered that are most similar to it according to the sorting result, that is, the preset number of first images to be clustered.

[0039] That is to say, for each image to be clustered, a preset number of first images to be clustered that are most similar to the image are found. The preset number can be set according to specific circumstances. For ease of description, the following description is based on the preset number being m.

[0040] Generally speaking, it is highly likely that the m first images to be clustered corresponding to the image to be clustered A belong to the same target object. However, considering that the data is very sparse in the actual process, it is possible that only a few of the m first images to be clustered belong to the same target object as the image to be clustered A. Therefore, for the accuracy of subsequent clustering, step S140 is executed.

[0041] S140: Screening out second images to be clustered from a preset number of first images to be clustered corresponding to each image to be clustered, wherein similarities between the images to be clustered and the corresponding second images to be clustered based on first image features meet a first preset requirement.

[0042] After obtaining m first images to be clustered corresponding to image A to be clustered, the similarities between image A to be clustered and the m first images to be clustered are determined respectively according to the corresponding first image features, wherein it is defined that image B to be clustered exists among the m first images to be clustered, then the distance (for example, cosine distance, Euclidean distance, etc.) between the first image feature of image A to be clustered and the first image feature of image B to be clustered is calculated to obtain the similarity between image A to be clustered and image B to be clustered.

[0043] After obtaining the similarity between the image to be clustered A and the m images to be clustered, the m first images to be clustered are screened for similarities that meet a first preset requirement, wherein the first preset requirement may be that the similarity is greater than a preset threshold value T1.

[0044] That is, the first preset requirement is used to determine which images of the corresponding m first images to be clustered and the image to be clustered A belong to the same target object. After step S140, for each image to be clustered, a corresponding second image to be clustered can be obtained.

[0045] S150: performing clustering processing on a plurality of images to be clustered according to a second image to be clustered corresponding to each image to be clustered.

[0046] After the above steps, it is highly likely that the image to be clustered and its corresponding second image to be clustered belong to the same target object. Based on the second image to be clustered corresponding to each image to be clustered, clustering processing can be performed on multiple images to be clustered.

[0047] In the related art, clustering is generally performed directly based on the original features of the images to be clustered. However, since the dimensions of the original features are usually large, the amount of calculation is large during the clustering process, resulting in slow clustering speed and prone to errors.

[0048] As can be seen from the above content, the present application first performs dimensionality reduction processing on the original features of the image to be clustered (i.e., the first image features) to obtain the corresponding second image features, and then for each image to be clustered, the first number of first images to be clustered with the most similarity is initially screened out according to the second image features, and then for each image to be clustered, the second images to be clustered whose similarity meets the first preset requirements are screened out according to the original features (first image features), and finally, the multiple images to be clustered are clustered according to the results of the two screenings. Since the dimension of the second image feature is smaller than the dimension of the first image feature, the computational complexity of the first screening is small, which can reduce the computational complexity of the entire clustering process, and the second screening is based on the original features (first image features), so the accuracy of subsequent clustering can be guaranteed. Therefore, the method of the present application can not only improve the speed of clustering, but also ensure the accuracy of clustering.

[0049] See also Figure 2 , step S150 specifically includes:

[0050] S151: constructing a first set corresponding to each image to be clustered, wherein the first set corresponding to the images to be clustered includes the image to be clustered and a second image to be clustered corresponding to the image to be clustered.

[0051] For the image A to be clustered, assuming that step S140 selects n second images to be clustered from its corresponding m first images to be clustered, the first set corresponding to the image A to be clustered is constructed using the image A to be clustered and the n second images to be clustered.

[0052] S152: Merge the obtained multiple first sets until the same image does not exist in any two obtained second sets.

[0053] Specifically, a plurality of images to be clustered are represented by a, b, c, ..., wherein it is assumed that the sets consisting of the images to be clustered a, the images to be clustered b, the second images to be clustered corresponding to the images to be clustered a, ... are represented by N(a), N(b), N(c), ..., respectively. Then N(a) and the image to be clustered a constitute the first set corresponding to the image to be clustered a, N(b) and the image to be clustered b constitute the first set corresponding to the image to be clustered b, N(c) and the image to be clustered c constitute the first set corresponding to the image to be clustered c, and so on.

[0054] When merging, if a∈N(b) or b∈N(a), the first set corresponding to the image to be clustered a and the first set corresponding to the image to be clustered b are merged; if a∈N(b) and b∈N(c), the first set corresponding to the image to be clustered a, the first set corresponding to the image to be clustered b, and the first set corresponding to the image to be clustered c are merged.

[0055] Among them, the same image will only appear once in the merged new set.

[0056] S153: performing clustering processing on the plurality of images to be clustered according to the obtained second set.

[0057] After the merging in step S152, the total number of elements in all the second sets is equal to the total number of the multiple images to be clustered. That is, assuming that h second sets are obtained, namely M1, M2, M3...M h , and the corresponding number of images included are n1, n2, n3…n h ,but

[0058] At this point, we can consider the second set M1, M2, M3…M h There is a high probability that the to-be-clustered images do not include the same target image at the same time, so the multiple to-be-clustered images can be clustered based on the obtained second set.

[0059] See also Figure 3 , step S153 specifically includes:

[0060] S1531: Perform clustering processing on each second set respectively to obtain a plurality of clusters of different categories, wherein the similarity between any two clusters corresponding to the second set is lower than a similarity threshold.

[0061] A clustering process is performed inside each second set, wherein the clustering method may be a hierarchical clustering method, such as an agglomerative hierarchical clustering method, or other clustering methods, such as a K-means clustering method. For ease of description, the clustering method is taken as an example for description below.

[0062] In the process of clustering the second set, in the initial stage, each image to be clustered is taken as a cluster, and then the similarity between any two clusters is calculated, and then the two clusters with the highest similarity and the highest similarity exceeding the similarity threshold T2 are merged. After obtaining a new cluster, the similarity between any two new clusters is calculated again, and then the two new clusters with the highest similarity and the highest similarity exceeding the similarity threshold T2 are merged. The above process is repeated until the preset clustering requirements are met and the final clusters of different categories are obtained.

[0063] In the process of clustering each second set, it is considered that two low-quality images to be clustered of different target objects may have a high similarity. For example, two different people are very similar when their side faces are blurred. Therefore, if the two images correspond to different people, but the postures of the corresponding people in the images are both blurred side faces, the two images may be merged during the clustering process.

[0064] Therefore, in order to avoid defects, the step of obtaining the similarity between any two clusters corresponding to each second set in this embodiment includes:

[0065] (a1) Determine a third image to be clustered that meets a second preset requirement from a first cluster and a second cluster in any two clusters corresponding to the second set.

[0066] (b1) respectively determining first similarities between each third image to be clustered in the first cluster and each third image to be clustered in the second cluster.

[0067] (c1) Determine the similarity between the first cluster and the second cluster based on the first similarity.

[0068] Among them, any two clusters corresponding to each second set are defined as the first cluster and the second cluster respectively.

[0069] First, the third images to be clustered that meet the second preset requirement are screened out from the first cluster and the second cluster respectively. That is to say, the third images to be clustered in the first cluster and the second cluster are all images to be clustered that meet the second preset requirement.

[0070] Then, the similarity between each third image to be clustered in the first cluster and each third image to be clustered in the second cluster is determined. For example, L third images to be clustered are screened out from the first cluster, and F third images to be clustered are screened out from the second cluster. Then, the first similarity between each image in the L third images to be clustered and each image in the F third images to be clustered is calculated to obtain L×F first similarities, wherein for each third image to be clustered in the first cluster, there are F first similarities corresponding thereto.

[0071] After obtaining multiple first similarities, the maximum value, average value, minimum value or median value of the multiple first similarities are calculated to obtain the similarity between the first cluster and the second cluster. The present application does not limit how to determine the similarity between the first cluster and the second cluster based on the multiple first similarities obtained.

[0072] It should be noted that, in other embodiments, when determining the similarity between the first cluster and the second cluster, it is also possible not to screen the images in the first cluster and the second cluster, and directly calculate the similarity between each image to be clustered in the first cluster and each image to be clustered in the second cluster, and then calculate the average value or maximum value of the obtained similarities to obtain the similarity between the first cluster and the second cluster.

[0073] In this embodiment, the second preset requirement includes at least one of an image quality score being higher than or equal to a score threshold and a clarity being higher than or equal to a clarity threshold.

[0074] At least one of the quality score and clarity of each image to be clustered is obtained in advance, and then whether the image to be clustered meets the second preset requirement is determined based on at least one of the quality score and clarity. The score threshold and the clarity threshold can be set according to the actual application scenario and are not limited here.

[0075] In this embodiment, in order to ensure the accuracy of clustering, the first similarity between the third image to be clustered in the first cluster and the third image to be clustered in the second cluster is determined based on the original features of the image to be clustered, that is, the corresponding first image features.

[0076] For example, the cosine distance or the Euclidean distance between the first image feature of the third image to be clustered in the first cluster and the first image feature of the third image to be clustered in the second cluster is calculated to obtain the first similarity.

[0077] In other embodiments, the first similarity can also be determined based on the corresponding second image features. Specifically, the cosine distance or Euclidean distance between the second image features of the third image to be clustered in the first cluster and the second image features of the third image to be clustered in the second cluster is calculated to obtain the first similarity.

[0078] S1532: Obtaining a clustering result of clustering the multiple images to be clustered according to the multiple clusters.

[0079] In one application scenario, after clustering each second set to obtain multiple clusters of different categories, it can be considered that the clustering processing of multiple images to be clustered has been completed, that is, the images in each cluster correspond to the same target object, and images in different clusters correspond to different target objects.

[0080] In another application scenario, considering that in step S140, when screening the second image to be clustered corresponding to each image to be clustered, there may be two images to be clustered corresponding to the same target object, but the similarity between the two images does not meet the first preset requirement, resulting in the subsequent two images to be clustered corresponding to the same target object not being classified into the same second set, affecting the accuracy of the final clustering. In order to avoid this defect, step S1532 specifically includes:

[0081] (a2) constructing a third set corresponding to each image in each cluster respectively, wherein the third set corresponding to the image includes images that are in a preset number of first images to be clustered corresponding to the image but are not in the corresponding second set.

[0082] (b2) In response to the fact that there are at least two third sets in the third sets corresponding to the clusters, both of which include the fourth image to be clustered, merging the cluster with the cluster in which the fourth image to be clustered is located.

[0083] For the image a to be clustered in the cluster, assuming that step S130 finds the m first images to be clustered that are most similar to it, for the sake of convenience, the set consisting of the m first images to be clustered is recorded as set G(a), and then the second set where the image A to be clustered is located is recorded as set M(a), then the third set T(a) corresponding to the image A to be clustered is constructed.

[0084] If there are images a1, a2, a3…a to be clustered in a cluster C1 p , then through the above method, we can determine all the corresponding third sets T(a1), T(a2), T(a3)…T(a p ).

[0085] Then traverse all the third sets T(a1), T(a2), T(a3)…T(a p ), if a certain image b to be clustered is found in T(a1), T(a2), T(a3)…T(a p), it is determined that the image b to be clustered has a relatively high probability of corresponding to the same target object as the cluster C1, and the cluster C1 is merged with the cluster C2 where the image b to be clustered is located.

[0086] Through the above method, the merging of clusters across the second set can be achieved, which can effectively improve the recall rate of clustering. In order to improve the accuracy of clustering, before merging the cluster C1 with the cluster C2 where the image b to be clustered is located, it is also determined whether the similarity between the cluster C1 and the cluster C2 meets the third preset requirement (for example, greater than a preset threshold). If it does, the merging process is performed, otherwise the merging process is not performed. That is to say, before merging the cluster with the cluster where the fourth image to be clustered is located, step (b2) determines whether the similarity between the cluster and the cluster where the fourth image to be clustered is located meets the third preset requirement; if it does, the step of merging the cluster with the cluster where the fourth image to be clustered is performed.

[0087] The process of calculating the similarity between two clusters can be found in the above-mentioned related content and will not be described in detail here.

[0088] Assuming that the number of the multiple images to be clustered is n, and the dimension of the first image feature is d, the existing method is used to directly perform hierarchical clustering on the multiple images to be clustered based on the first image feature. In order to calculate the similarity of any two images to be clustered, n 2 ×d multiplication operations.

[0089] Using the solution of the present application, first in step S120, hash coding is used for explanation, and only the calculation amount of projection and quantization needs to be considered, which is n×d×k multiplication operations; and in step S130, the Hamming distance between the two second images needs to be calculated, which requires n 2 ×k times of bit operations; and in step S140, it is necessary to calculate the similarity between the image to be clustered and the corresponding preset number m of images to be clustered, which requires n×d×m times of multiplication operations; and in step S150, when clustering is performed in each second set, it is necessary to perform Multiplication operations are performed, where h is the number of the second set. When the clusters across the second set are finally merged, the amount of calculation is small and can be ignored.

[0090] Therefore, the total amount of calculation in the solution of this application is: 2 ×k-order operations and n×d× times multiplication transport, among which,

[0091] Since k+m<<d, and bitwise operations are faster than multiplication operations, the clustering algorithm of the present application is more efficient than the prior art, and the two screening processes enable subsequent clustering to be performed on fewer data sets, thereby ensuring the accuracy of the clustering results.

[0092] See also Figure 4 , Figure 4 It is a structural diagram of an embodiment of a clustering device of the present application. The clustering device 200 includes a processor 210, a memory 220 and a communication circuit 230. The processor 210 is coupled to the memory 220 and the communication circuit 230 respectively. The memory 220 stores program data. The processor 210 implements the steps in any of the above-mentioned implementation methods by executing the program data in the memory 220. The detailed steps can be found in the above-mentioned implementations and will not be repeated here.

[0093] The clustering device 200 may be any device with algorithm processing capability, such as a computer or a mobile phone, and is not limited here.

[0094] See also Figure 5 , Figure 5 It is a structural diagram of another embodiment of the clustering device of the present application. The clustering device 300 includes an extraction module 310, an encoding module 320, a first search module 330, a second search module 340 and a clustering module 350.

[0095] The extraction module 310 is used to extract first image features of a plurality of images to be clustered respectively.

[0096] The encoding module 320 is connected to the extraction module 310 and is used to encode each first image feature respectively to obtain a corresponding second image feature, wherein the dimension of the second image feature is smaller than the dimension of the corresponding first image feature.

[0097] The first search module 330 is connected to the encoding module 320 and is used to search for a preset number of first images to be clustered that are most similar to each image to be clustered in the plurality of images to be clustered based on the corresponding second image features.

[0098] The second search module 340 is connected to the first search module 330, and is used to screen out second images to be clustered from a preset number of first images to be clustered corresponding to each image to be clustered, wherein the similarity between the image to be clustered and the corresponding second images to be clustered based on the corresponding first image features meets the first preset requirement.

[0099] The clustering module 350 is connected to the second search module 340 and is used to perform clustering processing on the multiple images to be clustered according to the second image to be clustered corresponding to each image to be clustered.

[0100] The clustering device 300 may be any device with algorithm processing capability, such as a computer or a mobile phone, and is not limited here.

[0101] The clustering device 300 executes the clustering method in any one of the above-mentioned embodiments when working. The specific clustering method can be found in the above-mentioned embodiments and will not be described in detail here.

[0102] See also Figure 6 , Figure 6 The computer-readable storage medium 400 stores a computer program 410, which can be executed by a processor to implement the steps in any of the above methods.

[0103] Among them, the computer-readable storage medium 400 can specifically be a device that can store the computer program 410, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or it can also be a server that stores the computer program 410. The server can send the stored computer program 410 to other devices for execution, or it can also run the stored computer program 410 by itself.

[0104] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A clustering method, characterized in that: The method comprises: Extracting first image features of a plurality of images to be clustered respectively; Encoding each of the first image features respectively to obtain a corresponding second image feature, wherein a dimension of the second image feature is smaller than a dimension of the corresponding first image feature; Based on the corresponding second image features, searching respectively among the plurality of images to be clustered a preset number of first images to be clustered that are most similar to each of the images to be clustered; Screening out second images to be clustered from the preset number of first images to be clustered corresponding to each of the images to be clustered, wherein similarities between the images to be clustered and the corresponding second images to be clustered based on the corresponding first image features meet a first preset requirement; Clustering is performed on a plurality of the images to be clustered according to the second image to be clustered corresponding to each of the images to be clustered.

2. The method according to claim 1, characterized in that The step of clustering a plurality of the images to be clustered according to the second image to be clustered corresponding to each of the images to be clustered comprises: Constructing a first set corresponding to each of the images to be clustered, wherein the first set corresponding to the images to be clustered includes the images to be clustered and the second images to be clustered corresponding to the images to be clustered; Merging the obtained multiple first sets until the same image does not exist in any two obtained second sets; According to the obtained second set, clustering processing is performed on the plurality of images to be clustered.

3. The method according to claim 2, characterized in that The step of clustering the plurality of images to be clustered according to the obtained second set comprises: Performing clustering processing on each of the second sets respectively to obtain a plurality of clusters of different categories, wherein the similarity between any two clusters corresponding to the second sets is lower than a similarity threshold; According to the plurality of clusters, a clustering result of clustering the plurality of images to be clustered is obtained.

4. The method according to claim 3, characterized in that The step of obtaining the similarity between any two of the clusters corresponding to the second set comprises: Determine a third image to be clustered that meets a second preset requirement in a first cluster and a second cluster in any two of the clusters corresponding to the second set; respectively determining first similarities between each of the third images to be clustered in the first cluster and each of the third images to be clustered in the second cluster; The similarity between the first cluster and the second cluster is determined according to the first similarity.

5. The method according to claim 4, characterized in that The second preset requirement includes at least one of a quality score of the image being higher than or equal to a score threshold and a clarity being higher than or equal to a clarity threshold.

6. The method according to claim 4, characterized in that The step of respectively determining a first similarity between each of the third images to be clustered in the first cluster and each of the third images to be clustered in the second cluster comprises: Based on the corresponding first image features, the first similarities between each of the third images to be clustered in the first cluster and each of the third images to be clustered in the second cluster are respectively determined.

7. The method according to claim 3, characterized in that The step of obtaining a clustering result of clustering the plurality of images to be clustered according to the plurality of clusters comprises: respectively constructing a third set corresponding to each image in each of the clusters, wherein the third set corresponding to the image includes images that are in the preset number of the first images to be clustered corresponding to the image but are not in the corresponding second set; In response to the fact that at least two of the third sets corresponding to the cluster both include the fourth image to be clustered, the cluster is merged with the cluster in which the fourth image to be clustered is located.

8. The method according to claim 7, characterized in that Before merging the cluster with the cluster where the fourth image to be clustered is located, the method further includes: Determining whether the similarity between the cluster and the cluster in which the fourth image to be clustered is located meets a third preset requirement; If so, the step of merging the cluster with the cluster where the fourth image to be clustered is located is performed.

9. The method according to claim 1, characterized in that: The step of respectively encoding each of the first image features comprises: Hash encoding is performed on each of the first image features respectively.

10. A clustering device, characterized in that: The clustering device includes a processor, a memory and a communication circuit, the processor is coupled to the memory and the communication circuit respectively, the memory stores program data, and the processor implements the steps in the method as described in any one of claims 1-9 by executing the program data in the memory.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the steps in the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Similar image clustering method and device, storage medium and electronic equipment

    CN109697451A

  • Systems and methods for managing portrait data

    WO2021128883A1