A face recognition method, device and storage medium
By using convolutional neural networks for feature extraction and similarity assessment, the problem of defending against local face spoofing attacks in face recognition systems has been solved. This enables fine-grained analysis and rapid identification of local spoofing, thereby improving the system's security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2026-03-24
AI Technical Summary
Existing facial recognition systems are unable to effectively defend against partial facial spoofing attacks, leading to a decline in the security of identity authentication.
Convolutional neural networks are used for feature extraction. By extracting features from the face image of the first object, the first face feature vector and the first region block feature vector are obtained. The similarity is used to determine whether there is a face region attack. The similarity of the feature vectors is determined by Hadamard product and linear programming, and fine-grained analysis is performed to identify local spoofing.
It improves the security of facial recognition, enabling it to quickly identify and defend against localized facial spoofing attacks, output attack alarm information, and display the attack area.
Smart Images

Figure CN115273181B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of facial recognition technology, and in particular to a facial recognition method, device and storage medium. Background Technology
[0002] With the development of facial recognition technology, it has been widely used in various fields such as identity authentication, attendance, and payment. Various attack methods targeting facial recognition systems have also emerged. For example, attackers can use images, videos, masks, head models, etc., of the target to disguise themselves and thus pass the facial recognition system's authentication. For non-live attackers, the facial recognition system can identify and refuse authentication. However, if an attacker uses partial facial feature information to disguise themselves and appears to be alive, the facial recognition system is highly likely to pass the authentication, causing property damage or security risks to the target.
[0003] Therefore, how to defend against localized face spoofing attacks is an urgent problem that needs to be solved. Summary of the Invention
[0004] This application provides a face recognition method to resist local face spoofing attacks and improve the security of face recognition attacks.
[0005] Firstly, a facial recognition method is provided, including:
[0006] Based on a convolutional neural network, feature extraction is performed on the face image of a first object to obtain a first face feature vector and a first region block feature vector. The features in the first region block feature vector are the features output by a specified layer in the convolutional neural network when feature extraction is performed on the face image of the first object, and the features in the first face feature vector are the features output by the last layer of the convolutional neural network when feature extraction is performed on the face image of the first object. A second face feature vector is determined from the face feature vectors based on the similarity between the first face feature vector and each face feature vector in the feature library. If the similarity between the first face feature vector and the second face feature vector meets a first requirement, the similarity between the first region block feature vector and the second region block feature vector is determined. The second region block feature vector is the feature output by the specified layer in the convolutional neural network when extracting the second face feature vector. The face region attack result of the first object is determined based on the similarity between the first region block feature vector and the second region block feature vector.
[0007] In one possible implementation, determining the similarity between the feature vector of the first region block and the feature vector of the second region block includes:
[0008] A first matrix is defined, which is an N*N dimensional matrix, where N is the number of features contained in the feature vector of the first region block or the feature vector of the second region block, and the elements d in the first matrix are defined. ij The similarity between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block is represented. A second matrix is determined based on the first matrix and the cost function. The second matrix is an N*N dimensional matrix, and the elements f in the second matrix... ij The first matrix represents the degree of importance between the i-th feature in the first region block feature vector and the j-th feature in the second region block feature vector. The second matrix is used to minimize the value of the cost function, and the value of the cost function is the Hadamard product of the first matrix and the second matrix. Based on the first matrix and the second matrix, the similarity between the first region block feature vector and the second region block feature vector is determined.
[0009] In one possible implementation, f in the second matrix ij It satisfies the following constraints:
[0010] The f ij The sum of rows i in the first region block feature vector is less than or equal to the weight of the i-th feature; where i = 1, 2, 3, ..., N, j = 1, 2, 3, ..., N; the sum of rows i in the first region block feature vector is less than or equal to the weight of the i-th feature; where i = 1, 2, 3, ..., N; the sum of rows i in the first region block feature vector is less than or equal to the weight of the i-th feature ij The sum of column j in the f_j column is less than or equal to the weight of the j-th feature in the feature vector of the second region block; ij The sum of the accumulated products is equal to the minimum value between the sum of the weights of the i-th feature in the feature vector of the first region block and the sum of the weights of the j-th feature in the feature vector of the second region block.
[0011] In one possible implementation, the weight of the i-th feature in the first region block feature vector is determined based on the feature mean of the i-th feature in the first region block feature vector and the feature mean of the second region block feature vector;
[0012] The weight of the j-th feature in the second region block feature vector is determined based on the feature mean of the j-th feature in the second region block feature vector and the feature mean of the first region block feature vector.
[0013] In one possible implementation, determining the similarity between the feature vectors of the first and second regions based on the first and second matrices includes:
[0014] The Hadamard product of the first matrix and the second matrix is normalized to obtain the similarity between the feature vectors of the first region block and the feature vectors of the second region block.
[0015] In one possible implementation, determining the face region attack result of the first object based on the similarity between the feature vector of the first region block and the feature vector of the second region block includes:
[0016] If the similarity between the feature vector of the first region block and the feature vector of the second region block meets the second requirement, then it is determined that the first object is not subject to face region attacks; otherwise, the first object is subject to face region attacks.
[0017] In one possible implementation, the second face feature vector is the face feature vector corresponding to the maximum similarity between the first face feature vector and each face feature vector in the feature library.
[0018] Secondly, a facial recognition device is provided, comprising:
[0019] A face image feature extraction module is used to extract features from a face image of a first object based on a convolutional neural network, obtaining a first face feature vector and a first region block feature vector; wherein, the features in the first region block feature vector are features output by a specified layer in the convolutional neural network when extracting features from the face image of the first object, and the features in the first face feature vector are features output by the last layer in the convolutional neural network when extracting features from the face image of the first object; a first determining module is used to determine a second face feature vector from the face feature vectors based on the similarity between the first face feature vector and each face feature vector in the feature library; a second determining module is used to determine the similarity between the first region block feature vector and the second region block feature vector if the first determining module determines that the similarity between the first face feature vector and the second face feature vector meets a first requirement; wherein, the second region block feature vector is a feature output by the specified layer in the convolutional neural network when extracting the second face feature vector; a third determining module is used to determine the face region attack result of the first object based on the similarity between the first region block feature vector and the second region block feature vector.
[0020] Thirdly, an electronic device is provided, comprising:
[0021] A memory for storing computer programs; a processor for executing the computer programs stored in the memory, performing the method as described in any of the first aspects.
[0022] Fourthly, a readable computer storage medium is provided, the computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method as described in any of the first aspects.
[0023] In this embodiment, feature extraction is performed on the face image of the first object to obtain a first face feature vector and a first region block feature vector. The similarity between the first face feature vector and the second face feature vector is then determined to meet a first requirement. This allows for a coarse-grained overall assessment of the extracted features, enabling rapid identification of the face state. Furthermore, when the first requirement is met, the similarity between the first region block feature vector and the second region block feature vector is determined. Based on this similarity, the face region attack result of the first object is determined. This allows for a fine-grained local assessment of the extracted features, thereby resisting local face spoofing attacks and improving the security of face recognition attacks. Attached Figure Description
[0024] Figure 1 A flowchart of a face recognition method provided in this application embodiment;
[0025] Figure 2 This application provides a schematic diagram of face recognition logic;
[0026] Figure 3 This is a schematic diagram of the structure of a face recognition device provided in an embodiment of this application;
[0027] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.
[0030] (1) In the embodiments of this application, the terms “network” and “system” are often used interchangeably, but those skilled in the art can understand their meaning.
[0031] (2) In the embodiments of this application, the term “multiple” refers to two or more, and other quantifiers are similar.
[0032] (3) "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three cases: A alone, A and B at the same time, and B alone. The character " / " generally indicates that the related objects before and after it are in an "or" relationship.
[0033] (4) Face region attack refers to an attacker (the first target) using partial regional features (such as eyes, nose, etc.) of the attacked person's (the target's) face image and editing them to disguise the corresponding regional features of their own face image to attack the face recognition system. For example, the attacker might edit the features of the attacked person's eyes to disguise them as features of their own eyes to attack the face recognition system.
[0034] In facial recognition scenarios, feature extraction from facial images often focuses on the most representative features, such as the eyes and nose. If this part of the face is spoofed, the extracted features will be highly similar to the features of the attacked person, resulting in misidentification.
[0035] In this application, a feature library can be pre-defined, which can be used to store the facial feature vectors of the attacker (target object), and further, can also store the facial region block feature vectors of the attacker.
[0036] In view of this, Figure 1 This application provides a flowchart of a face recognition method. The process can be executed by a face recognition device, which can be implemented in software, hardware, or a combination of both. As shown in the figure, the process includes the following steps:
[0037] 101: Based on a convolutional neural network, feature extraction is performed on the face image of the first object to obtain a first face feature vector and a first region block feature vector. The features in the first region block feature vector (which can be called patch features) are the features output by a specified layer in the convolutional neural network when feature extraction is performed on the face image of the first object. The features in the first face feature vector are the features output by the last layer of the convolutional neural network when feature extraction is performed on the face image of the first object.
[0038] This convolutional neural network can be composed of pooling layers, fully connected layers, and several convolutional layers. When extracting features from the face image of a first object, it can output multi-dimensional features. For example, the fully connected layer outputs the first facial feature vector of the first object, and the features output by the convolutional layer are specified as the first region block feature vector. If the feature dimension output by this layer is 1*C*H*W, then the first region block feature vector is extracted with C channels as the dimension. Any feature dimension is 1*C, resulting in a total of N = H*W features. This is more comprehensive and applicable than traditional models that can only output one-dimensional facial features. By specifying different output layers, the extracted features can be represented at different granularities. If H*W is larger, the granularity is finer, allowing for the monitoring of finer features; if H*W is smaller, the granularity is larger, reducing the computational load. It can be flexibly adjusted according to actual needs.
[0039] 102: After extracting the first face feature vector, determine the second face feature vector from each face feature vector in the feature library based on the similarity between the first face feature vector and each face feature vector in the feature library.
[0040] Optionally, the second face feature vector is the face feature vector with the highest similarity among the first face feature vector and the face feature vectors in the feature library. The determined second face feature vector can be called the face feature vector of the attacked party (target object).
[0041] Optionally, the similarity can be determined using algorithms such as cosine distance or Euclidean distance.
[0042] 103: Determine whether the similarity between the first face feature vector and the second face feature vector meets the first requirement. If yes, proceed to 104; otherwise, output the face recognition result as failure.
[0043] Optionally, similarity can be determined based on a set first threshold. For example, if the similarity between the first facial feature vector and the second facial feature vector exceeds the first threshold, it indicates that the similarity meets the first requirement, and the process proceeds to step 104; otherwise, it indicates that the first object and the target object are not the same person, and the facial recognition result is output as failed.
[0044] 104: Determine the similarity between the feature vector of the first region block and the feature vector of the second region block. The feature vector of the second region block is the feature output of a specified layer in the convolutional neural network when extracting the second face feature vector.
[0045] The feature vector of the first region block of the first object satisfies the following expression:
[0046] Q={(q1,ω q1 ),.....,(q N ,ω qN )}..........(1)
[0047] Where Q is the feature vector of the first region block, q1 is the first feature output of the specified layer in the convolutional neural network when performing feature extraction on the face image of the first object, and each feature represents the representation of a certain region block of the face image, such as the left eye, nose, right corner of the mouth, etc., ω q1 This represents the weight corresponding to the first feature in the feature vector of the first region block.
[0048] The second region block feature vector of the target object satisfies the following expression:
[0049] G={(g1,ω g1 ),.....,(gN ,ω gN )}..........(2)
[0050] Where Q is the feature vector of the second region block, g1 is the first feature output of the specified layer in the convolutional neural network when performing feature extraction on the face image of the target object, and ω g1 This is the weight corresponding to the first feature in the feature vector of the second region block.
[0051] Due to q1 to q N Based on the features output by a specified layer in a convolutional neural network, the above expression allows for representation at different granularities (e.g., the larger H*W is, the finer the granularity). By selecting features with different output sizes, the tolerance for the size of features from the attacker (the first target) can be controlled. Finer granularity allows for the detection of smaller features and can also be adaptively adjusted based on actual conditions.
[0052] Optionally, the similarity between the feature vector of the first region block and the feature vector of the second region block can be calculated as follows: A first matrix is determined, which is an N*N dimensional matrix, where N is the number of features in either the feature vector of the first region block or the feature vector of the second region block, and the elements d in the first matrix... ij This represents the similarity between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block; a second matrix is determined based on the first matrix and the cost function. This second matrix is an N*N dimensional matrix, and the elements f in the second matrix... ij This indicates the degree of correlation between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block. ij The second matrix, which can be obtained by solving linear programming, is used to minimize the value of the cost function. The value of the cost function is the Hadamard product of the first and second matrices. Based on the first and second matrices, the similarity between the feature vectors of the first and second regions is determined.
[0053] The cost function satisfies the following expression:
[0054] Where F represents the second matrix.
[0055] Optionally, the second matrix satisfies the following constraints:
[0056] f ij The summation of row i in the first region block feature vector is less than or equal to the weight of the i-th feature; where i = 1, 2, 3, ..., N, j = 1, 2, 3, ..., N; f ij The sum of column j in f is less than or equal to the weight of the j-th feature in the feature vector of the second region block;ij The sum of these products equals the minimum value between the sum of the weights of the i-th feature in the feature vector of the first region block and the sum of the weights of the j-th feature in the feature vector of the second region block. Specifically, it can satisfy the following expression:
[0057]
[0058]
[0059]
[0060] Where, ω pi ω represents the weight of the i-th feature in the feature vector of the first region block. gj This represents the weight of the j-th feature in the feature vector of the second region block, and min represents the minimum value operator.
[0061] Optionally, the weight (ω) of the i-th feature in the feature vector of the first region block. pi The feature vector of the second region block is determined based on the mean of the features of the i-th feature in the feature vector of the first region block and the feature vector of the second region block. gj The weight of the j-th feature in the first region block feature vector is determined based on the mean of the features of the j-th feature in the second region block feature vector and the feature vector of the first region block. Optionally, the above ω pi , and ω gj It satisfies the following formula:
[0062]
[0063]
[0064] Where, q i ω is the i-th feature in the feature vector of the first region block. g g is the mean feature value of the feature vector of the second region block. j ω is the j-th feature in the feature vector of the second region block. q Let be the feature mean of the feature vector of the first region block, dis represent the distance operator, and max represent the maximum value operator.
[0065] The ω qi The larger the value of ω, the more important the i-th feature of the first region block feature vector of the first object is. For example, the region blocks containing facial features such as eyes, nose, and mouth have higher weights. Similarly, ω gj The larger the value, the more important the j-th feature of the second region block feature vector of the target object is.
[0066] In other embodiments, it can be defined Treat each feature as equally important, and apply this to ω.qi and ω gj Normalization is performed to make
[0067] Optionally, the similarity between the feature vectors of the first and second regions can be determined by normalizing the Hadamard product of the first and second matrices to obtain the similarity between the feature vectors of the first and second regions.
[0068] Optionally, the similarity between the feature vector of the first region block and the feature vector of the second region block satisfies the following formula:
[0069]
[0070] Wherein, EMD(Q,G) is the similarity between the feature vectors of the first region block and the feature vectors of the second region block.
[0071] In this embodiment of the application, based on the EMD algorithm, more granular feature analysis is performed on the extracted features to prevent attackers (the first object) from performing local texture camouflage.
[0072] 105: Determine the face region attack result of the first object based on the similarity between the feature vector of the first region block and the feature vector of the second region block.
[0073] Optionally, if the similarity between the feature vector of the first region block and the feature vector of the second region block meets the second requirement, such as being greater than or equal to a second set threshold, then it is determined that the first object does not have a face region attack; otherwise, the first object has a face region attack.
[0074] In some embodiments, during the identification process, when it is determined that the first object has local feature spoofing (face region attack), an attack alarm message can be output. Furthermore, the information of the region where the face attack spoofing is located can be selectively output, thereby rejecting the current identification. Specifically, if the similarity between the feature vector of the first region block and the feature vector of the second region block is less than a set second threshold, the elements of the aforementioned second matrix can be sorted to determine the position of the element with the larger value, indicating that the feature corresponding to that position may have attack behavior (a partial face image of the target object pasted on it), which can be used as the display of the region information where the face attack spoofing is located.
[0075] In this embodiment, feature extraction is performed on the face image of the first object to obtain a first face feature vector and a first region block feature vector. The similarity between the first face feature vector and the second face feature vector is then determined to meet a first requirement. This allows for a coarse-grained overall assessment of the extracted features, enabling rapid identification of the face state. Furthermore, when the first requirement is met, the similarity between the first region block feature vector and the second region block feature vector is determined. Based on this similarity, the face region attack result of the first object is determined. This allows for a fine-grained local assessment of the extracted features, thereby resisting local face spoofing attacks and improving the security of face recognition attacks.
[0076] Figure 2 This application provides a schematic diagram of a face recognition logic, as shown in the embodiment. Figure 2 As shown, taking the eye region of the target object as an example of camouflaging the eye region of the first object, the first region feature vector of the first object is extracted from the pooling layer and the first face feature vector is extracted from the fully connected layer, similarly obtaining the second region feature vector and the second face feature vector of the target object. A first judgment is made on the similarity A between the first and second face features. If A is greater than a first threshold, a second judgment is made on the similarity B between the first and second region feature vectors. If B is less than a second threshold, it indicates that the first and second objects are not the same person and camouflage exists. The result of the face region attack is then output as "Face region attack exists on the first object".
[0077] Based on the same technical concept, this application embodiment also provides a face recognition device, which can implement the process of the face recognition method described above in this application embodiment. Figure 3 This is a schematic diagram of the structure of a face recognition device provided in an embodiment of this application, as shown below. Figure 3 As shown, the device includes: a face image feature extraction module 301, a first determination module 302, a second determination module 303, and a third determination module 304.
[0078] The face image feature extraction module 301 is used to extract features from the face image of a first object based on a convolutional neural network to obtain a first face feature vector and a first region block feature vector; wherein, the features in the first region block feature vector are the features output by a specified layer in the convolutional neural network when extracting features from the face image of the first object, and the features in the first face feature vector are the features output by the last layer in the convolutional neural network when extracting features from the face image of the first object.
[0079] The first determining module 302 is used to determine the second face feature vector from the face feature vectors based on the similarity between the first face feature vector and each face feature vector in the feature library.
[0080] The second determining module 303 is used to determine the similarity between the first region block feature vector and the second region block feature vector if the first determining module determines that the similarity between the first face feature vector and the second face feature vector meets the first requirement; wherein the second region block feature vector is the feature output by the specified layer in the convolutional neural network when extracting the second face feature vector.
[0081] The third determining module 304 is used to determine the face region attack result of the first object based on the similarity between the feature vector of the first region block and the feature vector of the second region block.
[0082] It should be noted that the apparatus provided in this application embodiment can implement all the method steps in the above face recognition method embodiment and achieve the same technical effect. Therefore, the parts and beneficial effects that are the same as those in the method embodiment will not be described in detail here.
[0083] Based on the same technical concept, this application also provides an electronic device that can implement the process of the face recognition method described above in this application.
[0084] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0085] As shown in the figure, the device may include: a processor 401, a memory 402, and a bus interface 403.
[0086] The processor 401 is responsible for managing the bus architecture and general processing, while the memory 402 can store the data used by the processor 401 when performing operations.
[0087] The bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 401) and memory (memory 402). The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides the interface. Processor 401 is responsible for managing the bus architecture and general processing, and memory 402 can store data used by processor 401 during operation.
[0088] The processes disclosed in this application can be applied to or implemented by processor 401. During implementation, each step of the signal processing flow can be completed by integrated logic circuits in the hardware of processor 401 or by instructions in software form. Processor 401 can be a general-purpose processor, digital signal processor, application-specific integrated circuit, field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, and can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods claimed in the embodiments of this application can be directly embodied in the execution by the hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 402, and processor 401 reads the information in memory 402 and, in conjunction with its hardware, completes the steps of the information processing flow.
[0089] Specifically, processor 401 is used to read computer instructions from memory 402 and execute a face recognition method according to an embodiment of this application.
[0090] It should be noted that the communication device provided in this application embodiment can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.
[0091] This application also provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform a face recognition method as described in the above embodiments.
[0092] This application also provides a computer program product, which, when invoked by a computer, causes the computer to execute a face recognition method as described in the above embodiments.
[0093] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0094] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0095] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0096] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0097] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A face recognition method, characterized in that, include: Based on a convolutional neural network, feature extraction is performed on the face image of the first object to obtain a first face feature vector and a first region block feature vector; wherein, the features in the first region block feature vector are the features output by a specified layer in the convolutional neural network when feature extraction is performed on the face image of the first object, and the features in the first face feature vector are the features output by the last layer of the convolutional neural network when feature extraction is performed on the face image of the first object. Based on the similarity between the first face feature vector and each face feature vector in the feature library, a second face feature vector is determined from each face feature vector. If the similarity between the first face feature vector and the second face feature vector meets the first requirement, then the similarity between the first region block feature vector and the second region block feature vector is determined; wherein, the second region block feature vector is the feature output by the specified layer in the convolutional neural network when extracting the second face feature vector; The face region attack result of the first object is determined based on the similarity between the feature vector of the first region block and the feature vector of the second region block. Wherein, determining the similarity between the feature vector of the first region block and the feature vector of the second region block includes: Determine the first matrix, which is N. An N-dimensional matrix, where N is the number of features contained in the feature vector of the first region block or the feature vector of the second region block, and the elements in the first matrix... This represents the similarity between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block; The second matrix is determined based on the first matrix and the cost function, and the second matrix is N. An N-dimensional matrix, the elements of the second matrix The first matrix represents the degree of importance between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block. The second matrix is used to minimize the value of the cost function, and the value of the cost function is the Hadamard product of the first matrix and the second matrix. Based on the first matrix and the second matrix, the similarity between the feature vector of the first region block and the feature vector of the second region block is determined; wherein, the weight of the i-th feature in the first region block feature vector is determined based on the feature mean of the i-th feature in the first region block feature vector and the feature mean of the second region block feature vector; the weight of the j-th feature in the second region block feature vector is determined based on the feature mean of the j-th feature in the second region block feature vector and the feature mean of the first region block feature vector.
2. The method as described in claim 1, characterized in that, In the second matrix It satisfies the following constraints: The The sum of rows i in the first region block feature vector is less than or equal to the weight of the i-th feature; where, , ; The The sum of column j in the second region block feature vector is less than or equal to the weight of the j-th feature. The The sum of the accumulated products is equal to the minimum value between the sum of the weights of the i-th feature in the feature vector of the first region block and the sum of the weights of the j-th feature in the feature vector of the second region block.
3. The method as described in claim 1, characterized in that, Determining the similarity between the feature vectors of the first and second regions based on the first and second matrices includes: The Hadamard product of the first matrix and the second matrix is normalized to obtain the similarity between the feature vectors of the first region block and the feature vectors of the second region block.
4. The method according to any one of claims 1-3, characterized in that, The step of determining the face region attack result of the first object based on the similarity between the feature vector of the first region block and the feature vector of the second region block includes: If the similarity between the feature vector of the first region block and the feature vector of the second region block meets the second requirement, then it is determined that the first object is not subject to face region attacks; otherwise, the first object is subject to face region attacks.
5. The method according to any one of claims 1-3, characterized in that, The second face feature vector is the face feature vector with the highest similarity among the first face feature vector and each face feature vector in the feature library.
6. A face recognition device, characterized in that, include: A face image feature extraction module is used to extract features from a face image of a first object based on a convolutional neural network to obtain a first face feature vector and a first region block feature vector. The features in the first region block feature vector are the features output by a specified layer in the convolutional neural network when extracting features from the face image of the first object, and the features in the first face feature vector are the features output by the last layer in the convolutional neural network when extracting features from the face image of the first object. The first determining module is used to determine the second face feature vector from the face feature vectors based on the similarity between the first face feature vector and each face feature vector in the feature library. The second determining module is used to determine the similarity between the first region block feature vector and the second region block feature vector if the first determining module determines that the similarity between the first face feature vector and the second face feature vector meets the first requirement; wherein, the second region block feature vector is the feature output by the specified layer in the convolutional neural network when extracting the second face feature vector; The third determining module is used to determine the face region attack result of the first object based on the similarity between the feature vector of the first region block and the feature vector of the second region block. The third determining module is specifically used for: Determine the first matrix, which is N. An N-dimensional matrix, where N is the number of features contained in the feature vector of the first region block or the feature vector of the second region block, and the elements in the first matrix... This represents the similarity between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block; The second matrix is determined based on the first matrix and the cost function, and the second matrix is N. An N-dimensional matrix, the elements of the second matrix The first matrix represents the degree of importance between the i-th feature in the feature vector of the first region block and the j-th feature in the feature vector of the second region block. The second matrix is used to minimize the value of the cost function, and the value of the cost function is the Hadamard product of the first matrix and the second matrix. Based on the first matrix and the second matrix, the similarity between the feature vector of the first region block and the feature vector of the second region block is determined; wherein, the weight of the i-th feature in the first region block feature vector is determined based on the feature mean of the i-th feature in the first region block feature vector and the feature mean of the second region block feature vector; the weight of the j-th feature in the second region block feature vector is determined based on the feature mean of the j-th feature in the second region block feature vector and the feature mean of the first region block feature vector.
7. An electronic device, characterized in that, include: Memory, used to store computer programs; When a processor executes a computer program stored in the memory, it performs the method as described in any one of claims 1-5.
8. A readable computer storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method and device for face image recognition
CN108446660A
Face recognition method and device, electronic equipment and computer readable storage medium
CN113705462A