Method, device and electronic device for clustering feature vectors

By using clustering algorithm as the index structure and clustering according to the distance between the eigenvector and the cluster, the problem of low clustering efficiency in high-dimensional and large-scale data is solved, and fast and efficient eigenvector clustering is achieved.

CN112215247BActive Publication Date: 2025-03-14NANJING HORIZON ROBOTICS TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN201910620718.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-10
Publication Date
2025-03-14
Estimated Expiration
2039-07-10

AI Technical Summary

Technical Problem

When the prior art deals with high-dimensional and large-scale feature vectors, density-based clustering algorithms cannot complete clustering within the required time due to dimension disasters and time complexity problems.

Method used

By determining the cluster in which each feature vector is located, using the cluster as the index structure, the eigenvectors of the same type as the eigenvector type are determined based on the distance between each feature vector and each cluster, and avoid calculating the distance between each feature vector and other feature vectors.

Benefits of technology

It greatly reduces the amount of calculation, improves the calculation speed of the algorithm, and can complete clustering in data of any dimension and scale to meet real-time needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112215247B_ABST
    Figure CN112215247B_ABST
Patent Text Reader

Abstract

Disclosed is a method for clustering feature vectors, comprising: determining a feature vector of each of a plurality of images to be clustered; determining a cluster to which each feature vector belongs based on the approximate distance relationship between the plurality of feature vectors; wherein the cluster is a set of feature vectors with similar distances, and the distance between each feature vector and the center point of the cluster to which it belongs is the closest compared to the distance between each feature vector and the center point of other clusters; and determining a feature vector of the same type as each feature vector based on the distance between each feature vector and each cluster. A device for clustering feature vectors comprises: a feature vector determination module, a cluster determination module and a clustering module. The present application does not need to calculate the distance between each feature vector and other feature vectors, which can greatly reduce the amount of calculation and improve the calculation speed of the algorithm. For data of any dimension and scale, it can be completed within the required time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device and electronic device for clustering feature vectors. Background Art

[0002] With the breakthroughs made by deep learning in many fields such as computer vision, machine learning and artificial intelligence have made great progress. At the same time, it also brings up a problem: how to cluster the feature vectors obtained by deep learning models, especially deep metric learning models. Summary of the invention

[0003] In order to solve the above technical problems, the embodiments of the present application provide a method, device and electronic device for clustering feature vectors.

[0004] According to one aspect of the present application, a method for clustering feature vectors is provided, comprising: determining a feature vector of each of a plurality of images to be clustered; determining a cluster to which each feature vector belongs based on an approximate distance relationship between the plurality of feature vectors; wherein the cluster is a set of feature vectors with similar distances, and the distance between each feature vector and the center point of the cluster to which it belongs is the closest compared to the distance between each feature vector and the center points of other clusters; and determining a feature vector of the same type as each feature vector based on the distance between each feature vector and each cluster.

[0005] According to another aspect of the present application, a device for clustering feature vectors is provided, comprising: a feature vector determination module, used to determine the feature vector of each of a plurality of images to be clustered; a cluster determination module, used to determine the cluster to which each feature vector belongs based on the approximate distance relationship between the plurality of feature vectors; wherein the cluster is a set of feature vectors with similar distances, and the distance between each feature vector and the center point of the cluster to which it belongs is the closest compared to the distance between each feature vector and the center points of other clusters; and a clustering module, used to determine the feature vector of the same type as each feature vector based on the distance between each feature vector and each cluster.

[0006] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and the computer program is used to execute any of the above methods.

[0007] According to another aspect of the present application, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; and the processor for executing any of the above-mentioned methods.

[0008] The method for clustering feature vectors provided in the embodiment of the present application takes each feature vector as the current feature vector, determines the distance between the feature point corresponding to the current feature vector and the center point of each cluster, and determines the feature vector of the same type as the current feature vector based on the distance between the feature point corresponding to the current feature vector and the center point of each cluster. There is no need to calculate the distance between each feature vector and other feature vectors, which can greatly reduce the amount of calculation and improve the calculation speed of the algorithm. For data of any dimension and scale, it can be completed within the required time. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.

[0010] Figure 1 It is a flowchart of a method for clustering feature vectors provided by an exemplary embodiment of the present application.

[0011] Figure 2 It is a schematic diagram of a flow chart of determining a feature vector of the same type as each feature vector according to the distance between each feature vector and each cluster, provided by an exemplary embodiment of the present application.

[0012] Figure 3 It is a flowchart of determining a feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster provided by an exemplary embodiment of the present application.

[0013] Figure 4 It is a schematic diagram of a flow chart of determining the cluster to which each feature vector belongs according to the distance approximation relationship between multiple feature vectors provided by an exemplary embodiment of the present application.

[0014] Figure 5 It is a schematic diagram of a process of redetermining the center point and feature point of each cluster in K clusters provided by an exemplary embodiment of the present application.

[0015] Figure 6 is a schematic diagram of clusters for clustering feature vectors provided by an exemplary embodiment of the present application;

[0016] Figure 7 It is a structural schematic diagram of an apparatus for clustering feature vectors provided by an exemplary embodiment of the present application.

[0017] Figure 8It is a schematic diagram of the structure of a clustering module provided by an exemplary embodiment of the present application.

[0018] Fig. 9 It is a schematic diagram of the structure of a clustering unit provided by an exemplary embodiment of the present application.

[0019] Fig.10 It is a structural diagram of a cluster determination module provided by an exemplary embodiment of the present application.

[0020] Fig.11 It is a structural diagram of a determination unit provided by an exemplary embodiment of the present application.

[0021] Fig.12 It is a structural diagram of an electronic device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0022] Below, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described here.

[0023] Application Overview

[0024] Clustering feature vectors is a problem that has become increasingly prominent in large-scale face recognition, product recognition, pedestrian recognition and other application fields. At present, the industry often uses density-based clustering algorithms to cluster feature vectors. However, density-based clustering algorithms only achieve good clustering results on low-dimensional, small-scale data. Due to the curse of dimension and time complexity, clustering problems with data scales of more than one million cannot be completed within the required time on high-dimensional, large-scale data.

[0025] In response to the above technical problems, the basic concept of the present application is to propose a method, device and electronic device for clustering feature vectors, determine the feature vector of each image to be clustered among multiple images to be clustered, determine the cluster to which each feature vector belongs based on the approximate distance relationship between the multiple feature vectors, determine the feature vector of the same type as each feature vector based on the distance between each feature vector and each cluster, and establish clusters of feature vectors, using the clusters as index structures. Based on the distance between each feature vector and each cluster, feature vectors of the same type as each feature vector can be determined. There is no need to calculate the distance between each feature vector and other feature vectors, which can greatly reduce the amount of calculation and improve the calculation speed of the algorithm. For data of any dimension and scale, it can be completed within the required time.

[0026] It should be noted that the application scope of the present application is not limited to the field of vehicle-mounted electronic technology. For example, the technical solutions mentioned in the embodiments of the present application can also be applied to other intelligent mobile devices, specifically for providing image technology support for intelligent mobile devices.

[0027] Various non-limiting embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0028] Exemplary Methods

[0029] Figure 1 1 is a flow chart of a method for clustering feature vectors provided by an exemplary embodiment of the present application. The method for clustering feature vectors provided by the embodiment of the present application can be applied to the field of automobile image processing technology, and can also be applied to the field of image processing functions of intelligent robots. Figure 1 As shown, the method for clustering feature vectors provided in the embodiment of the present application includes the following steps:

[0030] Step 101: determine a feature vector of each image to be clustered among a plurality of images to be clustered.

[0031] It should be noted that the image to be clustered can be an RGB image, a grayscale image, etc., and there is no limitation on this. One image to be clustered corresponds to one feature vector, and one feature vector can be a 256-dimensional floating point number, such as {0.22, 0.23, 0.12, ..., 0.35}.

[0032] Step 102: Determine the cluster to which each feature vector belongs based on the approximate distance relationship between the multiple feature vectors.

[0033] Among them, a cluster is a set of feature vectors with similar distances. The distance between each feature vector and the center point of its cluster is the closest to the distance between it and the center points of other clusters.

