Living body detection method and system based on feature channel characterization

Through the adaptive feature augmentation and channel-level whitening removal modules of the dual-tributary network architecture, the problem of insufficient generalization ability of the deep learning model under domain shift is solved, and the domain generalization performance and detection effect of living body detection are improved.

CN118570881AActive Publication Date: 2024-08-30SOUTH CHINA UNIV OF TECH

Patent Information

Application Number
CN202410347393.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2024-08-30
Estimated Expiration
2044-03-26

AI Technical Summary

Technical Problem

Existing deep learning-based liveness detection methods have insufficient generalization capabilities in the face of domain shift, and are difficult to effectively distinguish real faces from deceptive faces, especially under diverse cameras and environmental changes, resulting in a decline in detection performance.

Method used

The dual-tributary network architecture is adopted, the feature representation space is expanded through the adaptive feature augmentation module, and the channel-level whitening and elimination module is used to reduce the confusion and domain tendency of channel features, thereby improving the domain generalization ability of the model.

Benefits of technology

It improves the domain generalization performance of the living body detection model, can more effectively distinguish between real and fake faces, and shows better detection results than other algorithms in cross-database experiments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570881A
    Figure CN118570881A
Patent Text Reader

Abstract

The invention discloses a living body detection method and system based on feature channel representation, and the method comprises the following steps: carrying out the preprocessing of a video data set, extracting a face image, and setting an authenticity label and a domain label; extracting multi-scale features of the face image based on a multi-scale feature extraction module; expanding the representation space of the multi-scale features based on an adaptive feature augmentation module to obtain augmented features; based on a channel-level whitening module, the discriminant representation capability of channel features is improved; inhibiting channels sensitive to domain offset based on a channel-level rejection module so as to extract domain invariant information; the features output by the channel-level whitening module and the channel-level rejecting module are fused based on an attention feature fusion module to obtain final discrimination features; predicting a dichotomy result according to the final discriminant features; and training and updating the weight of the network, and obtaining a living body detection prediction result based on the trained network model. According to the invention, the discriminant representation capability of the channel features and the domain generalization performance of the living body detection model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a human face liveness detection technology, and in particular to a liveness detection method and system based on feature channel representation. Background Art

[0002] Liveness detection technology, also known as Face Anti-Spoofing (FAS), is a technology that identifies and confirms the authenticity of face images obtained by face recognition systems. Face recognition technology is widely used in many interactive intelligent application scenarios due to its convenience and excellent recognition accuracy, such as mobile payment, entry verification, mobile phone unlocking, attendance system, etc. However, face recognition systems may be attacked by means such as printed paper, video playback, 3D masks or human models, thereby threatening the user's personal privacy security. Therefore, it is very important to study liveness detection technology to protect personal facial information from attacks.

[0003] Existing liveness detection methods mainly include methods based on traditional manual feature extraction and methods based on deep learning. The former usually uses operation trace descriptors (such as local binary patterns, gradient direction histograms, etc.) in various color spaces to extract deception clues. Such methods have low computational complexity and strong interpretability, but because they need to select different feature representations for different objects, they cannot fully exert their performance when facing unknown test scenarios. The latter does not require manual design of features or functions, but uses convolutional neural networks to encode the low-level features (edges, textures, etc.) of the analysis object layer by layer to adaptively obtain high-level semantic information of the image. It has stronger feature representation capabilities and has gradually become the mainstream method in the field of liveness detection.

[0004] In practical applications, the diversity of camera sensors, changes in the environment, and unpredictable attack types may lead to domain shift, resulting in different distributions between the actual test set and the training set. Early deep learning methods did not fully consider the distribution differences of different domains, so such detection models were easily disturbed by domain shift, resulting in poor generalization ability. Summary of the invention

[0005] In order to overcome the defects and shortcomings of the prior art, the present invention provides a liveness detection method and system based on feature channel representation. The present invention adopts a dual-branch network architecture and uses multi-scale features as input, wherein the first branch uses an adaptive feature augmentation module to calculate the statistics of the input features, model the Gaussian distribution thereof and introduce disturbances, calculate the uncertainty of the statistics, set its upper and lower limits to control the degree of disturbance, thereby obtaining two affine parameters for augmenting the features to expand their representation space; based on the augmented features, a channel-level whitening module is used in the branch to decouple the channel features representing the true and false categories, reduce the confusion between the two categories of features, thereby improving the discriminative representation ability of the channel features; a channel-level elimination module is introduced in the second branch of the network to remove channels with a tendency to the domain and extract domain-invariant features, thereby improving the domain generalization ability of the detection model.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] The present invention provides a method for detecting a living body based on characteristic channel characterization, comprising the following steps:

[0008] The video dataset is divided into video frames, the face area of ​​each frame image is extracted to obtain the face image, and the corresponding authenticity label and domain label are set for the face image;

[0009] Construct a multi-scale feature extraction module to extract multi-scale features of face images;

[0010] Construct an adaptive feature augmentation module to expand the representation space of multi-scale features. By calculating the feature statistics of multi-scale features, Gaussian distribution modeling is performed on them and disturbances are introduced. The uncertainty of the statistics is calculated, and the upper and lower limits are set to control the degree of disturbance. Two affine parameters are obtained to perform augmentation transformation on multi-scale features to expand their representation space and obtain augmented features.

[0011] Construct a channel-level whitening module, input the augmented features into the channel-level whitening module, use the mapping layer to map the multi-channels of the augmented features into two channels for true and false discrimination, and in the mapping process, divide the channels that best represent the true and false categories into the same group according to the index of the mapping layer weights after size sorting, calculate the covariance matrix in each group, and constrain it with the unit matrix to calculate the whitening loss;

[0012] Construct a channel-level elimination module, input multi-scale features into the channel-level elimination module, use the weight calculation of the fully connected layer in the domain discriminator to predict the weighted activation value of the correct domain, measure the domain tendency of each channel, eliminate the channels that contribute greatly to the domain identification task, and learn domain-invariant features;

[0013] Construct an attention feature fusion module, and fuse the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level culling module based on the channel attention mechanism to obtain the final discriminant features;

[0014] Build a classifier and input the final discriminant features into the classifier to obtain the binary classification prediction result;

[0015] The output results of the classifier and the domain discriminator are supervised by using the authenticity label and domain label respectively, and the binary classification loss and domain discrimination loss are obtained. The total loss function is obtained by combining the whitening loss of the channel-level whitening module to train and update the weight coefficient of the network model.

[0016] The liveness detection prediction results are obtained based on the trained network model.

[0017] As a preferred technical solution, a multi-scale feature extraction module is constructed to extract multi-scale features of face images, specifically including:

[0018] The multi-scale feature extraction module uses the first three layers of ResNet-18 as the initial feature extractor of the input face image, extracts the features of each layer of the input face image, performs scale transformation operations on the obtained features at each level, and obtains multi-scale features through linear addition.

[0019] As a preferred technical solution, the obtained features at each level are scaled and then multi-scale features are obtained by linear addition, specifically including:

[0020] The features output by the first layer are scaled and then linearly added to the output of the second layer. The processed features are scaled and then linearly added to the output of the third layer to obtain multi-scale features.

[0021] As a preferred technical solution, an adaptive feature augmentation module is constructed to expand the representation space of multi-scale features, specifically including:

[0022] Calculate the mean and standard deviation of multi-scale features in the channel dimension, which can be expressed as:

[0023]

[0024]

[0025] Among them, μ(f) represents the mean, σ(f) represents the standard deviation, H, W and c represent the height, width and channel of the sample feature map respectively, and f c,h,v Represent multi-scale features in the channel dimension;

[0026] Calculate the variance of μ(f) and σ(f), which are respectively and The formula is as follows:

[0027]

[0028]

[0029] Where E n () means finding the mean of feature statistics;

[0030] use and The uncertainty of μ(f) and σ(f) is measured respectively, and the Gaussian distribution is used to model μ(f) and σ(f), and the standard normal distribution is introduced. The Gaussian perturbation ∈ μ and ∈ σ , based on the uncertainty, the degree of Gaussian perturbation is controlled respectively, and two affine parameters are obtained, which are specifically expressed as:

[0031]

[0032]

[0033] Based on the affine parameters β and γ, the features of the simulated domain shift, that is, the augmented features, are generated, which are specifically expressed as:

[0034]

[0035] in, represents the feature of the simulated domain shift, and f represents the multi-scale feature before augmentation.

[0036] As a preferred technical solution, the whitening loss is expressed as:

[0037]

[0038]

[0039]

[0040] Among them, L cw represents the whitening loss, N represents the number of input sample features, and C represents the number of channels before the feature passes through the mapping layer. is the number of groups after grouping, Represents the nth sample feature F in a batch input n The g-th group, I is the identity matrix, represent The covariance matrix of the sample feature map is H, W, and F. n,i,h,w ,F n,j,h,w(i,j∈[1,2]) represent the channel dimension features representing true and false in each group of the nth sample features, μ n,i ,μ n,j (i,j∈[1,2]) correspond to the channel means respectively, 1 and 2 represent the categories true and false respectively, i and j represent the channel indexes in the group, and the value range is [1,2].

[0041] As a preferred technical solution, the weighted activation value predicted as the correct domain is calculated using the weights of the fully connected layer in the domain discriminator, which is specifically expressed as:

[0042]

[0043] Among them, s c represents the weighted activation value, c is the channel index, represents the fully connected layer weight corresponding to the channel predicted as the correct domain, F m represents multi-scale features, and GAP represents the global average pooling layer.

[0044] As a preferred technical solution, the domain identification loss of the domain discriminator is expressed as:

[0045]

[0046] Among them, L d represents the domain discrimination loss, P is the number of source domains, and n d represents the number of samples with domain label d in a batch input, j is the predicted domain label, It means that the value of this formula is 1 when the domain discriminator D predicts correctly, otherwise it is 0. m Represents multi-scale features.

[0047] As a preferred technical solution, the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level culling module are fused based on the channel attention mechanism to obtain the final discriminant features, which are specifically expressed as:

[0048]

[0049] Among them, X and Y represent the features output by the channel-level whitening module and the features output by the channel-level culling module, respectively. represents the addition of corresponding elements, Indicates the multiplication of corresponding elements, A() indicates obtaining the fusion weight based on the attention mechanism. The specific operations are as follows:

[0050]

[0051] Among them, σ is the Sigmoid activation function, L(X) and G(X) represent the channel attention of local features and global features respectively.

[0052] As a preferred technical solution, the final discriminant features are input into the classifier to obtain a binary classification prediction result, which specifically includes:

[0053] The predicted labels and predicted probability values ​​are calculated based on the output features of the classifier, and supervised training is performed based on the true and false labels to construct the binary classification loss, which is specifically expressed as:

[0054] L cls =-(ylog(y′)+(1-y)log(1-y′))

[0055] Among them, L cls represents the binary classification loss, y represents the true or false label, and y′ represents the predicted label.

[0056] The present invention also provides a living body detection system based on feature channel representation, comprising: a data preprocessing module, a multi-scale feature extraction module, an adaptive feature augmentation module, a channel-level whitening module, a channel-level rejection module, an attention feature fusion module, a classifier, a network training module and a testing module;

[0057] The data preprocessing module divides the video data set into video frames, extracts the face area of ​​each frame image to obtain a face image, and sets a corresponding authenticity label and domain label for the face image;

[0058] The multi-scale feature extraction module is used to extract multi-scale features of face images;

[0059] The adaptive feature augmentation module is used to expand the representation space of multi-scale features by calculating the feature statistics of the multi-scale features, modeling the Gaussian distribution of the multi-scale features and introducing disturbances, finding the uncertainty of the statistics, setting the upper and lower limits to control the degree of disturbance, and obtaining two affine parameters for performing augmentation transformation on the multi-scale features to expand their representation space and obtain augmented features;

[0060] The channel-level whitening module uses a mapping layer to map the multi-channels of the augmented features into two channels for true and false discrimination. In the mapping process, the channels that best represent the true and false categories are divided into the same group in turn according to the index of the mapping layer weights after size sorting. The covariance matrix is ​​calculated in each group, and it is constrained by the unit matrix to calculate the whitening loss;

[0061] The channel-level elimination module is used to calculate the weighted activation value predicted as the correct domain based on the input multi-scale features using the weights of the fully connected layer in the domain discriminator, measure the domain tendency of each channel, eliminate the channels that contribute greatly to the domain identification task, and learn domain invariant features;

[0062] The attention feature fusion module is used to fuse the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level culling module based on the channel attention mechanism to obtain the final discriminant features;

[0063] The classifier is used to obtain a binary classification prediction result according to the final discriminant feature;

[0064] The network training module is used to supervise the output results of the classifier and the output results of the domain discriminator using the true and false labels and the domain labels respectively, obtain the binary classification loss and the domain discrimination loss, combine the whitening loss of the channel-level whitening module to weight the total loss function, and train and update the network model weight coefficient;

[0065] The test module is used to obtain a liveness detection prediction result based on the trained network model.

[0066] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0067] (1) The present invention enhances information transmission between different network layers by fusing features of multiple layers in a neural network, and uses multi-scale features that integrate information from each layer as input for subsequent modules. This choice can improve the representation ability of the model and more effectively play the role of each module. Specifically, for the adaptive feature augmentation module of the first branch, using multi-scale features as input can more effectively expand the representation space of features while retaining the powerful representation ability of the original features; for the channel-level elimination module of the second branch, since channels that are sensitive to domain shift may exist in both shallow and deep layers of the network, if the elimination module is used in multiple layers, too many features may be lost, hindering model learning. Therefore, multi-scale features covering information from multiple layers of the network are used as input for the module, and channels with domain bias in the features are directly eliminated, thereby effectively reducing the domain bias of the channels while avoiding affecting model training.

[0068] (2) The present invention adopts an adaptive feature augmentation module to calculate the statistics of the input features, model the Gaussian distribution and introduce disturbances, find the uncertainty of the statistics, set the upper and lower limits to control the degree of disturbance, and thus obtain two affine parameters for augmentation transformation to expand the representation space of the features; previous feature augmentation strategies mostly use linear interpolation, that is, the amplified results are only retained between the lines connecting the corresponding features of the two samples, which cannot guarantee full coverage of the unknown domain; in addition, some methods may introduce excessive disturbances, and in the research field of liveness detection, the offset between different domains is not necessarily very large, so excessive disturbances are likely to be counterproductive. In contrast, the adaptive feature augmentation module proposed by the present invention is more suitable for application in liveness detection technology.

[0069] (3) The present invention simultaneously studies the correlation between discriminative feature channels and the channel's tendency towards domains. The proposed dual-branch network can not only realize the task of true and false discrimination, but also suppress information that is sensitive to domain offset, thereby improving the domain generalization performance of the liveness detection model. Previous methods mostly conducted research at the domain or instance level, while the present invention studies the problem of domain generalization of liveness detection based on the channel level, which can more fundamentally analyze the factors that affect domain generalization when using convolutional neural networks for liveness detection.

[0070] (4) Cross-database experimental data prove that the dual-branch network proposed in the present invention has good domain generalization performance and is superior to several representative algorithms in the field of liveness detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 It is a flow chart of a living body detection method based on characteristic channel characterization of the present invention;

[0072] Figure 2 Schematic diagram of the network architecture for implementing the liveness detection method based on feature channel characterization of the present invention;

[0073] Figure 3 It is a structural schematic diagram of the multi-scale feature extraction module of the present invention;

[0074] Figure 4 Schematic diagram of the implementation process of the adaptive feature augmentation module of the present invention;

[0075] Figure 5 Schematic diagram of the implementation process of the channel-level whitening module of the present invention;

[0076] Figure 6 Schematic diagram of the implementation process of the channel-level rejection module of the present invention;

[0077] Figure 7 Schematic diagram of the network structure of the attention feature fusion module of the present invention. DETAILED DESCRIPTION

[0078] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0079] Example 1

[0080] This embodiment takes the four liveness detection datasets of Oulu_NPU, CASIA-MFSD, MSU_MFSD and Replay-Attack as examples for training and testing, and introduces the implementation process in detail. The Oulu_NPU dataset collects real faces from 55 testers and the corresponding generated deceptive faces. Each person has 90 videos, of which 20 are used for the training set, 15 for the verification set, and 20 for the test set. The attack methods include two printing attacks and two video replay attacks; the CASIA-MFSD dataset contains 600 videos, and uses three cameras with resolutions of 640×480 pixels, 480×640 pixels, and 1920×1080 pixels to collect real faces from 50 testers and the corresponding generated The MSU_MFSD dataset includes 280 videos, which collect real faces from 35 testers and the corresponding generated deceptive faces, of which 15 are used for the training set and 20 are used for the test set; the Replay-Attack dataset contains 1200 videos, which uses a MacBook camera with a resolution of 320×240 pixels to collect real faces from 50 testers and the corresponding generated deceptive faces, and is divided into training set, validation set and test set according to the ratio of 3:3:4.

[0081] This embodiment runs on the Linux system and is implemented based on the deep learning framework Pytorch. The graphics card used in the experiment is GTX1080Ti, the CUDA version is 10.1.105, and the cudnn version is 7.6.4.

[0082] like Figure 1 , Figure 2 As shown, this embodiment provides a method for liveness detection based on feature channel representation, adopting a dual-branch network architecture, and specifically including the following steps:

[0083] S1. Preprocess the input data: divide the data set into a training set and a test set, divide the video in the data set into frames, crop the face area in each frame image, extract the face area in each frame image to obtain the face image, and set the corresponding true and false label y and domain label d for the face image;

[0084] In this embodiment, the OpenCV tool library is used to frame all the videos in the training set and the test set, the MTCNN face recognition algorithm is used to detect the face area and obtain the face position frame, and the Lanczos interpolation algorithm is used to adjust the resolution to H×W×C after cropping the face area, where H, W, and C represent the height, width, and number of channels of the face image, respectively. In this embodiment, H=256, W=256, C=3, and the number of data in each batch N=8.

[0085] S2. Construct a multi-scale feature extraction module: Input the face image I into the initial feature extractor to obtain the features of each network depth, perform scale transformation operations on the features at each level, adjust the size of the feature maps at each level, and then linearly add them to obtain a multi-scale feature F containing comprehensive information. m ;

[0086] In this embodiment, the multi-scale feature extraction module is used to extract multi-scale features of the input image, such as Figure 3 As shown in Figure 1, the multi-scale feature extraction module uses the first three layers of ResNet-18 as the initial feature extractor of the input face image I to extract the features of each layer of the input face image I. The semantic information of the features extracted at different depths in the network is different. The scale transformation operation is performed on the features at each level, and the multi-scale feature F is obtained by linear addition. m , so that the features at each level can prompt each other and supplement the discriminative information during the learning process.

[0087] The specific implementation method is as follows: for a batch of input data I (the number of data in each batch is recorded as N), the feature F output by the first layer 1 After the scale transformation, the output F of the second layer 2 Linear addition is performed, and the processed features are subjected to the same scale transformation operation and then added to the output F of the third layer. 3 Perform linear addition to finally obtain multi-scale features that integrate information from each layer

[0088] S3, constructing an adaptive feature augmentation module: This embodiment adopts a dual-branch network architecture, constructs an adaptive feature augmentation module in the first branch, and calculates the multi-scale feature F m The characteristic statistics of , Gaussian distribution modeling and introduction of disturbance, the uncertainty of the statistics is calculated, and its upper and lower limits are set to control the degree of disturbance, thereby obtaining two affine parameters for multi-scale feature F m Perform augmentation transformation to expand its representation space and obtain augmented features

[0089] like Figure 4 As shown in the figure, the adaptive feature augmentation module is used to expand the representation space of the input features. The module first calculates F m The feature statistics of (denoted as f) in the channel dimension include the mean μ(f) and the standard deviation σ(f). μ(f) and σ(f) are modeled as Gaussian distributions and Gaussian perturbations ∈ μ and ∈ σ, based on which two affine parameters β and γ are generated for feature augmentation; in addition, in order to avoid the negative impact of excessive perturbation on network learning, the uncertainty of μ(f) and σ(f) is calculated and the upper and lower limits are set for them to control the degree of Gaussian perturbation. Finally, γ and β are used to adjust the multi-scale feature F m Perform augmentation transformation to generate features of simulated domain shift Thereby expanding the representation space of features;

[0090] Specifically, the multi-scale feature F m The calculation formula of the mean μ(f) and standard deviation σ(f) in the channel dimension (abbreviated as f) is as follows:

[0091]

[0092]

[0093] Among them, H, W and c represent the height, width and channel of the sample feature map respectively, and f c,h,w It is a multi-scale feature in the channel dimension.

[0094] Calculate the variance of μ(f) and σ(f), which are respectively and The formula is as follows:

[0095]

[0096]

[0097] Where E n () means finding the mean of feature statistics;

[0098] use and The uncertainty of μ(f) and σ(f) is measured respectively, and the Gaussian distribution is used to model μ(f) and σ(f). In order to perform feature augmentation, the standard normal distribution is introduced. The Gaussian perturbation ∈ μ and ∈ σ , using the obtained uncertainty and The degree of Gaussian perturbation is controlled respectively to obtain two affine parameters β and γ, the formula is as follows:

[0099]

[0100]

[0101] Using the affine parameters β and γ, the features of the simulated domain shift are finally generated That is, the augmented features The formula is as follows:

[0102]

[0103] Therefore, the multi-scale feature F m After the adaptive feature augmentation module, the feature

[0104] S4. Construct channel-level whitening module: Use the mapping layer to transform the augmented features The multi-channel mapping of is two channels for true and false discrimination. In the mapping process, according to the index of the mapping layer weight after size sorting, the channels that best represent the true and false categories are divided into the same group in turn. The covariance matrix is ​​calculated in each group and constrained by the unit matrix to calculate the whitening loss L cw ;

[0105] In this embodiment, the channel-level whitening module takes into account that in the mapping layer of the convolutional neural network, the channel feature can represent a kind of semantic information, which specifically represents the two categories of true and false in the field of liveness detection. This module uses the weight index of the sorted mapping layer to sequentially divide the channels that can best represent the two categories of true and false in the mapping process into the same group. Through the decorrelation operation, the covariance between the two channels in each group is reduced, the confusion between the channels representing the two categories of true and false is reduced, and the discriminative representation ability of the channel features is improved. This module mainly includes three parts: weight sorting, weight index grouping, and whitening loss calculation. Figure 5 As shown, the specific process is as follows:

[0106] First, a mapping layer is used to transform the features The multi-channels (assuming that the number of channels before mapping is C) are mapped into two channels representing true and false categories, where two sets of weights corresponding to the true and false channels can be obtained, the subscript r represents true, and the subscript s represents false, that is:

[0107]

[0108]

[0109] Sort the weights of the above two groups of mapping layers from large to small. Assume that the sorted index is as follows:

[0110]

[0111]

[0112] According to the sorted weight index in formula (10-11), the channels that best represent the true and false categories are divided into the same group, that is, channel 3 and channel 16 are grouped together, channel 14 and channel 5 are grouped together, and so on. The covariance matrix is ​​calculated in each group to obtain the whitening loss Lcw , and constrain it using the unit matrix, by reducing the covariance between the two channels in each group, reducing the confusion between the channels representing the true and false categories, thereby improving the discriminative representation ability of channel features. The formula for whitening loss is as follows:

[0113]

[0114] Among them, C is the number of channels before the feature passes through the mapping layer, is the number of groups in the module after grouping, Represents the nth sample feature F in a batch input nn The g-th group, I is the identity matrix, represent The covariance matrix of is:

[0115]

[0116] The formula for calculating the covariance matrix is ​​as follows:

[0117]

[0118] Among them, H and W represent the height and width of the sample feature map respectively, and F n,i,h,w ,F n,j,h,w (i,j∈[1,2]) represent the channel dimension features representing true and false in each group of the nth sample features, μ n,i ,μ n,j (i,j∈[1,2]) correspond to the channel means respectively, 1 and 2 represent the categories true and false respectively, i and j represent the channel indexes in the group, and the value range is [1,2].

[0119] S5. Construct a channel-level rejection module: This module is located in the second branch of the two-branch network. It uses the domain discriminator D and measures the domain tendency of each channel according to its weight, and removes the channels that contribute greatly to the domain identification task to suppress the channels that are sensitive to domain shift.

[0120] In this embodiment, the channel-level culling module extracts domain-invariant features by removing channels that are sensitive to domain shift. Figure 6 As shown in Figure 1, the domain discriminator D used in this module consists of a global average pooling layer (GAP) and a fully connected layer. A gradient reversal layer (GRL) is used before D to truncate the return gradient, which is used to avoid the negative impact of the domain division task on the main network classification task. mEnter this module and use the weights of the fully connected layer in the domain discriminator D to calculate the weighted activation value s predicted as the correct domain c , thereby measuring the domain tendency of each channel. The specific formula is as follows:

[0121]

[0122] Where c is the channel index, represents the fully connected layer weight corresponding to the channel predicted as the correct domain d, s c The larger the value, the greater the contribution of the channel to the domain identification task, that is, the more sensitive it is to domain shift. Therefore, it is necessary to continuously guide the model to remove such channels that are biased towards the domain during the forward propagation process to improve the domain generalization performance of the detection model. This module uses the idea of ​​adversarial learning. The task of the domain discriminator D is to identify channels that are sensitive to domain shift as much as possible, and the ultimate goal of the module is to learn domain invariant features. The domain identification loss L involved in this module is d The formula is as follows:

[0123]

[0124] Where P is the number of source domains, n d represents the number of samples with domain label d in a batch input, j is the predicted domain label, It means that the value of this formula is 1 when the domain discriminator D predicts correctly, otherwise it is 0.

[0125] S6. Construct an attention feature fusion module: Use the channel attention mechanism to fuse the features processed by the two branches to obtain the final discriminant features.

[0126] In this embodiment, the attention feature fusion module uses the channel attention mechanism to fuse the two parts of features after the two branches in the network are optimized to obtain the final discriminant feature like Figure 7 As shown in the figure, the channel attention mechanism adopted by this module generates fusion weights based on two branches (global channel attention and local channel attention) of different scales to achieve better feature fusion effect. The specific fusion method is as follows:

[0127]

[0128] Among them, X and Y represent the features output after being processed by the channel-level whitening module of the first branch and the features output after being processed by the channel-level culling module of the second branch, respectively. represents the addition of corresponding elements, Indicates the multiplication of corresponding elements, A() indicates obtaining the fusion weight based on the attention mechanism. The specific operation of the process is as follows:

[0129]

[0130] Among them, σ is the Sigmoid activation function, L(X) and G(X) represent the channel attention of local features and global features respectively. The specific operations of L(X) mainly include 1×1 point-by-point convolution, BN layer, and ReLU activation function. The only difference between G(X) and L(X) is that G(X) first passes through a global average pooling layer, and then performs several operations in L(X);

[0131] S7. Build a classifier: The final discriminant features Send it to the classifier to get the binary classification prediction result;

[0132] In this embodiment, the classifier includes a fully connected layer with an input dimension of N×8×8 and an output dimension of 4N, a ReLU activation function layer, a Dropout layer, and a fully connected layer with an input dimension of 4N and an output dimension of 2.

[0133] Specifically, Input the classifier to get the output feature of size 2. Calculate based on the output feature to get the predicted label and predicted probability value, and use the true and false label y of the sample to supervise it to get the classification loss function L cls , the formula is as follows:

[0134] L cls =-(ylog(y′)+(1-y)log(1-y′)) (19)

[0135] Among them, y represents the true or false label of the sample, and y′ represents the predicted label;

[0136] S8. Network training: Use the true or false label y and domain label d of the input sample to supervise the output of the classifier and the output of the domain discriminator D, and get the binary classification loss L cls and domain discrimination loss L d , combined with the whitening loss L of the channel-level whitening module cw , calculate the total loss function L all , used to constrain the model training process, update the network weight coefficients, and save the network model and optimal weights after training;

[0137] Specifically, the RGB face image is input into the network for end-to-end training, and the Adam optimizer is used as the training optimizer, and the learning rate is set to 2×10 -4 , the exponential decay rate of the first-order moment estimate β 1 is 0.9, and the exponential decay rate of the second-order moment estimate is β 2is 0.999, and the network weights are updated to minimize the total loss function. After training, the network model and optimal weights are saved. The total loss function involved in this process is as follows:

[0138] L all =λ 1 L cls +λ 2 L cw +λ 3 L d (20)

[0139] Among them, L cls is the binary classification loss, L cw is the whitening loss obtained by the channel-level whitening module in the first branch of the two-branch network, L d is the domain discrimination loss obtained by the channel-level culling module in the second branch of the network, λ 1 , 2 , 3 are the weights of the three losses, and in this embodiment, their values ​​are 1, 0.5, and 1 respectively;

[0140] S9. Network testing: Use the trained model for testing and calculate various benchmark indicators based on the prediction results.

[0141] The specific process is as follows: the test set samples are input into the trained network for feature extraction and prediction, the prediction results of the test set samples are output, and various benchmark indicators are calculated based on the prediction results. The benchmark indicators used include false positive rate (FPR), false negative rate (FNR), half total error rate (HTER) and area under the receiver operating characteristic curve (ROC).

[0142] The false positive rate (FPR) refers to the ratio of the number of non-live faces judged as live faces to the number of faces labeled as non-live faces. The formula is as follows:

[0143]

[0144] The false negative rate (FNR) refers to the ratio of the number of live faces judged as non-live faces to the number of faces labeled as live faces. The formula is as follows:

[0145]

[0146] The half total error rate (HTER) refers to the average of the false positive rate and the false negative rate. The smaller the HTER value, the better the detection effect of the model. The formula is as follows:

[0147]

[0148] The ROC curve is drawn by calculating the false positive rate FPR and true positive rate (True Positive Rate, TPR) under different thresholds, with FPR as the horizontal axis and TPR as the vertical axis. The AUC is the area under the ROC curve. The larger the AUC value, the better the detection effect of the model.

[0149] The present invention is based on a dual-branch network and utilizes whitening and culling operations at the feature channel level, so that the model can not only achieve the task of true and false discrimination, but also suppress information that is sensitive to domain shift, thereby improving the domain generalization performance of the living body detection model.

[0150] In this embodiment, three-database-cross-one-database experiments are conducted on four databases, namely Oulu_NPU (denoted as O database), CASIA-MFSD (denoted as C database), MSU-MFSD (denoted as M database), and Replay-Attack (denoted as I database) (training is performed on three databases and testing is performed on the remaining database) to verify the generalization performance of the algorithm, namely OCI database crosses M database (OCI_M), OMI database crosses C database (OMI_C), OCM database crosses I database (OCM_I), and ICM database crosses O database (ICM_O). The experimental results are shown in the following table:

[0151] Table 1 Cross-library test results (HTER)

[0152] method OCI_M OMI_C OCM_I ICM_O average value CAD 11.64% 17.51% 15.08% 14.27% 14.63% SSAN-R 6.67% 10.00% 8.88% 13.72% 9.82% The present invention 5.83% 10.56% 10.12% 9.98% 9.12%

[0153] Table 2 Cross-library test results (AUC)

[0154] method OCI_M OMI_C OCM_I ICM_O average value CAD 95.27% 89.98% 91.92% 93.04% 92.55% SSAN-R 98.75% 96.67% 96.79% 93.63% 96.46% The present invention 98.52% 97.15% 96.53% 95.76% 96.99%

[0155] This embodiment uses CAD and SSAN-R as the comparison algorithms of the present invention. CAD was published in ICASSP in 2022. This method improves cross-database performance through feature decoupling and cross-adversarial training. SSAN-R was published in CVPR in 2022. This method enhances feature diversity through style recombination and uses adversarial learning to extract domain-invariant features to improve the generalization performance of the detection model. Both are representative algorithms in the field of liveness detection, and SSAN-R is one of the currently leading algorithms. It can be seen from Table 1 and Table 2 that the HTER of the present invention in four cross-library experiments of OCI library across M library, OMI library across C library, OCM library across I library, and ICM library across O library are 5.83%, 10.56%, 10.12%, and 9.98%, respectively, with an average of 9.12%; the AUC are 98.52%, 97.15%, 96.53%, and 95.76%, respectively, with an average of 96.99%. It can be seen that the method is generally better than the two comparison algorithms, showing better domain generalization performance, which verifies the effectiveness of the method of this embodiment.

[0156] Example 2

[0157] This embodiment provides a liveness detection system based on feature channel characterization, which is used to implement the liveness detection method based on feature channel characterization of the above-mentioned embodiment 1. The system includes: a data preprocessing module, a multi-scale feature extraction module, an adaptive feature augmentation module, a channel-level whitening module, a channel-level elimination module, an attention feature fusion module, a classifier, a network training module and a testing module;

[0158] In this embodiment, the data preprocessing module divides the video data set, divides the video data set into video frames, extracts the face area of ​​each frame image to obtain a face image, and sets a corresponding authenticity label and domain label for the face image;

[0159] In this embodiment, the multi-scale feature extraction module is used to extract multi-scale features of the face image;

[0160] In this embodiment, the adaptive feature augmentation module is used to expand the representation space of the multi-scale feature, by calculating the feature statistics of the multi-scale feature, modeling the Gaussian distribution and introducing disturbances, finding the uncertainty of the statistic, setting its upper and lower limits to control the degree of disturbance, and obtaining two affine parameters to perform augmentation transformation on the multi-scale feature to expand its representation space, thereby obtaining the augmented feature;

[0161] In this embodiment, the channel-level whitening module uses a mapping layer to map the multi-channels of the augmented features into two channels for true and false discrimination. In the mapping process, the channels that best represent the true and false categories are divided into the same group in turn according to the index of the mapping layer weight after size sorting. The covariance matrix is ​​calculated in each group, and the unit matrix is ​​used to constrain it, and the whitening loss is calculated;

[0162] In this embodiment, the channel-level elimination module is used to calculate the weighted activation value predicted as the correct domain based on the multi-scale features of the input using the weights of the fully connected layer in the domain discriminator, measure the domain tendency of each channel, eliminate the channels that contribute greatly to the domain identification task, and learn domain invariant features;

[0163] In this embodiment, the attention feature fusion module is used to fuse the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level culling module based on the channel attention mechanism to obtain the final discriminant features;

[0164] In this embodiment, the classifier is used to obtain a binary classification prediction result based on the final discriminant features;

[0165] In this embodiment, the network training module is used to supervise the output results of the classifier and the output results of the domain discriminator using the true and false labels and the domain labels respectively, to obtain the binary classification loss and the domain discrimination loss, and to obtain the total loss function by weighting the whitening loss of the channel-level whitening module, and to train and update the weight coefficient of the network model;

[0166] In this embodiment, the testing module is used to obtain a liveness detection prediction result based on the trained network model.

[0167] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A method for liveness detection based on feature channel representation, characterized in that: The steps include: The video dataset is divided into video frames, the face area of ​​each frame image is extracted to obtain the face image, and the corresponding authenticity label and domain label are set for the face image; Construct a multi-scale feature extraction module to extract multi-scale features of face images; Construct an adaptive feature augmentation module to expand the representation space of multi-scale features. By calculating the feature statistics of multi-scale features, Gaussian distribution modeling is performed on them and disturbances are introduced. The uncertainty of the statistics is calculated, and the upper and lower limits are set to control the degree of disturbance. Two affine parameters are obtained to perform augmentation transformation on multi-scale features to expand their representation space and obtain augmented features. Construct a channel-level whitening module, input the augmented features into the channel-level whitening module, use the mapping layer to map the multi-channels of the augmented features into two channels for true and false discrimination, and in the mapping process, divide the channels that best represent the true and false categories into the same group according to the index of the mapping layer weights after size sorting, calculate the covariance matrix in each group, and constrain it with the unit matrix to calculate the whitening loss; Construct a channel-level elimination module, input multi-scale features into the channel-level elimination module, use the weight calculation of the fully connected layer in the domain discriminator to predict the weighted activation value of the correct domain, measure the domain tendency of each channel, eliminate the channels that contribute greatly to the domain identification task, and learn domain-invariant features; Construct an attention feature fusion module, and fuse the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level culling module based on the channel attention mechanism to obtain the final discriminant features; Build a classifier and input the final discriminant features into the classifier to obtain the binary classification prediction result; The output results of the classifier and the domain discriminator are supervised by using the authenticity label and domain label respectively, and the binary classification loss and domain discrimination loss are obtained. The total loss function is obtained by combining the whitening loss of the channel-level whitening module to train and update the weight coefficient of the network model. The liveness detection prediction results are obtained based on the trained network model.

2. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: Construct a multi-scale feature extraction module to extract multi-scale features of face images, including: The multi-scale feature extraction module uses the first three layers of ResNet-18 as the initial feature extractor of the input face image, extracts the features of each layer of the input face image, performs scale transformation operations on the obtained features at each level, and obtains multi-scale features through linear addition.

3. The multi-scale feature extraction module according to claim 2, characterized in that: The obtained features at all levels are scaled and multi-scale features are obtained by linear addition, including: The features output by the first layer are scaled and then linearly added to the output of the second layer. The processed features are scaled and then linearly added to the output of the third layer to obtain multi-scale features.

4. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: Construct an adaptive feature augmentation module to expand the representation space of multi-scale features, including: Calculate the mean and standard deviation of multi-scale features in the channel dimension, which can be expressed as: Among them, μ(f) represents the mean, σ(f) represents the standard deviation, H, W and c represent the height, width and channel of the sample feature map respectively, and f c,h,w Represents multi-scale features in the channel dimension; Calculate the variance of μ(f) and σ(f), which are respectively and The formula is as follows: Where E n () means finding the mean of feature statistics; use and The uncertainty of μ(f) and σ(f) is measured respectively, and the Gaussian distribution is used to model μ(f) and σ(f), and the standard normal distribution is introduced. The Gaussian perturbation ∈ μ and ∈ σ , based on the uncertainty, the degree of Gaussian perturbation is controlled respectively, and two affine parameters are obtained, which are specifically expressed as: Based on the affine parameters β and γ, the features of the simulated domain shift, that is, the augmented features, are generated, which are specifically expressed as: in, represents the feature of the simulated domain shift, and f represents the multi-scale feature before augmentation.

5. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: The whitening loss is expressed as: Among them, L cw represents the whitening loss, N represents the number of input sample features, and C represents the number of channels before the feature passes through the mapping layer. is the number of groups after grouping, Represents the nth sample feature F in a batch input nn The g-th group, I is the identity matrix, represent The covariance matrix of the sample feature map is H, W, and F. n,i,h,w ,F n,j,h,w (i,j∈[1,2]) represent the features on the channel dimension representing true and false in each group of the nth sample features, μ n,i ,μ n,j (i,j∈[1,2]) correspond to the channel means respectively, 1 and 2 represent the categories true and false respectively, i and j represent the channel indexes in the group, and the value range is [1,2].

6. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: The weighted activation value predicted as the correct domain is calculated using the weights of the fully connected layer in the domain discriminator, which is specifically expressed as: Among them, s c represents the weighted activation value, c is the channel index, represents the fully connected layer weight corresponding to the channel predicted as the correct domain, F m represents multi-scale features, and GAP represents the global average pooling layer.

7. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: The domain discrimination loss of the domain discriminator is expressed as: Among them, L d represents the domain discrimination loss, P is the number of source domains, and n d represents the number of samples with domain label d in a batch input, j is the predicted domain label, It means that the value of this formula is 1 when the domain discriminator D predicts correctly, otherwise it is 0. m Represents multi-scale features.

8. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: Based on the channel attention mechanism, the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level elimination module are fused to obtain the final discriminant features, which are specifically expressed as: Among them, X and Y represent the features output by the channel-level whitening module and the features output by the channel-level culling module, respectively. represents the addition of corresponding elements, Indicates the multiplication of corresponding elements, A() indicates obtaining the fusion weight based on the attention mechanism. The specific operations are as follows: Among them, σ is the Sigmoid activation function, L(X) and G(X) represent the channel attention of local features and global features respectively.

9. The method for liveness detection based on feature channel characterization according to claim 1, characterized in that: The final discriminant features are input into the classifier to obtain the binary classification prediction results, including: The predicted labels and predicted probability values ​​are calculated based on the output features of the classifier, and supervised training is performed based on the true and false labels to construct the binary classification loss, which is specifically expressed as: L cls =-(ylog(y′)+(1-y)log(1-y′)) Among them, L cls represents the binary classification loss, y represents the true or false label, and y′ represents the predicted label.

10. A living body detection system based on feature channel representation, characterized in that: include: Data preprocessing module, multi-scale feature extraction module, adaptive feature augmentation module, channel-level whitening module, channel-level culling module, attention feature fusion module, classifier, network training module and testing module; The data preprocessing module divides the video data set into video frames, extracts the face area of ​​each frame image to obtain a face image, and sets a corresponding authenticity label and domain label for the face image; The multi-scale feature extraction module is used to extract multi-scale features of face images; The adaptive feature augmentation module is used to expand the representation space of multi-scale features by calculating the feature statistics of the multi-scale features, modeling the Gaussian distribution and introducing disturbances, finding the uncertainty of the statistics, setting upper and lower limits to control the degree of disturbance, and obtaining two affine parameters for performing augmentation transformation on the multi-scale features to expand their representation space and obtain augmented features; The channel-level whitening module uses a mapping layer to map the multi-channels of the augmented features into two channels for true and false discrimination. In the mapping process, the channels that best represent the true and false categories are divided into the same group in turn according to the index of the mapping layer weights after size sorting. The covariance matrix is ​​calculated in each group, and it is constrained by the unit matrix to calculate the whitening loss; The channel-level elimination module is used to calculate the weighted activation value predicted as the correct domain based on the input multi-scale features using the weights of the fully connected layer in the domain discriminator, measure the domain tendency of each channel, eliminate the channels that contribute greatly to the domain identification task, and learn domain invariant features; The attention feature fusion module is used to fuse the features optimized by the channel-level whitening module and the domain-invariant features learned by the channel-level culling module based on the channel attention mechanism to obtain the final discriminant features; The classifier is used to obtain a binary classification prediction result according to the final discriminant feature; The network training module is used to supervise the output results of the classifier and the output results of the domain discriminator using the true and false labels and the domain labels respectively, obtain the binary classification loss and the domain discrimination loss, combine the whitening loss of the channel-level whitening module to weight the total loss function, and train and update the network model weight coefficient; The test module is used to obtain a liveness detection prediction result based on the trained network model.

Citation Information

Patent Citations

  • Multi-scale attention fusion-based dual-supervision face in-vivo detection method

    CN115131880A

  • Optical fingerprint sensor with spoof detection and associated method

    US20230072103A1

Cited By

  • Generalized face living body detection method based on frequency domain shortcut analysis

    CN119763173A

  • Domain decomposition type multi-scale intelligent simulation method for geothermal development scene

    CN119830728A

  • A domain decomposition-based multi-scale intelligent simulation method for geothermal development scenarios

    CN119830728B