A multi-scale dynamic convolution face anti-counterfeiting method, system, device and medium
By combining multi-scale dynamic convolution and attention mechanisms, the convolution kernel is adaptively adjusted to solve the problem of face anti-spoofing in fast judgment and cross-dataset scenarios, improving the efficiency and accuracy of the anti-spoofing system and making it suitable for edge devices.
Patent Information
- Application Number
- CN202310797489.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-06-30
AI Technical Summary
Existing face anti-spoofing solutions struggle to acquire long-term video information in rapid judgment scenarios. Traditional methods lack generalization ability, involve large computational loads, impact the performance of edge devices, and perform poorly when dealing with cross-datasets.
A multi-scale dynamic convolution face anti-spoofing method is adopted, which introduces channel attention and pixel attention mechanisms, designs an appropriate loss function, and adaptively adjusts the convolution kernel through multi-scale dynamic convolution to enhance feature extraction capability and reduce computational pressure.
It achieves efficient anti-counterfeiting in rapid judgment scenarios, improves the model's generalization ability and accuracy, reduces computational costs, and is suitable for various edge devices.
Smart Images

Figure CN116844207B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of face recognition, and particularly relates to a multi-scale dynamic convolution face anti-counterfeiting method, system, device and medium. BACKGROUND
[0002] Face recognition, as a convenient, natural and high-precision biometric recognition technology, has always been a research hotspot in the field of pattern recognition and computer vision. In recent years, face recognition technology has made great progress and has been widely used in people's daily life, such as mobile phone unlocking, access control system, financial payment and security system, etc., providing important support for the construction of smart city and intelligent industrial park.
[0003] However, the existing face recognition system still has many security risks. Due to the easy accessibility of face information, attackers can use the faces of legitimate users to deceive the face recognition system, which is called face fraud attack. With the increasing dependence of users on face recognition technology, face fraud attacks have become more complex.
[0004] Common face fraud attack methods include print attack (i.e. using a face image printed on paper to deceive the face recognition system), screen attack (i.e. playing a face video, photo or three-dimensional model on an electronic screen to deceive the face recognition system) and mask attack (i.e. attackers wearing masks to deceive the face recognition system). These attack methods are cleverly designed, not only can provide realistic face texture, but also can provide three-dimensional structure information and dynamic information, with high fraudulence. In recent years, academia and industry have paid more and more attention to the vulnerability of face recognition systems to the above face fraud attacks. It is necessary to develop a face anti-counterfeiting system with anti-fraud attack ability.
[0005] Face information is often affected by interference factors such as noise, shadow and lighting conditions. In order to reduce the influence of these interference factors on face anti-counterfeiting information, it is necessary to extract features and remove interference factors in order to better extract the required features. Face anti-counterfeiting systems can be divided into methods based on manual feature extraction and data-driven deep learning methods. Among these two methods, deep learning methods based on deep neural networks usually perform better than methods based on manual feature extraction. Traditional static neural networks are trained on large-scale datasets, and finally obtain a fixed-parameter, static network model. When testing, the fixed model parameters may not be able to cope with the diversity of input samples.
[0006] Invention patent CN201811192155.4 discloses a face anti-fake detection method, device and multi-camera, which comprises: acquiring depth image, infrared image and RGB image by TOF camera and RGB camera; analyzing the RGB image by a preset face detection algorithm to determine the RGB face area and the position information of the RGB face area in the RGB image; determining the depth face area of the face in the depth image and the infrared face area of the face in the infrared image according to the position information of the RGB face area; and determining that the face passes the detection when the depth face area, the infrared face area and the RGB face area each satisfy the corresponding preset rule. However, this method requires additional acquisition equipment to solve the problem of easy forgery of face information, and has poor universality.
[0007] Invention patent application CN202210921234.4 discloses a face anti-fake detection method, device, computer equipment and storage medium, which comprises: first receiving the verification image photographed by the detection terminal, and then performing target detection on the verification image to identify the target detection frame, which includes the face detection frame corresponding to the target face. By determining the size of the face detection frame and matching the corresponding face anti-fake detection method according to the size of the face detection frame, the target face is detected for anti-fake. However, this method is difficult to efficiently extract the required feature information, and the efficiency is not high. SUMMARY
[0008] The technical problems to be solved by the present application are as follows:
[0009] 1) Most of the existing face anti-fake solutions are for long video sequences, and although the frame-level face anti-fake method may have some performance loss, it is difficult and unrealistic to obtain long video information in some actual deployment scenarios that require quick judgment. From the perspective of usability, the frame-level face anti-fake solution is more advantageous.
[0010] 2) Traditional face anti-fake methods may not perform well in cross-dataset scenarios, because the model trained by traditional methods is only suitable for a certain dataset, has limited ability to process other data, lacks generalization ability, and the obtained features are not sufficient to predict complex scenarios, resulting in unsatisfactory accuracy in real-world applications.
[0011] 3) The existing face anti-fake solution has a large number of neural network layers and large amount of calculation, which is affected by the performance of the device when applied to low-computing edge devices, resulting in a decline in model performance and limiting the ability to process facial information.
[0012] To address the aforementioned issues, this invention proposes a multi-scale dynamic convolutional face anti-spoofing method, system, device, and medium. By employing multi-scale dynamic convolution, channel attention and pixel attention mechanisms are introduced, and a more suitable loss function is designed. This enables more efficient filtering of information unrelated to face anti-spoofing, enhances the neural network's feature extraction capability for facial information, improves accuracy while reducing computational pressure, effectively solves the problem of lack of generalization ability in face anti-spoofing systems, and improves system efficiency.
[0013] The technical solution adopted in this invention is as follows:
[0014] A multi-scale dynamic convolutional face anti-spoofing method first inputs a face image to be detected. After shallow feature extraction by the network, multi-scale dynamic convolution is performed. Then, the obtained feature information is extracted into deep features through a multi-attention mechanism. Finally, the method predicts whether the input face image is a forged face. The method specifically includes the following steps:
[0015] S1. Shallow feature extraction: The input face image to be detected is used to obtain a shallow feature vector x through shallow feature extraction;
[0016] S2. Multi-scale dynamic convolution: The shallow feature vector x is processed sequentially through the first average pooling layer, the first fully connected layer, the first ReLU function layer, the second fully connected layer, and the first softmax function layer to obtain the first set of weights {a1, a2, ..., a...}. n}, and dynamically aggregate with n convolutional kernels to obtain a dynamic convolutional kernel suitable for the current input and its output y;
[0017] S3. Processing based on a multi-attention mechanism: The output y of the dynamic convolution kernel is processed sequentially through a second average pooling layer, a third fully connected layer, a second ReLU function layer, a fourth fully connected layer, and a first Sigmoid function layer to obtain the second set of weights W. a Simultaneously, the third set of weights W is obtained through processing via the fifth fully connected layer, the third ReLU function layer, the sixth fully connected layer, and the second Sigmoid function layer. b Output deep features in For vector multiplication;
[0018] S4. Prediction based on loss function: Use the adjusted loss function to predict deep features O b The system processes the data and predicts the difference between the output and the actual label. If the difference exceeds a set threshold, the detected face image is determined to be a fake face image.
[0019] Furthermore, in step S2, the output of the dynamic convolution kernel... Where Conv represents the activation function of the convolution operation. W i is the weight of the i-th convolution kernel, b i is the weight and bias of the i-th convolution kernel,
[0020] Further, in step S3, the global average value of the input features is generated by the second average pooling layer, thereby obtaining the overall information of the input features; the weights of the features are normalized to the range of 0 to 1 by the first and second Sigmoid function layers, thereby determining the importance degree of each feature; the representation of the features is adjusted according to the weight value by the third to sixth fully connected layers, thereby enhancing or weakening the feature response of a specific region.
[0021] Further, in step S4, the adjusted loss function L is:
[0022]
[0023] where N represents the number of features to be classified, p is the number of batches of training, is the angle distance between the i-th sample and its corresponding category y i , m is a hyperparameter for increasing the intra-class separation degree, and s is a scaling factor for adjusting the scaled cosine value.
[0024] A multi-scale dynamic convolution face anti-counterfeiting system, comprising:
[0025] A shallow feature extraction module configured to input a face image to be detected, and obtain a shallow feature vector x by shallow feature extraction;
[0026] A multi-scale dynamic convolution module configured to process the shallow feature vector x through a first average pooling layer, a first fully connected layer, a first ReLU function layer, a second fully connected layer, and a first Softmax function layer in sequence to obtain a first group of weights {a1, a2,..., a n , and dynamically aggregate with n convolution kernels to obtain a dynamic convolution kernel suitable for the current input and its output y;
[0027] A multi-attention mechanism processing module configured to process the output y of the dynamic convolution kernel through a second average pooling layer, a third fully connected layer, a second ReLU function layer, a fourth fully connected layer, and a first Sigmoid function layer in sequence to obtain a second group of weights W a , and simultaneously process through a fifth fully connected layer, a third ReLU function layer, a sixth fully connected layer, and a second Sigmoid function layer to obtain a third group of weights W b , and output a deep feature where is the vector multiplication;
[0028] A loss function prediction module is configured to use the adjusted loss function to predict the deep features O b The difference value between the predicted output and the real label is processed, and if the difference value exceeds a set threshold, the face image to be detected is determined as a fake face image.
[0029] Further, in the multi-scale dynamic convolution module, the output of the dynamic convolution kernel is Wherein, Conv represents the activation function of the convolution operation, W i is the weight of the i-th convolution kernel, and b i is the weight and bias of the i-th convolution kernel,
[0030] Further, in the multi-attention mechanism processing module, the global average value of the input features is generated through the second average pooling layer, so as to obtain the overall information of the input features; the weights of the features are normalized to the range of 0 to 1 through the first and second Sigmoid function layers, so as to determine the importance degree of each feature; the representation of the features is adjusted according to the weight value through the third to sixth fully connected layers, so as to enhance or weaken the feature response of a specific region.
[0031] Further, in the loss function prediction module, the adjusted loss function L is:
[0032]
[0033] Wherein, N represents the number of features to be classified, p is the number of training batches, is the angular distance between the i-th sample and its corresponding category y i , m is a hyperparameter for increasing the intra-class separation degree, and s is a scaling factor for adjusting the scaled cosine value.
[0034] A computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps of the multi-scale dynamic convolution face anti-counterfeiting method when executing the computer program.
[0035] A computer-readable storage medium storing a computer program, the computer program being executed by a processor to implement the steps of the multi-scale dynamic convolution face anti-counterfeiting method.
[0036] The beneficial effects of the present application are:
[0037] (1) Frame-level anti-counterfeiting method: The present application does not need to use additional depth or time information, but uses multi-scale dynamic convolution, fuses multi-attention mechanism, generates adaptive dynamic convolution according to different input information, captures multi-level internal features, has stronger feature extraction ability, and achieves better anti-counterfeiting effect.
[0038] (2) Better generalization ability: the fixed convolution kernel has limited ability in extracting facial features of unfamiliar data sets, and the application can adaptively generate different scale convolution kernels related to the input, better extract deep features, and enable the model to cope with different environmental conditions.
[0039] (3) The multi-scale dynamic convolution kernel can adaptively process different sample information while significantly improving the representation ability of the neural network. Because of the use of dynamic convolution, even if the number of neural network layers is small, it also has good learning ability, and the additional calculation cost is small, and it has better application conditions in various edge devices.
[0040] In summary, by using multi-scale dynamic convolution, introducing channel attention and pixel attention mechanisms, and designing a more applicable loss function, the application can more efficiently filter information unrelated to face anti-counterfeiting, enhance the feature extraction ability of the neural network for face information, improve the accuracy while reducing the calculation pressure, and effectively solve the problem of lack of generalization ability of the face anti-counterfeiting system, and improve the system efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 is a multi-scale dynamic convolution face anti-counterfeiting method flowchart of embodiment 1 of the application.
[0042] Figure 2 is a multi-scale dynamic convolution combined with attention mechanism flowchart of embodiment 1 of the application. DETAILED DESCRIPTION
[0043] In order to have a more clear understanding of the technical features, purposes and effects of the application, the specific embodiments of the application will be described. It should be understood that the specific embodiments described herein are only used to explain the application and not to limit the application, that is, the described embodiments are only a part of the embodiments of the application, not all the embodiments. Based on the embodiments of the application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the application.
[0044] Embodiment 1
[0045] Face information is often affected by interference factors such as noise, shadow and lighting conditions. In order to reduce the influence of these interference factors on face anti-fake information, the features need to be refined and the interference factors need to be removed in order to better extract the required features. Face anti-fake system can be divided into methods based on manual feature extraction and data-driven deep learning methods. Among the two methods, the deep learning method based on deep neural network usually performs better than the method based on manual feature extraction. The traditional static neural network is trained on a large-scale dataset, and finally a static network model with fixed parameters is obtained. When testing, the fixed model parameters may not be able to cope with the diversity of input samples.
[0046] In order to avoid the disadvantages of the traditional static inference mode, a multi-scale dynamic convolutional network can be used to adaptively adjust the network parameters in a dynamic way for the input samples. In the inference stage, the dynamic convolutional network generates a mapping relationship suitable for the current input sample according to the feature distribution of different input samples, and adjusts the convolution kernel parameters, so as to better adjust the model parameters to adapt to different recognition scenes. Through the dynamic fusion of features at different levels, the dynamic convolutional network greatly improves the representation ability of the anti-fake model. By using multi-attention mechanism, combining channel attention and pixel attention, the weight distribution of different regions of the face and different image channels can also be realized, so as to improve the recognition ability of the forged face. The attention mechanism can cooperate with the multi-scale dynamic convolution operation to improve the adaptive ability of the model to the input image.
[0047] Therefore, the embodiment provides a multi-scale dynamic convolution face anti-fake method, as shown in Figure 1 The method comprises the following steps:
[0048] S1. Shallow feature extraction: input the face image to be detected, and obtain a shallow feature vector x through shallow feature extraction;
[0049] S2. Multi-scale dynamic convolution: as shown in Figure 2 The shallow feature vector x is sequentially processed through a first average pooling layer, a first full connection layer, a first ReLU function layer, a second full connection layer and a first Softmax function layer to obtain a first group of weights {a1, a2,..., an} and dynamically aggregate with n convolution kernels to obtain a dynamic convolution kernel suitable for the current input and its output y; n
[0050] S3. Processing based on multi-attention mechanism: as shown in Figure 2 The output y of the dynamic convolution kernel is sequentially processed through a second average pooling layer, a third full connection layer, a second ReLU function layer, a fourth full connection layer and a first Sigmoid function layer to obtain a second group of weights W a Meanwhile, the third group of weights W is obtained by processing through a fifth fully connected layer, a third ReLU function layer, a sixth fully connected layer, and a second Sigmoid function layer b , and the deep layer feature is output , wherein is vector multiplication
[0051] S4. Prediction based on the loss function: the adjusted loss function is used to process the deep layer feature O b , and the difference value between the predicted output and the real label is obtained. If the difference value exceeds the set threshold, the face image to be detected is determined to be a fake face image.
[0052] In step S2, a plurality of convolution kernels are set in each convolution layer, and the weight of each convolution kernel is dynamically adjusted according to the input of the convolution layer. Then, the weighted sum of these convolution kernels is formed into a dynamic convolution kernel suitable for the current input. The output of the dynamic convolution kernel is wherein Conv represents the activation function of the convolution operation, W i is the weight of the i-th convolution kernel, and b i is the weight and bias of the i-th convolution kernel
[0053] By dynamically adjusting the weight of the convolution kernel, the network can adaptively capture features of different scales, thereby better representing the input data. Compared with using fixed convolution kernels, dynamic convolution can flexibly adjust the convolution kernel according to the needs of different inputs, improve the flexibility and generalization ability of the model, and maintain high efficiency in the inference process. The weight changes adaptively with the input to cope with features of different scales, dynamically forms a mapping relationship, and adaptively generates a corresponding convolution kernel. Through this adaptive convolution, the network can adapt to various fields and enhance the generalization ability between the source domain and the unseen target domain.
[0054] As shown in Figure 2 , the processing based on the multi-attention mechanism in step S3 is divided into two parts. The weight calculation of the first part is W a =Sigmoid(Conv(y′)),y′=ReLU(Conv(Avgpool(y))),the output vector The weight calculation of the second part is W b =Sigmoid(Conv(y″)),y″=ReLU(Conv(y))),and the final output feature is wherein
[0055] The role of the Avgpool operation is to perform average pooling operation on the input features to reduce the spatial dimension of the feature map. This helps to capture global context information and reduce the amount of computation. The average pooling operation is used to generate the global average value of the features to obtain the overall information of the input features.
[0056] The role of the Sigmoid function is to normalize the weights of the features to the range of 0 to 1. By mapping the weights of the features to a probability distribution, the Sigmoid function can determine the degree of importance of each feature. Larger weight values indicate that the feature is more important, while smaller weight values indicate that the feature is relatively less important.
[0057] The Conv operation is mainly used to weight the features according to the attention weights. By convolving with the attention weights, each position in the feature map is weighted according to its corresponding weight value. This allows the attention mechanism to focus on important features and suppress unimportant features. The convolution operation adjusts the representation of the features according to the weight values to enhance or weaken the feature response in a specific region. Attention allows the network to focus on difficult-to-distinguish areas such as image details while analyzing the overall information of the image. Using this flexible attention mechanism, irrelevant features can be dynamically filtered and the input information can be more accurately processed according to the current input.
[0058] Preferably, in step S4, the adjusted loss function L can be:
[0059]
[0060] where N represents the number of features to be classified, p is the number of training batches, is the angle distance between the i-th sample and its corresponding class y i , m is a hyperparameter that increases the intra-class separation, preventing samples from being too close in feature space, and s is a scaling factor that adjusts the scaling of the cosine value.
[0061] Embodiment 2
[0062] The embodiment provides a multi-scale dynamic convolution face anti-counterfeiting system, comprising:
[0063] The shallow feature extraction module is configured to input the face image to be detected, and obtain a shallow feature vector x through shallow feature extraction;
[0064] The multi-scale dynamic convolution module is configured to process the shallow feature vector x through a first average pooling layer, a first fully connected layer, a first ReLU function layer, a second fully connected layer, and a first Soffmax function layer in turn to obtain a first group of weights {a1, a2,..., a n}, and a dynamic convolution kernel suitable for the current input and its output y are obtained by dynamic aggregation with n convolution kernels;
[0065] The multi-attention mechanism processing module is configured to sequentially process the output y of the dynamic convolution kernel through a second average pooling layer, a third fully connected layer, a second ReLU function layer, a fourth fully connected layer, and a first Sigmoid function layer to obtain a second group of weights W a , and a third group of weights W b is obtained by processing through a fifth fully connected layer, a third ReLU function layer, a sixth fully connected layer, and a second Sigmoid function layer. is vector multiplication;
[0066] The loss function prediction module is configured to process the deep feature O b using the adjusted loss function to predict the difference value between the output and the real label, and if the difference value exceeds a set threshold, the face image to be detected is determined to be a fake face image.
[0067] In the multi-scale dynamic convolution module, a plurality of convolution kernels are set in each convolution layer, and the weights of each convolution kernel are dynamically adjusted according to the input of the convolution layer. Then, these convolution kernels are weighted and summed to form a dynamic convolution kernel suitable for the current input. The output of the dynamic convolution kernel where Conv represents the activation function of the convolution operation, W i is the weight of the i-th convolution kernel, and b i is the weight and bias of the i-th convolution kernel,
[0068] By dynamically adjusting the weights of the convolution kernels, the network can adaptively capture features of different scales, thereby better representing the input data. Compared with using fixed convolution kernels, dynamic convolution can flexibly adjust the convolution kernels according to the needs of different inputs, improve the flexibility and generalization ability of the model, and maintain high efficiency in the inference process. The weights adaptively change with the input to cope with features of different scales, dynamically form a mapping relationship, and adaptively generate corresponding convolution kernels. Through this adaptive convolution, the network can adapt to various fields and enhance the generalization ability between the source domain and the unseen target domain.
[0069] The multi-attention mechanism processing module is divided into two parts. The weight calculation of the first part is W a = Sigmoid(Conv(y')) and y' = ReLU(Conv(Avgpool(y))), and the output vector The weight calculation of the second part is W b = Sigmoid(Conv(y")), y" = ReLU(Conv(y))), the final output feature is wherein:
[0070] The role of the Avgpool operation is to perform average pooling operation on the input features to reduce the spatial dimension of the feature map. This helps to capture global context information and reduce the amount of calculation. The average pooling operation is used to generate the global average value of the features to obtain the overall information of the input features.
[0071] The role of the Sigmoid function is to normalize the weight of the feature to the range of 0 to 1. By mapping the weight of the feature to a probability distribution, the Sigmoid function can determine the importance degree of each feature. Larger weight values indicate that the feature is more important, while smaller weight values indicate that the feature is relatively less important.
[0072] The Conv operation is mainly used to weight the features according to the attention weight. By convolving with the attention weight, each position in the feature map will be weighted according to its corresponding weight value. This allows the attention mechanism to focus on important features and suppress unimportant features. The convolution operation adjusts the representation of the feature according to the weight value to enhance or weaken the feature response in a specific region. Attention allows the network to focus on difficult-to-distinguish areas such as image details while analyzing the overall information of the image. Using this flexible attention mechanism, irrelevant features can be filtered out dynamically according to the current input, and the input information can be processed more accurately.
[0073] Preferably, in the loss function prediction module, the adjusted loss function L can be:
[0074]
[0075] where N represents the number of features to be classified, p is the number of training batches, is the angle distance between the i-th sample and its corresponding class y i , m is a hyperparameter that increases the intra-class separation, preventing samples from being too close in feature space, and s is a scaling factor that adjusts the scaling cosine value.
[0076] Embodiment 3
[0077] This embodiment is based on Embodiment 1:
[0078] This embodiment provides a computer device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the steps of the multi-scale dynamic convolution face anti-counterfeiting method of Embodiment 1 when executing the computer program. The computer program can be in the form of source code, object code, executable file or some intermediate form, etc.
[0079] Embodiment 4
[0080] This embodiment is based on Embodiment 1:
[0081] This embodiment provides a computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the steps of the multi-scale dynamic convolution face anti-counterfeiting method of Embodiment 1. The computer program can be in the form of source code, object code, an executable file, or some intermediate form, etc. The storage medium includes any entity or device capable of carrying computer program code, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content included in the storage medium can be appropriately added or reduced according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the storage medium does not include electrical carrier signals and telecommunication signals.
[0082] The above description is only preferred embodiments of the present application, and it should be understood that the present application is not limited to the forms disclosed herein, and should not be considered as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the concepts described herein by the above teachings or related art or knowledge. Any modification and change made by those skilled in the art without departing from the spirit and scope of the present application shall be within the protection scope of the appended claims of the present application.
Claims
1. A multi-scale dynamic convolutional face anti-spoofing method, characterized in that, Includes the following steps: S1. Shallow Feature Extraction: The input face image to be detected is processed to obtain a shallow feature vector. ; S2. Multi-scale dynamic convolution: converting shallow feature vectors Passing sequentially through the first average pooling layer, the first fully connected layer, and the first... Function layer, second fully connected layer and first The function layer processes the data to obtain the first set of weights. and with The convolutional kernels are dynamically aggregated to obtain a dynamic convolutional kernel and its output suitable for the current input. ; S3. Processing based on a multi-attention mechanism: The output of the dynamic convolutional kernel is processed... Passing sequentially through the second average pooling layer, the third fully connected layer, and the second... Function layer, fourth fully connected layer and first The function layer processes the data to obtain the second set of weights. At the same time, through the fifth fully connected layer, the third Function layer, sixth fully connected layer and second The function layer processes the data to obtain the third set of weights. Output deep features ,in , For vector multiplication; S4. Prediction based on loss function: Using the adjusted loss function for deep features The process is performed to predict the difference between the output and the real label. If the difference exceeds a set threshold, the face image to be detected is determined to be a fake face image. In step S2, the output of the dynamic convolution kernel ,in This represents the activation function for the convolution operation. , , For the first The weights of each convolution kernel, For the first The weights and biases of each convolutional kernel. ; In step S4, the adjusted loss function L is: in, This represents the number of features that need to be classified. The number of training batches. For the first Each sample and its corresponding category angular distance between them To increase the hyperparameter of intra-class separation, This is a scaling factor used to adjust the scaling cosine value.
2. The multi-scale dynamic convolutional face anti-spoofing method according to claim 1, characterized in that, In step S3, the global average value of the input features is generated through the second average pooling layer to obtain the overall information of the input features; through the first and second average pooling layers... The function layer normalizes the feature weights to a range between 0 and 1, determining the importance of each feature; The feature representation is adjusted according to the weight values through the third to sixth fully connected layers, thereby enhancing or weakening the feature response of a specific region.
3. A multi-scale dynamic convolutional face anti-spoofing system, characterized in that, include: The shallow feature extraction module is configured to take the face image to be detected as input and extract shallow feature vectors through shallow feature extraction. ; The multi-scale dynamic convolution module is configured to convert shallow feature vectors Passing sequentially through the first average pooling layer, the first fully connected layer, and the first... Function layer, second fully connected layer and first The function layer processes the data to obtain the first set of weights. and with The convolutional kernels are dynamically aggregated to obtain a dynamic convolutional kernel and its output suitable for the current input. ; The multi-attention mechanism processing module is configured to process the output of the dynamic convolution kernel. Passing sequentially through the second average pooling layer, the third fully connected layer, and the second... Function layer, fourth fully connected layer and first The function layer processes the data to obtain the second set of weights. At the same time, through the fifth fully connected layer, the third Function layer, sixth fully connected layer and second The function layer processes the data to obtain the third set of weights. Output deep features ,in , For vector multiplication; The loss function prediction module is configured to use an adjusted loss function for deep features. The process is performed to predict the difference between the output and the real label. If the difference exceeds a set threshold, the face image to be detected is determined to be a fake face image. In the multi-scale dynamic convolution module, the output of the dynamic convolution kernel ,in This represents the activation function for the convolution operation. , , For the first The weights of each convolution kernel, For the first The weights and biases of each convolutional kernel. ; In the loss function prediction module, the adjusted loss function L is: in, This represents the number of features that need to be classified. The number of training batches. For the first Each sample and its corresponding category angular distance between them To increase the hyperparameter of intra-class separation, This is a scaling factor used to adjust the scaling cosine value.
4. The multi-scale dynamic convolutional face anti-spoofing system according to claim 3, characterized in that, In the multi-attention mechanism processing module, a global average value of the input features is generated through a second average pooling layer to obtain the overall information of the input features; through the first and second attention mechanisms... The function layer normalizes the feature weights to a range between 0 and 1, determining the importance of each feature; The feature representation is adjusted according to the weight values through the third to sixth fully connected layers, thereby enhancing or weakening the feature response of a specific region.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the multi-scale dynamic convolutional face anti-spoofing method according to claim 1 or 2.
6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the multi-scale dynamic convolutional face anti-spoofing method as described in claim 1 or 2.
Citation Information
Patent Citations
Face anti-counterfeiting detection method and device and multi-view camera
CN111046703A
Face anti-counterfeiting detection method and device, computer equipment and storage medium
CN115223227A
Remote sensing image ship target fine-grained classification method based on dynamic convolution
CN112464792A
Crowd counting method based on attention mechanism dynamic fusion convolutional network
CN114091588A