Face recognition model training method, face recognition method and related equipment
By adding a fine-tuning branch network to the face recognition model and fine-tuning the parameters on the heterogeneous face data set, the problem of low recognition accuracy of the face recognition model in heterogeneous scenes is solved, and the recognition accuracy in general and heterogeneous scenes is achieved. The highly efficient recognition performance avoids the phenomenon of 'catastrophic forgetting'.
Patent Information
- Application Number
- CN202410927051.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-01
AI Technical Summary
Existing face recognition models have low recognition accuracy in heterogeneous face scenes and are difficult to cope with complex scenes in unconstrained environments, such as infrared scenes, low-quality face images, and poor lighting conditions.
Add a fine-tuning branch network to the general face recognition model, and fine-tune some parameters on the heterogeneous face data set, freeze the parameters of the backbone feature extraction module, and form a heterogeneous face recognition model to improve the recognition accuracy and avoid ' Catastrophic forgetting'.
It improves the recognition accuracy in heterogeneous face scenes, ensures that the model has good recognition performance in both general and heterogeneous scenes, and improves training efficiency.
Smart Images

Figure CN118736648A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of face recognition technology, and more specifically, to a face recognition model training method, a face recognition method, an apparatus, related equipment and a computer program product. Background Art
[0002] With the application of neural network models in the field of face recognition, the use of face recognition models can improve the accuracy of face recognition.
[0003] Currently, the widely used face recognition models are mainly trained based on large-scale general face datasets. These datasets usually contain a large number of high-resolution images, and in most cases, they are clear and unobstructed faces captured under visible light (also known as "clean face data"). Although this data environment ensures the high performance of the model in general scenarios, it also raises some challenges. When faced with complex and changeable heterogeneous scenes in the real world, such as face recognition tasks in unconstrained environments, models often need to deal with situations including but not limited to heterogeneous imaging (such as infrared scenes), low quality, occluded faces, or facial images with poor lighting conditions. These situations may exceed the data feature range of the original training set, resulting in greatly reduced recognition accuracy in heterogeneous face scenes. Summary of the invention
[0004] In view of the above problems, this application is proposed to provide a face recognition model training method, face recognition method, apparatus, related equipment and computer program product to solve the problem that the existing face recognition model has low recognition accuracy in heterogeneous face scenes. The specific solution is as follows:
[0005] In a first aspect, a face recognition model training method is provided, comprising:
[0006] Obtaining a universal face recognition model, wherein the universal face recognition model is a model pre-trained on a universal face data set, and comprises a backbone feature extraction module and a face attribute classification module, wherein the backbone feature extraction module is used to extract identity features from an input face image, and the face attribute classification module is used to predict an identity type matching the face image based on the identity features;
[0007] Adding a fine-tuning branch network in the trunk feature extraction module, wherein the fine-tuning branch network is connected in parallel with the trunk network in the trunk feature extraction module;
[0008] The universal face recognition model is trained on the configured heterogeneous face data set, and the parameters of the backbone network in the backbone feature extraction module are frozen during the training process to obtain the trained heterogeneous face recognition model.
[0009] In a possible design, in another implementation of the first aspect of the embodiment of the present application, the method further includes:
[0010] The parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module of the heterogeneous face recognition model are merged with the parameters of the parallel connected trunk network, and the fine-tuning branch network is removed to obtain a heterogeneous face recognition model with a simplified structure;
[0011] Among them, before parameter fusion, the operation result obtained by the parallel structure of the backbone network and the fine-tuning branch network operating on the input data is the same as the operation result obtained by the backbone network operating on the input data after parameter fusion.
[0012] In a possible design, in another implementation of the first aspect of the embodiments of the present application, the backbone feature extraction module uses a convolutional neural network with a bypass branch;
[0013] The fine-tuning branch network is connected in parallel with the bypass branch in the convolutional neural network.
[0014] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the fine-tuning branch network is a convolution layer having the same convolution kernel size as the bypass branch.
[0015] In one possible design, in another implementation of the first aspect of the embodiments of the present application, the trunk feature extraction module adopts a convolutional neural network with a bypass branch, the fine-tuning branch network is a convolutional layer having the same convolution kernel size as the bypass branch, and the fine-tuning branch network is connected in parallel with the bypass branch in the convolutional neural network;
[0016] Then, the process of fusing the parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module with the parameters of the trunk network connected in parallel includes:
[0017] The parameters of the fine-tuning branch network are linearly superimposed on the parameters of the bypass branches connected in parallel to achieve parameter fusion.
[0018] In a possible design, in another implementation of the first aspect of the embodiments of the present application, the universal face recognition model further includes:
[0019] The image preprocessing module is used to perform face detection on the input face image and align the detected faces to obtain an aligned standard face image;
[0020] The standard face image is used as input of the backbone feature extraction module.
[0021] In a second aspect, a face recognition method is provided, comprising:
[0022] Get face image;
[0023] Inputting the face image into a configured heterogeneous face recognition model to obtain a face recognition result output by the heterogeneous face recognition model;
[0024] Among them, the heterogeneous face recognition model is a model obtained by using the face recognition model training method described in any one of the first aspects of the present application.
[0025] In a third aspect, a face recognition model training device is provided, comprising:
[0026] A general model acquisition unit, used to acquire a general face recognition model, wherein the general face recognition model is a model pre-trained on a general face data set, and comprises a backbone feature extraction module and a face attribute classification module, wherein the backbone feature extraction module is used to extract identity features from an input face image, and the face attribute classification module is used to predict an identity type matching the face image based on the identity features;
[0027] A model editing unit, used for adding a fine-tuning branch network in the trunk feature extraction module, wherein the fine-tuning branch network is connected in parallel with the trunk network in the trunk feature extraction module;
[0028] The model fine-tuning unit is used to train the universal face recognition model on the configured heterogeneous face data set. The training process freezes the parameters of the backbone network in the backbone feature extraction module to obtain the trained heterogeneous face recognition model.
[0029] In a fourth aspect, an electronic device is provided, comprising: a memory and a processor;
[0030] The memory is used to store programs;
[0031] The processor is used to execute the program to implement the various steps of the face recognition model training method described in any one of the first aspects, or to implement the various steps of the face recognition method described in the second aspect.
[0032] In a fifth aspect, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the various steps of the face recognition model training method described in any one of the first aspects are implemented, or the various steps of the face recognition method described in the second aspect are implemented.
[0033] In the sixth aspect, a computer program product is provided, comprising a computer program. When the computer program is executed by a processor, the computer program implements the various steps of the face recognition model training method described in any one of the first aspects, or implements the various steps of the face recognition method described in the second aspect.
[0034] Through the above technical scheme, the present application provides a training method for a heterogeneous face recognition model. For the universal face recognition model obtained after pre-training on a universal face dataset, fine-tuning training of some parameters is performed on the heterogeneous face dataset to obtain a trained heterogeneous face recognition model, which can improve the recognition accuracy in heterogeneous face scenarios.
[0035] In addition, in order to improve the efficiency of model training on heterogeneous face datasets, this application does not adopt full-parameter fine-tuning training, but freezes the parameters of the backbone network in the backbone feature extraction module in the general face recognition model, and fine-tunes a small number of parameters such as the newly added fine-tuning branch network, which can effectively improve the training efficiency of the model.
[0036] Furthermore, in order to avoid or reduce the problem of "catastrophic forgetting" in the model and ensure that the trained heterogeneous face recognition model does not lose its performance on the original general face data set, the fine-tuning training process of this application adds a fine-tuning branch network based on the original general face recognition model. The fine-tuning branch network is connected in parallel to the trunk network in the trunk feature extraction module. When training on the heterogeneous face data set, the parameters of the trunk network are frozen and unchanged, and the parameters of the fine-tuning branch network are updated. This can not only retain the core parameters of the general face recognition model, but also achieve efficient migration and adaptation from general face recognition scenarios to heterogeneous face recognition scenarios, ensuring that the trained model has good recognition performance in both scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0038] Figure 1 A schematic diagram of an implementation system architecture of a face recognition model training and face recognition method provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of a terminal structure provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of a server structure provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of a process flow of a face recognition model training method provided in an embodiment of the present application;
[0042] Figure 5 A schematic diagram of the structure and training process of a face recognition model provided in an embodiment of the present application;
[0043] Figure 6 A schematic diagram of the structure of a backbone feature extraction module provided in an embodiment of the present application;
[0044] Figure 7 A schematic diagram of the structure of a trunk feature extraction module after adding a fine-tuning branch network provided in an embodiment of the present application;
[0045] Figure 8 A schematic diagram of the structure of a backbone feature extraction module after re-parameterization of a model structure provided in an embodiment of the present application;
[0046] Fig. 9 A schematic diagram of the structure of a face recognition model training device provided in an embodiment of the present application;
[0047] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] This application provides a face recognition model training method and a face recognition method, which can be applied to Figure 1 The system architecture shown in FIG. 1 may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1 A server is included as an example for explanation).
[0050] The terminal 100 or the server 200 can be used alone to execute the face recognition model training method or face recognition method provided in the embodiment of the present application. In addition, the terminal 100 and the server 200 can also be used in collaboration to execute the face recognition model training method or face recognition method provided in the embodiment of the present application.
[0051] Next describe Figure 1 The product form of the mid-terminal 100;
[0052] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a monitoring device, a time clock, a wearable device, a vehicle-mounted device, a conference terminal, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0053] Figure 2 An optional hardware structure diagram of the terminal 100 is shown.
[0054] refer to Figure 2 As shown, the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150, an audio circuit 160, a speaker 161, a microphone 162, an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 2 These are merely examples of terminals or multi-function devices and do not constitute limitations on the terminals or multi-function devices, which may include more or fewer components than those shown in the figures, or combinations of certain components, or different components.
[0055] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0056] Among them, the input device 132 can receive input data and the like.
[0057] The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In the embodiment of the present application, the display unit 140 may be used to display various interactive interfaces, processing results, etc. in the face recognition model training method or the face recognition method.
[0058] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.
[0059] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.
[0060] Among them, the memory 120 can be used to store software codes related to the face recognition model training method or the face recognition method, the processor 170 can execute the steps of the face recognition model training method or the face recognition method, and can also schedule other units (such as the above-mentioned input unit 130 and the display unit 140) to realize corresponding functions.
[0061] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0062] In the embodiment of the present application, the RF unit 110 can send data to the server 200 and receive the processing result sent by the server 200. Exemplarily, in the face recognition method, the RF unit 110 sends the received face image to the server 200, and the server 200 performs recognition processing on the face image based on the trained heterogeneous face recognition model, obtains the face recognition result and returns it to the terminal 100.
[0063] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0064] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0065] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to communicate with other devices, or to connect a charger to charge the terminal 100 .
[0066] Although not shown, the terminal 100 may also include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied in the following embodiments. Figure 2 In the terminal 100 shown.
[0067] Next describe Figure 1 The product form of the server 200;
[0068] Figure 3 A structural diagram of a server 200 is provided, such as Figure 3 As shown, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.
[0069] The bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0070] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0071] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard drive (HDD), or a solid state drive (SSD).
[0072] Among them, the memory 204 can be used to store software codes related to the face recognition model training method or the face recognition method, the processor 202 can execute the steps of the face recognition model training method or the face recognition method, and can also schedule other units to implement corresponding functions.
[0073] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0074] As mentioned above, the general face recognition model is trained on a clean general face dataset, and it can obtain good recognition results when facing general face recognition scenarios. However, objective factors in real scenes, such as occlusion, near-infrared lighting, and low resolution, often change the underlying distribution of facial features. Such scenes can be summarized as heterogeneous face scenes. Since general models are trained on "clean face data", the performance of the model is significantly reduced when facing heterogeneous face scenes.
[0075] To solve the above problems, an optional solution is to retrain a new face recognition model on a heterogeneous face dataset. However, in reality, the scale of heterogeneous face data is much smaller than that of general face data, and it is easy for the model to be underfitted due to insufficient training data.
[0076] Another optional solution is to fine-tune all parameters of the universal face recognition model trained on a universal face dataset on a small number of heterogeneous face datasets. Experiments have found that although this method can improve the problem of reduced recognition performance in heterogeneous scenes to a certain extent, due to the large number of parameters in the universal face recognition model, this training method will lead to extremely low model training efficiency.
[0077] In addition, the above-mentioned fine-tuning training method is also prone to the problem of "catastrophic forgetting" of model performance, that is: since the data distribution in heterogeneous face scenes is significantly different from that in general face scenes, for example, the solution to face recognition in near-infrared scenes is to regard it as a problem of bridging the domain gap between natural light and near-infrared light. This difference may cause the model to be trained on a heterogeneous face dataset while losing its performance on the original general face dataset. This phenomenon is called "catastrophic forgetting."
[0078] In order to solve or at least alleviate the above-mentioned problems, the present application further provides a new face recognition model training method, which is applied to Figure 1 Taking the computer device in the example as an example, the computer device can be Figure 1 The terminal 100 or the server 200 in FIG. Figure 4 , the face recognition model training method specifically includes the following steps:
[0079] Step S100: obtaining a general face recognition model, which includes a backbone feature extraction module and a face attribute classification module.
[0080] The general face recognition model is a model pre-trained on a general face dataset.
[0081] Combination Figure 5 As shown, the general face recognition model may include a backbone feature extraction module and a face attribute classification module.
[0082] The backbone feature extraction module is used to extract identity features for face verification from the input face image. The backbone feature extraction module can adopt a deep network model including but not limited to a convolutional neural network with a bypass branch and a Transformer.
[0083] The face attribute classification module is used to predict the identity type matching the face image based on the identity features extracted by the backbone feature extraction module. The face attribute classification module can use a classifier including but not limited to a fully connected layer.
[0084] Furthermore, the general face recognition model may also include an image preprocessing module for performing face detection on an input face image and aligning the detected face to obtain an aligned standard face image.
[0085] Specifically, the image preprocessing module can detect faces in the input face image through the face detection model and output the face frame. Further, the key point detection algorithm can be used to locate the key points on the face. These key points can include points with significant features such as the corners of the eyes, the corners of the mouth, the tip of the nose, etc., which are particularly important for face alignment. After obtaining the key points, a set of "reference key points" (such as two corners of the eyes, the tip of the nose, etc.) can be selected from the key points. These points will serve as a benchmark for alignment between different faces. Further, using the correspondence between the detected key points and the reference key points, a similarity transformation matrix is calculated. This matrix can transform the detected face into a state aligned with the standard face. Therefore, the calculated similarity transformation matrix can be applied to the detected face image to obtain the aligned standard face image.
[0086] Combination Figure 5 As shown, general face data can be used to train a general face recognition model, and the loss function during training can use loss functions including but not limited to softmax and additive angular margin loss (Additive Angular Margin Loss, ArcFace).
[0087] By using the universal face recognition model trained with universal face data, the network parameters of the backbone feature extraction module and the face attribute classification module can be obtained. On this basis, the subsequent process of fine-tuning the universal face recognition model on the heterogeneous face data set can be further performed.
[0088] Step S110: adding a fine-tuning branch network to the trunk feature extraction module, wherein the fine-tuning branch network is connected in parallel to the trunk network in the trunk feature extraction module.
[0089] This embodiment adopts a lightweight fine-tuning solution, adding a fine-tuning branch network to the general face recognition model obtained by the above training. Figure 5 As shown, the fine-tuning branch network is connected in parallel to the trunk network in the trunk feature extraction module, and the parallel structure composed of the trunk network and the fine-tuning branch network performs calculations on the output results of the previous level, and the results serve as the input of the next level.
[0090] In this step, the overall residual architecture is constructed by adding a fine-tuning branch network in parallel to the trunk feature extraction module, so that while maintaining the model's capabilities in general face recognition scenarios, it can also learn unique features and patterns for specific heterogeneous face scene tasks.
[0091] Step S120: training the general face recognition model on the configured heterogeneous face data set, freezing the parameters of the backbone network in the backbone feature extraction module during the training process, and obtaining the trained heterogeneous face recognition model.
[0092] Specifically, in order to improve the training efficiency of the model and keep the core parameters of the general face recognition model unchanged to minimize the "catastrophic forgetting" phenomenon, in this embodiment, when training the model on a heterogeneous face dataset, the parameters of the backbone network at each level in the backbone feature extraction module can be frozen, and gradient back propagation and parameter update are not involved. Only the parameters of the fine-tuning branch network and the face attribute classification module with a small number of parameters are updated. ( Figure 5 Different marks are used to indicate whether the parameters of each module in the training process of the heterogeneous face recognition model are involved in the update. The backbone feature extraction module uses the first type of icon to indicate frozen parameters, and the fine-tuning branch network and face attribute classification module use the second type of icon to indicate that the parameters are involved in the update).
[0093] According to the training strategy of this embodiment, the core parameters of the general face recognition model are retained, and efficient migration and adaptation from general scenarios to heterogeneous face recognition scenarios are achieved, ensuring that the model performs well in both scenarios.
[0094] It should be noted that the "heterogeneous face recognition model" is only an exemplary name used to distinguish it from the "general face recognition model", and does not mean that the model is only applicable to heterogeneous face recognition scenarios. The heterogeneous face recognition model trained by this embodiment can efficiently adapt to diverse environments and has good recognition effects for general scenarios and heterogeneous face scenarios.
[0095] In some possible implementations, combined with Figure 6 As shown, an optional structure of the backbone feature extraction module is provided.
[0096] like Figure 6 As shown in the figure, the backbone feature extraction module can use a convolutional neural network with a bypass branch. Among them, the convolutional neural network can adopt a bottleneck structure, that is, a larger number of channels are used in the input and output layers, and a smaller number of channels are used in the middle layer. This structural design can improve computational efficiency and reduce memory consumption while maintaining network performance. By reducing the number of channels in the middle layer. In addition, the bottleneck structure can significantly reduce the amount of computation of the convolution operation, thereby speeding up the forward and reverse propagation speeds of the network.
[0097] The bypass branch can use a residual connection or a convolutional layer with a convolution kernel to convolve the shallow features and then pass them to the deep layer.
[0098] Furthermore, combined with Figure 7 As shown in FIG, when the main feature extraction module adopts a convolutional neural network with a bypass branch, the corresponding fine-tuning branch network can be connected in parallel with the bypass branch. On this basis, the fine-tuning branch network can adopt a convolutional layer, and the size of its convolution kernel can be the same as that of the bypass branch, so as to facilitate feature fusion.
[0099] Of course, the above Figure 7 Only one optional structure and connection relationship of the trunk feature extraction module and the fine-tuning branch network are illustrated. In addition, the trunk feature extraction module can also adopt other structures, such as the transformer structure. Correspondingly, the fine-tuning branch network can be connected in parallel on both sides of the attention module in the transformer structure.
[0100] In some embodiments of the present application, further consideration of the needs of practical applications and ensuring the unified structure of model reasoning in different tasks and environments will help to further improve the efficiency and convenience of model deployment.
[0101] To this end, this embodiment combines the idea of re-parameterization of the model structure to process the heterogeneous face recognition model obtained by the above training, so that the structure of the heterogeneous face recognition model does not require any modification compared to the general face recognition model, which greatly improves the efficiency of model deployment in practical applications.
[0102] The core concept of model structure reparameterization is to use a set of model structures and corresponding parameters in the training phase, and convert to another set of structures and parameters in the inference phase. By equivalently converting training parameters to inference parameters, seamless conversion of model structures can be achieved.
[0103] Specific treatment methods may include:
[0104] The parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module of the trained heterogeneous face recognition model are fused with the parameters of the parallel connected trunk network, and the fine-tuning branch network is removed to obtain a heterogeneous face recognition model with a simplified structure.
[0105] Among them, before parameter fusion, the operation result obtained by the parallel structure of the backbone network and the fine-tuning branch network on the input data is the same as the operation result obtained by the backbone network on the input data after parameter fusion. This ensures that the heterogeneous face recognition model with simplified structure has the same reasoning ability as the original heterogeneous face recognition model.
[0106] In this embodiment, by adopting structural reparameterization processing, it is ensured that the model structure trained on the heterogeneous face data set can be aligned with the general face recognition model structure, and the efficiency of the model in actual deployment is significantly improved while ensuring the model performance.
[0107] by Figure 7 The backbone feature extraction module shown takes a convolutional neural network with a bypass branch as an example. The fine-tuning branch network is a convolutional layer with the same convolution kernel size as the bypass branch, and the fine-tuning branch network is connected in parallel with the bypass branch in the convolutional neural network.
[0108] according to Figure 7 After adding a fine-tuning branch network to the backbone feature extraction module of the general face recognition model, the structure shown is trained on a heterogeneous face dataset. The training process can make the parameters of the fine-tuning branch network learnable parameters, and freeze other network parameters in the backbone feature extraction module to obtain a trained heterogeneous face recognition model.
[0109] Furthermore, the structure of the heterogeneous face recognition model can be simplified based on the idea of model structure reparameterization, and the parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module can be merged with the parameters of the parallel connected trunk network. Figure 8 As shown, the parameter fusion process may include:
[0110] Based on the linear superposition characteristics of the convolution kernel, the parameters of the fine-tuning branch network can be linearly superimposed on the parameters of the bypass branch connected in parallel to achieve parameter fusion. Figure 8 As shown in the figure, after linearly superimposing the parameters of the fine-tuning branch network to the bypass branch, the re-parameterized bypass branch can be obtained, and the fine-tuning branch network can be removed. This ensures that the model structure is consistent with the structure of the pre-trained model during the inference phase, ensuring model performance while simplifying the model deployment process.
[0111] In some embodiments of the present application, a face recognition method is provided based on the heterogeneous face recognition model obtained by the face recognition model training method of the aforementioned embodiments.
[0112] Specifically, a face image is first acquired, and the face image may be an image containing a face captured by an electronic device.
[0113] The face image is further input into the heterogeneous face recognition model to obtain the face recognition result output by the heterogeneous face recognition model, that is, the identity information corresponding to the recognized face.
[0114] Among them, the heterogeneous face recognition model is a heterogeneous face recognition model obtained based on the face recognition model training method of the aforementioned embodiment.
[0115] The face recognition method of the present application can be applied to a variety of scenarios that require face recognition, such as monitoring scenarios, clocking in and out scenarios, access control scenarios, etc. Since the heterogeneous face recognition model has good recognition performance for both general face recognition scenarios and heterogeneous face recognition scenarios, it can be applied to a variety of complex and changing scenarios, which improves the scope of application of the solution and ensures the robustness of the model.
[0116] The face recognition model training device provided in an embodiment of the present application is described below. The face recognition model training device described below and the face recognition model training method described above can be referenced to each other.
[0117] See also Fig. 9 , Fig. 9 This is a schematic diagram of the structure of a face recognition model training device disclosed in an embodiment of the present application.
[0118] like Fig. 9 As shown, the device may include:
[0119] A general model acquisition unit 11 is used to acquire a general face recognition model, wherein the general face recognition model is a model pre-trained on a general face data set, and comprises a backbone feature extraction module and a face attribute classification module, wherein the backbone feature extraction module is used to extract identity features from an input face image, and the face attribute classification module is used to predict an identity type matching the face image based on the identity features;
[0120] A model editing unit 12, used for adding a fine-tuning branch network in the trunk feature extraction module, wherein the fine-tuning branch network is connected in parallel with the trunk network in the trunk feature extraction module;
[0121] The model fine-tuning unit 13 is used to train the general face recognition model on the configured heterogeneous face data set. The training process freezes the parameters of the backbone network in the backbone feature extraction module to obtain the trained heterogeneous face recognition model.
[0122] In some possible implementations, the apparatus of the present application may further include:
[0123] A model re-parameterization unit, used to merge the parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module of the heterogeneous face recognition model with the parameters of the parallel connected trunk network, and remove the fine-tuning branch network to obtain a heterogeneous face recognition model with a simplified structure;
[0124] Among them, before parameter fusion, the operation result obtained by the parallel structure of the backbone network and the fine-tuning branch network operating on the input data is the same as the operation result obtained by the backbone network operating on the input data after parameter fusion.
[0125] In some possible implementations, the backbone feature extraction module uses a convolutional neural network with a bypass branch;
[0126] The fine-tuning branch network is connected in parallel with the bypass branch in the convolutional neural network.
[0127] In some possible implementations, the fine-tuning branch network is a convolutional layer having the same convolution kernel size as the bypass branch.
[0128] In some possible implementations, based on the structure of the above-mentioned trunk feature extraction module and the fine-tuning branch network, the process in which the model reparameterization unit fuses the parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module with the parameters of the trunk network connected in parallel may include:
[0129] The parameters of the fine-tuning branch network are linearly superimposed on the parameters of the bypass branches connected in parallel to achieve parameter fusion.
[0130] In some possible implementations, the general face recognition model may further include:
[0131] The image preprocessing module is used to perform face detection on the input face image and align the detected faces to obtain an aligned standard face image; the standard face image is used as the input of the backbone feature extraction module.
[0132] The present application also provides an electronic device in an embodiment. Fig.10 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, tablet computers, monitoring equipment, clock-in machines, wearable devices, servers, etc. Fig.10 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0133] like Fig.10 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603, to implement the face recognition model training method or face recognition method of the aforementioned embodiment of the present application. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in RAM 603. Processing device 601, ROM 602, and RAM 603 are connected to each other via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0134] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0135] An embodiment of the present application also provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any face recognition model training method or face recognition method provided in the embodiment of the present application.
[0136] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any face recognition model training method or face recognition method provided in an embodiment of the present application.
[0137] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0138] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0139] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0140] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0141] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
Claims
1. A face recognition model training method, characterized in that: include: Obtaining a universal face recognition model, wherein the universal face recognition model is a model pre-trained on a universal face data set, and comprises a backbone feature extraction module and a face attribute classification module, wherein the backbone feature extraction module is used to extract identity features from an input face image, and the face attribute classification module is used to predict an identity type matching the face image based on the identity features; Adding a fine-tuning branch network in the trunk feature extraction module, wherein the fine-tuning branch network is connected in parallel with the trunk network in the trunk feature extraction module; The universal face recognition model is trained on the configured heterogeneous face data set, and the parameters of the backbone network in the backbone feature extraction module are frozen during the training process to obtain the trained heterogeneous face recognition model.
2. The method according to claim 1, characterized in that Also includes: The parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module of the heterogeneous face recognition model are merged with the parameters of the parallel connected trunk network, and the fine-tuning branch network is removed to obtain a heterogeneous face recognition model with a simplified structure; Among them, before parameter fusion, the operation result obtained by the parallel structure of the backbone network and the fine-tuning branch network operating on the input data is the same as the operation result obtained by the backbone network operating on the input data after parameter fusion.
3. The method according to claim 1, characterized in that The backbone feature extraction module adopts a convolutional neural network with a bypass branch; The fine-tuning branch network is connected in parallel with the bypass branch in the convolutional neural network.
4. The method according to claim 3, characterized in that The fine-tuning branch network is a convolution layer having the same convolution kernel size as the bypass branch.
5. The method according to claim 2, characterized in that: The backbone feature extraction module adopts a convolutional neural network with a bypass branch, the fine-tuning branch network is a convolutional layer with the same convolution kernel size as the bypass branch, and the fine-tuning branch network is connected in parallel with the bypass branch in the convolutional neural network; Then, the process of fusing the parameters of the fine-tuning branch network connected in parallel to the trunk network in the trunk feature extraction module with the parameters of the trunk network connected in parallel includes: The parameters of the fine-tuning branch network are linearly superimposed on the parameters of the bypass branches connected in parallel to achieve parameter fusion.
6. The method according to any one of claims 1 to 5, characterized in that: The general face recognition model also includes: The image preprocessing module is used to perform face detection on the input face image and align the detected faces to obtain an aligned standard face image; The standard face image is used as input of the backbone feature extraction module.
7. A face recognition method, characterized in that: include: Get face image; Inputting the face image into a configured heterogeneous face recognition model to obtain a face recognition result output by the heterogeneous face recognition model; Among them, the heterogeneous face recognition model is a heterogeneous face recognition model obtained by using the face recognition model training method of any one of claims 1 to 6.
8. A face recognition model training device, characterized in that: include: A general model acquisition unit, used to acquire a general face recognition model, wherein the general face recognition model is a model pre-trained on a general face data set, and comprises a backbone feature extraction module and a face attribute classification module, wherein the backbone feature extraction module is used to extract identity features from an input face image, and the face attribute classification module is used to predict an identity type matching the face image based on the identity features; A model editing unit, used for adding a fine-tuning branch network in the trunk feature extraction module, wherein the fine-tuning branch network is connected in parallel with the trunk network in the trunk feature extraction module; The model fine-tuning unit is used to train the universal face recognition model on the configured heterogeneous face data set. The training process freezes the parameters of the backbone network in the backbone feature extraction module to obtain the trained heterogeneous face recognition model.
9. An electronic device, characterized in that: include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement the various steps of the face recognition model training method as described in any one of claims 1 to 6, or to implement the various steps of the face recognition method as described in claim 7.
10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the various steps of the face recognition model training method as described in any one of claims 1 to 6, or implements the various steps of the face recognition method as described in claim 7.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it implements the various steps of the face recognition model training method as described in any one of claims 1 to 6, or implements the various steps of the face recognition method as described in claim 7.
Citation Information
Cited By
Modularized face attribute structure analysis method and device, equipment and medium
CN119580318A
Training method of gate position distribution model and gate position distribution method
CN120654970A
