Face recognition method, device, computer equipment and storage medium

By cutting and matching the face images wearing masks and synthesizing complete face images for recognition, the problem of misrecognition or inability to recognize faces in the prior art is solved, and the accuracy of face recognition is improved.

CN115063863BActive Publication Date: 2025-03-14CHINA PING AN LIFE INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210734756.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-03-14
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

Existing facial recognition technology is prone to misrecognition or unrecognition in application scenarios where faces wear masks.

Method used

By mask recognition of face images, if you wear a mask, the face image is trimmed to obtain the upper half of the face image, the lower half of the face is matched based on the upper half of the face image, and the lower half of the face matching image is obtained. Then the upper half of the face image and the lower half of the face matching image are synthesized to obtain the face synthetic image, and face recognition is performed.

Benefits of technology

When the face is blocked by a mask, the lower half is predicted by the upper part and a complete face image is synthesized, which improves the accuracy of face recognition and makes the characteristics of the recognized object more complete.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115063863B_ABST
    Figure CN115063863B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of face recognition, and in particular to a face recognition method, device, computer equipment and storage medium. The method comprises: performing mask recognition on a face image to determine whether the face in the face image is wearing a mask; if the face is wearing a mask, the face image is cropped to obtain an upper face image; based on the upper face image, the lower face of the face is matched to obtain a lower face matching image; the upper face image and the lower face matching image are synthesized to obtain a face synthesis image; face recognition is performed on the face synthesis image to obtain a face recognition result. The present invention can synthesize a complete face image when the face is blocked by a mask, and perform face recognition based on the synthesized face image, so that the features of the recognition object are more complete, which is conducive to recognition and can improve the accuracy of face recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of face recognition, and in particular to a face recognition method, device, computer equipment and storage medium. Background Art

[0002] With the rapid development of intelligent technology, face recognition is used as a means of identity verification in various scenarios. For example, face recognition attendance, community access management, station face recognition entry and other application scenarios. Existing face recognition technology is based on unobstructed face recognition, which relies on all facial feature points of the face. In conventional face recognition application scenarios, the recognition performance of existing face recognition technology is relatively stable.

[0003] However, in the application scenario where a person wears a mask, the existing facial recognition technology is prone to misidentification or failure to recognize because the lower half of the face is blocked and the available facial feature points are significantly reduced. Summary of the invention

[0004] Based on this, it is necessary to provide a face recognition method, device, computer equipment and storage medium to address the above-mentioned technical problems, so as to solve the problem that the existing face recognition technology is prone to misidentification or failure to recognize in application scenarios where a person wears a mask.

[0005] A face recognition method, comprising:

[0006] Performing mask recognition on the face image to determine whether the face in the face image is wearing a mask;

[0007] If the face is wearing a mask, the face image is cropped to obtain an upper face image;

[0008] Based on the upper half face image, performing face matching on the lower half face of the face to obtain a lower half face matching image;

[0009] Performing face synthesis on the upper half face image and the lower half face matching image to obtain a face synthesis image;

[0010] Perform face recognition on the face composite image to obtain a face recognition result.

[0011] A face recognition device, comprising:

[0012] A mask recognition module is used to perform mask recognition on a face image to determine whether the face in the face image is wearing a mask;

[0013] An upper face image module is used to crop the face image to obtain an upper face image if the face is wearing a mask;

[0014] A lower face matching image module, used for performing face matching on the lower half of the face based on the upper face image to obtain a lower face matching image;

[0015] A face synthesis image module, used for synthesizing the upper face image and the lower face matching image to obtain a face synthesis image;

[0016] The face recognition result module is used to perform face recognition on the face composite image to obtain a face recognition result.

[0017] A computer device comprises a memory, a processor and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the above-mentioned face recognition method when executing the computer-readable instructions.

[0018] One or more readable storage media storing computer-readable instructions, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors execute the above-mentioned face recognition method.

[0019] The above-mentioned face recognition method, device, computer equipment and storage medium perform mask recognition on a face image to determine whether the face in the face image is wearing a mask; if the face is wearing a mask, the face image is cropped to obtain an upper face image; based on the upper face image, the lower face of the face is matched to obtain a lower face matching image; the upper face image and the lower face matching image are synthesized to obtain a face synthesis image; the face synthesis image is performed on the face synthesis image to obtain a face recognition result. The present invention can predict the lower half of the face according to the upper half of the face when the face is blocked by a mask, and then synthesize a complete face image according to the unblocked upper half and the predicted lower half, and perform face recognition based on the synthesized face image, so that the features of the recognition object are more complete, which is conducive to recognition and can improve the accuracy of face recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0021] Figure 1 is a schematic diagram of an application environment of a face recognition method according to an embodiment of the present invention;

[0022] Figure 2is a flow chart of a face recognition method according to an embodiment of the present invention;

[0023] Figure 3 is a structural schematic diagram of a face recognition device in one embodiment of the present invention;

[0024] Figure 4 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. 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.

[0026] The face recognition method provided in this embodiment can be applied to Figure 1 In an application environment, a client communicates with a server. The client includes but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers.

[0027] In one embodiment, if Figure 2 As shown, a face recognition method is provided, which is applied in Figure 1 The server in the example is used as an example to illustrate the following steps:

[0028] S10: performing mask recognition on the face image to determine whether the face in the face image is wearing a mask.

[0029] It is understandable that a face image is usually obtained from a video or image taken by a shooting device, and the face image refers to a picture containing a face. Generally, the mask features of the face image are extracted by a mask recognition model, and based on the mask features, it is determined whether the face is wearing a mask. Among them, the mask recognition model is a model based on a deep neural network algorithm, which is used to identify whether the face is wearing a mask. For example, the mask recognition model can be a model based on the YOLOv3 (You Only Look Once) algorithm, and the YOLOv3 algorithm only needs one complete process to complete the recognition and positioning of the target.

[0030] S20: If the human face is wearing a mask, cropping the human face image to obtain an upper face image.

[0031] It is understandable that when a person wears a mask, the lower half of the face will be blocked by the mask, that is, the part of the face below the eyes will be blocked by the mask. After determining that the face in the face image is wearing a mask, the face image is cropped, and the upper half of the face that is not blocked by the mask is cropped out, that is, the part of the face above the eyes is cropped out. Specifically, the horizontal line of the two eyes in the face image is determined by the eye recognition model. After determining the horizontal line, a position line that is below the horizontal line, separated from the horizontal line by a preset distance and parallel to the horizontal line is used as a dividing line. According to the dividing line, the face image is cropped and the face image is cropped into two parts, and the face image above the dividing line is determined as the upper half of the face image, that is, the cropped part of the face above the eyes is determined as the upper half of the face image.

[0032] S30: Based on the upper half face image, perform face matching on the lower half face of the face to obtain a lower half face matching image.

[0033] It is understandable that face matching of the lower half of a face refers to the process of matching and predicting the lower half of the face based on the upper half of the face image through a face recognition model to obtain a lower half face matching image. Specifically, the upper half face features of the upper half face image are extracted through the face recognition model, and the upper half face features are compared one by one with all the registered upper half face features in the registered feature library to obtain a comparison result. Among them, the registered feature library is a pre-set feature library, and the registered feature library contains a number of registered upper half face features and an association relationship between a number of registered lower half face images and the registered upper half face features. According to the comparison results and the association relationship, a registered lower half face image matching the upper half face features is obtained, and the registered lower half face image matching the upper half face features is determined as a lower half face matching image. Among them, the number of registered lower half face images is at least one.

[0034] S40, performing face synthesis on the upper half face image and the lower half face matching image to obtain a face synthesis image.

[0035] It is understandable that according to the above steps, at least one lower face matching image can be obtained. After obtaining at least one lower face matching image, each lower face matching image is synthesized with the upper face image to obtain at least one synthesized face image.

[0036] S50: performing face recognition on the face composite image to obtain a face recognition result.

[0037] It is understandable that after obtaining the face composite image, face recognition is performed on the face composite image. Face recognition refers to the process of comparing and identifying the full-face features of the face composite image with all the registered full-face features in the registered feature library through the face recognition model to obtain the face recognition result. Generally, when the number of face composite images is 1, the full-face features of the face composite image are extracted through the face recognition model, and the full-face features are compared and identified with all the registered full-face features to obtain the face recognition result. Among them, the face recognition model is used to recognize the face composite image to obtain the face recognition result. The face recognition result includes the face composite image, the user information matched with the face composite image obtained by recognition, and other information. Among them, the user information can be personal information such as user name, gender, work number, etc. Preferably, when the number of face composite images is greater than or equal to 2, the full-face features of each face composite image are extracted through the face recognition model, and each full-face feature is compared and identified with all the registered full-face features to obtain the face recognition result. Specifically, the process of obtaining the face recognition result includes: comparing each full-face feature with all registered full-face features to obtain a number of feature similarity values. The feature similarity value refers to the maximum value of a number of similarity values ​​obtained by comparing the same full-face feature with all registered full-face features. Further, the maximum value of a number of feature similarity values ​​is used as the maximum feature similarity value, and the face recognition result is generated according to the maximum feature similarity value and the user information corresponding to the maximum feature similarity value. At this time, the face recognition result includes a face composite image corresponding to the maximum feature similarity value, and user information matching the face composite image. The user information can be personal information such as user name, gender, and work number.

[0038] In steps S10-S50, mask recognition is performed on the face image to determine whether the face in the face image is wearing a mask; if the face is wearing a mask, the face image is cropped to obtain an upper face image; based on the upper face image, the lower face of the face is matched to obtain a lower face matching image; the upper face image and the lower face matching image are synthesized to obtain a face synthesis image; face recognition is performed on the face synthesis image to obtain a face recognition result. The present invention can predict the lower half of the face according to the upper half of the face when the face is blocked by a mask, and then synthesize a complete face image according to the unblocked upper half and the predicted lower half, and perform face recognition based on the synthesized face image, so that the features of the identified object are more complete, which is conducive to recognition and can improve the accuracy of face recognition.

[0039] Optionally, in step S20, that is, performing mask recognition on the face image to determine whether the face in the face image wears a mask, includes:

[0040] S101, filtering the face image to obtain a filtered face image;

[0041] S102, extracting mask features of the filtered face image through a mask recognition model;

[0042] S103: Based on the mask features, determine whether the human face is wearing a mask.

[0043] Understandably, the acquired facial image is prone to noise due to the influence of light source, image acquisition equipment, etc. In particular, when a face wears a mask, some masks are easy to reflect light, which will increase the noise of the face image. Therefore, the face image is filtered and denoised here to improve the accuracy of mask recognition. Wherein, the original image of the face image is an RGB image, and the filtering process refers to separating the RGB image of the face image into three channels, obtaining an R channel image, a G channel image, and a B channel image, filtering the image of each channel, and synthesizing the filtered images of the three channels into a filtered face image. Preferably, filtering the image of each channel can filter the image by a low-pass filter to filter out noise. The mask recognition model is used to identify whether the face image is wearing a mask, and the mask recognition model can be a network structure using the YOLOv3 (You Only Look Once) algorithm. Mask features refer to the relevant features of the mask obtained from the face image.

[0044] In steps S101-S103, the face image is filtered to obtain a filtered face image; mask features of the filtered face image are extracted through a mask recognition model; and based on the mask features, it is determined whether the face is wearing a mask. The present invention performs filtering and denoising on the face image to improve the accuracy of mask recognition.

[0045] Optionally, in step S20, if the face is wearing a mask, the face image is cropped to obtain an upper face image, including:

[0046] S201, determining the horizontal line of the human eye in the face image by using a human eye recognition model;

[0047] S202, using a position line below the horizontal line, spaced a preset distance from the horizontal line and parallel to the horizontal line as a dividing line;

[0048] S203: Crop the facial image according to the dividing line, and determine the facial image above the dividing line as an upper face image.

