CN114048344A - Similar face searching method, device, equipment and readable storage medium - Google Patents
Similar face searching method, device, equipment and readable storage medium Download PDFInfo
- Publication number
- CN114048344A CN114048344A CN202111417307.8A CN202111417307A CN114048344A CN 114048344 A CN114048344 A CN 114048344A CN 202111417307 A CN202111417307 A CN 202111417307A CN 114048344 A CN114048344 A CN 114048344A
- Authority
- CN
- China
- Prior art keywords
- feature vector
- face
- cluster
- recognized
- similarity
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 239000013598 vector Substances 0.000 claims abstract description 328
- 230000001815 facial effect Effects 0.000 claims abstract description 51
- 238000004364 calculation method Methods 0.000 claims abstract description 24
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 21
- 238000001514 detection method Methods 0.000 claims description 20
- 238000012163 sequencing technique Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 3
- 238000004891 communication Methods 0.000 description 7
- 238000000605 extraction Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 241000157593 Milvus Species 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000007621 cluster analysis Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/55—Clustering; Classification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/53—Querying
- G06F16/535—Filtering based on additional data, e.g. user or group profiles
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/50—Information retrieval; Database structures therefor; File system structures therefor of still image data
- G06F16/53—Querying
- G06F16/538—Presentation of query results
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Computation (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a similar face searching method, a similar face searching device, similar face searching equipment and a readable storage medium, wherein the method comprises the following steps: acquiring a feature vector of a face image to be recognized; calculating a hash value of the feature vector of the face image to be recognized through a hash algorithm; determining a cluster matched with the feature vector of the facial image to be recognized according to the hash value cluster range of the hash value, wherein all feature vectors of the facial image with the hash value within the hash value cluster range of the cluster are stored in the cluster; calculating the similarity between each feature vector in the cluster and the feature vector of the face image; determining the feature vector with the similarity meeting a preset condition as a target feature vector; and acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector. The method and the device have the advantages that the required calculated amount and occupied calculation resources are small in the process of determining the acquaintance face, and the searching speed under large-scale image data is high.
Description
Technical Field
The present application relates to the field of computer intelligence, and more particularly, to a method, an apparatus, a device and a readable storage medium for searching similar faces.
Background
With the vigorous development of artificial intelligence, the face recognition technology has been advanced in recent years, and the face recognition technology has been widely applied to a plurality of fields such as entrance guard security, user authentication and the like. In application scenarios related to the face recognition technology, application scenarios for similar face queries are also frequently used, for example, images acquired by a camera are processed through face recognition, so that personnel deployment and control, population query, missing person and hidden escape person searching and the like are realized.
In the prior art, the query of similar faces usually adopts a traditional violence comparison method, and the method compares face images one by one. Obviously, under the condition that millions or even tens of millions of data are stored in a background database, the results are difficult to return in a short time by one-to-one comparison, and meanwhile, resources are very occupied in high concurrency, so that the method is difficult to adapt to large-scale image quick retrieval. In addition, in some scenes with high requirements on real-time performance, the traditional violence comparison method is difficult to perform well due to long retrieval time.
Therefore, in view of the above situation, a similar face searching method is needed, which is applied to fast retrieval of large-scale images and improves the similar face searching speed under large-scale image data.
Disclosure of Invention
In view of this, the present application provides a similar face searching method, apparatus, device and readable storage medium, which are used to detect whether a trailing condition occurs, and improve security.
In order to achieve the above object, the following solutions are proposed:
a similar face searching method comprises the following steps:
acquiring a feature vector of a face image to be recognized;
calculating a hash value of the feature vector of the face image to be recognized through a hash algorithm;
determining a cluster matched with the feature vector of the facial image to be recognized according to the hash value cluster range of the hash value, wherein all feature vectors of the facial image with the hash value within the hash value cluster range of the cluster are stored in the cluster;
calculating the similarity between each feature vector in the cluster and the feature vector of the face image;
determining the feature vector with the similarity meeting a preset condition as a target feature vector;
and acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
Preferably, the calculating the similarity between each feature vector in the cluster and the feature vector of the face image includes:
determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating the cosine distance;
or the like, or, alternatively,
and determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating the Euclidean distance.
Preferably, the obtaining the feature vector of the face image to be recognized includes:
acquiring a face image to be recognized;
identifying and intercepting a face area in a face image to be identified;
and extracting the characteristic vector of the face region, and taking the characteristic vector of the face region as the characteristic vector of the face image to be recognized.
Preferably, after determining the feature vector with the similarity satisfying the similarity threshold as the target feature vector, the method further includes:
determining an ID of the target feature vector;
the acquiring of the face identity information recorded in the face information base and corresponding to the target feature vector includes:
and inquiring in a face information base to obtain face identity information corresponding to the ID.
Preferably, before obtaining the feature vector of the face image to be recognized, the method further includes:
performing quality detection on the face image to be recognized;
if the facial image to be recognized meets the quality detection standard, executing the process of acquiring the characteristic vector of the facial image to be recognized;
and if the facial image to be recognized does not accord with the quality detection standard, prompting to upload the facial image to be recognized again.
Preferably, the determining the feature vector of which the similarity satisfies the preset condition as the target feature vector includes:
determining the feature vector with the similarity meeting a similarity threshold as a target feature vector;
or the like, or, alternatively,
and sequencing the similarity from high to low, and determining the feature vector with the similarity meeting the preset sequencing as a target feature vector.
Preferably, the generating process of each cluster includes:
extracting the feature vector of the existing face image;
calculating a hash value of the feature vector of the existing face image through a hash algorithm;
and clustering the characteristic vectors of the existing face images according to the hash values to generate clustering clusters, wherein the value intervals of the hash values of the characteristic vectors in each clustering cluster are used as the clustering ranges of the hash values corresponding to the clustering clusters.
A similar face search apparatus, comprising:
the first acquisition unit is used for acquiring a feature vector of a face image to be recognized;
the Hash calculation unit is used for calculating a Hash value of the feature vector of the face image to be recognized through a Hash algorithm;
a cluster determining unit, configured to determine a cluster matched with the feature vector of the facial image to be recognized according to a hash value cluster range in which the hash value is located, where all feature vectors of facial images whose hash values are within the hash value cluster range of the cluster are stored in the cluster;
the similarity calculation unit is used for calculating the similarity between each feature vector in the cluster and the feature vector of the face image;
a target determining unit, configured to determine, as a target feature vector, a feature vector for which the similarity satisfies a similarity threshold;
and the second acquisition unit is used for acquiring the face identity information which is recorded in the face information base and corresponds to the target characteristic vector.
A similar face search device comprising a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program to implement the steps of the similar face searching method.
A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the similar face search method as described above.
It can be seen from the above technical solutions that, the method, the apparatus, the device and the readable storage medium for searching similar faces provided by the present application obtain a feature vector of a face image to be recognized, calculate a hash value of the feature vector of the face image to be recognized through a hash algorithm, determining a cluster matched with the characteristic vector of the face image to be recognized according to the cluster range of the hash value, wherein all the characteristic vectors of the face images with the hash values within the hash value clustering range of the clustering cluster are stored in the clustering cluster, then the similarity between the characteristic vector of the face image to be recognized and each characteristic vector in the clustering cluster is calculated, and further determining a target feature vector which is required to be searched and has higher similarity with the feature vector of the face image according to the similarity, namely determining the feature vector of which the similarity meets the preset condition as the target feature vector. And acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
According to the method and the device, only Hash value calculation is needed to be carried out on the feature vectors of the facial images to be recognized, the cluster matched with the feature vectors of the facial images to be recognized is determined, and then the target feature vectors are determined according to the similarity between each feature vector in the matched cluster and the feature vector of the facial image to be recognized. According to the method and the device, all the characteristic vectors do not need to be compared with the characteristic vectors of the face image to be recognized one by one, and only the characteristic vectors in the cluster are compared after the cluster is determined. Obviously, the number of the feature vectors contained in one cluster is obviously less than that of all the feature vectors, so that the calculation amount and occupied calculation resources in the process of determining the acquaintance face are greatly reduced, and the similar face searching speed under large-scale image data is high.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a similar face searching method disclosed in the embodiment of the present application;
fig. 2 is a block diagram of a similar face search apparatus disclosed in the present application;
fig. 3 is a block diagram of a hardware structure of a similar face search device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following is a description of the present application, which proposes the following technical solutions, and is referred to in detail below.
Before explaining a process of specifically realizing similar face search in the present application, a generation process of each cluster is introduced first.
The similar face search realized by the application is to search images similar to the face images to be recognized in a database or a large number of existing face images. Before searching similar faces, clustering existing face images and generating cluster clusters, which may specifically include:
first, feature vectors of existing face images are extracted.
Specifically, the existing face images include, but are not limited to, face images captured by a camera in real time, or face images uploaded in background registration and personnel registration processes, and face images imported in batch. The existing face images are subjected to feature extraction through a neural network, and each face image is extracted by a 256-dimensional or 512-dimensional feature vector.
And secondly, calculating the hash value of the feature vector of the existing face image through a hash algorithm.
Specifically, after the feature vector of the existing face image is obtained, the hash value of the feature vector of the existing face image can be obtained through a hash algorithm, and the hash value can be used for clustering the feature vector of the existing face image.
And then clustering the characteristic vectors of the existing face images according to the hash values to generate each cluster, wherein the value interval of the hash value of each characteristic vector in each cluster is used as the corresponding hash value clustering range of the cluster.
Specifically, clustering of the feature vectors of the existing face images can be realized by adopting a clustering algorithm, the feature vectors of the existing face images after clustering are divided into a plurality of clustering clusters, each clustering cluster has a corresponding hash value clustering range, and the hash value clustering range of each clustering cluster is the value range of the hash value of each feature vector in the clustering cluster. Each cluster and feature vector may be stored in a millius feature database.
It can be understood that after the clustering is completed, the server stores the feature vectors of the existing face images according to the clustering clusters, that is, a plurality of clustering clusters are stored, and a plurality of matched feature vectors of the existing face images are arranged under each clustering cluster. When the similar face search is performed on the face image to be recognized, the cluster to which the face image to be recognized belongs can be determined, and then the similarity detection is performed on each feature vector in the cluster to determine the similar face image.
Based on the above generation process of each cluster, fig. 1 is a flow chart of a service processing method disclosed in the embodiment of the present application, and referring to fig. 1, the method may include:
and step S1, acquiring the feature vector of the face image to be recognized.
Specifically, feature extraction is performed on the face image to be recognized through the neural network, that is, sdk extraction features can be called to obtain feature vectors of the face image to be recognized, and a unique feature vector capable of representing each face feature of the face image is extracted from one face image to be recognized.
And step S2, calculating the hash value of the feature vector of the face image to be recognized through a hash algorithm.
Specifically, the hash algorithm may be a sensitive hash algorithm, the feature vector of the face image to be recognized may be converted into a hash value by the hash algorithm, and the hash value may be further used for cluster analysis.
And step S3, determining a cluster matched with the feature vector of the face image to be recognized according to the hash value cluster range of the hash value.
Specifically, all feature vectors of the face images with hash values within the hash value clustering range of the cluster are stored in the cluster. The characteristic vectors stored in the cluster and the hash values of the characteristic vectors of the facial images to be recognized belong to the same hash value cluster range, the characteristic vectors stored in the cluster and the characteristic vectors of the facial images to be recognized belong to the same class, and compared with other clusters, the similarity between the whole characteristic vectors in the cluster and the facial images to be recognized is highest.
And step S4, calculating the similarity between each feature vector in the cluster and the feature vector of the face image.
Specifically, because the similarity between the feature vector in the cluster matched with the feature vector of the facial image to be recognized and the feature vector of the facial image is the highest overall, the feature vector with the highest similarity to the feature vector of the facial image can be found out from all the feature vectors only by calculating the similarity between each feature vector in the cluster and the feature vector of the facial image.
And step S5, determining the feature vector with the similarity meeting the preset condition as a target feature vector.
Specifically, after the similarity between each feature vector in the cluster and the feature vector of the face image is obtained through calculation, the feature vector of which the similarity meets the preset condition is determined as a target feature vector, wherein the target feature vector is the feature vector with the highest similarity with the feature vector of the face image in the cluster and is also the feature vector with the highest similarity with the feature vector of the face image in all the existing feature vectors.
And step S6, acquiring the face identity information which is recorded in the face information base and corresponds to the target feature vector.
Specifically, the target feature vector is a feature vector with the highest similarity to a feature vector of a face image, the face image corresponding to the target feature vector is a face image with the highest similarity to a face image to be recognized, and the recorded face identity information corresponding to the target feature vector is obtained in a face information base, namely the required face image information similar to the face image to be recognized.
From the technical scheme, the similar face searching method provided by the application obtains the feature vector of the face image to be recognized, obtains the hash value of the feature vector of the face image to be recognized through the hash algorithm calculation, determining a cluster matched with the characteristic vector of the face image to be recognized according to the cluster range of the hash value, wherein all the characteristic vectors of the face images with the hash values within the hash value clustering range of the clustering cluster are stored in the clustering cluster, then the similarity between the characteristic vector of the face image to be recognized and each characteristic vector in the clustering cluster is calculated, and further determining a target feature vector which is required to be searched and has higher similarity with the feature vector of the face image according to the similarity, namely determining the feature vector of which the similarity meets the preset condition as the target feature vector. And acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
According to the method and the device, only Hash value calculation is needed to be carried out on the feature vectors of the facial images to be recognized, the cluster matched with the feature vectors of the facial images to be recognized is determined, and then the target feature vectors are determined according to the similarity between each feature vector in the matched cluster and the feature vector of the facial image to be recognized. According to the method and the device, all the characteristic vectors do not need to be compared with the characteristic vectors of the face image to be recognized one by one, and only the characteristic vectors in the cluster are compared after the cluster is determined. Obviously, the number of the feature vectors contained in one cluster is obviously less than that of all the feature vectors, so that the calculation amount and occupied calculation resources in the process of determining the acquaintance face are greatly reduced, and the similar face searching speed under large-scale image data is high.
In some embodiments of the present application, two optional implementations are provided for the process of calculating the similarity between each feature vector in the cluster and the feature vector of the face image in step S4, and the two optional implementations are described below, and may specifically include:
firstly, determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating cosine distance.
Specifically, the cosine similarity is to evaluate the similarity between vectors by calculating the cosine value of the included angle between two vectors. The cosine similarity between each feature vector in the cluster and the feature vector of the face image can be obtained by respectively calculating the cosine distance between each feature vector in the cluster and the feature vector of the face image.
And secondly, determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating Euclidean distance.
Specifically, the euclidean distance similarity is to determine the degree of similarity by the distance between vectors, and the closer the distance, the more similar the distance is. And respectively calculating the Euclidean distance between each feature vector in the cluster and the feature vector of the face image to obtain the Euclidean distance similarity between each feature vector in the cluster and the feature vector of the face image.
It can be understood that, the present application includes, but is not limited to, the above two ways of calculating the similarity between each feature vector in the cluster and the feature vector of the face image, and the present application emphasizes that the process of determining the feature vector similar to the feature vector of the face image to be recognized by calculating the similarity, and the way of obtaining the similarity between vectors according to the actual calculation should belong to the protection scope of the present application.
In some embodiments of the present application, before the step S1 of obtaining the feature vector of the facial image to be recognized, a process of performing quality detection on the facial image to be recognized may be further added, and the following process of performing quality detection on the facial image to be recognized may be specifically described as follows:
step S8, performing quality detection on the face image to be recognized;
if the facial image to be recognized meets the quality detection standard, executing the process of acquiring the characteristic vector of the facial image to be recognized;
and if the facial image to be recognized does not accord with the quality detection standard, prompting to upload the facial image to be recognized again.
Specifically, in practical application, if the face image to be recognized is blurred, the feature vector may not be accurately extracted, or a large error may exist in the similar face information obtained by searching, so that, to ensure the search effect and the search quality, before the feature vector of the face image to be recognized is obtained, quality detection may be performed on the face image to be recognized.
If the detected face image to be recognized meets the quality detection standard, the face image is clear and complete, and the process of obtaining the feature vector of the face image to be recognized is allowed to be continuously executed.
And if the detected face image to be recognized does not accord with the quality detection standard, prompting to upload the face image to be recognized again.
In some embodiments of the present application, the process of obtaining the feature vector of the face image to be recognized in step S1 may specifically include:
and step S11, acquiring a face image to be recognized.
And step S12, recognizing and intercepting the face area in the face image to be recognized.
Specifically, considering that the face image may be obtained by capturing a camera in real time, the obtained face image to be recognized may have a plurality of faces, or the face is in a non-central position, the face region may be recognized and a complete and clear face region in the face image to be recognized may be recognized and intercepted before extracting feature vectors from the face image to be recognized.
And step S13, extracting the feature vector of the face region, and taking the feature vector of the face region as the feature vector of the face image to be recognized.
Specifically, after a complete face region in a face image to be recognized is recognized and cut out, a feature vector of the face region is extracted, and the feature vector of the face region is used as a feature vector of the face image to be recognized.
In some embodiments of the present application, after determining, in step S5, the feature vector whose similarity satisfies the similarity threshold as the target feature vector, the method may further include:
and step S7, determining the ID of the target feature vector.
On the basis, the step S6 of obtaining the face identity information corresponding to the target feature vector recorded in the face information base may specifically include:
and inquiring in a face information base to obtain face identity information corresponding to the ID.
Specifically, when the feature vector is stored in the milvus feature database, a corresponding ID may be set for each feature vector, and the face identity information corresponding to the feature vector is stored in the face information database under the corresponding ID. After the target feature vectors are determined, the face identity information of each ID can be obtained by querying in a face information base according to the set ID of each target feature vector, and the face identity information is the face identity information of the searched similar faces.
In some embodiments of the present application, two optional implementations are provided for the process of determining, in step S5, the feature vector with the similarity satisfying the preset condition as the target feature vector, where the two optional implementations are described below, and specifically may include:
firstly, determining the feature vector with the similarity meeting the similarity threshold as a target feature vector.
Specifically, a similarity threshold may be preset, and the feature vector with the similarity within the preset similarity threshold range in the cluster is the target feature vector. And if the cosine distance is set to be between the range of-0.02 and 0.02 as a similarity threshold, calculating the cosine distance similarity between each feature vector in the cluster and the feature vector of the face image, wherein the feature vector with the cosine distance between the range of-0.02 and 0.02 is a target feature vector.
And secondly, sequencing the similarity from high to low, and determining the feature vector with the similarity meeting the preset sequencing as a target feature vector.
Specifically, after the similarity between each feature vector in the cluster and the feature vector of the face image is obtained through calculation, the similarity is ranked from high to low, and the feature vector meeting the preset ranking is used as the target feature vector. For example, the first five feature vectors with the highest similarity are taken as the target feature vectors.
It can be understood that, the embodiments of the present application for determining the feature vector with the similarity satisfying the preset condition as the target feature vector include, but are not limited to, the above two, and the present application emphasizes that the process of obtaining the target feature vector through the preset condition screening, and the manner meeting the actual preset condition shall belong to the protection scope of the present application.
The similar face searching device provided in the embodiment of the present application is described below, and the similar face searching device described below and the similar face searching method described above may be referred to in a corresponding manner.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a similar face search apparatus disclosed in the embodiment of the present application.
As shown in fig. 2, the apparatus may include:
a first obtaining unit 110, configured to obtain a feature vector of a face image to be recognized;
the hash calculation unit 120 is configured to calculate a hash value of the feature vector of the face image to be recognized through a hash algorithm;
a cluster determining unit 130, configured to determine a cluster matched with the feature vector of the facial image to be recognized according to a hash value cluster range in which the hash value is located, where all the feature vectors of the facial image whose hash value is within the hash value cluster range of the cluster are stored in the cluster;
a similarity calculation unit 140, configured to calculate a similarity between each feature vector in the cluster and a feature vector of the face image;
a target determining unit 150, configured to determine, as a target feature vector, a feature vector for which the similarity satisfies a preset condition;
the second obtaining unit 160 is configured to obtain face identity information corresponding to the target feature vector, which is recorded in a face information base.
It can be seen from the above technical solutions that, the similar face searching device provided in the embodiments of the present application obtains the feature vector of the face image to be recognized, obtains the hash value of the feature vector of the face image to be recognized through the hash algorithm calculation, determining a cluster matched with the characteristic vector of the face image to be recognized according to the cluster range of the hash value, wherein all the characteristic vectors of the face images with the hash values within the hash value clustering range of the clustering cluster are stored in the clustering cluster, then the similarity between the characteristic vector of the face image to be recognized and each characteristic vector in the clustering cluster is calculated, and further determining a target feature vector which is required to be searched and has higher similarity with the feature vector of the face image according to the similarity, namely determining the feature vector of which the similarity meets the preset condition as the target feature vector. And acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
According to the method and the device, only Hash value calculation is needed to be carried out on the feature vectors of the facial images to be recognized, the cluster matched with the feature vectors of the facial images to be recognized is determined, and then the target feature vectors are determined according to the similarity between each feature vector in the matched cluster and the feature vector of the facial image to be recognized. According to the method and the device, all the characteristic vectors do not need to be compared with the characteristic vectors of the face image to be recognized one by one, and only the characteristic vectors in the cluster are compared after the cluster is determined. Obviously, the number of the feature vectors contained in one cluster is obviously less than that of all the feature vectors, so that the calculation amount and occupied calculation resources in the process of determining the acquaintance face are greatly reduced, and the similar face searching speed under large-scale image data is high.
Optionally, the similarity calculation unit may include:
the cosine similarity calculation unit is used for determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating cosine distance;
or the like, or, alternatively,
and the Euclidean distance calculating unit is used for determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating the Euclidean distance.
Optionally, the first obtaining unit may include:
the image acquisition unit is used for acquiring a face image to be recognized;
the intercepting unit is used for identifying and intercepting a face area in a face image to be identified;
and the vector extraction unit is used for extracting the characteristic vector of the face region and taking the characteristic vector of the face region as the characteristic vector of the face image to be recognized.
Optionally, the similar face searching apparatus may further include:
an ID determining unit configured to determine an ID of a target feature vector after determining the feature vector whose similarity satisfies a similarity threshold as the target feature vector;
the second obtaining unit may be further configured to query a face information base to obtain face identity information corresponding to the ID.
Optionally, the similar face searching apparatus may further include a quality detection unit;
the quality detection unit is used for carrying out quality detection on the face image to be recognized before acquiring the feature vector of the face image to be recognized;
if the facial image to be recognized meets the quality detection standard, the first acquisition unit executes the process of acquiring the feature vector of the facial image to be recognized;
and if the facial image to be recognized does not accord with the quality detection standard, prompting to upload the facial image to be recognized again.
Optionally, the target determining unit may include:
a first target determination unit, configured to determine, as a target feature vector, a feature vector for which the similarity satisfies a similarity threshold;
or the like, or, alternatively,
and the second target determining unit is used for sequencing the similarity from high to low and determining the feature vector of which the similarity meets the preset sequencing as the target feature vector.
Optionally, the similar face searching apparatus may further include:
the cluster extraction unit is used for extracting the characteristic vector of the existing face image;
the cluster calculation unit is used for calculating a hash value of the feature vector of the existing face image through a hash algorithm;
and the cluster generating unit is used for clustering the characteristic vectors of the existing face images according to the hash values to generate each cluster, and the value interval of the hash value of each characteristic vector in each cluster is used as the corresponding hash value clustering range of the cluster.
The similar face searching device provided by the embodiment of the application can be applied to similar face searching equipment. Optionally, fig. 3 shows a block diagram of a hardware structure of the similar face searching apparatus, and referring to fig. 3, the hardware structure of the similar face searching apparatus may include: at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4;
in the embodiment of the application, the number of the processor 1, the communication interface 2, the memory 3 and the communication bus 4 is at least one, and the processor 1, the communication interface 2 and the memory 3 complete mutual communication through the communication bus 4;
the processor 1 may be a central processing unit CPU, or an application Specific Integrated circuit asic, or one or more Integrated circuits configured to implement embodiments of the present invention, etc.;
the memory 3 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory;
wherein the memory stores a program and the processor can call the program stored in the memory, the program for:
acquiring a feature vector of a face image to be recognized;
calculating a hash value of the feature vector of the face image to be recognized through a hash algorithm;
determining a cluster matched with the feature vector of the facial image to be recognized according to the hash value cluster range of the hash value, wherein all feature vectors of the facial image with the hash value within the hash value cluster range of the cluster are stored in the cluster;
calculating the similarity between each feature vector in the cluster and the feature vector of the face image;
determining the feature vector with the similarity meeting a preset condition as a target feature vector;
and acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
Alternatively, the detailed function and the extended function of the program may refer to the above description.
Embodiments of the present application further provide a readable storage medium, where a program suitable for being executed by a processor may be stored, where the program is configured to:
acquiring a feature vector of a face image to be recognized;
calculating a hash value of the feature vector of the face image to be recognized through a hash algorithm;
determining a cluster matched with the feature vector of the facial image to be recognized according to the hash value cluster range of the hash value, wherein all feature vectors of the facial image with the hash value within the hash value cluster range of the cluster are stored in the cluster;
calculating the similarity between each feature vector in the cluster and the feature vector of the face image;
determining the feature vector with the similarity meeting a preset condition as a target feature vector;
and acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
Alternatively, the detailed function and the extended function of the program may refer to the above description.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A similar face searching method is characterized by comprising the following steps:
acquiring a feature vector of a face image to be recognized;
calculating a hash value of the feature vector of the face image to be recognized through a hash algorithm;
determining a cluster matched with the feature vector of the facial image to be recognized according to the hash value cluster range of the hash value, wherein all feature vectors of the facial image with the hash value within the hash value cluster range of the cluster are stored in the cluster;
calculating the similarity between each feature vector in the cluster and the feature vector of the face image;
determining the feature vector with the similarity meeting a preset condition as a target feature vector;
and acquiring the face identity information which is recorded in a face information base and corresponds to the target characteristic vector.
2. The method according to claim 1, wherein the calculating the similarity between each feature vector in the cluster and the feature vector of the face image comprises:
determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating the cosine distance;
or the like, or, alternatively,
and determining the similarity between each feature vector in the cluster and the feature vector of the face image by calculating the Euclidean distance.
3. The method according to claim 1, wherein the obtaining the feature vector of the face image to be recognized comprises:
acquiring a face image to be recognized;
identifying and intercepting a face area in a face image to be identified;
and extracting the characteristic vector of the face region, and taking the characteristic vector of the face region as the characteristic vector of the face image to be recognized.
4. The method according to claim 1, wherein after determining the feature vector with the similarity satisfying the similarity threshold as a target feature vector, further comprising:
determining an ID of the target feature vector;
the acquiring of the face identity information recorded in the face information base and corresponding to the target feature vector includes:
and inquiring in a face information base to obtain face identity information corresponding to the ID.
5. The method according to claim 1, before obtaining the feature vector of the face image to be recognized, further comprising:
performing quality detection on the face image to be recognized;
if the facial image to be recognized meets the quality detection standard, executing the process of acquiring the characteristic vector of the facial image to be recognized;
and if the facial image to be recognized does not accord with the quality detection standard, prompting to upload the facial image to be recognized again.
6. The method according to claim 1, wherein the determining the feature vector with the similarity satisfying a preset condition as a target feature vector comprises:
determining the feature vector with the similarity meeting a similarity threshold as a target feature vector;
or the like, or, alternatively,
and sequencing the similarity from high to low, and determining the feature vector with the similarity meeting the preset sequencing as a target feature vector.
7. The method according to claim 1, wherein the generating process of each cluster includes:
extracting the feature vector of the existing face image;
calculating a hash value of the feature vector of the existing face image through a hash algorithm;
and clustering the characteristic vectors of the existing face images according to the hash values to generate clustering clusters, wherein the value intervals of the hash values of the characteristic vectors in each clustering cluster are used as the clustering ranges of the hash values corresponding to the clustering clusters.
8. A similar face search apparatus, comprising:
the first acquisition unit is used for acquiring a feature vector of a face image to be recognized;
the Hash calculation unit is used for calculating a Hash value of the feature vector of the face image to be recognized through a Hash algorithm;
a cluster determining unit, configured to determine a cluster matched with the feature vector of the facial image to be recognized according to a hash value cluster range in which the hash value is located, where all feature vectors of facial images whose hash values are within the hash value cluster range of the cluster are stored in the cluster;
the similarity calculation unit is used for calculating the similarity between each feature vector in the cluster and the feature vector of the face image;
a target determining unit, configured to determine, as a target feature vector, a feature vector for which the similarity satisfies a similarity threshold;
and the second acquisition unit is used for acquiring the face identity information which is recorded in the face information base and corresponds to the target characteristic vector.
9. A similar face search device comprising a memory and a processor;
the memory is used for storing programs;
the processor, configured to execute the program, and implement the steps of the similar face search method according to any one of claims 1 to 7.
10. A readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, performs the steps of the similar face search method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111417307.8A CN114048344A (en) | 2021-11-25 | 2021-11-25 | Similar face searching method, device, equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111417307.8A CN114048344A (en) | 2021-11-25 | 2021-11-25 | Similar face searching method, device, equipment and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114048344A true CN114048344A (en) | 2022-02-15 |
Family
ID=80211170
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111417307.8A Pending CN114048344A (en) | 2021-11-25 | 2021-11-25 | Similar face searching method, device, equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114048344A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117113321A (en) * | 2023-09-04 | 2023-11-24 | 北京锐融天下科技股份有限公司 | Image searching method and system for searching face by face |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107577990A (en) * | 2017-08-09 | 2018-01-12 | 武汉世纪金桥安全技术有限公司 | A kind of extensive face identification method for accelerating retrieval based on GPU |
CN107679250A (en) * | 2017-11-01 | 2018-02-09 | 浙江工业大学 | A kind of multitask layered image search method based on depth own coding convolutional neural networks |
CN109710792A (en) * | 2018-12-24 | 2019-05-03 | 西安烽火软件科技有限公司 | A kind of fast face searching system application based on index |
CN109800781A (en) * | 2018-12-07 | 2019-05-24 | 北京奇艺世纪科技有限公司 | A kind of image processing method, device and computer readable storage medium |
CN110765292A (en) * | 2019-10-24 | 2020-02-07 | 重庆紫光华山智安科技有限公司 | Image retrieval method, training method and related device |
CN111522989A (en) * | 2020-07-06 | 2020-08-11 | 南京梦饷网络科技有限公司 | Method, computing device, and computer storage medium for image retrieval |
CN112883848A (en) * | 2021-02-02 | 2021-06-01 | 青岛市中心医院 | Face recognition method and device and computer readable storage medium |
CN112925940A (en) * | 2021-03-04 | 2021-06-08 | 浙江中设天合科技有限公司 | Similar image retrieval method and device, computer equipment and storage medium |
-
2021
- 2021-11-25 CN CN202111417307.8A patent/CN114048344A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107577990A (en) * | 2017-08-09 | 2018-01-12 | 武汉世纪金桥安全技术有限公司 | A kind of extensive face identification method for accelerating retrieval based on GPU |
CN107679250A (en) * | 2017-11-01 | 2018-02-09 | 浙江工业大学 | A kind of multitask layered image search method based on depth own coding convolutional neural networks |
CN109800781A (en) * | 2018-12-07 | 2019-05-24 | 北京奇艺世纪科技有限公司 | A kind of image processing method, device and computer readable storage medium |
CN109710792A (en) * | 2018-12-24 | 2019-05-03 | 西安烽火软件科技有限公司 | A kind of fast face searching system application based on index |
CN110765292A (en) * | 2019-10-24 | 2020-02-07 | 重庆紫光华山智安科技有限公司 | Image retrieval method, training method and related device |
CN111522989A (en) * | 2020-07-06 | 2020-08-11 | 南京梦饷网络科技有限公司 | Method, computing device, and computer storage medium for image retrieval |
CN112883848A (en) * | 2021-02-02 | 2021-06-01 | 青岛市中心医院 | Face recognition method and device and computer readable storage medium |
CN112925940A (en) * | 2021-03-04 | 2021-06-08 | 浙江中设天合科技有限公司 | Similar image retrieval method and device, computer equipment and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117113321A (en) * | 2023-09-04 | 2023-11-24 | 北京锐融天下科技股份有限公司 | Image searching method and system for searching face by face |
CN117113321B (en) * | 2023-09-04 | 2024-01-30 | 北京锐融天下科技股份有限公司 | Image searching method and system for searching face by face |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109426785B (en) | Human body target identity recognition method and device | |
CN110348362B (en) | Label generation method, video processing method, device, electronic equipment and storage medium | |
CN109635686B (en) | Two-stage pedestrian searching method combining human face and appearance | |
CN111523569B (en) | User identity determination method and device and electronic equipment | |
CN103399896B (en) | The method and system of incidence relation between identification user | |
CN110866466B (en) | Face recognition method, device, storage medium and server | |
Li et al. | Shot boundary detection based on multilevel difference of colour histograms | |
CN109582813B (en) | Retrieval method, device, equipment and storage medium for cultural relic exhibit | |
US20140375886A1 (en) | Automatic face discovery and recognition for video content analysis | |
JP2022518469A (en) | Information processing methods and devices, storage media | |
CN112818149A (en) | Face clustering method and device based on space-time trajectory data and storage medium | |
CN111368867A (en) | Archive classification method and system and computer readable storage medium | |
WO2020135756A1 (en) | Video segment extraction method, apparatus and device, and computer-readable storage medium | |
CN111931548A (en) | Face recognition system, method for establishing face recognition data and face recognition method | |
CN111079517A (en) | Face management and recognition method and computer-readable storage medium | |
CN111444817B (en) | Character image recognition method and device, electronic equipment and storage medium | |
Singh et al. | A comprehensive survey on person re-identification approaches: various aspects | |
CN109711287B (en) | Face acquisition method and related product | |
CN109886239B (en) | Portrait clustering method, device and system | |
Mubariz et al. | Optimization of Person Re-Identification through Visual Descriptors. | |
CN114048344A (en) | Similar face searching method, device, equipment and readable storage medium | |
CN113987243A (en) | Image file gathering method, image file gathering device and computer readable storage medium | |
CN116758590B (en) | Palm feature processing method, device, equipment and medium for identity authentication | |
CN111666441A (en) | Method, device and electronic system for determining personnel identity type | |
De Marsico et al. | ES-RU: an e ntropy based rule to s elect r epresentative templates in face su rveillance |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |