WO2019119505A1 - Face recognition method and device, computer device and storage medium - Google Patents

Face recognition method and device, computer device and storage medium Download PDF

Info

Publication number
WO2019119505A1
WO2019119505A1 PCT/CN2017/119465 CN2017119465W WO2019119505A1 WO 2019119505 A1 WO2019119505 A1 WO 2019119505A1 CN 2017119465 W CN2017119465 W CN 2017119465W WO 2019119505 A1 WO2019119505 A1 WO 2019119505A1
Authority
WO
WIPO (PCT)
Prior art keywords
face image
feature vector
preset
samples
face
Prior art date
Application number
PCT/CN2017/119465
Other languages
French (fr)
Chinese (zh)
Inventor
严蕤
牟永强
Original Assignee
深圳云天励飞技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 深圳云天励飞技术有限公司 filed Critical 深圳云天励飞技术有限公司
Publication of WO2019119505A1 publication Critical patent/WO2019119505A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features

Definitions

  • the invention belongs to the field of image processing, and in particular relates to a method and device for face recognition, a computer device and a storage medium.
  • Face recognition is a biometric technology based on human facial feature information for identification. It is widely used in the fields of identity verification, security monitoring, access control and attendance systems, and judicial criminal investigation. Face recognition mainly includes processes such as face detection, face alignment, face feature extraction, and face similarity determination. Among them, the determination of face similarity is an important part of face recognition, which can directly affect the result of face recognition.
  • the existing methods for determining face similarity mainly include: (1) a method for determining face similarity based on distance, such as Euclidean distance, cosine distance or Mahalanobis distance, but the method is ineffective, It is difficult to distinguish samples that are closer in feature space distribution.
  • a method of determining face similarity based on classification such as a classification method of a support vector machine.
  • the model complexity of the method increases with the increase of training data, resulting in large computational complexity and low computational efficiency, which leads to poor performance and low efficiency of subsequent face recognition.
  • the existing method of face recognition has a problem of poor effect and low efficiency.
  • the invention provides a method and device for face recognition, a computer device and a storage medium, and aims to solve the problem that the existing face recognition method has poor effect and low efficiency.
  • a first aspect of the present invention provides a method for face recognition, the method comprising:
  • the face image to be recognized is identified by using the trained regression model.
  • the acquiring the fused feature vector of the any two samples includes:
  • the preset training set includes a category identifier corresponding to the sample, and the reference similarity for acquiring the any two samples includes:
  • the reference similarity of the two samples is the sum of the cosine distance and the preset constant
  • the reference similarity of the two samples is the difference between the cosine distance and the preset constant.
  • the regression model is determined according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training model, and the regression model after the training is determined to include:
  • the regression model includes at least a first fully connected layer and a second fully connected a layer, and the first fully connected layer and the second fully connected layer respectively perform feature mapping transformation on the any of the fusion feature vectors by using an activation function;
  • the parameter of the first fully connected layer and the parameter of the second fully connected layer of the regression model are adjusted by a process of back propagation using a random gradient descent;
  • the above iterative process is repeated until the error satisfies the preset convergence condition, and the parameters of the first fully connected layer and the parameters of the second fully connected layer of the last iterative process before the preset convergence condition are used as the first full regression model
  • the parameters of the connection layer and the parameters of the second fully connected layer determine the regression model after training.
  • the preset convergence condition includes:
  • the error is less than or equal to a preset error threshold or the error percentage corresponding to the error is less than or equal to a preset error percentage.
  • the using the trained regression model to identify the face image to be recognized includes:
  • first face image and the second face image are not the same person's face image .
  • the using the trained regression model to identify the face image to be recognized includes:
  • the method further includes:
  • the face images included in the preset search database are arranged in descending order of cosine distance, and the face images ranked in the top N are used as candidate sets, where N is a positive integer;
  • the fusion feature vector for determining the feature vector of the target face image and the feature vector of each face image included in the preset search database respectively includes:
  • the similarity between the face picture and each face picture included in the preset search database includes:
  • the arranged face images as search results include:
  • a second aspect of the present invention provides a device for recognizing a face, the device comprising:
  • a feature vector extraction module configured to extract feature vectors of any two samples in the preset training set according to the preset facial feature extraction model
  • a normalization module configured to respectively normalize feature vectors of any two samples
  • a fusion feature vector acquisition module configured to acquire a fusion feature vector of any two samples
  • a similarity obtaining module configured to acquire a reference similarity of the any two samples
  • a traversing acquisition module configured to sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set;
  • a training module configured to determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model;
  • the identification module is configured to identify the face image to be recognized by using the trained regression model.
  • a third aspect of the present invention provides a computer apparatus, comprising: a processor, wherein the processor is configured to implement a method of face recognition according to any of the above embodiments when executing a computer program stored in a memory.
  • a fourth aspect of the present invention provides a computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor to implement the method for face recognition according to any of the above embodiments.
  • the feature vectors of two mutually different samples in the preset training set are fused, and the regression model after training is determined according to the fusion feature vectors of the two samples that are different from each other and the reference similarity training regression model. model.
  • the fusion feature vector includes the texture feature and the dynamic mode feature of the face image. Therefore, the trained regression model can effectively distinguish the samples of different category markers, and use the trained regression model to identify the face image to be recognized. Can effectively improve the effect and accuracy of face recognition.
  • FIG. 1 is a flowchart of an implementation of a method for face recognition according to an embodiment of the present invention
  • step S106 is a flowchart of implementing step S106 in the method for face recognition according to an embodiment of the present invention
  • step S107 in the method for face recognition according to an embodiment of the present invention
  • step S107 is a flowchart of another implementation of step S107 in the method for face recognition according to the embodiment of the present invention.
  • FIG. 5 is a flowchart of still another implementation of step S107 in the method for face recognition according to the embodiment of the present invention.
  • FIG. 6 is a functional block diagram of a device for face recognition according to an embodiment of the present invention.
  • FIG. 7 is a structural block diagram of a training module 106 in a device for face recognition according to an embodiment of the present invention.
  • FIG. 8 is a structural block diagram of an identification module 107 in a device for recognizing a face according to an embodiment of the present invention.
  • FIG. 9 is a block diagram showing another structure of the identification module 107 in the device for recognizing a face according to an embodiment of the present invention.
  • FIG. 10 is a block diagram showing another structure of the identification module 107 in the device for recognizing a face according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a computer apparatus according to an embodiment of the present invention.
  • FIG. 1 shows an implementation flow of a method for face recognition according to an embodiment of the present invention.
  • the order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted.
  • the parts related to the embodiment of the present invention are shown, which are detailed as follows:
  • a method for face recognition includes:
  • Step S101 Extract feature vectors of any two samples in the preset training set according to the preset facial feature extraction model.
  • the preset facial feature extraction model is a pre-trained facial feature extraction model. Specifically, a large number of facial images can be used to learn facial feature extraction through convolutional neural network, and the trained facial feature extraction is established. Model, no longer detailed here.
  • the preset training set is a preset training set containing a large number of face images, and can be set. It is assumed that the preset training set includes M samples (ie, a face picture) and a category mark corresponding to the sample, where M is a positive integer greater than 1.
  • M is a positive integer greater than 1.
  • the category mark of the sample is based on whether the sample belongs to the same person's pre-set category mark. If two samples are the face image of the same person, the two samples belonging to the same person are one category mark, if the two samples are different people For face images, two samples that are not the same person are marked with different categories, and one category label may correspond to one or more samples.
  • any two samples include a first sample and a second sample, and the first sample and the second sample are different two samples, and the first sample and The second sample is described as an example.
  • x d ) and y (y 1 , y 2 , y 3 ... y d-3 , y d-2 , y d )
  • the class label of the first sample and the class label of the second sample are z i and z, respectively j .
  • the value of d is a dimension of the feature vector, and is a positive integer greater than 1. Specifically, it may be set when the preset facial feature extraction model is trained, and is not particularly limited herein.
  • Step S102 normalizing the feature vectors of the arbitrary two samples respectively.
  • the normalized processing is performed, and the elements of the normalized feature vector are The ratio of the elements of the corresponding dimension to the modulus length of the feature vector.
  • Step S103 Acquire a fusion feature vector of any two samples.
  • the eigenvector of the normalized first sample and the normalized second The feature vectors of the samples are fused to obtain a fused feature vector of the first sample and the second sample.
  • step S103 acquiring the fusion feature vector of the any two samples includes:
  • Step S104 Acquire a reference similarity of any two samples.
  • the reference similarity of the first sample and the second sample may be obtained according to the normalized first sample's feature vector and the normalized second sample's feature vector.
  • step S104 obtaining the reference similarity of the any two samples includes:
  • a cosine distance of the normalized first sample eigenvector and the normalized second sample eigenvector is determined.
  • x i ⁇ y j represents the dot product of the feature vector x i and the feature vector y j
  • 2 represent the two vectors of the feature vector x i and the feature vector y j , respectively
  • the number, the two-norm of the vector, refers to the sum of the square roots of the elements in the vector and the root number.
  • the cosine distance also known as the cosine similarity, is the magnitude of the difference between two individuals using the cosine of the two vectors in the vector space, which can be used to characterize the first sample and the second sample. Similarity.
  • the range of the cosine distance is [-1, +1], and the closer the distance is to 1, the closer the two vectors are to the same direction, that is, the positive correlation; the closer the distance is to -1, the more the direction of the two vectors Close to the opposite, that is, a negative correlation.
  • the reference similarity of the two samples is the sum of the cosine distance and the preset constant.
  • the degree is the sum of the cosine distance and a preset constant.
  • the preset constant is a preset constant. In a preferred embodiment, the preset constant is 0.5.
  • n cos(x i , y j )+ ⁇ .
  • the reference similarity of the two samples is the difference between the cosine distance and the preset constant.
  • the reference of the first sample and the second sample is similar
  • the degree is the difference between the cosine distance and the preset constant.
  • n cos(x i , y j ) ⁇ .
  • Step S105 sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set.
  • the steps S101 to S104 are repeated to obtain the fusion features of all the two samples that are different from each other in the preset training set.
  • the vector and the reference similarity, the two samples that are different from each other means that the two samples are different samples.
  • the preset training set includes M samples, and each time two arbitrary samples are extracted from the preset training set until M*(M-1)/2 times are repeated, and the preset training set is completed.
  • the extraction of any two mutually different samples, that is, repeating M*(M-1)/2 times steps S101 to S104 the fusion feature vectors of all the two samples different from each other in the preset training set can be obtained.
  • the reference similarity, and the obtained fusion feature vector and reference similarity of the two samples which are different from each other are used as the data of the training regression model. At this point, the construction of the regression model training data is completed, and the regression model is trained later. .
  • Step S106 Determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model.
  • the fused feature vector and the reference similarity of all the two different samples in the preset training set can be utilized.
  • the regression model is trained, and after the training is terminated, the regression model after training is determined.
  • Step S107 using the trained regression model to identify the face image to be recognized.
  • the trained regression model can be used to identify the face image to be recognized.
  • the recognition of the face image to be recognized mainly includes face verification and face retrieval.
  • the face verification determines whether the two face images to be verified are face images of the same person, and the face search is based on the target face.
  • the image is retrieved in the face database and the face image of the target face is the same person or the face image with the similarity of the target face image.
  • the feature vectors of all the two samples that are different from each other in the preset training set are merged, and the regression model is trained according to the fusion feature vectors of the two samples and the reference similarity training model to determine the training.
  • the fusion feature vector includes the texture feature and the dynamic mode feature of the face image. Therefore, the trained regression model can effectively distinguish the samples of different category markers, and use the trained regression model to identify the face image to be recognized. Can effectively improve the effect and accuracy of face recognition.
  • FIG. 2 shows an implementation flow of step S106 in the method for face recognition according to the embodiment of the present invention.
  • the order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted.
  • the parts related to the embodiment of the present invention are shown, which are detailed as follows:
  • step S106 according to the fusion feature vectors of the two samples that are different from each other in the preset training set.
  • the regression model is trained with the reference similarity, and the regression model after the training is determined to include:
  • Step S1061 Acquire any fusion feature vector of the preset training set.
  • any fusion feature vector of the preset training set is first acquired, and the fusion is performed.
  • the feature vector is any one of the fusion feature vectors of the two different samples of the mutually different samples in the preset training set.
  • Step S1062 Input any of the fusion feature vectors into a regression model to obtain training similarity of two samples corresponding to any of the fusion feature vectors, wherein the regression model includes at least a first fully connected layer and a first The second fully connected layer, and the first fully connected layer and the second fully connected layer respectively perform feature mapping transformation on the any of the merged feature vectors by using an activation function.
  • the regression model includes at least a first fully connected layer and a second fully connected layer, and the first fully connected layer and the second fully connected layer both use an activation function for any of the fusions
  • the feature vector is used for feature map transformation.
  • the first full connection Both the layer and the second fully connected layer perform feature mapping transformation on any of the fusion feature vectors using a Relu activation function.
  • the first fully connected layer and the second fully connected layer may also adopt a variant function with a Relu activation function, such as a Leaky-Relu activation function or a P-Relu (English full name: Parametric-Relu) activation function or R-Relu. (English full name: Randomizied Relu) activation function and so on.
  • a Relu activation function such as a Leaky-Relu activation function or a P-Relu (English full name: Parametric-Relu) activation function or R-Relu. (English full name: Randomizied Relu) activation function and so on.
  • Step S1063 Determine, by using the loss function, an error of the similarity between the training similarity of the two samples corresponding to the any fusion feature vector and the reference similarity of the two samples corresponding to the any fusion feature vector.
  • the loss function may be used to determine any of the fusion features.
  • the L2 loss function is used to determine the training similarity of the two samples corresponding to any one of the fusion feature vectors and the reference similarity of the two samples corresponding to the any of the fusion feature vectors.
  • Error, wherein the L2 loss (English name: Squared hinge loss, L2 loss for short) function is used to evaluate the degree of inconsistency between the predicted value and the true value.
  • the L2 loss function is used to evaluate the training similarity. The degree of inconsistency with the reference similarity.
  • step S1064 is performed, and the parameter of the first fully connected layer of the regression model and the second fully connected layer are adjusted by a process of backpropagation by using a random gradient descent parameter.
  • the preset convergence condition is a pre-set convergence condition.
  • the preset convergence condition includes: The error is less than or equal to the preset error threshold or the error percentage corresponding to the error is less than or equal to the preset error percentage.
  • the preset error threshold and the preset error percentage are preset error thresholds, and are not particularly limited herein.
  • the stochastic gradient descent is mainly used to perform weight update in the neural network model, and the parameters of the model are updated and adjusted in one direction to minimize the loss function.
  • the stochastic gradient descent randomly selects one sample from the training set at a time (in the embodiment of the present invention) In the middle, it refers to the fusion feature vector) to learn.
  • Backpropagation is to calculate the product of the input signal and its corresponding weight in the forward propagation, then apply the activation function to the sum of these products, and then return the relevant error in the back propagation of the network model, using a random gradient.
  • the update weight value is decreased, and the weight parameter is updated in the opposite direction of the loss function gradient by calculating the gradient of the error function with respect to the weight parameter.
  • the parameters of the first fully connected layer and the second full of the regression model are adjusted by a process of backpropagation by using a random gradient descent.
  • the parameters of the connection layer are adjusted by a process of backpropagation by using a random gradient descent.
  • step S1061 After adjusting the parameters of the first fully connected layer and the parameters of the second fully connected layer, the process goes to step S1061, and steps S1061 to S1063 are repeatedly performed until the error satisfies a preset convergence condition.
  • step S1065 is performed, and the parameters of the first fully connected layer and the parameter of the second fully connected layer of the last iteration process before the preset convergence condition are used as the first full of the regression model.
  • the parameters of the connection layer and the parameters of the second fully connected layer determine the regression model after training.
  • the training regression model is stopped, and the parameters of the first fully connected layer and the parameters of the second fully connected layer of the last iterative process before the preset convergence condition are used as the regression model.
  • the parameters of the first fully connected layer and the parameters of the second fully connected layer determine the regression model after training, and thus the training of the regression model is completed.
  • the fusion feature vector of the preset training set includes the texture feature and the dynamic mode feature of the face image
  • the regression model is trained by using the fusion feature vector of the preset training set, and the random gradient is used to Adjusting the parameters of the regression model to the process of propagation, and determining the regression model after training, therefore, the trained regression model can effectively distinguish samples of different categories of markers, and use the trained regression model to treat the recognized face images When the recognition is performed, the effect and accuracy of face recognition can be effectively improved.
  • FIG. 3 shows an implementation flow of step S107 in the method for face recognition according to the embodiment of the present invention.
  • the order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted.
  • the parts related to the embodiment of the present invention are shown, which are detailed as follows:
  • step S107 includes:
  • Step S201 Acquire a fusion feature vector of the first face image and the second face image to be verified.
  • the fusion feature vector of the first face image and the second face image is extracted, and the specific extraction method and the foregoing extraction are performed.
  • the method for fusing the feature vector of the first sample and the second sample is the same, that is, the feature vector of the first face image and the second face image is first extracted according to the preset face feature extraction model, and then the first face is extracted.
  • the feature vector of the picture and the second face image is normalized, and finally the fusion feature vector of the first face image and the second face image is obtained.
  • Step S202 input a fusion feature vector of the first face image and the second face image to the trained regression model, and acquire the first face image and the second face image. Similarity.
  • step S1062 When the similarity between the first face image and the second face image is obtained by using the trained regression model according to the fusion feature vector of the first face image and the second face image, The content of the above step S1062 can be referred to, and details are not described herein again.
  • step S203 is performed to determine that the first face image and the second face image are The face image of the same person.
  • the preset similarity threshold is a preset similarity, and is not particularly limited herein.
  • the similarity between the first face image and the second face image is greater than or equal to a preset similarity threshold, the first face image and the second face image may be determined to be the same person. Face picture.
  • step S204 is performed to determine that the first face image and the second face image are not the same person. Face picture.
  • the trained regression model can effectively distinguish the face images of different categories of markers, and use the trained regression model to verify the first face image and the second face image to be identified, which can effectively determine the first The similarity between the face image and the second face image, thereby determining whether the first face image and the second face image are face images of the same person, and thus, the face recognition can be further improved. Performance and accuracy.
  • FIG. 4 shows another implementation flow of step S107 in the method for face recognition according to the embodiment of the present invention.
  • the order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted.
  • the parts related to the embodiment of the present invention are shown, which are detailed as follows:
  • step S107 includes:
  • Step S301 Acquire a target face image to be retrieved.
  • the target face image to be retrieved may be acquired by an image acquisition device, such as a camera or a camera, or the target face image to be retrieved may be obtained through a network, where the target face image to be retrieved is obtained.
  • the route is not subject to special restrictions.
  • Step S302 Extract the feature vector of the target face image and the feature vector of the face image included in the preset search database by using the preset face feature extraction model.
  • the preset retrieval database is a preset retrieval database, which includes a large number of face images. For details, refer to the content of step S101 above, and details are not described herein again.
  • step S107 further includes: separately performing a feature vector of the target face image and a face image included in the preset search database.
  • the feature vector is normalized.
  • step S102 For the normalization process of the feature vector, the content of the above step S102 can be specifically referred to, and details are not described herein again.
  • Step S303 respectively determining a feature vector of the target face image and a feature vector of the feature vector of each face image included in the preset search database.
  • step S103 when the feature vector of the target face image and the feature vector of the feature vector of each face image included in the preset search database are determined, the content of step S103 may be specifically referred to, and details are not described herein again.
  • Step S304 respectively input a feature vector of the target face image and a feature vector of a feature vector of each face image included in the preset search database to the trained regression model, and acquire the target.
  • step S1062 When the similarity between the target face image and each face image included in the preset search database is obtained, the content of step S1062 may be specifically referred to, and details are not described herein again.
  • Step S305 arranging, according to the similarity between the target face image and each face image included in the preset search database, each face image included in the preset search database.
  • the arranged face images are used as search results.
  • each face image included in the preset search database may be arranged in descending order according to the similarity between the target face image and each face image included in the preset search database.
  • the arranged face image is used as a retrieval result to return the retrieval result, for example, displayed on the display screen.
  • the image is identified by using the fusion feature vector and the trained regression model, and the similarity of each face image included in the target face image and the preset retrieval database is from large to small.
  • the order of each face image included in the preset search database is arranged, and the arranged face image is used as a retrieval result, which can improve the accuracy of face retrieval, thereby improving the effect and accuracy of face recognition. .
  • FIG. 5 shows still another implementation flow of step S107 in the method for face recognition according to the embodiment of the present invention.
  • the order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted.
  • the parts related to the embodiment of the present invention are shown, which are detailed as follows:
  • step S107 further includes:
  • Step S306 respectively determining a cosine distance of the feature vector of the target face image and the feature vector of each face image included in the preset search database.
  • the target face picture may be first determined. And a cosine distance of the feature vector and the feature vector of each face image included in the preset retrieval database, to initially represent the similarity between the target face image and each face image included in the preset search database degree.
  • step S104 For determining the cosine distance of the feature vector of the target face image and the feature vector of each face image included in the preset search database, refer to the determining the normalized first sample in step S104.
  • the method of the feature vector and the cosine distance of the feature vector of the second sample will not be described in detail herein.
  • Step S307 the face images included in the preset search database are arranged in descending order of cosine distance, and the face images ranked in the top N are used as candidate sets, where N is a positive integer.
  • the preset search may be performed according to the cosine distance from the largest to the smallest.
  • the face images included in the database are arranged, and the top N face images are used as candidate sets, so as to narrow the search range, reduce the calculation amount of face search and subsequent face recognition, and improve face search and follow-up persons.
  • the positive integer N can be set.
  • the positive integer N is 100, that is, a face image ranked in the top 100 is used as a candidate set, so as to subsequently determine the target face.
  • the similarity between the picture and the 100 face pictures in the candidate set is 100, that is, a face image ranked in the top 100 is used as a candidate set, so as to subsequently determine the target face.
  • step S303 the determining a fusion feature vector of the feature vector of the target face image and the feature vector of each face image included in the preset retrieval database respectively includes:
  • Step S3031 respectively determine a feature vector of the target face image and a feature vector of the feature vector of each face image included in the candidate set.
  • the fusion feature vector of the feature vector of the target face image and the feature vector of each face image included in the candidate set may be determined. For details, refer to the content of step S303 above, and details are not described herein again.
  • step S304 the feature vector of the target face image and the feature vector of the feature vector of each face image included in the preset search database are respectively input to the trained regression model. And acquiring the similarity between the target face image and each face image included in the preset search database includes:
  • Step S3041 respectively input a feature vector of the target face image and a feature vector of a feature vector of each face image included in the candidate set to the trained regression model, and acquire the target face. The similarity of the picture and each face picture included in the candidate set.
  • step S304 the content of the above step S304 can be referred to in step S3041, and details are not described herein again.
  • step S305 the face included in the preset search database is in descending order of the similarity of each face image included in the target face picture and the preset search database.
  • the images are arranged and the arranged face images are included as search results:
  • Step S3051 Arrange the face images included in the candidate set in descending order of the similarity between the target face picture and each face picture included in the candidate set, and arrange the arranged faces.
  • the face image is used as a search result.
  • step S305 the content of step S305 can be referred to in step S3051, and details are not described herein again.
  • the face images included in the preset search database are arranged, and the face images ranked in the top N are used as candidate sets, and then the target face images are similar to each face image included in the candidate set.
  • the face images included in the candidate set are arranged in descending order, and the arranged face images are used as search results.
  • the cosine distance can preliminarily characterize the similarity between the pictures, by calculating the cosine distance, the plurality of face pictures ranked in the forefront most similar to the target face picture are first screened out as a candidate set for subsequent retrieval, therefore, The scope of the search can be narrowed, the retrieval speed can be improved, and the efficiency of face recognition can be improved.
  • FIG. 6 is a functional block diagram of a device for face recognition according to an embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
  • each module included in the apparatus 10 for face recognition is used to perform various steps in the corresponding embodiment of FIG. 1 .
  • the device 10 for face recognition includes a feature vector extraction module 101, a normalization module 102, a fusion feature vector acquisition module 103, a reference similarity acquisition module 104, a traversal acquisition module 105, a training module 106, and Identification module 107.
  • the feature vector extraction module 101 is configured to extract feature vectors of any two samples in the preset training set according to the preset face feature extraction model.
  • the normalization module 102 is configured to normalize the feature vectors of the any two samples separately.
  • the fusion feature vector obtaining module 103 is configured to acquire a fusion feature vector of the arbitrary two samples.
  • the reference similarity obtaining module 104 is configured to obtain a reference similarity of the any two samples.
  • the traversal obtaining module 105 is configured to sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set.
  • the training module 106 is configured to determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model.
  • the identification module 107 is configured to identify the face image to be recognized by using the trained regression model.
  • the fused feature vector obtaining module 103 fuses feature vectors of two samples that are different from each other in the preset training set, and the training module 106 combines the eigenvectors of the two samples that are different from each other and the reference similarity.
  • the regression model is trained to determine the regression model after training.
  • the fusion feature vector includes the texture feature and the dynamic mode feature of the face image. Therefore, the trained regression model can effectively distinguish the samples of different category markers, and use the trained regression model to identify the face image to be recognized. Can effectively improve the effect and accuracy of face recognition.
  • the fusion feature vector obtaining module 103 is specifically configured to:
  • FIG. 7 shows the structure of the training module 106 in the device for face recognition according to the embodiment of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are as follows:
  • each unit included in the training module 106 is used to perform various steps in the corresponding embodiment of FIG. 2.
  • the training module 106 includes a first obtaining unit 1061, a second obtaining unit 1062, an error determining unit 1063, a parameter adjusting unit 1064, and a regression model determining unit 1065.
  • the first acquiring unit 1061 is configured to acquire any fusion feature vector of the preset training set.
  • the second obtaining unit 1062 is configured to input any of the fusion feature vectors to a regression model, and obtain training similarity of two samples corresponding to any of the fusion feature vectors, wherein the regression model includes at least a first fully connected layer and a second fully connected layer, and the first fully connected layer and the second fully connected layer both perform feature mapping transformation on the any of the merged feature vectors by using an activation function.
  • the error determining unit 1063 is configured to determine, by using the loss function, an error of the similarity between the training similarity of the two samples corresponding to the any of the fusion feature vectors and the reference similarity of the two samples corresponding to the any of the fusion feature vectors. .
  • the parameter adjustment unit 1064 is configured to adjust a parameter of the first fully connected layer of the regression model and the first step by using a process of back propagation by using a random gradient descent if the error does not satisfy a preset convergence condition.
  • the parameters of the two fully connected layers are configured to adjust a parameter of the first fully connected layer of the regression model and the first step by using a process of back propagation by using a random gradient descent if the error does not satisfy a preset convergence condition.
  • the regression model determining unit 1065 is configured to: when the error satisfies a preset convergence condition, use a parameter of the first fully connected layer and a parameter of the second fully connected layer that meet the last iteration process before the preset convergence condition The parameters of the first fully connected layer of the regression model and the parameters of the second fully connected layer are determined to determine the regression model after training.
  • the preset convergence condition includes:
  • the error is less than or equal to a preset error threshold or the error percentage corresponding to the error is less than or equal to a preset error percentage.
  • the fusion feature vector of the preset training set includes the texture feature and the dynamic mode feature of the face image
  • the regression model is trained by using the fusion feature vector of the preset training set, and the random gradient is used to Adjusting the parameters of the regression model to the process of propagation, and determining the regression model after training, therefore, the trained regression model can effectively distinguish samples of different categories of markers, and use the trained regression model to treat the recognized face images When the recognition is performed, the effect and accuracy of face recognition can be effectively improved.
  • FIG. 8 shows the structure of the identification module 107 in the device for face recognition according to the embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
  • each unit included in the identification module 107 is used to perform various steps in the corresponding embodiment of FIG. 3.
  • the identification module 107 includes a fusion feature vector acquisition unit 201, a first similarity acquisition unit 202, and a determination unit 203.
  • the fused feature vector obtaining unit 201 is configured to acquire a fused feature vector of the first face image and the second face image to be verified.
  • the first similarity obtaining unit 202 is configured to input the fusion feature vector of the first facial image and the second facial image to the trained regression model to obtain the first facial image. The similarity with the second face picture.
  • the determining unit 203 is configured to determine the first face image and the second if the similarity between the first face image and the second face image is greater than or equal to a preset similarity threshold
  • the face image is the face image of the same person.
  • the determining unit 203 is further configured to: if the similarity between the first face image and the second face image is less than a preset similarity threshold, determine the first face image and the second person The face image is not the face image of the same person.
  • the fusion feature vector obtaining unit 201 acquires a fusion feature vector of the first face image and the second face image to be verified, and the first similarity acquisition unit 202 is configured according to the fusion feature vector.
  • the determining unit 203 compares the similarity with a preset similarity threshold, and further determines the first face image and the location Whether the second face image is a face image of the same person.
  • the first similarity acquiring unit 202 determines the similarity between the first facial image and the second facial image according to the fusion feature vector
  • the determining unit 203 determines the first facial image and the location. Whether the second face image is a face image of the same person, therefore, the effect and accuracy of the face recognition can be further improved.
  • FIG. 9 shows another structure of the identification module 107 in the device for face recognition according to the embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
  • each unit included in the identification module 107 is used to perform various steps in the corresponding embodiment of FIG. 4.
  • the identification module 107 includes a target face image acquisition unit 301, a feature vector extraction unit 302, a fusion feature vector determination unit 303, a second similarity acquisition unit 304, and a retrieval result determination unit 305.
  • the target face image obtaining unit 301 is configured to acquire a target face image to be retrieved.
  • the feature vector extracting unit 302 is configured to separately extract a feature vector of the target face image and a feature vector of a face image included in the preset search database by using the preset face feature extraction model.
  • the fused feature vector determining unit 303 is configured to respectively determine a fused feature vector of the feature vector of the target face image and the feature vector of each face image included in the preset search database.
  • the second similarity obtaining unit 304 is configured to input the feature vector of the target face image and the feature vector of the feature vector of each face image included in the preset search database to the training Regression model, and obtain similarity between the target face image and each face image included in the preset search database.
  • the search result determining unit 305 is configured to select, according to the similarity between the target face image and each face image included in the preset search database, the preset search database Each face image is arranged, and the arranged face image is used as a search result.
  • the image is identified by using the fusion feature vector and the trained regression model, and the retrieval result determination unit 305 is similar to each face image included in the target face image and the preset retrieval database.
  • the face images included in the preset search database are arranged in descending order, and the arranged face images are used as search results. Therefore, the effect and accuracy of face recognition can be further improved.
  • FIG. 10 shows still another structure of the identification module 107 in the device for face recognition according to the embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
  • each unit or subunit included in the identification module 107 is used to perform various steps in the corresponding embodiment of FIG. 5.
  • the identification module 107 further includes a cosine distance determining unit 306 and a candidate set determining unit 307 on the basis of the structure shown in FIG. 9 .
  • the fusion feature vector determining unit 303 includes a fusion feature vector determining subunit 3031
  • the second similarity acquiring unit 304 includes a similarity acquiring subunit 3041
  • the retrieval result determining unit 305 includes a retrieval result determining subunit. 3051.
  • the cosine distance determining unit 306 is configured to respectively determine a cosine distance of a feature vector of the target face image and a feature vector of each face image included in the preset search database.
  • the candidate set determining unit 307 is configured to arrange the face images included in the preset search database according to the cosine distance from the largest to the smallest, and use the face images ranked in the top N as the candidate set.
  • N is a positive integer.
  • the fused feature vector determining sub-unit 3031 is configured to respectively determine a fused feature vector of a feature vector of the target face image and a feature vector of each face image included in the candidate set.
  • the similarity acquisition sub-unit 3041 is configured to respectively input a feature vector of the target face image and a feature vector of a feature vector of each face image included in the candidate set to the trained regression model. And acquiring the similarity of the target face picture and each face picture included in the candidate set.
  • the search result determining sub-unit 3051 is configured to select a face image included in the candidate set according to the similarity degree of the target face picture and each face picture included in the candidate set in descending order Arrange and arrange the arranged face images as the search results.
  • the cosine distance determining unit 306 determines a cosine distance of the feature vector of the target face image and a feature vector of each face image included in the preset search database, and the candidate set determining unit 307 follows the cosine distance.
  • the face images included in the preset search database are arranged in descending order, and the face images ranked in the top N are used as candidate sets, and the search result determining subunit 3051 follows the target face image.
  • FIG. 11 is a schematic structural diagram of a computer apparatus 1 according to a preferred embodiment of a method for implementing face recognition according to an embodiment of the present invention.
  • the computer device 1 includes a memory 11, a processor 12, and an input/output device 13.
  • the computer device 1 is a device capable of automatically performing numerical calculation and/or information processing according to an instruction set or stored in advance, and the hardware includes, but not limited to, a microprocessor, an application specific integrated circuit (ASIC). ), Field-Programmable Gate Array (FPGA), Digital Signal Processor (DSP), embedded devices, etc.
  • ASIC application specific integrated circuit
  • FPGA Field-Programmable Gate Array
  • DSP Digital Signal Processor
  • the computer device 1 can be any electronic product that can interact with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game machine, an interactive network television ( Internet Protocol Television (IPTV), smart wearable devices, etc.
  • the computer device 1 may be a server, including but not limited to a single network server, a server group composed of a plurality of network servers, or a cloud computing-based cloud composed of a large number of hosts or network servers, wherein the cloud Computation is a type of distributed computing, a super-virtual computer consisting of a cluster of loosely coupled computers.
  • the network in which the computer device 1 is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), and the like.
  • VPN virtual private network
  • the memory 11 is used to store programs of various methods of face recognition and various data, and realizes high-speed, automatic completion of access of programs or data during the operation of the computer device 1.
  • the memory 11 may be an external storage device and/or an internal storage device of the computer device 1. Further, the memory 11 may be a circuit having a storage function in a physical form, such as a RAM (Random-Access Memory), a FIFO (First In First Out), or the like, or the memory 11 It may be a storage device having a physical form, such as a memory stick, a TF card (Trans-flash Card), or the like.
  • the processor 12 can be a Central Processing Unit (CPU).
  • the CPU is a very large-scale integrated circuit, which is the computing core (Core) and the Control Unit of the computer device 1.
  • the processor 12 can execute an operating system of the computer device 1 and various installed applications, program codes, and the like, such as an operating system in each module or unit in the device 10 for performing face recognition, and various installed applications and programs. Code to implement face recognition methods.
  • the input/output device 13 is mainly used to implement an input/output function of the computer device 1, such as transceiving input digital or character information, or displaying information input by a user or information provided to a user and various menus of the computer device 1.
  • the modules/units integrated by the computer device 1 can be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the present invention implements all or part of the processes in the foregoing embodiments, and may also be completed by a computer program to instruct related hardware.
  • the computer program may be stored in a computer readable storage medium. The steps of the various method embodiments described above may be implemented when the program is executed by the processor.
  • the computer program comprises computer program code, which may be in the form of source code, object code form, executable file or some intermediate form.
  • the computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM). , random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
  • the above-described characteristic means of the present invention can be realized by an integrated circuit and control the function of the living body detecting method described in any of the above embodiments. That is, the integrated circuit of the present invention is mounted in the computer device 1 such that the computer device 1 functions as follows:
  • the face image to be recognized is identified by using the trained regression model.
  • the functions of the living body detecting method can be installed in the computer device 1 by the integrated circuit of the present invention, so that the computer device 1 can perform the living body detecting method in any of the embodiments.
  • the functions implemented are not detailed here.
  • modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software function modules.

Abstract

A face recognition method and device, a computer device and a storage medium. The method comprises: extracting feature vectors of any two samples in a preset training set according to a preset face feature extraction model (S101); normalizing the feature vectors of the any two samples respectively (S102); acquiring a fusion feature vector of the any two samples (S103); acquiring a reference similarity of the any two samples (S104); sequentially traversing every two samples that are different from each other in the preset training set, and obtaining the fusion feature vector and reference similarity of every two samples that are different from each other in the preset training set (S105); training a regression model according to the fusion feature vector and reference similarity of every two samples that are different from each other in the preset training set (S106); and recognizing a face picture to be recognized by using the trained regression model (S107). In the present invention, a regression model is trained according to all fusion feature vectors and reference similarities in the preset training set, the trained regression model may effectively distinguish samples having different category markers, and the effect and accuracy of face recognition when carrying out recognition on a face picture to be recognized is thus improved.

Description

人脸识别的方法和装置、计算机装置及存储介质Method and device for face recognition, computer device and storage medium
本申请要求于2017年12月18日提交中国专利局,申请号为201711366133.0,发明名称为“人脸识别的方法、装置及计算机装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201711366133.0, entitled "Face Recognition Method, Apparatus and Computer Device", filed on Dec. 18, 2017, the entire contents of In this application.
技术领域Technical field
本发明属于图像处理领域,尤其涉及一种人脸识别的方法和装置、计算机装置及存储介质。The invention belongs to the field of image processing, and in particular relates to a method and device for face recognition, a computer device and a storage medium.
背景技术Background technique
人脸识别是基于人的脸部特征信息进行身份识别的一种生物识别技术,其广泛应用于身份验证、安防监控、门禁考勤系统以及司法刑侦等领域。人脸识别主要包括人脸检测、人脸对齐、人脸特征提取以及人脸相似度的确定等过程。其中,人脸相似度的确定是人脸识别中的一个重要环节,其可以直接影响人脸识别的结果。目前,现有的确定人脸相似度的方法主要包括:(1)基于距离的确定人脸相似度的方法,如欧氏距离、余弦距离或者马氏距离等,但该方法效果较差,其难以区分在特征空间分布较为接近的样本。(2)基于分类的确定人脸相似度的方法,例如支持向量机的分类方法。但该方法的模型复杂度会随着训练数据的增加而增加,造成计算量大、计算效率低,进而导致后续的人脸识别存在效果差、效率低。Face recognition is a biometric technology based on human facial feature information for identification. It is widely used in the fields of identity verification, security monitoring, access control and attendance systems, and judicial criminal investigation. Face recognition mainly includes processes such as face detection, face alignment, face feature extraction, and face similarity determination. Among them, the determination of face similarity is an important part of face recognition, which can directly affect the result of face recognition. At present, the existing methods for determining face similarity mainly include: (1) a method for determining face similarity based on distance, such as Euclidean distance, cosine distance or Mahalanobis distance, but the method is ineffective, It is difficult to distinguish samples that are closer in feature space distribution. (2) A method of determining face similarity based on classification, such as a classification method of a support vector machine. However, the model complexity of the method increases with the increase of training data, resulting in large computational complexity and low computational efficiency, which leads to poor performance and low efficiency of subsequent face recognition.
因此,现有的人脸识别的方法存在效果差、效率低的问题。Therefore, the existing method of face recognition has a problem of poor effect and low efficiency.
发明内容Summary of the invention
本发明提供一种人脸识别的方法和装置、计算机装置及存储介质,旨在解决现有的人脸识别的方法存在的效果差、效率低的问题。The invention provides a method and device for face recognition, a computer device and a storage medium, and aims to solve the problem that the existing face recognition method has poor effect and low efficiency.
本发明第一方面提供一种人脸识别的方法,所述方法包括:A first aspect of the present invention provides a method for face recognition, the method comprising:
根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量;Extracting feature vectors of any two samples in the preset training set according to the preset face feature extraction model;
分别对所述任意两个样本的特征向量进行归一化处理;Normalizing the feature vectors of any two samples;
获取所述任意两个样本的融合特征向量;Obtaining a fusion feature vector of any two samples;
获取所述任意两个样本的参照相似度;Obtaining a reference similarity of any two samples;
依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度;And sequentially traversing all the two samples that are different from each other in the preset training set, and obtaining a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set;
根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型;Determining the trained regression model according to the fusion feature vector of the two different samples and the reference similarity training regression model in the preset training set;
利用所述训练后的回归模型,对待识别的人脸图片进行识别。The face image to be recognized is identified by using the trained regression model.
在较优的一实施例中,所述获取所述任意两个样本的融合特征向量包括:In a preferred embodiment, the acquiring the fused feature vector of the any two samples includes:
将归一化后的任意两个样本的特征向量的对应维度的元素分别相乘,并将相乘的结果作为所述任意两个样本的融合特征向量的相应维度的元素,获得所述任意两个样本的融合特征向量。And multiplying the elements of the corresponding dimension of the feature vectors of the normalized arbitrary two samples respectively, and using the multiplied result as the element of the corresponding dimension of the fusion feature vector of the arbitrary two samples, obtaining the arbitrary two Fusion feature vector of samples.
在较优的一实施例中,所述预设训练集包括样本所对应的类别标记,所述获取所述任意两个样本的参照相似度包括:In a preferred embodiment, the preset training set includes a category identifier corresponding to the sample, and the reference similarity for acquiring the any two samples includes:
确定归一化后的所述任意两个样本的特征向量的余弦距离;Determining a cosine distance of a feature vector of the normalized two samples;
若所述任意两个样本的类别标记相同,则所述任意两个样本的参照相似 度为所述余弦距离与预设常数的和;If the class labels of the two samples are the same, the reference similarity of the two samples is the sum of the cosine distance and the preset constant;
若所述任意两个样本的类别标记不同,则所述任意两个样本的参照相似度为所述余弦距离与所述预设常数的差。If the class labels of the two samples are different, the reference similarity of the two samples is the difference between the cosine distance and the preset constant.
在较优的一实施例中,所述根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型包括:In a preferred embodiment, the regression model is determined according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training model, and the regression model after the training is determined to include:
获取所述预设训练集的任一融合特征向量;Obtaining any fusion feature vector of the preset training set;
将所述任一融合特征向量输入至回归模型,获得所述任一融合特征向量所对应的两个样本的训练相似度,其中,所述回归模型至少包括第一全连接层和第二全连接层,且所述第一全连接层和第二全连接层均采用激活函数对所述任一融合特征向量做特征映射变换;Entering any of the fusion feature vectors into a regression model to obtain training similarity of two samples corresponding to any of the fusion feature vectors, wherein the regression model includes at least a first fully connected layer and a second fully connected a layer, and the first fully connected layer and the second fully connected layer respectively perform feature mapping transformation on the any of the fusion feature vectors by using an activation function;
利用损失函数确定所述任一融合特征向量所对应的两个样本的训练相似度与所述任一融合特征向量所对应的两个样本的参照相似度的误差;Determining, by using the loss function, an error of a training similarity of two samples corresponding to any one of the fusion feature vectors and a reference similarity of two samples corresponding to the one of the fusion feature vectors;
若所述误差不满足预设收敛条件,则利用随机梯度下降通过反向传播的过程调整所述回归模型的所述第一全连接层的参数和所述第二全连接层的参数;If the error does not satisfy the preset convergence condition, the parameter of the first fully connected layer and the parameter of the second fully connected layer of the regression model are adjusted by a process of back propagation using a random gradient descent;
重复上述迭代过程,直至所述误差满足预设收敛条件,将满足预设收敛条件之前的最后一次迭代过程的第一全连接层的参数和第二全连接层的参数作为回归模型的第一全连接层的参数和第二全连接层的参数,确定训练后的回归模型。The above iterative process is repeated until the error satisfies the preset convergence condition, and the parameters of the first fully connected layer and the parameters of the second fully connected layer of the last iterative process before the preset convergence condition are used as the first full regression model The parameters of the connection layer and the parameters of the second fully connected layer determine the regression model after training.
在较优的一实施例中,所述预设收敛条件包括:In a preferred embodiment, the preset convergence condition includes:
所述误差小于或者等于预设的误差阈值或者所述误差所对应的误差百分比小于或者等于预设的误差百分比。The error is less than or equal to a preset error threshold or the error percentage corresponding to the error is less than or equal to a preset error percentage.
在较优的一实施例中,所述利用所述训练后的回归模型,对待识别的人脸图片进行识别包括:In a preferred embodiment, the using the trained regression model to identify the face image to be recognized includes:
获取待验证的第一人脸图片和第二人脸图片的融合特征向量;Obtaining a fusion feature vector of the first face image and the second face image to be verified;
将所述第一人脸图片和所述第二人脸图片的融合特征向量输入至所述训练后的回归模型,获取所述第一人脸图片和所述第二人脸图片的相似度;And inputting a fusion feature vector of the first face image and the second face image to the trained regression model, and acquiring a similarity between the first face image and the second face image;
若所述第一人脸图片和所述第二人脸图片的相似度大于或者等于预设相似度阈值,则确定所述第一人脸图片和所述第二人脸图片为同一人的人脸图片;If the similarity between the first face image and the second face image is greater than or equal to a preset similarity threshold, determining that the first face image and the second face image are the same person Face picture
若所述第一人脸图片和所述第二人脸图片的相似度小于预设相似度阈值,则确定所述第一人脸图片和所述第二人脸图片不是同一人的人脸图片。If the similarity between the first face image and the second face image is less than a preset similarity threshold, determining that the first face image and the second face image are not the same person's face image .
在较优的一实施例中,所述利用所述训练后的回归模型,对待识别的人脸图片进行识别包括:In a preferred embodiment, the using the trained regression model to identify the face image to be recognized includes:
获取待检索的目标人脸图片;Obtaining a target face image to be retrieved;
利用所述预设人脸特征提取模型分别提取所述目标人脸图片的特征向量以及预设检索数据库所包含的人脸图片的特征向量;Extracting a feature vector of the target face image and a feature vector of a face image included in the preset search database by using the preset face feature extraction model;
分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量;Determining, respectively, a feature vector of the feature vector of the target face image and a feature vector of each face image included in the preset search database;
分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片与所述预设检索数据库所包含的每个人脸图片的相似度;Inputting a feature vector of the target face image and a feature vector of the feature vector of each face image included in the preset search database to the trained regression model, and acquiring the target face image a similarity to each face image included in the preset retrieval database;
按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果。Arranging each face image included in the preset search database in descending order of the similarity between the target face image and each face image included in the preset search database, and arranging The face image after the search is used as the search result.
在较优的一实施例中,所述方法还包括:In a preferred embodiment, the method further includes:
分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离;Determining, respectively, a feature vector of the target face image and a cosine distance of a feature vector of each face image included in the preset search database;
按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排在前N名的人脸图片作为候选集,其中,N为正整数;The face images included in the preset search database are arranged in descending order of cosine distance, and the face images ranked in the top N are used as candidate sets, where N is a positive integer;
所述分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量包括:The fusion feature vector for determining the feature vector of the target face image and the feature vector of each face image included in the preset search database respectively includes:
分别确定所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量;Determining, respectively, a feature vector of the feature vector of the target face image and a feature vector of each face image included in the candidate set;
所述分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度包括:And inputting a feature vector of the target face image and a feature vector of the feature vector of each face image included in the preset search database to the trained regression model, and acquiring the target person The similarity between the face picture and each face picture included in the preset search database includes:
分别将所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度;And respectively inputting a feature vector of the target face image and a feature vector of the feature vector of each face image included in the candidate set to the trained regression model, and acquiring the target face image and the location Comparing the similarity of each face picture included in the candidate set;
所述按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果包括:And arranging, according to the similarity degree of each of the face images included in the target face image and the preset search database, the face images included in the preset search database, and The arranged face images as search results include:
按照所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度由大到小的顺序对所述候选集所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果。Arranging the face images included in the candidate set in descending order of the similarity between the target face picture and each face picture included in the candidate set, and arranging the arranged face pictures As a result of the search.
本发明第二方面提供一种人脸识别的装置,所述装置包括:A second aspect of the present invention provides a device for recognizing a face, the device comprising:
特征向量提取模块,用于根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量;a feature vector extraction module, configured to extract feature vectors of any two samples in the preset training set according to the preset facial feature extraction model;
归一化模块,用于分别对所述任意两个样本的特征向量进行归一化处理;a normalization module, configured to respectively normalize feature vectors of any two samples;
融合特征向量获取模块,用于获取所述任意两个样本的融合特征向量a fusion feature vector acquisition module, configured to acquire a fusion feature vector of any two samples
参照相似度获取模块,用于获取所述任意两个样本的参照相似度;Referring to a similarity obtaining module, configured to acquire a reference similarity of the any two samples;
遍历获取模块,用于依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度;a traversing acquisition module, configured to sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set;
训练模块,用于根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型;a training module, configured to determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model;
识别模块,用于利用所述训练后的回归模型,对待识别的人脸图片进行识别。The identification module is configured to identify the face image to be recognized by using the trained regression model.
本发明第三方面提供一种计算机装置,所述计算机装置包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现上述任一实施例所述人脸识别的方法。A third aspect of the present invention provides a computer apparatus, comprising: a processor, wherein the processor is configured to implement a method of face recognition according to any of the above embodiments when executing a computer program stored in a memory.
本发明第四方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例所述人脸识别的方法。A fourth aspect of the present invention provides a computer readable storage medium having stored thereon a computer program, the computer program being executed by a processor to implement the method for face recognition according to any of the above embodiments.
在本发明中,对预设训练集中所有互不相同的两个样本的特征向量进行融合,根据所有互不相同的两个样本的融合特征向量以及参照相似度训练回归模型,确定训练后的回归模型。融合特征向量包含了人脸图片的纹理特征和动态模式特征,因此,训练后的回归模型能够有效区分不同类别标记的样本,利用所述训练后的回归模型,对待识别的人脸图片进行识别时,可以有效提高人脸识别的效果和准确率。In the present invention, the feature vectors of two mutually different samples in the preset training set are fused, and the regression model after training is determined according to the fusion feature vectors of the two samples that are different from each other and the reference similarity training regression model. model. The fusion feature vector includes the texture feature and the dynamic mode feature of the face image. Therefore, the trained regression model can effectively distinguish the samples of different category markers, and use the trained regression model to identify the face image to be recognized. Can effectively improve the effect and accuracy of face recognition.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings can also be obtained from those skilled in the art based on these drawings without paying any creative effort.
图1是本发明实施例提供的人脸识别的方法的实现流程图;1 is a flowchart of an implementation of a method for face recognition according to an embodiment of the present invention;
图2是本发明实施例提供的人脸识别的方法中步骤S106的实现流程图;2 is a flowchart of implementing step S106 in the method for face recognition according to an embodiment of the present invention;
图3是本发明实施例提供的人脸识别的方法中步骤S107的实现流程图;3 is a flowchart of implementing step S107 in the method for face recognition according to an embodiment of the present invention;
图4是本发明实施例提供的人脸识别的方法中步骤S107的另一实现流程图;4 is a flowchart of another implementation of step S107 in the method for face recognition according to the embodiment of the present invention;
图5是本发明实施例提供的人脸识别的方法中步骤S107的又一实现流程图;FIG. 5 is a flowchart of still another implementation of step S107 in the method for face recognition according to the embodiment of the present invention;
图6是本发明实施例提供的人脸识别的装置的功能模块图;FIG. 6 is a functional block diagram of a device for face recognition according to an embodiment of the present invention; FIG.
图7是本发明实施例提供的人脸识别的装置中训练模块106的结构框图;FIG. 7 is a structural block diagram of a training module 106 in a device for face recognition according to an embodiment of the present invention;
图8是本发明实施例提供的人脸识别的装置中识别模块107的结构框图;FIG. 8 is a structural block diagram of an identification module 107 in a device for recognizing a face according to an embodiment of the present invention;
图9是本发明实施例提供的人脸识别的装置中识别模块107的另一结构框图;FIG. 9 is a block diagram showing another structure of the identification module 107 in the device for recognizing a face according to an embodiment of the present invention;
图10是本发明实施例提供的人脸识别的装置中识别模块107的又一结构框图;FIG. 10 is a block diagram showing another structure of the identification module 107 in the device for recognizing a face according to an embodiment of the present invention;
图11是本发明实施例提供的计算机装置的结构示意图。FIG. 11 is a schematic structural diagram of a computer apparatus according to an embodiment of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
图1示出了本发明实施例提供的人脸识别的方法的实现流程,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 1 shows an implementation flow of a method for face recognition according to an embodiment of the present invention. The order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are detailed as follows:
如图1所示,人脸识别的方法,其包括:As shown in FIG. 1, a method for face recognition includes:
步骤S101,根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量。Step S101: Extract feature vectors of any two samples in the preset training set according to the preset facial feature extraction model.
所述预设的人脸特征提取模型为预先训练好的人脸特征提取模型,具体可以利用大量的人脸图片,通过卷积神经网络学习人脸特征的提取,建立训练后的人脸特征提取模型,此处不再详细赘述。所述预设训练集为预先设置的包含大量人脸图片的训练集,可以设置。假设所述预设训练集包括M个样本(即人脸图片)以及样本所对应的类别标记,其中,M为大于1的正整数。样本的类别标记是根据样本是否同属同一个人预先设置的类别标记,假设两个样本为同一人的人脸图片,则同属同一人的两个样本为一个类别标记,若两个样本为不同人的人脸图片,则不是同属同一人的两个样本为不同的类别标记,一个类别标记可能对应一个或者多个样本。The preset facial feature extraction model is a pre-trained facial feature extraction model. Specifically, a large number of facial images can be used to learn facial feature extraction through convolutional neural network, and the trained facial feature extraction is established. Model, no longer detailed here. The preset training set is a preset training set containing a large number of face images, and can be set. It is assumed that the preset training set includes M samples (ie, a face picture) and a category mark corresponding to the sample, where M is a positive integer greater than 1. The category mark of the sample is based on whether the sample belongs to the same person's pre-set category mark. If two samples are the face image of the same person, the two samples belonging to the same person are one category mark, if the two samples are different people For face images, two samples that are not the same person are marked with different categories, and one category label may correspond to one or more samples.
此处为便于描述,假设所述任意两个样本包括第一样本和第二样本,且所述第一样本和所述第二样本为不同的两个样本,以下采用第一样本和第二样本为例进行说明。Here, for convenience of description, it is assumed that any two samples include a first sample and a second sample, and the first sample and the second sample are different two samples, and the first sample and The second sample is described as an example.
假设根据预设的人脸特征提取模型提取的第一样本的特征向量和第二样本的特征向量分别为x=(x 1,x 2,x 3…x d-3,x d-2,x d)和y=(y 1,y 2,y 3…y d-3,y d-2,y d),第 一样本的类别标记和第二样本的类别标记分别为z i和z jIt is assumed that the feature vector of the first sample and the feature vector of the second sample extracted according to the preset face feature extraction model are x=(x 1 , x 2 , x 3 ... x d-3 , x d-2 , respectively). x d ) and y=(y 1 , y 2 , y 3 ... y d-3 , y d-2 , y d ), the class label of the first sample and the class label of the second sample are z i and z, respectively j .
其中,d表示特征向量的维度,且为大于1的正整数,具体可以在训练所述预设的人脸特征提取模型时进行设定,此处不做特别限定。The value of d is a dimension of the feature vector, and is a positive integer greater than 1. Specifically, it may be set when the preset facial feature extraction model is trained, and is not particularly limited herein.
步骤S102,分别对所述任意两个样本的特征向量进行归一化处理。Step S102, normalizing the feature vectors of the arbitrary two samples respectively.
为了进一步的提高人脸识别的效果和准确率,在获取到第一样本的特征向量和第二样本的特征向量后,对其进行归一化处理,归一化后的特征向量的元素为相应维度的元素与特征向量的模长的比值。In order to further improve the effect and accuracy of the face recognition, after acquiring the feature vector of the first sample and the feature vector of the second sample, the normalized processing is performed, and the elements of the normalized feature vector are The ratio of the elements of the corresponding dimension to the modulus length of the feature vector.
假设归一化后的第一样本的特征向量和第二样本的特征向量分别为
Figure PCTCN2017119465-appb-000001
Figure PCTCN2017119465-appb-000002
It is assumed that the eigenvector of the normalized first sample and the eigenvector of the second sample are respectively
Figure PCTCN2017119465-appb-000001
with
Figure PCTCN2017119465-appb-000002
步骤S103,获取所述任意两个样本的融合特征向量。Step S103: Acquire a fusion feature vector of any two samples.
在获得归一化后的第一样本的特征向量和归一化后的第二样本的特征向量后,即对归一化后的第一样本的特征向量和归一化后的第二样本的特征向量进行融合,获得所述第一样本和所述第二样本的融合特征向量。After obtaining the normalized first sample eigenvector and the normalized second sample eigenvector, the eigenvector of the normalized first sample and the normalized second The feature vectors of the samples are fused to obtain a fused feature vector of the first sample and the second sample.
为了进一步的提高人脸识别的效果和准确率,在较优的一实施例中,步骤S103,获取所述任意两个样本的融合特征向量包括:In order to further improve the effect and accuracy of the face recognition, in a preferred embodiment, in step S103, acquiring the fusion feature vector of the any two samples includes:
将归一化后的第一样本的特征向量和归一化后的第二样本的特征向量的对应维度的元素分别相乘,并将相乘的结果作为所述第一样本和所述第二样本的融合特征向量的相应维度的元素,获得所述第一样本和所述第二样本的融合特征向量。Multiplying the normalized first sample's feature vector and the normalized second sample's feature vector's corresponding dimension elements, respectively, and multiplying the result as the first sample and the An element of a corresponding dimension of the second sample of the fusion feature vector obtains a fusion feature vector of the first sample and the second sample.
假设融合特征向量用m表示,则
Figure PCTCN2017119465-appb-000003
Assuming that the fusion feature vector is represented by m, then
Figure PCTCN2017119465-appb-000003
步骤S104,获取所述任意两个样本的参照相似度。Step S104: Acquire a reference similarity of any two samples.
在获取到归一化后的第一样本的特征向量
Figure PCTCN2017119465-appb-000004
和归一化后的第二样本的特征向量
Figure PCTCN2017119465-appb-000005
后,即可根据归一化后的第一样本的特征向量和归一化后的第二样本的特征向量获取所述第一样本和所述第二样本的参照相似度。
Obtaining the eigenvector of the normalized first sample
Figure PCTCN2017119465-appb-000004
And the normalized second sample eigenvector
Figure PCTCN2017119465-appb-000005
Then, the reference similarity of the first sample and the second sample may be obtained according to the normalized first sample's feature vector and the normalized second sample's feature vector.
为了进一步的提高人脸识别的效果和准确率,在较优的一实施例中,步骤S104,获取所述任意两个样本的参照相似度包括:In order to further improve the effect and accuracy of the face recognition, in a preferred embodiment, in step S104, obtaining the reference similarity of the any two samples includes:
确定归一化后的第一样本的特征向量和归一化后的第二样本的特征向量的余弦距离。A cosine distance of the normalized first sample eigenvector and the normalized second sample eigenvector is determined.
归一化后的第一样本和第二样本的特征向量分别为
Figure PCTCN2017119465-appb-000006
Figure PCTCN2017119465-appb-000007
则两个特征向量的余弦距离为:
The normalized feature vectors of the first sample and the second sample are respectively
Figure PCTCN2017119465-appb-000006
with
Figure PCTCN2017119465-appb-000007
Then the cosine distance of the two eigenvectors is:
Figure PCTCN2017119465-appb-000008
Figure PCTCN2017119465-appb-000008
其中,x i·y j表示特征向量x i和特征向量y j的点积,||x i|| 2和||y j|| 2分别表示特征向量x i和特征向量y j的二范数,所谓向量的二范数是指向量中各个元素的平方根之和再开根号。 Where x i · y j represents the dot product of the feature vector x i and the feature vector y j , and ||x i || 2 and ||y j || 2 represent the two vectors of the feature vector x i and the feature vector y j , respectively The number, the two-norm of the vector, refers to the sum of the square roots of the elements in the vector and the root number.
余弦距离,也称为余弦相似度,是用向量空间中两个向量的余弦值来度量两个个体间差异的大小,此处即可以用来表征所述第一样本和所述第二样本的相似度。另外,余弦距离的取值范围为[-1,+1],距离越接近1,表示两个向量的方向越接近相同,即呈正相关关系;距离越接近-1,表示两个向量的方向越接近相反,即呈负相关的关系。The cosine distance, also known as the cosine similarity, is the magnitude of the difference between two individuals using the cosine of the two vectors in the vector space, which can be used to characterize the first sample and the second sample. Similarity. In addition, the range of the cosine distance is [-1, +1], and the closer the distance is to 1, the closer the two vectors are to the same direction, that is, the positive correlation; the closer the distance is to -1, the more the direction of the two vectors Close to the opposite, that is, a negative correlation.
若所述任意两个样本的类别标记相同,则所述任意两个样本的参照相似度为所述余弦距离与预设常数的和。If the class labels of the two samples are the same, the reference similarity of the two samples is the sum of the cosine distance and the preset constant.
在第一样本的类别标记和第二样本的类别标记为相同的类别标记时,为了增大相同类别标记的样本的参照相似度,所述第一样本和所述第二样本的参照相似度为所述余弦距离与预设常数的和。所述预设常数为预先设置的常数,在较优的一实施例中,所述预设常数为0.5。When the category mark of the first sample and the category mark of the second sample are marked as the same category mark, in order to increase the reference similarity of the samples of the same category mark, the reference of the first sample and the second sample is similar The degree is the sum of the cosine distance and a preset constant. The preset constant is a preset constant. In a preferred embodiment, the preset constant is 0.5.
假设参照相似度用n表示,所述预设常数用α表示,则在第一样本的类别标记和第二样本的类别标记相同时,有:n=cos(x i,y j)+α。 Assuming that the reference similarity is represented by n, and the preset constant is represented by α, when the class mark of the first sample and the class mark of the second sample are the same, there is: n=cos(x i , y j )+α .
若所述任意两个样本的类别标记不同,则所述任意两个样本的参照相似度为所述余弦距离与所述预设常数的差。If the class labels of the two samples are different, the reference similarity of the two samples is the difference between the cosine distance and the preset constant.
在第一样本的类别标记和第二样本的类别标记为不同的类别标记时,为了减小不同类别标记的样本的参照相似度,所述第一样本和所述第二样本的参照相似度为所述余弦距离与预设常数的差。When the category mark of the first sample and the category mark of the second sample are marked as different category marks, in order to reduce the reference similarity of the samples of the different class marks, the reference of the first sample and the second sample is similar The degree is the difference between the cosine distance and the preset constant.
即在第一样本的类别标记和第二样本的类别标记相同时,有:n=cos(x i,y j)-α。 That is, when the category mark of the first sample and the category mark of the second sample are the same, there is: n=cos(x i , y j )−α.
步骤S105,依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度。Step S105: sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set.
在根据上述步骤获取到第一样本和第二样本的融合特征向量和参照相似度之后,即重复上述步骤S101至S104,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度,所述互不相同的两个样本是指两个样本是不相同的样本。假设所述预设训练集中包括M个样本,每次从所述预设训练集中抽取任意两个不相同的样本,直至重复M*(M-1)/2次,完成所述预设训练集中任意两个互不相同的样本的抽取,即重复M*(M-1)/2次步骤S101至步骤S104,即可获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度,并将获得的所有互不相同的两个样本的融合特征向量和参照相似度作为训练回归模型的数据,至此,完成回归模型训练数据的构造,以待后续对回归模型进行训练。After acquiring the fusion feature vector of the first sample and the second sample and the reference similarity according to the above steps, the steps S101 to S104 are repeated to obtain the fusion features of all the two samples that are different from each other in the preset training set. The vector and the reference similarity, the two samples that are different from each other means that the two samples are different samples. It is assumed that the preset training set includes M samples, and each time two arbitrary samples are extracted from the preset training set until M*(M-1)/2 times are repeated, and the preset training set is completed. The extraction of any two mutually different samples, that is, repeating M*(M-1)/2 times steps S101 to S104, the fusion feature vectors of all the two samples different from each other in the preset training set can be obtained. And the reference similarity, and the obtained fusion feature vector and reference similarity of the two samples which are different from each other are used as the data of the training regression model. At this point, the construction of the regression model training data is completed, and the regression model is trained later. .
步骤S106,根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型。Step S106: Determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model.
再获取到上述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度后,即可利用上述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,并在训练终止后,确定训练后的回归 模型。After obtaining the fused feature vector and the reference similarity of all the two different samples in the preset training set, the fused feature vector and the reference similarity of all the two different samples in the preset training set can be utilized. The regression model is trained, and after the training is terminated, the regression model after training is determined.
步骤S107,利用所述训练后的回归模型,对待识别的人脸图片进行识别。Step S107, using the trained regression model to identify the face image to be recognized.
在确定训练后的回归模型后,即可利用训练后的回归模型对待识别的人脸图片进行识别。其中,对待识别的人脸图片进行识别主要包括人脸验证以及人脸检索,人脸验证即判断待验证的两张人脸图片是否是同一个人的人脸图片,人脸检索是根据目标人脸图片,在人脸数据库中检索和目标人脸图片为同一人或者和目标人脸图片的相似度符合一定要求的人脸图片。After determining the regression model after training, the trained regression model can be used to identify the face image to be recognized. The recognition of the face image to be recognized mainly includes face verification and face retrieval. The face verification determines whether the two face images to be verified are face images of the same person, and the face search is based on the target face. The image is retrieved in the face database and the face image of the target face is the same person or the face image with the similarity of the target face image.
在本发明实施例中,对预设训练集中所有互不相同的两个样本的特征向量进行融合,根据所有互不相同的两个样本的融合特征向量以及参照相似度训练回归模型,确定训练后的回归模型。融合特征向量包含了人脸图片的纹理特征和动态模式特征,因此,训练后的回归模型能够有效区分不同类别标记的样本,利用所述训练后的回归模型,对待识别的人脸图片进行识别时,可以有效提高人脸识别的效果和准确率。In the embodiment of the present invention, the feature vectors of all the two samples that are different from each other in the preset training set are merged, and the regression model is trained according to the fusion feature vectors of the two samples and the reference similarity training model to determine the training. Regression model. The fusion feature vector includes the texture feature and the dynamic mode feature of the face image. Therefore, the trained regression model can effectively distinguish the samples of different category markers, and use the trained regression model to identify the face image to be recognized. Can effectively improve the effect and accuracy of face recognition.
图2示出了本发明实施例提供的人脸识别的方法中步骤S106的实现流程,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 2 shows an implementation flow of step S106 in the method for face recognition according to the embodiment of the present invention. The order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are detailed as follows:
在较优的一实施例中,为了进一步的提高人脸识别的效果和准确率,如图2所示,步骤S106,根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型包括:In a preferred embodiment, in order to further improve the effect and accuracy of the face recognition, as shown in FIG. 2, in step S106, according to the fusion feature vectors of the two samples that are different from each other in the preset training set. The regression model is trained with the reference similarity, and the regression model after the training is determined to include:
步骤S1061,获取所述预设训练集的任一融合特征向量。Step S1061: Acquire any fusion feature vector of the preset training set.
在利用所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型时,首先获取到所述预设训练集的任一融合特征向量,所述任一融合特征向量即为上述获取到的所述预设训练集中所有互不相同的两个样本的融合特征向量的其中任意一个融合特征向量。When the regression model is trained by using the fusion feature vector of the two samples different from each other in the preset training set and the reference similarity, any fusion feature vector of the preset training set is first acquired, and the fusion is performed. The feature vector is any one of the fusion feature vectors of the two different samples of the mutually different samples in the preset training set.
步骤S1062,将所述任一融合特征向量输入至回归模型,获得所述任一融合特征向量所对应的两个样本的训练相似度,其中,所述回归模型至少包括第一全连接层和第二全连接层,且所述第一全连接层和第二全连接层均采用激活函数对所述任一融合特征向量做特征映射变换。Step S1062: Input any of the fusion feature vectors into a regression model to obtain training similarity of two samples corresponding to any of the fusion feature vectors, wherein the regression model includes at least a first fully connected layer and a first The second fully connected layer, and the first fully connected layer and the second fully connected layer respectively perform feature mapping transformation on the any of the merged feature vectors by using an activation function.
在本发明实施例中,所述回归模型至少包括了第一全连接层和第二全连接层,且所述第一全连接层和第二全连接层均采用激活函数对所述任一融合特征向量做特征映射变换。鉴于修正线性单元(英文全称:Rectified linear unit,简称Relu)激活函数可以加速回归模型的收敛,提高回归模型训练的速度和效率,因此,在较优的一实施例中,所述第一全连接层和第二全连接层均采用Relu激活函数对所述任一融合特征向量做特征映射变换。或者所述第一全连接层和第二全连接层也可以采用和Relu激活函数的变体函数,如Leaky-Relu激活函数或者P-Relu(英文全称:Parametric-Relu)激活函数或者R-Relu(英文全称:Randomizied Relu)激活函数等。在将所述任一融合特征向量输入至回归模型后,所述回归模型的所述第一全连接层和第二全连接层采用Relu激活函数对所述任一融合特征向量做特征映射变换,在所述第二全连接层输出所述任一融合特征向量所对应的两个样本的训练相似度。In an embodiment of the present invention, the regression model includes at least a first fully connected layer and a second fully connected layer, and the first fully connected layer and the second fully connected layer both use an activation function for any of the fusions The feature vector is used for feature map transformation. In view of the correction of the linear unit (Rectified linear unit, Relu for short) activation function can accelerate the convergence of the regression model, improve the speed and efficiency of the regression model training, therefore, in a preferred embodiment, the first full connection Both the layer and the second fully connected layer perform feature mapping transformation on any of the fusion feature vectors using a Relu activation function. Alternatively, the first fully connected layer and the second fully connected layer may also adopt a variant function with a Relu activation function, such as a Leaky-Relu activation function or a P-Relu (English full name: Parametric-Relu) activation function or R-Relu. (English full name: Randomizied Relu) activation function and so on. After the fusion feature vector is input to the regression model, the first fully connected layer and the second fully connected layer of the regression model perform feature mapping transformation on the any fusion feature vector by using a Relu activation function. The training similarity of the two samples corresponding to any of the fusion feature vectors is outputted at the second fully connected layer.
步骤S1063,利用损失函数确定所述任一融合特征向量所对应的两个样本的训练相似度与所述任一融合特征向量所对应的两个样本的参照相似度的误差。Step S1063: Determine, by using the loss function, an error of the similarity between the training similarity of the two samples corresponding to the any fusion feature vector and the reference similarity of the two samples corresponding to the any fusion feature vector.
在将所述任一融合特征向量通过所述训练后的回归模型,获取到所述任一融合特征向量所对应的两个样本的训练相似度之后,可以利用损失函数确定所述任一融合特征向量所对应的两个样本的训练相似度与所述任一融合特征向量所对应的两个样本的参照相似度的误差。在较优的一实施例中,利用 L2损失函数确定所述任一融合特征向量所对应的两个样本的训练相似度与所述任一融合特征向量所对应的两个样本的参照相似度的误差,其中,L2损失(英文全称:Squared hinge loss,简称L2 loss)函数,其是用来评估预测值与真实值的不一致程度,在本发明实施例中,L2损失函数用于评估训练相似度和参照相似度的不一致程度。After the fusion feature is passed through the trained regression model to obtain the training similarity of the two samples corresponding to any of the fusion feature vectors, the loss function may be used to determine any of the fusion features. The error between the training similarity of the two samples corresponding to the vector and the reference similarity of the two samples corresponding to any of the fusion feature vectors. In a preferred embodiment, the L2 loss function is used to determine the training similarity of the two samples corresponding to any one of the fusion feature vectors and the reference similarity of the two samples corresponding to the any of the fusion feature vectors. Error, wherein the L2 loss (English name: Squared hinge loss, L2 loss for short) function is used to evaluate the degree of inconsistency between the predicted value and the true value. In the embodiment of the present invention, the L2 loss function is used to evaluate the training similarity. The degree of inconsistency with the reference similarity.
若所述误差不满足预设收敛条件,则执行步骤S1064,利用随机梯度下降通过反向传播的过程调整所述回归模型的所述第一全连接层的参数和所述第二全连接层的参数。If the error does not satisfy the preset convergence condition, step S1064 is performed, and the parameter of the first fully connected layer of the regression model and the second fully connected layer are adjusted by a process of backpropagation by using a random gradient descent parameter.
所述预设收敛条件为预先设置的收敛条件,为了提高训练回归模型的计算效率,减小训练回归模型的计算量,在较优的一实施例中,所述预设收敛条件包括:所述误差小于或者等于预设的误差阈值或者所述误差所对应的误差百分比小于或者等于预设的误差百分比。所述预设的误差阈值和所述预设的误差百分比为预先设置的误差阈值,此处并不做特别的限制。The preset convergence condition is a pre-set convergence condition. In order to improve the calculation efficiency of the training regression model and reduce the calculation amount of the training regression model, in a preferred embodiment, the preset convergence condition includes: The error is less than or equal to the preset error threshold or the error percentage corresponding to the error is less than or equal to the preset error percentage. The preset error threshold and the preset error percentage are preset error thresholds, and are not particularly limited herein.
随机梯度下降主要用于在神经网络模型中进行权重更新,在一个方向上更新和调整模型的参数,来最小化损失函数,随机梯度下降每次从训练集中随机选择一个样本(在本发明实施例中即指融合特征向量)来进行学习。反向传播是先在前向传播中计算输入信号的乘积及其对应的权重,然后将激活函数作用于这些乘积的总和,之后在网络模型的反向传播过程中回传相关误差,使用随机梯度下降更新权重值,通过计算误差函数相对于权重参数的梯度,在损失函数梯度的相反方向上更新权重参数。因此,在本发明实施例中,若误差不满足预设收敛条件,则利用随机梯度下降通过反向传播的过程调整所述回归模型的所述第一全连接层的参数和所述第二全连接层的参数。The stochastic gradient descent is mainly used to perform weight update in the neural network model, and the parameters of the model are updated and adjusted in one direction to minimize the loss function. The stochastic gradient descent randomly selects one sample from the training set at a time (in the embodiment of the present invention) In the middle, it refers to the fusion feature vector) to learn. Backpropagation is to calculate the product of the input signal and its corresponding weight in the forward propagation, then apply the activation function to the sum of these products, and then return the relevant error in the back propagation of the network model, using a random gradient. The update weight value is decreased, and the weight parameter is updated in the opposite direction of the loss function gradient by calculating the gradient of the error function with respect to the weight parameter. Therefore, in the embodiment of the present invention, if the error does not satisfy the preset convergence condition, the parameters of the first fully connected layer and the second full of the regression model are adjusted by a process of backpropagation by using a random gradient descent. The parameters of the connection layer.
在调整所述第一全连接层的参数和所述第二全连接层的参数后,跳转至步骤S1061,重复执行步骤S1061至步骤S1063,直至所述误差满足预设收敛条件。After adjusting the parameters of the first fully connected layer and the parameters of the second fully connected layer, the process goes to step S1061, and steps S1061 to S1063 are repeatedly performed until the error satisfies a preset convergence condition.
若所述误差满足预设收敛条件,则执行步骤S1065,将满足预设收敛条件之前的最后一次迭代过程的第一全连接层的参数和第二全连接层的参数作为回归模型的第一全连接层的参数和第二全连接层的参数,确定训练后的回归模型。If the error satisfies the preset convergence condition, step S1065 is performed, and the parameters of the first fully connected layer and the parameter of the second fully connected layer of the last iteration process before the preset convergence condition are used as the first full of the regression model. The parameters of the connection layer and the parameters of the second fully connected layer determine the regression model after training.
在所述误差满足预设收敛条件后,即停止训练回归模型,并将满足预设收敛条件之前的最后一次迭代过程的第一全连接层的参数和第二全连接层的参数作为回归模型的第一全连接层的参数和第二全连接层的参数,确定训练后的回归模型,至此,完成回归模型的训练。After the error satisfies the preset convergence condition, the training regression model is stopped, and the parameters of the first fully connected layer and the parameters of the second fully connected layer of the last iterative process before the preset convergence condition are used as the regression model. The parameters of the first fully connected layer and the parameters of the second fully connected layer determine the regression model after training, and thus the training of the regression model is completed.
在本发明实施例中,预设训练集中的融合特征向量同时包含了人脸图片的纹理特征和动态模式特征,利用预设训练集的融合特征向量对回归模型进行训练,利用随机梯度下降通过反向传播的过程调整所述回归模型的参数,确定训练后的回归模型,因此,训练后的回归模型可以有效区分不同类别标记的样本,利用所述训练后的回归模型,对待识别的人脸图片进行识别时,可以有效提高人脸识别的效果和准确率。In the embodiment of the present invention, the fusion feature vector of the preset training set includes the texture feature and the dynamic mode feature of the face image, and the regression model is trained by using the fusion feature vector of the preset training set, and the random gradient is used to Adjusting the parameters of the regression model to the process of propagation, and determining the regression model after training, therefore, the trained regression model can effectively distinguish samples of different categories of markers, and use the trained regression model to treat the recognized face images When the recognition is performed, the effect and accuracy of face recognition can be effectively improved.
图3示出了本发明实施例提供的人脸识别的方法中步骤S107的实现流程,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 3 shows an implementation flow of step S107 in the method for face recognition according to the embodiment of the present invention. The order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are detailed as follows:
在较优的一实施例中,为了进一步的提高人脸识别的效果和准确率,如图3所示,步骤S107包括:In a preferred embodiment, in order to further improve the effect and accuracy of the face recognition, as shown in FIG. 3, step S107 includes:
步骤S201,获取待验证的第一人脸图片和第二人脸图片的融合特征向量。Step S201: Acquire a fusion feature vector of the first face image and the second face image to be verified.
为了验证第一人脸图片和第二人脸图片是否为同一人的人脸图片,首先 需要提取第一人脸图片和第二人脸图片的融合特征向量,具体的提取第方法和前文中提取第一样本和第二样本的融合特征向量的方法相同,即首先根据预设的人脸特征提取模型分别提取第一人脸图片和第二人脸图片的特征向量,之后对第一人脸图片和第二人脸图片的特征向量进行归一化处理,最后在获取第一人脸图片和第二人脸图片的融合特征向量,具体可参照上述步骤S101至步骤S103相关内容,此处不再详细赘述。In order to verify whether the first face image and the second face image are the same person's face image, firstly, the fusion feature vector of the first face image and the second face image is extracted, and the specific extraction method and the foregoing extraction are performed. The method for fusing the feature vector of the first sample and the second sample is the same, that is, the feature vector of the first face image and the second face image is first extracted according to the preset face feature extraction model, and then the first face is extracted. The feature vector of the picture and the second face image is normalized, and finally the fusion feature vector of the first face image and the second face image is obtained. For details, refer to the related content of step S101 to step S103 above. More details will be described.
步骤S202,将所述第一人脸图片和所述第二人脸图片的融合特征向量输入至所述训练后的回归模型,获取所述第一人脸图片和所述第二人脸图片的相似度。Step S202, input a fusion feature vector of the first face image and the second face image to the trained regression model, and acquire the first face image and the second face image. Similarity.
在根据所述第一人脸图片和所述第二人脸图片的融合特征向量,利用所述训练后的回归模型获得第一人脸图片和所述第二人脸图片的相似度时,具体可以参照上述步骤S1062的内容,此处不再详细赘述。When the similarity between the first face image and the second face image is obtained by using the trained regression model according to the fusion feature vector of the first face image and the second face image, The content of the above step S1062 can be referred to, and details are not described herein again.
若所述第一人脸图片和所述第二人脸图片的相似度大于或者等于预设相似度阈值,则执行步骤S203,确定所述第一人脸图片和所述第二人脸图片为同一人的人脸图片。If the similarity between the first face image and the second face image is greater than or equal to the preset similarity threshold, step S203 is performed to determine that the first face image and the second face image are The face image of the same person.
所述预设相似度阈值为预先设置的相似度,此处并不做特别的限制。在所述第一人脸图片和所述第二人脸图片的相似度大于或者等于预设相似度阈值时,即可确定所述第一人脸图片和所述第二人脸图片为同一人的人脸图片。The preset similarity threshold is a preset similarity, and is not particularly limited herein. When the similarity between the first face image and the second face image is greater than or equal to a preset similarity threshold, the first face image and the second face image may be determined to be the same person. Face picture.
若所述第一人脸图片和所述第二人脸图片的相似度小于预设相似度阈值,则执行步骤S204,确定所述第一人脸图片和所述第二人脸图片不是同一人的人脸图片。If the similarity between the first face image and the second face image is less than the preset similarity threshold, step S204 is performed to determine that the first face image and the second face image are not the same person. Face picture.
在所述第一人脸图片和所述第二人脸图片的相似度小于预设相似度阈值,确定所述第一人脸图片和所述第二人脸图片不是同一人的人脸图片。至此,即完成对所述第一人脸图片和所述第二人脸图片的验证。And determining that the first face picture and the second face picture are not the same person's face picture, where the similarity between the first face picture and the second face picture is less than a preset similarity threshold. At this point, the verification of the first face picture and the second face picture is completed.
在本发明实施例中,训练后的回归模型可以有效区分不同类别标记的人脸图片,利用训练后的回归模型对待识别的第一人脸图片和第二人脸图片进行验证,能够有效确定第一人脸图片和第二人脸图片的相似度,进而确定所述第一人脸图片和所述第二人脸图片是否是同一人的人脸图片,因此,可以进一步的提高人脸识别的效果和准确率。In the embodiment of the present invention, the trained regression model can effectively distinguish the face images of different categories of markers, and use the trained regression model to verify the first face image and the second face image to be identified, which can effectively determine the first The similarity between the face image and the second face image, thereby determining whether the first face image and the second face image are face images of the same person, and thus, the face recognition can be further improved. Performance and accuracy.
图4示出了本发明实施例提供的人脸识别的方法中步骤S107的另一实现流程,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 4 shows another implementation flow of step S107 in the method for face recognition according to the embodiment of the present invention. The order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are detailed as follows:
在较优的一实施例中,为了进一步的提高人脸识别的效果和准确率,如图4所示,步骤S107包括:In a preferred embodiment, in order to further improve the effect and accuracy of the face recognition, as shown in FIG. 4, step S107 includes:
步骤S301,获取待检索的目标人脸图片。Step S301: Acquire a target face image to be retrieved.
为了对人脸图片进行检索,以返回和待检索的目标人脸图片相似度在一定范围的人脸图片,首先需要获取待检索的目标人脸图片。所述待检索的目标人脸图片具体可以通过图像获取设备获取,例如照相机或者摄像机等;或者可以通过网络获取待检索的所述目标人脸图片,此处获取所述待检索的目标人脸图片的途径并不做特别的限制。In order to retrieve the face image, in order to return the face image with the similarity of the target face image to be retrieved in a certain range, it is first necessary to obtain the target face image to be retrieved. The target face image to be retrieved may be acquired by an image acquisition device, such as a camera or a camera, or the target face image to be retrieved may be obtained through a network, where the target face image to be retrieved is obtained. The route is not subject to special restrictions.
步骤S302,利用所述预设人脸特征提取模型分别提取所述目标人脸图片的特征向量以及预设检索数据库所包含的人脸图片的特征向量。Step S302: Extract the feature vector of the target face image and the feature vector of the face image included in the preset search database by using the preset face feature extraction model.
所述预设检索数据库为预先设置的检索数据库,其包括大量的人脸图片。步骤S302具体可以参照上述步骤S101的内容,此处不再详细赘述。The preset retrieval database is a preset retrieval database, which includes a large number of face images. For details, refer to the content of step S101 above, and details are not described herein again.
在较优的一实施例中,为了进一步的提高人脸识别的效果和准确率,步骤S107还包括:分别对所述目标人脸图片的特征向量以及预设检索数据库所包含的人脸图片的特征向量进行归一化处理。In a preferred embodiment, in order to further improve the effect and accuracy of the face recognition, step S107 further includes: separately performing a feature vector of the target face image and a face image included in the preset search database. The feature vector is normalized.
在对特征向量进行归一化处理时,具体可以参照上述步骤S102的内容,此处不再详细赘述。For the normalization process of the feature vector, the content of the above step S102 can be specifically referred to, and details are not described herein again.
步骤S303,分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量。Step S303, respectively determining a feature vector of the target face image and a feature vector of the feature vector of each face image included in the preset search database.
在确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量时,具体可以参照上述步骤S103的内容,此处不再详细赘述。For example, when the feature vector of the target face image and the feature vector of the feature vector of each face image included in the preset search database are determined, the content of step S103 may be specifically referred to, and details are not described herein again.
步骤S304,分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片与所述预设检索数据库所包含的每个人脸图片的相似度。Step S304, respectively input a feature vector of the target face image and a feature vector of a feature vector of each face image included in the preset search database to the trained regression model, and acquire the target. The similarity between the face picture and each face picture included in the preset search database.
在获取所述目标人脸图片与所述预设检索数据库所包含的每个人脸图片的相似度时,具体可以参照上述步骤S1062的内容,此处不再详细赘述。When the similarity between the target face image and each face image included in the preset search database is obtained, the content of step S1062 may be specifically referred to, and details are not described herein again.
步骤S305,按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果。Step S305, arranging, according to the similarity between the target face image and each face image included in the preset search database, each face image included in the preset search database. The arranged face images are used as search results.
为了将和待检索的目标人脸图片最为相似的人脸图片更为直观的显示在前面,在获取所述目标人脸图片与所述预设检索数据库所包含的每个人脸图片的相似度后,即可按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果,以便将检索结果返回,例如显示在显示屏上。In order to display the face image most similar to the target face image to be retrieved in the front, the similarity between the target face image and each face image included in the preset search database is obtained. And each face image included in the preset search database may be arranged in descending order according to the similarity between the target face image and each face image included in the preset search database. The arranged face image is used as a retrieval result to return the retrieval result, for example, displayed on the display screen.
在本发明实施例中,利用融合特征向量和训练后的回归模型对图片进行识别,按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果,可以提高人脸检索的准确率,进而提高人脸识别的效果和准确率。In the embodiment of the present invention, the image is identified by using the fusion feature vector and the trained regression model, and the similarity of each face image included in the target face image and the preset retrieval database is from large to small. The order of each face image included in the preset search database is arranged, and the arranged face image is used as a retrieval result, which can improve the accuracy of face retrieval, thereby improving the effect and accuracy of face recognition. .
图5示出了本发明实施例提供的人脸识别的方法中步骤S107的又一实现流程,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 5 shows still another implementation flow of step S107 in the method for face recognition according to the embodiment of the present invention. The order of the steps in the flowchart may be changed according to different requirements, and some steps may be omitted. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are detailed as follows:
在较优的一实施例中,为了进一步提高人脸识别的效果和准确率,如图5所示,在上述图4所示步骤的基础上,步骤S107还包括:In a preferred embodiment, in order to further improve the effect and accuracy of the face recognition, as shown in FIG. 5, based on the steps shown in FIG. 4, step S107 further includes:
步骤S306,分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离。Step S306, respectively determining a cosine distance of the feature vector of the target face image and the feature vector of each face image included in the preset search database.
鉴于所述预设检索数据库包含了大量的人脸图片,对所述预设检索数据库中所有的人脸图片都采用上述方法进行计算,会产生很大的计算量。鉴于余弦距离也可以用来表征两个向量之间的相似度,因此,为了提高人脸检索以及后续的人脸识别的效率,在本发明实施例中,可以首先确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离,以初步用来表征所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度。关于所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离的确定,具体可以参照上述步骤S104中确定归一化后的第一样本的特征向量和第二样本的特征向量的余弦距离的方法,此处不再详细赘述。In view of the fact that the preset search database contains a large number of face images, all the face images in the preset search database are calculated by the above method, which generates a large amount of calculation. Since the cosine distance can also be used to characterize the similarity between the two vectors, in order to improve the efficiency of the face search and the subsequent face recognition, in the embodiment of the present invention, the target face picture may be first determined. And a cosine distance of the feature vector and the feature vector of each face image included in the preset retrieval database, to initially represent the similarity between the target face image and each face image included in the preset search database degree. For determining the cosine distance of the feature vector of the target face image and the feature vector of each face image included in the preset search database, refer to the determining the normalized first sample in step S104. The method of the feature vector and the cosine distance of the feature vector of the second sample will not be described in detail herein.
步骤S307,按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排在前N名的人脸图片作为候选集,其中,N为正整数。Step S307, the face images included in the preset search database are arranged in descending order of cosine distance, and the face images ranked in the top N are used as candidate sets, where N is a positive integer.
在确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离后,即可按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,将排在前N名的人脸图片作为候选集,以便缩小检索的范围,减少人脸检索和后续人脸识别的计算量,提高人脸检索和后续人脸识别的效率。所述正整数N可以进行设置,例如,在较优的一实施例中,所述正整数N为100,即将排在前100名的人脸图片作为候选集,以便后续确定所述目标人脸图片和所述候选集中的100张人脸图片的相似度。After determining the cosine distance of the feature vector of the target face image and the feature vector of each face image included in the preset search database, the preset search may be performed according to the cosine distance from the largest to the smallest. The face images included in the database are arranged, and the top N face images are used as candidate sets, so as to narrow the search range, reduce the calculation amount of face search and subsequent face recognition, and improve face search and follow-up persons. The efficiency of face recognition. The positive integer N can be set. For example, in a preferred embodiment, the positive integer N is 100, that is, a face image ranked in the top 100 is used as a candidate set, so as to subsequently determine the target face. The similarity between the picture and the 100 face pictures in the candidate set.
相应的,步骤S303,所述分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量包括:Correspondingly, in step S303, the determining a fusion feature vector of the feature vector of the target face image and the feature vector of each face image included in the preset retrieval database respectively includes:
步骤S3031,分别确定所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量。Step S3031: respectively determine a feature vector of the target face image and a feature vector of the feature vector of each face image included in the candidate set.
在减小了检索范围,确定符合一定条件和要求的候选集后,即可确定所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量。步骤S3031具体可以参照上述步骤S303的内容,此处不再详细赘述。After the search range is reduced and the candidate set meets certain conditions and requirements, the fusion feature vector of the feature vector of the target face image and the feature vector of each face image included in the candidate set may be determined. For details, refer to the content of step S303 above, and details are not described herein again.
相应的,步骤S304,所述分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度包括:Correspondingly, in step S304, the feature vector of the target face image and the feature vector of the feature vector of each face image included in the preset search database are respectively input to the trained regression model. And acquiring the similarity between the target face image and each face image included in the preset search database includes:
步骤S3041,分别将所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度。Step S3041: respectively input a feature vector of the target face image and a feature vector of a feature vector of each face image included in the candidate set to the trained regression model, and acquire the target face. The similarity of the picture and each face picture included in the candidate set.
同样的,步骤S3041可以参照上述步骤S304的内容,此处不再详细赘述。Similarly, the content of the above step S304 can be referred to in step S3041, and details are not described herein again.
相应的,步骤S305,所述按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果包括:Correspondingly, in step S305, the face included in the preset search database is in descending order of the similarity of each face image included in the target face picture and the preset search database. The images are arranged and the arranged face images are included as search results:
步骤S3051,按照所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度由大到小的顺序对所述候选集所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果。Step S3051: Arrange the face images included in the candidate set in descending order of the similarity between the target face picture and each face picture included in the candidate set, and arrange the arranged faces. The face image is used as a search result.
同样的,步骤S3051可以参照上述步骤S305的内容,此处不再详细赘述。Similarly, the content of step S305 can be referred to in step S3051, and details are not described herein again.
在本发明实施例,首先确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离,按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排在前N名的人脸图片作为候选集,进而按照所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度由大到小的顺序对所述候选集所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果。因此,鉴于余弦距离能够初步表征图片之间的相似度,通过计算余弦距离,将与目标人脸图片最为相似的排在前列的多个人脸图片首先筛选出来,作为后续检索的候选集,因此,可以缩小检索的范围,提高检索速度、进而提高人脸识别的效率。In the embodiment of the present invention, first, determining a cosine distance of a feature vector of the target face image and a feature vector of each face image included in the preset search database, in the order of cosine distance from large to small The face images included in the preset search database are arranged, and the face images ranked in the top N are used as candidate sets, and then the target face images are similar to each face image included in the candidate set. The face images included in the candidate set are arranged in descending order, and the arranged face images are used as search results. Therefore, since the cosine distance can preliminarily characterize the similarity between the pictures, by calculating the cosine distance, the plurality of face pictures ranked in the forefront most similar to the target face picture are first screened out as a candidate set for subsequent retrieval, therefore, The scope of the search can be narrowed, the retrieval speed can be improved, and the efficiency of face recognition can be improved.
图6示出了本发明实施例提供的人脸识别的装置的功能模块,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 6 is a functional block diagram of a device for face recognition according to an embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
参考图6,所述人脸识别的装置10所包括的各个模块用于执行图1对应实施例中的各个步骤,具体请参阅图1以及图1对应实施例中的相关描述,此处不再赘述。本发明实施例中,所述人脸识别的装置10包括特征向量提取 模块101、归一化模块102、融合特征向量获取模块103、参照相似度获取模块104、遍历获取模块105、训练模块106以及识别模块107。Referring to FIG. 6 , each module included in the apparatus 10 for face recognition is used to perform various steps in the corresponding embodiment of FIG. 1 . For details, refer to the related description in the corresponding embodiment of FIG. 1 and FIG. 1 . Narration. In the embodiment of the present invention, the device 10 for face recognition includes a feature vector extraction module 101, a normalization module 102, a fusion feature vector acquisition module 103, a reference similarity acquisition module 104, a traversal acquisition module 105, a training module 106, and Identification module 107.
所述特征向量提取模块101,用于根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量。The feature vector extraction module 101 is configured to extract feature vectors of any two samples in the preset training set according to the preset face feature extraction model.
所述归一化模块102,用于分别对所述任意两个样本的特征向量进行归一化处理。The normalization module 102 is configured to normalize the feature vectors of the any two samples separately.
所述融合特征向量获取模块103,用于获取所述任意两个样本的融合特征向量。The fusion feature vector obtaining module 103 is configured to acquire a fusion feature vector of the arbitrary two samples.
所述参照相似度获取模块104,用于获取所述任意两个样本的参照相似度。The reference similarity obtaining module 104 is configured to obtain a reference similarity of the any two samples.
所述遍历获取模块105,用于依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度。The traversal obtaining module 105 is configured to sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set.
所述训练模块106,用于根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型。The training module 106 is configured to determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model.
所述识别模块107,用于利用所述训练后的回归模型,对待识别的人脸图片进行识别。The identification module 107 is configured to identify the face image to be recognized by using the trained regression model.
在本发明实施例中,融合特征向量获取模块103对预设训练集中互不相同的两个样本的特征向量进行融合,训练模块106根据所有互不相同的两个样本的融合特征向量以及参照相似度训练回归模型,确定训练后的回归模型。融合特征向量包含了人脸图片的纹理特征和动态模式特征,因此,训练后的回归模型能够有效区分不同类别标记的样本,利用所述训练后的回归模型,对待识别的人脸图片进行识别时,可以有效提高人脸识别的效果和准确率。In the embodiment of the present invention, the fused feature vector obtaining module 103 fuses feature vectors of two samples that are different from each other in the preset training set, and the training module 106 combines the eigenvectors of the two samples that are different from each other and the reference similarity. The regression model is trained to determine the regression model after training. The fusion feature vector includes the texture feature and the dynamic mode feature of the face image. Therefore, the trained regression model can effectively distinguish the samples of different category markers, and use the trained regression model to identify the face image to be recognized. Can effectively improve the effect and accuracy of face recognition.
在较优的一实施例中,为了进一步的提高人脸识别的效果和准确率,所述融合特征向量获取模块103具体用于:In a preferred embodiment, in order to further improve the effect and accuracy of the face recognition, the fusion feature vector obtaining module 103 is specifically configured to:
将归一化后的所述任意两个样本的特征向量的对应维度的元素分别相乘,并将相乘的结果作为所述任意两个样本的融合特征向量的相应维度的元素,获得所述任意两个样本的融合特征向量。And multiplying the elements of the corresponding dimension of the normalized feature vectors of the two samples respectively, and using the multiplied result as the element of the corresponding dimension of the fusion feature vector of the arbitrary two samples, obtaining the A fused feature vector of any two samples.
图7示出了本发明实施例提供的人脸识别的装置中训练模块106的结构,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 7 shows the structure of the training module 106 in the device for face recognition according to the embodiment of the present invention. For the convenience of description, only the parts related to the embodiment of the present invention are shown, which are as follows:
在较优的一实施例中,参考图7,所述训练模块106所包括的各个单元用于执行图2对应实施例中的各个步骤,具体请参阅图2以及图2对应实施例中的相关描述,此处不再赘述。本发明实施例中,所述训练模块106包括第一获取单元1061、第二获取单元1062、误差确定单元1063、参数调整单元1064以及回归模型确定单元1065。In a preferred embodiment, with reference to FIG. 7, each unit included in the training module 106 is used to perform various steps in the corresponding embodiment of FIG. 2. For details, refer to the related embodiments in FIG. 2 and FIG. Description, no longer repeat here. In the embodiment of the present invention, the training module 106 includes a first obtaining unit 1061, a second obtaining unit 1062, an error determining unit 1063, a parameter adjusting unit 1064, and a regression model determining unit 1065.
所述第一获取单元1061,用于获取所述预设训练集的任一融合特征向量。The first acquiring unit 1061 is configured to acquire any fusion feature vector of the preset training set.
所述第二获取单元1062,用于将所述任一融合特征向量输入至回归模型,获得所述任一融合特征向量所对应的两个样本的训练相似度,其中,所述回归模型至少包括第一全连接层和第二全连接层,且所述第一全连接层和第二全连接层均采用激活函数对所述任一融合特征向量做特征映射变换。The second obtaining unit 1062 is configured to input any of the fusion feature vectors to a regression model, and obtain training similarity of two samples corresponding to any of the fusion feature vectors, wherein the regression model includes at least a first fully connected layer and a second fully connected layer, and the first fully connected layer and the second fully connected layer both perform feature mapping transformation on the any of the merged feature vectors by using an activation function.
所述误差确定单元1063,用于利用损失函数确定所述任一融合特征向量所对应的两个样本的训练相似度与所述任一融合特征向量所对应的两个样本的参照相似度的误差。The error determining unit 1063 is configured to determine, by using the loss function, an error of the similarity between the training similarity of the two samples corresponding to the any of the fusion feature vectors and the reference similarity of the two samples corresponding to the any of the fusion feature vectors. .
所述参数调整单元1064,用于若所述误差不满足预设收敛条件,则利用随机梯度下降通过反向传播的过程调整所述回归模型的所述第一全连接层的参数和所述第二全连接层的参数。The parameter adjustment unit 1064 is configured to adjust a parameter of the first fully connected layer of the regression model and the first step by using a process of back propagation by using a random gradient descent if the error does not satisfy a preset convergence condition. The parameters of the two fully connected layers.
所述回归模型确定单元1065,用于在所述误差满足预设收敛条件时,将满足预设收敛条件之前的最后一次迭代过程的第一全连接层的参数和第二全连接层的参数作为回归模型的第一全连接层的参数和第二全连接层的参数,确定训练后的回归模型。The regression model determining unit 1065 is configured to: when the error satisfies a preset convergence condition, use a parameter of the first fully connected layer and a parameter of the second fully connected layer that meet the last iteration process before the preset convergence condition The parameters of the first fully connected layer of the regression model and the parameters of the second fully connected layer are determined to determine the regression model after training.
在较优的一实施例中,所述预设收敛条件包括:In a preferred embodiment, the preset convergence condition includes:
所述误差小于或者等于预设的误差阈值或者所述误差所对应的误差百分比小于或者等于预设的误差百分比。The error is less than or equal to a preset error threshold or the error percentage corresponding to the error is less than or equal to a preset error percentage.
在本发明实施例中,预设训练集中的融合特征向量同时包含了人脸图片的纹理特征和动态模式特征,利用预设训练集的融合特征向量对回归模型进行训练,利用随机梯度下降通过反向传播的过程调整所述回归模型的参数,确定训练后的回归模型,因此,训练后的回归模型可以有效区分不同类别标记的样本,利用所述训练后的回归模型,对待识别的人脸图片进行识别时,可以有效提高人脸识别的效果和准确率。In the embodiment of the present invention, the fusion feature vector of the preset training set includes the texture feature and the dynamic mode feature of the face image, and the regression model is trained by using the fusion feature vector of the preset training set, and the random gradient is used to Adjusting the parameters of the regression model to the process of propagation, and determining the regression model after training, therefore, the trained regression model can effectively distinguish samples of different categories of markers, and use the trained regression model to treat the recognized face images When the recognition is performed, the effect and accuracy of face recognition can be effectively improved.
图8示出了本发明实施例提供的人脸识别的装置中识别模块107的结构,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 8 shows the structure of the identification module 107 in the device for face recognition according to the embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
在较优的一实施例中,参考图8,所述识别模块107所包括的各个单元用于执行图3对应实施例中的各个步骤,具体请参阅图3以及图3对应实施例中的相关描述,此处不再赘述。本发明实施例中,所述识别模块107包括融合特征向量获取单元201、第一相似度获取单元202以及确定单元203。In a preferred embodiment, with reference to FIG. 8, each unit included in the identification module 107 is used to perform various steps in the corresponding embodiment of FIG. 3. For details, refer to the related embodiments in FIG. 3 and FIG. Description, no longer repeat here. In the embodiment of the present invention, the identification module 107 includes a fusion feature vector acquisition unit 201, a first similarity acquisition unit 202, and a determination unit 203.
所述融合特征向量获取单元201,用于获取待验证的第一人脸图片和第二人脸图片的融合特征向量。The fused feature vector obtaining unit 201 is configured to acquire a fused feature vector of the first face image and the second face image to be verified.
所述第一相似度获取单元202,用于将所述第一人脸图片和所述第二人脸图片的融合特征向量输入至所述训练后的回归模型,获取所述第一人脸图片和所述第二人脸图片的相似度。The first similarity obtaining unit 202 is configured to input the fusion feature vector of the first facial image and the second facial image to the trained regression model to obtain the first facial image. The similarity with the second face picture.
所述确定单元203,用于若所述第一人脸图片和所述第二人脸图片的相似度大于或者等于预设相似度阈值,则确定所述第一人脸图片和所述第二人脸图片为同一人的人脸图片。The determining unit 203 is configured to determine the first face image and the second if the similarity between the first face image and the second face image is greater than or equal to a preset similarity threshold The face image is the face image of the same person.
所述确定单元203,还用于若所述第一人脸图片和所述第二人脸图片的相似度小于预设相似度阈值,则确定所述第一人脸图片和所述第二人脸图片不是同一人的人脸图片。The determining unit 203 is further configured to: if the similarity between the first face image and the second face image is less than a preset similarity threshold, determine the first face image and the second person The face image is not the face image of the same person.
在本发明实施例中,所述融合特征向量获取单元201获取待验证的第一人脸图片和第二人脸图片的融合特征向量,所述第一相似度获取单元202根据所述融合特征向量获取所述第一人脸图片和所述第二人脸图片的相似度,所述确定单元203将所述相似度与预设相似度阈值进行比较,进而确定所述第一人脸图片和所述第二人脸图片是否是同一人的人脸图片。本发明实施例,第一相似度获取单元202根据融合特征向量确定所述第一人脸图片和所述第二人脸图片的相似度,进而确定单元203确定所述第一人脸图片和所述第二人脸图片是否是同一人的人脸图片,因此,可以进一步的提高人脸识别的效果和准确率。In the embodiment of the present invention, the fusion feature vector obtaining unit 201 acquires a fusion feature vector of the first face image and the second face image to be verified, and the first similarity acquisition unit 202 is configured according to the fusion feature vector. Acquiring the similarity between the first face image and the second face image, the determining unit 203 compares the similarity with a preset similarity threshold, and further determines the first face image and the location Whether the second face image is a face image of the same person. In the embodiment of the present invention, the first similarity acquiring unit 202 determines the similarity between the first facial image and the second facial image according to the fusion feature vector, and the determining unit 203 determines the first facial image and the location. Whether the second face image is a face image of the same person, therefore, the effect and accuracy of the face recognition can be further improved.
图9示出了本发明实施例提供的人脸识别的装置中识别模块107的另一结构,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 9 shows another structure of the identification module 107 in the device for face recognition according to the embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
在较优的一实施例中,参考图9,所述识别模块107所包括的各个单元用于执行图4对应实施例中的各个步骤,具体请参阅图4以及图4对应实施例中的相关描述,此处不再赘述。本发明实施例中,所述识别模块107包括目标人脸图片获取单元301、特征向量提取单元302、融合特征向量确定单元303、第二相似度获取单元304以及检索结果确定单元305。In a preferred embodiment, with reference to FIG. 9, each unit included in the identification module 107 is used to perform various steps in the corresponding embodiment of FIG. 4. For details, refer to the related embodiments in FIG. 4 and FIG. Description, no longer repeat here. In the embodiment of the present invention, the identification module 107 includes a target face image acquisition unit 301, a feature vector extraction unit 302, a fusion feature vector determination unit 303, a second similarity acquisition unit 304, and a retrieval result determination unit 305.
所述目标人脸图片获取单元301,用于获取待检索的目标人脸图片。The target face image obtaining unit 301 is configured to acquire a target face image to be retrieved.
所述特征向量提取单元302,用于利用所述预设人脸特征提取模型分别提取所述目标人脸图片的特征向量以及预设检索数据库所包含的人脸图片的特征向量。The feature vector extracting unit 302 is configured to separately extract a feature vector of the target face image and a feature vector of a face image included in the preset search database by using the preset face feature extraction model.
所述融合特征向量确定单元303,用于分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量。The fused feature vector determining unit 303 is configured to respectively determine a fused feature vector of the feature vector of the target face image and the feature vector of each face image included in the preset search database.
所述第二相似度获取单元304,用于分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片与所述预设检索数据库所包含的每个人脸图片的相似度。The second similarity obtaining unit 304 is configured to input the feature vector of the target face image and the feature vector of the feature vector of each face image included in the preset search database to the training Regression model, and obtain similarity between the target face image and each face image included in the preset search database.
所述检索结果确定单元305,用于按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果。The search result determining unit 305 is configured to select, according to the similarity between the target face image and each face image included in the preset search database, the preset search database Each face image is arranged, and the arranged face image is used as a search result.
在本发明实施例中,利用融合特征向量和训练后的回归模型对图片进行识别,检索结果确定单元305按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果,因此,可以进一步提高人脸识别的效果和准确率。In the embodiment of the present invention, the image is identified by using the fusion feature vector and the trained regression model, and the retrieval result determination unit 305 is similar to each face image included in the target face image and the preset retrieval database. The face images included in the preset search database are arranged in descending order, and the arranged face images are used as search results. Therefore, the effect and accuracy of face recognition can be further improved.
图10示出了本发明实施例提供的人脸识别的装置中识别模块107的又一结构,为了便于说明,仅示出了与本发明实施例相关的部分,详述如下:FIG. 10 shows still another structure of the identification module 107 in the device for face recognition according to the embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown, which are described in detail as follows:
在较优的一实施例中,参考图10,所述识别模块107所包括的各个单元或者子单元用于执行图5对应实施例中的各个步骤,具体请参阅图5以及图5对应实施例中的相关描述,此处不再赘述。本发明实施例中,所述识别模块107在上述图9所示结构的基础上还包括余弦距离确定单元306以及候选集确定单元307。相应的,所述融合特征向量确定单元303包括融合特征向量确定子单元3031,所述第二相似度获取单元304包括相似度获取子单元3041,所述检索结果确定单元305包括检索结果确定子单元3051。In a preferred embodiment, referring to FIG. 10, each unit or subunit included in the identification module 107 is used to perform various steps in the corresponding embodiment of FIG. 5. For details, refer to FIG. 5 and FIG. The related descriptions are not repeated here. In the embodiment of the present invention, the identification module 107 further includes a cosine distance determining unit 306 and a candidate set determining unit 307 on the basis of the structure shown in FIG. 9 . Correspondingly, the fusion feature vector determining unit 303 includes a fusion feature vector determining subunit 3031, the second similarity acquiring unit 304 includes a similarity acquiring subunit 3041, and the retrieval result determining unit 305 includes a retrieval result determining subunit. 3051.
所述余弦距离确定单元306,用于分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离。The cosine distance determining unit 306 is configured to respectively determine a cosine distance of a feature vector of the target face image and a feature vector of each face image included in the preset search database.
所述候选集确定单元307,用于按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排在前N名的人脸图片作为候选集,其中,N为正整数。The candidate set determining unit 307 is configured to arrange the face images included in the preset search database according to the cosine distance from the largest to the smallest, and use the face images ranked in the top N as the candidate set. Where N is a positive integer.
所述融合特征向量确定子单元3031,用于分别确定所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量。The fused feature vector determining sub-unit 3031 is configured to respectively determine a fused feature vector of a feature vector of the target face image and a feature vector of each face image included in the candidate set.
所述相似度获取子单元3041,用于分别将所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度。The similarity acquisition sub-unit 3041 is configured to respectively input a feature vector of the target face image and a feature vector of a feature vector of each face image included in the candidate set to the trained regression model. And acquiring the similarity of the target face picture and each face picture included in the candidate set.
所述检索结果确定子单元3051,用于按照所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度由大到小的顺序对所述候选集所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果。The search result determining sub-unit 3051 is configured to select a face image included in the candidate set according to the similarity degree of the target face picture and each face picture included in the candidate set in descending order Arrange and arrange the arranged face images as the search results.
在本发明实施例,余弦距离确定单元306确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离,候选集确定单元307按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排在前N名的人脸图片作为候选集,检索结果确定子单元3051按照所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度由大到小的顺序对所述候选集所包含的人脸图片进行排列,并 将排列后的人脸图片作为检索结果,鉴于余弦距离能够初步表征图片之间的相似度,通过计算余弦距离,将与目标人脸图片最为相似的排在前列的多个人脸图片首先筛选出来,作为后续检索的候选集,因此,可以缩小检索的范围、提高检索速度,进而提高人脸识别的效率。In the embodiment of the present invention, the cosine distance determining unit 306 determines a cosine distance of the feature vector of the target face image and a feature vector of each face image included in the preset search database, and the candidate set determining unit 307 follows the cosine distance. The face images included in the preset search database are arranged in descending order, and the face images ranked in the top N are used as candidate sets, and the search result determining subunit 3051 follows the target face image. And matching the face images included in the candidate set with the similarity degree of each face image included in the candidate set, and arranging the arranged face images as a retrieval result, in view of the cosine distance It is possible to preliminarily characterize the similarity between pictures, and by calculating the cosine distance, the plurality of face pictures ranked in the forefront most similar to the target face picture are first screened out as a candidate set for subsequent retrieval, thereby narrowing the scope of the search. Improve search speed and improve the efficiency of face recognition.
图11是本发明实施例提供的实现人脸识别的方法的较佳实施例的计算机装置1的结构示意图。如图11所示,计算机装置1包括存储器11、处理器12及输入输出设备13。FIG. 11 is a schematic structural diagram of a computer apparatus 1 according to a preferred embodiment of a method for implementing face recognition according to an embodiment of the present invention. As shown in FIG. 11, the computer device 1 includes a memory 11, a processor 12, and an input/output device 13.
所述计算机装置1是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。The computer device 1 is a device capable of automatically performing numerical calculation and/or information processing according to an instruction set or stored in advance, and the hardware includes, but not limited to, a microprocessor, an application specific integrated circuit (ASIC). ), Field-Programmable Gate Array (FPGA), Digital Signal Processor (DSP), embedded devices, etc.
所述计算机装置1可以是任何一种可与用户进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal DigitalAssistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能式穿戴式设备等。所述计算机装置1可以是服务器,所述服务器包括但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络服务器构成的云,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。所述计算机装置1所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用网络(Virtual Private Network,VPN)等。The computer device 1 can be any electronic product that can interact with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game machine, an interactive network television ( Internet Protocol Television (IPTV), smart wearable devices, etc. The computer device 1 may be a server, including but not limited to a single network server, a server group composed of a plurality of network servers, or a cloud computing-based cloud composed of a large number of hosts or network servers, wherein the cloud Computation is a type of distributed computing, a super-virtual computer consisting of a cluster of loosely coupled computers. The network in which the computer device 1 is located includes, but is not limited to, the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), and the like.
存储器11用于存储人脸识别的方法的程序和各种数据,并在计算机装置1运行过程中实现高速、自动地完成程序或数据的存取。存储器11可以是计算机装置1的外部存储设备和/或内部存储设备。进一步地,存储器11可以是集成电路中没有实物形式的具有存储功能的电路,如RAM(Random-Access Memory,随机存取存储设备)、FIFO(First In First Out,)等,或者,存储器11也可以是具有实物形式的存储设备,如内存条、TF卡(Trans-flash Card)等等。The memory 11 is used to store programs of various methods of face recognition and various data, and realizes high-speed, automatic completion of access of programs or data during the operation of the computer device 1. The memory 11 may be an external storage device and/or an internal storage device of the computer device 1. Further, the memory 11 may be a circuit having a storage function in a physical form, such as a RAM (Random-Access Memory), a FIFO (First In First Out), or the like, or the memory 11 It may be a storage device having a physical form, such as a memory stick, a TF card (Trans-flash Card), or the like.
处理器12可以是中央处理器(CPU,Central Processing Unit)。CPU是一块超大规模的集成电路,是计算机装置1的运算核心(Core)和控制核心(Control Unit)。处理器12可执行计算机装置1的操作系统以及安装的各类应用程序、程序代码等,例如执行人脸识别的装置10中的各个模块或者单元中的操作系统以及安装的各类应用程序、程序代码,以实现人脸识别的方法。The processor 12 can be a Central Processing Unit (CPU). The CPU is a very large-scale integrated circuit, which is the computing core (Core) and the Control Unit of the computer device 1. The processor 12 can execute an operating system of the computer device 1 and various installed applications, program codes, and the like, such as an operating system in each module or unit in the device 10 for performing face recognition, and various installed applications and programs. Code to implement face recognition methods.
输入输出设备13主要用于实现计算机装置1的输入输出功能,比如收发输入的数字或字符信息,或显示由用户输入的信息或提供给用户的信息以及计算机装置1的各种菜单。The input/output device 13 is mainly used to implement an input/output function of the computer device 1, such as transceiving input digital or character information, or displaying information input by a user or information provided to a user and various menus of the computer device 1.
所述计算机装置1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access  Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述计算机可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,计算机可读介质不包括电载波信号和电信信号。The modules/units integrated by the computer device 1 can be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the present invention implements all or part of the processes in the foregoing embodiments, and may also be completed by a computer program to instruct related hardware. The computer program may be stored in a computer readable storage medium. The steps of the various method embodiments described above may be implemented when the program is executed by the processor. Wherein, the computer program comprises computer program code, which may be in the form of source code, object code form, executable file or some intermediate form. The computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM). , random access memory (RAM, Random Access Memory), electrical carrier signals, telecommunications signals, and software distribution media. It should be noted that the content contained in the computer readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in a jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, computer readable media Does not include electrical carrier signals and telecommunication signals.
以上说明的本发明的特征性的手段可以通过集成电路来实现,并控制实现上述任意实施例中所述活体检测方法的功能。即,本发明的集成电路安装于所述计算机装置1中,使所述计算机装置1发挥如下功能:The above-described characteristic means of the present invention can be realized by an integrated circuit and control the function of the living body detecting method described in any of the above embodiments. That is, the integrated circuit of the present invention is mounted in the computer device 1 such that the computer device 1 functions as follows:
根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量;Extracting feature vectors of any two samples in the preset training set according to the preset face feature extraction model;
分别对所述任意两个样本的特征向量进行归一化处理;Normalizing the feature vectors of any two samples;
获取所述任意两个样本的融合特征向量;Obtaining a fusion feature vector of any two samples;
获取所述任意两个样本的参照相似度;Obtaining a reference similarity of any two samples;
依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度;And sequentially traversing all the two samples that are different from each other in the preset training set, and obtaining a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set;
根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型;Determining the trained regression model according to the fusion feature vector of the two different samples and the reference similarity training regression model in the preset training set;
利用所述训练后的回归模型,对待识别的人脸图片进行识别。The face image to be recognized is identified by using the trained regression model.
在任意实施例中所述活体检测方法所能实现的功能都能通过本发明的集成电路安装于所述计算机装置1中,使所述计算机装置1发挥任意实施例中所述活体检测方法所能实现的功能,在此不再详述。In any of the embodiments, the functions of the living body detecting method can be installed in the computer device 1 by the integrated circuit of the present invention, so that the computer device 1 can perform the living body detecting method in any of the embodiments. The functions implemented are not detailed here.
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and the actual implementation may have another division manner.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software function modules.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个模块或装置也可以由一个模块或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。It is apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and the present invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the present embodiments are to be considered as illustrative and not restrictive, and the scope of the invention is defined by the appended claims instead All changes in the meaning and scope of equivalent elements are included in the present invention. Any accompanying drawings in the claims should not be construed as limiting the claim. In addition, it is to be understood that the word "comprising" does not exclude other elements or steps. A plurality of modules or devices recited in the system claims may also be implemented by a module or device by software or hardware. The first, second, etc. words are used to denote names and do not denote any particular order.
最后应说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或等同替换,而不脱离本发明技术方案的精神和范围。It should be noted that the above embodiments are only for explaining the technical solutions of the present invention and are not intended to be limiting, and the present invention will be described in detail with reference to the preferred embodiments. Modifications or equivalents are made without departing from the spirit and scope of the invention.