[0049] It can be understood that the human eye recognition model is used to identify and locate the human eyes in the face image, where the human eyes refer to both eyes in the face image. Specifically, the position of the human eyes in the face image is located by the human eye recognition model, and the line connecting the center points of the two eyes is determined as the horizontal line of the human eyes. Among them, the center point of the eye can be the center point of the eyeball. Among them, the preset distance is a pre-set distance, which can be set according to actual needs. For example, the preset distance can be set to two-fifths of the length of the eye. Cropping refers to dividing the face image into two parts along the dividing line. And the face image above the dividing line is determined as the upper half of the face image.

[0050] Preferably, when determining the horizontal line of the human eyes in the face image through the human eye recognition model, if the horizontal line has a tilt angle, the face image is corrected according to the tilt angle so that the horizontal line of the human eyes in the face image is horizontal, thereby improving the accuracy of cropping, and further improving the integrity and recognizability of the upper half of the face image.

[0051] In steps S201-S203, the horizontal line of the human eye in the face image is determined by the human eye recognition model; a position line below the horizontal line, at a preset distance from the horizontal line and parallel to the horizontal line is used as a dividing line; according to the dividing line, the face image is cropped, and the face image above the dividing line is determined as the upper half face image. The present invention crops the face image based on the horizontal line of the human eye, which can ensure that the upper half face image contains the human eye, and can improve the integrity and recognizability of the upper half face image.

[0052] Optionally, in step S30, that is, performing face matching on the lower half of the face based on the upper half face image to obtain a lower half face matching image includes:

[0053] S301, extracting upper face features of the upper face image through a face recognition model;

[0054] S302, comparing the upper face feature with all registered upper face features in a registered feature library to obtain a comparison result; the registered feature library contains an association relationship between a registered lower face image and the registered upper face feature;

[0055] S303: Obtain a registered lower-half-face image that matches the upper-half-face feature according to the comparison result and the association relationship, and determine the registered lower-half-face image as the lower-half-face matching image.

[0056] It is understandable that the upper face feature refers to the feature of the upper face image. Generally, the upper face feature includes human eye features, forehead features and hairline features, etc. After obtaining the upper face feature of the upper face image, the registered upper face feature matching the upper face feature is searched in the registered feature library. Specifically, the upper face feature is compared with all the registered upper face features in the registered feature library to obtain a comparison result. The comparison result refers to the result of comparing the upper face feature with all the registered upper face features in the registered feature library. The comparison result contains at least one registered upper face feature matching the upper face feature. Preferably, when constructing the registered feature library, the registered face image, the registered lower face image, the registered full face feature and the registered upper face feature of the same user are associated. According to the registered upper face feature matching the upper face feature contained in the comparison result and the association relationship between the registered upper face feature and the registered lower face image, the registered lower face image corresponding to the upper face feature can be determined, and the registered lower face image is determined as the lower face matching image.

[0057] In steps S301-S303, the upper face features of the upper face image are extracted through the face recognition model; the upper face features are compared with all registered upper face features in the registered feature library to obtain a comparison result; the registered feature library contains the association relationship between the registered lower face image and the registered upper face features; according to the comparison result and the association relationship, a registered lower face image matching the upper face features is obtained, and the registered lower face image is determined as the lower face matching image. The present invention first matches the corresponding registered upper face features based on the upper face image, and then determines the registered lower face image corresponding to the registered upper face image as the lower face matching image based on the association relationship. Since the association relationship is determined, the accuracy of the lower face matching image can be improved.

[0058] Optionally, before step S302, before comparing the upper face feature with all registered upper face features in a registered feature library, the process includes:

[0059] S3021, obtaining a registered face image of the user;

[0060] S3022, extracting the registered full face features and the registered upper half face features of the registered face image through the face recognition model;

[0061] S3023, performing face cropping on the registered face image to obtain a registered lower half face image; the registered lower half face image is associated with the registered upper half face features;

[0062] S3024, constructing the registered feature library according to the registered full-face features, the registered upper-half-face features, the registered lower-half-face image, and the association relationship.