[0034] It should be noted that the distance between two feature vectors can be Euclidean distance (also called L2 distance) or L1 distance, and Euclidean distance is generally used. For example, there are two low-dimensional (e.g., 2-dimensional) feature vectors, (x1, y1) and (x2, y2). The Euclidean distance d between these two feature vectors is

[0035] Step 103: Determine a feature vector of the same type as each feature vector according to the distance between each feature vector and each cluster.

[0036] It should be noted that by determining the feature vectors of the same type as each feature vector, images to be clustered of the same type can be determined.

[0037] The method for clustering feature vectors mentioned in the embodiment of the present application determines the feature vector of each image to be clustered among multiple images to be clustered, determines the cluster to which each feature vector belongs based on the approximate distance relationship between the multiple feature vectors, determines the feature vector of the same type as each feature vector based on the distance between each feature vector and each cluster, and establishes clusters of feature vectors and uses the clusters as index structures. Based on the distance between each feature vector and each cluster, the feature vector of the same type as each feature vector can be determined. Therefore, there is no need to calculate the distance between each feature vector and other feature vectors, which can greatly reduce the amount of calculation and improve the calculation speed of the algorithm. For data of any dimension and scale, it can be completed within the required time.

[0038] Figure 2 FIG. 1 is a flow chart of determining a feature vector of the same type as each feature vector according to the distance between each feature vector and each cluster provided by an exemplary embodiment of the present application. Figure 1 The present application is extended based on the embodiment shown Figure 2 The embodiment shown is described below in detail. Figure 2 The embodiment shown and Figure 1 The differences and similarities of the illustrated embodiments are not described in detail.

[0039] like Figure 2 As shown, in the method for clustering feature vectors provided in the embodiment of the present application, determining feature vectors of the same type as each feature vector (i.e., step 103) according to the distance between each feature vector and each cluster includes:

[0040] Step 1031: Take each feature vector as the current feature vector and determine the distance between the feature point corresponding to the current feature vector and the center point of each cluster.

[0041] Specifically, each eigenvector is used as the current eigenvector in turn, and the distance between the feature point corresponding to each eigenvector and the center point of each cluster is determined in turn. For example, there are 5 eigenvectors, namely the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector. The first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector are used as the current eigenvector in turn, and the distance between the feature point corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of each cluster is determined to be 10, 20, 12, 23, and 11, respectively.

[0042] Step 1032: Determine a feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster.

[0043] For example, there are 5 eigenvectors, namely the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector; there are 3 clusters, namely the first cluster, the second cluster, and the third cluster. The distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of the first cluster are 10, 20, 12, 23, and 11, respectively; the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of the second cluster are 12, 19, 10, 24, and 11, respectively; the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of the third cluster are 25, 10, 30, 9, and 25, respectively. Then, according to the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center points of the first cluster, the second cluster, and the third cluster, the eigenvectors of the same type are determined.

[0044] The method for clustering feature vectors mentioned in the embodiment of the present application, by taking each feature vector as the current feature vector, determining the distance between the feature point corresponding to the current feature vector and the center point of each cluster, determining the feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster, and determining the feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to each feature vector and the center point of each cluster, can avoid calculating the distance between every two feature vectors, thereby saving computing space and improving computing speed.

[0045] Figure 3 This is a flowchart of determining a feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster provided by an exemplary embodiment of the present application. Figure 2 The present application is extended based on the embodiment shown Figure 3 The embodiment shown is described below in detail. Figure 3 The embodiment shown and Figure 2 The differences and similarities of the illustrated embodiments are not described in detail.

[0046] like Figure 3 As shown, according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster, the method of determining the feature vector of the same type as the current feature vector (ie, step 1032) provided in the embodiment of the present application includes:

[0047] Step 10321, determining a preset number of clusters with the closest distances according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster.

[0048] For example: there are 5 eigenvectors, namely the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector; there are 3 clusters, namely the first cluster, the second cluster, and the third cluster. The distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of the first cluster are 10, 20, 12, 19, and 11, respectively; the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of the second cluster are 12, 19, 10, 24, and 11, respectively; the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point of the third cluster are 25, 10, 30, 9, and 25, respectively. Set the preset number of closest clusters to 2, then determine that the two clusters closest to the first eigenvector are the first cluster and the second cluster, determine that the two clusters closest to the second eigenvector are the second cluster and the third cluster, determine that the two clusters closest to the third eigenvector are the first cluster and the second cluster, determine that the two clusters closest to the fourth eigenvector are the first cluster and the third cluster, and determine that the two clusters closest to the fifth eigenvector are the first cluster and the second cluster.

[0049] Step 10322, determining the distance between the feature point corresponding to the current feature vector and each feature point in the preset closest clusters.

[0050] For example: the two clusters closest to the first eigenvector are determined to be the first cluster and the second cluster. There are 3 feature points in the first cluster and 4 feature points in the second cluster. The distances between the first eigenvector and the 3 feature points in the first cluster are determined to be 10, 5, and 2 respectively, and the distances between the first eigenvector and the 4 feature points in the second cluster are determined to be 1, 3, 15, and 6 respectively.

[0051] Step 10323: Determine feature vectors of the same type as the current feature vector in the preset number of closest clusters according to the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of closest clusters.

[0052] For example, it is determined that the distances between the first feature vector and the three feature points in the first cluster are 10, 5, and 2, respectively, and the distances between the first feature vector and the four feature points in the second cluster are 1, 3, 15, and 6, respectively. The feature vectors with a preset distance less than or equal to 5 are of the same type, and the feature vectors of the same type as the first feature vector are the feature vectors corresponding to the feature points with distances of 5 and 2 in the first cluster and the feature vectors corresponding to the feature points with distances of 1 and 3 in the second cluster.

[0053] The method for clustering feature vectors mentioned in the embodiment of the present application determines a preset number of nearest clusters based on the distance between the feature point corresponding to the current feature vector and the center point of each cluster, determines the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of nearest clusters, and determines the feature vectors of the same type as the current feature vector in the preset number of nearest clusters based on the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of nearest clusters. It is only necessary to determine the feature vector of the same type as the current feature vector based on the distance to each feature point in the preset number of nearest clusters, without calculating the distance to the feature points in all clusters, which can further reduce the amount of calculation and further improve the calculation speed.

[0054] Figure 4 FIG. 1 is a flow chart of determining the cluster to which each feature vector belongs according to the distance approximation relationship between multiple feature vectors provided by an exemplary embodiment of the present application. Figure 1 The present application is extended based on the embodiment shown Figure 4 The embodiment shown is described below in detail. Figure 4 The embodiment shown and Figure 1 The differences and similarities of the illustrated embodiments are not described in detail.

[0055] like Figure 4 As shown, in the method for clustering feature vectors provided in the embodiment of the present application, the cluster to which each feature vector belongs is determined (i.e., step 102) according to the distance approximation relationship between multiple feature vectors, including:

[0056] Step 1021: Select K points from the feature points corresponding to the multiple feature vectors as initial center points, where K is a natural number.

[0057] For example, there are five eigenvectors, namely the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector. The feature points corresponding to the first eigenvector and the third eigenvector are selected from the feature points corresponding to the five eigenvectors as the initial center points.

[0058] Step 1022: Determine the distance between the feature point corresponding to each feature vector and each of the initial center points.

[0059] For example: the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point (the feature point corresponding to the first eigenvector) are determined to be 0, 2, 9, 4, and 8, respectively; the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point (the feature point corresponding to the third eigenvector) are determined to be 9, 10, 0, 8, and 1, respectively.

[0060] Step 1023: Combine the feature points corresponding to each feature vector with each initial center point closest to it to form K clusters.

[0061] For example: according to the distances between the feature points corresponding to the first eigenvector, the second eigenvector, the third eigenvector, the fourth eigenvector, and the fifth eigenvector and the center point in the above step 1022, the feature points corresponding to the first eigenvector, the second eigenvector, and the fourth eigenvector are determined to be a cluster, and the feature points corresponding to the third eigenvector and the fifth eigenvector are determined to be a cluster.

[0062] Step 1024, re-determine the center point and feature point of each of the K clusters.

[0063] Specifically, based on all feature points in any cluster, the center point of any cluster is recalculated, and then the steps of assigning feature points belonging to any cluster to any cluster and updating the center point of any cluster are iteratively performed until the center point of any cluster changes very little or reaches a specified number of iterations.

[0064] Step 1025: When the preset termination determination condition is met, the center point and feature point of each cluster determined when the preset termination determination condition is met are used as the final center point and feature point of each cluster.

[0065] Specifically, the preset termination determination condition may be that the change of the center point of the cluster is less than a preset change threshold, or reaches a specified number of iterations. The preset change threshold and the specified number of iterations may be set according to actual application conditions, and are not specifically limited thereto.

[0066] The method for clustering feature vectors mentioned in the embodiment of the present application selects K points as initial center points from the feature points corresponding to multiple feature vectors, determines the distance between the feature point corresponding to each feature vector and each initial center point, combines the feature point corresponding to each feature vector and each initial center point closest to it to form K clusters, and re-determines the center point and feature point of each cluster in the K clusters. When a preset termination determination condition is met, the center point and feature point of each cluster determined when the preset termination determination condition is met are used as the final center point and feature point of each cluster, so that the cluster of feature points corresponding to the feature vector can be quickly determined, and the speed of clustering the feature vector can be improved.

[0067] Figure 5 1 is a flow chart of re-determining the center point and feature point of each cluster in K clusters provided by an exemplary embodiment of the present application. Figure 4 The embodiments shown in the present application are extended based on the embodiments shown in the present application. The following focuses on describing the present application. Figure 5 The embodiment shown and Figure 4 The differences and similarities of the illustrated embodiments are not described in detail.

[0068] In the embodiments of this application Figure 5 In the provided method for clustering feature vectors, re-determining the center point and feature point of each cluster in the K clusters (i.e., step 1024) includes:

[0069] Step 10241, calculate the mean of the feature points of each cluster in the cluster.

[0070] Specifically, the coordinates of the feature points of each cluster in the cluster are summed and averaged to obtain the mean of the feature points of each cluster in the cluster.

[0071] Step 10242, taking the mean of the feature points of each cluster as the new center point of each cluster.

[0072] Specifically, the mean of the feature points of each cluster is used as the new center point of each cluster, and the feature points of each cluster are re-determined.

[0073] Step 10243, determining the distance between the feature point corresponding to each feature vector and each of the new center points.

[0074] Specifically, the distance between the feature point corresponding to each feature vector and each new center point includes Euclidean distance (also called L2 distance), L1 distance, etc., and Euclidean distance is generally used. The specific calculation of Euclidean distance is detailed in step 102 and will not be repeated here.

[0075] Step 10244, divide the feature points corresponding to each feature vector into the cluster corresponding to the new center point that is closest to it.

[0076] Specifically, the feature points corresponding to each feature vector are divided into the cluster corresponding to the new center point that is closest to it, and form a cluster with the new center point.

[0077] The method for clustering feature vectors mentioned in the embodiment of the present application calculates the mean of the feature points of each cluster in the cluster, takes the mean of the feature points of each cluster as the new center point of each cluster, determines the distance between the feature points corresponding to each feature vector and each new center point, and divides the feature points corresponding to each feature vector into the cluster corresponding to the new center point closest to it. By taking the mean of the feature points of each cluster as the new center point of each cluster, the new center point of each cluster can be quickly determined, thereby determining the cluster, which can improve the calculation speed.

