Face recognition model evaluation method and device, electronic equipment and storage medium
By calculating the feature similarity distribution and feature distribution of the face recognition model, and optimizing the model using comprehensive evaluation indicators, the problem of declining face recognition accuracy in large-scale face databases was solved, achieving higher recognition accuracy and stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LENS SYST INTEGRATION CO LTD
- Filing Date
- 2023-07-24
- Publication Date
- 2026-06-30
AI Technical Summary
Existing face recognition models are prone to problems such as face mismatch and failure to recognize faces when faced with large-scale face databases. Existing evaluation metrics are difficult to select reasonable thresholds for differentiation, resulting in a decrease in recognition accuracy.
By acquiring face datasets with positive and negative sample pairs and grouped face datasets, we calculate the feature similarity distribution and face feature distribution. We use the first and second model evaluation metrics to comprehensively calculate the overall evaluation metric, which reflects the cohesion and separation of face features and guides model optimization.
It effectively reduces the possibility of misidentification and failure to recognize faces, and improves the recognition accuracy and stability of the face recognition model.
Smart Images

Figure CN116959072B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of model energy efficiency evaluation technology, and more specifically, to an evaluation method, apparatus, electronic device and storage medium for a face recognition model. Background Technology
[0002] Facial recognition, as an important biological indicator authentication technology, has been widely used in various industries. Currently, facial recognition algorithms mainly adopt the metric learning method based on deep learning. The quality of the deep learning model directly determines the algorithm's capabilities and the user experience. Therefore, constructing a reasonable method for evaluating model capabilities plays a crucial role in guiding the optimization of deep learning models.
[0003] Currently, in the field of face recognition, the accuracy of model recognition is mainly calculated using a 1:1 positive-negative face comparison method, the top-1 accuracy of the model search using an N:M face search method, and the pass rate and accuracy of the model search using an N:M face search method with a fixed threshold. However, as the face database increases, the boundaries between faces become increasingly blurred, making face recognition algorithms highly sensitive to the choice of threshold. The facial features of different faces overlap significantly in spatial distribution, making it difficult to choose a reasonable threshold for differentiation, which easily leads to face mixing. Furthermore, because the facial features of the same face are not concentrated, there are cases where face recognition algorithms cannot identify them.
[0004] There are currently no effective solutions to the aforementioned problems in the relevant technologies. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and storage medium for evaluating a face recognition model, in order to solve the technical problem that face recognition models in related technologies are prone to face mismatch and failure to recognize faces.
[0006] According to one aspect of the embodiments of this application, an evaluation method for a face recognition model is provided, comprising: acquiring a positive sample pair face dataset and a negative sample pair face dataset, and acquiring a grouped face dataset, wherein the two face images of any positive sample pair in the positive sample pair face dataset belong to the same object, the two face images of any negative sample pair in the negative sample pair face dataset belong to different objects, and all face images in each group of face data in the grouped face dataset belong to the same object; using the face recognition model to be evaluated to acquire the feature similarity distribution of the positive sample pair face dataset and the negative sample pair face dataset, and using the face recognition model to acquire the face feature distribution of the grouped face dataset; calculating a first model evaluation index based on the feature similarity distribution, and calculating a second model evaluation index based on the face feature distribution; calculating a total evaluation index using the first model evaluation index and the second model evaluation index, wherein the total evaluation index is proportional to the degree of cohesion of face features of the same face extracted by the face recognition model, and the degree of separation of face features of different faces.
[0007] According to another aspect of the embodiments of this application, an evaluation device for a face recognition model is also provided, comprising: a first acquisition module, configured to acquire a positive sample pair face dataset and a negative sample pair face dataset, and to acquire a grouped face dataset, wherein the two face images of any positive sample pair in the positive sample pair face dataset belong to the same object, the two face images of any negative sample pair in the negative sample pair face dataset belong to different objects, and all face images in each group of face data in the grouped face dataset belong to the same object; a second acquisition module, configured to acquire the feature similarity distribution of the positive sample pair face dataset and the negative sample pair face dataset using the face recognition model to be evaluated, and to acquire the face feature distribution of the grouped face dataset using the face recognition model; a calculation module, configured to calculate a first model evaluation index based on the feature similarity distribution, and to calculate a second model evaluation index based on the face feature distribution; and an evaluation module, configured to calculate a total evaluation index using the first model evaluation index and the second model evaluation index, wherein the total evaluation index is proportional to the degree of cohesion of face features of the same face extracted by the face recognition model, and the degree of separation of face features of different faces.
[0008] Further, the second acquisition module includes a first acquisition unit, configured to extract a first feature vector for each face image in the positive sample pair face dataset using the face recognition model to be evaluated, and to extract a second feature vector for each face image in the negative sample pair face dataset; calculate a first feature similarity for each positive sample pair based on the first feature vector, and calculate a second feature similarity for each negative sample pair based on the second feature vector, wherein all first feature similarities form the feature similarity distribution of the positive sample pairs, and all second feature similarities form the feature similarity distribution of the negative sample pairs.
[0009] Furthermore, the first acquisition unit includes a first calculation unit, used to calculate a first feature similarity for each pair of positive samples using the following formula: in, This is the feature vector of the anchor point data in the current group of positive samples. Let θ be the feature vector of the positive sample corresponding to the anchor point data in the current group of positive sample pairs. and The angle between vectors in n-dimensional space takes the value of a real number in the range [0, π]. For vectors and The inner product, For vectors L2 norm, For vectors The L2 norm.
[0010] Furthermore, the calculation unit also includes a second calculation unit, used to calculate the first feature distribution evaluation index based on the first feature similarity and the second feature similarity using the following formula: Wherein, the first feature similarity corresponds to the feature similarity of each positive sample pair, the second feature similarity corresponds to the feature similarity of each negative sample pair, and S t (P1, P2) is the evaluation index of the first characteristic distribution. P1 is the probability distribution calculated from the vector composed of all first feature similarities, P2 is the probability distribution calculated from the vector composed of all second feature similarities, and Γ(P1,P2) is the set of all joint distributions of P1 and P2 in the χ×χ space, where χ is a subset of the real number field R. To iterate through all conjoint distributions and obtain the minimum value of the Δ operation, where Δ=∫ χ×χ |xy| t dγ(x,y) is the transition cost |xy| for the corresponding coordinates (x,y) under the current conjoint probability distribution. tThe integral of the product of the combined probability dγ(x,y) in the χ×χ space, where x is the specific value in the spatial domain of the P1 distribution, y is the specific value in the spatial domain of the P2 distribution, σ1 is the standard deviation of the P1 distribution, and σ2 is the standard deviation of the P2 distribution.
[0011] Furthermore, the second acquisition module also includes a second acquisition unit, used to extract the third feature vector of each face image in the grouped face dataset using the face recognition model; calculate the cluster center point feature of each group of face datasets based on the third feature vector; calculate the third feature similarity between the cluster center point feature corresponding to the current group and the cluster center point feature corresponding to other groups; and calculate the fourth feature similarity between the face feature of each face image in the current group and the cluster center point feature of the current group, wherein all third feature similarities form a face feature distribution of different faces, and all fourth feature similarities form a face feature distribution of the same face.
[0012] Furthermore, the calculation module also includes a third calculation unit, used to use the sum of the minimum values of the third feature similarity of each group as the second feature distribution evaluation index to evaluate the degree of separation of facial features of different faces; and to calculate the sum of the squared averages of the fourth feature similarity as the evaluation of the cohesion of the same face, wherein the third feature similarity is the facial feature similarity between different groups, and the fourth feature similarity is the facial feature similarity between different face images within the same group.
[0013] Furthermore, the evaluation module also includes a fusion unit, used to calculate the total evaluation index of the face recognition model using the first model evaluation index and the second model evaluation index, through the following formula: S′=w St ×S t +w S ×S, where S′ is the total evaluation index, S t w is the first model evaluation metric. St Let S be the weight corresponding to the first model evaluation index, and w be the second model evaluation index. S The weights are the evaluation metrics for the second model.
[0014] According to another aspect of the embodiments of this application, a storage medium is also provided, the storage medium including a stored program that executes the above steps when the program is run.
[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the programs stored in the memory.
[0016] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps in the above-described method.
[0017] This application transforms the feature similarity distribution of positive and negative sample pairs into a specific first model evaluation index, and the facial feature distribution of grouped face datasets into a second model evaluation index. Specific index values are calculated considering the distribution of facial features. Since the high overlap of facial features among different faces easily leads to face-matching issues, and the dispersed distribution of facial features among the same faces easily results in the model being unable to recognize them, the evaluation index effectively reflects whether the facial features of the same face are highly cohesive and whether the facial features of different faces are highly separated. This provides convenience for optimizing face recognition models to address the common issues of face-matching and unrecognition, effectively guiding model optimization and reducing the possibility of face-matching and unrecognition. Attached Figure Description
[0018] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0019] Figure 1 This is a hardware structure block diagram of a computer according to an embodiment of this application;
[0020] Figure 2 This is a flowchart of an evaluation method for a face recognition model according to an embodiment of this application;
[0021] Figure 3 This is a schematic diagram of the face recognition model capability evaluation process based on feature distribution in an embodiment of this application;
[0022] Figure 4 This is a schematic diagram of the evaluation process based on the 1:1 positive and negative face comparison feature similarity distribution in an embodiment of this application;
[0023] Figure 5 This is a schematic diagram illustrating the distribution of feature similarity between positive and negative face comparison samples in an embodiment of this application.
[0024] Figure 6 This is a schematic diagram of the evaluation process based on the grouped and combined facial feature distribution in an embodiment of this application;
[0025] Figure 7 This is a schematic diagram illustrating the distribution of grouped and combined facial features according to an embodiment of this application;
[0026] Figure 8 This is a structural block diagram of an evaluation device for a face recognition model according to an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0029] Example 1
[0030] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile phone, computer, tablet, or similar computing device. Taking running on a computer as an example, Figure 1 This is a hardware structure block diagram of a computer according to an embodiment of this application. Figure 1 As shown, a computer may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the computer may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer described above. For example, the computer may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0031] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to a face recognition model evaluation method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the aforementioned method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0032] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a computer's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0033] This embodiment provides a method for evaluating a face recognition model. Figure 2 This is a flowchart of an evaluation method for a face recognition model according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0034] Step S10: Obtain positive sample pair face dataset and negative sample pair face dataset, and obtain grouped face dataset, wherein the two face images of any positive sample pair in the positive sample pair face dataset belong to the same object, the two face images of any negative sample pair in the negative sample pair face dataset belong to different objects, and all face images in each group of face datasets in the grouped face dataset belong to the same object.
[0035] In this embodiment, the positive sample pair face dataset is a collection of multiple positive sample pairs, and the negative sample pair face dataset is a collection of multiple negative sample pairs. Each positive sample pair includes face image A, face image B, and a label indicating whether A and B are the same face. When A and B are the same face, the label is set to 1, indicating that the (A,B) sample pair is a positive sample pair. Otherwise, the label is set to 0, indicating that the (A,B) sample pair is a negative sample pair.
[0036] In this embodiment, the positive sample pair face dataset and the negative sample pair face dataset can be generated as follows: a) A face image set that has been grouped and saved in the face database based on identity information such as employee ID, and each identity data contains multiple face images of the same person. The face images in the face database are collected through manual registration, manual collection, and other methods such as check-in record collection; b) Randomly select a face image from each identity data as anchor data; c) Randomly select another face image that is different from the anchor from the same identity data and form a positive sample pair with the anchor; d) Finally, randomly select a face image from different identity data and form a negative sample pair with the anchor.
[0037] The grouped face dataset consists of multiple sets of data. Within each set, all face images belong to the same person, while different sets contain face data from different individuals. For example, in this embodiment, the grouped face dataset contains m sets of different face data, each assigned a specific ID code. The i-th set contains ni image samples.
[0038] Grouped face datasets can be obtained directly from face databases collected through manual registration, manual collection, and other check-in record collection methods. These databases are already grouped and stored based on identity information such as employee ID, and each identity data contains multiple face images of the same person.
[0039] Step S20: Use the face recognition model to be evaluated to obtain the feature similarity distribution of the positive sample pair face dataset and the negative sample pair face dataset, and use the face recognition model to obtain the face feature distribution of the grouped face dataset.
[0040] Step S30: Calculate the first model evaluation index based on the feature similarity distribution, and calculate the second model evaluation index based on the face feature distribution;
[0041] Step S40: Calculate the total evaluation index using the first model evaluation index and the second model evaluation index. The total evaluation index is proportional to the degree of cohesion of facial features of the same face extracted by the face recognition model and the degree of separation of facial features of different faces.
[0042] refer to Figure 3In this embodiment, the face recognition model to be evaluated is input, and two evaluation methods are used: a first model evaluation index calculated based on the feature similarity distribution of a 1:1 positive and negative face comparison dataset, and a second model evaluation index calculated based on the grouped face feature distribution. The first and second model evaluation indices are combined to output a comprehensive evaluation result. The 1:1 positive and negative face comparison dataset consists of a positive sample pair face dataset and a negative sample pair face dataset.
[0043] This embodiment calculates the first model evaluation index based on the feature similarity distribution of positive and negative sample pairs, and calculates the second model evaluation index based on the facial feature distribution of grouped face datasets. The specific values of the indexes can effectively reflect whether the facial features of the same face are highly cohesive and whether the facial features of different faces are highly separated, and can intuitively compare and evaluate the optimization of the model on indicators such as face matching and unrecognizable faces.
[0044] In one embodiment of this example, the evaluation method is based on the feature similarity distribution of positive and negative sample pairs, such as... Figure 4 Input the face recognition model to be evaluated, extract features from the 1:1 positive and negative face comparison dataset, calculate the cosine similarity of the features, and calculate the similarity distribution index S of identical / different faces. t (P1, P2), output the first model evaluation result. Specifically, the feature similarity distribution of the positive sample pairs and negative sample pairs face datasets is obtained using the face recognition model to be evaluated, including:
[0045] S21, using the face recognition model to be evaluated, extract the first feature vector of each face image in the face dataset for the positive sample pair, and extract the second feature vector of each face image in the face dataset for the negative sample pair;
[0046] The face recognition model to be evaluated is used to extract features from both positive and negative face datasets. Each face image sample in the dataset yields a feature vector of fixed length.
[0047] S22, calculate the first feature similarity of each positive sample pair based on the first feature vector, and calculate the second feature similarity of each negative sample pair based on the second feature vector, wherein all first feature similarities form the feature similarity distribution of the positive sample pairs, and all second feature similarities form the feature similarity distribution of the negative sample pairs.
[0048] This application calculates the first feature similarity for each pair of positive samples and the second feature similarity for each pair of negative samples. All first feature similarities form the feature similarity distribution for positive sample pairs, and all second feature similarities form the feature similarity distribution for negative sample pairs. Figure 5The diagram showing the feature similarity distribution of positive and negative sample pairs provides a visual analysis of the feature similarity distribution of positive samples (identical faces) and negative samples (different faces), combined with... Figure 5 The mean of the feature similarity distribution for positive sample pairs approaches 1, indicating a high degree of cohesion among facial features of the same face. The mean of the feature similarity distribution for negative sample pairs approaches 0, with little overlap between the distributions corresponding to positive and negative samples, indicating a high degree of separation among facial features of different faces. This results in a low face-crossing rate and a high recognition success rate for the face recognition model. It should be noted that the face-crossing phenomenon in this embodiment can be referred to... Figure 5 The proportion of overlapping facial features among different faces is high. In extreme cases, the mean of the positive sample distribution is almost the same as the mean of the negative sample distribution, meaning that positive and negative samples cannot be clearly distinguished.
[0049] Specifically, calculating the first feature similarity of each pair of positive samples based on the first feature vector includes:
[0050] For each pair of positive samples, the similarity of the first feature is calculated using the following formula: Let this be denoted as Formula 1. In Formula 1, Let A be the first feature vector of the anchor data in the current group of positive samples, where A k Let k be the eigenvalue of index k, a real number taking the value (-∞, +∞). B is the first feature vector of the positive sample corresponding to the anchor data. k Let θ be an eigenvalue of index k, and let θ be a real number taking the value (-∞, +∞). and The angle between vectors in n-dimensional space takes the value of a real number in the range [0, π]. For vectors and The inner product, For vectors L2 norm, For vectors The L2 norm.
[0051] Similarly, the second feature similarity of each negative sample pair can be calculated using Formula 1 above. When calculating the second feature similarity, This is the first feature vector of the negative sample corresponding to the anchor data.
[0052] In this embodiment, calculating the first feature distribution evaluation index based on the feature similarity distribution includes:
[0053] The first feature distribution evaluation index is calculated based on the similarity between the first feature and the second feature using the following formula: This is denoted as Formula 2, where the first feature similarity corresponds to the feature similarity of each positive sample pair, the second feature similarity corresponds to the feature similarity of each negative sample pair, and St(P1, P2) is the evaluation index of the first feature distribution. Let this be Equation 3, where P1 is a vector composed of the similarities of all first features. The calculated probability distribution is as follows, The vector length is m, sim posk P1 represents the feature similarity of the k-th positive sample pair, taking a real number in the range [-1, 1]. P2 is a vector composed of all the second feature similarities. The calculated probability distribution is as follows, The vector length is l. Let Γ(P1,P2) be the feature similarity of the k-th positive sample pair, taking a real number in the range [-1,1]. Let Γ(P1,P2) be the set of all conjoint distributions of the P1 and P2 distributions in the χ×χ space, where χ is a subset of the real number domain R. To iterate through all conjoint distributions and obtain the minimum value of the Δ operation, where Δ=∫ χ×χ |xy| t dγ(x,y) is the transition cost |xy| for the corresponding coordinates (x,y) under the current conjoint probability distribution. t The integral of the product of the combined probability dγ(x,y) in the χ×χ space, where x is the specific value in the spatial domain of the P1 distribution, y is the specific value in the spatial domain of the P2 distribution, σ1 is the standard deviation of the P1 distribution, and σ2 is the standard deviation of the P2 distribution.
[0054] In this embodiment, the Wasserstein Distance and its standard deviation are used as indicators to calculate the distribution of positive and negative face similarity. The Wasserstein Distance is the minimum cost required to transform the P1 distribution into the P2 distribution. The standard deviations of the P1 and P2 distributions are then used to further consider the cohesion of each distribution. The final evaluation index calculation formula is shown in Figure 2. The value of the St(P1,P2) index ranges from [0,+∞), and the value of St is positively correlated with the model performance strength. When the P1 and P2 distributions completely overlap, the value of the St(P1,P2) index is 0. Conversely, as the P1 and P2 distributions gradually separate and become more cohesive, the value of the St(P1,P2) index will gradually increase.
[0055] In another embodiment of this example, an evaluation method based on grouped facial feature distribution is used, such as... Figure 6The process involves inputting the face recognition model to be evaluated, extracting features from the grouped face datasets, calculating the cluster center features of each face dataset, calculating the feature distribution index S of each face dataset, and outputting the second model evaluation result. Specifically, obtaining the face feature distribution of the grouped face datasets using the face recognition model includes:
[0056] S23, the face recognition model is used to extract the third feature vector of each face image in the grouped face dataset;
[0057] S24, Calculate the cluster center point features of each face dataset based on the third feature vector;
[0058] In this embodiment, the cluster center point features of each group of facial features are calculated by calculating the vector mean, which is used to calculate the evaluation index of the second model. The summation of the cluster center point feature vectors of the i-th group of facial data is calculated as follows: This is denoted as Formula 4, where, Let be the cluster center feature vector of the i-th group of face data, where It is the eigenvalue of the subscript k, a real number taking the value (-∞, +∞). Let be the feature vector of the i-th group and the j-th face image data, where is the feature value of subscript k, which is a real number in (-∞, +∞), and ni is the number of face images contained in the i-th group of face data.
[0059] S25, calculate the third feature similarity between the cluster center point feature corresponding to the current group and the cluster center point feature corresponding to each other group, and calculate the fourth feature similarity between the facial features of each face image in the current group and the cluster center point feature of the current group, wherein all third feature similarities form facial feature distributions of different faces, and all fourth feature similarities form facial feature distributions of the same face.
[0060] The third feature similarity and the fourth feature similarity in this embodiment can be calculated according to Formula 1 above.
[0061] Specifically, calculating the second feature distribution evaluation index based on the facial feature distribution includes: using the sum of the minimum values of the third feature similarity of each group as the second feature distribution evaluation index to assess the degree of separation of facial features of different faces; and calculating the sum of the squared averages of the fourth feature similarity as the evaluation of the cohesion of the same face, wherein the third feature similarity is the facial feature similarity between different groups, and the fourth feature similarity is the facial feature similarity between different face images within the same group.
[0062] In this embodiment, since facial feature data cannot be intuitively visualized in a high-dimensional state, in order to intuitively display the distribution of facial features in a high-dimensional state and thus facilitate further analysis of feasible measurement strategies, this embodiment can adopt PCA (Principal Component Analysis) technology (PCA is a data analysis method that can be used for dimensionality reduction of high-dimensional data and can be used to extract the main feature components of the data) to reduce facial features to 3 dimensions while retaining the main feature components. In this embodiment, for example... Figure 7 The image shows three sets of facial feature data selected for display. The specific effect is as follows: Figure 7 As shown in the image, this visualization provides an intuitive understanding of the distribution of facial feature data in a high-dimensional state: identical facial data within a group cluster together, while different facial data between groups are separated.
[0063] In this embodiment, the second characteristic distribution evaluation index is calculated using the following formula: This is denoted as Formula 5, where, Let be the cluster center feature vector of the j-th group of face data. Calculate the feature similarity between the feature vectors of the cluster center points of the i-th and j-th face data groups. This represents the minimum value obtained by applying the Δ operation to the feature vectors of the cluster centers of all groups (excluding the i-th group). Let be the feature vector of the i-th group and the j-th person's face image data. Calculate the feature similarity between the j-th face image data in the i-th group and the feature vector of the cluster center point of the current group.
[0064] In this embodiment, the cosine distances between the cluster centers of different groups of face data are calculated, and the sum of the minimum values is used to evaluate the separation degree of different faces. For the same group of face data, the cosine distances between each image sample and the cluster centers within the group are calculated, and then the sum of the squared averages is used to evaluate the cohesion degree of the same face. The final second model evaluation index is shown in Formula 5 above. The S index value ranges from [0, +∞), and the larger the S value, the stronger the model capability. When all face feature distributions completely overlap, the S index value is 0. Conversely, as different face feature distributions gradually separate and the same face gradually becomes more cohesive, the S index value will gradually increase.
[0065] In this embodiment, calculating the total evaluation index using the first model evaluation index and the second model evaluation index includes: calculating the total evaluation index of the face recognition model using the first model evaluation index and the second model evaluation index through the following formula: This is denoted as Formula 6, where S′ is the overall evaluation index, and S... t As the first model evaluation metric, Let S be the weight corresponding to the first model evaluation index, and w be the second model evaluation index. S The weights are the evaluation metrics for the second model.
[0066] In this embodiment, a weighted average method is used for metric fusion. In the process of training deep learning models, it is often necessary to try a variety of optimization strategies, such as multiple model structures, more training data, multiple data augmentation strategies, multiple loss function strategies, etc. However, not all training strategies can guarantee that the model's capabilities will be improved, and some may even make the model's capabilities worse. Therefore, an evaluation function is needed to guide the evaluation of which training strategies can truly improve the model's capabilities.
[0067] This paper uses the S′ scoring metric as the evaluation function, where S′ ranges from [0, +∞). When the model has no ability to distinguish face data, S′ is 0. As the value of S′ increases, it indicates that the model is better able to make the features of the same face data more cohesive and the features of different face data more separable, that is, the model's ability is becoming stronger. When there are multiple models to be evaluated, the total evaluation metric of each model will vary, with a higher metric value indicating a stronger corresponding model ability, thus helping to select the optimal model.
[0068] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0069] Example 2
[0070] This embodiment also provides an evaluation device for a face recognition model, used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0071] Figure 8 This is a structural block diagram of an evaluation device for a face recognition model according to an embodiment of this application, such as... Figure 8 As shown, the device includes:
[0072] The first acquisition module 81 is used to acquire positive sample pair face datasets and negative sample pair face datasets, as well as to acquire grouped face datasets, wherein the two face images of any positive sample pair in the positive sample pair face dataset belong to the same object, the two face images of any negative sample pair in the negative sample pair face dataset belong to different objects, and all face images in each group of face data in the grouped face dataset belong to the same object.
[0073] The second acquisition module 82 is used to acquire the feature similarity distribution of the positive sample pair face dataset and the negative sample pair face dataset using the face recognition model to be evaluated, and to acquire the face feature distribution of the grouped face dataset using the face recognition model.
[0074] The calculation module 83 is used to calculate a first model evaluation index based on the feature similarity distribution, and to calculate a second model evaluation index based on the face feature distribution.
[0075] Evaluation module 84 is used to calculate a total evaluation index using the first model evaluation index and the second model evaluation index. The total evaluation index is proportional to the degree of cohesion of facial features of the same face extracted by the face recognition model and the degree of separation of facial features of different faces.
[0076] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0077] Example 3
[0078] Embodiments of this application also provide a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0079] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0080] S1, obtain positive sample pair face dataset and negative sample pair face dataset, and obtain grouped face dataset, wherein, in the positive sample pair face dataset, the two face images of any positive sample pair belong to the same object, in the negative sample pair face dataset, the two face images of any negative sample pair belong to different objects, and in each group of face data in the grouped face dataset, all face images belong to the same object.
[0081] S2, using the face recognition model to be evaluated to obtain the feature similarity distribution of the positive sample pairs face dataset and the negative sample pairs face dataset, and using the face recognition model to obtain the face feature distribution of the grouped face dataset;
[0082] S3, calculate the first model evaluation index based on the feature similarity distribution, and calculate the second model evaluation index based on the face feature distribution;
[0083] S4, calculate the total evaluation index using the first model evaluation index and the second model evaluation index. The total evaluation index is proportional to the degree of cohesion of facial features of the same face extracted by the face recognition model and the degree of separation of facial features of different faces.
[0084] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0085] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0086] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0087] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0088] S1, obtain positive sample pair face dataset and negative sample pair face dataset, and obtain grouped face dataset, wherein, in the positive sample pair face dataset, the two face images of any positive sample pair belong to the same object, in the negative sample pair face dataset, the two face images of any negative sample pair belong to different objects, and in each group of face data in the grouped face dataset, all face images belong to the same object.
[0089] S2, using the face recognition model to be evaluated to obtain the feature similarity distribution of the positive sample pairs face dataset and the negative sample pairs face dataset, and using the face recognition model to obtain the face feature distribution of the grouped face dataset;
[0090] S3, calculate the first model evaluation index based on the feature similarity distribution, and calculate the second model evaluation index based on the face feature distribution;
[0091] S4, calculate the total evaluation index using the first model evaluation index and the second model evaluation index. The total evaluation index is proportional to the degree of cohesion of facial features of the same face extracted by the face recognition model and the degree of separation of facial features of different faces.
[0092] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0093] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0094] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0097] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0098] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0099] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for evaluating a face recognition model, characterized in that, The method includes: Obtain positive sample pair face datasets and negative sample pair face datasets, as well as grouped face datasets, wherein the two face images of any positive sample pair in the positive sample pair face dataset belong to the same object, the two face images of any negative sample pair in the negative sample pair face dataset belong to different objects, and all face images in each group of face data in the grouped face dataset belong to the same object. The method of obtaining the feature similarity distribution of the positive sample pair face dataset and the negative sample pair face dataset using the face recognition model to be evaluated includes: extracting a first feature vector for each face image in the positive sample pair face dataset and extracting a second feature vector for each face image in the negative sample pair face dataset using the face recognition model to be evaluated; calculating a first feature similarity for each positive sample pair based on the first feature vector and calculating a second feature similarity for each negative sample pair based on the second feature vector, wherein all first feature similarities form the feature similarity distribution of the positive sample pairs and all second feature similarities form the feature similarity distribution of the negative sample pairs; The method of obtaining the facial feature distribution of the grouped face dataset using the face recognition model includes: extracting the third feature vector of each face image in the grouped face dataset using the face recognition model; calculating the cluster center point feature of each group of face datasets based on the third feature vector; calculating the third feature similarity between the cluster center point feature corresponding to the current group and the cluster center point feature corresponding to other groups; and calculating the fourth feature similarity between the facial features of each face image in the current group and the cluster center point feature of the current group, wherein all third feature similarities form the facial feature distribution of different faces, and all fourth feature similarities form the facial feature distribution of the same face. The first model evaluation index is calculated based on the feature similarity distribution, and the second model evaluation index is calculated based on the facial feature distribution. The first model evaluation index and the second model evaluation index are used to calculate the total evaluation index. The total evaluation index is proportional to the degree of cohesion of facial features of the same face extracted by the face recognition model and the degree of separation of facial features of different faces.
2. The method according to claim 1, characterized in that, The calculation of the first feature similarity of each positive sample pair based on the first feature vector includes: For each pair of positive samples, the similarity of the first feature is calculated using the following formula: ,in, This is the first feature vector of the anchor point data in the current group of positive samples. This is the first feature vector of the positive sample in the current group of positive sample pairs that corresponds to the anchor point data. for and The angle between vectors in n-dimensional space takes the value of real numbers, For vectors and The inner product, For vectors L2 norm, For vectors The L2 norm.
3. The method according to claim 1, characterized in that, The first model evaluation index is calculated based on the feature similarity distribution, including: The first model evaluation index is calculated using the following formula based on the similarity of the first feature and the similarity of the second feature: Wherein, the first feature similarity corresponds to the feature similarity of each pair of positive samples, and the second feature similarity corresponds to the feature similarity of each pair of negative samples. As the first model evaluation metric, P1 is the probability distribution calculated from the vector composed of all first-feature similarities, and P2 is the probability distribution calculated from the vector composed of all second-feature similarities. For P1 distribution and P2 distribution in The set of all conjoint distributions in space, the For a subset of the real number field R, To traverse all conjoint distributions and obtain The minimum value of the operation, where, The transition cost for the corresponding coordinates (x, y) under the current conjoint probability distribution. With the probability of union Product in The integral in space, where x is a specific value in the spatial domain of distribution P1, and y is a specific value in the spatial domain of distribution P2. Let P1 be the standard deviation of the distribution. Let be the standard deviation of the P2 distribution.
4. The method according to claim 1, characterized in that, The second model evaluation index is calculated based on the facial feature distribution, including: The sum of the minimum third feature similarity values of each group is used as the second model evaluation index to evaluate the degree of separation of facial features of different faces; The sum of the squared averages of the fourth feature similarity is used to evaluate the cohesion of the same face. The third feature similarity is the facial feature similarity between different groups, and the fourth feature similarity is the facial feature similarity between different face images within the same group.
5. The method according to claim 1, characterized in that, The calculation of the total evaluation index using the first model evaluation index and the second model evaluation index includes: Using the first model evaluation index and the second model evaluation index, the total evaluation index of the face recognition model is calculated using the following formula: ,in, For the overall evaluation indicators, As the first model evaluation metric, The weights corresponding to the evaluation metrics of the first model are: As the evaluation metric for the second model, The weights are the evaluation metrics for the second model.
6. An evaluation device for a face recognition model, characterized in that, include: The first acquisition module is used to acquire positive sample pair face datasets and negative sample pair face datasets, as well as grouped face datasets, wherein the two face images of any positive sample pair in the positive sample pair face dataset belong to the same object, the two face images of any negative sample pair in the negative sample pair face dataset belong to different objects, and all face images in each group of face data in the grouped face dataset belong to the same object. The second acquisition module is used to acquire the feature similarity distribution of the positive sample pair face dataset and the negative sample pair face dataset using the face recognition model to be evaluated. This includes: extracting a first feature vector for each face image in the positive sample pair face dataset and extracting a second feature vector for each face image in the negative sample pair face dataset using the face recognition model to be evaluated; calculating a first feature similarity for each positive sample pair based on the first feature vector and a second feature similarity for each negative sample pair based on the second feature vector, wherein all first feature similarities form the feature similarity distribution of the positive sample pairs, and all second feature similarities form the feature similarity distribution of the negative sample pairs. The method of obtaining the facial feature distribution of the grouped face dataset using the face recognition model includes: extracting the third feature vector of each face image in the grouped face dataset using the face recognition model; calculating the cluster center point feature of each group of face datasets based on the third feature vector; calculating the third feature similarity between the cluster center point feature of the current group and the cluster center point feature of each other group; and calculating the fourth feature similarity between the facial features of each face image in the current group and the cluster center point feature of the current group, wherein all third feature similarities form the facial feature distribution of different faces, and all fourth feature similarities form the facial feature distribution of the same face. The calculation module is used to calculate a first model evaluation index based on the feature similarity distribution, and to calculate a second model evaluation index based on the facial feature distribution. The evaluation module is used to calculate a total evaluation index using the first model evaluation index and the second model evaluation index. The total evaluation index is proportional to the degree of cohesion of facial features of the same face extracted by the face recognition model and the degree of separation of facial features of different faces.
7. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other through the communication bus; wherein: Memory, used to store computer programs; A processor for executing the method steps of any one of claims 1 to 5 by running a program stored in memory.
8. A storage medium, characterized in that, The storage medium includes a stored program, wherein the program, when executed, performs the method steps of any one of claims 1 to 5.