Face recognition method, device, equipment and medium based on offline class center

Through the face recognition method based on the offline class center, the unmasked data set is used to train and freeze the classification layer weights, combined with the mask augmentation data, to solve the problems of poor mask face recognition results and high training resource consumption in the existing technology. , improves the accuracy and robustness of face recognition, and reduces training time and memory usage.

CN114694231BActive Publication Date: 2024-09-06SHENZHEN TVT DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210415640.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-18
Publication Date
2024-09-06
Estimated Expiration
2042-04-18

AI Technical Summary

Technical Problem

Existing mask face recognition methods are not effective in practical applications, and consume a large amount of GPU memory and time during the training process, resulting in a decrease in recognition accuracy and robustness.

Method used

Using a face recognition method based on offline class centers, the face recognition network is trained by obtaining face data sets without masks, freezing the weights of the classification layer, and introducing mask augmentation data into the model to narrow down the number of people wearing masks and those without masks. differences in facial features to improve recognition accuracy.

Benefits of technology

It significantly improves the recognition accuracy of faces without masks without losing the recognition effect of faces wearing masks, reduces the occupation of GPU memory during the training process and speeds up the training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114694231B
    Figure CN114694231B
Patent Text Reader

Abstract

The embodiment of the present invention discloses a face recognition method, device, equipment and medium based on offline class center, wherein the method includes obtaining captured image data with a face; performing face key feature detection on the captured image data, and performing affine transformation on the face area to obtain face image data; inputting the obtained face image data into a pre-trained face recognition model to obtain the features of the face image; comparing the obtained face image with the face image stored in the face feature library to obtain a similarity score; comparing the obtained similarity score with a set threshold to obtain the ID of the captured image data. The present invention improves the accuracy and robustness of face recognition. On the basis of not losing the recognition effect of a face wearing a mask, the recognition effect of a face not wearing a mask is significantly increased. In addition, the weights of the classification layer can be reused for the same data set, thereby reducing the GPU memory occupancy during training and speeding up the training speed.
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 technology, and more specifically to a face recognition method, device, equipment and medium based on an offline class center. Background Art

[0002] With the normalization of public health events in recent years, higher requirements have been placed on the effect of face recognition with masks. In most practical application scenarios, the captured masked faces are compared with normal faces (faces without masks) in the face library, which assumes that normal faces are class centers. Existing masked face recognition methods mostly use mask data enhancement and add attention mechanisms to the model. According to relevant studies, the class center is actually the feature mean of all samples in the class. Due to the addition of mask augmentation, the existing masked face recognition methods have deviated from the class center of normal faces, which results in the effect of masked face recognition in practical applications not being optimal, and a decrease in the effect of normal face recognition. In addition, due to the increasing number of face recognition data IDs, each training of the class center will result in huge GPU memory usage and training time during the training process. Summary of the invention

[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a face recognition method, device, equipment and medium based on an offline class center.

[0004] To achieve the above object, the present invention adopts the following technical solutions:

[0005] In a first aspect, a face recognition method based on an offline class center, the method comprises:

[0006] Obtain captured image data with human faces;

[0007] Detect key facial features of the captured image data and perform affine transformation on the facial area to obtain facial image data;

[0008] Inputting the obtained face image data into a pre-trained face recognition model to obtain features of the face image;

[0009] Compare the obtained face image with the face image stored in the face feature library to obtain a similarity score;

[0010] The obtained similarity score is compared with a set threshold to obtain the ID of the captured image data.

[0011] Its further technical solution is: the key facial features are detected on the captured image data, and the face area is affine transformed to obtain face image data, wherein the key facial features include the coordinates of the centers of the eyes, the coordinates of the nose tip, and the coordinates of the left and right corners of the mouth.

[0012] Its further technical solution is: the method for creating the face recognition model includes:

[0013] Obtain a dataset of unmasked faces and initialize the first face recognition network;

[0014] The face dataset without masks is sent in batches to the initialized first face recognition network for training to obtain the classification layer FC of the first face recognition network;

[0015] The classification layer FC of the first face recognition network is used to assign and freeze the classification layer of the second face recognition network;

[0016] Perform mask augmentation on the face dataset without masks;

[0017] The mask-augmented dataset is input into the assigned and frozen second face recognition network in batches for training;

[0018] A feature extraction part is selected from the assigned and frozen second face recognition network to serve as the face recognition model for the final application.

[0019] Its further technical solution is: the first face recognition network and the second face recognition network both include:

[0020] Use the backbone network to extract facial features;

[0021] The classification network is used to classify the facial features extracted by the backbone.

[0022] Its further technical solution is: the backbone network adopts convolutional neural network or transformer, and the classification network adopts FC.

[0023] In a second aspect, a face recognition device based on an offline class center, the device includes an acquisition unit, a detection unit, an input unit, a contrast unit, and a comparison unit;

[0024] The acquisition unit is used to acquire captured image data with a human face;

[0025] The detection unit is used to detect key facial features of the captured image data and perform affine transformation on the facial region to obtain facial image data;

[0026] The input unit is used to input the obtained face image data into a pre-trained face recognition model to obtain features of the face image;

[0027] The comparison unit is used to compare the obtained face image with the face image stored in the face feature library to obtain a similarity score;

[0028] The comparison unit is used to compare the obtained similarity score with a set threshold value to obtain the ID of the captured image data.

[0029] Its further technical solution is: it also includes an acquisition module, a first training module, an assignment freezing module, a mask augmentation module, a second training module and a selection module;

[0030] The acquisition module is used to acquire a dataset of faces without masks and initialize a first face recognition network;

[0031] The first training module is used to send the face data set without masks to the initialized first face recognition network in batches for training, so as to obtain the classification layer FC of the first face recognition network;

[0032] The assignment and freezing module is used to assign and freeze the classification layer of the second face recognition network using the classification layer FC obtained from the first face recognition network;

[0033] The mask augmentation module is used to perform mask augmentation on a face dataset of people who are not wearing masks;

[0034] The second training module is used to input the mask-augmented dataset in batches into the assigned and frozen second face recognition network for training;

[0035] The selection module is used to select the feature extraction part from the second face recognition network that has been assigned and frozen, so as to serve as the face recognition model for final application.

[0036] Its further technical solution is: it also includes an extraction module and a classification module;

[0037] The extraction module is used to extract the features of the face using the backbone network;

[0038] The classification module is used to classify the facial features extracted by the backbone using the classification network.

[0039] In a third aspect, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned steps of the offline class center-based face recognition method when executing the computer program.

[0040] In a fourth aspect, a computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the face recognition method based on offline class centers as described above.

[0041] The beneficial effect of the present invention compared with the prior art is that the present invention adopts the method of offline class center to train the face recognition model. In the face recognition model training, the classification layer FC of the first face recognition network is used to assign and freeze the classification layer of the second face recognition network. It is intended to introduce the class center of the face without a mask to cater to the scene in the actual application, forcing the face recognition model to reduce the difference or distance between the facial features of wearing a mask and not wearing a mask as much as possible, increase the similarity between the facial features of wearing a mask and not wearing a mask, and help improve the accuracy and robustness of face recognition. On the basis of not losing the recognition effect of the face wearing a mask, the recognition effect of the face without a mask is significantly increased. In addition, the weight of the classification layer can be reused for the same data set, thereby reducing the occupancy of the GPU memory during training and speeding up the training speed.

[0042] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 will be briefly introduced below. Obviously, the accompanying drawings described below are 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 any creative work.

[0044] Figure 1 A flowchart of a face recognition method based on offline class centers provided by a specific embodiment of the present invention;

[0045] Figure 2 A schematic block diagram of a face recognition device based on an offline class center provided in a specific embodiment of the present invention;

[0046] Figure 3 A schematic block diagram of a computer device provided for a specific embodiment of the present invention;

[0047] Figure 4 A schematic diagram of face recognition training provided for a specific implementation of the present invention. DETAILED DESCRIPTION

[0048] In order to more fully understand the technical content of the present invention, the technical solution of the present invention is further introduced and illustrated in conjunction with specific embodiments below, but is not limited thereto.

[0049] 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.

[0050] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0051] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural forms unless the context clearly indicates otherwise.

[0052] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0053] The specific embodiment of the present invention provides a face recognition method based on an offline class center. In this embodiment, the method is applied to a face panel machine for specific description. Figure 1 As shown, the method includes the following steps: S10-S50.

[0054] S10: Acquire captured image data with a human face.

[0055] The captured image data of human faces can be obtained through image sensors, cameras and other image acquisition devices.

[0056] S20: Detect key facial features of the captured image data and perform affine transformation on the facial region to obtain facial image data.

[0057] The key features of the face can be detected by using the mature face detection model. The key features of the face include the coordinates of the center of the eyes, the coordinates of the nose tip, and the coordinates of the left and right corners of the mouth.