[0078] For ease of understanding of this application, see Figure 6 , is a schematic diagram of clusters for clustering feature vectors provided by an exemplary embodiment of the present application, such as Figure 6As shown in the figure, ①, ②, ③, and ④ are four center points, which together with the feature points in an irregular circle formed clusters ①, ②, ③, and ④. Figure 6It can be seen that among the distances from feature point A to center point ①, center point ②, center point ③, and center point ④, the distance from feature point A to center point ① is the smallest, so feature point A is a point in cluster ①. When calculating the distance matrix, it is not necessary to calculate the distance from feature point A to all other feature points. It is only necessary to first calculate the distance from feature point A to the center point of each cluster (such as line a in the figure), and then select the cluster where the preset center point with the closest distance is located (in this embodiment, only the cluster where the center point with the closest distance to feature point A is located is selected), and calculate the distance from feature point A to all feature points in these clusters (such as line b in the figure). When classifying n feature vectors, according to the method of the prior art, it is necessary to calculate the distance from each corresponding feature feature vector point to the feature point corresponding to each other feature vector, that is, it is necessary to calculate n-1 distances; when the feature points corresponding to n feature vectors are first divided into m clusters, it is only necessary to calculate m+t distances (where m represents the number of clusters, and t represents the sum of the number of all feature points in m clusters). Generally speaking, for n=100W, it can be assumed that there are 100W feature points in the space, and the value of (m+t) is only 1% of n=100W, and the distance calculation amount is reduced by about 99%. Furthermore, R clusters with the closest center points can be selected from m clusters, and only R+s (where R represents the number of the closest clusters and s represents the sum of the number of all feature points in the R clusters) need to be calculated, so that the time complexity of calculating the distance is reduced from O(nlogn) using the existing technology to O(nlogR), and the calculation amount is reduced to 1% to 0.1% of the existing technology. At the same time, in most application scenarios, the distribution difference of images in each category will not be very extreme. For example, the number of faces captured by the surveillance cameras at the subway entrance every month, the snapshot of the same person among office workers will appear 30 to 60 times (when they take the subway to and from work). Assuming that the monthly passenger flow of this subway entrance is 500,000, the staff at the subway entrance will be captured multiple times, resulting in the number of their snapshots exceeding 60 (generally much higher than 60, assuming 100). Assuming that there are 10 staff at this subway entrance, each person who appears at the subway entrance and is captured is regarded as a sample. Therefore, samples with a number of appearances less than or equal to 100 account for (500,000-10) / 500,000*100%=99.998% of the total samples, that is, the impact of setting R to 100 on the accuracy is only about one in one hundred thousand. If R takes a larger value, the error can be completely reduced to one in ten thousand or even lower. Therefore, by adopting the method of the present application, the algorithm time complexity can be optimized from the square order to the linear level without losing the accuracy of the density clustering algorithm, which greatly improves the efficiency of the algorithm and increases the speed of calculation.

[0079] It should be noted that Figure 6Only 4 clusters and 4 feature points are taken as an example for illustrative description. Their number does not constitute a limitation to the present disclosure. The number of clusters and their center points in the present disclosure is determined by the number and distance of feature vectors corresponding to samples in specific application scenarios (such as face recognition, product recognition, pedestrian recognition, etc.).

[0080] Exemplary Devices

[0081] Figure 7 1 is a schematic diagram of a device for clustering feature vectors provided by an exemplary embodiment of the present application. The device for clustering feature vectors provided by the embodiment of the present application can be applied to the field of automobile image processing, and can also be applied to the field of image processing functions of intelligent robots. Figure 7 As shown, the device for clustering feature vectors provided in an embodiment of the present application includes:

[0082] A feature vector determination module 201 is used to determine a feature vector of each image to be clustered among a plurality of images to be clustered;

[0083] A cluster determination module 202 is used to determine the cluster to which each feature vector belongs based on the approximate distance relationship between the multiple feature vectors; wherein a cluster is a set of feature vectors with similar distances, and the distance between each feature vector and the center point of the cluster to which it belongs is the closest compared to the distance between each feature vector and the center points of other clusters;

[0084] The clustering module 203 is used to determine the feature vectors of the same type as each feature vector according to the distance between each feature vector and each cluster.

[0085] Figure 8 Schematic diagram of the structure of a clustering module provided by an exemplary embodiment of the present application. Figure 7 The present application is extended based on the embodiment shown Figure 8 The embodiment shown is described below in detail. Figure 8 The embodiment shown and Figure 7 The differences and similarities of the illustrated embodiments are not described in detail.

[0086] like Figure 8 As shown, in the device for clustering feature vectors provided in the embodiment of the present application, the clustering module 203 includes:

[0087] A distance determination unit 2031 is used to use each feature vector as a current feature vector and determine the distance between the feature point corresponding to the current feature vector and the center point of each cluster;

[0088] The clustering unit 2032 is used to determine a feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster.

[0089] Fig. 9 Schematic diagram of the structure of a clustering unit provided by an exemplary embodiment of the present application. Figure 8 The present application is extended based on the embodiment shown Fig. 9 The embodiment shown is described below in detail. Fig. 9 The embodiment shown and Figure 8 The differences and similarities of the illustrated embodiments are not described in detail.