Claims (11)

  1. 一种人脸识别的方法,其特征在于,所述方法包括:A method for face recognition, characterized in that the method comprises:
    根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量;Extracting feature vectors of any two samples in the preset training set according to the preset face feature extraction model;
    分别对所述任意两个样本的特征向量进行归一化处理;Normalizing the feature vectors of any two samples;
    获取所述任意两个样本的融合特征向量;Obtaining a fusion feature vector of any two samples;
    获取所述任意两个样本的参照相似度;Obtaining a reference similarity of any two samples;
    依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度;And sequentially traversing all the two samples that are different from each other in the preset training set, and obtaining a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set;
    根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型;Determining the trained regression model according to the fusion feature vector of the two different samples and the reference similarity training regression model in the preset training set;
    利用所述训练后的回归模型,对待识别的人脸图片进行识别。The face image to be recognized is identified by using the trained regression model.
  2. 如权利要求1所述的方法,其特征在于,所述获取所述任意两个样本的融合特征向量包括:The method according to claim 1, wherein the acquiring the fused feature vector of the arbitrary two samples comprises:
    将归一化后的所述任意两个样本的特征向量的对应维度的元素分别相乘,并将相乘的结果作为所述任意两个样本的融合特征向量的相应维度的元素,获得所述任意两个样本的融合特征向量。And multiplying the elements of the corresponding dimension of the normalized feature vectors of the two samples respectively, and using the multiplied result as the element of the corresponding dimension of the fusion feature vector of the arbitrary two samples, obtaining the A fused feature vector of any two samples.
  3. 如权利要求1所述的方法,其特征在于,所述预设训练集包括样本所对应的类别标记,所述获取所述任意两个样本的参照相似度包括:The method according to claim 1, wherein the preset training set includes a category mark corresponding to the sample, and the reference similarity for acquiring the any two samples comprises:
    确定归一化后的所述任意两个样本的特征向量的余弦距离;Determining a cosine distance of a feature vector of the normalized two samples;
    若所述任意两个样本的类别标记相同,则所述任意两个样本的参照相似度为所述余弦距离与预设常数的和;If the class labels of the two samples are the same, the reference similarity of the two samples is the sum of the cosine distance and the preset constant;
    若所述任意两个样本的类别标记不同,则所述任意两个样本的参照相似度为所述余弦距离与所述预设常数的差。If the class labels of the two samples are different, the reference similarity of the two samples is the difference between the cosine distance and the preset constant.
  4. 如权利要求1所述的方法,其特征在于,所述根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型包括:The method according to claim 1, wherein the regression model is determined according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training model, and the regression model after the training is determined to include:
    获取所述预设训练集的任一融合特征向量;Obtaining any fusion feature vector of the preset training set;
    将所述任一融合特征向量输入至回归模型,获得所述任一融合特征向量所对应的两个样本的训练相似度,其中,所述回归模型至少包括第一全连接层和第二全连接层,且所述第一全连接层和第二全连接层均采用激活函数对所述任一融合特征向量做特征映射变换;Entering any of the fusion feature vectors into a regression model to obtain training similarity of two samples corresponding to any of the fusion feature vectors, wherein the regression model includes at least a first fully connected layer and a second fully connected a layer, and the first fully connected layer and the second fully connected layer respectively perform feature mapping transformation on the any of the fusion feature vectors by using an activation function;
    利用损失函数确定所述任一融合特征向量所对应的两个样本的训练相似度与所述任一融合特征向量所对应的两个样本的参照相似度的误差;Determining, by using the loss function, an error of a training similarity of two samples corresponding to any one of the fusion feature vectors and a reference similarity of two samples corresponding to the one of the fusion feature vectors;
    若所述误差不满足预设收敛条件,则利用随机梯度下降通过反向传播的过程调整所述回归模型的所述第一全连接层的参数和所述第二全连接层的参数;If the error does not satisfy the preset convergence condition, the parameter of the first fully connected layer and the parameter of the second fully connected layer of the regression model are adjusted by a process of back propagation using a random gradient descent;
    重复上述迭代过程,直至所述误差满足预设收敛条件,将满足预设收敛条 件之前的最后一次迭代过程的第一全连接层的参数和第二全连接层的参数作为回归模型的第一全连接层的参数和第二全连接层的参数,确定训练后的回归模型。The above iterative process is repeated until the error satisfies the preset convergence condition, and the parameters of the first fully connected layer and the parameters of the second fully connected layer of the last iterative process before the preset convergence condition are used as the first full regression model The parameters of the connection layer and the parameters of the second fully connected layer determine the regression model after training.
  5. 如权利要求4所述的方法,其特征在于,所述预设收敛条件包括:The method of claim 4, wherein the predetermined convergence condition comprises:
    所述误差小于或者等于预设的误差阈值或者所述误差所对应的误差百分比小于或者等于预设的误差百分比。The error is less than or equal to a preset error threshold or the error percentage corresponding to the error is less than or equal to a preset error percentage.
  6. 如权利要求1所述的方法,其特征在于,所述利用所述训练后的回归模型,对待识别的人脸图片进行识别包括:The method according to claim 1, wherein the identifying the face image to be recognized by using the trained regression model comprises:
    获取待验证的第一人脸图片和第二人脸图片的融合特征向量;Obtaining a fusion feature vector of the first face image and the second face image to be verified;
    将所述第一人脸图片和所述第二人脸图片的融合特征向量输入至所述训练后的回归模型,获取所述第一人脸图片和所述第二人脸图片的相似度;And inputting a fusion feature vector of the first face image and the second face image to the trained regression model, and acquiring a similarity between the first face image and the second face image;
    若所述第一人脸图片和所述第二人脸图片的相似度大于或者等于预设相似度阈值,则确定所述第一人脸图片和所述第二人脸图片为同一人的人脸图片;If the similarity between the first face image and the second face image is greater than or equal to a preset similarity threshold, determining that the first face image and the second face image are the same person Face picture
    若所述第一人脸图片和所述第二人脸图片的相似度小于预设相似度阈值,则确定所述第一人脸图片和所述第二人脸图片不是同一人的人脸图片。If the similarity between the first face image and the second face image is less than a preset similarity threshold, determining that the first face image and the second face image are not the same person's face image .
  7. 如权利要求1所述的方法,其特征在于,所述利用所述训练后的回归模型,对待识别的人脸图片进行识别包括:The method according to claim 1, wherein the identifying the face image to be recognized by using the trained regression model comprises:
    获取待检索的目标人脸图片;Obtaining a target face image to be retrieved;
    利用所述预设人脸特征提取模型分别提取所述目标人脸图片的特征向量以及预设检索数据库所包含的人脸图片的特征向量;Extracting a feature vector of the target face image and a feature vector of a face image included in the preset search database by using the preset face feature extraction model;
    分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量;Determining, respectively, a feature vector of the feature vector of the target face image and a feature vector of each face image included in the preset search database;
    分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片与所述预设检索数据库所包含的每个人脸图片的相似度;Inputting a feature vector of the target face image and a feature vector of the feature vector of each face image included in the preset search database to the trained regression model, and acquiring the target face image a similarity to each face image included in the preset retrieval database;
    按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的每个人脸图片进行排列,并将排列后的人脸图片作为检索结果。Arranging each face image included in the preset search database in descending order of the similarity between the target face image and each face image included in the preset search database, and arranging The face image after the search is used as the search result.
  8. 如权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7 wherein the method further comprises:
    分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的余弦距离;Determining, respectively, a feature vector of the target face image and a cosine distance of a feature vector of each face image included in the preset search database;
    按照余弦距离由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排在前N名的人脸图片作为候选集,其中,N为正整数;The face images included in the preset search database are arranged in descending order of cosine distance, and the face images ranked in the top N are used as candidate sets, where N is a positive integer;
    所述分别确定所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量包括:The fusion feature vector for determining the feature vector of the target face image and the feature vector of each face image included in the preset search database respectively includes:
    分别确定所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量;Determining, respectively, a feature vector of the feature vector of the target face image and a feature vector of each face image included in the candidate set;
    所述分别将所述目标人脸图片的特征向量与所述预设检索数据库所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度包括:And inputting a feature vector of the target face image and a feature vector of the feature vector of each face image included in the preset search database to the trained regression model, and acquiring the target person The similarity between the face picture and each face picture included in the preset search database includes:
    分别将所述目标人脸图片的特征向量与所述候选集所包含的每个人脸图片的特征向量的融合特征向量输入至所述训练后的回归模型,并获取所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度;And respectively inputting a feature vector of the target face image and a feature vector of the feature vector of each face image included in the candidate set to the trained regression model, and acquiring the target face image and the location Comparing the similarity of each face picture included in the candidate set;
    所述按照所述目标人脸图片和所述预设检索数据库所包含的每个人脸图片的相似度由大到小的顺序对所述预设检索数据库所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果包括:And arranging, according to the similarity degree of each of the face images included in the target face image and the preset search database, the face images included in the preset search database, and The arranged face images as search results include:
    按照所述目标人脸图片和所述候选集所包含的每个人脸图片的相似度由大到小的顺序对所述候选集所包含的人脸图片进行排列,并将排列后的人脸图片作为检索结果。Arranging the face images included in the candidate set in descending order of the similarity between the target face picture and each face picture included in the candidate set, and arranging the arranged face pictures As a result of the search.
  9. 一种人脸识别的装置,其特征在于,所述装置包括:A device for recognizing a face, characterized in that the device comprises:
    特征向量提取模块,用于根据预设的人脸特征提取模型提取预设训练集中任意两个样本的特征向量,所述预设训练集包括样本所对应的类别标记;And a feature vector extraction module, configured to extract feature vectors of any two samples in the preset training set according to the preset face feature extraction model, where the preset training set includes a category tag corresponding to the sample;
    归一化模块,用于分别对所述任意两个样本的特征向量进行归一化处理;a normalization module, configured to respectively normalize feature vectors of any two samples;
    融合特征向量获取模块,用于获取所述任意两个样本的融合特征向量a fusion feature vector acquisition module, configured to acquire a fusion feature vector of any two samples
    参照相似度获取模块,用于获取所述任意两个样本的参照相似度;Referring to a similarity obtaining module, configured to acquire a reference similarity of the any two samples;
    遍历获取模块,用于依次遍历所述预设训练集中所有互不相同的两个样本,获得所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度;a traversing acquisition module, configured to sequentially traverse all the two samples that are different from each other in the preset training set, and obtain a fusion feature vector and a reference similarity of all the two samples that are different from each other in the preset training set;
    训练模块,用于根据所述预设训练集中所有互不相同的两个样本的融合特征向量和参照相似度训练回归模型,确定训练后的回归模型;a training module, configured to determine a regression model after training according to the fusion feature vector of the two samples that are different from each other in the preset training set and the reference similarity training regression model;
    识别模块,用于利用所述训练后的回归模型,对待识别的人脸图片进行识别。The identification module is configured to identify the face image to be recognized by using the trained regression model.
  10. 一种计算机装置,其特征在于,所述计算机装置包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如权利要求1-8中任意一项所述人脸识别的方法。A computer apparatus, comprising: a processor, the processor for performing a face recognition method according to any one of claims 1-8 when executing a computer program stored in a memory.
  11. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至8任意一项所述人脸识别的方法。A computer readable storage medium having stored thereon a computer program, wherein the computer program is executed by a processor to implement the method of face recognition according to any one of claims 1 to 8.