[0063] It is understandable that the registered face image refers to the face image provided by the user during registration, and the face image is a frontal face image without a mask. The registered full face features refer to all the features of the face in the registered face image. The registered upper face features refer to the features of the upper half of the face in the registered face image. Among them, the upper half features can be set according to actual needs. For example, the upper half features may include eye features, forehead features, and hairline features. Face cropping refers to cropping the registered face image. The specific cropping method can refer to the cropping method of the above-mentioned face image, which is not limited here. When constructing the registered feature library, the registered face image, registered lower half face image, registered full face features, and registered upper half face features of the same user are associated. By constructing a registered feature library, the accuracy of the lower half face matching image can be improved.

[0064] Optionally, before step S10, the mask recognition of the face image and the determination of whether the face is wearing a mask include:

[0065] S104, performing face detection on the initial face image using a face detection model, cropping the detected face, and generating the face image;

[0066] S105, determining whether the face in the face image is a frontal face, and obtaining a determination result;

[0067] S106: If the judgment result indicates that the face is not a frontal face, triggering a warning measure corresponding to the judgment result.

[0068] It is understandable that the initial face image refers to the original face image obtained by the camera device. The face detection model is used to detect whether the initial face image contains a face. If the initial face image contains a face, the face is extracted from the initial face image to generate a face image. Among them, the front face means that the face in the face image is facing forward. When it is detected that the face in the face image is not a front face, the corresponding early warning measure may be to re-acquire the initial face image, so that the accuracy of face recognition can be improved. Preferably, if the initial face image contains a face, the position of the face is located, the size of the face is identified, and the face is marked, so that the user can know whether he has been recognized in time. The marking method can be to generate a colored marking frame at the position of the face according to the size of the face, and the specific marking method is not limited here.

[0069] Optionally, in step S50, that is, performing face recognition on the face composite image to obtain a face recognition result, includes:

[0070] S501, extracting full-face features of the face composite image through the face recognition model;

[0071] S502: Compare and identify the full-face feature with all the registered full-face features in the registered feature library to obtain a face recognition result.

[0072] It is understandable that the full face feature refers to all the features of the face in the face composite image. The full face feature of the face composite image is extracted through the face recognition model, and the full face feature is compared and identified with all registered full face features to obtain the face recognition result. Among them, the face recognition model is used to identify the face composite image to obtain the face recognition result. The face recognition result includes the face composite image, the user information matched with the face composite image obtained by recognition, and other information. Among them, the user information can be personal information such as user name, gender, work number, etc.

[0073] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0074] In one embodiment, a face recognition device is provided, which corresponds one-to-one to the face recognition method in the above embodiment. Figure 3 As shown, the face recognition device includes a mask recognition module 10, an upper face image module 20, a lower face matching image module 30, a face synthesis image module 40 and a face recognition result module 50. The functional modules are described in detail as follows:

[0075] The mask recognition module 10 is used to perform mask recognition on the face image to determine whether the face in the face image is wearing a mask;

[0076] The upper face image module 20 is used to crop the face image to obtain an upper face image if the face is wearing a mask;

[0077] A lower half face matching image module 30 is used to perform face matching on the lower half of the face based on the upper half face image to obtain a lower half face matching image;

[0078] A face synthesis image module 40 is used to synthesize the upper face image and the lower face matching image to obtain a face synthesis image;

[0079] The face recognition result module 50 is used to perform face recognition on the face composite image to obtain a face recognition result.

[0080] Optionally, the mask recognition module 10 includes:

[0081] A face image filtering unit, used for filtering the face image to obtain a filtered face image;

[0082] A mask feature unit, used for extracting mask features of the filtered face image through a mask recognition model;

[0083] The mask judgment unit is used to judge whether the face is wearing a mask based on the mask features.

[0084] Optionally, the upper face image module 20 includes:

[0085] A horizontal line unit, used to determine the horizontal line of the human eye in the face image through a human eye recognition model;

[0086] A dividing line unit, used to use a position line below the horizontal line, at a preset distance from the horizontal line and parallel to the horizontal line as a dividing line;

[0087] The upper face image unit is used to cut the face image according to the dividing line, and determine the face image above the dividing line as the upper face image.

[0088] Optionally, the lower face matching image module 30 includes:

