CN108932321B - Face image retrieval method and device, computer equipment and storage medium - Google Patents
Face image retrieval method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN108932321B CN108932321B CN201810693522.2A CN201810693522A CN108932321B CN 108932321 B CN108932321 B CN 108932321B CN 201810693522 A CN201810693522 A CN 201810693522A CN 108932321 B CN108932321 B CN 108932321B
- Authority
- CN
- China
- Prior art keywords
- vector
- face
- vectors
- basis
- matrix
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/168—Feature extraction; Face representation
-
- 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)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Image Analysis (AREA)
Abstract
The application relates to a face image retrieval method, a face image retrieval device, computer equipment and a computer storage medium. The method comprises the following steps: acquiring a face image, and extracting the features of the face image to obtain a corresponding face feature vector; generating an index vector and an offset vector of the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of basis vectors, and the basis vectors have discrimination with the face feature vectors in a database; searching a database according to the index vector and the offset vector to obtain a face similarity set of the face feature vector; and acquiring the face with the maximum matching degree with the face image in the face similarity set as a face image retrieval result. The invention can quickly obtain the search result. And after the data source is updated, model training is not needed, so that resource loss is reduced, and the recognition efficiency is greatly improved.
Description
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for retrieving a face image, a computer device, and a computer-readable storage medium.
Background
With the development of artificial intelligence technology, face recognition becomes an increasingly interesting field. Acquiring a face picture in a picture or a video is an essential step in face recognition.
In the image retrieval method in the traditional technology, a dimension reduction weighting is generally carried out on a feature vector to train a dimension reduction model, finally, the feature vector is subjected to the dimension reduction model to generate an index of a similar bit string, and then matching is searched according to the index. The process resource consumption of the training model of the face retrieval method is very high, and the weighted weight is difficult to select, so that the retrieval result is limited. The weight value is difficult because: it is difficult to determine how much each dimension affects the overall similarity, and in order to achieve a better effect, a huge amount of data is needed to perform continuous model training, a large amount of resources are consumed, the final effect has a great relationship with the data source during training, the effect of training from a wide range of data sources does not necessarily meet the situation in an actual scene, for example, pictures during training come from all over the world, but the actual application-oriented objects are basically Chinese, and the data source needed for training is needed to achieve a better effect in this situation. The time cost for training the model and the data source acquisition cost are very large, which causes great cost pressure.
Disclosure of Invention
Therefore, it is necessary to provide a face image retrieval method, a face image retrieval apparatus, a computer device, and a computer readable storage medium, which can solve the technical problems of high resource consumption and high cost caused by the need of continuously training a model to ensure recognition accuracy after adding a new data source in the conventional technology.
A face image retrieval method comprises the following steps:
acquiring a face image, and extracting the features of the face image to obtain a corresponding face feature vector;
generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of a plurality of basis vectors, the basis vectors have discrimination with the face feature vectors in a database, and the database stores a large number of face feature vectors of the face image;
searching a database according to the index vector and the offset vector to obtain a face similarity set corresponding to the face feature vector;
and acquiring the face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
A face image retrieval apparatus comprising:
the face feature extraction module is used for extracting features of the obtained face image to obtain a corresponding face feature vector;
the characteristic vector processing module is used for generating an index vector and an offset vector corresponding to the human face characteristic vector through a basis vector matrix, wherein the basis vector matrix is formed by basis vectors, the basis vectors have a distinguishing degree with sample data in a database, and the database stores a large number of human face characteristic vectors of human face images;
and the face image searching module is used for searching in a database according to the index vector and the offset vector to obtain a face similarity set of the face feature vector, and acquiring a face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring a face image, and extracting the features of the face image to obtain a corresponding face feature vector;
generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of a plurality of basis vectors, the basis vectors have discrimination with the face feature vectors in a database, and the database stores a large number of face feature vectors of the face image;
searching a database according to the index vector and the offset vector to obtain a face similarity set corresponding to the face feature vector;
and acquiring the face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring a face image, and extracting the features of the face image to obtain a corresponding face feature vector;
generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of basis vectors, and the basis vectors have discrimination with the face feature vectors in the database;
searching a database according to the index vector and the offset vector to obtain a face similarity set of the face feature vector;
and acquiring the face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
And when the number of the face feature vectors in the database changes and exceeds a preset value, generating the basis vector matrix.
According to the face image retrieval method, the face image retrieval device, the computer equipment and the computer readable storage medium, the index vector and the offset vector of the face feature vector are generated through the basis vector matrix, the corresponding minimum space data set and the adjacent minimum space data set of the face feature vector in the database are positioned, so that the face similarity set of the face feature vector is searched, the face similarity set is subjected to traversal comparison finally, and the search result can be quickly obtained. And after the data source is updated, model training is not needed, so that resource loss is reduced, and the recognition efficiency is greatly improved.
Drawings
FIG. 1 is a diagram of an exemplary embodiment of a face image retrieval method;
FIG. 2 is a flow diagram of a method for facial image retrieval in one embodiment;
FIG. 3 is a flow chart illustrating a face image retrieval method according to an embodiment;
FIG. 4 is a schematic flow chart of a face image retrieval method according to another embodiment;
FIG. 5 is a flowchart illustrating steps of a face image retrieval method according to another embodiment;
FIG. 6 is a graph showing the similarity distribution of sample data in the face image retrieval method according to an embodiment;
FIG. 7 is a diagram illustrating the steps of a face image retrieval method according to another embodiment;
FIG. 8 is a block diagram showing the construction of a face image retrieval apparatus according to an embodiment;
FIG. 9 is a block diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The face image retrieval method provided by the application can be applied to the application environment shown in fig. 1. The terminal 102 communicates with the server 104 through a network, the terminal 102 sends the acquired face image to the server 104, the server 104 performs a series of processing on the face image, and the server 104 acquires the face feature vector in the face image and identifies the face which is most matched with the face feature vector, so that the purpose of face image retrieval is achieved.
In an embodiment, as shown in fig. 2, the embodiment provides a face image retrieval method, which can be applied to a server for illustration, and includes:
The face image is an image or picture containing a face, and the face feature vector is a vector formed by extracting and aggregating features of each region of the face. Specifically, feature extraction is performed on five sense organs and the like of the face in the face image, and then the feature extraction is performed on the five sense organs and the like of the face image to form a vector, which is equivalent to separately storing the features of the nose, the eyes, the forehead, the chin and the like of one face in a database.
And 204, generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of basis vectors, the basis vectors have discrimination with the face feature vectors in the database, and the database stores a large number of face feature vectors of the face image. The basis vector matrix is an M-dimensional matrix composed of M basis vectors, similar to a multi-dimensional coordinate system, the basis vectors are axes corresponding to a certain dimension, and M is an integer. The term "discrimination" means that the similarity distribution of the basis vector is represented on the data as not being gathered at a certain position. Specifically, after the generated face feature vector passes through the basis vector matrix, an index vector and an offset vector of the face feature vector are generated, where the index vector is an index of the face feature vector, and data corresponding to the index vector may be searched according to the index vector.
The index vector is generated according to the face feature vector and the base vector matrix, the index vector is a pointer pointing to a data value stored at a specified position in the database, and the index vector indicates a corresponding region of all the face feature vectors in the database on a high-dimensional space.
The offset vector is used to determine whether to search the space corresponding to the critical position during the search, i.e. to indicate the neighboring area of the area that needs to be searched additionally during the search.
And step 206, searching in a database according to the index vector and the offset vector to obtain a face similarity set corresponding to the face feature vector.
Because the same index vector can simultaneously correspond to a plurality of faces, when data corresponding to the index vector is searched from a database, a group of face images meeting the index vector can be found, the group formed by the group of face images is the minimum spatial data set, the adjacent spatial data of the minimum spatial data set is obtained according to the offset vector to be used as the adjacent minimum spatial data set, and all the obtained minimum spatial data sets are used as the face similarity set of the face feature vector.
And 208, acquiring the face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
And matching one by one according to the obtained face similarity set to obtain the face which is most matched with the face feature vector. When the data volume in the face similarity set is not large at first, the traversal search can be directly carried out to compare the result.
In the embodiment, the base vector matrix is constructed, the index vector and the offset vector of the face feature vector are generated through the base vector matrix, and the face similarity set of the face feature vector is confirmed in the database according to the index vector and the offset vector, so that the purpose of face search is achieved, model training is not needed, and cost pressure is greatly saved.
In one embodiment, as shown in fig. 3, generating an index vector and an offset vector of a face feature vector by a basis vector matrix includes:
Specifically, the candidate base vector is compared with a single sample data, a similarity of the base vector on the single sample data is generated, the candidate base vector is compared with all the face feature vectors substituted at this time one by one, and a similarity distribution relative to all the sample data is generated, wherein the similarity distribution is as [0.1, 0.24, 0.35.
And step 304, confirming an index vector and an offset vector corresponding to the face feature vector according to the region of the similarity on the basis vector. Specifically, the basis vector matrix is an M-dimensional matrix formed by M basis vectors, and is similar to a multi-dimensional coordinate system, the face feature vector and the basis vector of the corresponding dimension are compared in M dimensions of the basis vector matrix, the similarity between the face feature vector and the basis vector of the corresponding dimension is calculated, and the interval to which the face feature vector belongs is found in the corresponding basis vector according to the similarity. For example, if the calculated similarity is 0.36, in this dimension, the index of the face feature vector is denoted as N3, the offset vector is denoted as 1, and so on, an index vector in the form of [ N3, N3, N5, N8, … ] and an offset vector in the form of [1,0,0, -1, … ] are formed.
According to the face searching method, the index vector and the offset vector of the face feature vector are obtained by calculating the similarity, the calculating method is simple and convenient, the precision is high, and the face searching efficiency and accuracy are greatly improved.
In one embodiment, as shown in fig. 4, the way of generating the basis vector matrix includes:
A large amount of face data, specifically face feature vectors, are stored in the data, and sample data is randomly extracted from a database, wherein the sample data is random face feature vectors.
The candidate matrix set is a matrix set composed of a plurality of vectors with preset settings. Specifically, a set of candidate matrices having shapes of [0,1,1, … ], [1,0,1,1, … ], [1,1,0, 1. ] … may be preset, and M vectors are selected as candidate basis vector vectors in the set of candidate matrices, which are all vectors that have not been verified.
Specifically, substituting a single sample data into the candidate basis vector for comparison to obtain the similarity of the basis vector with respect to the single sample data, then obtaining the similarity distribution of the basis vector on all the sample data, and taking the similarity distribution as a first similarity distribution.
And step 408, acquiring candidate basis vector vectors with discrimination degrees with the sample data according to the first similarity distribution as basis vector vectors. The term "differentiated" means that the first similarity distribution is substantially unchanged and non-generic after a plurality of sets of sample data are substituted, and if the first similarity distribution is non-generic, the non-generic is regarded as passing, and the non-generic is represented as non-gathering of data in the distribution, on the contrary, all the data are distributed around 0, and no data exist between 0.1 and 0.9.
Specifically, successful basis vector vectors are verified according to step 408, the basis vector vectors are used as a part of the basis vector matrix, and when the required number of basis vector vectors are verified, one basis vector matrix is generated.
In the embodiment, the basis vector matrix is constructed, the sample data is selected, so that the basis vector meets the characteristics that the similarity distribution has no change to the sample data basically and has non-generality, the uniformity of the whole data space is realized through sample extraction and calculation, and the search speed is ensured.
Further, in an embodiment, as shown in fig. 5, obtaining candidate basis vector vectors having a region distribution with sample data according to the first similarity distribution includes:
Re-selecting new sample data, namely acquiring a plurality of face characteristic vectors, and substituting a single face characteristic vector into the candidate base vector to obtain a similarity; and after all the face feature vectors are substituted, comparing the similarity of the candidate base vector vectors and all the face feature vectors one by one, and generating a similarity distribution as a second similarity distribution.
Specifically, the first similarity distribution is compared with a newly obtained second similarity distribution, specifically, the corresponding numerical subscripts of each lattice of the similarity distribution are compared one by one, if the difference between the numerical subscripts of each lattice exceeds a preset threshold, the lattice in the first similarity does not meet the requirement, and if the number of failed lattices exceeds the preset threshold, the current test result is: the candidate base vector vectors of the batch are unqualified; and otherwise, the vector is qualified, and the candidate base vector passing the inspection is taken as the base vector.
And forming a basis vector matrix by the basis vectors until a preset number of basis vectors are obtained.
The candidate basis vector check successfully becomes a part of the basis vector matrix by representing the candidate basis vector.
More specifically, as shown in fig. 6, fig. 6 is a distribution curve of samples in comparison with a single basis vector in similarity, the distribution curve is unknown, if the equal area of the distribution curve is uniformly divided into N parts, the number of samples in each interval is N/N, for example, when the similarity takes a value of 0 to 0.1, the sample interval is denoted as an index N1, and when the similarity takes a value of 0.1 to 0.22, the sample interval is denoted as an index N2, the sample interval is denoted as an N/N to 2N/N. And so on, finally forming vectors like [ N1, N2, N3, … ] for the single basis vector. Meanwhile, taking a certain 2 positions in the left and right boundaries in each interval as offset points, and taking the position between the offset point and the boundary as a critical position to determine whether to search an adjacent space during searching, wherein the left offset is marked as-1, the right offset is marked as 1, and no offset is marked as 0 to be used as compensation.
In the present embodiment, the part N3 in fig. 6 is taken as an example, the left and right boundaries are 0.22 and 0.4, and the position shifted by 20% is taken as the offset point, and assuming that the positions are 0.25 and 0.35, respectively, the parts 0.22 to 0.25 and 0.35 to 0.4 are critical parts, and the point in between are compensated to-1 and 1.
Finally, the M basis vector vectors are combined to form a basis vector matrix.
In the embodiment, the basis vector matrix is constructed, the sample is selected, the basis vector meets the requirement that the distribution has no change and non-generality on the sample, the process is completed through sample sampling and repetitive calculation, the uniformity of the whole data space is realized, and the searching speed is ensured.
Further, in an embodiment, when the number of face feature vectors in the database changes by more than a preset value, the basis vector matrix is generated.
The data volume in the database may be relatively small at the beginning, and in this case, a search matching algorithm is not needed, and the face similarity set is directly traversed, searched and compared, but as the face images are continuously increased, the generated face feature vectors are more and more, the data volume in the database is increased, and the division precision of the face similarity set is greatly reduced.
And because the same index vector may correspond to a plurality of faces, a batch of faces meeting the condition can be found by only searching data containing the index vector, and a data set formed by the batch of faces forms a minimum space data set. Each generation of the basis vector matrix is also a refresh of the minimum spatial data set.
Along with the increase of data quantity, the basis vector matrix can be refreshed quickly according to the existing data at intervals, and the time cost is an application maintenance level, so that the uniformity of the divided space is ensured, and the retrieval effect is kept. In a specific service scene, when the face feature vector changes due to the change of a passenger source, the model is retrained at a higher cost in a corresponding scheme, but the method only needs to regenerate the basis vector matrix and recalculate the index vector and the offset vector of the face feature vector in the database according to the newly generated basis vector matrix, so that the time cost and the economic cost are greatly reduced.
All face feature vectors can be regarded as an aggregate, the operation of regenerating a basis vector matrix is to actually subdivide the aggregate according to a certain rule, and generate a corresponding index vector and an offset vector for each face feature vector, and similar face feature vectors can point to the same or adjacent index vectors, so that after refreshing, the face feature vectors themselves do not change, but all the index vectors corresponding to the face feature vectors change, then the searched face similar set is more accurate, and part of faces which are more dissimilar can be squeezed out of the minimum spatial data set, and similar faces can enter the minimum spatial data set. The index vector is generated according to the face feature vector and the basis vector matrix, the basis vector matrix can be regarded as a segmentation rule, the rule is changed when the basis vector matrix is regenerated, and then the index vector is changed, so that the basis vector matrix is regenerated along with the change of data quantity every time.
In the embodiment, when the change of the data quantity in the database exceeds a certain threshold, the operation of regenerating the basis vector matrix is performed, so that the similarity of the face in the minimum spatial data set is higher, and the retrieval result is more accurate.
In one embodiment, a face image retrieval method is provided, which searches a database according to the index vector and the offset vector to obtain a face similarity set of face feature vectors, and includes:
determining a corresponding minimum space data set or an adjacent minimum space data set of the face feature vector in the database through the index vector and the offset vector; and acquiring a face similarity set corresponding to the face feature vector according to a minimum space data set, wherein the minimum space data set is a set of faces corresponding to the same index vector.
Specifically, the whole database, that is, the set of all face feature vectors, is divided into a plurality of minimum spatial data sets, the database is divided into a plurality of minimum spatial data sets according to the similarity, so that the speed of searching and matching is higher, and the face similar set similar to the face identified according to the needs is found out and compared.
The size of the minimum spatial data set is controlled within a certain range, and the specific size can be freely adjusted. The principle is that when the data set is larger and larger, the size of the similarity set also rises, and when the preset value is reached, the data set is updated, all the data are cut again, and the size of the similarity set is controlled in a desired range.
In the embodiment, the face similarity set of the face feature vector is searched in the segmented database, and the similarity between the face feature vector and the basis vector is compared to determine which block of the face feature vector in the database, so that the efficiency of searching and matching is greatly improved. In addition, the embodiment has low time cost and economic cost, always keeps high-efficiency retrieval on the existing type of human faces, and flexibly copes with the situation that the human face characteristics change due to the change of the passenger source.
In one embodiment, as shown in fig. 7, a face image retrieval method is provided, including:
However, the candidate basis vector after the first similarity distribution is obtained is not necessarily the vector that we need, and the candidate basis vector needs to be checked.
And 710, randomly extracting sample data from the database again, and substituting the newly acquired sample data into the candidate basis vector to obtain a second similarity distribution of the candidate basis vector on the newly acquired sample data.
In step 712, candidate basis vector vectors corresponding to the second similarity distribution whose deviation value from the first similarity distribution does not exceed a predetermined value are obtained as basis vector vectors.
And 714, generating a base vector matrix according to the base vector.
Specifically, the basis vector matrix is generated depending on the existing data in the database, so when the data amount changes greatly, refreshing is required to ensure the performance of the base vector matrix. The criterion of the variation can be considered in combination with practical conditions such as database capacity, speed, etc., where a reference value is given for refreshing when the data amount is changed to 4 times the original one. The refreshing process is the process of regenerating, replacing and deleting the original data. The index vector depends on the basis vector matrix, so that when the basis vector matrix is updated, the basis vector matrix needs to be refreshed, and the process is basically the same as the refreshing process of the basis vector matrix. The time consumed in the whole process belongs to the application maintenance level, the model does not need to be retrained again, and the data cost and the time cost are reduced.
And step 716, generating an index vector and an offset vector of the face feature vector through the basis vector matrix.
Specifically, in M dimensions of the basis vector matrix, the face feature vector and the basis vector of the corresponding dimension are compared, the similarity of the face feature vector and the basis vector of the corresponding dimension is calculated, and the belonging interval is found in the corresponding basis vector according to the similarity. For example, if the calculated similarity is 0.36, then in this dimension, the index is denoted as N3, the offset is denoted as 1, and so on, an index vector such as [ N3, N2, N5, N8, ] and an offset vector such as [1,0,0, -1, … ] are formed.
The neighboring minimum spatial data sets are derived based on the offset vector. The offset vector is set because the interval is divided into interval 1 (0-0.3), interval 2 (0.3-0.6) and interval 3 (0.6-1) in a certain dimension. If the feature value of a face feature vector is 0.29 (if the basis vector has only one dimension, 0.29 represents a face), then the face feature vector belongs to the interval 1 (if the basis vector has only one dimension, this interval 1 is an index vector), but the feature value 0.29 is already close to the interval 0.3, and the feature value 0.29 may fluctuate due to some other factors, such as makeup, expression, etc., so the feature value may be 0.25 or 0.35 next time, then the shift needs to be considered at this time, and it is noted that this feature value belongs to the interval 1 and the shift interval 2, if the basis vector has only one dimension, this shift interval 2 is a shift vector, otherwise, only a part of the shift vector is included.
The neighboring minimum spatial data sets are derived based on the offset vector. The reason why the offset vector is provided is that the interval is divided into interval 1 (0-1), interval 2 (1-2) and interval 3 (2-3) in a certain dimension. If the feature value of a face feature vector is 0.99 (if the basis vector has only one dimension, 0.99 represents the face), then the face feature vector belongs to the interval 1 (if the basis vector has only one dimension, this interval 1 is the index vector), but the feature value 0.99 is already close to the interval 2, and the feature value 0.99 may fluctuate due to some other factors, such as makeup, expression, etc., so the feature value may be 0.8 or 1.1 next time, then the shift is considered, and it is considered that this feature value belongs to the interval 1 and the shift interval 2, if the basis vector has only one dimension, this shift interval 2 is the shift vector, otherwise, it is only a part of the shift vector.
And 720, acquiring a face similarity set of the face feature vectors according to the minimum spatial data set.
And step 722, acquiring the face with the maximum matching degree with the face image in the face similarity set as a face image retrieval result.
Specifically, the similarity comparison between two face feature vectors actually compares cosine clip angle values between the two face feature vectors, and the larger the value is, the more similar the result is. And calculating a final result by comparing the face feature vectors with the face feature vectors in the face similarity set one by one.
In this embodiment, a set of similar values is calculated by generating and searching an index vector and an offset vector, and comparing corresponding basis vector according to a face feature vector and a basis vector matrix, and then a corresponding index vector and an offset vector are calculated according to the basis vector matrix, and a set and an adjacent set of the face feature vector in a space are determined, so as to search out a face similar set, and finally, comparison is performed. The time cost and the economic cost are greatly reduced, the efficient retrieval of the existing type of human faces is always kept, and the situation that the human face characteristics change due to the change of the passenger source is flexibly coped with.
In an embodiment, a passenger flow identification system suitable for the face image retrieval method is further provided, and is suitable for a store to count and identify passenger flows, and in this embodiment, when a person enters a certain area, the face image of the person may be obtained, information extraction may be performed on the face image, and finally, identity information of the person is identified, specifically, the method includes:
the image acquisition equipment is used for capturing visiting clients, acquiring face images of the clients, performing local preprocessing operation on the face images, removing interference information in the face images, and finally uploading the undistorted face images to an equipment monitoring platform through the communication unit;
the equipment monitoring platform is used for monitoring and uniformly managing the image acquisition equipment, receiving the face image uploaded by the image acquisition equipment and uploading the face image to the server;
the server is used for carrying out face detection, face alignment and face feature extraction on the received face image to obtain a face feature vector; generating an index vector and an offset vector of the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of basis vectors, and the basis vectors have discrimination with the face feature vectors in the database; searching a face similarity set of the face feature vector in a database according to the index vector and the offset vector; acquiring a face with the maximum matching degree with the face image in the face similarity set as a face image retrieval result; finally, identifying the identity information of the face, and if the identified face is a member, transmitting the identified member identity information to a display; when the member checks out the account, the member identity information is called, the data integration and processing are carried out, the dimensional data of the member, such as information of account numbers, coupons and the like, are generated, and finally the account checking operation is achieved.
According to the embodiment, the characteristic that the target passenger flow mobility is large, namely the characteristic that the group base number needing to be identified is large is overcome, the face identification efficiency is improved, the consumption experience of the user is improved, and the stickiness of the user is enhanced.
In one embodiment, as shown in fig. 8, there is provided a face image retrieval apparatus including: a face feature extraction module 802, a feature vector processing module 806, and a face image search module 808, wherein:
the face feature extraction module 802 is configured to perform feature extraction on the obtained face image to obtain a corresponding face feature vector.
The feature vector processing module 806 is configured to generate an index vector and an offset vector corresponding to a face feature vector through a basis vector matrix, where the basis vector matrix is formed by a plurality of basis vectors, the basis vectors have a degree of distinction from sample data in a database, the database stores a large number of face feature vectors of face images, and the database stores a large number of face feature vectors of face images.
And the face image searching module 808 is configured to search the database according to the index vector and the offset vector to obtain a face similarity set of the face feature vector, and obtain a face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
The face image retrieval is carried out through the embodiment, so that the retrieval efficiency is greatly increased, and the retrieval cost is greatly reduced.
In one embodiment, as shown in fig. 8, a facial image retrieving apparatus is provided, the apparatus further includes a basis vector matrix generating module 804, the basis vector matrix generating module 804 is configured to:
acquiring sample data from a database; acquiring a preset alternative matrix set, wherein the alternative matrix set comprises a plurality of preset vectors; selecting a preset number of vectors from the candidate matrix set as candidate base vector vectors; substituting the sample data into the candidate base vector to obtain a first similarity distribution of the candidate base vector on the sample data; obtaining candidate base vector vectors with discrimination with the sample data according to the first similarity distribution as base vector vectors; and generating a basis vector matrix according to the plurality of basis vectors.
Further, the basis vector matrix generating module 804 is further configured to regenerate the basis vector matrix when the data change in the database exceeds a preset value.
In the embodiment, the basis vector matrix is constructed through the basis vector matrix generation module, the sample is selected, so that the basis vector meets the requirement that the distribution has no change basically and has non-generality on the sample, the process is completed through sample sampling and repeated calculation, the uniformity of the whole data space is realized, and the search speed is ensured.
In one embodiment, as shown in fig. 9, based on the above embodiments, the present embodiment provides a computer device, including a memory in which a computer program is stored, and a processor, configured to receive a face image of a target person captured by an image processing device and process the face image; and the cloud end processes the target image to acquire the identity information of the target person.
The server carries out operations such as face detection, face alignment, feature extraction and the like on the received face image, finally, a face similarity set corresponding to the face feature vector is retrieved in the database, face comparison is carried out according to data in the face similarity set, a similar face is found out, storage and processing are carried out, and finally the recognition process in the whole process is supported in the form of API.
It should be understood that although the various steps in the flow charts of fig. 2-7 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 2 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
It will be appreciated by those skilled in the art that the block diagrams described above are merely block diagrams of some structures related to the embodiments of the present application, and do not constitute limitations on the computer apparatus to which the embodiments of the present application may be applied, and that a particular computer apparatus may include more or less components than those shown in the drawings, or may combine some components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring a face image, and performing feature extraction on the face image to obtain a face feature vector; generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of a plurality of basis vectors, the basis vectors have discrimination with the face feature vectors in a database, and the database stores a large number of face feature vectors of the face image; searching in a database according to the index vector and the offset vector to obtain a face similarity set corresponding to the face feature vector; and acquiring the face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
comparing the human face feature vector with the basis vector in the basis vector matrix of the corresponding dimension to obtain the similarity between the human face feature vector and the basis vector of the corresponding dimension; and determining an index vector and an offset vector according to the interval of the similarity on the basis vector.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
selecting sample data from a database, acquiring a preset alternative matrix set, wherein the alternative matrix set comprises a plurality of preset vectors, and selecting a preset number of vectors from the alternative matrix set as candidate base vector vectors; then substituting the selected sample data into the candidate base vector to calculate the similarity of the candidate base vector relative to a single sample data, and finally obtaining the similarity distribution of the candidate base vector on all sample data as a first similarity distribution; and acquiring a candidate basis vector differentiated from the sample data basis friend according to the first similarity distribution as an own basis vector, and generating a basis vector matrix according to the basis vector.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
re-acquiring sample data, and substituting the re-acquired sample data into the candidate basis vector to obtain a second similarity distribution of the candidate basis vector; and acquiring a candidate base vector corresponding to the second similarity distribution of which the deviation value of the first similarity distribution does not exceed a preset value as the base vector.
Further, in one embodiment, the processor, when executing the computer program, further performs the steps of:
and when the number of the face feature vectors in the database changes and exceeds a preset value, generating a basis vector matrix.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and obtaining a relative minimum space data set or an adjacent minimum space data set of the face feature vector in the database through the index vector and the offset vector, and taking the obtained minimum space data set as a face similarity set of the face feature vector.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a face image, and performing feature extraction on the face image to obtain a face feature vector; generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of a plurality of basis vectors, and the basis vectors have discrimination with the face feature vectors in the database; searching a face similarity set of the face feature vector in a database according to the index vector and the offset vector; and acquiring the face with the maximum matching degree with the face image in the face similarity set as a face image retrieval result.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A face image retrieval method is characterized by comprising the following steps:
acquiring a face image, and extracting the features of the face image to obtain a corresponding face feature vector;
generating an index vector and an offset vector corresponding to the face feature vector through a basis vector matrix, wherein the basis vector matrix is composed of a plurality of basis vectors, the basis vectors have discrimination with the face feature vectors in a database, and the database stores a large number of face feature vectors of the face image; the index vector is a pointer pointing to a data value stored at a designated position in the database and is used for indicating a corresponding area of all the face feature vectors in the database on a high-dimensional space; the offset vector is used for determining whether to search a space corresponding to the critical position during searching;
searching a database according to the index vector and the offset vector to obtain a face similarity set corresponding to the face feature vector;
and acquiring the face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
2. The method of claim 1, wherein the generating the index vector and the offset vector corresponding to the face feature vector through the basis vector matrix comprises:
comparing the human face feature vector with a basis vector in a basis vector matrix of a corresponding dimension to obtain the similarity between the human face feature vector and the basis vector of the corresponding dimension;
and determining an index vector and an offset vector corresponding to the face feature vector according to the interval of the similarity on the basis vector.
3. The method of claim 1, wherein the basis vector matrix is generated by:
acquiring sample data from the database;
acquiring a preset alternative matrix set, wherein the alternative matrix set comprises a plurality of preset vectors, and selecting a preset number of vectors from the alternative matrix set as candidate base vector vectors;
substituting the sample data into the candidate base vector to obtain a first similarity distribution of the candidate base vector on the sample data;
obtaining candidate base vector vectors with discrimination with the sample data according to the first similarity distribution as base vector vectors;
and generating a basis vector matrix according to the plurality of basis vectors.
4. The method according to claim 3, wherein said obtaining candidate basis vector vectors having a region distribution with the sample data according to the first similarity distribution comprises:
re-acquiring sample data, and substituting the re-acquired sample data into the candidate basis vector to obtain a second similarity distribution of the candidate basis vector;
and acquiring a candidate base vector corresponding to a second similarity distribution of which the deviation value with the first similarity distribution does not exceed a preset value as a base vector.
5. The method of claim 3, further comprising:
and when the quantity change of the face feature vectors in the database exceeds a preset value, generating the basis vector matrix.
6. The method according to claim 1, wherein the searching in the database according to the index vector and the offset vector to obtain the face similarity set corresponding to the face feature vector comprises:
determining a corresponding minimum space data set or an adjacent minimum space data set of the face feature vector in the database through the index vector and the offset vector;
and acquiring a face similarity set corresponding to the face feature vector according to the minimum space data set.
7. A face image retrieval apparatus, characterized in that the apparatus comprises:
the face feature extraction module is used for extracting features of the obtained face image to obtain a corresponding face feature vector;
the characteristic vector processing module is used for generating an index vector and an offset vector corresponding to the human face characteristic vector through a basis vector matrix, wherein the basis vector matrix is formed by basis vectors, the basis vectors have a distinguishing degree with sample data in a database, and the database stores a large number of human face characteristic vectors of human face images; the index vector is a pointer pointing to a data value stored at a designated position in the database and is used for indicating a corresponding area of all the face feature vectors in the database on a high-dimensional space; the offset vector is used for determining whether to search a space corresponding to the critical position during searching;
and the face image searching module is used for searching in a database according to the index vector and the offset vector to obtain a face similarity set of the face feature vector, and acquiring a face with the maximum matching degree with the face image in the face similarity set as a retrieval result of the face image.
8. The apparatus of claim 7, further comprising:
the vector matrix generating module of basis vector, is used for obtaining the sample data from the said database;
acquiring a preset alternative matrix set, wherein the alternative matrix set comprises a plurality of preset vectors;
selecting a preset number of vectors from the candidate matrix set as candidate base vector vectors;
substituting the sample data into the candidate base vector to obtain a first similarity distribution of the candidate base vector on the sample data;
obtaining candidate base vector vectors with discrimination with the sample data according to the first similarity distribution as base vector vectors;
and generating a basis vector matrix according to the plurality of basis vectors.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810693522.2A CN108932321B (en) | 2018-06-29 | 2018-06-29 | Face image retrieval method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810693522.2A CN108932321B (en) | 2018-06-29 | 2018-06-29 | Face image retrieval method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108932321A CN108932321A (en) | 2018-12-04 |
CN108932321B true CN108932321B (en) | 2020-10-23 |
Family
ID=64446605
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810693522.2A Active CN108932321B (en) | 2018-06-29 | 2018-06-29 | Face image retrieval method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108932321B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109711473A (en) * | 2018-12-29 | 2019-05-03 | 北京沃东天骏信息技术有限公司 | Item identification method, equipment and system |
CN110458002B (en) * | 2019-06-28 | 2023-06-23 | 天津大学 | Lightweight rapid face recognition method |
CN110874419B (en) * | 2019-11-19 | 2022-03-29 | 山东浪潮科学研究院有限公司 | Quick retrieval technology for face database |
CN110941730B (en) * | 2019-11-29 | 2020-12-08 | 南京甄视智能科技有限公司 | Retrieval method and device based on human face feature data migration |
CN111709303A (en) * | 2020-05-21 | 2020-09-25 | 北京明略软件系统有限公司 | Face image recognition method and device |
CN112115281A (en) * | 2020-09-17 | 2020-12-22 | 杭州海康威视数字技术股份有限公司 | Data retrieval method, device and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106503686A (en) * | 2016-10-28 | 2017-03-15 | 广州炒米信息科技有限公司 | The method and system of retrieval facial image |
CN106909870A (en) * | 2015-12-22 | 2017-06-30 | 中兴通讯股份有限公司 | The search method and device of facial image |
CN108170732A (en) * | 2017-12-14 | 2018-06-15 | 厦门市美亚柏科信息股份有限公司 | Face picture search method and computer readable storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR100442834B1 (en) * | 2002-07-19 | 2004-08-02 | 삼성전자주식회사 | Method and system for face detecting using classifier learned decision boundary with face/near-face images |
US9405965B2 (en) * | 2014-11-07 | 2016-08-02 | Noblis, Inc. | Vector-based face recognition algorithm and image search system |
US10482336B2 (en) * | 2016-10-07 | 2019-11-19 | Noblis, Inc. | Face recognition and image search system using sparse feature vectors, compact binary vectors, and sub-linear search |
-
2018
- 2018-06-29 CN CN201810693522.2A patent/CN108932321B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106909870A (en) * | 2015-12-22 | 2017-06-30 | 中兴通讯股份有限公司 | The search method and device of facial image |
CN106503686A (en) * | 2016-10-28 | 2017-03-15 | 广州炒米信息科技有限公司 | The method and system of retrieval facial image |
CN108170732A (en) * | 2017-12-14 | 2018-06-15 | 厦门市美亚柏科信息股份有限公司 | Face picture search method and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN108932321A (en) | 2018-12-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108932321B (en) | Face image retrieval method and device, computer equipment and storage medium | |
CN110490078B (en) | Monitoring video processing method, device, computer equipment and storage medium | |
CN110689038A (en) | Training method and device of neural network model and medical image processing system | |
CN111160275B (en) | Pedestrian re-recognition model training method, device, computer equipment and storage medium | |
CN112906483B (en) | Target re-identification method, device and computer readable storage medium | |
CN106780639B (en) | Hash coding method based on significance characteristic sparse embedding and extreme learning machine | |
CN110555164B (en) | Method, device, computer equipment and storage medium for generating group interest labels | |
CN110046577B (en) | Pedestrian attribute prediction method, device, computer equipment and storage medium | |
CN111898682B (en) | Method and device for correcting new model based on multiple source models and computer equipment | |
CN112926616B (en) | Image matching method and device, electronic equipment and computer readable storage medium | |
CN112818821B (en) | Human face acquisition source detection method and device based on visible light and infrared light | |
CN112101156B (en) | Target identification method and device and electronic equipment | |
CN111177436A (en) | Face feature retrieval method, device and equipment | |
CN114119460A (en) | Semiconductor image defect identification method, semiconductor image defect identification device, computer equipment and storage medium | |
CN114565955B (en) | Face attribute identification model training, community personnel monitoring method, device and equipment | |
CN115422479A (en) | Track association method and device, electronic equipment and machine-readable storage medium | |
CN114332556A (en) | Training sample screening method and device, computer equipment and storage medium | |
CN111414952A (en) | Noise sample identification method, device, equipment and storage medium for pedestrian re-identification | |
CN113963221B (en) | Image clustering method and device, computer equipment and readable storage medium | |
CN111160077A (en) | Large-scale dynamic face clustering method | |
CN112364714B (en) | Face recognition method, device, computer equipment and storage medium | |
US20230012137A1 (en) | Pedestrian search method, server, and storage medium | |
CN111680175B (en) | Face database construction method, computer equipment and computer readable storage medium | |
CN114220045A (en) | Object recognition method, device and computer-readable storage medium | |
CN113284165A (en) | Target tracking method and device, computer equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |