Face recognition model training method, face recognition method, device and apparatus
Patent Information
- Application Number
- CN202211225387.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-09
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2042-10-09
AI Technical Summary
[0004]但由于两个权重为超参数,其最优解随着数据分布的变换而变化,在进行模型训练时无法保证稳定提升模型识别的准确性
[0024] According to another aspect of the present disclosure, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the training method for the face recognition model or the face recognition method provided in the above-described optional implementation.
Smart Images

Figure CN117011905B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a training method for a face recognition model, a face recognition method, a device, and an apparatus. Background Technology
[0002] Because masks cover the face, facial recognition systems experience a significant decrease in accuracy when recognizing faces that are obscured.
[0003] To enable the face recognition model to simultaneously recognize both masked and unmasked faces, a multi-task approach was employed for training. Different loss functions were used to calculate the loss for masked and unmasked images, with different weights for each loss. The model parameters were then adjusted based on these two losses.
[0004] However, since the two weights are hyperparameters, their optimal solutions change with the data distribution, making it impossible to guarantee a stable improvement in the model's recognition accuracy during model training. Summary of the Invention
[0005] This application provides a method for training a face recognition model, a face recognition method, an apparatus, and a device, which can improve the accuracy of face recognition when the face is wearing a mask. The technical solution is as follows.
[0006] According to one aspect of this application, a method for training a face recognition model is provided, the method comprising:
[0007] A first face recognition model is obtained by training a face sample set, wherein the face sample set includes face images corresponding to at least one face identifier, and the first face recognition model includes a first set of class centers, wherein the first set of class centers includes a class center corresponding to each face identifier among the at least one face identifier.
[0008] A hybrid face recognition model is trained based on the face sample set and the occluded face sample set. The occluded face sample set includes occluded face images corresponding to the at least one face identifier. The hybrid face recognition model includes a second set of class centers. The second set of class centers includes a class center corresponding to each face identifier in the at least one face identifier. In the second set of class centers, occluded face images and face images corresponding to the same face identifier correspond to the same class center.
[0009] The parameters of the face class centers in the second face recognition model are initialized based on the first set of class centers, and the parameters of the hybrid class centers in the second face recognition model are initialized based on the second set of class centers.
[0010] The second face recognition model is trained and initialized based on the face sample set. The second face recognition model includes the face class center and the hybrid class center.
[0011] According to one aspect of this application, a face recognition method is provided, the method comprising:
[0012] The fifth face recognition model is called to perform face recognition on the input image, and the fifth face recognition result is obtained;
[0013] The first network structure of the fifth face recognition model is the same as the second network structure of the second face recognition model, and the second face model is trained using the face recognition model training method described above.
[0014] According to another aspect of this application, a training apparatus for a face recognition model is provided, the apparatus comprising:
[0015] A first face recognition module is used to train a first face recognition model based on a face sample set, wherein the face sample set includes face images corresponding to at least one face identifier, and the first face recognition model includes a first set of class centers, wherein the first set of class centers includes a class center corresponding to each face identifier among the at least one face identifier.
[0016] A hybrid face recognition module is used to train a hybrid face recognition model based on the face sample set and the occluded face sample set. The occluded face sample set includes occluded face images corresponding to the at least one face identifier. The hybrid face recognition model includes a second set of class centers. The second set of class centers includes a class center corresponding to each face identifier in the at least one face identifier. In the second set of class centers, occluded face images and face images corresponding to the same face identifier correspond to the same class center.
[0017] An initialization module is used to initialize the parameters of the face class centers in the second face recognition model based on the first set of class centers, and to initialize the parameters of the hybrid class centers in the second face recognition model based on the second set of class centers.
[0018] The second face recognition module is used to train the initialized second face recognition model based on the face sample set. The second face recognition model includes the face class center and the hybrid class center.
[0019] According to another aspect of this application, a face recognition device is provided, the device comprising:
[0020] The recognition module is used to call the fifth face recognition model to perform face recognition on the input image and obtain the fifth face recognition result;
[0021] The first network structure of the fifth face recognition model is the same as the second network structure of the second face recognition model, and the second face model is trained using the face recognition model training method described above.
[0022] According to another aspect of this application, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the training method of the face recognition model or the face recognition method as described above.
[0023] According to another aspect of this application, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the training method of the face recognition model or the face recognition method as described above.
[0024] According to another aspect of the present disclosure, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the training method for the face recognition model or the face recognition method provided in the above-described optional implementation.
[0025] The beneficial effects of the technical solutions provided in this application include at least the following:
[0026] The class centers of the face recognition model are initialized using two sets of class centers from two pre-trained models. The first set of class centers is trained using unoccluded normal face images, accurately recognizing features from such images. The second set of class centers is trained using both unoccluded and occluded face images, accurately recognizing features from both. This results in class centers capable of recognizing both full-face, global features and partial local facial features. This allows the face recognition model to be trained to accurately extract facial features from both normal and occluded face images, improving its recognition accuracy. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a block diagram of a computer device provided in an exemplary embodiment of this application;
[0029] Figure 2 This is a flowchart of a method for training a face recognition model provided in another exemplary embodiment of this application;
[0030] Figure 3 This is a schematic diagram of the training model of a face recognition model provided in another exemplary embodiment of this application;
[0031] Figure 4 This is a flowchart of a method for training a face recognition model provided in another exemplary embodiment of this application;
[0032] Figure 5 This is a schematic diagram of a training method for a face recognition model provided in another exemplary embodiment of this application;
[0033] Figure 6 This is a schematic diagram of a training method for a face recognition model provided in another exemplary embodiment of this application;
[0034] Figure 7 This is a flowchart of a face recognition method provided in another exemplary embodiment of this application;
[0035] Figure 8 This is a schematic diagram of a face recognition method provided in another exemplary embodiment of this application;
[0036] Figure 9 This is a schematic diagram of a face recognition method provided in another exemplary embodiment of this application;
[0037] Figure 10 This is a schematic diagram of a training method for a face recognition model provided in another exemplary embodiment of this application;
[0038] Figure 11 This is a schematic diagram of a training method for a face recognition model provided in another exemplary embodiment of this application;
[0039] Figure 12 This is a schematic diagram of a training method for a face recognition model provided in another exemplary embodiment of this application;
[0040] Figure 13This is a block diagram of a training apparatus for a face recognition model provided in another exemplary embodiment of this application;
[0041] Figure 14 This is a block diagram of a face recognition device provided in another exemplary embodiment of this application;
[0042] Figure 15 This is a schematic diagram of the server structure provided in another exemplary embodiment of this application;
[0043] Figure 16 This is a block diagram of a terminal provided in another exemplary embodiment of this application. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0045] It should be noted that this application may display prompt interfaces, pop-ups, or output voice prompts before and during the collection of user data. These prompt interfaces, pop-ups, or voice prompts are used to inform the user that their data is being collected. This ensures that the application only begins the steps for collecting user data after receiving confirmation from the user regarding the prompt interface or pop-up; otherwise (i.e., without user confirmation), the steps for collecting user data end, meaning no user data is collected. In other words, all user data collected in this application is collected with the user's consent and authorization, and the collection, use, and processing of related user data must comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0046] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0047] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0048] Computer vision (CV) is a science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes in recognizing, detecting, and measuring targets, and then performs image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, OCR (Optical Character Recognition), video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0049] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.
[0050] Figure 1 A schematic diagram of a computer device 101 provided in an exemplary embodiment of this application is shown. The computer device 101 may be a terminal or a server.
[0051] The terminal may include at least one of a digital camera, smartphone, laptop, desktop computer, tablet computer, smart speaker, and smart robot. In one optional implementation, the training method for the facial recognition model provided in this application can be used to train a facial recognition model that can be applied to applications with facial recognition functionality. These applications may include: payment applications, identity authentication applications, shopping applications, social applications, lifestyle service applications, live streaming applications, forum applications, information applications, office applications, etc. Optionally, a client application for this application is installed on the terminal.
[0052] For example, the terminal stores a facial recognition model. When the client needs to use the facial recognition function, the client can call the facial recognition model to complete the facial recognition. For example, the training process of the facial recognition model can be completed by the terminal or by the server.
[0053] The terminal and the server are connected to each other via wired or wireless network.
[0054] The terminal includes a first memory and a first processor. The first memory stores a training model of the face recognition model; the face recognition model is invoked and executed by the first processor to implement the face recognition model training method provided in this application. The first memory may include, but is not limited to, the following: Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM).
[0055] The first processor can consist of one or more integrated circuit chips. Optionally, the first processor can be a general-purpose processor, such as a central processing unit (CPU) or a network processor (NP). Optionally, the first processor can implement the training method of the face recognition model provided in this application by running programs or code.
[0056] The server includes a second memory and a second processor. The second memory stores a training model of the face recognition model; the face recognition model is invoked by the second processor to implement the face recognition model training method provided in this application. Optionally, the second memory may include, but is not limited to, the following: RAM, ROM, PROM, EPROM, and EEPROM. Optionally, the second processor may be a general-purpose processor, such as a CPU or NP.
[0057] Figure 2 A flowchart illustrating a training method for a face recognition model provided in an exemplary embodiment of this application is shown. This method can be performed by a computer device, such as... Figure 1 The method is executed using the terminal or server shown. The method includes the following steps.
[0058] Step 210: A first face recognition model is trained based on a face sample set. The face sample set includes face images corresponding to at least one face identifier. The first face recognition model includes a first set of class centers, which includes a class center corresponding to each face identifier in at least one face identifier.
[0059] The face sample set includes at least one face image. Each face image corresponds to a face identifier, which identifies that it comes from the same face. Each face identifier in the face sample set corresponds to at least one face image. For example, if the face sample set includes 100 face identifiers, and each face identifier corresponds to 10 face images, then the face sample set includes 1000 face images.
[0060] A face image refers to an image containing a face, which can be the face of a person, animal, virtual character, etc. Optionally, the face image is an image cropped from the original image based on the facial contours. For example, after using a face region recognition model to identify the face in an image, the portion selected by the resulting face bounding box is extracted as the face image used in this embodiment. In this way, the model can be trained to accurately extract facial features to the maximum extent, ignoring the background or other parts. Of course, the original image can also be used directly as the face image used in this embodiment without cropping the original image.
[0061] Optionally, in the facial image used in this application embodiment, the proportion of the face portion is greater than a threshold. For example, the proportion of face pixels is higher than 90%. Optionally, the facial image can be a regular rectangular image or an irregular image with irregular edges (e.g., an image cropped according to the facial contour). Optionally, the face in this application embodiment may or may not include hair.
[0062] Optionally, the face in the face image is unobstructed. An unobstructed face means that the proportion of the face that is obscured is less than a threshold. Obstruction can be determined by hair covering the face, or in some embodiments, hair covering the face is not considered obstruction. In some embodiments, an unobstructed face may also mean that the face image contains facial features. For example, an image containing facial features is an unobstructed face image, while an image lacking any facial feature is an obstructed face image.
[0063] The first face recognition model is used to output which face identifier the face image belongs to based on the input face image. The output information can be the predicted face identifier or the predicted probability value of the face image belonging to each face identifier.
[0064] Optionally, the network structure of the first face recognition model can be arbitrary, but it must include a first set of class centers. The first set of class centers is a model parameter within a network structure of the first face recognition model. The first set of class centers is d*m dimensional data / matrix, where d is the feature dimension and m is the total number of face identifiers in the face sample set (i.e., the total number of face categories). For example, if there are 100 face identifiers in the face sample set, then the first set of class centers is d*100 dimensional data, and d can be set according to requirements.
[0065] The first set of class centers is used to perform matrix operations with the input data, such as matrix multiplication. For example, when the first face recognition model includes a sequentially connected feature extraction layer and the first set of class centers, the first set of class centers is used to perform matrix multiplication with the facial features output by the feature extraction layer to obtain the probability values of the input image belonging to each face identifier (face category).
[0066] The first group of class centers contains one class center for each face identifier. The number of class centers in the first group is the same as the number of face identifiers in the face sample set, and they correspond one-to-one. When the face sample set contains 100 face identifiers, the first group of class centers contains 100 class centers, each corresponding to one of the 100 face identifiers.
[0067] A class center can represent the cluster center of a face image for a face identifier. When the facial features of a face image are close to a certain class center, it means that the face image is more likely to belong to the face identifier corresponding to that class center. Therefore, the class center can be used to identify the face identifier to which the face image belongs.
[0068] During the training of the first face recognition model, the model parameters are continuously adjusted, including the parameter data of the first set of class centers. During the training process, the parameter data of each class center in the first set of class centers is continuously adjusted according to the input face image (this parameter data is the d-dimensional feature mentioned above).
[0069] Once the first face recognition model is trained, a first set of class centers can be obtained that can be used to accurately distinguish the facial features of different face identifiers.
[0070] Step 220: A hybrid face recognition model is trained based on the face sample set and the occluded face sample set. The occluded face sample set includes at least one occluded face image corresponding to a face identifier. The hybrid face recognition model includes a second set of class centers. The second set of class centers includes a class center corresponding to each face identifier in at least one face identifier. In the second set of class centers, the occluded face image and the face image corresponding to the same face identifier correspond to the same class center.
[0071] The face sample sets used in steps 210, 220, and 240 are all the same set.
[0072] The occluded face sample set is a collection of occluded face images corresponding to face identifiers in the face sample set. Optionally, the number of face identifiers in the occluded face sample set is equal to and corresponds one-to-one with the number of face identifiers in the face sample set. For example, if the face sample set contains face images with 100 face identifiers, then the occluded face sample set contains the occluded face images corresponding to these 100 face identifiers. Optionally, each face identifier in the occluded face sample set corresponds to at least one occluded face image.
[0073] An occluded face image refers to an image containing a face, which can be the face of a person, animal, virtual character, etc. Optionally, the occluded face image is an image cropped from the original image based on the facial contours. For example, after using a face region recognition model to identify faces in an image, the portion selected by the resulting face bounding box is extracted as the occluded face image used in this embodiment. This maximizes the accuracy of the model's facial feature extraction during training, ignoring the background or other parts. Alternatively, the original image can be used directly without cropping, using the original image containing the face as the occluded face image used in this embodiment.
[0074] When the occluded face image is an image that is occluded / cropped from the original image, the occluded face image may or may not include the occluded part of the face. For example, when the occlusion is a mask or sunglasses, the occluded face image may include the mask (with the complete facial outline) or may not include the mask (only the face not covered by the mask).
[0075] Optionally, in the occluded face image used in this embodiment, the proportion of the face portion is greater than a threshold. For example, the proportion of face pixels is higher than 30%. Optionally, the face image can be a regular rectangular image or an irregular image with irregular edges (e.g., an image cropped according to the facial contour). Optionally, the face in this embodiment may or may not include hair.
[0076] Optionally, the face in the occluded face image is occluded. An occluded face refers to a face whose occluded area exceeds a threshold. Occlusion can be defined as hair obscuring the face, or vice versa. An occluded face can also refer to an image that does not contain all facial features. For example, an image that only includes part of the facial features is considered an occluded face image.
[0077] In one alternative embodiment, an image that does not contain facial features is not a face image / an image with an obscured face; an image containing some facial features is an image with an obscured face; and an image containing all facial features is a face image.
[0078] Optionally, to improve the accuracy of model training, the occluded facial portions in the occluded face images are identical; for example, all faces in the occluded face images have their mouths or eyes covered. Optionally, the occluded face images can be images of people wearing masks or sunglasses.
[0079] Hybrid face recognition models are used to output which face identifier an image belongs to based on an input face image / occluded face image. The output information can be the predicted face identifier or the predicted probability value of the image belonging to each face identifier.
[0080] Optionally, the network structure of the hybrid face recognition model can be arbitrary, but it must include a second set of class centers. The second set of class centers consists of model parameters within one of the network structures of the hybrid face recognition model. This second set of class centers is a d*m dimensional data / matrix, where d is the feature dimension and m is the total number of face identifiers (i.e., the total number of face categories). For example, if the face sample set / occluded face sample set contains 100 face identifiers, then the second set of class centers is d*100 dimensional data, and d can be set according to requirements.
[0081] The second set of class centers is used to perform matrix operations with the input data, such as matrix multiplication. For example, when a hybrid face recognition model includes a sequentially connected feature extraction layer and a second set of class centers, the second set of class centers is used to perform matrix multiplication with the facial features output by the feature extraction layer to obtain the probability values of the input image belonging to each face identifier (face category).
[0082] The second set of class centers contains one class center for each face identifier. The number of class centers in the second set is the same as the number of face identifiers in the face sample set / occluded face sample set, and they correspond one-to-one. When the face sample set / occluded face sample set contains 100 face identifiers, the second set of class centers contains 100 class centers, each corresponding to one of the 100 face identifiers.
[0083] A class center can represent the cluster center of a face image and an occluded face image. When the facial features of a face image / occluded face image are close to a certain class center, it means that the image is more likely to belong to the face image corresponding to that class center. Therefore, the class center can be used to identify the face image / occluded face image to which it belongs.
[0084] It should be noted that in the second set of class centers, face images and occluded face images belonging to the same face identifier correspond to the same class center. Due to the inclusion of occluded face images, the second set of class centers will deviate from the first set. The first set of class centers can accurately identify facial features in face images, while the second set can identify facial features in both face images and occluded face images. That is, the first set of class centers focuses on full-face features; the second set of class centers focuses on common features between face images and occluded face images. Optionally, the second set of class centers may focus more on local features of the unoccluded parts of the face.
[0085] During the training of the hybrid face recognition model, the model parameters are continuously adjusted, including the parameter data of the second set of class centers. During the training process, the parameter data of each class center in the second set of class centers is continuously adjusted based on the input face image and the occluded face image (this parameter data is the d-dimensional feature mentioned above).
[0086] Once the hybrid face recognition model is trained, a second set of class centers can be obtained, which can be used to accurately distinguish facial features of different face identifiers.
[0087] Step 230: Initialize the parameters of the face class centers in the second face recognition model according to the first group of class centers, and initialize the parameters of the hybrid class centers in the second face recognition model according to the second group of class centers.
[0088] The second face recognition model includes face class centers and hybrid class centers. Other network structures in the second face recognition model can be arbitrary.
[0089] The model parameters of the face class center are initialized using the first set of class centers trained in step 210, and the model parameters of the hybrid class center are initialized using the second set of class centers trained in step 220.
[0090] The initialized second face recognition model's face class centers and hybrid class centers then possess the ability to recognize facial features in both face images and occluded face images. Building upon this, further training the model parameters of the second face recognition model using a face sample set allows for more accurate feature extraction from face images, while maintaining its ability to extract features from occluded face images.
[0091] Optional, such as Figure 3 As shown, the second face recognition model includes a common feature extraction layer 301, a face feature extraction layer 302 connected to the common feature extraction layer 301, a hybrid feature extraction layer 303 connected to the common feature extraction layer 301, a face class center 304 connected to the face feature extraction layer 302, and a hybrid class center 305 connected to the hybrid feature extraction layer 303.
[0092] Since the initial parameters of the hybrid class centers use the model parameters of the second set of class centers, and the second set of class centers focuses on the common features of face images and occluded face images, the trained hybrid feature extraction layer also focuses on extracting the common features of face images and occluded face images. That is, the hybrid feature extraction layer focuses on extracting the common features of the two types of images (regardless of whether the input is a face image or an occluded face image, the model can use these shared features to identify its face identifier); while the face feature extraction layer focuses on extracting the specific features of face images (the face feature extraction layer extracts features from the entire face, and its feature extraction accuracy / recognition accuracy for face images is higher, but it cannot extract effective features from occluded face images for face recognition).
[0093] Step 240: Train the initialized second face recognition model based on the face sample set. The second face recognition model includes face class centers and hybrid class centers.
[0094] After initializing the face class centers and hybrid class centers of the second face recognition model, the second face recognition model is trained using face images from the face sample set, so that the second face recognition model outputs the corresponding face identifier based on the input face image.
[0095] Optionally, the second face recognition model includes a feature extraction layer. The face features extracted by the feature extraction layer after training include full-face features and local face features of occluded faces. The face features extracted by the feature extraction layer can be applied to both full-face face recognition and occluded face recognition, ensuring the accuracy of the recognition.
[0096] Optional, such as Figure 3 As shown, the feature extraction layer of the second face recognition model includes a shared feature extraction layer, a face feature extraction layer, and a hybrid feature extraction layer.
[0097] In summary, the method provided in this embodiment initializes the class centers of the face recognition model by using two sets of class centers from two pre-trained models. The first set of class centers is trained using unoccluded normal face images, accurately recognizing features of unoccluded normal face images. The second set of class centers is trained using both unoccluded and occluded face images, accurately recognizing features of both. This results in class centers capable of recognizing both full-face global features and partial local facial features, enabling the face recognition model to be trained to accurately extract facial features from both normal and occluded face images, thus improving the recognition accuracy of the face recognition model.
[0098] For example, this application provides a network structure for a second face recognition model and a training method thereof.
[0099] Figure 4 A flowchart illustrating a training method for a face recognition model provided in an exemplary embodiment of this application is shown. This method can be performed by a computer device, such as... Figure 1 The method is executed using the terminal or server shown. The method includes the following steps.
[0100] Step 210: A first face recognition model is trained based on a face sample set. The face sample set includes face images corresponding to at least one face identifier. The first face recognition model includes a first set of class centers, which includes a class center corresponding to each face identifier in at least one face identifier.
[0101] Optional, such as Figure 5 As shown, the first face recognition model includes a first feature extraction layer 306 and a first set of class centers 307. The computer device calls the first feature extraction layer to extract features from face images in the face sample set to obtain fourth face features; calls the first set of class centers to perform matrix operations on the fourth face features to obtain a third face recognition result; and trains the first feature extraction layer and the first set of class centers based on the loss between the third face recognition result and the face identifiers in the face images.
[0102] The fourth facial feature is obtained by the first feature extraction layer from the input facial image. The training objective of the first feature extraction layer is to extract global / whole-face features from the facial image (unoccluded full-face image) to facilitate facial image recognition based on the extracted features. Therefore, the fourth facial feature is the global / whole-face feature of the facial image. This fourth facial feature should be close to the class center of the facial identifier corresponding to the facial image in the first set of class centers.
[0103] Step 220: A hybrid face recognition model is trained based on the face sample set and the occluded face sample set. The occluded face sample set includes at least one occluded face image corresponding to a face identifier. The hybrid face recognition model includes a second set of class centers, which includes a class center corresponding to each face identifier in at least one face identifier.
[0104] Optional, such as Figure 6As shown, the hybrid face recognition model includes a second feature extraction layer 308 and a second set of class centers 309. The computer device calls the second feature extraction layer to extract features from face images in the face sample set or occluded face images in the occluded face sample set, obtaining a fifth face feature; it then calls the second set of class centers to perform matrix operations on the fifth face feature, obtaining a fourth face recognition result; based on the loss between the fourth face recognition result and the face identifier, the second feature extraction layer and the second set of class centers are trained, with the face identifier being the face identifier of the face image or the occluded face image.
[0105] The fifth facial feature is the facial feature extracted by the second feature extraction layer from the facial image or occluded facial image. The training objective of the second feature extraction layer is to simultaneously extract features from both the facial image and the occluded facial image, and to recognize both based on the extracted features. That is, the second feature extraction layer is used to extract common features from the facial image and the occluded facial image. For example, if the occluded facial image occludes the mouth, the second feature extraction layer should focus more on features of the facial contour, eyes, nose, etc. This ensures accurate facial recognition regardless of whether the input is a facial image or an occluded facial image, using the second feature extraction layer and the second set of class centers. Therefore, the fifth facial feature is a local feature / non-whole-face feature of the facial image / occluded facial image. This fifth facial feature should be close to the class center of the facial identifier corresponding to the facial image / occluded facial image in the second set of class centers.
[0106] It is important to understand that since the output data of a neural network model does not have any practical meaning, we assign practical meaning to each of the output data here only for ease of understanding, but this interpretation should not constitute a limitation on each of the output data.
[0107] In other words, the training samples for the hybrid face recognition model are a combination of the existing face sample set and the occluded face sample set. Each face image corresponds to a face identifier, and each occluded face image corresponds to a face identifier. The two types of images do not distinguish between different training tasks; both use the same loss function to calculate the loss, and there are no hyperparameters such as loss function weights.
[0108] Step 230: Initialize the parameters of the face class centers in the second face recognition model according to the first group of class centers, and initialize the parameters of the hybrid class centers in the second face recognition model according to the second group of class centers.
[0109] Optionally, the second face recognition model includes a common structure and face branch structures and hybrid branch structures connected to the common structure, respectively. The face branch structures include face class centers, and the hybrid branch structures include hybrid class centers.
[0110] Step 241: Train the model parameters of the common structure and the face branch structure based on the face sample set.
[0111] Optionally, the shared structure includes a shared feature extraction layer, and the face branch structure further includes a face feature extraction layer. The computer device calls the shared feature extraction layer to extract features from face images in the face sample set, obtaining first face features; it calls the face feature extraction layer to extract features from the first face features, obtaining second face features; it calls the face class center to perform matrix operations on the second face features, obtaining a first face recognition result; and it trains the shared feature extraction layer, the face feature extraction layer, and the face class center based on the loss between the first face recognition result and the face identifier of the face image. The face identifier of the face image is the true label corresponding to that face image.
[0112] The first facial feature is the shallow feature of the input image (face image), such as facial contours, the position of facial features, etc., which are obtained through simple feature extraction.
[0113] The second facial feature is a deep feature of the input image (face image). Optionally, since the features extracted by the facial feature extraction layer should be close to the face class center, and the face class center is trained with the global features of the face image (fourth facial feature), the features extracted by the facial feature extraction layer should be close to the global features of the face image. That is, the facial feature extraction layer is used to further extract deeper features of the face image based on the first facial feature, and the second facial feature is the deeper feature extracted by it.
[0114] That is, with the model parameters of the mixed feature extraction layer and the mixed class center fixed, the model parameters of the shared feature extraction layer, the face feature extraction layer, and the face class center are trained first.
[0115] Step 242: Train the model parameters of the hybrid branch structure based on the face sample set.
[0116] Optionally, the shared structure includes a shared feature extraction layer, and the hybrid branch structure further includes a hybrid feature extraction layer. The computer device uses the shared feature extraction layer to extract features from facial images in the facial sample set, obtaining first facial features; it then uses the hybrid feature extraction layer to extract features from the first facial features, obtaining third facial features; finally, it uses hybrid class centers to perform matrix operations on the third facial features, obtaining a second facial recognition result; and finally, it trains the hybrid feature extraction layer and hybrid class centers based on the loss between the second facial recognition result and the facial identifiers of the facial images. The facial identifiers of the facial images are the corresponding ground truth labels for those facial images.
[0117] The third facial feature is a deep feature of the input image (face image). Optionally, since the features extracted by the occluded facial feature extraction layer should be close to the mixture class center, and the mixture class center is trained with local features (the fifth facial feature), the features extracted by the mixture feature extraction layer should be close to the local features of the face image. The range of this local area should be close to the undisturbed area in the occluded face image. For example, if the occluded face image does not obscure the eyes and nose, then the mixture feature extraction layer should focus more on the local features of the eyes and nose. That is, the mixture feature extraction layer is used to further extract deeper local features of the face image based on the first facial feature, and the third facial feature is the deeper feature extracted by it.
[0118] That is, the model parameters of the fixed shared feature extraction layer, face feature extraction layer, and face class center remain unchanged, while the model parameters of the hybrid feature extraction layer and hybrid class center are trained.
[0119] Optionally, the model structure of the second face recognition model can be determined using a network search method. For example, a network search method can be used to determine information related to the network structure, such as the number of layers in the shared feature extraction layer, the face feature extraction layer, and the hybrid feature extraction layer, the network type of each layer, the network structure of each layer, and the dimensions of the parameters in the network structure.
[0120] Optionally, the shared feature extraction layer / facial feature extraction layer / hybrid feature extraction layer may include at least one of the following: convolutional layer, activation function, pooling layer, and normalization layer.
[0121] Optionally, the first face recognition model and the hybrid face recognition model are large-scale neural network models. The feature extraction layers (first feature extraction layer and second feature extraction layer) of the first face recognition model and the hybrid face recognition model have more complex structures. For example, the number of layers in the first feature extraction layer / second feature extraction layer is greater than a first threshold, or the number of convolutional kernels in the convolutional layers of the first feature extraction layer / second feature extraction layer is greater than a second threshold. Through a more complex feature extraction network structure, it can be ensured that the class centers obtained by the first face recognition model and the hybrid face recognition model are more accurate.
[0122] Optionally, the second face recognition model is a small neural network model. The feature extraction layers (shared feature extraction layer, face feature extraction layer, and hybrid feature extraction layer) of the second face recognition model have a simpler structure compared to the first / second feature extraction layers. For example, the number of layers in the shared feature extraction layer / face feature extraction layer / hybrid feature extraction layer is less than a first threshold, or the number of convolutional kernels in the convolutional layers of the shared feature extraction layer / face feature extraction layer / hybrid feature extraction layer is less than a second threshold. The class centers from the two large neural network models are used for model transfer (parameter initialization) of the class centers of this small neural network model. This allows the small neural network model to accurately extract effective features from face images / occluded face images based on the two pre-trained sets of class center parameters through a simple feature extraction structure. This reduces the computational load of the feature extraction layer while ensuring the accuracy of the extracted features, thereby improving the accuracy of face recognition based on these features.
[0123] In summary, the method provided in this embodiment initializes the class centers of the face recognition model by using two sets of class centers from two pre-trained models. The first set of class centers is trained using unoccluded normal face images, accurately recognizing features of unoccluded normal face images. The second set of class centers is trained using both unoccluded and occluded face images, accurately recognizing features of both. This results in class centers capable of recognizing both full-face global features and partial local face features. Consequently, the face recognition model can be trained to accurately extract facial features from both normal and occluded face images. In other words, the facial features extracted by the shared feature extraction layer, the face feature extraction layer, and the hybrid feature extraction layer can be used simultaneously to recognize both face and occluded face images, improving the recognition accuracy of the face recognition model.
[0124] For example, this application also provides a face recognition method.
[0125] Figure 7 A flowchart illustrating a face recognition method provided in an exemplary embodiment of this application is shown. This method can be executed by a computer device, such as... Figure 1 The method is executed using the terminal or server shown. The method includes the following steps.
[0126] Step 501: Call the fifth face recognition model to perform face recognition on the input image and obtain the fifth face recognition result.
[0127] The first network structure of the fifth face recognition model is the same as the second network structure of the second face recognition model. The second face model is trained using the training method of any of the above face recognition models.
[0128] Optionally, both the first and second network structures are feature extraction layers. The first and second network structures include a shared feature extraction layer, a face feature extraction layer, and a hybrid feature extraction layer; wherein the shared feature extraction layer is connected to the face feature extraction layer, and the shared feature extraction layer is connected to the hybrid feature extraction layer. The features output from the face feature extraction layer and the hybrid feature extraction layer are merged and input into the third network structure of the fifth face recognition model.
[0129] That is, the computer device calls the common feature extraction layer to extract features from the fifth face recognition model to obtain common face features; calls the face feature extraction layer to extract features from the common face features to obtain face branch features; calls the hybrid feature extraction layer to extract features from the common face features to obtain hybrid branch features; merges the face branch features and hybrid branch features into total features; calls the third network structure of the fifth face recognition model to perform face recognition on the total features to obtain the fifth face recognition result.
[0130] Optionally, the feature extraction layer of the second face recognition model trained by the above method can be applied to the training of other face recognition models; or, it can directly provide face features for other face recognition models so that other face recognition models can output face recognition results.
[0131] The second face recognition model includes a common feature extraction layer, a face feature extraction layer connected to the common feature extraction layer, a hybrid feature extraction layer connected to the common feature extraction layer, a face class center connected to the face feature extraction layer, and a hybrid class center connected to the hybrid feature extraction layer.
[0132] 1. Used for training other face recognition models.
[0133] For example, such as Figure 8 As shown, the third face recognition model (also known as the "fifth face recognition model") includes a feature extraction layer and other network structures (also known as the "third network structure") 310.
[0134] The computer device can initialize the feature extraction layer of the third face recognition model based on the shared feature extraction layer, the face feature extraction layer, and the hybrid feature extraction layer; and train the initialized third face recognition model based on the face image set.
[0135] The training methods for the third face recognition model can be as follows:
[0136] (1) The model parameters of the feature extraction layer and other network structures are trained simultaneously.
[0137] The set of face images used to train the third face recognition model can be the same as or different from the face sample set. The set of face images includes face images corresponding to face icons and occluded face images.
[0138] Images from a set of face images are used as input to a feature extraction layer (common feature extraction layer, face feature extraction layer, and hybrid feature extraction layer), resulting in face feature 1 (the face feature output by the face feature extraction layer) and face feature 2 (the face feature output by the hybrid feature extraction layer). Face feature 1 and face feature 2 are integrated to obtain face feature 3, which is then input to other network structures to provide the final face recognition result. The model parameters of the feature extraction layer and other network structures are trained based on the loss between the face recognition result and the face identifiers in the input images.
[0139] The method of integrating facial feature 1 and facial feature 2 to obtain facial feature 3 can be at least one of the following: adding facial feature 1 and facial feature 2, splicing facial feature 1 and facial feature 2, stacking facial feature 1 and facial feature 2, or multiplying facial feature 1 and facial feature 2.
[0140] (2) Fix the model parameters of the feature extraction layer and train the model parameters of other network structures.
[0141] The feature extraction layer parameters of the third face recognition model are kept constant, and the third face recognition model is trained based on a set of face images.
[0142] Images from the face image set are used as input to the feature extraction layers (common feature extraction layer, face feature extraction layer, and hybrid feature extraction layer), resulting in face feature 1 (the face feature output by the face feature extraction layer) and face feature 2 (the face feature output by the hybrid feature extraction layer). Face feature 1 and face feature 2 are integrated to obtain face feature 3, which is then input to other network structures to provide the final face recognition results. The model parameters of the other network structures are trained based on the loss between the face recognition results and the face identifiers in the input images.
[0143] 2. Provide facial features for other face recognition models.
[0144] For example, such as Figure 9 As shown, the computer device calls the common feature extraction layer 301 to extract features from the input image to obtain common features; calls the face feature extraction layer 302 to extract features from the common features to obtain face features; calls the hybrid feature extraction layer 303 to extract features from the common features to obtain occlusion features; integrates the face features and occlusion features to obtain merged features; inputs the merged features into the fourth face recognition model 311 to obtain the face recognition result.
[0145] That is, the shared feature extraction layer, the face feature extraction layer, and the hybrid feature extraction layer can be packaged into a feature extraction program. Other programs can call this feature extraction program to extract features from the input image and output the merged features. Other programs can then use the merged features to perform face recognition.
[0146] The model consisting of a shared feature extraction layer, a facial feature extraction layer, a hybrid feature extraction layer, and a fourth face recognition model can be called the fifth face recognition model. The fourth face recognition model can be considered the third network structure of the fifth face recognition model.
[0147] In summary, the method provided in this embodiment trains a common feature extraction layer, a facial feature extraction layer, and a hybrid feature extraction layer using the training method of the face recognition model provided in this application embodiment. These feature extraction layers can accurately extract facial features from the input image. These facial features can be used to identify facial images with unobstructed faces as well as occluded facial images with obstructed faces, ensuring the accuracy of the face recognition results.
[0148] With the outbreak of the pandemic, wearing masks has become an essential part of daily life. Due to the obstruction of the face by masks, the accuracy of facial recognition models in recognizing masked faces has significantly decreased. Ordinary facial recognition models compare unobstructed, high-quality faces, thus failing to adapt properly to the comparison pattern between masked and normal faces. The fundamental reason is the inconsistency in the distribution of masked and normal face images, leading to misalignment in the feature space. To ensure the model meets runtime requirements in different application scenarios, the computational load of the facial recognition model must be controlled within a certain timeframe. This application's embodiment adjusts the structure of the facial recognition model by introducing a normal face branch and a masked face branch, training these two branches separately. This allows the model to adapt to both masked and normal face comparison patterns. Introducing different branches into the deep network of the same model allows for feature sharing in the shallow network. Therefore, the dual-branch model structure does not significantly increase runtime, meeting the deployment requirements of the recognition model. During the training of a face recognition model, the facial features extracted by the model cannot stably support the construction of class centers for face recognition, leading to instability in the class centers. However, accurate construction of class centers is a prerequisite for the feedforward network to converge to the optimal solution. This embodiment employs class center distillation to utilize the classification capabilities of the large model (the first face recognition model and the hybrid face recognition model) to construct two relatively stable class centers. These two class centers are then transferred to the training task of the small model (the second face recognition model), while ensuring that the class centers do not shift or update during the training of the small model. As training progresses, the features extracted by the small model gradually converge to the area surrounding the class centers constructed by the large model, thus the small model indirectly learns the feature distribution of the large model. Since the data distribution extracted by the large model is more accurate than the data distribution obtained by directly training the small model, the second face recognition model obtained through this embodiment has a higher face recognition accuracy than the face recognition model obtained through direct training. By employing centroid distillation-like techniques to train the two deep branches, the accuracy of normal face recognition is ensured while improving the accuracy of the face recognition model for faces wearing masks.
[0149] The method proposed in this application to improve the accuracy of masked face recognition using deep network branching with class center distillation is based on the original face recognition model. A branch representing masked faces is introduced into the deep structure of the model, and class centers from a large face recognition model are used for transfer distillation on each branch. This method increases the robustness of the face recognition model to masked face recognition with only a small increase in processing time. In this application, the accurate class centers constructed by the large face recognition network are used to distill and train the two branches separately, effectively improving recognition accuracy. In this application, there is no need to adjust the ratio between masked face images and normal face images; only the number of both needs to remain consistent. Furthermore, the large recognition network does not need to be deployed after training. This application only adds a computationally insignificant branch to the existing network, ensuring that the increase in processing time is controllable. The two branches are trained independently during training, without increasing GPU memory or training time. The separation of the mask branch and the normal face branch ensures that the recognition model can match the comparison patterns in masked face recognition.
[0150] This application's embodiments introduce a masked face branch into the deep structure of the normal face recognition model, and perform class center transfer distillation training on both the small model of normal face recognition and the masked face recognition branch. The masked face recognition branch is then used to assist the normal face branch in recognition, thereby improving the accuracy of masked face recognition. Figure 10 As shown, the embodiments of this application are mainly divided into a training phase 401 and a deployment phase 402. First, a large model (first face recognition model) is trained using normal face images. This large model, trained on normal faces, is then used to train a smaller model using class center transfer distillation. Next, another large masked face recognition model (hybrid face recognition model) is trained using masked face data and normal face data. Then, a masked face recognition branch (occlusion branch) is introduced into the normal face recognition network. This branch is trained using class center transfer distillation from the class centers of the large masked face recognition model (second group of class centers). The two branches share the shallow feature extraction layer of the face recognition network, thereby reducing model processing time. In the deployment phase, the masked face recognition branch is merged into the normal face recognition model, and the two are integrated into a single model for feature extraction deployment.
[0151] 1. Model Training
[0152] (1) As Figure 11 As shown in (A), the first face recognition model is trained, and its process and the functions of each module are as follows:
[0153] (a) Training data preparation: During the training process, the face training data (face sample set) is read, and the read data is combined into a batch of data and sent to the first feature extraction layer of the first face recognition model for processing.
[0154] (b) First Feature Extraction Layer: This layer extracts spatial features from the facial image, and the output feature map retains the spatial structure information of the facial image. The first feature extraction layer has a Convolutional Neural Network (CNN) structure, which includes operations such as convolution calculation, ReLU nonlinear activation function calculation, and pooling calculation.
[0155] (c) First group of class centers: This group stores the class centers for each ID (face identifier) in the training data. Its shape is (d*m), where d is the feature dimension and m is the number of ID categories in the training data. A matrix operation is performed between the first group of class centers and the features extracted by the first feature extraction layer to obtain the probability value of each image belonging to each category.
[0156] (d) Loss Calculation: The probability vector of the image belonging to each category obtained by matrix multiplication of the feature f output by the first feature extraction layer with the center of each category, and the label information (face identifier) of the face image that generated the vector are used as inputs to calculate the objective function value (loss). The objective function can be a classification function (such as the softmax function, a softmax function with various margins), or other types of objective functions (loss functions).
[0157] (e) Model Optimization: The first face recognition model (first feature extraction layer and first group of class centers) is trained and optimized using gradient descent methods (such as stochastic gradient descent, stochastic gradient descent with dynamic terms, Adam, Adamard). Steps (a) to (d) are repeated during training until the training results meet the training termination condition. The termination condition is generally set to the number of iterations meeting a predetermined value, or the loss calculated by the face recognition objective function meeting a predetermined value.
[0158] (2) The process and functions of each module for training the hybrid face recognition model are as follows:
[0159] The process of training a hybrid face recognition model is similar to... Figure 11 (A) is consistent with this. Figure 11 Unlike (A) in this step, the training data in this step is a mixture of masked face data (occluded face sample set) and normal face image data (face sample set) used for training. Its constrained objective function is... Figure 11The objective function is the same as in (A). Using both normal and masked face image data for joint supervision primarily provides the model with basic recognition capabilities for normal face data, preventing overfitting to masked face data. In this training step, a new class center (the second set of class centers) is obtained through re-initialization; the same class center is used for both normal and masked face images.
[0160] (3) The dual-branch face recognition network is trained. The connection relationship of each module in this step is shown in Figure 12. The model shares the features of the shallow network (stage 1, stage 2, stage 3), and the deep network is divided into a mask branch and a normal branch. The training process of this step is as follows: Figure 11 As shown in (B) above, the functions of each module are as follows:
[0161] (a) Training data preparation: and Figure 11 Consistent with (A) in the above, the training data is normal face data (face sample set).
[0162] (b) Feature Extraction Layer: Normal facial data is input into a shared feature extraction layer. The facial features output from the shared feature extraction layer are then input into the facial feature extraction layer and the hybrid feature extraction layer, respectively, to obtain two facial features. Optionally, the network structure of the shared feature extraction layer, the facial feature extraction layer, and the hybrid feature extraction layer is simpler than that of the first feature extraction layer, for example, with fewer layers and fewer parameters.
[0163] (c) Class Centers: Class centers include face class centers (normal class centers) and hybrid class centers (mask class centers). Both class centers have a shape of (d×m), where d is the feature dimension and m is the number of ID categories in the training data. During class center training, the first set of class centers is used to initialize the parameters of the face class centers, and the second set of class centers is used to initialize the parameters of the hybrid class centers. Then, the recognition results output by the face class centers and the ground truth labels are used to update the model parameters of the shared feature extraction layer, the face feature extraction layer, and the face class centers, while the model parameters of the hybrid feature extraction layer and the hybrid class centers are not updated. Then, the recognition results output by the hybrid class centers and the ground truth labels are used to update the model parameters of the hybrid feature extraction layer and the hybrid class centers, while the model parameters of the shared feature extraction layer, the face feature extraction layer, and the face class centers are not updated.
[0164] (d) Loss Calculation: The objective function used in this step is... Figure 11 The objective function of (A) in the equation is consistent with the objective function of (A).
[0165] Repeated training yields a face recognition model with two deep branches: one branch for recognizing faces wearing masks and the other for recognizing normal faces.
[0166] 2. Model Deployment
[0167] The model deployment phase primarily involves deploying the model obtained during the training phase to form a complete solution. In this embodiment, it is necessary to merge the facial features output from the trained facial feature extraction layer and the hybrid feature extraction layer. The feature F output by the normal face branch... N The feature output by the mask branch is F. M Both are normalized features. After integrating the mask branch into the normal face recognition model, the model outputs features F = Fmask. N +F M The integrated recognition model retains its feature dimensions and can be seamlessly integrated into a conventional face recognition system.
[0168] In summary, the method provided in this embodiment can improve the accuracy of the face recognition system and make it adaptable to various complex application scenarios.
[0169] The following are device embodiments of this application. For details not described in detail in the device embodiments, please refer to the corresponding descriptions in the above method embodiments. They will not be repeated here.
[0170] Figure 13 A schematic diagram of a training apparatus for a face recognition model provided in an exemplary embodiment of this application is shown. This apparatus can be implemented as all or part of a computer device through software, hardware, or a combination of both. The apparatus includes:
[0171] The first face recognition module 601 is used to train a first face recognition model based on a face sample set. The face sample set includes face images corresponding to at least one face identifier. The first face recognition model includes a first set of class centers, which includes a class center corresponding to each face identifier among the at least one face identifier.
[0172] The hybrid face recognition module 604 is used to train a hybrid face recognition model based on the face sample set and the occluded face sample set. The occluded face sample set includes occluded face images corresponding to the at least one face identifier. The hybrid face recognition model includes a second set of class centers. The second set of class centers includes a class center corresponding to each face identifier in the at least one face identifier. In the second set of class centers, occluded face images and face images corresponding to the same face identifier correspond to the same class center.
[0173] The initialization module 605 is used to initialize the parameters of the face class centers in the second face recognition model according to the first group of class centers, and to initialize the parameters of the hybrid class centers in the second face recognition model according to the second group of class centers;
[0174] The second face recognition module 606 is used to train the initialized second face recognition model based on the face sample set. The second face recognition model includes the face class center and the hybrid class center.
[0175] In an optional embodiment, the second face recognition model includes a common structure and face branch structures and a hybrid branch structure respectively connected to the common structure. The face branch structure includes the face class center, and the hybrid branch structure includes the hybrid class center.
[0176] The second face recognition module 606 is used to train the model parameters of the common structure and the face branch structure based on the face sample set;
[0177] The second face recognition module 606 is used to train the model parameters of the hybrid branch structure based on the face sample set.
[0178] In an optional embodiment, the common structure includes a common feature extraction layer, and the face branch structure further includes a face feature extraction layer;
[0179] The second face recognition module 606 is used to call the common feature extraction layer to extract features from the face images in the face sample set to obtain the first face features;
[0180] The second face recognition module 606 is used to call the face feature extraction layer to extract features from the first face features to obtain the second face features;
[0181] The second face recognition module 606 is used to call the face class center to perform matrix operations on the second face features to obtain the first face recognition result;
[0182] The second face recognition module 606 is used to train the shared feature extraction layer, the face feature extraction layer, and the face class center based on the loss between the first face recognition result and the face identifier of the face image.
[0183] In an optional embodiment, the shared structure includes a shared feature extraction layer, and the hybrid branch structure further includes a hybrid feature extraction layer;
[0184] The second face recognition module 606 is used to call the common feature extraction layer to extract features from the face images in the face sample set to obtain the first face features;
[0185] The second face recognition module 606 is used to call the hybrid feature extraction layer to extract features from the first face features to obtain the third face features;
[0186] The second face recognition module 606 is used to call the hybrid class center to perform matrix operations on the third face features to obtain the second face recognition result;
[0187] The second face recognition module 606 is used to train the hybrid feature extraction layer and the hybrid class center based on the loss between the second face recognition result and the face identifier of the face image.
[0188] In an optional embodiment, the second face recognition model includes a common feature extraction layer, a face feature extraction layer connected to the common feature extraction layer, a hybrid feature extraction layer connected to the common feature extraction layer, a face class center connected to the face feature extraction layer, and a hybrid class center connected to the hybrid feature extraction layer;
[0189] The device further includes:
[0190] The third face recognition module 603 is used to initialize the feature extraction layer of the third face recognition model according to the shared feature extraction layer, the face feature extraction layer, and the hybrid feature extraction layer;
[0191] The third face recognition module 603 is used to train the initialized third face recognition model based on a set of face images.
[0192] In an optional embodiment, the third face recognition module 603 is used to fix the feature extraction layer parameters of the third face recognition model unchanged and train the third face recognition model based on the face image set.
[0193] In an optional embodiment, the second face recognition model includes a common feature extraction layer, a face feature extraction layer connected to the common feature extraction layer, a hybrid feature extraction layer connected to the common feature extraction layer, a face class center connected to the face feature extraction layer, and a hybrid class center connected to the hybrid feature extraction layer;
[0194] The device further includes:
[0195] The fourth face recognition module 602 is used to call the common feature extraction layer to extract features from the input image and obtain common features;
[0196] The fourth face recognition module 602 is used to call the face feature extraction layer to extract features from the common features to obtain face features;
[0197] The fourth face recognition module 602 is used to call the hybrid feature extraction layer to extract features from the shared features to obtain occlusion features;
[0198] The fourth face recognition module 602 is used to integrate the face features and the occlusion features to obtain a merged feature;
[0199] The fourth face recognition module 602 is used to input the merged features into the fourth face recognition model to obtain the face recognition result.
[0200] In an optional embodiment, the first face recognition model includes a first feature extraction layer and a first group of class centers;
[0201] The first face recognition module 601 is used to call the first feature extraction layer to extract features from the face images in the face sample set to obtain a fourth face feature;
[0202] The first face recognition module 601 is used to call the first group of class centers to perform matrix operations on the fourth face features to obtain the third face recognition result;
[0203] The first face recognition module 601 is used to train the first feature extraction layer and the first group of class centers based on the loss between the third face recognition result and the face identifier of the face image.
[0204] In an optional embodiment, the hybrid face recognition model includes a second feature extraction layer and a second set of class centers;
[0205] The hybrid face recognition module 604 is used to call the second feature extraction layer to extract features from the face images in the face sample set or the occluded face images in the occluded face sample set to obtain the fifth face feature.
[0206] The hybrid face recognition module 604 is used to call the second group of class centers to perform matrix operations on the fifth face feature to obtain the fourth face recognition result;
[0207] The hybrid face recognition module 604 is used to train the second feature extraction layer and the second group of class centers based on the loss between the fourth face recognition result and the face identifier, wherein the face identifier is the face identifier of the face image or the face identifier of the occluded face image.
[0208] Figure 14 A schematic diagram of a training apparatus for a face recognition model provided in an exemplary embodiment of this application is shown. This apparatus can be implemented as all or part of a computer device through software, hardware, or a combination of both. The apparatus includes:
[0209] The recognition module 701 is used to call the fifth face recognition model to perform face recognition on the input image and obtain the fifth face recognition result;
[0210] The first network structure of the fifth face recognition model is the same as the second network structure of the second face recognition model, and the second face model is trained using the training method of the face recognition model as described in any one of claims 1 to 9.
[0211] In an optional embodiment, the first network structure and the second network structure include a shared feature extraction layer, a facial feature extraction layer, and a hybrid feature extraction layer;
[0212] The recognition module 701 is used to call the common feature extraction layer to extract features from the fifth face recognition model to obtain common face features;
[0213] The recognition module 701 is used to call the facial feature extraction layer to extract features from the common facial features to obtain facial branch features;
[0214] The recognition module 701 is used to call the hybrid feature extraction layer to extract features from the common facial features to obtain hybrid branch features;
[0215] The recognition module 701 is used to merge the facial branch features and the mixed branch features into a total feature;
[0216] The recognition module 701 is used to call the third network structure of the fifth face recognition model to perform face recognition on the total features and obtain the fifth face recognition result.
[0217] Figure 15 This is a schematic diagram of the structure of a server provided in one embodiment of this application. Specifically, the server 800 includes a Central Processing Unit (CPU) 801, a system memory 804 including Random Access Memory (RAM) 802 and Read-Only Memory (ROM) 803, and a system bus 805 connecting the system memory 804 and the CPU 801. The server 800 also includes a basic input / output system (I / O system) 806 that facilitates the transfer of information between various devices within the computer, and a mass storage device 807 for storing the operating system 813, application programs 814, and other program modules 815.
[0218] The basic input / output system 806 includes a display 808 for displaying information and an input device 809 for inputting information, such as a mouse or keyboard. Both the display 808 and the input device 809 are connected to the central processing unit 801 via an input / output controller 810 connected to the system bus 805. The basic input / output system 806 may also include the input / output controller 810 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 810 also provides output to a display screen, printer, or other types of output devices.
[0219] Mass storage device 807 is connected to central processing unit 801 via a mass storage controller (not shown) connected to system bus 805. Mass storage device 807 and its associated computer-readable media provide non-volatile storage for server 800. That is, mass storage device 807 may include computer-readable media (not shown) such as hard disk or compact disc read-only memory (CD-ROM) drive.
[0220] Without loss of generality, computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types. The system memory 804 and mass storage device 807 described above can be collectively referred to as memory.
[0221] According to various embodiments of this application, server 800 can also be connected to a remote computer on a network, such as the Internet. That is, server 800 can be connected to network 812 via network interface unit 811 connected to system bus 805, or it can use network interface unit 811 to connect to other types of networks or remote computer systems (not shown).
[0222] This application also provides a terminal, which includes a processor and a memory. The memory stores at least one instruction, which is loaded and executed by the processor to implement the training method or face recognition method of the face recognition model provided in the above-described method embodiments. It should be noted that the terminal can be as follows: Figure 16 The provided terminal.
[0223] Figure 16 This illustration shows a structural block diagram of a terminal 900 provided in an exemplary embodiment of this application. The terminal 900 may be a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. The terminal 900 may also be referred to as a user-side device, portable terminal, laptop terminal, desktop terminal, or other names.
[0224] Typically, terminal 900 includes a processor 901 and a memory 902.
[0225] Processor 901 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 901 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 901 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 901 may integrate a GPU (Graphics Processing Unit, a trainer for facial recognition models), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 901 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0226] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 902 is used to store at least one instruction, which is executed by the processor 901 to implement the training method of the face recognition model or the face recognition method provided in the method embodiments of this application.
[0227] In some embodiments, the terminal 900 may also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908, and a power supply 909.
[0228] Peripheral device interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 901 and memory 902. In some embodiments, processor 901, memory 902 and peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 901, memory 902 and peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0229] The radio frequency (RF) circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Exemplarily, the RF circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user account identity module card, etc. The RF circuit 904 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 904 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0230] Display screen 905 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 905 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 901 for processing. In this case, display screen 905 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 905, which serves as the front panel of terminal 900; in other embodiments, there may be at least two display screens 905, respectively disposed on different surfaces of terminal 900 or in a folded design; in still other embodiments, display screen 905 may be a flexible display screen, disposed on a curved or folded surface of terminal 900. Furthermore, display screen 905 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 905 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0231] Camera assembly 906 is used to acquire images or videos. Exemplarily, camera assembly 906 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, camera assembly 906 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.
[0232] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user account and environment, converting the sound waves into electrical signals that are input to the processor 901 for processing, or input to the radio frequency circuit 904 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located at a different part of the terminal 900. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0233] The positioning component 908 is used to determine the current geographic location of the terminal 900 in order to enable navigation or LBS (Location Based Service). The positioning component 908 can be a positioning component based on the US GPS (Global Positioning System), China's BeiDou system, or other countries' Galileo systems.
[0234] Power supply 909 is used to supply power to the various components in terminal 900. Power supply 909 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 909 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0235] In some embodiments, the terminal 900 further includes one or more sensors 910. The one or more sensors 910 include, but are not limited to: an accelerometer 911, a gyroscope 912, a pressure sensor 913, a fingerprint sensor 914, an optical sensor 915, and a proximity sensor 916.
[0236] Accelerometer 911 can detect the magnitude of acceleration along the three coordinate axes of a coordinate system established by terminal 900. For example, accelerometer 911 can be used to detect the components of gravitational acceleration along the three coordinate axes. Processor 901 can control display screen 905 to display the user account interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 911. Accelerometer 911 can also be used to collect motion data from games or user accounts.
[0237] The gyroscope sensor 912 can detect the orientation and rotation angle of the terminal 900. The gyroscope sensor 912, in conjunction with the accelerometer sensor 911, can collect 3D motion data from the user account on the terminal 900. Based on the data collected by the gyroscope sensor 912, the processor 901 can perform the following functions: motion sensing (e.g., changing the UI based on the user account's tilting actions), image stabilization during shooting, game control, and inertial navigation.
[0238] The pressure sensor 913 can be installed on the side bezel of the terminal 900 and / or on the lower layer of the display screen 905. When the pressure sensor 913 is installed on the side bezel of the terminal 900, it can detect the user's grip signal on the terminal 900, and the processor 901 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 913. When the pressure sensor 913 is installed on the lower layer of the display screen 905, the processor 901 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0239] The fingerprint sensor 914 is used to collect the user's fingerprint. The processor 901 identifies the user's account based on the fingerprint collected by the fingerprint sensor 914, or vice versa. When the user's account is identified as a trusted identity, the processor 901 authorizes the user account to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 914 can be located on the front, back, or side of the terminal 900. When the terminal 900 has physical buttons or a manufacturer's logo, the fingerprint sensor 914 can be integrated with the physical buttons or manufacturer's logo.
[0240] An optical sensor 915 is used to collect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 based on the ambient light intensity collected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 based on the ambient light intensity collected by the optical sensor 915.
[0241] The proximity sensor 916, also known as a distance sensor, is typically located on the front panel of the terminal 900. The proximity sensor 916 is used to detect the distance between the user account and the front of the terminal 900. In one embodiment, when the proximity sensor 916 detects that the distance between the user account and the front of the terminal 900 is gradually decreasing, the processor 901 controls the display screen 905 to switch from a screen-on state to a screen-off state; when the proximity sensor 916 detects that the distance between the user account and the front of the terminal 900 is gradually increasing, the processor 901 controls the display screen 905 to switch from a screen-off state to a screen-on state.
[0242] Those skilled in the art will understand that Figure 16 The structure shown does not constitute a limitation on terminal 900, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0243] The memory also includes one or more programs stored in the memory, and the one or more programs include a training method or a face recognition method for performing the face recognition model provided in the embodiments of this application.
[0244] This application also provides a computer device, which includes a processor and a memory. The memory storage medium stores at least one instruction, at least one program, code set, or instruction set. The at least one instruction, at least one program, code set, or instruction set is loaded and executed by the processor to implement the training method or face recognition method of the face recognition model provided in the above-described method embodiments.
[0245] This application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the training method or face recognition method of the face recognition model provided in the above-described method embodiments.
[0246] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the training method or face recognition method of the face recognition model provided in the above-described optional implementation.
[0247] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0248] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0249] The above are merely optional embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for training a face recognition model, characterized in that, The method includes: A first face recognition model is obtained by training a face sample set, wherein the face sample set includes face images corresponding to at least one face identifier, and the first face recognition model includes a first set of class centers, wherein the first set of class centers includes a class center corresponding to each face identifier among the at least one face identifier. A hybrid face recognition model is trained based on the face sample set and the occluded face sample set. The occluded face sample set includes occluded face images corresponding to the at least one face identifier. The hybrid face recognition model includes a second set of class centers. The second set of class centers includes a class center corresponding to each face identifier in the at least one face identifier. In the second set of class centers, occluded face images and face images corresponding to the same face identifier correspond to the same class center. The parameters of the face class centers in the second face recognition model are initialized based on the first set of class centers, and the parameters of the hybrid class centers in the second face recognition model are initialized based on the second set of class centers. The second face recognition model is trained and initialized based on the face sample set. The second face recognition model includes the face class center and the hybrid class center.
2. The method according to claim 1, characterized in that, The second face recognition model includes a common structure and face branch structures and a hybrid branch structure connected to the common structure, respectively. The face branch structure includes the face class center, and the hybrid branch structure includes the hybrid class center. The second face recognition model, trained and initialized based on the face sample set, includes the face class center and the hybrid class center, comprising: The model parameters of the common structure and the facial branch structure are trained based on the face sample set. The model parameters of the hybrid branch structure are trained based on the face sample set.
3. The method according to claim 2, characterized in that, The shared structure includes a shared feature extraction layer, and the face branch structure further includes a face feature extraction layer; The training of model parameters for the common structure and the facial branch structure based on the facial sample set includes: The shared feature extraction layer is invoked to extract features from the facial images in the facial sample set to obtain the first facial features; The facial feature extraction layer is invoked to extract features from the first facial features to obtain the second facial features; The face class center is invoked to perform matrix operations on the second face features to obtain the first face recognition result; The shared feature extraction layer, the face feature extraction layer, and the face class center are trained based on the loss between the first face recognition result and the face identifier of the face image.
4. The method according to claim 2, characterized in that, The shared structure includes a shared feature extraction layer, and the hybrid branch structure further includes a hybrid feature extraction layer; The model parameters for training the hybrid branch structure based on the face sample set include: The shared feature extraction layer is invoked to extract features from the facial images in the facial sample set to obtain the first facial features; The hybrid feature extraction layer is invoked to extract features from the first facial features to obtain the third facial features; The hybrid class center is invoked to perform matrix operations on the third facial features to obtain the second facial recognition result; The hybrid feature extraction layer and the hybrid class center are trained based on the loss between the second face recognition result and the face identifier of the face image.
5. The method according to any one of claims 1 to 4, characterized in that, The second face recognition model includes a common feature extraction layer, a face feature extraction layer connected to the common feature extraction layer, a hybrid feature extraction layer connected to the common feature extraction layer, a face class center connected to the face feature extraction layer, and a hybrid class center connected to the hybrid feature extraction layer; The method further includes: The feature extraction layer of the third face recognition model is initialized based on the shared feature extraction layer, the face feature extraction layer, and the hybrid feature extraction layer; The third face recognition model is trained and initialized based on a set of face images.
6. The method according to claim 5, characterized in that, The third face recognition model, trained and initialized based on a set of face images, includes: The feature extraction layer parameters of the third face recognition model are kept constant, and the third face recognition model is trained based on the face image set.
7. The method according to any one of claims 1 to 4, characterized in that, The second face recognition model includes a common feature extraction layer, a face feature extraction layer connected to the common feature extraction layer, a hybrid feature extraction layer connected to the common feature extraction layer, a face class center connected to the face feature extraction layer, and a hybrid class center connected to the hybrid feature extraction layer; The method further includes: The shared feature extraction layer is invoked to extract features from the input image, thus obtaining shared features. The facial feature extraction layer is invoked to extract features from the shared features, thereby obtaining facial features; The hybrid feature extraction layer is invoked to extract features from the shared features to obtain occlusion features; The facial features and the occlusion features are integrated to obtain a merged feature; The merged features are input into the fourth face recognition model to obtain the face recognition result.
8. The method according to any one of claims 1 to 4, characterized in that, The first face recognition model includes a first feature extraction layer and a first group of class centers; The first face recognition model, trained based on a face sample set, includes: The first feature extraction layer is invoked to extract features from the facial images in the facial sample set to obtain the fourth facial feature; The first group of class centers is used to perform matrix operations on the fourth facial features to obtain the third facial recognition result; The first feature extraction layer and the first set of class centers are trained based on the loss between the third face recognition result and the face identifiers in the face image.
9. The method according to any one of claims 1 to 4, characterized in that, The hybrid face recognition model includes a second feature extraction layer and a second set of class centers; The hybrid face recognition model trained based on the face sample set and the occluded face sample set includes: The second feature extraction layer is invoked to extract features from the face images in the face sample set or the occluded face images in the occluded face sample set to obtain the fifth face feature; The second group of class centers is used to perform matrix operations on the fifth facial feature to obtain the fourth facial recognition result; The second feature extraction layer and the second set of class centers are trained based on the loss between the fourth face recognition result and the face identifier, wherein the face identifier is the face identifier of the face image or the occluded face image.
10. A face recognition method, characterized in that, The method includes: The fifth face recognition model is called to perform face recognition on the input image, and the fifth face recognition result is obtained; The first network structure of the fifth face recognition model is the same as the second network structure of the second face recognition model, and the second face recognition model is trained using the training method of the face recognition model as described in any one of claims 1 to 9.
11. The method according to claim 10, characterized in that, The first network structure and the second network structure include a shared feature extraction layer, a facial feature extraction layer, and a hybrid feature extraction layer; The step of calling the fifth face recognition model to perform face recognition on the input image and obtaining the fifth face recognition result includes: The shared feature extraction layer is invoked to extract features from the fifth face recognition model to obtain shared face features; The facial feature extraction layer is invoked to extract features from the shared facial features, thereby obtaining the facial branch features; The hybrid feature extraction layer is invoked to extract features from the shared facial features, resulting in hybrid branch features; The facial branch features and the mixed branch features are merged into a total feature; The third network structure of the fifth face recognition model is invoked to perform face recognition on the total features, thereby obtaining the fifth face recognition result.
12. A training device for a face recognition model, characterized in that, The device includes: A first face recognition module is used to train a first face recognition model based on a face sample set, wherein the face sample set includes face images corresponding to at least one face identifier, and the first face recognition model includes a first set of class centers, wherein the first set of class centers includes a class center corresponding to each face identifier among the at least one face identifier. A hybrid face recognition module is used to train a hybrid face recognition model based on the face sample set and the occluded face sample set. The occluded face sample set includes occluded face images corresponding to the at least one face identifier. The hybrid face recognition model includes a second set of class centers, which includes one class center corresponding to each face identifier in the at least one face identifier. In the second set of class centers, occluded face images and face images corresponding to the same face identifier correspond to the same class center. An initialization module is used to initialize the parameters of the face class centers in the second face recognition model based on the first set of class centers, and to initialize the parameters of the hybrid class centers in the second face recognition model based on the second set of class centers. The second face recognition module is used to train the initialized second face recognition model based on the face sample set. The second face recognition model includes the face class center and the hybrid class center.
13. A facial recognition device, characterized in that, The device includes: The recognition module is used to call the fifth face recognition model to perform face recognition on the input image and obtain the fifth face recognition result; The first network structure of the fifth face recognition model is the same as the second network structure of the second face recognition model, and the second face recognition model is trained using the training method of the face recognition model as described in any one of claims 1 to 9.
14. A computer device, characterized in that, The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the training method of the face recognition model as described in any one of claims 1 to 9, or to implement the face recognition method as described in any one of claims 10 to 11.
15. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the training method of the face recognition model as described in any one of claims 1 to 9, or to implement the face recognition method as described in any one of claims 10 to 11.
Citation Information
Patent Citations
A shielded face recognition method and device
CN109886167A
Blocking object recognition model training method and device, blocking object recognition method and device and storage medium
CN111860566A