Method for improving face recognition and removing repeated recognition
By performing face detection and feature extraction in non-binding scenes, using cosine similarity comparison and database matching, the repeated recognition problem caused by the failure of the tracking of face detection frame in face recognition technology is solved, and the same face is realized Unique identification.
Patent Information
- Application Number
- CN202310734479.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2024-12-20
AI Technical Summary
In non-binding scenarios, face recognition technology cannot effectively remove duplicate recognition due to insufficient imaging clarity, small face size, and many lights affecting and identifying targets, resulting in failure of tracking of face detection frames in the same face, resulting in multiple IDs appearing in the same face Perform multiple identifications.
By acquiring image data, performing face detection and quality selection, updating tracking status, determining that the new ID is generated, facial feature extraction and historical frame comparison are performed, using the cosine similarity algorithm to determine whether the ID exists in historical frames, and performing database Compare to ensure that the same face does not recognize multiple times.
It effectively avoids multiple recognition results in the same face, improves the uniqueness and deduplication efficiency of face recognition, and meets the business needs in non-constrained scenarios.
Smart Images

Figure CN119169675A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of face recognition, and in particular relates to a method for improving face recognition and removing repeated recognition. Background Art
[0002] In the existing technology, with the development of computer vision and intelligent learning, face recognition technology has become a relatively mature and practical technology among many AI algorithms. In the security field, it has been very popular in constraint scenarios such as attendance machine access control and gate access control. However, face recognition applications in non-constraint scenarios such as general security IPC still have many problems such as insufficient imaging clarity, small face size, light influence, and many recognition targets. Face recognition deduplication in non-constraint scenarios also faces the problems of many recognition targets, small face targets, and large activity range, which leads to the failure of the method of removing duplicate recognition based on face detection frame information tracking and tracking ID uniqueness, and cannot meet business needs.
[0003] However, the defects in the prior art are:
[0004] The common method of existing recognition deduplication is to rely on the face detection frame and use the frame position information to track the face, and rely on the tracking ID to avoid multiple recognition comparisons of the same ID and output multiple duplicate recognition results. However, in unconstrained scenarios, faces will move quickly. At the same time, due to the increase in the number of recognition targets, the processing load will increase, the face detection speed will slow down, and the detection frame rate will drop, which will make it difficult to generate position association for the same face detection frame and even fail to track. The frequent switching of IDs cannot guarantee the uniqueness of the same face ID, and multiple recognitions of the same face with multiple IDs cannot meet the requirements.
[0005] In addition, commonly used technical terms in the prior art include:
[0006] 1. Face feature extraction: Feed the aligned face image into the CNN face feature model algorithm and output feature data of specified length.
[0007] 2. Cosine similarity comparison: Cosine similarity, also known as cosine similarity, evaluates the similarity of two vectors by calculating the cosine value of the angle between them. Cosine similarity plots the vectors into a vector space, such as the most common two-dimensional space, based on their coordinate values.
[0008] 3. Face detection: Face detection refers to the use of CNN deep learning algorithm to calculate whether any given image contains a face. If so, it returns the face location, tracking ID and other results. Summary of the invention
[0009] In order to solve the above problems, the purpose of this application is to propose a new method for face recognition deduplication, which ensures that the same face is not recognized multiple times when position information tracking fails, thereby avoiding multiple recognition results for the same face.
[0010] Specifically, the present invention provides a method for improving face recognition and removing duplicate recognition, the method comprising the following steps:
[0011] S1, Start: The whole process starts;
[0012] S2, acquiring image: acquiring a frame of image data from the image sensor;
[0013] S3, face detection module: perform face detection on a picture, output the frame information of all faces in the picture, track ID, and perform quality optimization;
[0014] S4, update tracking status;
[0015] The method of updating the tracking status is to determine whether the latest tracking ID information can be found in the historical tracking ID information. If it is found, it is considered that the target has not disappeared and continues to be tracked. If the ID is not found in the historical tracking ID information, it is considered that the tracking ID is a new target, which is used to implement the new ID determination in S5;
[0016] S5. According to the tracking result in step S4, determine whether a new ID is generated?
[0017] If a new ID is generated, perform S6 facial feature extraction;
[0018] If not, return to step S2 to obtain the image;
[0019] S6, facial feature extraction: extract facial image data according to the new ID and coordinate frame information appearing in step S5, wherein the ID is a randomly generated positive integer, and the coordinate frame information includes the pixel coordinates of the upper left point, i.e., the width and height information of the frame, as well as landmark, facial key point information, i.e., the coordinate values of the facial features in the pixel are marked; and perform facial feature extraction, and extract feature information of the face using a deep learning model;
[0020] S7, historical frame face comparison: perform cosine similarity comparison between the new face features obtained in step S6 and all face features in the historical frame;
[0021] S8, by comparing whether the similarity reaches the threshold, the threshold value range is 0-1 and is adjusted according to the actual situation, and the empirical value is set to 0.4, to determine whether the ID exists in the historical frame? If yes, proceed to step S9, otherwise it is determined that the ID does not exist in the historical frame, that is, it is a new face, and proceed to step S10;
[0022] S9, update the facial features of the historical frame: update the facial feature values matching the ID in the historical frame, modify the historical ID to the current ID, and return to step S2 to obtain the image;
[0023] S10, compare the newly appeared face with the database cosine similarity according to the result of step S9; S11, determine whether the database match is successful? If the similarity result is compared with the threshold and meets the threshold range, it is considered that the face in the face data database has been registered and proceed to S12; if it does not reach the threshold range, it is determined that the face does not exist in the database, and then proceed to step S9; S12, extract face data according to the face information successfully matched in S11, that is, use the deep learning model to extract the feature information of the face, and perform jpg encoding to save it to the storage medium, and continue to return to step S2.
[0024] The quality selection in step S3 is divided into two modules. Module 1 evaluates the angle quality of the face and uses a deep learning model to determine whether the face angle is a frontal face. The angle quality score is a real number between 0 and 1, which is greater than the set threshold. The threshold is adjusted according to the actual situation and is configured to be 0.5 here based on experience. Module 2 evaluates the blurriness of the face and uses a deep learning model to determine whether the face is clear. The blur quality score is a real number between 0 and 1, which is greater than the set threshold. The threshold is adjusted according to the actual situation and is configured to be 0.5 here based on experience. When the two quality thresholds of module 1 and module 2 are met, it is considered that the face meets the requirements and the selection is completed.
[0025] In step S4, a result of whether the ID can be found in the historical tracking ID information is obtained by comparison.
[0026] The cosine similarity algorithm described in step S7: the cosine value between the angle between two vectors in a vector space is used as a measure of the size of the difference between two individuals. The closer the cosine value is to 1, the closer the angle is to 0, indicating that the two vectors are more similar. The closer the cosine value is to 0, the closer the angle is to 90 degrees, indicating that the two vectors are less similar.
[0027] In step S11, the facial feature value obtained in step S9 is similarly calculated with each pre-recorded facial feature value in the database. When the similarity result is greater than a set threshold, which is configured as 0.4 based on experience, it is considered that the person is the same as the person recorded in the database.
[0028] Therefore, the advantages of the present application are: the method is simple, based on the facial feature comparison of historical frames, and improves the problem of repeated recognition when switching the same face tracking ID. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.
[0030] Figure 1 is a schematic diagram of the process of this method. DETAILED DESCRIPTION
[0031] In order to more clearly understand the technical content and advantages of the present invention, the present invention is now further described in detail in conjunction with the accompanying drawings.
[0032] like Figure 1 As shown, the present application provides a method for improving face recognition and removing duplicate recognition, comprising:
[0033] S1, Start: The whole process starts;
[0034] S2, acquiring image: acquiring a frame of image data from the image sensor;
[0035] S3, face detection module: perform face detection on a picture, output the frame information of all faces in the picture, track the ID, and perform quality optimization; the quality optimization is divided into two modules, module 1 evaluates the angle quality of the face, uses a deep learning model to determine whether the face angle is a frontal face, and the angle quality is scored as a real number between 0 and 1, which is greater than the set threshold. The threshold is adjusted according to the actual situation, and is configured to be 0.5 here based on experience; module 2 evaluates the blurriness of the face, uses a deep learning model to determine whether the face is clear, and the blur quality is scored as a real number between 0 and 1, which is greater than the set threshold. The threshold is adjusted according to the actual situation, and is configured to be 0.5 here based on experience; when the two quality thresholds of module 1 and module 2 are met, it is considered that the face meets the requirements and the optimization is completed;
[0036] S4, update tracking status;
[0037] The method of updating the tracking status is to determine whether the latest tracking ID information can be found in the historical tracking ID information. If it is found, it is considered that the target has not disappeared and continues to be tracked. If the ID is not found in the historical tracking ID information, it is considered that the tracking ID is a new target, which is used to implement the new ID determination in S5. The result of whether it can be found in the historical tracking ID information is obtained by comparison.
[0038] S5. According to the tracking result in step S4, determine whether a new ID is generated?
[0039] If a new ID is generated, perform S6 facial feature extraction;
[0040] If not, return to step S2 to obtain the image;
[0041] S6, facial feature extraction: extract facial image data according to the new ID and coordinate frame information appearing in step S5, wherein the ID is a randomly generated positive integer, and the coordinate frame information includes the pixel coordinates of the upper left point, i.e., the width and height information of the frame, as well as landmark, facial key point information, i.e., the coordinate values of the facial features in the pixel are marked; and perform facial feature extraction, and extract feature information of the face using a deep learning model;
[0042] S7, historical frame face comparison: perform cosine similarity comparison on the new face features obtained in step S6 and all face features in the historical frame; the cosine similarity algorithm: the cosine value between the angle between two vectors in a vector space is used as a measure of the difference between two individuals. The closer the cosine value is to 1, the closer the angle is to 0, indicating that the two vectors are more similar. The closer the cosine value is to 0, the closer the angle is to 90 degrees, indicating that the two vectors are less similar.
[0043] S8, by comparing whether the similarity reaches the threshold, the threshold value range is 0-1 and is adjusted according to the actual situation, and the empirical value is set to 0.4, to determine whether the ID exists in the historical frame? If yes, proceed to step S9, otherwise it is determined that the ID does not exist in the historical frame, that is, it is a new face, and proceed to step S10;
[0044] S9, update the facial features of the historical frame: update the facial feature values matching the ID in the historical frame, modify the historical ID to the current ID, and return to step S2 to obtain the image;
[0045] S10, perform a cosine similarity comparison of the newly appeared face with the database according to the result of step S9; S11, determine whether the database match is successful? If the similarity result is compared with the threshold and meets the threshold range, it is considered that the face in the face data database has been registered and proceed to S12; if it does not reach the threshold range, it is determined that the face does not exist in the database, and then proceed to step S9; calculate the similarity between the facial feature value obtained in step S9 and each pre-recorded facial feature value in the database. When the similarity result is greater than the set threshold, which is configured as 0.4 based on experience, it is considered to be the same person as the person recorded in the database;
[0046] S12. Extract facial data based on the facial information successfully matched in S11, that is, use a deep learning model to extract feature information of the face, perform jpg encoding and save it to a storage medium, and then return to step S2.
[0047] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for improving face recognition and removing duplicate recognition, characterized in that: The method comprises the following steps: S1, Start: The whole process starts; S2, acquiring image: acquiring a frame of image data from the image sensor; S3, face detection module: perform face detection on a picture, output the frame information of all faces in the picture, track ID, and perform quality optimization; S4, update tracking status; The method of updating the tracking status is to determine whether the latest tracking ID information can be found in the historical tracking ID information. If it is found, it is considered that the target has not disappeared and continues to be tracked. If the ID is not found in the historical tracking ID information, it is considered that the tracking ID is a new target, which is used to implement the new ID determination in S5; S5. According to the tracking result in step S4, determine whether a new ID is generated? If a new ID is generated, perform S6 facial feature extraction; If not, return to step S2 to obtain the image; S6, facial feature extraction: extract facial image data according to the new ID and coordinate frame information appearing in step S5, wherein the ID is a randomly generated positive integer, and the coordinate frame information includes the pixel coordinates of the upper left point, i.e., the width and height information of the frame, as well as landmark, facial key point information, i.e., the coordinate values of the facial features in the pixel are marked; and perform facial feature extraction, and extract feature information of the face using a deep learning model; S7, historical frame face comparison: perform cosine similarity comparison between the new face features obtained in step S6 and all face features in the historical frame; S8, by comparing whether the similarity reaches the threshold, the threshold value range is 0-1 and is adjusted according to the actual situation, and the empirical value is set to 0.4, to determine whether the ID exists in the historical frame? If yes, proceed to step S9, otherwise it is determined that the ID does not exist in the historical frame, that is, it is a new face, and proceed to step S10; S9, update the facial features of the historical frame: update the facial feature values matching the ID in the historical frame, modify the historical ID to the current ID, and return to step S2 to obtain the image; S10, performing a cosine similarity comparison on the newly appeared face in the database according to the result of step S9; S11. Determine whether the database match is successful? If the similarity result is compared with the threshold and meets the threshold range, it is considered that the face in the face data database has been registered and proceeds to S12; if it does not meet the threshold range, it is determined that the face does not exist in the database, and then proceeds to step S9; S12. Extract facial data based on the facial information successfully matched in S11, that is, use a deep learning model to extract feature information of the face, perform jpg encoding and save it to a storage medium, and then return to step S2.
2. A method for improving face recognition and removing duplicate recognition according to claim 1, characterized in that: The quality selection in step S3 is divided into two modules. Module 1 evaluates the angle quality of the face and uses a deep learning model to determine whether the face angle is a frontal face. The angle quality score is a real number between 0 and 1, which is greater than the set threshold. The threshold is adjusted according to the actual situation and is configured to be 0.5 here based on experience. Module 2 evaluates the blurriness of the face and uses a deep learning model to determine whether the face is clear. The blur quality score is a real number between 0 and 1, which is greater than the set threshold. The threshold is adjusted according to the actual situation and is configured to be 0.5 here based on experience. When the two quality thresholds of module 1 and module 2 are met, it is considered that the face meets the requirements and the selection is completed.
3. The method for improving face recognition and removing duplicate recognition according to claim 1, characterized in that: In step S4, a result of whether the ID can be found in the historical tracking ID information is obtained by comparison.
4. The method for improving face recognition and removing duplicate recognition according to claim 1, characterized in that: The cosine similarity algorithm described in step S7: the cosine value between the angle between two vectors in a vector space is used as a measure of the size of the difference between two individuals. The closer the cosine value is to 1, the closer the angle is to 0, indicating that the two vectors are more similar. The closer the cosine value is to 0, the closer the angle is to 90 degrees, indicating that the two vectors are less similar.
5. The method for improving face recognition and removing duplicate recognition according to claim 1, characterized in that: In step S11, the facial feature value obtained in step S9 is similarly calculated with each pre-recorded facial feature value in the database. When the similarity result is greater than a set threshold, which is configured as 0.4 based on experience, it is considered that the person is the same as the person recorded in the database.