[0090] In the device for clustering feature vectors provided in the embodiment of the present application, the clustering unit 2032 includes:

[0091] The cluster determination subunit 20321 is used to determine a preset number of clusters with the closest distances according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster;

[0092] The distance determination subunit 20322 is used to determine the distance between the feature point corresponding to the current feature vector and each feature point in the preset closest clusters;

[0093] The clustering subunit 20323 is used to determine feature vectors of the same type as the current feature vector in the preset number of closest clusters according to the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of closest clusters.

[0094] Fig.10 Schematic diagram of the structure of a cluster determination module provided by an exemplary embodiment of the present application. Figure 7 The present application is extended based on the embodiment shown Fig.10 The embodiment shown is described below in detail. Fig.10 The embodiment shown and Figure 7 The differences and similarities of the illustrated embodiments are not described in detail.

[0095] like Fig.10 As shown, in the device for clustering feature vectors provided in the embodiment of the present application, the cluster determination module 202 includes:

[0096] A selection unit 2021 is used to select K points from the feature points corresponding to the multiple feature vectors as initial center points, where K is a natural number;

[0097] A distance determination unit 2022, used to determine the distance between the feature point corresponding to each feature vector and each initial center point;

[0098] A combining unit 2023, used for combining the feature points corresponding to each feature vector with each initial center point closest to it to form K clusters;

[0099] A determination unit 2024, used to re-determine the center point and feature point of each cluster in the K clusters;

[0100] The processing unit 2025 is configured to, when a preset termination determination condition is met, use the center point and feature point of each cluster determined when the preset termination determination condition is met as the final center point and feature point of each cluster.

[0101] Fig.11 is a schematic diagram of the structure of a determination unit provided by an exemplary embodiment of the present application. Fig.10 The present application is extended based on the embodiment shown Fig.11 The embodiment shown is described below in detail. Fig.11 The embodiment shown and Fig.10 The differences and similarities of the illustrated embodiments are not described in detail.

[0102] like Fig.11 As shown, in the device for clustering feature vectors provided in the embodiment of the present application, the determining unit 2024 includes:

[0103] A calculation subunit 20241 is used to calculate the mean of the feature points of each cluster in the cluster;

[0104] The processing subunit 20242 is used to use the mean of the feature points of each cluster as the new center point of each cluster;

[0105] The distance determination subunit 20243 is used to determine the distance between the feature point corresponding to each feature vector and each of the new center points;

[0106] The division subunit 20244 is used to divide the feature points corresponding to each feature vector into the cluster corresponding to the new center point that is closest to the feature point.

[0107] It should be understood that Figures 7 to 11 The operations and functions of the feature vector determination module 201, cluster determination module 202 and clustering module 203 in the provided device for clustering feature vectors, as well as the distance determination unit 2031 and clustering unit 2032 included in the clustering module 203, the cluster determination subunit 20321, the distance determination subunit 20322 and the clustering subunit 20323 included in the clustering unit 2032, the selection unit 2021, the distance determination unit 2022, the combination unit 2023, the determination unit 2024 and the processing unit 2025 included in the cluster determination module 202, and the calculation subunit 20241, the processing subunit 20242, the distance determination subunit 20243 and the division subunit 20244 included in the determination unit 2024 can refer to the above Figures 1 to 5 The provided method for clustering feature vectors will not be described here in detail to avoid repetition.

[0108] Exemplary Electronic Devices

[0109] Fig.12 A block diagram of an electronic device according to an embodiment of the present application is illustrated.

[0110] like Fig.12 As shown, the electronic device 11 includes one or more processors 111 and a memory 112 .

[0111] The processor 111 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 11 to perform desired functions.

[0112] The memory 112 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 111 may run the program instructions to implement the method for clustering feature vectors and / or other desired functions of the various embodiments of the present application described above. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0113] In one example, the electronic device 11 may further include: an input device 113 and an output device 114 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0114] For example, the input device 113 may be a camera or a microphone, a microphone array, etc., for capturing input signals of images or sound sources. When the electronic device is a stand-alone device, the input device 113 may be a communication network connector for receiving collected input signals from a network processor.