PCT/CN2017/119465 2017-12-18 2017-12-28 Face recognition method and device, computer device and storage medium WO2019119505A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711366133.0 2017-12-18
CN201711366133.0A CN108197532B (en) 2017-12-18 2017-12-18 The method, apparatus and computer installation of recognition of face

Publications (1)

Publication Number Publication Date
WO2019119505A1 true WO2019119505A1 (en) 2019-06-27

Family

ID=62574509

Family Applications (2)

Application Number Title Priority Date Filing Date
PCT/CN2017/119465 WO2019119505A1 (en) 2017-12-18 2017-12-28 Face recognition method and device, computer device and storage medium
PCT/CN2018/120513 WO2019120115A1 (en) 2017-12-18 2018-12-12 Facial recognition method, apparatus, and computer apparatus

Family Applications After (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/120513 WO2019120115A1 (en) 2017-12-18 2018-12-12 Facial recognition method, apparatus, and computer apparatus

Country Status (2)

Country Link
CN (1) CN108197532B (en)
WO (2) WO2019119505A1 (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110414588A (en) * 2019-07-23 2019-11-05 广东小天才科技有限公司 Picture mask method, device, computer equipment and storage medium
CN110674748A (en) * 2019-09-24 2020-01-10 腾讯科技(深圳)有限公司 Image data processing method, image data processing device, computer equipment and readable storage medium
CN111209860A (en) * 2020-01-06 2020-05-29 上海海事大学 Video attendance system and method based on deep learning and reinforcement learning
CN111325156A (en) * 2020-02-24 2020-06-23 北京沃东天骏信息技术有限公司 Face recognition method, device, equipment and storage medium
CN111860165A (en) * 2020-06-18 2020-10-30 盛视科技股份有限公司 Dynamic face recognition method and device based on video stream
CN111968152A (en) * 2020-07-15 2020-11-20 桂林远望智能通信科技有限公司 Dynamic identity recognition method and device
CN112101172A (en) * 2020-09-08 2020-12-18 平安科技(深圳)有限公司 Weight grafting-based model fusion face recognition method and related equipment
CN112418303A (en) * 2020-11-20 2021-02-26 浙江大华技术股份有限公司 Training method and device for recognizing state model and computer equipment
CN112633297A (en) * 2020-12-28 2021-04-09 浙江大华技术股份有限公司 Target object identification method and device, storage medium and electronic device
CN112991154A (en) * 2021-03-17 2021-06-18 福建库克智能科技有限公司 Mixture manufacturing method, mixture and method for generating picture of face mask
CN112990090A (en) * 2021-04-09 2021-06-18 北京华捷艾米科技有限公司 Face living body detection method and device
CN113177449A (en) * 2021-04-20 2021-07-27 北京百度网讯科技有限公司 Face recognition method and device, computer equipment and storage medium
CN113269010A (en) * 2020-02-14 2021-08-17 深圳云天励飞技术有限公司 Training method and related device for human face living body detection model
CN114565979A (en) * 2022-03-04 2022-05-31 中国科学技术大学 Pedestrian re-identification method, system, equipment and storage medium
CN115690443A (en) * 2022-09-29 2023-02-03 北京百度网讯科技有限公司 Feature extraction model training method, image classification method and related device
US11881052B2 (en) 2019-08-15 2024-01-23 Huawei Technologies Co., Ltd. Face search method and apparatus

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108197532B (en) * 2017-12-18 2019-08-16 深圳励飞科技有限公司 The method, apparatus and computer installation of recognition of face
CN108921071A (en) * 2018-06-24 2018-11-30 深圳市中悦科技有限公司 Human face in-vivo detection method, device, storage medium and processor
CN109063698B (en) * 2018-10-23 2022-03-08 深圳大学 Non-negative feature extraction and face recognition application method, system and storage medium
CN109583332B (en) * 2018-11-15 2021-07-27 北京三快在线科技有限公司 Face recognition method, face recognition system, medium, and electronic device
CN110070046A (en) * 2019-04-23 2019-07-30 北京市商汤科技开发有限公司 Facial image recognition method and device, electronic equipment and storage medium
CN110427870A (en) * 2019-06-10 2019-11-08 腾讯医疗健康(深圳)有限公司 Eye image identification method, Model of Target Recognition training method and device
CN110415424B (en) * 2019-06-17 2022-02-11 众安信息技术服务有限公司 Anti-counterfeiting identification method and device, computer equipment and storage medium
CN112445992B (en) * 2019-09-03 2024-02-20 阿里巴巴集团控股有限公司 Information processing method and device
CN111091080A (en) * 2019-12-06 2020-05-01 贵州电网有限责任公司 Face recognition method and system
CN111144240B (en) * 2019-12-12 2023-02-07 深圳数联天下智能科技有限公司 Image processing method and related equipment
CN111368644B (en) * 2020-02-14 2024-01-05 深圳市商汤科技有限公司 Image processing method, device, electronic equipment and storage medium
CN111339884B (en) * 2020-02-19 2023-06-06 浙江大华技术股份有限公司 Image recognition method, related device and apparatus
CN111598818B (en) * 2020-04-17 2023-04-28 北京百度网讯科技有限公司 Training method and device for face fusion model and electronic equipment
CN111555889A (en) * 2020-04-27 2020-08-18 深圳壹账通智能科技有限公司 Electronic signature verification method and device, computer equipment and storage medium
CN111709303A (en) * 2020-05-21 2020-09-25 北京明略软件系统有限公司 Face image recognition method and device
CN114372205B (en) * 2022-03-22 2022-06-10 腾讯科技(深圳)有限公司 Training method, device and equipment of characteristic quantization model

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978550A (en) * 2014-04-08 2015-10-14 上海骏聿数码科技有限公司 Face recognition method and system based on large-scale face database
US20160070956A1 (en) * 2014-09-05 2016-03-10 Huawei Technologies Co., Ltd. Method and Apparatus for Generating Facial Feature Verification Model
CN106250858A (en) * 2016-08-05 2016-12-21 重庆中科云丛科技有限公司 A kind of recognition methods merging multiple face recognition algorithms and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7356168B2 (en) * 2004-04-23 2008-04-08 Hitachi, Ltd. Biometric verification system and method utilizing a data classifier and fusion model
CN104715254B (en) * 2015-03-17 2017-10-10 东南大学 A kind of general object identification method merged based on 2D and 3D SIFT features
CN107292146B (en) * 2016-03-30 2019-12-13 中国联合网络通信集团有限公司 User feature vector selection method and system
CN108197532B (en) * 2017-12-18 2019-08-16 深圳励飞科技有限公司 The method, apparatus and computer installation of recognition of face

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104978550A (en) * 2014-04-08 2015-10-14 上海骏聿数码科技有限公司 Face recognition method and system based on large-scale face database
US20160070956A1 (en) * 2014-09-05 2016-03-10 Huawei Technologies Co., Ltd. Method and Apparatus for Generating Facial Feature Verification Model
CN106250858A (en) * 2016-08-05 2016-12-21 重庆中科云丛科技有限公司 A kind of recognition methods merging multiple face recognition algorithms and system

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110414588A (en) * 2019-07-23 2019-11-05 广东小天才科技有限公司 Picture mask method, device, computer equipment and storage medium
US11881052B2 (en) 2019-08-15 2024-01-23 Huawei Technologies Co., Ltd. Face search method and apparatus
CN110674748A (en) * 2019-09-24 2020-01-10 腾讯科技(深圳)有限公司 Image data processing method, image data processing device, computer equipment and readable storage medium
CN110674748B (en) * 2019-09-24 2024-02-13 腾讯科技(深圳)有限公司 Image data processing method, apparatus, computer device, and readable storage medium
CN111209860A (en) * 2020-01-06 2020-05-29 上海海事大学 Video attendance system and method based on deep learning and reinforcement learning
CN111209860B (en) * 2020-01-06 2023-04-07 上海海事大学 Video attendance system and method based on deep learning and reinforcement learning
CN113269010B (en) * 2020-02-14 2024-03-26 深圳云天励飞技术有限公司 Training method and related device for human face living body detection model
CN113269010A (en) * 2020-02-14 2021-08-17 深圳云天励飞技术有限公司 Training method and related device for human face living body detection model
CN111325156A (en) * 2020-02-24 2020-06-23 北京沃东天骏信息技术有限公司 Face recognition method, device, equipment and storage medium
CN111325156B (en) * 2020-02-24 2023-08-11 北京沃东天骏信息技术有限公司 Face recognition method, device, equipment and storage medium
CN111860165A (en) * 2020-06-18 2020-10-30 盛视科技股份有限公司 Dynamic face recognition method and device based on video stream
CN111860165B (en) * 2020-06-18 2023-11-03 盛视科技股份有限公司 Dynamic face recognition method and device based on video stream
CN111968152A (en) * 2020-07-15 2020-11-20 桂林远望智能通信科技有限公司 Dynamic identity recognition method and device
CN111968152B (en) * 2020-07-15 2023-10-17 桂林远望智能通信科技有限公司 Dynamic identity recognition method and device
CN112101172A (en) * 2020-09-08 2020-12-18 平安科技(深圳)有限公司 Weight grafting-based model fusion face recognition method and related equipment
CN112101172B (en) * 2020-09-08 2023-09-08 平安科技(深圳)有限公司 Weight grafting-based model fusion face recognition method and related equipment
CN112418303A (en) * 2020-11-20 2021-02-26 浙江大华技术股份有限公司 Training method and device for recognizing state model and computer equipment
CN112633297B (en) * 2020-12-28 2023-04-07 浙江大华技术股份有限公司 Target object identification method and device, storage medium and electronic device
CN112633297A (en) * 2020-12-28 2021-04-09 浙江大华技术股份有限公司 Target object identification method and device, storage medium and electronic device
CN112991154B (en) * 2021-03-17 2023-10-17 福建库克智能科技有限公司 Method for producing mixture, and method for producing picture of face mask
CN112991154A (en) * 2021-03-17 2021-06-18 福建库克智能科技有限公司 Mixture manufacturing method, mixture and method for generating picture of face mask
CN112990090A (en) * 2021-04-09 2021-06-18 北京华捷艾米科技有限公司 Face living body detection method and device
CN113177449A (en) * 2021-04-20 2021-07-27 北京百度网讯科技有限公司 Face recognition method and device, computer equipment and storage medium
CN113177449B (en) * 2021-04-20 2024-02-02 北京百度网讯科技有限公司 Face recognition method, device, computer equipment and storage medium
CN114565979A (en) * 2022-03-04 2022-05-31 中国科学技术大学 Pedestrian re-identification method, system, equipment and storage medium
CN114565979B (en) * 2022-03-04 2024-03-29 中国科学技术大学 Pedestrian re-identification method, system, equipment and storage medium
CN115690443A (en) * 2022-09-29 2023-02-03 北京百度网讯科技有限公司 Feature extraction model training method, image classification method and related device

Also Published As

Publication number Publication date
CN108197532B (en) 2019-08-16
WO2019120115A1 (en) 2019-06-27
CN108197532A (en) 2018-06-22

Similar Documents

Publication Publication Date Title
WO2019120115A1 (en) Facial recognition method, apparatus, and computer apparatus
WO2019200781A1 (en) Receipt recognition method and device, and storage medium
CN111062871B (en) Image processing method and device, computer equipment and readable storage medium
WO2020119350A1 (en) Video classification method and apparatus, and computer device and storage medium
WO2021218060A1 (en) Face recognition method and device based on deep learning
WO2019109526A1 (en) Method and device for age recognition of face image, storage medium
WO2021159613A1 (en) Text semantic similarity analysis method and apparatus, and computer device
WO2020155939A1 (en) Image recognition method and device, storage medium and processor
US20210374386A1 (en) Entity recognition from an image
WO2019200782A1 (en) Sample data classification method, model training method, electronic device and storage medium
CN110503076B (en) Video classification method, device, equipment and medium based on artificial intelligence
US20230087657A1 (en) Assessing face image quality for application of facial recognition
WO2020087774A1 (en) Concept-tree-based intention recognition method and apparatus, and computer device
US11126827B2 (en) Method and system for image identification
CN108197592B (en) Information acquisition method and device
CN108550065B (en) Comment data processing method, device and equipment
WO2020019591A1 (en) Method and device used for generating information
WO2022105118A1 (en) Image-based health status identification method and apparatus, device and storage medium
JP2022141931A (en) Method and device for training living body detection model, method and apparatus for living body detection, electronic apparatus, storage medium, and computer program
Haji et al. Real time face recognition system (RTFRS)
WO2023123923A1 (en) Human body weight identification method, human body weight identification device, computer device, and medium
WO2021051602A1 (en) Lip password-based face recognition method and system, device, and storage medium
CN116311370A (en) Multi-angle feature-based cow face recognition method and related equipment thereof
CN110175500B (en) Finger vein comparison method, device, computer equipment and storage medium
US8086616B1 (en) Systems and methods for selecting interest point descriptors for object recognition

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17935688

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 21/09/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17935688

Country of ref document: EP

Kind code of ref document: A1