Face recognition method and device in presence of occlusion
By constructing a mask network and a residual network, and combining feature fusion and loss function optimization, the problem of balancing accuracy and training cost in face recognition models under occlusion scenarios is solved, thus improving the accuracy of face recognition models under occlusion scenarios.
Patent Information
- Application Number
- CN202211724240.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-12-30
AI Technical Summary
Existing technologies cannot balance accuracy and training cost in face recognition models under occluded scenarios, resulting in poor recognition performance of face recognition algorithms in such scenarios.
A mask network is constructed, utilizing global average pooling layers, fully connected layers, and activation layers, combined with residual networks and mask networks. The face recognition model is trained through feature fusion and loss function optimization, including the calculation of feature difference loss and classification loss values, and the updating of model parameters.
Without significantly increasing costs, the accuracy of face recognition models in occluded scenarios has been improved, solving the problems of accuracy and training cost in face recognition models in occluded scenarios.
Smart Images

Figure CN115862117B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of face recognition, and particularly relates to a face recognition method and device in the presence of occlusion. BACKGROUND
[0002] With the development of deep learning, the face recognition effect in general scenarios is getting better and better. However, in real scenarios, faces are often occluded by various objects such as masks and sunglasses. When these face data are subjected to face recognition, misrecognition often occurs, which seriously affects the promotion of face recognition algorithms. The existing algorithms for solving the problem of face recognition in the occlusion scenario include two kinds. The first kind is to generate a large amount of occlusion data, train a face recognition model through the occlusion data, and thus improve the accuracy of the face recognition model in the occlusion scenario. The second kind is to generate complete face features for the occluded face through a generation network, and then perform face recognition based on the complete face features. The first method is heavily dependent on the amount of training data, and the second method is dependent on the effect of the generation network. To improve the effect of the generation network, the generation network needs to be trained. Therefore, both the first method and the second method need to pay a considerable cost to improve the accuracy of the face recognition model in the occlusion scenario.
[0003] In the process of implementing the present disclosure, the inventors have found that the related art has at least the following technical problem: it cannot balance the accuracy of the face recognition model in the occlusion scenario and the cost of training the face recognition model. SUMMARY
[0004] Therefore, the embodiments of the present disclosure provide a face recognition method and device in the presence of occlusion, an electronic device and a computer readable storage medium, to solve the problem in the prior art that it cannot balance the accuracy of the face recognition model in the occlusion scenario and the cost of training the face recognition model.
[0005] In a first aspect, the present disclosure provides a face recognition method in the presence of an occlusion, comprising: constructing a mask network using a global average pooling layer, a fully connected layer and an activation layer, and constructing a face recognition model using a residual network and the mask network; obtaining a training data set, wherein the training data set comprises a first sample in the presence of an occlusion and a second sample in the absence of an occlusion belonging to a same target object; extracting a first sample feature of the first sample and a second sample feature of the second sample using the residual network respectively, and performing feature fusion processing on the first sample feature and the second sample feature to obtain a third sample feature; processing the third sample feature using the mask network to obtain a fourth sample feature and a fifth sample feature; multiplying the first sample feature and the fourth sample feature to obtain a sixth sample feature, and multiplying the second sample feature and the fifth sample feature to obtain a seventh sample feature; calculating a difference loss value based on the sixth sample feature and the seventh sample feature using a feature difference loss function, and calculating a classification loss value based on the sixth sample feature using a classification loss function; and updating model parameters of the face recognition model according to the difference loss value and the classification loss value to complete training of the face recognition model.
[0006] In a second aspect, the present disclosure provides a face recognition device in the presence of an occlusion, comprising: a construction module configured to construct a mask network using a global average pooling layer, a fully connected layer and an activation layer, and construct a face recognition model using a residual network and the mask network; an obtaining module configured to obtain a training data set, wherein the training data set comprises a first sample in the presence of an occlusion and a second sample in the absence of an occlusion belonging to a same target object; an extracting module configured to extract a first sample feature of the first sample and a second sample feature of the second sample using the residual network respectively, and perform feature fusion processing on the first sample feature and the second sample feature to obtain a third sample feature; a processing module configured to process the third sample feature using the mask network to obtain a fourth sample feature and a fifth sample feature; a multiplying module configured to multiply the first sample feature and the fourth sample feature to obtain a sixth sample feature, and multiply the second sample feature and the fifth sample feature to obtain a seventh sample feature; a calculating module configured to calculate a difference loss value based on the sixth sample feature and the seventh sample feature using a feature difference loss function, and calculate a classification loss value based on the sixth sample feature using a classification loss function; and a training module configured to update model parameters of the face recognition model according to the difference loss value and the classification loss value to complete training of the face recognition model.
[0007] In a third aspect, the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0008] In a fourth aspect, the present disclosure provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above method.
[0009] Compared with the prior art, the present disclosure has the beneficial effects that: the present disclosure constructs a mask network by using a global average pooling layer, a full connection layer and an activation layer, constructs a face recognition model by using a residual network and the mask network, obtains a training data set, wherein the training data set includes a first sample with occlusion and a second sample without occlusion belonging to the same target object, extracts a first sample feature of the first sample and a second sample feature of the second sample by using the residual network, and performs feature fusion processing on the first sample feature and the second sample feature to obtain a third sample feature, processes the third sample feature by using the mask network to obtain a fourth sample feature and a fifth sample feature, multiplies the first sample feature and the fourth sample feature to obtain a sixth sample feature, multiplies the second sample feature and the fifth sample feature to obtain a seventh sample feature, calculates a difference loss value by using a feature difference loss function based on the sixth sample feature and the seventh sample feature, calculates a classification loss value by using a classification loss function based on the sixth sample feature, and updates model parameters of the face recognition model according to the difference loss value and the classification loss value to complete the training of the face recognition model. Therefore, by using the above technical means, the problem that the precision of the face recognition model in the occlusion scene and the cost of training the face recognition model cannot be considered in the prior art can be solved, and the precision of the face recognition model in the occlusion scene can be improved without incurring huge costs. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without any creative effort.
[0011] Figure 1 is a scene schematic diagram of an application scenario of the present disclosure;
[0012] Figure 2 is a flow schematic diagram of a face recognition method with occlusion provided by the present disclosure;
[0013] Figure 3 is a structural schematic diagram of a face recognition device with occlusion provided by the present disclosure;
[0014] Figure 4 is a structural schematic diagram of an electronic device provided by the present disclosure. DETAILED DESCRIPTION
[0015] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular sequences of acts, in order to thoroughly describe the embodiments of the present disclosure. However, it will be apparent to those skilled in the art that the present disclosure can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, and circuits are omitted so as not to obscure the description of the present disclosure.
[0016] A face recognition method and device for an occluded face will be described in detail below with reference to the accompanying drawings.
[0017] Figure 1 FIG. 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure. The application scenario can include terminal devices 101, 102, and 103, a server 104, and a network 105.
[0018] The terminal devices 101, 102, and 103 can be hardware or software. When the terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with a display screen and supporting communication with the server 104, including but not limited to a smart phone, a tablet computer, a laptop computer, and a desktop computer, etc. When the terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices as above. The terminal devices 101, 102, and 103 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure do not limit this. Further, the terminal devices 101, 102, and 103 can have various applications installed thereon, such as a data processing application, an instant messaging tool, a social platform software, a search application, a shopping application, etc.
[0019] The server 104 can be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection therewith. The background server can receive and analyze the request sent by the terminal device, etc., and generate a processing result. The server 104 can be a single server, a server cluster composed of several servers, or a cloud computing service center, and the embodiments of the present disclosure do not limit this.
[0020] It should be noted that the server 104 can be hardware or software. When the server 104 is hardware, it can be various electronic devices that provide various services for the terminal devices 101, 102 and 103. When the server 104 is software, it can be multiple software or software modules that provide various services for the terminal devices 101, 102 and 103, or a single software or software module that provides various services for the terminal devices 101, 102 and 103, and the embodiments of the present disclosure do not make any restrictions thereon.
[0021] The network 105 can be a wired network that adopts coaxial cables, twisted pairs and optical fibers, or a wireless network that can realize interconnection of various communication devices without wiring, for example, Bluetooth, Near Field Communication (NFC), Infrared, etc., and the embodiments of the present disclosure do not make any restrictions thereon.
[0022] The user can establish a communication connection with the server 104 via the network 105 through the terminal devices 101, 102 and 103 to receive or send information, etc. It should be noted that the specific types, quantities and combinations of the terminal devices 101, 102 and 103, the server 104 and the network 105 can be adjusted according to the actual needs of the application scenarios, and the embodiments of the present disclosure do not make any restrictions thereon.
[0023] Figure 2 is a flowchart of a face recognition method in the presence of an occlusion provided by the embodiments of the present disclosure. Figure 2 The face recognition method in the presence of an occlusion can be executed by Figure 1 a computer or a server, or software on the computer or the server. As shown in Figure 2 the face recognition method in the presence of an occlusion includes:
[0024] S201, constructing a mask network by using a global average pooling layer, a full connection layer and an activation layer, and constructing a face recognition model by using a residual network and the mask network;
[0025] S202, obtaining a training data set, wherein the training data set includes a first sample in the presence of an occlusion and a second sample in the absence of an occlusion of a same target object;
[0026] It can be understood that the training data set includes a large number of first samples and second samples of target objects, and in the embodiments of the present disclosure, the first sample and the second sample are of the same target object, and for the convenience of understanding, the training data set can be understood as having only one target object and the first sample and the second sample of the target object.
[0027] S203, the first sample feature of first sample and the second sample feature of second sample are extracted respectively by using residual network, and the first sample feature and the second sample feature are processed by feature fusion, to obtain third sample feature;
[0028] S204, the third sample feature is processed by using mask network to obtain fourth sample feature and fifth sample feature;
[0029] The activation layer comprises: a first activation layer and a second activation layer, and the fourth sample feature is the output of the first activation layer and the output of the second activation layer of the fifth sample feature.
[0030] S205, the first sample feature and the fourth sample feature are multiplied to obtain the sixth sample feature, and the second sample feature and the fifth sample feature are multiplied to obtain the seventh sample feature;
[0031] This step is realized by the multiplication network layer in the face recognition model.
[0032] S206, based on the sixth sample feature and the seventh sample feature, the difference loss value is calculated by using the feature difference loss function, and based on the sixth sample feature, the classification loss value is calculated by using the classification loss function;
[0033] The feature difference loss function can be realized by using the function of calculating similarity, the higher the similarity, the smaller the difference loss value; the classification loss function can be cross entropy loss function.
[0034] S207, the model parameters of the face recognition model are updated according to the difference loss value and the classification loss value, to complete the training of the face recognition model.
[0035] In updating the model parameters of the face recognition model, the model parameters of the residual network and the mask network need to be updated.
[0036] According to the technical scheme provided by the embodiment of the present disclosure, the global average pooling layer, the full connection layer and the activation layer are used to construct the mask network, the residual network and the mask network are used to construct the face recognition model; a training data set is obtained, wherein the training data set includes a first sample with occlusion and a second sample without occlusion belonging to the same target object; the residual network is used to extract the first sample feature of the first sample and the second sample feature of the second sample respectively, and the first sample feature and the second sample feature are subjected to feature fusion processing to obtain a third sample feature; the mask network is used to process the third sample feature to obtain a fourth sample feature and a fifth sample feature; the first sample feature and the fourth sample feature are multiplied to obtain a sixth sample feature, and the second sample feature and the fifth sample feature are multiplied to obtain a seventh sample feature; based on the sixth sample feature and the seventh sample feature, a feature difference loss function is used to calculate a difference loss value, and based on the sixth sample feature, a classification loss function is used to calculate a classification loss value; the model parameters of the face recognition model are updated according to the difference loss value and the classification loss value to complete the training of the face recognition model, so that the above technical means can solve the problem that the precision of the face recognition model in the occlusion scene and the cost of training the face recognition model cannot be considered in the prior art, thereby improving the precision of the face recognition model in the occlusion scene without incurring huge cost.
[0037] The mask network is constructed by using the global average pooling layer, the full connection layer and the activation layer, including: using the global average pooling layer followed by the full connection layer, using the full connection layer followed by the first activation layer and the second activation layer respectively, to obtain the mask network; wherein the activation layer includes the first activation layer and the second activation layer, and the first activation layer and the second activation layer are parallel in the mask network, and the outputs of the first activation layer and the second activation layer are two outputs of the mask network.
[0038] For example, the first activation layer is 1-sigmoid, and the second activation layer is sigmoid.
[0039] The face recognition model is constructed by using the residual network and the mask network, including: connecting the residual network and the mask network, connecting the residual network and the mask network followed by a multiplication network layer, connecting the multiplication network layer followed by a full connection layer, to obtain the face recognition model.
[0040] The training data set is obtained, including: when there is only the second sample in the training data set, generating occlusion for the second sample to obtain the first sample corresponding to the second sample.
[0041] The embodiment of the present disclosure is a data enhancement processing of generating occlusion for the training data set.
[0042] Based on the sixth sample feature, a classification loss value is calculated using a classification loss function, including: the sixth sample feature is processed through a full connection layer to obtain a recognition result of the first sample, and the classification loss value between the recognition result of the first sample and a label is calculated using the classification loss function.
[0043] The full connection layer through which the sixth sample feature passes is a full connection layer connected after a multiplication network layer in the face recognition model, and is not a full connection layer in the mask network, but the network structure of the full connection layer connected after the multiplication network layer in the mask network can be the same.
[0044] After the training of the face recognition model is completed, the method further includes: inputting a face picture to be recognized into the face recognition model after the training is completed; extracting a first picture feature of the face picture using the residual network; processing the first picture feature using the mask network to obtain a second picture feature, wherein the second picture feature is output by a first activation layer of the mask network; multiplying the first picture feature and the second picture feature to obtain a third picture feature; processing the third picture feature through a full connection layer to obtain a recognition result of the face picture.
[0045] Different from the training of the face recognition model, the face recognition model is used for face recognition: because the face picture is only one, the output of the residual network is only one, and therefore there is no feature fusion processing; in the recognition process, the second activation layer of the mask network is not used, and the output of the mask network can be regarded as only the second picture feature; because the outputs of the residual network and the mask network are only one, the feature multiplication is only one time.
[0046] After the training of the face recognition model is completed, the method further includes: removing the mask network from the face recognition model to simplify the model structure of the face recognition model; and using the face recognition model after the simplification for face recognition.
[0047] In fact, because the mask network is removed, the multiplication network layer is also removed. That is, the face recognition model after the simplification is the residual network connected with the full connection layer.
[0048] The face picture to be recognized is input into the face recognition model after the simplification; the first picture feature of the face picture is extracted using the residual network; and the first picture feature is processed through the full connection layer to obtain the recognition result of the face picture.
[0049] All the optional technical solutions described above can be combined to form optional embodiments of the present application, and will not be repeated here.
[0050] The following is an apparatus embodiment of the present disclosure, which can be used to execute the method embodiments of the present disclosure. For details not disclosed in the apparatus embodiments of the present disclosure, please refer to the method embodiments of the present disclosure.
[0051] Figure 3 is a schematic view of a face recognition device with occlusion provided by an embodiment of the present disclosure. As shown in the figure, the face recognition device with occlusion includes: Figure 3
[0052] The construction module 301 is configured to construct a mask network by using a global average pooling layer, a full connection layer and an activation layer, and construct a face recognition model by using a residual network and the mask network.
[0053] The acquisition module 302 is configured to acquire a training data set, wherein the training data set includes a first sample with occlusion and a second sample without occlusion belonging to a same target object.
[0054] The extraction module 303 is configured to extract a first sample feature of the first sample and a second sample feature of the second sample by using the residual network respectively, and perform feature fusion processing on the first sample feature and the second sample feature to obtain a third sample feature.
[0055] The processing module 304 is configured to process the third sample feature by using the mask network to obtain a fourth sample feature and a fifth sample feature.
[0056] The multiplication module 305 is configured to multiply the first sample feature and the fourth sample feature to obtain a sixth sample feature, and multiply the second sample feature and the fifth sample feature to obtain a seventh sample feature.
[0057] The calculation module 306 is configured to calculate a difference loss value by using a feature difference loss function based on the sixth sample feature and the seventh sample feature, and calculate a classification loss value by using a classification loss function based on the sixth sample feature.
[0058] The training module 307 is configured to update model parameters of the face recognition model according to the difference loss value and the classification loss value, so as to complete the training of the face recognition model.
[0059] According to the technical scheme provided by the embodiment of the present disclosure, a global average pooling layer, a full connection layer and an activation layer are used to construct a mask network, a residual network and the mask network are used to construct a face recognition model; a training data set is obtained, wherein the training data set includes a first sample with occlusion and a second sample without occlusion belonging to the same target object; the residual network is used to extract a first sample feature of the first sample and a second sample feature of the second sample respectively, and the first sample feature and the second sample feature are subjected to feature fusion processing to obtain a third sample feature; the mask network is used to process the third sample feature to obtain a fourth sample feature and a fifth sample feature; the first sample feature and the fourth sample feature are multiplied to obtain a sixth sample feature, and the second sample feature and the fifth sample feature are multiplied to obtain a seventh sample feature; based on the sixth sample feature and the seventh sample feature, a feature difference loss function is used to calculate a difference loss value, and based on the sixth sample feature, a classification loss function is used to calculate a classification loss value; the model parameters of the face recognition model are updated according to the difference loss value and the classification loss value to complete the training of the face recognition model, so that the above technical means can solve the problem that the precision of the face recognition model in the occlusion scene and the cost of training the face recognition model cannot be considered in the prior art, and thus the precision of the face recognition model in the occlusion scene is improved without incurring huge cost.
[0060] Optionally, the constructing module 301 is further configured to use a global average pooling layer followed by a full connection layer, use the full connection layer followed by a first activation layer and a second activation layer respectively, to obtain a mask network; wherein the activation layer includes the first activation layer and the second activation layer, and the first activation layer and the second activation layer are parallel in the mask network, and the outputs of the first activation layer and the second activation layer are two outputs of the mask network.
[0061] For example, the first activation layer is 1-sigmoid, and the second activation layer is sigmoid.
[0062] Optionally, the constructing module 301 is further configured to connect the residual network and the mask network, connect the residual network and the mask network followed by a multiplication network layer, connect the multiplication network layer followed by a full connection layer, to obtain the face recognition model.
[0063] Optionally, the obtaining module 302 is further configured to, when only the second sample exists in the training data set, generate occlusion for the second sample to obtain the first sample corresponding to the second sample.
[0064] The embodiment of the present disclosure is a data enhancement processing of generating occlusion for the training data set.
[0065] Optionally, the calculating module 306 is further configured to process the sixth sample feature through the full connection layer to obtain a recognition result of the first sample, and calculate a classification loss value between the recognition result of the first sample and a label by using the classification loss function.
[0066] The sixth sample feature passing full connection layer is a full connection layer connected after a multiplication network layer in a face recognition model, and is not a full connection layer in a mask network. However, the network structure of the full connection layer connected after the multiplication network layer in the mask network can be the same.
[0067] Optionally, the training module 307 is further configured to input the face picture to be recognized into the face recognition model after training; extract a first picture feature of the face picture by using the residual network; process the first picture feature by using the mask network to obtain a second picture feature, wherein the second picture feature is output by a first activation layer of the mask network; multiply the first picture feature and the second picture feature to obtain a third picture feature; and process the third picture feature by using a full connection layer to obtain a recognition result of the face picture.
[0068] Different from training the face recognition model, the face recognition model is used for face recognition: because the face picture is only one, the output of the residual network is only one, and therefore there is no feature fusion processing; in the recognition process, the second activation layer of the mask network is not used, and the output of the mask network can be regarded as only the second picture feature; because the outputs of the residual network and the mask network are only one, the feature multiplication is only one time.
[0069] Optionally, the training module 307 is further configured to remove the mask network from the face recognition model to simplify the model structure of the face recognition model; and use the face recognition model after simplification for face recognition.
[0070] In fact, because the mask network is removed, the multiplication network layer is also removed. That is, the face recognition model after simplification is a residual network connected with a full connection layer. The face picture to be recognized is input into the face recognition model after simplification; the first picture feature of the face picture is extracted by using the residual network; and the first picture feature is processed by using the full connection layer to obtain a recognition result of the face picture.
[0071] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0072] Figure 4 is a schematic diagram of an electronic device 4 provided by the embodiments of the present disclosure. As shown in Figure 4As shown, the electronic device 4 of this embodiment includes a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. The processor 401 implements the steps in each of the above method embodiments when executing the computer program 403. Alternatively, the processor 401 implements the functions of each module / unit in each of the above apparatus embodiments when executing the computer program 403.
[0073] The electronic device 4 can be a desktop computer, a notebook computer, a palm computer, a cloud server, or the like. The electronic device 4 can include but is not limited to the processor 401 and the memory 402. Those skilled in the art can understand that the electronic device 4 can include more or less components, or different components than those shown. Figure 4 The electronic device 4 is merely an example and does not constitute a limitation on the electronic device 4, which can include more or less components, or different components than those shown.
[0074] The processor 401 can be a central processing unit (CPU), or other general purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like.
[0075] The memory 402 can be an internal storage unit of the electronic device 4, such as a hard disk or a memory of the electronic device 4. The memory 402 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like. The memory 402 can also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.
[0076] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0077] If the integrated module / unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be instructed by a computer program to related hardware, and the computer program can be stored in a computer readable storage medium. The computer program can be executed by a processor to implement the steps of each method embodiment described above. The computer program can include computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium can include any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content included in the computer readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0078] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than limit them; although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure.
Claims
1. A face recognition method in the presence of occlusion, characterized in that, The method comprises the following steps: constructing a mask network by using a global average pooling layer, a full connection layer and an activation layer, and constructing a face recognition model by using a residual network and the mask network; obtaining a training data set, wherein the training data set comprises a first sample with occlusion and a second sample without occlusion belonging to a same target object; extracting a first sample feature of the first sample and a second sample feature of the second sample by using the residual network, and performing feature fusion processing on the first sample feature and the second sample feature to obtain a third sample feature; processing the third sample feature by using the mask network to obtain a fourth sample feature and a fifth sample feature; multiplying the first sample feature and the fourth sample feature to obtain a sixth sample feature, and multiplying the second sample feature and the fifth sample feature to obtain a seventh sample feature; calculating a difference loss value by using a feature difference loss function based on the sixth sample feature and the seventh sample feature, and calculating a classification loss value by using a classification loss function based on the sixth sample feature; updating model parameters of the face recognition model according to the difference loss value and the classification loss value to complete training of the face recognition model.
2. The method of claim 1, wherein, The method for constructing a mask network by using a global average pooling layer, a full connection layer and an activation layer comprises the following steps: using the global average pooling layer followed by the full connection layer, using the full connection layer followed by a first activation layer and a second activation layer respectively, and obtaining the mask network; wherein the activation layer comprises the first activation layer and the second activation layer, the first activation layer and the second activation layer are parallel in the mask network, and the outputs of the first activation layer and the second activation layer are two outputs of the mask network.
3. The method of claim 1, wherein, The method for constructing a face recognition model by using a residual network and the mask network comprises the following steps: connecting the residual network and the mask network, connecting the residual network and the mask network followed by a multiplication network layer, connecting the multiplication network layer followed by the full connection layer, and obtaining the face recognition model.
4. The method of claim 1, wherein, The method for obtaining a training data set comprises the following steps: when only the second sample exists in the training data set, generating occlusion for the second sample to obtain the first sample corresponding to the second sample.
5. The method of claim 1, wherein, The method for calculating a classification loss value based on the sixth sample feature by using a classification loss function comprises the following steps: processing the sixth sample feature by using the full connection layer to obtain a recognition result of the first sample, and calculating a classification loss value between the recognition result of the first sample and a label by using a classification loss function.
6. The method of claim 1, wherein, After completing the training of the face recognition model, the method further comprises the following steps: inputting a face picture to be recognized into the face recognition model after the training is completed; extracting a first picture feature of the face picture by using the residual network; processing the first picture feature by using the mask network to obtain a second picture feature, wherein the second picture feature is output by a first activation layer of the mask network; multiplying the first picture feature and the second picture feature to obtain a third picture feature; The third picture feature is processed through the full connection layer to obtain a recognition result of the face picture.
7. The method of claim 1, wherein, After the training of the face recognition model is completed, the method further includes: The mask network is removed from the face recognition model to simplify a model structure of the face recognition model. The face recognition is performed using the simplified face recognition model. 8.A face recognition device in the presence of an occlusion, characterized in that, Comprise: The constructing module is configured to construct a mask network using a global average pooling layer, a full connection layer and an activation layer, and construct a face recognition model using a residual network and the mask network; The acquiring module is configured to acquire a training data set, wherein the training data set comprises a first sample with occlusion and a second sample without occlusion belonging to a same target object; The extracting module is configured to extract a first sample feature of the first sample and a second sample feature of the second sample using the residual network respectively, and perform feature fusion processing on the first sample feature and the second sample feature to obtain a third sample feature; The processing module is configured to process the third sample feature using the mask network to obtain a fourth sample feature and a fifth sample feature; The multiplying module is configured to multiply the first sample feature and the fourth sample feature to obtain a sixth sample feature, and multiply the second sample feature and the fifth sample feature to obtain a seventh sample feature; The computing module is configured to calculate a difference loss value using a feature difference loss function based on the sixth sample feature and the seventh sample feature, and calculate a classification loss value using a classification loss function based on the sixth sample feature; The training module is configured to update model parameters of the face recognition model according to the difference loss value and the classification loss value to complete the training of the face recognition model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the steps of the method in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 7.
Citation Information
Patent Citations
Image processing method and system, terminal equipment and storage medium
CN114926520A
Multi-granularity academic emotion recognition method combined with context information
CN115346259A