[0089] An upper face feature unit, used for extracting upper face features of the upper face image through a face recognition model;

[0090] A comparison result unit, used for comparing the upper half face feature with all registered upper half face features in a registered feature library to obtain a comparison result; the registered feature library contains an association relationship between a registered lower half face image and the registered upper half face feature;

[0091] The registered lower face image unit is used to obtain a registered lower face image matching the upper face feature according to the comparison result and the association relationship, and determine the registered lower face image as the lower face matching image.

[0092] Optionally, before the comparison result unit, it includes:

[0093] A registered face image unit, used to obtain a registered face image of a user;

[0094] A registration feature extraction unit, used to extract the registration full face features and the registration upper half face features of the registration face image through the face recognition model;

[0095] A registered lower half face image unit is used to perform face cropping on the registered face image to obtain a registered lower half face image; the registered lower half face image is associated with the registered upper half face features;

[0096] A registration feature library construction unit is used to construct the registration feature library according to the registered full-face features, the registered upper-half-face features, the registered lower-half-face image and the association relationship.

[0097] Optionally, the mask recognition module 10 includes:

[0098] A face detection unit, used to perform face detection on the initial face image through a face detection model, crop the detected face, and generate the face image;

[0099] A frontal face judgment unit, used to judge whether the face in the face image is a frontal face, and obtain a judgment result;

[0100] The early warning measure unit is used to trigger the early warning measure corresponding to the judgment result if the judgment result indicates that the face is not a frontal face.

[0101] Optionally, the face recognition result module 50 includes:

[0102] A full-face feature unit, used for extracting full-face features of the face composite image through the face recognition model;

[0103] The face recognition result unit is used to compare and identify the full-face feature with all the registered full-face features in the registered feature library to obtain a face recognition result.

[0104] For the specific definition of the face recognition device, please refer to the definition of the face recognition method above, which will not be repeated here. Each module in the above face recognition device can be implemented in whole or in part by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0105] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a readable storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer-readable instructions are executed by the processor, a face recognition method is implemented. The readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.

[0106] In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor executes the computer-readable instructions to implement the following steps:

[0107] Performing mask recognition on the face image to determine whether the face in the face image is wearing a mask;

[0108] If the face is wearing a mask, the face image is cropped to obtain an upper face image;

[0109] Based on the upper half face image, performing face matching on the lower half face of the face to obtain a lower half face matching image;

[0110] Performing face synthesis on the upper half face image and the lower half face matching image to obtain a face synthesis image;

[0111] Perform face recognition on the face composite image to obtain a face recognition result.

[0112] In one embodiment, one or more computer-readable storage media storing computer-readable instructions are provided. The readable storage media provided in this embodiment include non-volatile readable storage media and volatile readable storage media. The readable storage media store computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the following steps are implemented:

[0113] Performing mask recognition on the face image to determine whether the face in the face image is wearing a mask;

[0114] If the face is wearing a mask, the face image is cropped to obtain an upper face image;

[0115] Based on the upper half face image, performing face matching on the lower half face of the face to obtain a lower half face matching image;

[0116] Performing face synthesis on the upper half face image and the lower half face matching image to obtain a face synthesis image;

[0117] Perform face recognition on the face composite image to obtain a face recognition result.

[0118] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When the computer-readable instructions are executed, they may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0119] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0120] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A face recognition method, characterized in that: include: Performing mask recognition on the face image to determine whether the face in the face image is wearing a mask; If the face is wearing a mask, the face image is cropped to obtain an upper face image; Based on the upper half face image, performing face matching on the lower half face of the face to obtain a lower half face matching image; Performing face synthesis on the upper half face image and the lower half face matching image to obtain a face synthesis image; Performing face recognition on the face composite image to obtain a face recognition result; If the face is wearing a mask, the face image is cropped to obtain an upper face image, including: Determine the horizontal line of the human eye in the face image by using a human eye recognition model; wherein, if the horizontal line has an inclination angle, correct the face image according to the inclination angle so that the horizontal line of the human eye in the face image is in a horizontal state; A position line below the horizontal line, spaced a preset distance from the horizontal line and parallel to the horizontal line is used as a dividing line; According to the dividing line, the facial image is cropped, and the facial image above the dividing line is determined as the upper half of the facial image; The step of performing face matching on the lower half of the face based on the upper half face image to obtain a lower half face matching image comprises: Extracting upper face features of the upper face image through a face recognition model; Compare the upper face feature with all registered upper face features in a registered feature library to obtain a comparison result; the registered feature library contains the association relationship between the registered lower face image and the registered upper face feature; According to the comparison result and the association relationship, a registered lower-half-face image matching the upper-half-face feature is obtained, and the registered lower-half-face image is determined as the lower-half-face matching image.

