Face database automatic updating method and device
By extracting feature vectors through face detection and recognition algorithms, calculating Euclidean distance and recognition probability, updating global feature centers, and optimizing the base database samples using conditional constraint functions, the problem of automatic updating of the face base database is solved, thus improving the accuracy of face recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN MARITIME COMMUNICATION RESEARCH INSTITUTE
- Filing Date
- 2022-10-31
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, the face database is difficult to update automatically in application scenarios with continuous input data, resulting in a decrease in the accuracy of face recognition.
Feature vectors are extracted using face detection and recognition algorithms, Euclidean distance and recognition probability are calculated, global feature centers are updated, and conditional constraint functions are used to optimize the base database samples to ensure recognition probability and image quality, limit repeated updates, and optimize the number of base database samples.
It significantly improves the accuracy of face recognition, reduces the impact of misidentification and boundary features, and optimizes the database update process.
Smart Images

Figure CN115761842B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image recognition technology, specifically relating to a method and apparatus for automatically updating a face database. Background Technology
[0002] The face database plays a crucial role in facial recognition, and the quality of the samples in the database largely determines the accuracy of facial recognition. In certain applications, such as intelligent video surveillance and attendance systems, the input data is continuous, and some of this data is more suitable for use as a face database for discrimination. How to utilize this continuously input data to further improve recognition accuracy in these applications—that is, how to automatically update the database during facial recognition applications to enhance accuracy—is a pressing problem that needs to be solved. Summary of the Invention
[0003] To address one or more of the above-mentioned deficiencies or improvement needs in the existing technology, the present invention provides a method for automatically updating a face database, the method comprising the following steps:
[0004] Step 1: Determine the initial face database, and use face detection and face recognition algorithms to obtain the face feature vectors corresponding to all samples of all categories in the face database;
[0005] Step 2: Input the images or pictures to be recognized in sequence. First, use the face detection algorithm to detect the positions of all face boxes, and then use the face recognition algorithm to extract the feature vectors corresponding to all faces in the image.
[0006] Step 3: Calculate the Euclidean distance between the face feature vector and the face feature vector in the database one by one to obtain the recognition probability of these faces to be identified and each category in the face database;
[0007] Step 4: If a face belongs to a category in the base database, then use the face feature to update the global feature center of that category; otherwise, do nothing.
[0008] For faces belonging to the base database category, determine whether they meet the conditions for updating the base database of the same category of samples. If they do not meet the conditions, no processing is performed. If they meet the conditions for updating the base database of the same category of samples, they are temporarily added to the base database of the same category of samples. Then, determine whether the number of samples of that category in the base database exceeds the threshold. If it does not exceed the threshold, the base database of that category of samples is directly updated.
[0009] If the number of samples exceeds the threshold, firstly, multiple combinations of samples of this category in the base database are generated, with the number of samples in each combination being the threshold. Then, the condition constraint function value of each combination is calculated, and the combination with the smallest value is selected as the new sample of this category in the face base database, thereby completing one automatic update of the face base database.
[0010] Preferably, in step 4, updating the global feature center of the category specifically includes:
[0011] When a face in the input image or image belongs to a certain category in the base database, the features of this face are used to update the global feature center of that category. The specific formula is as follows:
[0012]
[0013] In the above formula, V' is the global center, V is the current face feature vector, and n is the number of samples that have been used to calculate the global center.
[0014] Preferably, in step 4, the conditions for meeting the criteria for updating samples of the same category in the baseline database specifically include:
[0015] By obtaining the recognition probabilities of the face to be recognized and each category in the face database, the category to which the face to be recognized belongs can be determined. For faces belonging to the category in the database, the following conditions must be met before they can be used to update the database.
[0016] (1) A face with a recognition probability greater than 0.7 can be considered to belong to a certain category. For faces used to update the base database, the recognition probability must be greater than 0.8.
[0017] (2) The base sample of the same category is updated at most once in a short period of time.
[0018] Preferably, in step 4, the method for calculating the condition constraint function includes:
[0019] The conditional constraint function L for updating the sample is as follows:
[0020]
[0021]
[0022] In the above formula, V m This refers to the local center used for the baseline sample, where m is the number of baseline samples. For example, if m = 10, a maximum of 10 images will be used for judgment. When updating the baseline, a new image will be selected while one image will be removed from the baseline. V i Let V' be the facial feature vector corresponding to the i-th sample. V' is the global center, and threshold is the discrimination threshold. d(V', V') m ) refers to the Euclidean distance between the global center and the local center, d(V',V) i ) represents the Euclidean distance between the face feature vector corresponding to the i-th sample and the global center, and β is a hyperparameter with a value range of 0.5 to 0.55.
[0023] The present invention also provides an automatic face database update device for implementing the above method, the device comprising:
[0024] The face detection module is used to detect all human faces in the input image or picture to be recognized.
[0025] The face recognition module is used to identify the detected faces and obtain the person information of the face, that is, the category of the base database to which it belongs;
[0026] The face database self-update module is used to process the input image or image, determine whether it meets the conditions for updating the database, and update it according to the set process if the conditions are met.
[0027] The present invention also provides a server comprising a processor and a memory, the memory having at least one line of program code, the program code being loaded and executed by the processor to implement the above-described method for automatically updating the face database.
[0028] In summary, the beneficial effects of the above-described technical solutions conceived by this invention compared with the prior art include:
[0029] (1) The updating method and apparatus provided by the present invention have a significant effect on improving the accuracy of face recognition;
[0030] (2) The global center algorithm provided by this invention is equivalent to calculating the average of n feature vectors when n < 100; when n ≥ 100, the moving weighted average is used instead of the arithmetic average, which can gradually reduce the influence of early face data.
[0031] (3) The condition for updating the same category of samples in the base database is that the recognition probability is greater than 0.7, which means that the sample belongs to a certain category. However, the recognition probability of the face used to update the base database must be greater than 0.8. This can further filter out face features that may be misidentified or located at the boundary.
[0032] (4) The condition constraint function provided by the present invention has a significant effect on improving the accuracy of face recognition. Attached Figure Description
[0033] Figure 1 This is a flowchart of an automatic face database update method provided by an embodiment of the present invention;
[0034] Figure 2 This is a schematic diagram showing the results of a simulation experiment based on an embodiment of the present invention;
[0035] Figure 3 This is a schematic diagram showing the results of a simulation experiment in an embodiment of the present invention;
[0036] Figure 4 A block diagram of an automatic face database update device provided in an embodiment of the present invention:
[0037] Figure 5 This is a structural block diagram of a server provided in an embodiment of the present invention.
[0038] In all the accompanying drawings, the same reference numerals denote the same technical features, specifically: 401, face detection module; 402, face recognition module; 403, face database self-updating module; 501, processor; 502, memory. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0040] Example:
[0041] like Figure 1 The diagram shown is a flowchart of an automatic update method for a face database provided by an embodiment of the present invention. The method includes:
[0042] Step 101: Determine the initial face database, and use face detection and face recognition algorithms to obtain the face feature vectors corresponding to all samples of all categories in the face database.
[0043] In this embodiment of the invention, the samples of each category in the initial face database can be one or more images, or one or more video frame images captured by monitoring equipment (such as cameras) obtained by the server. The data content stored in the face database is a collection of face feature vectors of all categories.
[0044] Step 102: Input the images to be recognized or each frame of the image in sequence, use the face detection algorithm to obtain all face bounding boxes, and use the face recognition algorithm to extract the corresponding face features.
[0045] In this embodiment of the invention, the face detection algorithm and the face feature extraction algorithm are respectively performed by the face detection module and the face recognition module provided by the present invention, and are executed in the device or server provided by the present invention.
[0046] Step 103: Compare the extracted facial features with the features in the facial database to determine the probability of each face belonging to each category in the database.
[0047] That is, to determine whether the face to be identified belongs to the person in the face database, and if so, to determine its specific identity information such as its name.
[0048] Step 104: If a face belongs to a certain category in the base database, then use the face feature to update the global feature center of that category; otherwise, do not process it.
[0049] In this embodiment, the global center of a certain category of features refers to the global center of that category calculated by continuously collecting suitable facial feature vectors for that category during face recognition, using the following formula.
[0050]
[0051] In the above formula, V' is the global center, V is the current face feature vector, and n is the number of samples that have participated in the calculation of the global center. When n < 100, this formula is equivalent to calculating the average of n feature vectors; when n ≥ 100, using a moving weighted average instead of the arithmetic average can gradually reduce the influence of early face data.
[0052] Step 105: For faces belonging to the base database category, determine whether they meet the conditions for updating samples of the same category in the base database. If they do, temporarily add them to the same category in the base database.
[0053] In this embodiment, the conditions for updating the base database include: First, increasing the recognition probability threshold. For example, in face recognition, a recognition probability greater than 0.7 is considered to belong to a certain category, but for faces used to update the base database, the recognition probability must be greater than 0.8. This can further filter out face features that may be misidentified or located at the boundary. Second, using image quality indicators such as information entropy, only high-quality images will be updated to the base database. Third, adding time limits, such as updating the base database samples of the same category at most once a day, to avoid meaningless repeated updates in a short period of time.
[0054] Step 106: Determine whether the number of samples of this category in the base database exceeds the threshold. If it does not exceed the threshold, update the base database directly.
[0055] In this embodiment, if the number of samples of a certain category in the base database is less than the maximum number of samples of that category, then the images that meet the conditions for updating the base database are directly added to the base database.
[0056] Step 107: If the number of samples exceeds the limit, first generate multiple combinations of samples of this category in the base database, calculate the condition constraint function value of each combination, and select the combination with the smallest value to update the samples of this category in the face base database.
[0057] In this embodiment, the condition constraint function expression is as follows:
[0058]
[0059]
[0060] In the above formula, V m This refers to the local center used for the baseline sample, where m is the number of baseline samples. For example, if m = 10, a maximum of 10 images will be used for judgment. When updating the baseline, a new image will be selected while one image will be removed from the baseline. V i Let V' be the facial feature vector corresponding to the i-th sample. V' is the global center, and threshold is the discrimination threshold. d(V', V') m ) refers to the Euclidean distance between the global center and the local center, d(V',V) i ) represents the Euclidean distance between the face feature vector corresponding to the i-th sample and the global center, and β is a hyperparameter, which is recommended to be 0.5 to 0.55.
[0061] In the simulation experiment, with initial sample sizes of 1 and 10, respectively, the method of this invention and the method without this invention were repeatedly tested 80 times. The TP (True Positive) and FP (False Positive) index results obtained on the validation set are as follows: Figure 2 and Figure 3 As shown, the average TP value using the method of the present invention increased by 7.80% and 1.59%, respectively, and the average FP value increased by 2.91% and decreased by 0.14%, respectively. Overall, the present invention has a significant effect on improving the accuracy of face recognition.
[0062] like Figure 4 The diagram shown is a structural block diagram of an automatic face database update device provided in an embodiment of the present invention. The device includes: a face detection module 401, a face recognition module 402, and an automatic face database update module 403.
[0063] The face detection module 401 is used to detect faces in the base database samples or input images and generate specific face detection boxes; the face recognition module 402 is used to extract face feature vectors and compare the face to be recognized with the faces in the base database to calculate the final recognition probability; the face base database automatic update module performs face base database update operations according to the process described in 101 to 107.
[0064] like Figure 5 The diagram shown is a server structure block diagram provided by an embodiment of the present invention. Typically, a server includes: a processor 501 and a memory 502.
[0065] The processor 501 may contain one or more processing cores and may be implemented in at least one of the following hardware forms: CPU (Center Processing Unit), GPU (Graphics Processing Unit), DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array).
[0066] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices.
[0067] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for automatically updating a face database, characterized in that, The method includes the following steps: Step 1: Determine the initial face database, and use face detection and face recognition algorithms to obtain the face feature vectors corresponding to all samples of all categories in the face database; Step 2: Input the images or pictures to be recognized in sequence. First, use the face detection algorithm to detect the positions of all face boxes, and then use the face recognition algorithm to extract the face feature vectors corresponding to all faces in the image. Step 3: Calculate the Euclidean distance between the face feature vector and the face feature vector in the face database one by one to obtain the recognition probability of these faces to be identified and each category in the face database; Step 4: If a face in the input image belongs to a category in the face database, then update the global feature center of that category using the face feature vector; otherwise, do nothing. This is done using the formula... , Calculate the global feature center for this category; As the global feature center, For the current face feature vector, This represents the number of samples that have already been used to calculate the global feature center. For faces belonging to the face database category, determine whether they meet the conditions for updating the face database to the same category of samples. If not, no action is taken. If they meet the conditions for updating the face database to the same category of samples, temporarily add them to the face database to the same category of samples, and then determine whether the number of samples of that category in the face database exceeds a threshold. If it does not exceed the threshold, directly update the face database to the same category of samples. The conditions for updating the face database to the same category of samples include: increasing the recognition probability threshold, using image quality indicators, and adding time limits. If the number of samples exceeds the threshold, firstly, multiple combinations of samples of this category in the face database are generated, with the number of samples in each combination being the threshold. Then, the condition constraint function value of each combination is calculated, and the combination with the smallest value is selected as the new sample of this category in the face database, thereby completing the process of automatic updating of the face database. Condition constraint function for: ; ; in, Refers to the local feature centers used in the face database samples; The number of samples in the face database; For the first The facial feature vector corresponding to Zhang's sample; This is a hyperparameter, and its value ranges from 0.5 to 0.
55. The Euclidean distance between the global feature center and the local feature center; For the first The Euclidean distance between the face feature vector corresponding to Zhang's sample and the global feature center; To determine the threshold.
2. The method for automatically updating a face database according to claim 1, characterized in that, In step 4, The conditions for meeting the criteria for updating the face database samples of the same category specifically include: by obtaining the recognition probabilities of the face to be identified and each category in the face database, the category to which the face to be identified belongs is determined. For faces belonging to the category in the face database, the following conditions must be met before they can be used to update the face database. (1) A face can be considered to belong to a certain category if its recognition probability is greater than 0.
7. For faces used to update the face database, the recognition probability must be greater than 0.
8. (2) The face database samples of the same category are updated at most once in a short period of time.
3. An apparatus for automatically updating a face database to implement the method of any one of claims 1-2, characterized in that, The device includes: The face detection module is used to detect all human faces in the input image or picture to be recognized; The face recognition module is used to identify the detected face and obtain the person information of the face, that is, the category of the face database to which it belongs; The face database self-update module is used to process the input image or image, determine whether it meets the conditions for updating the face database, and update it according to the set process if the conditions are met.
4. A server, characterized in that, The server includes a processor and a memory, the memory having at least one line of program code, which is loaded and executed by the processor to implement the automatic face database update method according to any one of claims 1 to 2.