[0058] S30, inputting the obtained face image data into a pre-trained face recognition model to obtain features of the face image.

[0059] Specifically, the face recognition model is trained using the offline class center method. The so-called class center is the weight of the fully connected layer (FC) in the classification network. Usually, this class center (FC weight) is trained together with the backbone network based on the input data. Here, a fixed class center is used, so it is called an offline class center. The face recognition model obtained after training effectively improves the accuracy of normal face recognition while ensuring the accuracy of mask face recognition. And during the training process, the class center only needs to be trained once for the same data set, which can effectively reduce the number of class center training times, thereby speeding up training and reducing GPU memory usage.

[0060] The method for creating a face recognition model includes the following steps:

[0061] S301, obtaining a face data set of people who are not wearing masks and initializing a first face recognition network.

[0062] The face dataset is composed of multiple face data.

[0063] S302, sending the face data set without masks to the initialized first face recognition network in batches for training to obtain the classification layer FC of the first face recognition network.

[0064] The first face recognition network includes: using a backbone network to extract face features; and using a classification network to classify the face features extracted by the backbone.

[0065] The backbone network uses a convolutional neural network or transformer, which is mainly used to extract facial features. The classification network uses a fully connected neural network (FC). Classification is performed based on the facial features extracted by the backbone. In face recognition, the weights of facial features and FC are normalized, so that a loss function based on angular distance, such as ARCloss, can be used. After the weight of FC is normalized, it represents the class center of each class. Back propagation is performed based on the obtained loss, the gradients of all parameters are calculated, and the gradients are updated according to the gradient descent method until the loss converges or the preset number of iterations is reached.

[0066] S303: Use the classification layer FC of the first face recognition network to assign a value to the classification layer of the second face recognition network and freeze it.

[0067] The second face recognition network includes: using the backbone network to extract face features; and using the classification network to classify the face features extracted by the backbone.

[0068] The classification layer FC of the first face recognition network is used to assign and freeze the classification layer of the second face recognition network, and does not participate in the parameter update during directional propagation. The purpose of this treatment is to cater to the scenarios in practical applications by introducing the class center (classification layer FC) of normal faces (faces without masks). Forcing the face recognition model to minimize the difference or distance between the facial features of people wearing masks and those not wearing masks as much as possible, and increasing the similarity between the facial features of people wearing masks and those not wearing masks, helps to improve the accuracy and robustness of face recognition.

[0069] S304, performing mask augmentation on the face dataset of people who are not wearing masks.

[0070] In this embodiment, an online mask augmentation method is adopted, for example, random cutout is used to simulate the mask, the size of the input data is 112*112, the center point of the mask is selected at (56,112), and the width and height of the mask are randomly sampled within [56,112].

[0071] S305, inputting the mask-augmented dataset into the assigned and frozen second face recognition network in batches for training.

[0072] The way to feed data into the network in batches is, for example, if there are 100 data in total, 10 data are fed in each time, so a full round of training is completed 10 times. Each batch is 10 data, usually called batch size = 10.

[0073] The backbone network uses a convolutional neural network or transformer, which is mainly used to extract facial features. The classification network uses a fully connected neural network (FC). Classification is performed based on the facial features extracted by the backbone. In face recognition, the weights of facial features and FC are normalized, so that a loss function based on angular distance, such as ARCloss, can be used. After the weight of FC is normalized, it represents the class center of each class. According to the loss, back propagation is performed, the gradient is calculated, and the unfrozen parameters are updated using the gradient descent method until the loss converges or the preset number of iterations is reached.

[0074] S306: Select a feature extraction part from the assigned and frozen second face recognition network to serve as a face recognition model for final application.

[0075] like Figure 4 As shown, Figure 4This is a schematic diagram of face recognition training. It can be seen from the figure that the classification layer weights (FC) obtained by training the first face recognition network using a data set of normal faces (faces without masks) are used to assign and freeze the classification layer of the second face recognition network. The purpose is to cater to the scenarios in practical applications by introducing the class center of normal faces. Forcing the face recognition model to minimize the difference or distance between the facial features of people wearing masks and those not wearing masks as much as possible, and increasing the similarity between the facial features of people wearing masks and those not wearing masks, helps to improve the accuracy and robustness of face recognition. Without losing the recognition effect of masked faces, the recognition effect of non-mask faces (faces without masks) is significantly increased. In addition, the weights of the classification layer can be reused for the same data set, thereby reducing the GPU memory usage during training and speeding up training.

