A method and device for face recognition
By establishing a high-frequency face library, first perform face comparison with the high-frequency face library, and if it fails, then compare with all face libraries, the problem of long comparison time in the existing technology is solved, and the face recognition efficiency and user experience are improved.
Patent Information
- Application Number
- CN202110789144.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-13
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-07-13
AI Technical Summary
When comparing existing facial recognition technologies, they need to compare with a large number of facial information databases, resulting in a long comparison time and poor user experience.
By establishing a high-frequency face library, first compare the face information to the high-frequency face library. If the comparison fails, then compare it with all face libraries. The high-frequency face library includes the top N personal face information that has the most successful face recognition in all face libraries.
It reduces the number and time of comparison, improves the efficiency of facial recognition, realizes the gate opening or access control in seconds, and significantly improves the user's experience.
Smart Images

Figure CN113469096B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of face recognition technology, and in particular to a face recognition method and device. Background Art
[0002] Facial recognition technology can be applied to various scenarios in life and work. Take the community access control system in life as an example. If a user wants to enter a community, he can point his face to the camera of the access control system. After the camera captures the user's facial image, the processor in the access control system processes the facial information and then compares the facial information with the facial information in the pre-established facial information database. When the comparison is successful, the access control can be opened and the user can enter the community.
[0003] In the above example, when performing face comparison, it is necessary to compare with the face information database, and the face information database includes the face information of all users collected in advance. This results in a large number of comparisons, which in turn requires a longer comparison time, causing the user to wait for a longer time to open the access control system, reducing the user experience.
[0004] Based on this, how to quickly and effectively perform face matching and improve the user experience is a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention
[0005] The embodiments of the present invention provide a method and device for face recognition, which are used to quickly and effectively perform face comparison and improve user experience.
[0006] In a first aspect, an embodiment of the present invention provides a method for face recognition, comprising:
[0007] Get face image;
[0008] Performing face recognition processing on the face image to obtain a processing result, wherein the processing result includes face information to be processed;
[0009] Determining whether the face information to be processed exists in a pre-established high-frequency face database;
[0010] If it exists, it is determined that the face recognition is successful;
[0011] If not, when it is determined that the face information to be processed exists in all pre-established face databases, determining that the face recognition is successful;
[0012] Among them, when the facial information in the entire face library is sorted from large to small according to the number of successful face recognitions, the high-frequency face library includes the first N facial information in the entire face library, where N is an integer greater than 1.
[0013] In a second aspect, an embodiment of the present invention provides a face recognition device, including:
[0014] A memory for storing program instructions;
[0015] The processor is used to call the program instructions stored in the memory and execute the above-mentioned face recognition method provided by the embodiment of the present invention according to the obtained program.
[0016] The beneficial effects of the present invention are as follows:
[0017] A face recognition method and device provided by an embodiment of the present invention, when identifying face information to be processed, first compares the face information to be processed with the face information in a high-frequency face library, and if the comparison fails, then compares it with all face libraries, and when sorting the face information in all face libraries from large to small according to the number of successful face recognitions, the high-frequency face library includes the first N face information in all face libraries; in this way, when performing the comparison, first compare with the high-frequency face library including a smaller number of face information, which can help reduce the number of comparisons, and then help reduce the time consumed by the comparison, thereby improving the comparison efficiency, improving the efficiency of face recognition, and when applied to systems such as gates or access control, the gates or access control can be opened in seconds, greatly improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A flowchart of a face recognition method provided in an embodiment of the present invention;
[0019] Figure 2 A flowchart of a specific embodiment provided in an embodiment of the present invention;
[0020] Figure 3 The present invention provides a schematic diagram of the structure of a face recognition device. DETAILED DESCRIPTION
[0021] The following will be combined with the accompanying drawings to describe in detail the specific implementation of a method and device for face recognition provided by an embodiment of the present invention. It should be noted that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] The embodiment of the present invention provides a method for face recognition, such as Figure 1 As shown, it may include:
[0023] S101, obtaining a face image;
[0024] When acquiring a face image, an image acquisition device such as a camera may be used.
[0025] S102, performing face recognition processing on the face image to obtain a processing result, where the processing result includes face information to be processed;
[0026] Specifically, when performing face recognition processing, any method known to those skilled in the art that can achieve the purpose of face recognition can be used, and is not limited here.
[0027] S103, determining whether there is face information to be processed in the pre-established high-frequency face database; if so, executing S104; if not, executing S105;
[0028] S104, determining that face recognition is successful;
[0029] S105, when it is determined that there is face information to be processed in all pre-established face databases, determining that face recognition is successful;
[0030] Among them, when the facial information in all face libraries is sorted from large to small according to the number of successful face recognitions, the high-frequency face library includes the facial information of the first N people in all face libraries, where N is an integer greater than 1.
[0031] That is to say, optionally, the high-frequency face library can be understood as:
[0032] A database consisting of facial information with a higher number of successful face recognition in the entire face database.
[0033] For example, taking the application of the face recognition method provided by the embodiment of the present invention to the access control system as an example, assuming that there are 50 employees on a certain floor and an access control system is set up on the floor, then the 50 employees enter the floor through the access control system more frequently than the employees on other floors, so the 50 employees have more successful face recognition in the access control system on the floor. Furthermore, for the access control system on the floor, the face information of these 50 employees can be added to the high-frequency face library.
[0034] Optionally, the value of N can be set according to actual needs, for example but not limited to: based on the number of successful face recognitions in the entire face library in 24 hours, the top 1000 face information (where the number of face recognitions corresponding to the face information in the entire face library is arranged in order from large to small) are selected to form a high-frequency face library, so the value of N is 1000, which is not limited here.
[0035] When identifying the face information to be processed, the face information to be processed is first compared with the face information in the high-frequency face library. If the comparison fails, it is then compared with all the face libraries, and when the face information in all the face libraries is sorted from large to small according to the number of successful face recognitions, the high-frequency face library includes the first N face information in all the face libraries; in this way, when performing the comparison, first compare with the high-frequency face library including a smaller number of face information, which can help reduce the number of comparisons, and then help reduce the time consumed by the comparison, thereby improving the comparison efficiency, improving the efficiency of face recognition, and when applied to systems such as gates or access control, the gates or access control can be opened in seconds, greatly improving the user experience.
[0036] Optionally, in the embodiment of the present invention, the processing result further includes: age information corresponding to the face information to be processed, and gender information corresponding to the face information to be processed;
[0037] After determining that there is no face information to be processed in the high-frequency face database and before determining whether there is face information to be processed in the entire face database, the method further includes:
[0038] It is determined that the age information and gender information corresponding to the face information to be processed are both unreliable information.
[0039] Among them, age information and gender information can be regarded as attribute information. Whether the face information to be processed needs to be compared with the entire face database can be determined by whether the attributes are reliable, so as to compare with the entire face database when it is unreliable, thereby completing the face recognition process.
[0040] Specifically, in the embodiment of the present invention, determining that both the age information and the gender information corresponding to the face information to be processed are unreliable information includes:
[0041] When the processing result also includes: an age credibility score corresponding to the age information, and a gender credibility score corresponding to the gender information, and when it is judged that the age credibility score is less than a first preset value, and when it is judged that the gender credibility score is less than a second preset value, it is determined that the age information and gender information corresponding to the facial information to be processed are both unreliable information.
[0042] In this way, whether the age information of the facial information to be processed is reliable can be determined by the size relationship between the age credibility score and the first preset value, and whether the gender information of the facial information to be processed is reliable can be determined by the size relationship between the gender credibility score and the second preset value. That is, whether the age information and gender information are reliable can be determined in a simple way, thereby reducing the complexity of the face recognition process, which is beneficial to improving the efficiency of face recognition and reducing the production cost of the face recognition device.
[0043] Optionally, in the embodiment of the present invention, the method further includes:
[0044] When it is determined that the age information and / or gender information corresponding to the face information to be processed is reliable information, it is determined whether the face information to be processed exists in a pre-established face attribute library; wherein the face attribute library is a true subset of the entire face library;
[0045] If so, it is determined that the face recognition is successful;
[0046] If not, it is determined that face recognition has failed.
[0047] That is to say, when at least one of the age information and gender information of the facial information to be processed is reliable information, the facial information to be processed can be compared with the facial attribute library, so that: when the facial information to be processed does not exist in the high-frequency face library, the facial information to be processed is further compared with the facial attribute library, instead of directly comparing the facial information to be processed with the entire face library, thereby further reducing the number of facial information comparisons in the face recognition process, and further improving the efficiency of face recognition.
[0048] Specifically, the meaning of the face attribute library being a proper subset of the entire face library may be:
[0049] The entire face library includes all face information in the face attribute library, and the number of face information included in the face attribute library is less than the number of face information included in the entire face library. At the same time, there is at least one face information that only exists in the entire face library but not in the face attribute library.
[0050] Moreover, for the high-frequency face library and the face attribute library, the face information in the two databases does not overlap. In other words, the face attribute library is a database established according to the two dimensions of age and gender after removing the face information in the high-frequency face library from the entire face library. The two databases are established from different perspectives and are independent of each other.
[0051] Optionally, in an embodiment of the present invention, the face attribute library includes: a plurality of attribute groups divided according to age information and gender information, at least one of the age information and gender information corresponding to the face information in each attribute group is reliable information;
[0052] Determine whether there is face information to be processed in the pre-established face attribute library, specifically including:
[0053] Determine a corresponding attribute group according to whether the age information and / or gender information corresponding to the face information to be processed is reliable information;
[0054] Determine whether there is face information to be processed in the determined attribute group.
[0055] In this way, when comparing facial information, the facial information to be processed can be compared with the corresponding attribute group instead of directly comparing it with the entire facial attribute library, which further reduces the number of comparisons and further improves the efficiency of facial recognition.
[0056] Specifically, age information may include, but is not limited to, infant, teenager, youth, middle-aged, and elderly; gender information may include, male and female; therefore, the attribute groups in the face attribute library may include:
[0057] Male-baby attribute group, male-teenager attribute group, male-youth attribute group, male-middle-aged attribute group, male-elderly attribute group, female-baby attribute group, female-teenager attribute group, female-youth attribute group, female-middle-aged attribute group, female-elderly attribute group.
[0058] Furthermore, when age information is reliable information, the age information corresponding to the face information to be processed may be, but is not limited to, youth; and when gender information is reliable information, the gender information corresponding to the face information to be processed may be, but is not limited to, male.
[0059] For example, when the age information corresponding to the face information to be processed is reliable information, but the corresponding gender information is unreliable information, the corresponding attribute group determined may include: female-youth attribute group; therefore, it is necessary to determine whether the face information to be processed exists in the female-youth attribute group;
[0060] Alternatively, when the age information corresponding to the face information to be processed is unreliable information, but the corresponding gender information is reliable information, the corresponding attribute groups determined may include: male-infant attribute group, male-juvenile attribute group, male-middle-aged attribute group, and male-elderly attribute group; therefore, it is necessary to determine whether the face information to be processed exists in the male-infant attribute group, the male-juvenile attribute group, the male-middle-aged attribute group, and the male-elderly attribute group;
[0061] Alternatively, when the age information corresponding to the facial information to be processed is reliable information and the corresponding gender information is also reliable information, the corresponding attribute group determined may include: male-youth attribute group; therefore, it is necessary to determine whether the facial information to be processed exists in the male-youth attribute group.
[0062] Optionally, in the embodiment of the present invention, the method further includes:
[0063] When it is determined that the face recognition is successful, the matching tag value corresponding to the face information to be processed is updated; wherein the matching tag value is used to indicate the number of successful face recognitions;
[0064] Update the matching library identifier corresponding to the face information to be processed; wherein the matching library identifier is used to indicate the face library used when the face recognition was successful the most recently, and the face library includes: a high-frequency face library, a face attribute library, and a full face library;
[0065] Update the high-frequency face library according to the matching tag value and matching library identifier of the face information to be processed.
[0066] In this way, the high-frequency face database can be updated in real time to ensure that the facial information in the high-frequency face database is facial information with a relatively large number of successful face recognitions. Therefore, when it is applied to the access control of a certain area, if there is a change in the people entering and leaving the area, it can be ensured that the high-frequency face database is adapted to the actual situation, thereby improving the user experience.
[0067] Specifically, in the embodiment of the present invention, updating the matching mark value corresponding to the face information to be processed specifically includes:
[0068] Add 1 to the matching mark value corresponding to the face information.
[0069] For example, assuming that the facial information corresponding to user A is the facial information to be processed, taking the access control applied to a certain area as an example, when the access control successfully identifies user A for the first time, the matching tag value corresponding to user A can be increased by 1, and the matching tag value is 1 at this time;
[0070] When the access control system successfully identifies user A for the second time, the matching tag value corresponding to user A can be increased by 1, and the matching tag value is now 2.
[0071] Specifically, in the embodiment of the present invention, the matching library identifier may be set to:
[0072] If there is face information to be processed in the high-frequency face database, the matching database identifier corresponding to the face information to be processed may be the first identifier;
[0073] If there is face information to be processed in the face attribute library, then the matching library identifier corresponding to the face information to be processed may be the second identifier;
[0074] If there is face information to be processed in all face libraries, then the matching library identifier corresponding to the face information to be processed may be the third identifier.
[0075] The first identifier, the second identifier and the third identifier may be set according to actual needs, for example but not limited to at least one of numbers, letters and special symbols, which is not limited here.
[0076] Furthermore, assuming that the facial information corresponding to user A is the facial information to be processed, taking the access control applied to a certain area as an example, assuming that when the facial recognition of user A is performed for the first time, it is determined that the facial information of user A exists in the facial attribute library, then after the first facial recognition is successful, the matching library identifier corresponding to user A is updated to the second identifier;
[0077] Assume that when performing face recognition on user A for the second time, it is determined that the face information of user A exists in the high-frequency face library. Then after the second face recognition is successful, the matching library identifier corresponding to user A can be updated to the first identifier.
[0078] Specifically, in the embodiment of the present invention, updating the high-frequency face database according to the matching tag value and the matching database identifier of the face information to be processed specifically includes:
[0079] Determine whether the matching library identifier of the face information to be processed represents a high-frequency face library;
[0080] If so, keep the high-frequency face database unchanged;
[0081] If not, determine whether the storage space of the high-frequency face database is full;
[0082] If it is not full, the face information to be processed is added to the high-frequency face database to update the high-frequency face database;
[0083] If it is full, continue to determine whether the matching mark value of the face information is greater than the minimum matching mark value of the face information in the high-frequency face database;
[0084] If it is greater than, the face information corresponding to the minimum matching mark value in the high-frequency face database is removed, and the face information to be processed is added to the high-frequency face database to update the high-frequency face database;
[0085] If it is not greater than, the high-frequency face database remains unchanged.
[0086] In this way, the high-frequency face database can be updated timely and effectively. When the actual situation changes, the high-frequency face database can be adjusted timely and effectively, thereby minimizing the number of comparisons, thereby maximizing the efficiency of face recognition and greatly improving the user experience.
[0087] Specifically, the amount of facial information that can be stored in the high-frequency face database can be set according to actual needs and actual application scenarios, and is not limited here.
[0088] Specifically, in the embodiment of the present invention, it also includes:
[0089] When updating the high-frequency face database, the entire face database and face attribute database remain unchanged.
[0090] Optionally, in an embodiment of the present invention, the above-mentioned face recognition method provided in the embodiment of the present invention can be applied to any scenario requiring face recognition, such as but not limited to gates or access control, etc., and is not limited here; correspondingly, when face recognition is successful, the gate can be opened or the access control can be opened, and when face recognition fails, the gate can be kept closed or the access control can be kept closed.
[0091] The face recognition method provided by the embodiment of the present invention is described below in conjunction with specific embodiments.
[0092] Combination Figure 2 shown.
[0093] S201, obtaining a face image;
[0094] S202, performing face recognition processing on the face image to obtain a processing result, the processing result including: face information to be processed (hereinafter referred to as face information A), age information, age credibility score corresponding to the age information, gender information, and gender credibility score corresponding to the gender information;
[0095] S203, determine whether there is face information A in the high-frequency face database; if not, execute S204; if so, execute S206;
[0096] S204, determine whether the gender credibility score is less than the first preset value, and whether the age credibility score is less than the second preset value; if so, execute S205; if not, execute S213;
[0097] S205, determine whether there is face information A in all face databases; if so, execute S206; if not, end the process;
[0098] S206, adding 1 to the matching tag value corresponding to the face information A, updating the matching library identifier corresponding to the face information A, and outputting the result of successful face recognition;
[0099] S207, determining whether the matching library identifier of the face information A indicates a high-frequency face library; if so, executing S208; if not, executing S209;
[0100] S208, maintaining the high-frequency face database unchanged; ending the process;
[0101] S209, determining whether the storage space of the current high-frequency face database is full; if so, executing S210; if not, executing S212;
[0102] S210, determining whether the matching tag value corresponding to the face information A is greater than the minimum matching tag value of the face information in the high-frequency face database; if not, returning to S208; if so, executing S211;
[0103] S211, remove the face information corresponding to the minimum matching mark value in the high-frequency face database, and add the face information A to the high-frequency face database; end the process;
[0104] S212, adding the face information A to the high-frequency face database; ending the process;
[0105] S213, determine whether face information A exists in the attribute face database; if so, return to S206; if not, end the process.
[0106] Based on the same inventive concept, an embodiment of the present invention provides a face recognition device, the implementation principle of the device is similar to the principle of the aforementioned face recognition method. The specific implementation of the device can refer to the specific embodiment of the aforementioned method, and the repeated parts will not be repeated.
[0107] Specifically, an embodiment of the present invention provides a face recognition device, such as Figure 3 As shown, it may include:
[0108] Memory 301, used for storing program instructions;
[0109] The processor 302 is used to call the program instructions stored in the memory 301 and execute the above-mentioned face recognition method provided by the embodiment of the present invention according to the obtained program.
[0110] Optionally, in the embodiment of the present invention, the face recognition device may be a gate machine or an access control system, which is not limited here.
[0111] Optionally, in the embodiment of the present invention, the face recognition device may further include an image acquisition device, which may acquire face images and transmit them to the processor so that the processor performs face recognition.
[0112] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for face recognition, characterized in that: The method comprises: Get face image; Performing face recognition processing on the face image to obtain a processing result, wherein the processing result includes face information to be processed, age information corresponding to the face information to be processed, and gender information corresponding to the face information to be processed; Determining whether the face information to be processed exists in a pre-established high-frequency face database; If it exists, it is determined that the face recognition is successful; If not present: When it is determined that the age information and the gender information corresponding to the face information to be processed are both unreliable information, and the face information to be processed exists in all pre-established face libraries, it is determined that the face recognition is successful; wherein, when the face information in all face libraries is sorted from large to small according to the number of successful face recognitions, the high-frequency face library includes the first N face information in all face libraries, where N is an integer greater than 1; When it is determined that the age information and / or the gender information corresponding to the facial information to be processed is reliable information, it is determined whether the facial information to be processed exists in a pre-established facial attribute library; wherein the facial attribute library is a true subset of the entire facial library; and the facial attribute library is a database established according to the two dimensions of age and gender after the facial information in the high-frequency face library is removed from the entire face library; if so, it is determined that the facial recognition is successful; if not, it is determined that the facial recognition fails.
2. The method according to claim 1, characterized in that Determining that the age information and the gender information corresponding to the face information to be processed are both unreliable information includes: When the processing result also includes: an age credibility score corresponding to the age information, and a gender credibility score corresponding to the gender information, and when it is judged that the age credibility score is less than a first preset value, and when it is judged that the gender credibility score is less than a second preset value, it is determined that the age information and the gender information corresponding to the facial information to be processed are both unreliable information.
3. The method according to claim 1, characterized in that The face attribute library comprises: a plurality of attribute groups divided according to the age information and the gender information, at least one of the age information and the gender information corresponding to the face information in each of the attribute groups being the reliable information; Determining whether the face information to be processed exists in a pre-established face attribute library specifically includes: Determining a corresponding attribute group according to whether the age information and / or the gender information corresponding to the face information to be processed is the reliable information; It is determined whether the face information to be processed exists in the determined attribute group.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When it is determined that the face recognition is successful, updating the matching tag value corresponding to the face information to be processed; wherein the matching tag value is used to indicate the number of successful face recognitions; Update the matching library identifier corresponding to the face information to be processed; wherein the matching library identifier is used to indicate the face library used when the face recognition was successful the most recently, and the face library includes: the high-frequency face library, the face attribute library and the entire face library; The high-frequency face library is updated according to the matching mark value of the face information to be processed and the matching library identifier.
5. The method according to claim 4, characterized in that Updating the matching mark value corresponding to the face information to be processed includes: The matching mark value corresponding to the face information is increased by 1.
6. The method according to claim 4, characterized in that Updating the high-frequency face database according to the matching tag value of the face information to be processed and the matching database identifier includes: Determine whether the matching library identifier of the face information to be processed represents the high-frequency face library; If yes, keep the high-frequency face database unchanged; If not, determining whether the storage space of the high-frequency face database is full; If it is not full, adding the face information to be processed to the high-frequency face database to update the high-frequency face database; If it is full, continue to determine whether the matching mark value of the face information is greater than the minimum matching mark value of the face information in the high-frequency face database; If it is greater than, the face information corresponding to the minimum matching mark value in the high-frequency face library is removed, and the face information to be processed is added to the high-frequency face library to update the high-frequency face library; If it is not greater than, the high-frequency face database is maintained unchanged.
7. The method according to claim 4, characterized in that When the high-frequency face library is updated, the entire face library and the face attribute library are kept unchanged.
8. A face recognition device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory and execute the face recognition method as described in any one of claims 1 to 7 according to the obtained program.
Citation Information
Patent Citations
Mixed-mode face recognition method and system for supporting high-frequency use of buffer mechanism
CN112597861A
Face recognition method and device, computer equipment and storage medium
CN112949468A