Identity recognition method, electronic device and storage medium
By correcting the similarity score in the identity recognition method, using the vector density of the eigenvectors, the problem of low identity recognition reliability in the prior art is solved and the user experience is improved.
Patent Information
- Application Number
- CN202311230578.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-22
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2043-09-22
AI Technical Summary
The existing identity recognition methods fail to learn to match the identity with the real user identity during the training stage, resulting in the user being often misidentified in actual applications or other people being misidentified successfully, seriously affecting the user experience.
By obtaining the first feature vector of the image to be identified and its similarity score, and correcting the similarity score to determine the identity recognition result of the target user based on the preset mapping relationship between the feature vector and the vector density.
Improve the reliability of identity recognition, reduce the situation of misidentification, and thus improve the user experience.
Smart Images

Figure CN118447268B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an identity recognition method, an electronic device, and a storage medium. Background Art
[0002] Identity recognition refers to the process of identity authentication based on the user's biometric data (such as face, fingerprint, iris, etc.). Identity authentication is widely used, and common application scenarios include electronic device unlocking, transaction payment, access control, etc.
[0003] In related technologies, training samples of multiple identities can be used to train a convolutional neural network (CNN) model, which learns how to distinguish different identities. After the convolutional neural network is trained, it can perform identity recognition on images containing user biometric data.
[0004] However, although the convolutional neural network learns how to distinguish different identities during the training phase, it does not learn how to match them with the real user identity. Therefore, in actual applications, when users try to use electronic devices for identity recognition, they are often mistakenly recognized and fail, or others are mistakenly recognized and succeed, which seriously affects the user experience. Summary of the invention
[0005] The present application provides an identity recognition method, an electronic device and a storage medium, which can solve the problem that the reliability of identity recognition is low and seriously affects the user experience.
[0006] In a first aspect, an embodiment of the present application provides an identity recognition method, including: obtaining a first feature vector and a first similarity score corresponding to an image to be recognized, wherein the image to be recognized contains biological data of a target user; determining a vector density corresponding to the first feature vector based on a preset mapping relationship between feature vectors and vector density; and correcting the first similarity score based on the vector density corresponding to the first feature vector to determine an identity recognition result of the target user.
[0007] In the technical solution of the present application, the first similarity score can be obtained by comparing the first feature vector corresponding to the image to be identified with the template feature vector, wherein the template feature vector is pre-stored in a database and is a mathematical representation of the biometric features of a legitimate user, and can be obtained by extracting features from positive samples, where the positive samples refer to samples belonging to a target category or a category of interest.
[0008] For ease of explanation, this application abstracts the similarity score as the distance between two feature vectors in the feature space, and the higher the similarity score, the closer the distance between the two feature vectors; the lower the similarity score, the farther the distance between the two feature vectors.
[0009] It should be noted that, assuming that there are multiple negative samples, the vector density corresponding to the first eigenvector is used to characterize the number of negative samples around the image to be identified, where negative samples refer to samples that do not belong to the target category or the category of no interest.
[0010] It can be understood that the larger the vector density corresponding to the first eigenvector, the more negative samples there are around the image to be identified, the more difficult it is to distinguish the image to be identified, and the lower the final similarity score should be; correspondingly, the smaller the vector density corresponding to the first eigenvector, the smaller the number of negative samples around the image to be identified, the easier it is to distinguish the image to be identified, and the higher the final similarity score should be.
[0011] The embodiment of the present application is based on the above idea. First, the initial first similarity score of the image to be identified is obtained, and then the first similarity score is corrected by the vector density corresponding to the first feature vector. Finally, the identity recognition result of the target user is determined based on the correction result, thereby improving the reliability of identity recognition and enhancing the user experience.
[0012] In a possible implementation manner of the first aspect, the first similarity score is modified according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user, including:
[0013] According to a preset mapping relationship, determining a vector density corresponding to a preset template feature vector;
[0014] The first similarity score is modified according to the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector to determine the identity recognition result of the target user.
[0015] Among them, when performing identity recognition, in addition to considering the difficulty of distinguishing the image to be recognized, it is also necessary to consider the difficulty of distinguishing the positive sample corresponding to the template feature vector. That is, when the vector density of the template feature vector is larger, it indicates that the number of negative samples around the positive sample corresponding to the template feature vector is larger, and the positive sample corresponding to the template feature vector is more difficult to distinguish, and the final similarity score should be lower; correspondingly, the smaller the vector density corresponding to the template feature vector is, the smaller the number of negative samples around the positive sample corresponding to the template feature vector is, the positive sample corresponding to the template feature vector is easier to distinguish, and the final similarity score should be higher. Therefore, the embodiment of the present application corrects the first similarity score by combining the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector, and finally obtains the identity recognition result of the target user.
[0016] Optionally, in another possible implementation manner of the first aspect, the first similarity score is corrected according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user, including:
[0017] Generate a correction coefficient according to the vector density corresponding to the first eigenvector;
[0018] Correcting the first similarity score according to the correction coefficient to determine a second similarity score;
[0019] An identity recognition result of the target user is determined according to the second similarity score.
[0020] The correction coefficient may also be generated by combining the vector density corresponding to the first eigenvector and the vector density corresponding to the template eigenvector.
[0021] As an example, the larger the vector density, the lower the corresponding correction coefficient; the smaller the vector density, the higher the correction coefficient. Finally, the product of the correction coefficient and the first similarity score can be determined as the second similarity score.
[0022] Optionally, in another possible implementation manner of the first aspect, determining the identity recognition result of the target user according to the second similarity score includes:
[0023] Determining whether the second similarity score is greater than a preset similarity threshold;
[0024] If yes, then the target user's identity recognition result is determined to be recognition passed;
[0025] If not, it is determined that the target user's identity recognition result is recognition failure.
[0026] If the second similarity score is greater than the preset similarity threshold, the target user's identity recognition result is determined to be a passed recognition; if the second similarity score is less than or equal to the preset similarity threshold, the target user's identity recognition result is determined to be a failed recognition.
[0027] Optionally, in another possible implementation manner of the first aspect, the obtaining of the first feature vector and the first similarity score corresponding to the image to be identified includes:
[0028] The feature extraction model is called to identify the image to be identified to obtain a first feature vector and a first similarity score.
[0029] The feature extraction model may be a pre-trained convolutional neural network model, which may be used to extract a feature vector of an image and output an initial similarity score based on the feature vector and a template feature vector.
[0030] Optionally, in another possible implementation manner of the first aspect, calling the feature extraction model to identify the image to be identified to obtain the first feature vector and the first similarity score includes:
[0031] Calling a feature extraction model to extract a first feature vector corresponding to the image to be identified;
[0032] The cosine similarity between the first feature vector and a preset template feature vector is determined through the feature extraction model, and the cosine similarity between the first feature vector and the template feature vector is determined as a first similarity score.
[0033] Among them, cosine similarity is used to evaluate the similarity between two feature vectors. Similarity is an abstract concept. The embodiment of the present application converts the abstract concept into a concrete numerical value by determining the cosine similarity between the first feature vector and the template feature vector, and finally determines the calculated cosine similarity as the first similarity score.
[0034] Optionally, in another possible implementation manner of the first aspect, the number of the template feature vectors is at least two, and the determining, through the feature extraction model, a cosine similarity between the first feature vector and a preset template feature vector, and determining the cosine similarity between the first feature vector and the template feature vector as a first similarity score includes:
[0035] Determining, by the feature extraction model, a cosine similarity between the first feature vector and each template feature vector, and determining at least two first similarity scores based on the cosine similarity between the first feature vector and each template feature vector;
[0036] The first similarity score is modified according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user, including:
[0037] Modifying each first similarity score according to a vector density corresponding to the first eigenvector to determine at least two second similarity scores;
[0038] The identity recognition result of the target user is determined according to the second similarity score with the highest score.
[0039] As an example, in some scenarios, the positive samples corresponding to the template feature vector may all be images of the same identity. For example, in the scenario of mobile phone face recognition unlocking, the template feature vector comes from one or more positive samples, and these positive samples are all face images of the unique user of the mobile phone. And because these positive samples are obtained by collecting the unique user, the feature vectors corresponding to these positive samples are similar, so any one of the feature vectors can be used as the template feature vector for subsequent identity recognition, or the average feature vector of these feature vectors can be used as the template feature vector.
[0040] As another example, in some other scenarios, there may be multiple template feature vectors, because the collected positive samples may come from different users. For example, in the access control face recognition unlocking scenario, the access control gate needs to be able to recognize multiple users at the same time. In this case, each user will correspond to a template feature vector, that is, the number of template feature vectors is at least two. Therefore, in the process of identity recognition, it is necessary to match and identify the first feature vector corresponding to the image to be recognized with each template feature vector respectively, and finally at least two second similarity scores can be obtained, and finally the identity recognition result of the target user is determined according to the second similarity score with the highest score.
[0041] Optionally, in another possible implementation manner of the first aspect, the preset mapping relationship is determined by the following steps:
[0042] Determining a third similarity score between a preset target sample and a plurality of preset negative samples;
[0043] The third similarity scores are sorted from large to small, and the negative samples corresponding to at least two third similarity scores that are ranked first are determined as the adjacent negative samples corresponding to the target sample;
[0044] Determine the vector density corresponding to the target sample according to the adjacent negative samples corresponding to the target sample;
[0045] A preset mapping relationship is determined according to vector densities corresponding to the multiple target samples.
[0046] It is understandable that the farther the distance between the negative sample and the target sample (the lower the similarity), the smaller the effect of the negative sample on the vector density of the target sample feature vector, and the effect of the negative sample with a longer distance on the vector density can even be ignored. In other words, the vector density of the target sample feature vector is mainly determined by the several negative samples closest to the target sample. Therefore, the embodiment of the present application sorts each third similarity score, finds several negative samples with the largest third similarity score with the target sample (that is, several negative samples closest to the target sample) as adjacent negative samples, and determines the vector density corresponding to the target sample based on the adjacent negative samples, and finally determines the preset mapping relationship according to the vector density corresponding to the multiple target samples. In the above manner, while ensuring the reliability of identity recognition, the amount of calculation determined by the preset mapping relationship is reduced, thereby improving the efficiency of identity recognition.
[0047] Optionally, in another possible implementation manner of the first aspect, the determining of a third similarity score between a preset target sample and a plurality of preset negative samples includes:
[0048] Obtain the second eigenvector corresponding to the target sample and the third eigenvector corresponding to each negative sample;
[0049] The cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector is determined respectively, and the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector is determined as the third similarity score between the target sample and each negative sample.
[0050] Among them, by respectively determining the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector, the abstract concept is converted into a concrete numerical value, and finally the calculated cosine similarity is determined as the third similarity score between the target sample and each negative sample.
[0051] Optionally, in another possible implementation manner of the first aspect, the method is applied to an identity recognition model, and the step of determining a preset mapping relationship according to vector densities corresponding to the plurality of target samples includes:
[0052] Based on the vector densities corresponding to multiple target samples, a preset mapping relationship is established in the identity recognition model.
[0053] Among them, since determining the vector density requires finding the adjacent negative samples of multiple target samples from a large number of negative samples, the amount of calculation is very large. Therefore, in order to reduce the amount of calculation, before performing identity recognition, the second eigenvectors and corresponding vector densities corresponding to multiple target samples can be used in advance to establish a preset mapping relationship in the identity recognition model. In the subsequent actual application process, the first eigenvector of the image to be recognized can be input into the identity recognition model to directly obtain the vector density corresponding to the first eigenvector.
[0054] Optionally, in another possible implementation manner of the first aspect, determining the preset mapping relationship according to the vector densities corresponding to the multiple target samples includes:
[0055] Based on the vector densities corresponding to the multiple target samples, a polynomial approximation function is generated to establish a preset mapping relationship.
[0056] In addition to establishing a preset mapping relationship in the identity recognition model, a preset mapping relationship between a feature vector and a vector density can also be established by generating a polynomial approximation function. In subsequent practical applications, the first feature vector of the image to be recognized can be input into the polynomial approximation function to directly obtain the vector density corresponding to the first feature vector.
[0057] In a second aspect, an embodiment of the present application provides an identity recognition device, which has the function of implementing the identity recognition method behavior in the first aspect above, and the device includes:
[0058] The data acquisition module is used to acquire a first feature vector and a first similarity score corresponding to an image to be identified, wherein the image to be identified contains biological data of a target user.
[0059] The density determination module is used to determine the vector density corresponding to the first eigenvector according to a preset mapping relationship between the eigenvector and the vector density.
[0060] The score correction module is used to correct the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user.
[0061] In a possible implementation manner of the second aspect, the score correction module includes:
[0062] The first determination unit is used to modify the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user, including:
[0063] The second determining unit is used to determine the vector density corresponding to the preset template feature vector according to the preset mapping relationship.
[0064] The third determination unit is used to modify the first similarity score according to the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector to determine the identity recognition result of the target user.
[0065] Optionally, in another possible implementation of the second aspect, the score correction module includes:
[0066] The first generating unit is used to generate a correction coefficient according to a vector density corresponding to the first eigenvector.
[0067] The fourth determining unit is configured to modify the first similarity score according to the correction coefficient to determine a second similarity score.
[0068] The fifth determining unit is used to determine the identity recognition result of the target user according to the second similarity score.
[0069] Optionally, in yet another possible implementation manner of the second aspect, the fourth determining unit is specifically configured to:
[0070] It is determined whether the second similarity score is greater than a preset similarity threshold.
[0071] If so, the target user's identity recognition result is determined to be recognition passed.
[0072] If not, it is determined that the target user's identity recognition result is recognition failure.
[0073] Optionally, in another possible implementation of the second aspect, the data acquisition module includes:
[0074] The first acquisition unit is used to call the feature extraction model to identify the image to be identified, so as to obtain a first feature vector and a first similarity score.
[0075] Optionally, in another possible implementation manner of the second aspect, the first acquiring unit is specifically configured to:
[0076] The feature extraction model is called to extract the first feature vector corresponding to the image to be identified.
[0077] The cosine similarity between the first feature vector and a preset template feature vector is determined through the feature extraction model, and the cosine similarity between the first feature vector and the template feature vector is determined as a first similarity score.
[0078] Optionally, in yet another possible implementation manner of the second aspect, the number of the template feature vectors is at least two, and the first acquisition unit is specifically configured to:
[0079] The cosine similarity between the first feature vector and each template feature vector is determined by the feature extraction model, and at least two first similarity scores are determined based on the cosine similarity between the first feature vector and each template feature vector.
[0080] The above-mentioned score correction module includes:
[0081] The sixth determining unit is configured to modify each first similarity score according to a vector density corresponding to the first feature vector to determine at least two second similarity scores.
[0082] The seventh determination unit is used to determine the identity recognition result of the target user according to the second similarity score with the highest score.
[0083] Optionally, in yet another possible implementation manner of the second aspect, a mapping relationship determination module is further included, and the mapping relationship determination module includes:
[0084] The eighth determining unit is used to determine a third similarity score between the preset target sample and a plurality of preset negative samples.
[0085] The ninth determining unit is configured to sort the third similarity scores from large to small, and determine the negative samples corresponding to at least two third similarity scores that are ranked first as the adjacent negative samples corresponding to the target sample.
[0086] The tenth determining unit is used to determine the vector density corresponding to the target sample according to the adjacent negative samples corresponding to the target sample.
[0087] The eleventh determining unit is used to determine a preset mapping relationship according to vector densities corresponding to the plurality of target samples.
[0088] Optionally, in another possible implementation manner of the second aspect, the eighth determining unit is specifically configured to:
[0089] Obtain the second eigenvector corresponding to the target sample and the third eigenvector corresponding to each negative sample.
[0090] The cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector is determined respectively, and the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector is determined as the third similarity score between the target sample and each negative sample.
[0091] Optionally, in yet another possible implementation manner of the second aspect, the eleventh determining unit is specifically configured to:
[0092] Based on the vector densities corresponding to multiple target samples, a preset mapping relationship is established in the identity recognition model.
[0093] Optionally, in yet another possible implementation manner of the second aspect, the eleventh determining unit is specifically configured to:
[0094] Based on the vector densities corresponding to the multiple target samples, a polynomial approximation function is generated to establish a preset mapping relationship.
[0095] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the identity recognition method of the first aspect when executing the computer program.
[0096] Optionally, the electronic device can be a mobile phone, a tablet computer, a desktop computer, an access control gate, a clock-in attendance machine, etc.
[0097] In a fourth aspect, an embodiment of the present application provides a chip, including a processor, which is used to read and execute a computer program stored in a memory. When the computer program is executed by the processor, the identity recognition method of the first aspect above can be implemented.
[0098] Optionally, the chip also includes a memory, and the memory is electrically connected to the processor.
[0099] Optionally, the chip may also include a communication interface.
[0100] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it can implement the identity recognition method of the first aspect mentioned above.
[0101] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it can implement the identity recognition method of the first aspect mentioned above.
[0102] The technical effects obtained by the above-mentioned second, third, fourth, fifth and sixth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0104] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0105] Figure 2 It is a flowchart of an identity recognition method provided by an embodiment of the present application;
[0106] Figure 3 This is a sample distribution diagram provided by an embodiment of the present application;
[0107] Figure 4 This is another sample distribution schematic diagram provided by an embodiment of the present application;
[0108] Figure 5 It is a flowchart of another identity recognition method provided by an embodiment of the present application;
[0109] Figure 6 This is a schematic diagram of an application scenario of a face recognition method provided by an embodiment of the present application;
[0110] Figure 7 This is another sample distribution schematic diagram provided by an embodiment of the present application;
[0111] Figure 8 This is a sample similarity distribution diagram provided by an embodiment of the present application;
[0112] Fig. 9 is another sample similarity distribution diagram provided by an embodiment of the present application;
[0113] Fig.10 It is a structural schematic diagram of an identity recognition device provided by an embodiment of the present application;
[0114] Fig.11 It is a schematic diagram of the hardware structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0115] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0116] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0117] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0118] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0119] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0120] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0121] It should be understood that the size of the serial numbers of the steps in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0122] In the related art, the convolutional neural network model can be trained using training samples of multiple identities, and the convolutional neural network will learn how to distinguish different identities. After the convolutional neural network training is completed, the image containing the user's biometric data can be used for identity recognition. However, although the convolutional neural network learns how to distinguish different identities during the training phase, it does not learn how to match them with the real user identity. Therefore, in actual applications, when users try to use electronic devices for identity recognition, users are often mistakenly identified and fail, or others are mistakenly identified and succeed, which seriously affects the user experience.
[0123] In view of this, the embodiments of the present application provide an identity recognition method, an electronic device and a storage medium. Based on the idea that the greater the density of the feature vector, the more difficult it is to distinguish, the first similarity score of the image to be identified is corrected by utilizing the vector density corresponding to the first feature vector, thereby improving the reliability of identity recognition and enhancing the user experience.
[0124] The following is an example of an application scenario of the identity recognition method provided in the embodiment of the present application;
[0125] Please refer to Figure 1 , Figure 1 Schematic diagram of an application scenario provided by the embodiment of the present application. The embodiment of the present application can be applied to the mobile phone face recognition unlocking scenario. Figure 1 As shown, when the mobile phone is locked, the user faces the front camera of the mobile phone, the mobile phone collects the face image through the camera, and then determines the user's identity recognition result through the identity recognition method provided in the embodiment of the present application. If the identity recognition result is passed, the lock screen is touched, otherwise the lock screen remains.
[0126] It should be noted that the above application scenarios are only exemplary, and other possible similar application scenarios may also be included in the application, such as unlocking other electronic devices (tablet computers, desktop computers, etc.), opening doors with access control gates, clocking in with attendance machines, and electronic device payments. The identity recognition method of each electronic device may also include face, fingerprint, iris, etc. The above application scenarios can all use the method provided in the embodiments of the present application for identity recognition. The specific implementation process of the method can be found in the following embodiments.
[0127] The identity recognition method, electronic device and storage medium provided by the present application are described in detail below with reference to the accompanying drawings.
[0128] Reference Figure 2 , shows a flow chart of an identity recognition method provided by an embodiment of the present application. Figure 2 As shown, the identity recognition method may include the following steps:
[0129] Step 201: Obtain a first feature vector and a first similarity score corresponding to the image to be identified.
[0130] The image to be identified contains biological data of the target user.
[0131] In the embodiments of the present application, there are various types of identity recognition, such as face recognition, fingerprint recognition, and iris recognition.
[0132] Face recognition is to confirm a person's identity by analyzing facial features in a face image. When the type of identity recognition is face recognition, the image to be recognized is the face image of the target user, and the target user's biometric data can be the target user's facial (e.g., eyes, nose, mouth, etc.) data.
[0133] Fingerprint recognition is to confirm the identity by analyzing the user's fingerprint image. Each person's fingerprint has unique patterns and characteristics. When the type of identity recognition is fingerprint recognition, the image to be recognized is the fingerprint image of the target user, and the target user's biometric data can be the target user's fingerprint pattern data.
[0134] Iris recognition is the process of confirming identity by analyzing the user's iris image. The iris is a part of the eyeball with a highly unique texture and is not easily interfered by external factors. When the type of identity recognition is iris recognition, the image to be recognized is the iris image of the target user, and the target user's biometric data can be the target user's iris texture data.
[0135] It should be noted that the image to be identified can be obtained through a camera mounted on an electronic device. The user shows his or her face or other biometric features in front of the camera, and the camera captures the image to obtain the image to be identified.
[0136] As an example, the image to be identified can be identified by calling a feature extraction model to obtain a first feature vector and a first similarity score. The feature extraction model can be a pre-trained convolutional neural network model, which extracts a feature vector of the image and outputs an initial similarity score between the feature vector and the template feature vector based on the feature vector and the template feature vector.
[0137] Specifically, firstly, the feature extraction model is used to extract the features of the image to be identified, so as to extract the first feature vector in the image to be identified, and the first feature vector contains the key information of the target user's biological data, such as the key point information on the face in face recognition, the fingerprint texture information in fingerprint recognition, or the iris texture information in iris recognition. Next, the first feature vector is compared with the template feature vector to determine the first similarity score, wherein the template feature vector is pre-stored in the database, is the mathematical representation of the legal user's biological features, and can be obtained by extracting features from the positive sample.
[0138] It should be noted that positive samples refer to samples that belong to the target category or the category of interest, and the corresponding samples are negative samples, which refer to samples that do not belong to the target category or the category of no interest. In the embodiment of the present application, different categories represent the identities of different users. Taking the face recognition scenario as an example, the positive sample is the face image of the legitimate user of the electronic device, and the face image of the legitimate user can be successfully recognized and unlock the electronic device; correspondingly, the negative sample is the face image of the illegal user of the electronic device, and the face image of the illegal user cannot be recognized as the legitimate user, and the electronic device cannot be unlocked by the face image of the illegal user.
[0139] As an example, positive samples can be obtained by collecting biometric images (such as face images, fingerprint images, or iris images) of legitimate users, and the target identity can be identified. Negative samples can be obtained by collecting biometric images of other identities, and other identities cannot be identified.
[0140] As another example, negative samples can also be generated by Generative Adversarial Network (GAN), which is a deep learning model that learns by playing games between two neural networks. It consists of a generator and a discriminator. The generator randomly samples from the latent space as input, and its output needs to imitate the real samples in the training set as much as possible. The input of the discriminator is the real sample or the output of the generator. Its purpose is to distinguish the output of the generator from the real sample as much as possible. The generator and the discriminator compete with each other and learn continuously. Generative adversarial networks can learn generative tasks without using labeled data. Negative samples similar to but different from positive samples can be generated through generative adversarial networks.
[0141] In a possible implementation, the feature extraction model can be generated in the following manner: first, images for training the feature extraction model are collected, and these images should include biological data of different users. Then, these images are preprocessed, including operations such as image scaling, normalization, denoising, and alignment to ensure the consistency and quality of the input data. Then, feature extraction is performed on the images, and each image is labeled, that is, a corresponding identity label is assigned to each sample. Each sample should be labeled with the identity of which user so that the model can learn the correct identity classification. The initial convolutional neural network is trained using the labeled training set. During the training process, some optimization algorithms, such as gradient descent, can be used to continuously adjust the weights and parameters of the model to minimize the classification error. Further, the performance of the feature extraction model can be evaluated by a validation set or cross-validation method. The model performance evaluation can be performed by evaluating indicators such as the accuracy, recall rate, and F1 score of the feature extraction model. If the performance of the model does not meet the requirements, the model can continue to be tuned.
[0142] For ease of explanation, this application abstracts the similarity score as the distance between two feature vectors in the feature space, and the higher the similarity score, the closer the distance between the two feature vectors; the lower the similarity score, the farther the distance between the two feature vectors.
[0143] In the embodiment of the present application, the similarity between two feature vectors can be evaluated by cosine similarity, which is the cosine value of the angle between the two feature vectors, and is used to measure whether the directions of the two feature vectors are similar. The cosine similarity is between [-1, 1], and the closer the cosine similarity value is to 1, the more similar the two feature vectors are.
[0144] As an example in this application, in some scenarios, the positive samples corresponding to the template feature vector may all be images of the same identity. For example, in the scenario of mobile phone face recognition unlocking, the template feature vector comes from one or more positive samples, and these positive samples are all face images of the only user of the mobile phone. And because these positive samples are obtained by collecting the only user, the feature vectors corresponding to these positive samples are similar, so any one of the feature vectors can be used as a template feature vector for subsequent identity recognition, or the average feature vector of these feature vectors can be used as a template feature vector.
[0145] Therefore, as a possible implementation method of an embodiment of the present application, the above-mentioned calling of the feature extraction model to identify the image to be identified to obtain a first feature vector and a first similarity score may include: calling the feature extraction model to extract the first feature vector corresponding to the image to be identified; determining the cosine similarity between the first feature vector and a preset template feature vector through the feature extraction model, and determining the cosine similarity between the first feature vector and the template feature vector as the first similarity score.
[0146] Here, similarity is an abstract concept. In the embodiment of the present application, the cosine similarity between the first feature vector and the template feature vector is determined to convert the abstract concept into a concrete numerical value, and finally the calculated cosine similarity is determined as the first similarity score.
[0147] As another example in the present application, there can be multiple template feature vectors, because the collected positive samples may come from different users. For example, in the access control face recognition unlocking scenario, the access control gate needs to be able to recognize multiple users at the same time. In this case, each user will correspond to a template feature vector, that is, the number of template feature vectors is at least two. Therefore, in the process of identity recognition, it is necessary to match and identify the first feature vector corresponding to the image to be recognized with each template feature vector respectively, and finally at least two second similarity scores can be obtained.
[0148] Therefore, as another possible implementation method of the embodiment of the present application, the above-mentioned determining the cosine similarity between the first feature vector and the preset template feature vector through the feature extraction model, and determining the cosine similarity between the first feature vector and the template feature vector as the first similarity score may include: determining the cosine similarity between the first feature vector and each template feature vector through the feature extraction model, and determining at least two first similarity scores based on the cosine similarity between the first feature vector and each template feature vector.
[0149] It should be understood that the number of first similarity scores is the same as the number of template feature vectors.
[0150] Step 202: Determine the vector density corresponding to the first eigenvector according to a preset mapping relationship between the eigenvector and the vector density.
[0151] It should be noted that the vector density corresponding to the first eigenvector is used to characterize the number of negative samples around the image to be identified.
[0152] Reference Figure 3 , shows a sample distribution diagram provided by an embodiment of the present application. The two black dots are target sample 31 and target sample 32, respectively, and the white origins are negative samples 33. Figure 3 As shown, the number of negative samples around target sample 31 is obviously greater than that of target sample 32, that is, the vector density corresponding to target sample 31 is larger, and it is more difficult to distinguish target sample 31 from negative samples than target sample 32.
[0153] Therefore, it can be understood that the larger the vector density corresponding to the first eigenvector, the more negative samples there are around the image to be identified, the more difficult it is to distinguish the image to be identified, and the lower the final similarity score should be; correspondingly, the smaller the vector density corresponding to the first eigenvector, the smaller the number of negative samples around the image to be identified, the easier it is to distinguish the image to be identified, and the higher the final similarity score should be.
[0154] It is understandable that, assuming there is a target sample, the farther the distance between the negative sample and the target sample (the lower the similarity), the smaller the effect of the negative sample on the vector density of the target sample feature vector, and the effect of the negative sample with a longer distance on the vector density can even be ignored. In other words, the vector density of the target sample feature vector is mainly determined by the several negative samples closest to the target sample. In the embodiment of the present application, the similarity score between the target sample and each negative sample is defined as the third similarity score, and then the third similarity scores are sorted to find the negative samples with the maximum corresponding third similarity score between the target samples (that is, the negative samples closest to the target sample) as the adjacent negative samples, and the vector density corresponding to the target sample is determined based on the adjacent negative samples, and finally the preset mapping relationship is determined according to the vector density corresponding to the multiple target samples. In the above manner, while ensuring the reliability of identity recognition, the amount of calculation for determining the preset mapping relationship is reduced, thereby improving the efficiency of identity recognition.
[0155] Reference Figure 4 , showing a sample distribution diagram obtained through experimental data. Define the second eigenvector as the eigenvector corresponding to the target sample, such as Figure 4 As shown in the curve in , the vector density of the second eigenvector is mainly determined by the negative samples closest to the target sample, and the influence of negative samples far away on the vector density can be ignored.
[0156] Therefore, as a possible implementation method of an embodiment of the present application, the above-mentioned preset mapping relationship can be determined by the following steps: determining a third similarity score between a preset target sample and multiple preset negative samples; sorting each third similarity score from large to small, and determining the negative samples corresponding to at least two third similarity scores at the top of the sort as the neighboring negative samples corresponding to the target sample; determining the vector density corresponding to the target sample based on the neighboring negative samples corresponding to the target sample; and determining the preset mapping relationship based on the vector densities corresponding to multiple target samples.
[0157] It should be noted that the third similarity scores may also be sorted in ascending order, and then the negative samples corresponding to at least two third similarity scores at the end of the sorting are determined as the adjacent negative samples corresponding to the target sample.
[0158] As an example, the number of neighboring negative samples may be two or three, and may also be flexibly selected based on actual application scenarios.
[0159] It is worth noting that since the amount of calculation of vector density is very large, for example, it is necessary to find several adjacent negative samples from a large number of negative samples (for example, find two adjacent negative samples from 10,000 negative samples). Therefore, if the vector density corresponding to the first eigenvector is determined by the above-mentioned method of determining the vector density corresponding to the target sample in the actual application scenario, it will undoubtedly increase the burden on the electronic device. Therefore, in the preparation stage before the actual application of the present application, the preset mapping relationship can be determined by the vector densities corresponding to multiple target samples, and then in actual applications, the vector density corresponding to the first eigenvector can be directly obtained by the preset mapping relationship. While reducing the amount of calculation of the electronic device, the efficiency of identity recognition is improved.
[0160] Furthermore, the process of determining the third similarity score is similar to the process of determining the first similarity score described above, and can be obtained by calculating the cosine similarity between the second eigenvector corresponding to the target sample and the third eigenvector corresponding to each negative sample. That is, as a possible implementation method of an embodiment of the present application, the above-mentioned determination of the third similarity score between a preset target sample and multiple preset negative samples may include: obtaining the second eigenvector corresponding to the target sample and the third eigenvector corresponding to each negative sample; respectively determining the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector, and determining the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector as the third similarity score between the target sample and each negative sample.
[0161] Therefore, by respectively determining the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector, the abstract concept is converted into a concrete numerical value, and finally the calculated cosine similarity is determined as the third similarity score between the target sample and each negative sample.
[0162] As a possible implementation method of the embodiment of the present application, since the neural network can process complex nonlinear mapping relationships and is applicable to various types of data, the second feature vectors corresponding to multiple target samples and the corresponding vector density can be used to train and generate an identity recognition model to establish a preset mapping relationship. The identity recognition model can be a lightweight neural network model. In the subsequent practical application process, the first feature vector of the image to be recognized can be directly input into the identity recognition model to obtain the vector density corresponding to the first feature vector. That is, the above-mentioned determination of the preset mapping relationship based on the vector density corresponding to the multiple target samples can specifically include: establishing a preset mapping relationship in the identity recognition model based on the vector density corresponding to the multiple target samples.
[0163] As another possible implementation method of the embodiment of the present application, the above-mentioned determination of the preset mapping relationship based on the vector density corresponding to the multiple target samples may also specifically include: generating a polynomial approximation function based on the vector density corresponding to the multiple target samples to establish the preset mapping relationship. Among them, polynomial approximation is a method of fitting the mapping relationship between two parameters using a polynomial function, which has a fast calculation speed. In the subsequent actual application process, the first feature vector of the image to be identified can be input into the polynomial approximation function to directly obtain the vector density corresponding to the first feature vector.
[0164] Step 203: modify the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user.
[0165] Among them, a correction coefficient can be generated based on the vector density corresponding to the first feature vector, and the correction coefficient can be a value between [0, 1], and the first similarity score is corrected by the correction coefficient to obtain an updated similarity score. That is, as a possible implementation method of the embodiment of the present application, the above step 204 can include: generating a correction coefficient based on the vector density corresponding to the first feature vector; correcting the first similarity score based on the correction coefficient to determine the second similarity score; and determining the identity recognition result of the target user based on the second similarity score.
[0166] As an example, the larger the vector density, the lower the corresponding correction coefficient can be; the smaller the vector density, the higher the correction coefficient can be.
[0167] As another example, the product of the correction coefficient and the first similarity score may be determined as the second similarity score. For example, if the first similarity score is 0.6 and the correction coefficient is 0.8, the second similarity score is 0.48.
[0168] It should be noted that if there are multiple template feature vectors, the final second similarity scores are also multiple. In this case, it is necessary to determine the identity recognition result of the target user based on the second similarity score with the highest score. That is, as a possible implementation method of the embodiment of the present application, the above step 203 may include: correcting each first similarity score according to the vector density corresponding to the first feature vector to determine at least two second similarity scores; and determining the identity recognition result of the target user according to the second similarity score with the highest score.
[0169] Furthermore, a similarity threshold may be set, and the second similarity score may be judged. When the second similarity score is greater than the preset similarity threshold, the target user's identity recognition result is determined to be a pass; when the second similarity score is less than or equal to the preset similarity threshold, the target user's identity recognition result is determined to be a pass. That is, as a possible implementation method of the present application embodiment, the above determination of the target user's identity recognition result based on the second similarity score may include: judging whether the second similarity score is greater than the preset similarity threshold; if so, determining the target user's identity recognition result is a pass; if not, determining the target user's identity recognition result is a fail.
[0170] It is understandable that the higher the preset similarity threshold is set, the higher the reliability of identity recognition is, but correspondingly, legitimate users may often be misidentified. Therefore, the preset similarity threshold can be set in combination with actual application scenarios, such as 0.5, and the embodiment of the present application does not limit this.
[0171] The identity recognition method provided in the embodiment of the present application is based on the idea that the greater the density of the feature vector, the more difficult it is to distinguish. By utilizing the vector density corresponding to the first feature vector, the first similarity score of the image to be recognized is corrected, thereby improving the reliability of identity recognition and enhancing the user experience.
[0172] In a possible implementation of the present application, when performing identity recognition, in addition to considering the difficulty of distinguishing the image to be recognized, it is also necessary to consider the difficulty of distinguishing the positive sample corresponding to the template feature vector. Therefore, the embodiment of the present application corrects the first similarity score by combining the vector density corresponding to the first feature vector and the vector density corresponding to the second feature vector, and finally obtains the identity recognition result of the target user.
[0173] Combine the following Figure 5 , the identity recognition method provided in the embodiment of the present application is further explained.
[0174] Reference Figure 5 , shows a flow chart of another identity recognition method provided by an embodiment of the present application. Figure 5 As shown, the identity recognition method may include the following steps:
[0175] Step 501: Obtain a first feature vector and a first similarity score corresponding to an image to be identified.
[0176] Step 502: Determine the vector density corresponding to the first eigenvector according to a preset mapping relationship between the eigenvector and the vector density.
[0177] The specific implementation process and principle of the above steps 501-502 can refer to the detailed description of the above embodiment, which will not be repeated here.
[0178] Step 503: Determine the vector density corresponding to the preset template feature vector according to the preset mapping relationship.
[0179] It should be noted that the specific process of the above step 503 is similar to the process of determining the vector density corresponding to the first eigenvector in the above embodiment, and will not be repeated here.
[0180] Step 504: modify the first similarity score according to the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector to determine the identity recognition result of the target user.
[0181] Among them, when the vector density of the template feature vector is larger, it means that the number of negative samples around the positive sample corresponding to the template feature vector is larger, the positive sample corresponding to the template feature vector is more difficult to distinguish, and the final similarity score should be lower; correspondingly, the vector density corresponding to the template feature vector is smaller, it means that the number of negative samples around the positive sample corresponding to the template feature vector is smaller, the positive sample corresponding to the template feature vector is easier to distinguish, and the final similarity score should be higher.
[0182] As a possible implementation of the embodiment of the present application, the first similarity score may be corrected according to the following formula:
[0183] D=dist(f1,f2)*context(f1,f1_Neighbors)*context(f2,f2_Neighbors)*τ;
[0184] Among them, D represents the second similarity score obtained by correcting the first similarity score; f1 represents the first feature vector; f2 represents the template feature vector; dist(f1,f2) represents the cosine similarity between the first feature vector and the template feature vector, that is, the first similarity score; f1_Neighbors represents the k neighboring negative samples corresponding to the image to be identified; f2_Neighbors represents the k neighboring negative samples of the positive sample corresponding to the template feature vector; context() represents the density of the current feature vector, which can be the inverse of the harmonic mean of the distance between the k neighboring negative samples and the M negative samples of other N classes; τ represents the hyperparameter.
[0185] It should be noted that k is usually 2 or 3. N represents the number of categories in the training sample set, which is usually 100. M represents the total number of negative samples, which is usually 10,000. The hyperparameter τ is usually 0.1.
[0186] In addition, the harmonic mean is the reciprocal of the arithmetic mean of the reciprocals of the statistical variables of the population. The specific formula is as follows:
[0187]
[0188] Where H represents the harmonic mean; n represents the total number of calculated distances between k adjacent negative samples and M negative samples from other N classes; x i Represents the i-th calculation result of the distance between k neighboring negative samples and M negative samples of other N classes.
[0189] As another possible implementation of the embodiment of the present application, the first similarity score may also be corrected according to the following formula:
[0190]
[0191] in, and Respectively represent the vector density corresponding to the first eigenvector and the vector density corresponding to the template eigenvector; s i1 represents the cosine similarity between the first feature vector and the feature vector of the corresponding i-th adjacent negative sample; s i2 Represents the cosine similarity between the template feature vector and the feature vector of the corresponding i-th neighboring negative sample.
[0192] It should be noted that the above formula actually includes the process of calculating the vector density through the preset mapping relationship in order to more intuitively reflect the specific calculation process of the first similarity score. In actual application, the process of calculating the vector density can be directly obtained through the preset mapping relationship without specific calculation.
[0193] The identity recognition method provided in the embodiment of the present application corrects the first similarity score by combining the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector, and finally obtains the identity recognition result of the target user, further improving the reliability of identity recognition and enhancing the user experience.
[0194] Taking face recognition as an example, the specific process of an identity recognition method is explained below.
[0195] Reference Figure 6 , shows a schematic diagram of an application scenario of a face recognition method provided by an embodiment of the present application. Figure 6As shown, firstly, the face image is input into the face feature extraction model, the first feature vector is extracted, and then the first similarity score between the first feature vector and the template feature vector is determined. Then, the first similarity score is corrected by the identity recognition model to determine the second similarity score, and finally, it is determined whether the second similarity score is greater than the preset similarity threshold. If so, it is determined that the face recognition has passed, and if not, it is determined that the face recognition has failed.
[0196] In one possible case, the same feature extraction model may have different identity recognition reliability for two different identities. Figure 7 , shows a sample distribution diagram provided in an embodiment of the present application, including a positive sample 71 and a first negative sample 72 of a first identity, and a positive sample 73 and a second negative sample 74 of a second identity. Figure 7 In , the number of negative samples around the sample is represented by the radius of the circle. The larger the radius, the more negative samples there are. Figure 7 As shown, since there are more negative samples around the positive sample 71 of the first identity and the first negative sample 72, it means that the positive sample 71 of the first identity and the first negative sample 72 are more difficult to distinguish. Therefore, in actual use, the result of the feature extraction model can be optimized by the identity recognition method provided in the embodiment of the present application to improve the reliability of identity recognition.
[0197] For another example, assuming that the overall distribution of the positive samples of the third identity is better than that of the fourth identity (for example, the positive sample images of the third identity are clear, the scenes are simple, and they are easy to distinguish, etc.), then in the verification stage after the model training is completed, if the same threshold is used for identity recognition, the following two situations are likely to occur: the first is that the false negative rate (False Negative Rate, FN) corresponding to the fourth identity is high, that is, it is easy to mistake the user corresponding to the fourth identity as an illegal user, resulting in identity authentication failure; the second is that the false positive rate (False Positive Rate, FP) corresponding to the third identity is high, that is, it is easy to mistake the user of the third identity as a legal user, resulting in reduced security of identity authentication. Therefore, the result of the feature extraction model can be optimized by the identity recognition method provided in the embodiment of the present application, for example, different correction coefficients are assigned to the third user and the fourth user, and the correction coefficient of the third user is greater than the correction coefficient of the fourth user.
[0198] Take the feature extraction model using the softmax loss function based on cosine similarity as an example. The goal of the loss function is to make the distance between the positive class and the center greater than the distance between the negative class and the center. Figure 8, shows a sample similarity distribution diagram provided by an embodiment of the present application, wherein region 81 is the positive similarity distribution of the third identity, region 82 is the negative similarity distribution of the third identity, region 83 is the positive similarity distribution of the fourth identity, and region 84 is the negative similarity distribution of the fourth identity. Figure 8 It can be seen that the fourth identity is prone to false negatives. Therefore, the result of the feature extraction model can be corrected by the identity recognition method provided in the embodiment of the present application. The corrected sample similarity distribution diagram is shown in Fig. 9 shown.
[0199] Corresponding to the identity recognition method described in the above embodiment, Fig.10 FIG. 1 is a schematic diagram showing the structure of an identity recognition device provided in an embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown. Fig.10 As shown, the identity recognition device 1000 includes:
[0200] The data acquisition module 1001 is used to acquire a first feature vector and a first similarity score corresponding to an image to be identified, wherein the image to be identified contains biological data of a target user.
[0201] The density determination module 1002 is used to determine the vector density corresponding to the first eigenvector according to a preset mapping relationship between the eigenvector and the vector density.
[0202] The score correction module 1003 is used to correct the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user.
[0203] The identity recognition device provided in the embodiment of the present application is based on the idea that the greater the density of the feature vector, the more difficult it is to distinguish. By utilizing the vector density corresponding to the first feature vector, the first similarity score of the image to be recognized is corrected, thereby improving the reliability of identity recognition and enhancing the user experience.
[0204] In a possible implementation of the second aspect, the score correction module 1003 includes:
[0205] The first determination unit is used to modify the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user, including:
[0206] The second determining unit is used to determine the vector density corresponding to the preset template feature vector according to the preset mapping relationship.
[0207] The third determination unit is used to modify the first similarity score according to the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector to determine the identity recognition result of the target user.
[0208] Optionally, in another possible implementation of the second aspect, the score correction module 1003 includes:
[0209] The first generating unit is used to generate a correction coefficient according to a vector density corresponding to the first eigenvector.
[0210] The fourth determining unit is configured to modify the first similarity score according to the correction coefficient to determine a second similarity score.
[0211] The fifth determining unit is used to determine the identity recognition result of the target user according to the second similarity score.
[0212] Optionally, in yet another possible implementation manner of the second aspect, the fourth determining unit is specifically configured to:
[0213] It is determined whether the second similarity score is greater than a preset similarity threshold.
[0214] If so, the target user's identity recognition result is determined to be recognition passed.
[0215] If not, it is determined that the target user's identity recognition result is recognition failure.
[0216] Optionally, in another possible implementation of the second aspect, the data acquisition module 1001 includes:
[0217] The first acquisition unit is used to call the feature extraction model to identify the image to be identified, so as to obtain a first feature vector and a first similarity score.
[0218] Optionally, in another possible implementation manner of the second aspect, the first acquiring unit is specifically configured to:
[0219] The feature extraction model is called to extract the first feature vector corresponding to the image to be identified.
[0220] The cosine similarity between the first feature vector and a preset template feature vector is determined through the feature extraction model, and the cosine similarity between the first feature vector and the template feature vector is determined as a first similarity score.
[0221] Optionally, in yet another possible implementation manner of the second aspect, the number of the template feature vectors is at least two, and the first acquisition unit is specifically configured to:
[0222] The cosine similarity between the first feature vector and each template feature vector is determined by the feature extraction model, and at least two first similarity scores are determined based on the cosine similarity between the first feature vector and each template feature vector.
[0223] The score correction module 1003 includes:
[0224] The sixth determining unit is configured to modify each first similarity score according to a vector density corresponding to the first feature vector to determine at least two second similarity scores.
[0225] The seventh determination unit is used to determine the identity recognition result of the target user according to the second similarity score with the highest score.
[0226] Optionally, in yet another possible implementation manner of the second aspect, a mapping relationship determination module is further included, and the mapping relationship determination module includes:
[0227] The eighth determining unit is configured to determine a third similarity score between a preset target sample and a plurality of preset negative samples.
[0228] The ninth determining unit is configured to sort the third similarity scores from large to small, and determine the negative samples corresponding to at least two third similarity scores that are ranked first as the adjacent negative samples corresponding to the target sample.
[0229] The tenth determining unit is used to determine the vector density corresponding to the target sample according to the adjacent negative samples corresponding to the target sample.
[0230] The eleventh determining unit is used to determine a preset mapping relationship according to vector densities corresponding to the plurality of target samples.
[0231] Optionally, in another possible implementation manner of the second aspect, the eighth determining unit is specifically configured to:
[0232] Obtain the second eigenvector corresponding to the target sample and the third eigenvector corresponding to each negative sample.
[0233] The cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector is determined respectively, and the cosine similarity between the second eigenvector corresponding to the target sample and each third eigenvector is determined as the third similarity score between the target sample and each negative sample.
[0234] Optionally, in yet another possible implementation manner of the second aspect, the eleventh determining unit is specifically configured to:
[0235] Based on the vector densities corresponding to multiple target samples, a preset mapping relationship is established in the identity recognition model.
[0236] Optionally, in yet another possible implementation manner of the second aspect, the eleventh determining unit is specifically configured to:
[0237] Based on the vector densities corresponding to the multiple target samples, a polynomial approximation function is generated to establish a preset mapping relationship.
[0238] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0239] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0240] Fig.11 Schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. Fig.11 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0241] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0242] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0243] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0244] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0245] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0246] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device 100 through the power management module 141.
[0247] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0248] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0249] Among them, the wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (WiFi network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering processing, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0250] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and / or the satellite based augmentation system (SBAS).
[0251] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.
[0252] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0253] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0254] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes. It is not difficult to understand that when the electronic device is in a stationary state, the value collected by the gyro sensor 180B does not change.
[0255] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100, and is applied to applications such as horizontal and vertical screen switching and pedometers. It is not difficult to understand that when the electronic device is in a stationary state, the value collected by the acceleration sensor 180E does not change.
[0256] It can be seen that the gyro sensor 180B and the acceleration sensor 180E can be used to detect the state of the electronic device, that is, to determine whether the electronic device is in motion or in a stationary state.
[0257] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0258] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0259] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0260] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is an integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0261] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).
[0262] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.
Claims
1. An identity recognition method, characterized in that: include: Obtaining a first feature vector and a first similarity score corresponding to an image to be identified, wherein the image to be identified includes biological data of a target user; Determine, according to a preset mapping relationship between feature vectors and vector density, a vector density corresponding to the first feature vector; the vector density is used to indicate the number of negative samples around the image in the feature space, the negative sample being an image that does not contain the biological data of the target user; The first similarity score is modified according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user.
2. The identity recognition method according to claim 1, characterized in that: The modifying the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user includes: According to the preset mapping relationship, determining a vector density corresponding to a preset template feature vector; The first similarity score is modified according to the vector density corresponding to the first feature vector and the vector density corresponding to the template feature vector to determine the identity recognition result of the target user.
3. The identity recognition method according to claim 1, characterized in that: The modifying the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user includes: generating a correction coefficient according to a vector density corresponding to the first eigenvector; Correcting the first similarity score according to the correction coefficient to determine a second similarity score; An identity recognition result of the target user is determined according to the second similarity score.
4. The identity recognition method according to claim 3, characterized in that: Determining the identity recognition result of the target user according to the second similarity score includes: Determining whether the second similarity score is greater than a preset similarity threshold; If yes, then determining that the target user's identity recognition result is recognition passed; If not, it is determined that the identity recognition result of the target user is recognition failure.
5. The identity recognition method according to claim 1, characterized in that: The obtaining of a first feature vector and a first similarity score corresponding to the image to be identified includes: A feature extraction model is called to identify the image to be identified to obtain the first feature vector and the first similarity score.
6. The identity recognition method according to claim 5, characterized in that: The calling of the feature extraction model to identify the image to be identified to obtain the first feature vector and the first similarity score includes: Calling the feature extraction model to extract a first feature vector corresponding to the image to be identified; The cosine similarity between the first feature vector and a preset template feature vector is determined through the feature extraction model, and the cosine similarity between the first feature vector and the template feature vector is determined as the first similarity score.
7. The identity recognition method according to claim 6, characterized in that: The number of the template feature vectors is at least two, and determining the cosine similarity between the first feature vector and a preset template feature vector through the feature extraction model, and determining the cosine similarity between the first feature vector and the template feature vector as the first similarity score includes: Determine, by means of the feature extraction model, a cosine similarity between the first feature vector and each of the template feature vectors, and determine at least two first similarity scores based on the cosine similarities between the first feature vector and each of the template feature vectors; The modifying the first similarity score according to the vector density corresponding to the first feature vector to determine the identity recognition result of the target user includes: modifying each of the first similarity scores according to a vector density corresponding to the first feature vector to determine at least two second similarity scores; The identity recognition result of the target user is determined according to the second similarity score with the highest score.
8. The identity recognition method according to any one of claims 1 to 7, characterized in that: The preset mapping relationship is determined by the following steps: Determining a third similarity score between a preset target sample and a plurality of preset negative samples; The third similarity scores are sorted from large to small, and negative samples corresponding to at least two third similarity scores that are ranked first are determined as adjacent negative samples corresponding to the target sample; Determine the vector density corresponding to the target sample according to the adjacent negative samples corresponding to the target sample; The preset mapping relationship is determined according to the vector densities corresponding to the plurality of target samples.
9. The identity recognition method according to claim 8, characterized in that: The determining of a third similarity score between a preset target sample and a plurality of preset negative samples includes: Obtaining a second eigenvector corresponding to the target sample and a third eigenvector corresponding to each of the negative samples; The cosine similarity between the second eigenvector corresponding to the target sample and each of the third eigenvectors is determined respectively, and the cosine similarity between the second eigenvector corresponding to the target sample and each of the third eigenvectors is determined as the third similarity score between the target sample and each of the negative samples.
10. The identity recognition method according to claim 8, characterized in that: Applied to the identity recognition model, the determining of the preset mapping relationship according to the vector density corresponding to the plurality of target samples includes: Based on the vector densities corresponding to the plurality of target samples, the preset mapping relationship is established in the identity recognition model.
11. The identity recognition method according to claim 8, characterized in that: The determining the preset mapping relationship according to the vector densities corresponding to the plurality of target samples includes: Based on the vector densities corresponding to the plurality of target samples, a polynomial approximation function is generated to establish the preset mapping relationship.
12. An electronic 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 computer program, the method according to any one of claims 1 to 11 is implemented.
13. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Method for selecting and rapidly comparing robust features of iris images
CN101539990A
Data processing method and device and computer equipment
CN110163265A