[0115] In addition, the input device 113 may also include, for example, a keyboard, a mouse, and the like.

[0116] The output device 114 can output various information to the outside, including the determined output voltage, output current information, etc. The output device 114 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.

[0117] Of course, to simplify, Fig.12Only some of the components related to the present application in the electronic device 11 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 11 may also include any other appropriate components.

[0118] Exemplary computer program products and computer-readable storage media

[0119] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps in the method for clustering feature vectors described in the above-mentioned "Exemplary Method" section of this specification.

[0120] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0121] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the method for clustering feature vectors according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0122] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0123] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.

[0124] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.

[0125] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present application.

[0126] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0127] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present application to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A method for clustering feature vectors in image recognition, comprising: Determining a feature vector of each of the images to be clustered in a plurality of images to be clustered; According to the approximate distance relationship between the plurality of feature vectors, the cluster to which each feature vector belongs is determined; wherein the cluster is a set of feature vectors with similar distances, and the distance between each feature vector and the center point of the cluster to which it belongs is the shortest compared with the distance between each feature vector and the center points of other clusters; Determine a feature vector of the same type as each feature vector according to the distance between each feature vector and the center point of each cluster, including: taking each feature vector as the current feature vector, and determining the distance between the feature point corresponding to the current feature vector and the center point of each cluster; determine a preset number of closest clusters according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster; determine the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of closest clusters; determine the feature vector of the same type as the current feature vector in the preset number of closest clusters according to the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of closest clusters.

2. The method according to claim 1, wherein: Determining the cluster to which each of the feature vectors belongs according to the distance approximation relationship between the plurality of feature vectors, comprising: Selecting K points from the feature points corresponding to the plurality of feature vectors as initial center points, wherein K is a natural number; Determine the distance between each feature point corresponding to the feature vector and each initial center point; Combining the feature points corresponding to each of the feature vectors with each of the initial center points closest to it to form K clusters; Re-determine the center point and feature point of each of the K clusters; When the preset termination determination condition is met, the center point and the feature point of each cluster determined when the preset termination determination condition is met are used as the final center point and the feature point of each cluster.

3. The method according to claim 2, wherein: Re-determining the center point and feature point of each of the K clusters, including: Calculate the mean of the feature points of each cluster in the cluster; Taking the mean of the feature points of each cluster as the new center point of each cluster; Determine the distance between each feature point corresponding to the feature vector and each new center point; The feature points corresponding to each of the feature vectors are divided into clusters corresponding to the new center point that is closest to the feature vectors.

4. A device for clustering feature vectors in image recognition, comprising: A feature vector determination module, used to determine a feature vector of each of the plurality of images to be clustered; A cluster determination module, used to determine the cluster to which each feature vector belongs according to the approximate distance relationship between the plurality of feature vectors; wherein the cluster is a set of feature vectors with similar distances, and the distance between each feature vector and the center point of the cluster to which it belongs is the shortest compared with the distance between each feature vector and the center points of other clusters; A clustering module, determining a feature vector of the same type as each of the feature vectors according to the distance between each of the feature vectors and each of the cluster centers; Wherein, the clustering module includes: A distance determination unit, used to take each of the feature vectors as a current feature vector, and determine the distance between a feature point corresponding to the current feature vector and a center point of each of the clusters; A clustering unit, configured to determine a feature vector of the same type as the current feature vector according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster; The clustering unit comprises: A cluster determination subunit, used to determine a preset number of clusters with the closest distances according to the distance between the feature point corresponding to the current feature vector and the center point of each cluster; A distance determination subunit, used to determine the distance between the feature point corresponding to the current feature vector and each feature point in the preset closest clusters; The clustering subunit is used to determine the feature vectors of the same type as the current feature vector in the preset number of closest clusters according to the distance between the feature point corresponding to the current feature vector and each feature point in the preset number of closest clusters.

5. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the method for clustering feature vectors according to any one of claims 1 to 3.

6. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to execute the method for clustering feature vectors as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Clustering method and device

    CN108805174A

  • System and method for evaluating face form

    JP2016085490A

  • Image processing method, image processing apparatus, and program

    US20100202685A1

  • Image processing method, image processing apparatus, and program

    US20100202686A1