[0076] S40: Compare the obtained face image with the face image stored in the face feature library to obtain a similarity score.

[0077] S50 , comparing the obtained similarity score with a set threshold value to obtain an ID of the captured image data.

[0078] The threshold can be determined based on the false detection rate. For example, the false detection rate is set to 10e-5, that is, only one error is allowed in 100,000. The threshold that can reach this standard is the threshold for application. By comparing the similarity score with the threshold, if it meets the threshold requirement, the ID of the corresponding image data is determined as the ID to be found. This application is applied in a face panel machine, which can effectively improve the accuracy of face recognition without a mask while ensuring the accuracy of face recognition with a mask.

[0079] 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.

[0080] Corresponding to the above-mentioned face recognition method based on offline class center, a specific embodiment of the present invention further provides a face recognition device based on offline class center.

[0081] like Figure 2 As shown, the face recognition device based on offline class center includes an acquisition unit 1, a detection unit 2, an input unit 3, a contrast unit 4 and a comparison unit 5.

[0082] The acquisition unit 1 is used to acquire captured image data with a human face.

[0083] The captured image data of human faces can be obtained through image sensors, cameras and other image acquisition devices.

[0084] The detection unit 2 is used to detect key facial features of the captured image data and perform affine transformation on the facial area to obtain facial image data.

[0085] The key features of the face can be detected by using the mature face detection model. The key features of the face include the coordinates of the center of the eyes, the coordinates of the nose tip, and the coordinates of the left and right corners of the mouth.

[0086] The input unit 3 is used to input the obtained face image data into a pre-trained face recognition model to obtain the features of the face image.

[0087] Specifically, the face recognition model is trained using the offline class center method. The so-called class center is the weight of the fully connected layer (FC) in the classification network. Usually, this class center (FC weight) is trained together with the backbone network based on the input data. Here, a fixed class center is used, so it is called an offline class center. The face recognition model obtained after training effectively improves the accuracy of normal face recognition while ensuring the accuracy of mask face recognition. And during the training process, the class center only needs to be trained once for the same data set, which can effectively reduce the number of class center training times, thereby speeding up training and reducing GPU memory usage.

[0088] The device also includes an acquisition module, a first training module, an assignment freezing module, a mask augmentation module, a second training module and a selection module.

[0089] The acquisition module is used to obtain a dataset of faces without masks and initialize the first face recognition network.

[0090] The face dataset is composed of multiple face data.

[0091] The first training module is used to send the face data set without masks in batches to the initialized first face recognition network for training, so as to obtain the classification layer FC of the first face recognition network.

[0092] The device also includes an extraction module and a classification module.

[0093] The extraction module is used to extract facial features using the backbone network.

[0094] The classification module is used to classify the facial features extracted by the backbone using the classification network.

[0095] The backbone network uses a convolutional neural network or transformer, which is mainly used to extract facial features. The classification network uses a fully connected neural network (FC). Classification is performed based on the facial features extracted by the backbone. In face recognition, the weights of facial features and FC are normalized, so that a loss function based on angular distance, such as ARCloss, can be used. After the weight of FC is normalized, it represents the class center of each class. Back propagation is performed based on the obtained loss, the gradients of all parameters are calculated, and the gradients are updated according to the gradient descent method until the loss converges or the preset number of iterations is reached.

[0096] The value assignment and freezing module is used to assign and freeze the classification layer of the second face recognition network by using the classification layer FC of the first face recognition network.

[0097] The second face recognition network includes: using the backbone network to extract face features; and using the classification network to classify the face features extracted by the backbone.

[0098] The classification layer FC of the first face recognition network is used to assign and freeze the classification layer of the second face recognition network, and does not participate in the parameter update during directional propagation. The purpose of this treatment is to cater to the scenarios in practical applications by introducing the class center (classification layer FC) of normal faces (faces without masks). Forcing the face recognition model to minimize the difference or distance between the facial features of people wearing masks and those not wearing masks as much as possible, and increasing the similarity between the facial features of people wearing masks and those not wearing masks, helps to improve the accuracy and robustness of face recognition.

[0099] The mask augmentation module is used to perform mask augmentation on the face dataset without masks.

[0100] In this embodiment, an online mask augmentation method is adopted, for example, random cutout is used to simulate the mask, the size of the input data is 112*112, the center point of the mask is selected at (56,112), and the width and height of the mask are randomly sampled within [56,112].

[0101] The second training module is used to input the mask-augmented data set in batches into the assigned and frozen second face recognition network for training.

[0102] The way to feed data into the network in batches is, for example, if there are 100 data in total, 10 data are fed in each time, so a full round of training is completed 10 times. Each batch is 10 data, usually called batch size = 10.

[0103] The backbone network uses a convolutional neural network or transformer, which is mainly used to extract facial features. The classification network uses a fully connected neural network (FC). Classification is performed based on the facial features extracted by the backbone. In face recognition, the weights of facial features and FC are normalized, so that a loss function based on angular distance, such as ARCloss, can be used. After the weight of FC is normalized, it represents the class center of each class. According to the loss, back propagation is performed, the gradient is calculated, and the unfrozen parameters are updated using the gradient descent method until the loss converges or the preset number of iterations is reached.

[0104] The selection module is used to select the feature extraction part from the second face recognition network that has been assigned and frozen, so as to serve as the face recognition model for the final application.

[0105] like Figure 4 As shown, Figure 4 This is a schematic diagram of face recognition training. It can be seen from the figure that the classification layer weights (FC) obtained by training the first face recognition network using a data set of normal faces (faces without masks) are used to assign and freeze the classification layer of the second face recognition network. The purpose is to cater to the scenarios in practical applications by introducing the class center of normal faces. Forcing the face recognition model to minimize the difference or distance between the facial features of people wearing masks and those not wearing masks as much as possible, and increasing the similarity between the facial features of people wearing masks and those not wearing masks, helps to improve the accuracy and robustness of face recognition. Without losing the recognition effect of masked faces, the recognition effect of non-mask faces (faces without masks) is significantly increased. In addition, the weights of the classification layer can be reused for the same data set, thereby reducing the GPU memory usage during training and speeding up training.

[0106] The comparison unit 4 is used to compare the obtained face image with the face image stored in the face feature library to obtain a similarity score.

[0107] The comparison unit 5 is used to compare the obtained similarity score with a set threshold value to obtain the ID of the captured image data.

[0108] The threshold can be determined based on the false positive rate. For example, if the false positive rate is 10e-5, that is, only one error is allowed in 100,000, the threshold that can reach this standard is the threshold for application. By comparing the similarity score with the threshold, if it meets the threshold requirement, the ID of the corresponding image data is determined as the ID to be found. Figure 3 As shown, a specific embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned steps of the face recognition method based on offline class center are implemented.

[0109] The computer device 700 may be a terminal or a server. The computer device 700 includes a processor 720 , a memory, and a network interface 750 connected via a system bus 710 , wherein the memory may include a non-volatile storage medium 730 and an internal memory 740 .

[0110] The non-volatile storage medium 730 may store an operating system 731 and a computer program 732. When the computer program 732 is executed, the processor 720 may execute any face recognition method based on offline class centers.

[0111] The processor 720 is used to provide computing and control capabilities and support the operation of the entire computer device 700.

[0112] The internal memory 740 provides an environment for the operation of the computer program 732 in the non-volatile storage medium 730. When the computer program 732 is executed by the processor 720, the processor 720 can execute any face recognition method based on the offline class center.

[0113] The network interface 750 is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 700 to which the solution of the present application is applied. The specific computer device 700 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. The processor 720 is used to run the program code stored in the memory to implement the following steps:

[0114] Obtain captured image data with human faces;

[0115] Detect key facial features of the captured image data and perform affine transformation on the facial area to obtain facial image data;

[0116] Inputting the obtained face image data into a pre-trained face recognition model to obtain features of the face image;

[0117] Compare the obtained face image with the face image stored in the face feature library to obtain a similarity score;

[0118] The obtained similarity score is compared with a set threshold to obtain the ID of the captured image data.

[0119] Its further technical solution is: the key facial features are detected on the captured image data, and the face area is affine transformed to obtain face image data, wherein the key facial features include the coordinates of the centers of the eyes, the coordinates of the nose tip, and the coordinates of the left and right corners of the mouth.

[0120] Its further technical solution is: the method for creating the face recognition model includes:

[0121] Obtain a dataset of unmasked faces and initialize the first face recognition network;

[0122] The face dataset without masks is sent in batches to the initialized first face recognition network for training to obtain the classification layer FC of the first face recognition network;

[0123] The classification layer FC of the first face recognition network is used to assign and freeze the classification layer of the second face recognition network;

[0124] Perform mask augmentation on the face dataset without masks;

[0125] The mask-augmented dataset is input into the assigned and frozen second face recognition network in batches for training;

[0126] A feature extraction part is selected from the assigned and frozen second face recognition network to serve as the face recognition model for the final application.

[0127] Its further technical solution is: the first face recognition network and the second face recognition network both include:

[0128] Use the backbone network to extract facial features;

[0129] The classification network is used to classify the facial features extracted by the backbone.

[0130] Its further technical solution is: the backbone network adopts convolutional neural network or transformer, and the classification network adopts FC.

[0131] It should be understood that in the embodiment of the present application, the processor 720 may be a central processing unit (CPU), and the processor 720 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0132] Those skilled in the art will understand that Figure 3 The structure of the computer device 700 shown in the figure does not constitute a limitation on the computer device 700, and the computer device 700 may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0133] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0134] 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 is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. The functional units in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0135] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0136] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0137] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0138] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A face recognition method based on offline class center, characterized in that: The method comprises: Obtain captured image data with human faces; Detect key facial features of the captured image data and perform affine transformation on the facial area to obtain facial image data; Inputting the obtained face image data into a pre-trained face recognition model to obtain features of the face image; Compare the obtained face image with the face image stored in the face feature library to obtain a similarity score; The obtained similarity score is compared with the set threshold to obtain the ID of the captured image data; The method for creating the face recognition model includes: Obtain a dataset of unmasked faces and initialize the first face recognition network; The face dataset without masks is sent in batches to the initialized first face recognition network for training to obtain the classification layer FC of the first face recognition network; The classification layer FC of the first face recognition network is used to assign and freeze the classification layer of the second face recognition network; Perform mask augmentation on the face dataset without masks; The mask-augmented dataset is input into the assigned and frozen second face recognition network in batches for training; A feature extraction part is selected from the assigned and frozen second face recognition network to serve as the face recognition model for the final application.

2. The face recognition method based on offline class center according to claim 1 is characterized in that: The key features of the face are detected on the captured image data, and the face area is affine transformed to obtain the face image data. The key features of the face include the coordinates of the centers of the eyes, the coordinates of the nose tip, and the coordinates of the left and right corners of the mouth.

3. The face recognition method based on offline class center according to claim 1, characterized in that: The first face recognition network and the second face recognition network both include: Use the backbone network to extract facial features; The classification network is used to classify the facial features extracted by the backbone.

4. The face recognition method based on offline class center according to claim 3 is characterized in that: The backbone network adopts a convolutional neural network or a transformer, and the classification network adopts FC.

5. A face recognition device based on an offline class center, characterized in that: The device comprises an acquisition unit, a detection unit, an input unit, a contrast unit and a comparison unit; The acquisition unit is used to acquire captured image data with a human face; The detection unit is used to detect key facial features of the captured image data and perform affine transformation on the facial region to obtain facial image data; The input unit is used to input the obtained face image data into a pre-trained face recognition model to obtain features of the face image; The comparison unit is used to compare the obtained face image with the face image stored in the face feature library to obtain a similarity score; The comparison unit is used to compare the obtained similarity score with a set threshold value to obtain the ID of the captured image data; It also includes an acquisition module, a first training module, an assignment freezing module, a mask augmentation module, a second training module and a selection module; The acquisition module is used to acquire a dataset of faces without masks and initialize a first face recognition network; The first training module is used to send the face data set without masks to the initialized first face recognition network in batches for training, so as to obtain the classification layer FC of the first face recognition network; The assignment and freezing module is used to assign and freeze the classification layer of the second face recognition network using the classification layer FC obtained from the first face recognition network; The mask augmentation module is used to perform mask augmentation on a face dataset of people who are not wearing masks; The second training module is used to input the mask-augmented dataset in batches into the assigned and frozen second face recognition network for training; The selection module is used to select the feature extraction part from the second face recognition network that has been assigned and frozen, so as to serve as the face recognition model for final application.

6. The face recognition device based on offline class center according to claim 5, characterized in that: It also includes an extraction module and a classification module; The extraction module is used to extract the features of the face using the backbone network; The classification module is used to classify the facial features extracted by the backbone using the classification network.

7. A computer device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the face recognition method based on offline class center as described in any one of claims 1 to 4 are implemented.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the face recognition method based on offline class centers as described in any one of claims 1 to 4.