Face recognition method and device, neural network
The similarity is corrected by the offset of the face image, and the neural network is used to unify the similarity thresholds of different categories, which solves the problem of low face recognition accuracy in multi-category object scenes and improves recognition accuracy and user experience.
Patent Information
- Application Number
- CN202110721897.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-06-28
AI Technical Summary
Existing face recognition technology has low accuracy in multi-category object scenes, resulting in large differences in similarity thresholds for different categories of objects, affecting recognition accuracy.
By obtaining the offset of the face image, it represents the difference between the similarity threshold of the category to which it belongs under the preset misrecognition rate and the similarity threshold of the reference category under the same misrecognition rate, corrects the similarity, and uses a neural network Implement feature extraction and offset output to unify the similarity thresholds of different categories for face recognition.
It improves the accuracy of face recognition, reduces complexity, achieves balanced recognition effects of different categories of objects, and improves user experience and traffic efficiency.
Smart Images

Figure CN113255594B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of face recognition technology, and in particular to a face recognition method and device, and a neural network. Background Art
[0002] Face recognition is one of the most widely used biometric technologies and the most common algorithm in the security field. It has mature applications in many scenarios such as ID verification, access control, and criminal search. When performing face recognition, a pixel threshold is generally set, and the similarity of two face images is compared with the similarity threshold. If the similarity of the two face images is higher than the similarity threshold, the two face images are considered to be the face images of the same object, otherwise they are considered to be the face images of different objects. With the continuous deepening of globalization, there is a high degree of diversity in objects in different regions. The similarity thresholds corresponding to objects of different categories often differ greatly, resulting in low accuracy in face recognition of multi-category object images. Summary of the invention
[0003] The present invention provides a face recognition method and device, and a neural network.
[0004] According to a first aspect of an embodiment of the present disclosure, a face recognition method is provided, the method comprising: obtaining a bias of a category to which a first face image belongs; the bias is used to characterize the difference between a first similarity threshold corresponding to the category to which the first face image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first face image and the second face image as face images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the face image of the reference category and a third face image as face images of the same object; correcting the similarity between the first face image and the second face image based on the bias; and performing face recognition on the first face image based on the corrected similarity and the second similarity threshold.
[0005] In some embodiments, the method also includes: obtaining N first sample face images and M second sample face images; the category to which the first sample face image belongs and the category to which the second sample face image belongs are the same as the category to which the first face image belongs; M and N are positive integers; for each of the N first sample face images, determining the similarity between the first sample face image and each second sample face image respectively; based on the similarity between the first sample face image and the second sample face image, determining a first similarity threshold corresponding to the category to which the first face image belongs at the error recognition rate.
[0006] In some embodiments, the face recognition of the first face image based on the corrected similarity and the second similarity threshold includes: when the corrected similarity is greater than the second similarity threshold, determining that the first face image and the second face image are face images of the same object; and / or when the corrected similarity is not greater than the second similarity threshold, determining that the first face image and the second image are face images of different objects.
[0007] In some embodiments, the method is implemented by a neural network, which includes: a feature extraction network, used to extract features from the first face image to obtain features of the first face image; a bias output network, used to determine the first similarity threshold based on the features of the first face image, and determine the bias based on the first similarity threshold and the second similarity threshold.
[0008] In some embodiments, the method further includes: performing a first training on an initial feature extraction network and an initial classification network based on a third sample facial image to obtain an intermediate feature extraction network and a classification network, wherein the classification network is used to classify the third sample facial image based on the features of the third sample facial image to determine the category to which the third sample facial image belongs; performing a second training on an initial bias output network using a vector including features of the third sample facial image as input information and a bias between a third similarity threshold and the second similarity threshold corresponding to the category to which the third sample facial image belongs at the false recognition rate as supervision information to obtain an intermediate bias output network; performing a third training on the intermediate feature extraction network and the intermediate bias output network based on a fourth sample facial image to obtain the feature extraction network and the bias output network.
[0009] In some embodiments, the method further includes: obtaining the modulus of the features of the third sample facial image; generating the vector based on the features of the third sample facial image and the modulus of the features of the third sample facial image, and using the vector as the input information.
[0010] In some embodiments, the bias output network includes: a first fully connected layer, a normalization layer, a first activation layer, a second fully connected layer and a second activation layer connected in sequence; the first fully connected layer is used to classify the features output by the feature extraction network; the normalization layer is used to normalize the classified features; the first activation layer is used to perform nonlinear processing on the normalized features; the second fully connected layer is used to reclassify the features after nonlinear processing to obtain the bias; the second activation layer is used to map the value range of the bias to a preset range.
[0011] In some embodiments, the method further includes: obtaining the similarity threshold corresponding to each category in multiple categories respectively; determining the similarity threshold with the smallest value as the second similarity threshold, and determining the category corresponding to the similarity threshold with the smallest value as the reference category.
[0012] In some embodiments, the method further includes: acquiring geographic location information of a target area; determining a reference category in the target area based on the geographic location information of the target area, wherein the number of objects of the reference category in the target area is greater than the number of other objects in the target area except the reference category; and determining a similarity threshold corresponding to the reference category as a second similarity threshold in the target area.
[0013] According to a second aspect of an embodiment of the present disclosure, a face recognition device is provided, the device comprising: an acquisition module, used to acquire an offset of a category to which a first face image belongs; the offset is used to characterize the difference between a first similarity threshold corresponding to the category to which the first face image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first face image and the second face image as face images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the face image of the reference category and a third face image as face images of the same object; a correction module, used to correct the similarity between the first face image and the second face image based on the offset; and a recognition module, used to perform face recognition on the first face image based on the corrected similarity and the second similarity threshold.
[0014] In some embodiments, the device also includes: a sample image acquisition module, used to acquire N first sample face images and M second sample face images; the category to which the first sample face image belongs and the category to which the second sample face image belongs are the same as the category to which the first face image belongs; M and N are positive integers; a similarity determination module, used to determine, for each of the N first sample face images, the similarity between the first sample face image and each second sample face image; a threshold determination module, used to determine, based on the similarity between the first sample face image and the second sample face image, a first similarity threshold corresponding to the category to which the first face image belongs at the error recognition rate.
[0015] In some embodiments, the recognition module is used to: determine that the first facial image and the second facial image are facial images of the same object when the corrected similarity is greater than the second similarity threshold; and / or determine that the first facial image and the second image are facial images of different objects when the corrected similarity is not greater than the second similarity threshold.
[0016] In some embodiments, the method is implemented by a neural network, which includes: a feature extraction network, used to extract features from the first face image to obtain features of the first face image; a bias output network, used to determine the first similarity threshold based on the features of the first face image, and determine the bias based on the first similarity threshold and the second similarity threshold.
[0017] In some embodiments, the device also includes: a first training module, used to perform a first training on an initial feature extraction network and an initial classification network based on a third sample face image to obtain an intermediate feature extraction network and a classification network, wherein the classification network is used to classify the third sample face image based on the features of the third sample face image to determine the category to which the third sample face image belongs; a second training module, used to perform a second training on an initial bias output network using a vector including features of the third sample face image as input information and a bias between a third similarity threshold corresponding to the category to which the third sample face image belongs at the false recognition rate and the second similarity threshold as supervision information to obtain an intermediate bias output network; and a third training module, used to perform a third training on the intermediate feature extraction network and the intermediate bias output network based on a fourth sample face image to obtain the feature extraction network and the bias output network.
[0018] In some embodiments, the device also includes: a modulus acquisition module, used to obtain the modulus of the features of the third sample facial image; a generation module, used to generate the vector based on the features of the third sample facial image and the modulus of the features of the third sample facial image, and use the vector as the input information.
[0019] In some embodiments, the bias output network includes: a first fully connected layer, a normalization layer, a first activation layer, a second fully connected layer and a second activation layer connected in sequence; the first fully connected layer is used to classify the features output by the feature extraction network; the normalization layer is used to normalize the classified features; the first activation layer is used to perform nonlinear processing on the normalized features; the second fully connected layer is used to reclassify the features after nonlinear processing to obtain the bias; the second activation layer is used to map the value range of the bias to a preset range.
[0020] In some embodiments, the device also includes: a threshold acquisition module, used to respectively obtain the similarity threshold corresponding to each category in multiple categories; a first selection module, used to determine the similarity threshold with the smallest value as the second similarity threshold, and determine the category corresponding to the similarity threshold with the smallest value as the reference category.
[0021] In some embodiments, the device also includes: a location acquisition module for acquiring geographic location information of a target area; a reference category determination module for determining a reference category in the target area based on the geographic location information of the target area, wherein the number of objects of the reference category in the target area is greater than the number of other objects in the target area except the reference category; and a second selection module for determining a similarity threshold corresponding to the reference category as a second similarity threshold in the target area.
[0022] According to a third aspect of an embodiment of the present disclosure, a neural network is provided, comprising: a feature extraction network, used to extract features from a first face image to obtain features of the first face image; a bias output network, used to determine a bias based on the features of the first face image; the bias is used to characterize the difference between a first similarity threshold corresponding to a category to which the first face image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first face image and the second face image as face images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the face image of the reference category and a third face image as face images of the same object; the bias is used to correct the similarity between the first face image and the second face image, and the corrected similarity and the second similarity threshold are used to perform face recognition on the first face image.
[0023] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described in any embodiment is implemented.
[0024] According to a fifth aspect of an embodiment of the present disclosure, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of the embodiments is implemented.
[0025] The disclosed embodiment corrects the similarity between the first facial image and the second facial image through an offset. Since the offset can characterize the difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the same false recognition rate, by correcting the similarity through the offset, the similarities corresponding to different categories can be mapped to a unified evaluation standard, so that different categories can use the same similarity threshold for facial recognition, thereby improving the accuracy of facial recognition.
[0026] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0028] Figure 1 It is a flowchart of the face recognition method of the embodiment of the present disclosure.
[0029] Figure 2 Schematic diagram of the principle of the neural network of the embodiment of the present disclosure.
[0030] Figure 3 Schematic diagram of the neural network training process of the embodiment of the present disclosure.
[0031] Figure 4 is a block diagram of a face recognition device according to an embodiment of the present disclosure.
[0032] Figure 5 is a block diagram of a neural network according to an embodiment of the present disclosure.
[0033] Figure 6 It is a schematic diagram of the specific structure of the neural network of the embodiment of the present disclosure.
[0034] Figure 7 It is a schematic diagram of the structure of a computer device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0036] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items. In addition, the term "at least one" herein means any combination of at least two of any one or more of a plurality of.
[0037] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0038] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present disclosure and to make the above-mentioned purposes, features and advantages of the embodiments of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings.
[0039] Face recognition is a biometric technology that identifies people based on their facial features. Face recognition models are usually used to identify face images. The representation ability of face recognition models is the feature extraction ability. Face recognition models have different representation abilities for objects of different categories, which will lead to large differences in the recognition success rates of objects of different categories. For example, when the category is skin color, the facial contour information of objects with darker skin color is generally weaker, while the facial contour information of objects with lighter skin color and objects with yellower skin color is stronger, which will lead to different recognition accuracy for objects of different skin colors.
[0040] Before deploying a face recognition model, the face recognition threshold corresponding to different error rates is usually obtained on the test set, and the corresponding similarity threshold is set according to the error rate required by the application scenario. For example, if the user requires that the error rate in the application scenario including 100,000 face images (called base images) in the face database be less than one in ten thousand, the similarity threshold corresponding to the error rate of one in ten thousand is obtained through the test set. If the similarity between the image recognized by the face recognition model and a base image is higher than the set similarity threshold, it is determined that the face image and the base image are the face images of the same object, otherwise the two images are considered to be face images of different objects. However, this deployment method will bring about the problem of threshold balance in scenes including objects of multiple categories, that is, the test sets of objects of different categories usually get significantly different similarity thresholds. For example, the test set of objects with yellowish skin color gets threshold a, and the test set of objects with darker skin color gets threshold b, which is usually higher than a. If a is used as the deployment threshold of the face recognition model, the error rate of face recognition for objects with darker skin color will be greatly increased. If b is used as the deployment threshold of the face recognition model, the pass rate of face recognition for objects with yellowish skin color will be greatly reduced, which will greatly affect the user experience. The false recognition rate refers to the probability of recognition error, and the pass rate refers to the probability of recognizing user A's face image and user A's base image as the same user's face image.
[0041] In the related art, a mixed test set is often used to test the face recognition model for scenes including objects of multiple categories. However, when the mixed test set is used to calculate the similarity threshold, the false recognition rate and the pass rate are difficult to reach the expected level.
[0042] Based on this, the present disclosure provides a face recognition method, such as Figure 1 As shown, the face recognition method includes:
[0043] Step 101: Obtaining an offset of a category to which a first face image belongs;
[0044] Step 102: correcting the similarity between the first face image and the second face image based on the offset;
[0045] Step 103: performing face recognition on the first face image based on the corrected similarity and the second similarity threshold.
[0046] In step 101, the first facial image may be a facial image of any category, and the category of the facial image is related to the attributes of the face in the facial image, and the attributes may include but are not limited to skin color, age, gender, etc. For example, the facial image corresponding to a face with darker skin color is in one category, and the facial image corresponding to a face with lighter skin color is in another category. For another example, the facial image of a man is in one category, and the facial image of a woman is in another category. Facial images of different categories may correspond to different labels. The facial image includes at least one face. In the case where the first facial image includes multiple faces, each face may be processed separately, and the processing method of each face is the same. Here, the technical solution of the present disclosure is described by taking the first facial image including one face as an example.
[0047] The offset is used to characterize the difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to the reference category at the false recognition rate. The false recognition rate refers to the probability of recognition error, that is, the probability of recognizing a facial image of one object as a facial image of another object. For example, the facial database includes the facial image of object A, and the target image to be recognized is also the facial image of object A, but the target image is mistakenly recognized as not being a facial image of object A. For another example, the facial database includes the facial image of object A, and the target image to be recognized is the facial image of object B, but the target image is mistakenly recognized as a facial image of object A. The above two situations are recognition errors. The false recognition rate can be determined by the ratio of the number of target images that are recognized incorrectly to the total number of target images.
[0048] Wherein, the first similarity threshold is the lower limit of similarity for identifying the first face image and the second face image as face images of the same object, that is, when the similarity between the first face image and the second face image is greater than the first similarity threshold, the first face image and the second face image are identified as face images of the same object, otherwise they are identified as face images of different objects. Similarly, the second similarity threshold is the lower limit of similarity for identifying the face image of the reference category and the third face image as face images of the same object. Wherein, the second face image and the third face image can both be face images in a face database, the face database can be established in advance, the face database can include face images collected from various channels, and the second face image and the third face image can be face images of the same object or different objects in the face database.
[0049] However, the similarity thresholds corresponding to different categories often vary greatly. For example, the threshold corresponding to objects with yellowish skin color is 0.4, and the threshold corresponding to objects with darker skin color is 0.6. In other words, for objects with yellowish skin color, the similarity between facial images of different people generally does not exceed 0.4. Therefore, setting the threshold corresponding to objects with yellowish skin color to 0.4 is sufficient to distinguish different objects. For objects with darker skin color, the facial contours are not clear enough, so the similarity between different objects is higher. Therefore, a higher similarity threshold needs to be set to distinguish objects with darker skin color.
[0050] In some embodiments, the relationship between the threshold and the false recognition rate can be determined by a database collision experiment. Specifically, N first sample face images and M second sample face images can be obtained; the category to which the first sample face image belongs and the category to which the second sample face image belongs are the same as the category to which the first face image belongs; M and N are positive integers. Among them, any two first sample face images among the N first sample face images can be face images of different objects, or the N first sample face images can also include at least two first sample face images of the same object, and the present disclosure is not limited to this. Any two second sample face images among the M second sample face images can be face images of different objects, or the N second sample face images can also include at least two second sample face images of the same object, and the present disclosure is not limited to this. Any first sample face image and any second sample face image can be face images of different objects, or there is at least one first sample face image and a second sample face image of the same object, and the present disclosure is not limited to this.
[0051] For each of the N first sample face images, the similarity between the first sample face image and each second sample face image can be determined respectively. Then, based on the similarity between the first sample face image and the second sample face image, a first similarity threshold corresponding to the category to which the first face image belongs under the false recognition rate can be determined.
[0052] For example, suppose the value of M is 3 and the value of N is 2. ij represents the similarity between the i-th first sample face image and the j-th second sample face image, where 1≤i≤2, 1≤j≤3, assuming that any first sample face image and any second sample face image are face images of different objects, and assuming that the similarity between each first sample face image and the second sample face image is as shown in the following table:
[0053]
[0054]
[0055] It can be seen from the above table that when the similarity threshold is greater than or equal to 0.6, it will be determined that any first sample face image and any second sample face image are face images of different objects, so the error recognition rate is 0. When the similarity threshold is less than 0.6 and greater than or equal to 0.5, it will be determined that the third second sample face image and the first first sample face image are face images of the same object, so the error recognition rate is 1 / 6. When the similarity threshold is less than 0.5 and greater than or equal to 0.4, it will be determined that the third second sample face image and the first first sample face image are face images of the same object, and the second second sample face image and the second first sample face image are face images of the same object, so the error recognition rate is 2 / 6. Therefore, the relationship between the error recognition rate and the similarity threshold can be determined from the above table. When the values of M and N are large, the relationship between the error recognition rate and the similarity threshold determined in the above manner can approach the real scene.
[0056] The first sample face image and the second sample face image corresponding to each category can be used to determine the relationship between the similarity threshold and the false recognition rate of the category, so that the first similarity threshold corresponding to each category can be determined under a given false recognition rate. A category is selected from each category as a reference category, and the difference between the first similarity threshold of each category at the false recognition rate and the first similarity threshold of the reference category at the false recognition rate can be determined, and the difference is the offset.
[0057] In some embodiments, the similarity thresholds corresponding to multiple categories can be obtained respectively; the similarity threshold with the smallest value is determined as the second similarity threshold, and the category corresponding to the similarity threshold with the smallest value is determined as the reference category. Assume that the similarity thresholds of m categories under the preset error recognition rate are th1, th2, ..., th m , then the basic similarity threshold is defined as:
[0058] th base =min(th1,th2,...,th m ),
[0059] The category corresponding to the basic threshold is the reference category. The offsets corresponding to each category are gap1, gap2, ..., gap m , where gap k (1≤k≤m) is expressed as:
[0060] gap k =th k -th base .
[0061] In addition to the above method, other categories can also be selected as reference categories. For example, the maximum similarity threshold under a preset false recognition rate is determined as the basic threshold, and the category corresponding to the maximum similarity threshold under the preset false recognition rate is determined as the reference category. The present disclosure does not impose any restrictions on this.
[0062] In other embodiments, the category including the largest number of objects may be determined as the reference category. For example, if the number of objects in the first category is 20, the number of objects in the second category is 30, and the number of objects in the third category is 40, the third category is determined as the reference category. Since the number distribution of object categories in different regions is often different, the reference category in the target area may be determined based on the geographic location information of the target area, wherein the number of objects of the reference category in the target area is greater than the number of other objects in the target area except the reference category, and the similarity threshold corresponding to the reference category is determined as the second similarity threshold in the target area. For example, in Southeast Asia, the number of objects with yellowish skin color is greater than the number of objects with darker skin color and the number of objects with whiter skin color. Therefore, the objects with yellowish skin color may be determined as the reference category in Southeast Asia, and the similarity threshold corresponding to the objects with yellowish skin color may be determined as the second similarity threshold in Southeast Asia.
[0063] Furthermore, the category of the target area can also be determined based on the geographical location information of the target area, such as a residential area, a foreign enterprise, an exhibition area of an international exhibition, etc. Then, the reference category in the target area is determined based on the category of the target area. For example, in a residential area of a certain country, the number of local residents is often greater than the number of foreign residents. In this case, the category corresponding to the residents of that country can be determined as the reference category of the residential area; and in a foreign enterprise of that country, the number of employees from other countries may be greater than the number of domestic employees. In this case, the number distribution of employees of different skin colors can be determined based on the nationality of the employees, thereby determining the reference category.
[0064] In step 102, the similarity between the first face image and the second face image may be corrected based on the offset. Assuming that the first face image is a face image of category k, and the similarity between the first face image and the second face image is Distmp, the corrected similarity Dis between the first face image and the second face image is recorded as:
[0065] Dis=Distmp+gap k .
[0066] Wherein, Distmp can be calculated based on the distance (for example, cosine distance, Chebyshev distance, etc.) between the feature vector f of the first face image and the feature vector F of the second face image. Taking the cosine distance as an example, Distmp can be recorded as:
[0067] Distmp=cos(f,F).
[0068] Through the above correction process, in step 103, the second similarity threshold corresponding to the reference category can be directly used to perform face recognition on the first face image, that is, to determine whether the first face image and the second face image are face images of the same object, so as to achieve a balancing effect of different thresholds for different categories. Specifically, when the corrected similarity is greater than the second similarity threshold, it can be determined that the first face image and the second face image are face images of the same object. When the corrected similarity is not greater than the second similarity threshold, it can be determined that the first face image and the second image are face images of different objects. Since there is no need to adaptively set different similarity thresholds based on different first categories, but each category can use the same second similarity threshold for face recognition, the complexity of face recognition is reduced; at the same time, since the similarity between the first face image and the second face image is corrected, even if the same similarity threshold is used, the accuracy of face recognition of different categories will not be reduced.
[0069] In some embodiments, the face recognition method of the disclosed embodiment can be implemented by a neural network. The neural network includes two sub-networks: a feature extraction network and a bias output network. The feature extraction network is used to extract features from the first face image to obtain features of the first face image; the bias output network is used to determine the first similarity threshold based on the features of the first face image, and to determine the bias based on the first similarity threshold and the second similarity threshold. The principle of face recognition by neural network is as follows: Figure 2 As shown. The first face image can be input into the feature extraction network in the neural network so as to extract the dim-dimensional feature f from the first face image. On the one hand, the feature f is used to calculate the similarity Distmp with the feature F extracted from the second face image. On the other hand, the offset gap corresponding to the first face image is predicted through the bias output network. Among them, F can be pre-extracted and saved through the feature extraction network or other machine learning models with feature extraction capabilities. Then, the similarity Distmp is corrected based on the offset gap to obtain the corrected similarity Dis. By comparing the corrected similarity Dis with the preset basic threshold th base By comparing, it can be determined whether the first facial image and the second facial image are facial images of the same object.
[0070] like Figure 3 As shown, the feature extraction network and the bias output network can be jointly trained. In the first training stage, the parameters of the bias output network are fixed, the feature extraction network is trained, and then the similarity threshold and bias of each category are obtained; in the second training stage, the parameters of the feature extraction network are fixed, and the bias output network is trained. Further, in the third training stage, the feature extraction network and the bias output network can be trained at the same time. The training set corresponding to each category will obtain the corresponding bias according to its category (which can be obtained by calibration), and then generate the sample face image-bias pair in the training set. The sample face image can be feature extracted by the feature extraction network to obtain the dim-dimensional feature f. On the one hand, the feature f is used to input into the classification network so as to jointly train the feature extraction network and the classification network, wherein the classification network is used to predict the category to which the sample image belongs. On the other hand, the feature f is used to input the bias output network, and the bias output network can regress the feature f to predict the bias gap. After the training is completed, the classification network can be removed, and only the feature extraction network and the bias output network are used for face recognition.
[0071] A multi-stage training method can be adopted. In the first stage, the initial feature extraction network and the initial classification network are first trained based on the third sample face image to obtain an intermediate feature extraction network and a classification network. The classification network is used to classify the third sample face image based on the features of the third sample face image to determine the category to which the third sample face image belongs. In this training stage, the parameters of the initial bias output network can be fixed, and a loss function (for example, an arcface loss function) can be established by comparing the category predicted by the classification network with the actual category obtained by calibration. Based on the loss function, the initial feature extraction network and the initial classification network can be jointly trained.
[0072] In the second stage, the vector including the features of the third sample face image is used as input information, and the offset between the third similarity threshold and the second similarity threshold corresponding to the category to which the third sample face image belongs at the false recognition rate is used as supervision information, and the initial bias output network is secondly trained to obtain an intermediate bias output network. In this training stage, the parameters of the intermediate feature extraction network can be fixed, and a loss function (for example, an L2 loss function) is established by predicting the offset and the offset in the sample face image-offset pair, and the initial bias output network can be trained based on the loss function.
[0073] In the third stage, the intermediate feature extraction network and the intermediate bias output network are trained for the third time based on the fourth sample face image to obtain the feature extraction network and the bias output network. In this training stage, the parameters of the intermediate feature extraction network and the intermediate bias output network can be optimized simultaneously, and a loss function (e.g., an L2 loss function) is established with the bias predicted by the intermediate bias output network and the bias in the sample face image-bias pair, and the intermediate feature extraction network and the intermediate bias output network can be jointly trained based on the loss function.
[0074] Furthermore, the input information also includes the modulus of the feature of the third sample face image. Assume that the feature vector of the third sample face image is {q1, q2, ..., q dim}, then the modulus length of the feature of the third sample face image can be recorded as:
[0075]
[0076] The vector may be generated based on the feature of the third sample face image and the modulus of the feature of the third sample face image, and the generated vector may be used as input information. For example, the dim-dimensional feature vector {q1, q2, ..., q dim} is concatenated with the modulus to obtain a dim+1-dimensional vector {q1,q2,…,q dim ,f}. The quality of an image is generally positively correlated with the modulus of the image's features, that is, the higher the image quality, the longer the modulus of the image's features. By using the modulus of the features of the third sample face image as input information to train the neural network, the neural network can obtain prior information on the image quality of the third sample face image, thereby improving the accuracy of the trained neural network.
[0077] In some embodiments, the bias output network includes a first fully connected layer, a normalization layer, a first activation layer, a second fully connected layer, and a second activation layer connected in sequence. The first fully connected layer is used to classify the features output by the feature extraction network, the normalization layer is used to normalize the classified features, the first activation layer is used to perform nonlinear processing on the normalized features, the second fully connected layer is used to reclassify the features after nonlinear processing to obtain the bias, and the second activation layer is used to map the value range of the bias to a preset range (for example, between 0 and 1). The bias output network with the above structure has sufficient feature expression capabilities, and the training process is easy to converge.
[0078] The present invention designs a face recognition method for multi-category objects, which can balance the recognition accuracy of each category, embed category bias parameters during neural network training, so that the neural network can automatically perceive the category and adjust the similarity, so that the different thresholds of multiple categories can be unified into the same threshold, that is, there is no need to adjust the adopted similarity threshold accordingly according to the different categories, thereby reducing the complexity of face recognition and improving the efficiency of face recognition, and achieving the best access efficiency and user experience in the fields of face recognition access control, security monitoring, etc. After experimental verification, the face recognition method of the present invention can ensure the recognition accuracy of each category without affecting the pass rate.
[0079] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0080] like Figure 4 As shown, the present disclosure also provides a face recognition device, the device comprising:
[0081] An acquisition module 401 is used to acquire an offset of a category to which a first facial image belongs; the offset is used to characterize a difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first facial image and the second facial image as facial images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the facial image of the reference category and a third facial image as facial images of the same object;
[0082] A correction module 402, configured to correct the similarity between the first face image and the second face image based on the offset;
[0083] The recognition module 403 is configured to perform face recognition on the first face image based on the corrected similarity and the second similarity threshold.
[0084] In some embodiments, the device also includes: a sample image acquisition module, used to acquire N first sample face images and M second sample face images; the category to which the first sample face image belongs and the category to which the second sample face image belongs are the same as the category to which the first face image belongs; M and N are positive integers; a similarity determination module, used to determine, for each of the N first sample face images, the similarity between the first sample face image and each second sample face image; a threshold determination module, used to determine, based on the similarity between the first sample face image and the second sample face image, a first similarity threshold corresponding to the category to which the first face image belongs at the error recognition rate.
[0085] In some embodiments, the recognition module is used to: determine that the first facial image and the second facial image are facial images of the same object when the corrected similarity is greater than the second similarity threshold; and / or determine that the first facial image and the second image are facial images of different objects when the corrected similarity is not greater than the second similarity threshold.
[0086] In some embodiments, the method is implemented by a neural network, which includes: a feature extraction network, used to extract features from the first face image to obtain features of the first face image; a bias output network, used to determine the first similarity threshold based on the features of the first face image, and determine the bias based on the first similarity threshold and the second similarity threshold.
[0087] In some embodiments, the device also includes: a first training module, used to perform a first training on an initial feature extraction network and an initial classification network based on a third sample face image to obtain an intermediate feature extraction network and a classification network, wherein the classification network is used to classify the third sample face image based on the features of the third sample face image to determine the category to which the third sample face image belongs; a second training module, used to perform a second training on an initial bias output network using a vector including features of the third sample face image as input information and a bias between a third similarity threshold corresponding to the category to which the third sample face image belongs at the false recognition rate and the second similarity threshold as supervision information to obtain an intermediate bias output network; and a third training module, used to perform a third training on the intermediate feature extraction network and the intermediate bias output network based on a fourth sample face image to obtain the feature extraction network and the bias output network.
[0088] In some embodiments, the device also includes: a modulus acquisition module, used to obtain the modulus of the features of the third sample facial image; a generation module, used to generate the vector based on the features of the third sample facial image and the modulus of the features of the third sample facial image, and use the vector as the input information.
[0089] In some embodiments, the bias output network includes: a first fully connected layer, a normalization layer, a first activation layer, a second fully connected layer and a second activation layer connected in sequence; the first fully connected layer is used to classify the features output by the feature extraction network; the normalization layer is used to normalize the classified features; the first activation layer is used to perform nonlinear processing on the normalized features; the second fully connected layer is used to reclassify the features after nonlinear processing to obtain the bias; the second activation layer is used to map the value range of the bias to a preset range.
[0090] In some embodiments, the device also includes: a threshold acquisition module, used to respectively obtain the similarity threshold corresponding to each category in multiple categories; a first selection module, used to determine the similarity threshold with the smallest value as the second similarity threshold, and determine the category corresponding to the similarity threshold with the smallest value as the reference category.
[0091] In some embodiments, the device also includes: a location acquisition module for acquiring geographic location information of a target area; a reference category determination module for determining a reference category in the target area based on the geographic location information of the target area, wherein the number of objects of the reference category in the target area is greater than the number of other objects in the target area except the reference category; and a second selection module for determining a similarity threshold corresponding to the reference category as a second similarity threshold in the target area.
[0092] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0093] like Figure 5 As shown, the present disclosure also provides a neural network, the neural network comprising:
[0094] A feature extraction network 501 is used to extract features from a first face image to obtain features of the first face image;
[0095] A bias output network 502, configured to determine a bias amount based on features of the first facial image;
[0096] The offset is used to characterize the difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to the reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first facial image and the second facial image as facial images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the facial image of the reference category and the third facial image as facial images of the same object;
[0097] The offset is used to correct the similarity between the first face image and the second face image, and the corrected similarity and the second similarity threshold are used to perform face recognition on the first face image.
[0098] like Figure 6 As shown, it is a schematic diagram of the specific structure of the neural network. Among them, the feature extraction network 501 can adopt convolutional neural network (CNN). The bias output network 502 includes a first fully connected (FC) layer, a normalization layer (Batch Normalization, BN), a first activation layer, a second fully connected layer and a second activation layer connected in sequence. The first fully connected layer is used to classify the features output by the feature extraction network, the normalization layer is used to normalize the classified features, the first activation layer is used to perform nonlinear processing on the normalized features, the second fully connected layer is used to classify the features after nonlinear processing again, and obtain the bias, and the second activation layer is used to limit the value range of the bias to between 0 and 1. The bias output network with the above structure has sufficient feature expression ability, and the training process is easy to converge. Among them, the first activation layer and the second activation layer are ReLU layer and Sigmoid layer respectively. The neural network may also be connected to a classifier 503, which may include a fully connected layer for classifying the category to which the sample image belongs based on the features of the sample image output by the feature extraction network during the neural network training process. During the neural network reasoning process, the classifier 503 may be removed.
[0099] An embodiment of the present specification also provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any of the above embodiments is implemented.
[0100] Figure 7A more specific hardware structure diagram of a computing device provided in an embodiment of this specification is shown, and the device may include: a processor 701, a memory 702, an input / output interface 703, a communication interface 704, and a bus 705. The processor 701, the memory 702, the input / output interface 703, and the communication interface 704 are connected to each other in communication within the device through the bus 705.
[0101] The processor 701 can be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., for executing relevant programs to implement the technical solutions provided in the embodiments of this specification. The processor 701 can also include a graphics card, which can be a Nvidia titan X graphics card or a 1080Ti graphics card, etc.
[0102] The memory 702 may be implemented in the form of a read-only memory (ROM), a random access memory (RAM), a static storage device, a dynamic storage device, etc. The memory 702 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 702 and are called and executed by the processor 701.
[0103] The input / output interface 703 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0104] The communication interface 704 is used to connect to a communication module (not shown) to send information of the device to the communication module of other devices, or receive information sent by the communication module of other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WIFI, Bluetooth, etc.).
[0105] The bus 705 includes a path for transmitting information between various components of the device (eg, the processor 701 , the memory 702 , the input / output interface 703 , and the communication interface 704 ).
[0106] It should be noted that, although the above device only shows the processor 701, the memory 702, the input / output interface 703, the communication interface 704 and the bus 705, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0107] The present disclosure also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any of the above embodiments is implemented.
[0108] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0109] It can be known from the above description of the implementation mode that the technicians in this field can clearly understand that the embodiments of this specification can be implemented by means of software plus the necessary general hardware platform. Based on such an understanding, the technical solution of the embodiments of this specification can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments of this specification.
[0110] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0111] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment scheme of this specification. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0112] The above is only a specific implementation of the embodiments of this specification. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiments of this specification. These improvements and modifications should also be regarded as the protection scope of the embodiments of this specification.
Claims
1. A face recognition method, characterized in that: The method comprises: Obtaining an offset of a category to which a first facial image belongs; the offset is used to characterize a difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first facial image and the second facial image as facial images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the facial image of the reference category and a third facial image as facial images of the same object; the second facial image and the third facial image are the same or different facial images in a facial database; Correcting the similarity between the first face image and the second face image based on the offset; wherein the corrected similarity is the sum of the offset and the similarity between the first face image and the second face image; Perform face recognition on the first face image based on the corrected similarity and the second similarity threshold.
2. The method according to claim 1, characterized in that: The method further comprises: Obtain N first sample face images and M second sample face images; the category to which the first sample face images belong and the category to which the second sample face images belong are both the same as the category to which the first face images belong; M and N are positive integers; For each of the N first sample face images, respectively determine the similarity between the first sample face image and each second sample face image; Based on the similarity between the first sample facial image and the second sample facial image, a first similarity threshold corresponding to the category to which the first facial image belongs at the false recognition rate is determined.
3. The method according to claim 1, characterized in that The performing face recognition on the first face image based on the corrected similarity and the second similarity threshold includes: When the corrected similarity is greater than the second similarity threshold, determining that the first facial image and the second facial image are facial images of the same object; and / or When the corrected similarity is not greater than the second similarity threshold, it is determined that the first facial image and the second facial image are facial images of different objects.
4. The method according to claim 1, characterized in that: The method is implemented by a neural network, which comprises: A feature extraction network, used to extract features from the first face image to obtain features of the first face image; A bias output network is used to determine the first similarity threshold based on the characteristics of the first face image, and to determine the bias based on the first similarity threshold and the second similarity threshold.
5. The method according to claim 4, characterized in that The method further comprises: Performing a first training on the initial feature extraction network and the initial classification network based on the third sample facial image to obtain an intermediate feature extraction network and a classification network, wherein the classification network is used to classify the third sample facial image based on the features of the third sample facial image to determine the category to which the third sample facial image belongs; Taking the vector including the features of the third sample face image as input information, taking the offset between the third similarity threshold and the second similarity threshold corresponding to the category to which the third sample face image belongs at the false recognition rate as supervision information, performing a second training on the initial bias output network to obtain an intermediate bias output network; The intermediate feature extraction network and the intermediate bias output network are trained for the third time based on the fourth sample face image to obtain the feature extraction network and the bias output network.
6. The method according to claim 5, characterized in that The method further comprises: Obtaining the modulus length of the feature of the third sample face image; The vector is generated based on the feature of the third sample face image and the modulus of the feature of the third sample face image, and the vector is used as the input information.
7. The method according to claim 4, characterized in that The bias output network includes: A first fully connected layer, a normalized layer, a first activation layer, a second fully connected layer, and a second activation layer connected in sequence; The first fully connected layer is used to classify the features output by the feature extraction network; The normalization layer is used to normalize the classified features; The first activation layer is used to perform nonlinear processing on the normalized features; The second fully connected layer is used to reclassify the features after nonlinear processing to obtain the bias; The second activation layer is used to map the value range of the bias amount into a preset range.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Obtain the similarity threshold corresponding to each category in multiple categories respectively; The similarity threshold with the smallest value is determined as the second similarity threshold, and the category corresponding to the similarity threshold with the smallest value is determined as the reference category.
9. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Obtain geographic location information of the target area; determining a reference category in the target area based on geographic location information of the target area, wherein the number of objects of the reference category in the target area is greater than the number of other objects in the target area except the reference category; The similarity threshold corresponding to the reference category is determined as the second similarity threshold in the target area.
10. A face recognition device, characterized in that: The device comprises: an acquisition module, configured to acquire an offset of a category to which a first facial image belongs; the offset is used to characterize a difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to a reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first facial image and the second facial image as facial images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the facial image of the reference category and a third facial image as facial images of the same object; the second facial image and the third facial image are the same or different facial images in a facial database; A correction module, configured to correct the similarity between the first face image and the second face image based on the offset; wherein the corrected similarity is the sum of the offset and the similarity between the first face image and the second face image; A recognition module is used to perform face recognition on the first face image based on the corrected similarity and the second similarity threshold.
11. A neural network, characterized in that The neural network comprises: A feature extraction network, used to extract features from the first face image to obtain features of the first face image; A bias output network, used to determine a bias amount based on features of the first facial image; The offset is used to characterize the difference between a first similarity threshold corresponding to the category to which the first facial image belongs at a preset false recognition rate and a second similarity threshold corresponding to the reference category at the false recognition rate, the first similarity threshold being a lower limit of similarity for recognizing the first facial image and the second facial image as facial images of the same object, and the second similarity threshold being a lower limit of similarity for recognizing the facial image of the reference category and the third facial image as facial images of the same object; the second facial image and the third facial image are the same or different facial images in a facial database; The offset is used to correct the similarity between the first facial image and the second facial image, wherein the corrected similarity is the sum of the offset and the similarity between the first facial image and the second facial image; the corrected similarity and the second similarity threshold are used to perform facial recognition on the first facial image.
12. The neural network according to claim 11, characterized in that The bias output network includes: A first fully connected layer, a normalized layer, a first activation layer, a second fully connected layer, and a second activation layer connected in sequence; The first fully connected layer is used to classify the features output by the feature extraction network; The normalization layer is used to normalize the classified features; The first activation layer is used to perform nonlinear processing on the normalized features; The second fully connected layer is used to reclassify the features after nonlinear processing to obtain the bias; The second activation layer is used to map the value range of the bias amount into a preset range.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 9 is implemented.
14. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Face recognition method and device
CN103902961A
A face recognition convolutional neural network training method based on a novel loss function
CN109165566A
Face recognition method and a recognition device,
CN109508694A
Face recognition method and device and training method and device of face recognition system
CN111401344A
Image processing method and device, computer equipment and computer readable storage medium
CN111476222A