2. The face recognition method according to claim 1, characterized in that: Performing mask recognition on a face image to determine whether a face in the face image is wearing a mask includes: Performing filtering on the face image to obtain a filtered face image; Extracting mask features of the filtered face image through a mask recognition model; Based on the mask features, determine whether the face is wearing a mask.

3. The face recognition method according to claim 1, characterized in that: Before comparing the upper face feature with all registered upper face features in a registered feature library, the method includes: Get the user's registered face image; Extracting the registered full face features and the registered upper half face features of the registered face image through the face recognition model; Performing face cropping on the registered face image to obtain a registered lower half face image; the registered lower half face image is associated with the registered upper half face features; The registered feature library is constructed according to the registered full-face features, the registered upper-half-face features, the registered lower-half-face image and the association relationship.

4. The face recognition method according to claim 1, characterized in that: Before performing mask recognition on a face image to determine whether the face is wearing a mask, the method includes: Performing face detection on the initial face image by using a face detection model, cropping the detected face, and generating the face image; Determine whether the face in the face image is a frontal face, and obtain a determination result; If the judgment result indicates that the face is not a frontal face, a warning measure corresponding to the judgment result is triggered.

5. The face recognition method according to claim 1, characterized in that: The performing face recognition on the face composite image to obtain a face recognition result includes: Extracting full-face features of the face composite image through the face recognition model; The full-face feature is compared and identified with all the registered full-face features in the registered feature library to obtain a face recognition result.

6. A face recognition device, characterized in that: include: A mask recognition module is used to perform mask recognition on a face image to determine whether the face in the face image is wearing a mask; An upper face image module is used to crop the face image to obtain an upper face image if the face is wearing a mask; A lower face matching image module, used for performing face matching on the lower half of the face based on the upper face image to obtain a lower face matching image; A face synthesis image module, used for synthesizing the upper face image and the lower face matching image to obtain a face synthesis image; A face recognition result module is used to perform face recognition on the face composite image to obtain a face recognition result; Upper face image module, including: A horizontal line unit, used to determine the horizontal line of the human eye in the face image through a human eye recognition model; wherein, if the horizontal line has an inclination angle, the face image is corrected according to the inclination angle so that the horizontal line of the human eye in the face image is in a horizontal state; A dividing line unit, used to use a position line below the horizontal line, at a preset distance from the horizontal line and parallel to the horizontal line as a dividing line; An upper face image unit, used to perform cropping processing on the face image according to the dividing line, and determine the face image above the dividing line as the upper face image; The lower face matching image module comprises: An upper face feature unit, used for extracting upper face features of the upper face image through a face recognition model; A comparison result unit, used for comparing the upper half face feature with all registered upper half face features in a registered feature library to obtain a comparison result; the registered feature library contains an association relationship between a registered lower half face image and the registered upper half face feature; The registered lower face image unit is used to obtain a registered lower face image matching the upper face feature according to the comparison result and the association relationship, and determine the registered lower face image as the lower face matching image.

7. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer-readable instructions, the face recognition method according to any one of claims 1 to 5 is implemented.

8. One or more computer-readable storage media storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by one or more processors, the one or more processors execute the face recognition method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Face recognition method, device and equipment

    CN113033244A

  • Face recognition method based on image splicing

    CN114241542A

  • Feature extraction model training method, facial recognition method, apparatus, device and medium

    WO2021174880A1