A face recognition output result screening method and device
By employing the maximum inter-class variance algorithm and the threshold self-learning algorithm, the problems of inaccurate recognition results and high manual screening costs in the field of face recognition technology in public safety are solved, realizing automated target face image screening and improving recognition efficiency and usability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING WONDERSOFT TECH CO LTD
- Filing Date
- 2023-05-31
- Publication Date
- 2026-05-05
AI Technical Summary
Existing facial recognition technology cannot guarantee 100% accuracy in the field of public safety. Furthermore, the large target facial feature database makes it difficult to determine whether the target face has been detected using a simple threshold. This requires manual screening of the output results, which consumes a lot of manpower and financial resources.
The algorithm employs the maximum inter-class variance algorithm and the threshold self-learning algorithm. By calculating the maximum inter-class variance of the top k similarity values output by the face recognition algorithm, it determines whether the target face to be detected is matched, and selects the target face image if it is matched.
It reduces reliance on human judgment, lowers the cost of applying facial recognition technology in the field of public safety, and improves recognition efficiency and usability.
Smart Images

Figure CN116631035B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a method and device for filtering face recognition output results. Background Technology
[0002] Public safety is a crucial cornerstone of social stability and prosperity, characterized by its wide service scope and large data volume. Maintaining public safety requires necessary monitoring and identification of citizens or users. Facial recognition technology compares faces in an image to a feature database built upon those faces to verify identity or identify individuals. Therefore, facial recognition technology has become an important component of the public safety field.
[0003] Reference Figure 1 This diagram illustrates a flowchart of existing face recognition technology based on artificial intelligence algorithms, which may include the following steps:
[0004] Input: q, target face image library M, k=5
[0005] A1. Read the image to be detected, q;
[0006] A2. Based on the deep residual neural network algorithm, the facial features of the target face in the image to be detected are extracted to obtain the facial features F of the target face.
[0007] A3. Calculate the similarity between face feature F and each face feature in the target face image library M using Euclidean distance, and return the top-k (top-5) most similar face features in descending order.
[0008] A4. Based on the top-5 facial features, query the corresponding facial images from the target facial image database M.
[0009] A5. Manually determine whether the returned target face image contains the face in the image to be detected q.
[0010] The output consists of two parts: 1) target face images; 2) similarity. The k (k=5) target face images represent the 5 face images in the target face database that have the highest similarity to the face image to be detected; the similarity represents the degree of similarity between the k most similar target face images and the face image to be detected. The similarity value ranges from [0,1]. The higher the similarity value, the higher the similarity between the two face images.
[0011] Based on whether the returned results contain an image of the target face to be detected, the output results can be divided into:
[0012] (1) It contains n (n <= k, where k is the number of output results) target human faces, which are recorded as the detected human face images that are successfully recognized.
[0013] (2) It does not contain the target human face, which is recorded as the detected human face images that are not successfully recognized.
[0014] Due to the large number of users to be identified in the field of public security, the following problems exist in the application of face recognition technology in this field:
[0015] (1) The field of public security requires a high recognition accuracy for the target person. However, the current face recognition technology cannot ensure that the recognition results are 100% accurate. Instead, it often returns the top-k similar face images to improve the effectiveness of the face recognition results.
[0016] (2) The target face feature database is huge, resulting in a high similarity between different face features. It is impossible to determine whether the k results returned by the face recognition algorithm contain the face of the target to be detected, that is, whether the target to be detected is successfully recognized, through a simple threshold.
[0017] (3) Among the k results returned by the face recognition algorithm, there may be n (n < k) detected target face images. It is necessary to screen out the images that contain the detected target face images from the output results.
[0018] In response to the above problems, the traditional solution is to use the manual method to complete the screening of the output results. However, the manual method will consume a huge amount of manpower and financial resources in the field of public security with a large number of detection tasks, and it cannot meet the requirements of high-efficiency recognition in the field of public security. Therefore, how to accurately screen out the detected target face images from the returned results has become an urgent problem to be solved for the face recognition algorithm. Summary of the Invention
[0019] In view of the deficiencies in the prior art, embodiments of the present invention provide a method for screening face recognition output results and a device for screening face recognition output results.
[0020] In a first aspect, embodiments of the present invention provide a method for screening face recognition output results, including:
[0021] Read the detected target face image;
[0022] Based on a preset face recognition algorithm, identify similar face images from the target face database and output the top k similar face images and the corresponding top k similarity values in descending order of the similarity values;
[0023] Calculate the maximum between-class variance of the top k similarity values;
[0024] If the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, then it is determined that the output result does not match the target face image to be detected.
[0025] Otherwise, the output result is determined to match the target face image to be detected, and the target face image is selected from the top k similar face images according to the maximum inter-class variance.
[0026] Optionally, as described above, the maximum inter-class variance threshold is determined in the following manner:
[0027] Set up a face recognition training dataset S and a target face training dataset Q to be detected;
[0028] Based on the target face training dataset Q, the training data in the face recognition training dataset S is divided into hit training datasets S. h and the training dataset S that was not hit n ;
[0029] For each target face data in the target face training dataset Q, based on the preset face recognition algorithm, the data is extracted from the hit training dataset S. h and the missing training dataset S n The system identifies similar face images and outputs two sets of the top k similarity values in descending order of similarity value. The first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values are calculated respectively.
[0030] Based on the first maximum inter-class variance and the second maximum inter-class variance, the maximum inter-class variance threshold T is determined.
[0031] As described above, optionally, for each target face data q in the training dataset Q of the target face to be detected... i Based on the preset face recognition algorithm, the data are respectively extracted from the training dataset S. h Neutralize the missing training dataset S n The system identifies similar face images and outputs two sets of the top k similarity values in descending order of similarity. It then calculates the first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values, including:
[0032] Take any one target face data q from the target face training dataset Q. i ;
[0033] Based on the preset face recognition algorithm, from the hit training dataset S h The system identifies similar face images and outputs the top k similarity values in descending order.
[0034] The first maximum inter-class variance v of the first k similarity values is calculated using the maximum inter-class variance algorithm. i and the first largest inter-class variance v i Stored into the first array V h The process continues until all the target face data in the target face training dataset Q is identified.
[0035] Based on the preset face recognition algorithm, the training dataset S that has never been hit is... n The system identifies similar face images and outputs the top k similarity values in descending order.
[0036] The second maximum inter-class variance v of the first k similarity values is calculated using the maximum inter-class variance algorithm. j and the second largest inter-class variance v j Stored into the second array V n This process continues until all the target face data in the target face training dataset Q is identified.
[0037] Optionally, as described above, determining the maximum inter-class variance threshold T based on the first maximum inter-class variance and the second maximum inter-class variance includes:
[0038] Calculate the first array V h The minimum value V in min and the maximum value V in the second array max ;
[0039] The minimum value V min and the maximum value V max The average value is used as the maximum inter-class variance threshold T.
[0040] Optionally, as described above, calculating the maximum inter-class variance of the first k similarity values includes:
[0041] Calculate the inter-class variance between the first n similarity values and the last kn similarity values from the first k similarity values in sequence, and store the calculated inter-class variances into list L in order, where n is a positive integer in the interval [1, k).
[0042] The maximum value Lmax in the list L is taken as the maximum inter-class variance of the first k similarity values.
[0043] Optionally, as described above, the step of selecting the target face image from the top k similar face images based on the maximum inter-class variance includes:
[0044] Determine the list index m corresponding to the maximum value Lmax in the list L, where m is a positive integer in the interval [1, n].
[0045] The first m similar face images out of the first k similar face images are determined as the target face images.
[0046] Optionally, as described above, the preset face recognition algorithm is a face recognition algorithm based on the deep residual neural network ResNet-50.
[0047] Secondly, embodiments of the present invention provide a face recognition output result filtering device, comprising:
[0048] The reading module is used to read the face image of the target to be detected;
[0049] The recognition module is used to identify similar face images from the target face database based on a preset face recognition algorithm, and output the top k similar face images and their corresponding top k similarity values in descending order of similarity value;
[0050] The calculation module is used to calculate the maximum inter-class variance of the first k similarity values;
[0051] The judgment module is used to determine that the output result does not match the target face image to be detected if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm.
[0052] The output module is used to determine that the output result hits the target face image to be detected if the maximum inter-class variance is not less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, and to select the target face image from the first k similar face images according to the maximum inter-class variance.
[0053] Optionally, the apparatus described above may further include: a training module, the training module being used for:
[0054] Set up a face recognition training dataset S and a target face training dataset Q to be detected;
[0055] Based on the target face training dataset Q, the training data in the face recognition training dataset S is divided into hit training datasets S. h and the training dataset S that was not hit n ;
[0056] For each target face data in the target face training dataset Q, based on the preset face recognition algorithm, the data is extracted from the hit training dataset S. h and the missing training dataset S nThe system identifies similar face images and outputs two sets of the top k similarity values in descending order of similarity value. The first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values are calculated respectively.
[0057] Based on the first maximum inter-class variance and the second maximum inter-class variance, the maximum inter-class variance threshold T is determined.
[0058] As described above, optionally, the training module is used to train each target face data q in the target face dataset Q. i Based on the preset face recognition algorithm, the data are respectively extracted from the training dataset S. h Neutralize the missing training dataset S n The system identifies similar face images and outputs two sets of the top k similarity values in descending order of similarity. Specifically, when calculating the first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values, it is used for:
[0059] Take any one target face data q from the target face training dataset Q. i ;
[0060] Based on the preset face recognition algorithm, from the hit training dataset S h The system identifies similar face images and outputs the top k similarity values in descending order.
[0061] The first maximum inter-class variance v of the first k similarity values is calculated using the maximum inter-class variance algorithm. i and the first largest inter-class variance v i Stored into the first array V h The process continues until all the target face data in the target face training dataset Q is identified.
[0062] Based on the preset face recognition algorithm, the training dataset S that has never been hit is... n The system identifies similar face images and outputs the top k similarity values in descending order.
[0063] The second maximum inter-class variance v of the first k similarity values is calculated using the maximum inter-class variance algorithm. j and the second largest inter-class variance v j Stored into the second array V n This process continues until all the target face data in the target face training dataset Q is identified.
[0064] As described above, optionally, when the training module is used to determine the maximum inter-class variance threshold T based on the first maximum inter-class variance and the second maximum inter-class variance, it specifically includes:
[0065] Calculate the first array V h The minimum value V in min and the maximum value V in the second array max ;
[0066] The minimum value V min and the maximum value V max The average value is used as the maximum inter-class variance threshold T.
[0067] As described above, optionally, the computing module 630 is specifically used for:
[0068] Calculate the inter-class variance between the first n similarity values and the last kn similarity values from the first k similarity values in sequence, and store the calculated inter-class variances into list L in order, where n is a positive integer in the interval [1, k).
[0069] The maximum value Lmax in the list L is taken as the maximum inter-class variance of the first k similarity values.
[0070] As described above, optionally, the output module is specifically used for:
[0071] Determine the list index m corresponding to the maximum value Lmax in the list L, where m is a positive integer in the interval [1, n].
[0072] The first m similar face images out of the first k similar face images are determined as the target face images.
[0073] Optionally, the preset face recognition algorithm of the device described above is a face recognition algorithm based on the deep residual neural network ResNet-50.
[0074] Thirdly, embodiments of the present invention provide an electronic device, comprising:
[0075] The system includes a memory and a processor, which communicate with each other via a bus. The memory stores program instructions executable by the processor. The processor can execute the following methods by calling the program instructions: reading a target face image to be detected; identifying similar face images from a target face database based on a preset face recognition algorithm, and outputting the top k similar face images and their corresponding top k similarity values in descending order of similarity value; calculating the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, then determining that the output result does not match the target face image to be detected; otherwise, determining that the output result matches the target face image to be detected, and selecting the target face image from the top k similar face images based on the maximum inter-class variance.
[0076] Fourthly, embodiments of the present invention provide a storage medium storing a computer program, which, when executed by a processor, implements the following method: reading a target face image to be detected; identifying similar face images from a target face database based on a preset face recognition algorithm, and outputting the top k similar face images and their corresponding top k similarity values in descending order of similarity value; calculating the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, then determining that the output result does not match the target face image to be detected; otherwise, determining that the output result matches the target face image to be detected, and selecting the target face image from the top k similar face images according to the maximum inter-class variance.
[0077] The face recognition output result filtering scheme provided in this embodiment of the invention reads the target face image to be detected; based on a preset face recognition algorithm, it identifies similar face images from the target face database, and outputs the top k similar face images and their corresponding top k similarity values in descending order of similarity value; it calculates the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, it is determined that the output result does not match the target face image to be detected; otherwise, it is determined that the output result matches the target face image to be detected, and the target face image is filtered out from the top k similar face images according to the maximum inter-class variance. This scheme utilizes the maximum inter-class variance algorithm and the threshold self-learning algorithm to determine whether a target face is detected based on the top k similarity scores output by the face recognition algorithm. If a match is found, the scheme selects the target face images from the target face database. This alleviates the drawback of face recognition results relying too heavily on manual judgment, reduces the cost of applying face recognition technology in the public safety field, improves the work efficiency and effectiveness of security maintenance personnel, and enhances the usability and practicality of face recognition technology in the public safety field. Attached Figure Description
[0078] Figure 1 This is a flowchart of existing facial recognition technology based on artificial intelligence algorithms;
[0079] Figure 2 This is a flowchart illustrating the steps of an embodiment of a face recognition output result filtering method according to the present invention;
[0080] Figure 3 This is a schematic diagram illustrating the application of the maximum inter-class variance algorithm in face recognition results in an embodiment of a face recognition output result filtering method of the present invention.
[0081] Figure 4 This is a schematic diagram of the training process in an embodiment of a face recognition output result filtering method of the present invention;
[0082] Figure 5 This is a schematic diagram of the prediction process in an embodiment of a face recognition output result filtering method of the present invention;
[0083] Figure 6 This is a structural block diagram of an embodiment of a face recognition output result filtering device of the present invention;
[0084] Figure 7 This is a structural block diagram of an embodiment of an electronic device according to the present invention. Detailed Implementation
[0085] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0086] In existing technologies, the selection of face recognition output results is done manually. However, in the public security field with massive detection tasks, manual methods consume enormous human and financial resources and cannot meet the requirements of efficient recognition in the public security field. To solve this problem, this embodiment of the invention reads the target face image to be detected; based on a preset face recognition algorithm, it identifies similar face images from the target face database and outputs the top k similar face images and their corresponding top k similarity values in descending order of similarity value; it calculates the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, it is determined that the output result does not match the target face image to be detected; otherwise, it is determined that the output result matches the target face image to be detected, and the target face image is selected from the top k similar face images according to the maximum inter-class variance. This scheme utilizes the maximum inter-class variance algorithm and the threshold self-learning algorithm to determine whether the target face is matched based on the top k similarity values output by the face recognition algorithm. If the match is matched, the target face image is selected from the target face database. This solves the drawback of relying on manual judgment for face recognition results, reduces the cost of applying face recognition technology in the field of public safety, and improves the usability and practicality of face recognition technology in the field of public safety.
[0087] Reference Figure 2 The diagram illustrates a step flowchart of an embodiment of a face recognition output result filtering method according to the present invention, which may specifically include the following steps:
[0088] Step S210: Read the image of the target face to be detected;
[0089] Specifically, when it is necessary to recognize a face image, the target face image I to be detected is first read. The target face image I to be detected is a face image that has been preprocessed, such as denoising, key point detection, and face alignment of the original face image.
[0090] Step S220: Based on the preset face recognition algorithm, identify similar face images from the target face database, and output the top k similar face images and the corresponding top k similarity values in descending order of similarity value;
[0091] Specifically, based on a preset face recognition algorithm, face features F are first extracted from the target face image I to be detected. Then, the similarity between face features F and the face features of each face image in the target face database M is calculated. For example, the similarity between face features F and the face features of each face image in the target face database M is calculated using Euclidean distance. According to the similarity values arranged from largest to smallest, the top k similar face images and their corresponding top k similarity values are output, that is, the Top-k similar face images and their similarity values are output. For example, the Top-5 similar face images and their 5 similarity values are output.
[0092] The preset face recognition algorithm can be a deep residual neural network algorithm, such as the ResNet-50 algorithm. The preset face recognition algorithm defines a method for extracting face features F. Through the preset face recognition algorithm, the face features F of the target face image I to be detected can be obtained. It should be noted that the face features of each face image in the target face database M are also obtained through the same face recognition algorithm. The extraction of face features of each face image in the target face database M can be completed in advance, and then the face features of each face image can be saved. When face recognition is required, only the face features of the face image to be recognized need to be extracted, which can improve the recognition efficiency.
[0093] Step S230: Calculate the maximum inter-class variance of the first k similarity values;
[0094] Specifically, the Otsu method was proposed by Japanese scholar Otsu. The inter-class variance is the weighted variance of the distance between the individual means of the data on both sides of the threshold and the overall mean. The inter-class variance characterizes the dispersion of the data on both sides of the threshold. The larger the inter-class variance, the greater the difference between the foreground and the background, and the better the binarization effect. With the help of the inter-class variance, the top-k similar face images can be divided into two types: images that match the target face and images that do not match the target face.
[0095] For the top-k similar face images and their similarity values identified, firstly, the inter-class variance between the first n similarity values and the last kn similarity values is calculated sequentially, where n is a positive integer in the interval [1, k). It should be noted that the k similarity values are arranged in descending order of similarity. The calculated inter-class variances are then stored in list L, where the indices represent the order in which the inter-class variances are stored.
[0096] Then find the maximum class value Lmax in list L, and use this value as the maximum inter-class variance of the first k similarity values.
[0097] For example, refer to Figure 3This diagram illustrates the application of the maximum inter-class variance algorithm in face recognition results in an embodiment of the face recognition output result filtering method of the present invention. When k=5, for the top-5 similar face images, the five largest similarity values are divided into group 1 and group 2, and the inter-class variance between group 1 and group 2 is calculated. First, the first similarity value of 0.9014 is taken as group 1, and the other four similarities are taken as group 2. The inter-class variance is calculated and denoted as inter-class variance 1. Inter-class variance 1 is stored in list L, and the index of inter-class variance 1 in list L is 1. Then, the first two similarities of 0.9014 and 0.8114 are taken as group 1, and the last three similarities are taken as group 2. The inter-class variance is calculated and denoted as inter-class variance 2. Inter-class variance 2 is stored in list L. In the first list L, the index of the inter-class variance 2 is 2. Then, the first three similarities (0.9014, 0.8114, 0.8014) are grouped into group 1, and the last two similarities are grouped into group 2. The inter-class variance is calculated and denoted as inter-class variance 3. Inter-class variance 3 is stored in list L, and its index in list L is 3. Then, the first four similarities (0.9014, 0.8114, 0.8014, 0.7934) are grouped into group 1, and the last similarity is grouped into group 2. The inter-class variance is calculated and denoted as inter-class variance 4. Inter-class variance 4 is stored in list L, and its index in list L is 4. Finally, the maximum value Lmax in list L is found, and the maximum value Lmax is taken as the maximum inter-class variance of the five largest similarity values.
[0098] Step S240: If the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, then it is determined that the output result does not hit the target face image to be detected.
[0099] Specifically, the first step, based on the maximum inter-class variance threshold obtained through pre-training a preset face recognition algorithm, may include the following steps:
[0100] First, set up the face recognition training dataset S and the target face training dataset Q;
[0101] Then, based on the target face training dataset Q, the training data in the face recognition training dataset S is divided into a hit training dataset S. h and the training dataset S that was not hit n .
[0102] Among them, the training dataset S was hit. h This indicates that all faces in the images of the target face dataset Q match the faces in the training dataset S. h The training dataset S was not hit. n This indicates that none of the faces in the images of the target face dataset Q were found in the training dataset S that did not match. nIt appears in the training dataset S. h and the training dataset S that was not hit n The intersection can be empty or contain the intersection.
[0103] Then, for each target face data in the training dataset Q, based on the preset face recognition algorithm, the data is retrieved from the training dataset S. h and the training dataset S that was not hit n The system identifies similar face images and outputs two sets of the top k similarity values in descending order of similarity. The first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values are calculated respectively.
[0104] Specifically, a target face data q is randomly selected from the target face training dataset Q. i Using a pre-defined face recognition algorithm, such as a deep residual neural network algorithm, for example, the ResNet-50 deep residual neural network algorithm, q is extracted. i Facial features Fi, and from the training dataset S h The algorithm identifies similar face images, obtains similar face images and their corresponding similarity values, and outputs the top-k similarity values in descending order, which are recorded as the first group of similarity values.
[0105] The maximum inter-class variance (MAV) of the first set of similarity values is calculated using the Otsu's algorithm, and denoted as the first maximum inter-class variance (VV). i And the first largest inter-class variance v i Stored into the first array V h In the next step, let i = i + 1, and continue executing the above steps until all target face data q in the target face training dataset Q are detected. i All facial recognition operations were completed, and the first array V was obtained. h The dataset Q stores the face data q of each target face to be detected in the training dataset Q. i Hit the training dataset S h The first maximum inter-class variance v corresponding to the recognition result in the data i .
[0106] Simultaneously, randomly select one target face data q from the target face training dataset Q. i Using a pre-defined face recognition algorithm, such as a deep residual neural network algorithm, for example, the ResNet-50 deep residual neural network algorithm, q is extracted. i The facial feature Fi never matched the training dataset S. n The algorithm identifies similar face images, obtains similar face images and their corresponding similarity values, and outputs the top-k similarity values in descending order, which are recorded as the second group of similarity values.
[0107] The maximum inter-class variance (MAV) of the second set of similarity values is calculated using the Otsu's algorithm, and denoted as the second Otsu's MAV v. j And the second largest inter-class variance v j Stored into the second array V n In the next step, let i = i + 1, and continue executing the above steps until all target face data q in the target face training dataset Q are detected. i All facial recognition operations were completed, resulting in the second array V. n The dataset Q stores the face data q of each target face to be detected in the training dataset Q. i In the training dataset S that was not hit n The second largest inter-class variance v corresponding to the recognition results in j .
[0108] Finally, based on the first maximum inter-class variance and the second maximum inter-class variance, the maximum inter-class variance threshold T is determined.
[0109] Specifically, due to the first array V h The dataset Q stores the face data q of each target face to be detected in the training dataset Q. i Hit the training dataset S h The first maximum inter-class variance v corresponding to the recognition result in the data i The second array V n The dataset Q stores the face data q of each target face to be detected in the training dataset Q. i In the training dataset S that was not hit n The second largest inter-class variance v corresponding to the recognition results in j Therefore, the first array V can be calculated. h The minimum value V in min The maximum value V in the second array max , the minimum value V min and maximum value V max The average value is used as the maximum inter-class variance threshold T, which is calculated using the following formula:
[0110]
[0111] The above-mentioned method for obtaining the threshold is a statistical threshold self-learning algorithm. It calculates the maximum inter-class variance threshold (hit threshold) T by statistically analyzing the minimum inter-class variance in the output of the face image to be detected that hits the target face image and the maximum inter-class variance in the output of the face image to be detected that misses the target face image in the training dataset.
[0112] After determining the maximum inter-class variance threshold T during the training phase, in the prediction phase, face recognition is performed based on a preset face recognition algorithm, such as a face recognition algorithm based on a deep residual neural network ResNet-50 (the same face recognition algorithm used in the training phase). The top k similar face images and their corresponding top k similarity values are output in descending order of similarity value. The maximum inter-class variance of the top k similarity values is calculated, and then compared with the maximum inter-class variance threshold T. If the maximum inter-class variance is less than the maximum inter-class variance threshold T, it is determined that the output result does not match the target face image to be detected, that is, the face recognition output result does not contain the target face image to be detected.
[0113] Step S250: Otherwise, determine that the output result hits the target face image to be detected, and select the target face image from the first k similar face images according to the maximum inter-class variance.
[0114] Specifically, face recognition is performed based on a preset face recognition algorithm, such as a face recognition algorithm based on a deep residual neural network ResNet-50 (the same face recognition algorithm used in the training phase). The top k similar face images and their corresponding top k similarity values are output in descending order of similarity value. The maximum inter-class variance of the top k similarity values is calculated. Then, the maximum inter-class variance is compared with the maximum inter-class variance threshold T. If the maximum inter-class variance is greater than the maximum inter-class variance threshold T, it is determined that the output result hits the target face image to be detected, that is, the face recognition output result contains the target face image to be detected.
[0115] Furthermore, after confirming that the face recognition output contains the image of the target face to be detected, it is also necessary to filter out these images.
[0116] If the maximum inter-class variance during the prediction phase is greater than the maximum inter-class variance threshold T, then the target face image is selected from the first k similar face images based on this maximum inter-class variance. Specifically, the inter-class variances of the first n similarity values and the last kn similarity values among the first k similarity values are calculated sequentially, and the calculated inter-class variances are stored in list L in order, where n is a positive integer in the interval [1, k). The maximum value Lmax in list L is taken as the maximum inter-class variance of the first k similarity values. Then, the list index m corresponding to the maximum value Lmax in list L is determined, where m is a positive integer in the interval [1, n]. The first m similar face images among the first k similar face images are determined as the target face images.
[0117] For example, when outputting the top-5 similar face images, if the first three have a similarity of group 1 and the last two have a similarity of group 2, the inter-class variance is the largest. Then the list index m corresponding to the maximum value Lmax in list L is 3. If the maximum inter-class variance Lmax is greater than the maximum inter-class variance threshold T, then the output result is determined to have hit the target face image to be detected, where the first three similar face images are the selected target face images.
[0118] The face recognition output result filtering method provided in this embodiment of the invention reads a target face image to be detected; based on a preset face recognition algorithm, it identifies similar face images from a target face database and outputs the top k similar face images and their corresponding top k similarity values in descending order of similarity value; it calculates the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, it is determined that the output result does not match the target face image to be detected; otherwise, it is determined that the output result matches the target face image to be detected, and the target face image is filtered out from the top k similar face images according to the maximum inter-class variance. This method utilizes the maximum inter-class variance algorithm and a threshold self-learning algorithm. Based on the top k similarity scores output by the face recognition algorithm, it determines whether a target face has been detected. If a match is found, it filters out target face images from the target face database. This alleviates the drawback of excessive reliance on manual judgment in face recognition results, reduces the cost of applying face recognition technology in the public safety field, improves the work efficiency and effectiveness of security personnel, and enhances the usability and practicality of face recognition technology in public safety.
[0119] The face recognition output result filtering method provided in this embodiment of the invention includes two stages: a training stage and a prediction stage.
[0120] Reference Figure 4 The diagram illustrates a training process in an embodiment of a face recognition output result filtering method according to the present invention, which may specifically include the following steps:
[0121] During the training phase, this method primarily obtains the hit threshold (maximum inter-class variance threshold) T using a face recognition training dataset. The specific process is as follows:
[0122] Input: Face recognition training dataset S, target face training dataset Q, k=5.
[0123] Step S410: Decompose the face recognition training dataset S;
[0124] Step S421: Divide the face recognition training dataset S into a hit training dataset S2. h ;
[0125] Step S422: Divide the face recognition training dataset S into a mismatch training dataset S n ;
[0126] Steps S431 and S432: Randomly select one target face data q from Q to be detected. i ;
[0127] Step S441: Extract q using a face recognition algorithm based on a deep residual neural network ResNet-50. i Facial features, and from the training dataset S h Identify similar face images and output the top 5 similarity values in descending order;
[0128] Step S451: Calculate and obtain the maximum inter-class variance v of the output similarity value using the maximum inter-class variance algorithm. i And store it in array V h middle;
[0129] Step S461: Determine whether the maximum inter-class variance of all data in Q has been calculated. If yes, proceed to step S471. Otherwise, proceed to steps S431, S441, S451, and S461 in sequence until the maximum inter-class variance of all target face data to be detected in Q has been calculated.
[0130] Step S471: Obtain array V by statistics h Minimum value of inter-class variance V min ;
[0131] Step S442: Extract q using a face recognition algorithm based on a deep residual neural network ResNet-50. i The facial features never matched the training dataset S. n The algorithm identifies similar face images and outputs the top 5 similarity values in descending order.
[0132] Step S452: Calculate and obtain the maximum inter-class variance v of the output similarity value using the maximum inter-class variance algorithm. j And store it in array V n middle.
[0133] Step S462: Determine whether the maximum inter-class variance of all data in Q has been calculated. If yes, proceed to step S472. Otherwise, proceed to steps S432, S442, S452, and S462 in sequence until the maximum inter-class variance of all target face data to be detected in Q has been calculated.
[0134] Step S472: Obtain array V by statistics n The maximum value of the inter-class variance V max ;
[0135] Step S480, according to the formula T = (V min +V max ) / 2, calculate the hit threshold (maximum inter-class variance threshold) T.
[0136] Step S490: Output the hit threshold (maximum inter-class variance threshold) T.
[0137] Output: Hit threshold T.
[0138] Reference Figure 5 This diagram illustrates the prediction process in an embodiment of a face recognition output result filtering method according to the present invention. In the prediction stage, the method uses the hit threshold T obtained through training and the maximum inter-class variance algorithm to determine whether a face image in the target face database is hit and how many face images are hit. The specific steps are as follows:
[0139] Input: Target face image I to be detected, target face database M, hit threshold T.
[0140] Step S510: Read the target face image I;
[0141] Step S520: Extract the facial features of I using the face recognition algorithm based on deep residual neural network ResNet-50, identify similar faces from the target face database M, and output the top 5 similarity values in descending order;
[0142] Step S530: Calculate and obtain the maximum inter-class variance v of the output similarity value using the maximum inter-class variance algorithm;
[0143] Step S540: Determine whether v is less than the hit threshold T. If yes, proceed to step S551; otherwise, proceed to step S552.
[0144] Step S551: The output results do not contain the target face image to be detected;
[0145] Step S552: The output result contains the image of the target face to be detected;
[0146] Step S560: Filter out the target face image from the output results.
[0147] It should be noted that during both the training and prediction phases, the facial feature extraction of the training dataset, the target face image to be detected, and the target face database must use the same algorithm and be processed uniformly.
[0148] This invention provides a method for filtering face recognition output results, used to process the top-k face images output by face recognition technology. On one hand, it determines whether the output results contain a face from the image to be detected; on the other hand, based on the similarity between the top-k face images, it filters out images containing the target face from the output results. This method has significant implications for reducing the workload of manual judgment and improving the accuracy and efficiency of face recognition in public safety applications.
[0149] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0150] Reference Figure 6 The diagram illustrates a structural block diagram of an embodiment of a face recognition output result filtering device according to the present invention, which may specifically include the following modules: a reading module 610, a recognition module 620, a calculation module 630, a judgment module 640, and an output module 650, wherein:
[0151] The reading module 610 is used to read the target face image to be detected; the recognition module 620 is used to identify similar face images from the target face database based on a preset face recognition algorithm, and output the top k similar face images and the corresponding top k similarity values in descending order of similarity value; the calculation module 630 is used to calculate the maximum inter-class variance of the top k similarity values; the judgment module 640 is used to determine that the output result does not hit the target face image to be detected if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training based on the preset face recognition algorithm; the output module 650 is used to determine that the output result hits the target face image to be detected if the maximum inter-class variance is not less than the maximum inter-class variance threshold obtained by pre-training based on the preset face recognition algorithm, and select the target face image from the top k similar face images according to the maximum inter-class variance.
[0152] Optionally, the apparatus described above may further include: a training module, the training module being used for:
[0153] Set up a face recognition training dataset S and a target face training dataset Q to be detected;
[0154] Based on the target face training dataset Q, the training data in the face recognition training dataset S is divided into hit training datasets S. hand the training dataset S that was not hit n ;
[0155] For each target face data in the target face training dataset Q, based on the preset face recognition algorithm, the data is extracted from the hit training dataset S. h and the missing training dataset S n The system identifies similar faces and outputs two sets of the top k similarity values in descending order of similarity value. The first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values are calculated respectively.
[0156] Based on the first maximum inter-class variance and the second maximum inter-class variance, the maximum inter-class variance threshold T is determined.
[0157] As described above, optionally, the training module is used to train each target face data q in the target face dataset Q. i Based on the preset face recognition algorithm, the data are respectively extracted from the training dataset S. h Neutralize the missing training dataset S n The system identifies similar face images and outputs two sets of the top k similarity values in descending order of similarity. Specifically, when calculating the first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values, it is used for:
[0158] Take any one target face data q from the target face training dataset Q. i ;
[0159] Based on the preset face recognition algorithm, from the hit training dataset S h The system identifies similar face images and outputs the top k similarity values in descending order.
[0160] The first maximum inter-class variance v of the first k similarity values is calculated using the maximum inter-class variance algorithm. i and the first largest inter-class variance v i Stored into the first array V h The process continues until all the target face data in the target face training dataset Q is identified.
[0161] Based on the preset face recognition algorithm, the training dataset S that has never been hit is... n The system identifies similar face images and outputs the top k similarity values in descending order.
[0162] The second maximum inter-class variance v of the first k similarity values is calculated using the maximum inter-class variance algorithm. j and the second largest inter-class variance vj Stored into the second array V n This process continues until all the target face data in the target face training dataset Q is identified.
[0163] As described above, optionally, when the training module is used to determine the maximum inter-class variance threshold T based on the first maximum inter-class variance and the second maximum inter-class variance, it specifically includes:
[0164] Calculate the first array V h The minimum value V in min and the maximum value V in the second array max ;
[0165] The minimum value V min and the maximum value V max The average value is used as the maximum inter-class variance threshold T.
[0166] As described above, optionally, the computing module 630 is specifically used for:
[0167] Calculate the inter-class variance between the first n similarity values and the last kn similarity values from the first k similarity values in sequence, and store the calculated inter-class variances into list L in order, where n is a positive integer in the interval [1, k).
[0168] The maximum value Lmax in the list L is taken as the maximum inter-class variance of the first k similarity values.
[0169] As described above, optionally, the output module 650 is specifically used for:
[0170] Determine the list index m corresponding to the maximum value Lmax in the list L, where m is a positive integer in the interval [1, n].
[0171] The first m similar face images out of the first k similar face images are determined as the target face images.
[0172] Optionally, the preset face recognition algorithm of the device described above is a face recognition algorithm based on the deep residual neural network ResNet-50.
[0173] The face recognition output result filtering device provided in this embodiment of the invention utilizes the maximum inter-class variance algorithm and the threshold self-learning algorithm to determine whether the target face to be detected is matched based on the first k similarity values output by the face recognition algorithm. If the match is matched, the target face image in the target face database is filtered out. This alleviates the drawback of face recognition results relying too much on manual judgment, reduces the cost of applying face recognition technology in the field of public safety, improves the work efficiency and effectiveness of security maintenance personnel, and enhances the usability and practicality of face recognition technology in the field of public safety.
[0174] As the device embodiment is basically similar to the method embodiment, the description is relatively simple. For relevant details, please refer to the description of the method embodiment. It will not be repeated here.
[0175] Reference Figure 7 The diagram shows a structural block diagram of an embodiment of an electronic device according to the present invention. The device includes: a processor 710, a memory 720, and a bus 730.
[0176] The processor 710 and the memory 720 communicate with each other via the bus 730.
[0177] The processor 710 is used to call program instructions in the memory 720 to execute the methods provided in the above-described method embodiments, such as: reading a target face image to be detected; identifying similar face images from a target face database based on a preset face recognition algorithm, and outputting the top k similar face images and their corresponding top k similarity values in descending order of similarity value; calculating the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training based on the preset face recognition algorithm, then determining that the output result does not match the target face image to be detected; otherwise, determining that the output result matches the target face image to be detected, and selecting the target face image from the top k similar face images according to the maximum inter-class variance.
[0178] This invention discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, and when the program instructions are executed by a computer, the computer can perform the methods provided in the above-described method embodiments, such as: reading a target face image to be detected; identifying similar face images from a target face database based on a preset face recognition algorithm, and outputting the top k similar face images and their corresponding top k similarity values in descending order of similarity value; calculating the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, then determining that the output result does not match the target face image to be detected; otherwise, determining that the output result matches the target face image to be detected, and selecting the target face image from the top k similar face images according to the maximum inter-class variance.
[0179] This invention provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute the methods provided in the above-described method embodiments. These instructions include, for example, reading a target face image to be detected; identifying similar face images from a target face database based on a preset face recognition algorithm, and outputting the top k similar face images and their corresponding top k similarity values in descending order of similarity value; calculating the maximum inter-class variance of the top k similarity values; if the maximum inter-class variance is less than a maximum inter-class variance threshold obtained through pre-training based on the preset face recognition algorithm, determining that the output result does not match the target face image to be detected; otherwise, determining that the output result matches the target face image to be detected, and selecting the target face image from the top k similar face images based on the maximum inter-class variance.
[0180] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0181] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0182] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0183] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0184] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0185] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0186] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0187] The foregoing has provided a detailed description of a face recognition output result filtering method and a face recognition output result filtering device provided by the present invention. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for filtering face recognition output results, characterized in that, include: Read the image of the target face to be detected; Based on a preset face recognition algorithm, similar face images are identified from the target face database, and the top k similar face images and their corresponding top k similarity values are output in descending order of similarity value. Calculate the maximum inter-class variance of the first k similarity values; If the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, then it is determined that the output result does not match the target face image to be detected. Otherwise, determine that the output result matches the target face image to be detected, and select the target face image from the top k similar face images according to the maximum inter-class variance; The calculation of the maximum inter-class variance of the first k similarity values includes: Calculate the inter-class variance between the first n similarity values and the last kn similarity values from the first k similarity values in sequence, and store the calculated inter-class variances into list L in order, where n is a positive integer in the interval [1, k). The maximum value Lmax in the list L is taken as the maximum inter-class variance of the first k similarity values.
2. The method according to claim 1, characterized in that, The maximum inter-class variance threshold is determined in the following manner: Set up a face recognition training dataset S and a target face training dataset Q to be detected; Based on the target face training dataset Q, the training data in the face recognition training dataset S is divided into a hit training dataset Sh and a miss training dataset Sn. For each target face data in the target face training dataset Q, based on the preset face recognition algorithm, similar face images are identified from the hit training dataset Sh and the miss training dataset Sn respectively, and the first k similarity values are output in descending order of similarity value. The first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of first k similarity values are calculated respectively. Based on the first maximum inter-class variance and the second maximum inter-class variance, the maximum inter-class variance threshold T is determined.
3. The method according to claim 2, characterized in that, For each target face data qi in the target face training dataset Q, based on the preset face recognition algorithm, similar face images are identified from the hit training dataset Sh and the miss training dataset Sn, respectively. Two sets of the top k similarity values are output in descending order of similarity value. The first maximum inter-class variance and the second maximum inter-class variance corresponding to the two sets of the top k similarity values are calculated, including: Take any target face data qi from the target face training dataset Q; Based on the preset face recognition algorithm, similar face images are identified from the hit training dataset Sh, and the top k similarity values are output in descending order of similarity value. The first maximum inter-class variance vi of the first k similarity values is calculated using the maximum inter-class variance algorithm, and the first maximum inter-class variance vi is stored in the first array Vh until all the target face data in the target face training dataset Q is identified. Based on the preset face recognition algorithm, similar face images are identified in the never-hit training dataset Sn, and the top k similarity values are output in descending order of similarity value. The second maximum inter-class variance vj of the first k similarity values is calculated using the maximum inter-class variance algorithm, and the second maximum inter-class variance vj is stored in the second array Vn until all the target face data in the target face training dataset Q is identified.
4. The method according to claim 3, characterized in that, Based on the first maximum inter-class variance and the second maximum inter-class variance, the maximum inter-class variance threshold T is determined, including: Calculate the minimum value Vmin in the first array Vh and the maximum value Vmax in the second array; The average of the minimum value Vmin and the maximum value Vmax is used as the maximum inter-class variance threshold T.
5. The method according to claim 1, characterized in that, The step of selecting the target face image from the top k similar face images based on the maximum inter-class variance includes: Determine the list index m corresponding to the maximum value Lmax in the list L, where m is a positive integer in the interval [1, n]. The first m similar face images out of the first k similar face images are determined as the target face images.
6. The method according to any one of claims 1-4, characterized in that, The preset face recognition algorithm is a face recognition algorithm based on the deep residual neural network ResNet-50.
7. A face recognition output result filtering device, characterized in that, include: The reading module is used to read the face image of the target to be detected; The recognition module is used to identify similar face images from the target face database based on a preset face recognition algorithm, and output the top k similar face images and their corresponding top k similarity values in descending order of similarity value; The calculation module is used to calculate the maximum inter-class variance of the first k similarity values; The judgment module is used to determine that the output result does not match the target face image to be detected if the maximum inter-class variance is less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm. The output module is used to determine that the output result hits the target face image to be detected if the maximum inter-class variance is not less than the maximum inter-class variance threshold obtained by pre-training the preset face recognition algorithm, and to select the target face image from the first k similar face images according to the maximum inter-class variance. The calculation module is used for: Calculate the inter-class variance between the first n similarity values and the last kn similarity values from the first k similarity values in sequence, and store the calculated inter-class variances into list L in order, where n is a positive integer in the interval [1, k). The maximum value Lmax in the list L is taken as the maximum inter-class variance of the first k similarity values.
8. An electronic device, characterized in that, include: The memory and the processor communicate with each other via a bus; The memory stores program instructions that can be executed by the processor, and the processor can execute the method as described in any one of claims 1 to 6 by calling the program instructions.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Face recognition method and device, equipment and storage medium
CN112329715A