Living body detection method and device based on dazzle light technology and electronic equipment
By combining facial key point correction and multi-color space feature extraction with a dual-channel attention fusion method, the light and color recognition accuracy of glare decoding technology in complex lighting scenarios is improved, solving the problem of low light and color recognition accuracy in existing technologies and ensuring the security of remote identity authentication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-13
Smart Images

Figure CN121661719A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of video recognition technology, specifically to a liveness detection method based on glare technology, a liveness detection device based on glare technology, and an electronic device. Background Technology
[0002] In remote identity authentication scenarios such as fintech and digital payments, real-time video liveness detection technology can be used to verify user biometrics, thus resisting spoofing attacks and preventing identity fraud. However, video injection attackers can hijack camera permissions to inject fake facial video streams or use electronic screens to play dynamic videos to deceive the acquisition system, leading to the risk of non-liveness fraud. Glare decoding technology has emerged to address this issue. Its core logic is to actively illuminate an electronic screen to capture the reflected light characteristics of a face, and identify non-liveness attacks by verifying the consistency of the light color and illumination pattern in each frame.
[0003] Current glare decoding technology has formed a basic technical framework, relying on computer vision and deep learning algorithms to extract and match light and color features. Existing solutions analyze glare artifacts such as halos and stripes in video frames by constructing glare decoding models, thereby completing light and color judgment and authenticity verification.
[0004] Existing glare decoding technology still has shortcomings in practical applications. For example, the accuracy of light color recognition is low, and it is easily affected by light reflection signal noise, ambient light interference and material reflection differences. In particular, it is prone to classification errors in attack scenarios such as screen copying. Summary of the Invention
[0005] To address the aforementioned technical deficiencies, this invention provides a liveness detection method, apparatus, and electronic device based on glare technology.
[0006] The first aspect of this invention provides a liveness detection method based on glare technology, comprising: Real-time facial video capture; The coordinates of key facial features are extracted from the first and current frames of a face video, and the face region is corrected based on the coordinates of the key facial features. Based on the corrected first frame image and the current frame image, perform inter-frame difference calculation in multiple color spaces to obtain the YCrCb color space frame difference map and the RGB color space frame difference map; Feature extraction was performed on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain channel feature maps; A dual-channel attention fusion method is used to fuse the channel feature maps to obtain a dual-channel attention feature map; The dual-channel attention feature map is input into the image classification model for classification processing to obtain the light and color classification results.
[0007] In this embodiment of the invention, facial region correction based on the coordinates of key facial features includes: Calculate the similarity transformation matrix based on the coordinates of key facial features; The similarity transformation matrix is applied to the face region of the current frame image using bilinear interpolation, so that the face regions in the first frame image and the current frame image are spatially aligned.
[0008] In this embodiment of the invention, the step of calculating the similarity transformation matrix based on the coordinates of key facial features includes: using the coordinates of key facial features in the first frame image as a reference, performing a Prouke analysis on the key facial features in the current frame image, calculating the center coordinates of the key facial features in the first frame image and the center coordinates of the key facial features in the current frame image, calculating the rotation angle and scaling factor through singular value decomposition, and establishing the similarity transformation matrix.
[0009] In this embodiment of the invention, the similarity transformation matrix is: ; Where M represents the similarity transformation matrix, θ is the rotation angle, s is the scaling factor, and C0 x C0 y Ct represents the center coordinates of key facial features in the first frame image. x 、Ct y These are the center coordinates of key facial features in the current frame image.
[0010] In this embodiment of the invention, the multi-color space inter-frame difference calculation based on the corrected first frame image and the current frame image includes: The corrected first frame image and the current frame image are converted to the YCrCb color space, and inter-channel difference operations are performed on the Y, Cr, and Cb channels to obtain the YCrCb color space frame difference map. Simultaneously, the corrected first frame image and the current frame image are converted to the RGB color space, and inter-channel difference operations are performed on the R, G, and B channels to obtain the RGB color space frame difference map.
[0011] In this embodiment of the invention, the inter-channel difference operation on the Y, Cr, and Cb channels includes: The absolute difference between the Y, Cr, and Cb channels of the first frame image and the current frame image is calculated respectively to obtain the frame difference map of the Y, Cr, and Cb channels; Through linear normalization, the pixel values of the frame difference maps of the Y, Cr, and Cb channels are mapped to the range of [0, 255].
[0012] In this embodiment of the invention, the inter-channel differential operation on the R, G, and B channels includes: Calculate the differences between the RG, GB, and BR channels for the first frame image and the current frame image respectively to obtain the difference map between the RG, GB, and BR channels; A second frame difference operation is performed on the inter-channel difference map of the first frame image and the inter-channel difference map of the current frame image to obtain the RGB color space frame difference map.
[0013] In this embodiment of the invention, the feature extraction of the YCrCb color space frame difference map and the RGB color space frame difference map includes: performing 3×3 convolution processing and function activation processing on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain a 6-channel feature map.
[0014] In this embodiment of the invention, the method of fusing the channel feature maps using a dual-channel attention fusion method includes: Attention weighting is applied to the channel feature maps; The weighted channel feature maps are convolved and activated to generate a spatial attention weight map; Weights are assigned to the regions corresponding to key facial features in the spatial attention weight map. The weighted spatial attention weight map is then multiplied pixel by pixel with the weighted channel feature map to generate a dual-channel attention feature map.
[0015] In this embodiment of the invention, the loss function used by the image classification model includes: classification loss, key region feature loss, and color space consistency loss; The classification loss is a weighted cross-entropy loss for the light and color classification task of face video frames; The key region feature loss is used to constrain the difference between the key facial features and the actual physiological movement features. The color space consistency loss is used to ensure the consistency of the YCrCb channel features with the RGB channel features distribution.
[0016] A second aspect of the present invention provides a liveness detection device based on glare technology, comprising: a video acquisition module and an image processing module; The video acquisition module is used to acquire facial videos in real time; The image processing module is used for: The coordinates of key facial features are extracted from the first and current frames of a face video, and the face region is corrected based on the coordinates of the key facial features. Based on the corrected first frame image and the current frame image, perform inter-frame difference calculation in multiple color spaces to obtain the YCrCb color space frame difference map and the RGB color space frame difference map; Feature extraction was performed on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain channel feature maps; A dual-channel attention fusion method is used to fuse the channel feature maps to obtain a dual-channel attention feature map; The dual-channel attention feature map is input into the image classification model for classification processing to obtain the light and color classification results.
[0017] A third aspect of the present invention provides an electronic device, comprising: Memory, which stores computer programs; A processor is used to execute the computer program to implement the above-described liveness detection method based on glare technology.
[0018] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described liveness detection method based on glare technology.
[0019] The fifth aspect of the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the above-described liveness detection method based on glare technology.
[0020] The above technical solution first corrects the facial region by extracting the coordinates of key facial features, constructing a dynamic frame difference for facial key point correction. This effectively eliminates non-rigid motion interference caused by changes in facial pose, ensuring that the frame difference results only reflect real physiological motion features, thus laying a stable foundation for subsequent feature extraction. Next, by extracting features from the YCrCb and RGB color spaces in parallel, it enhances the differences in brightness, color components, and relative changes in the three primary colors of the moving region, improving feature representation capabilities under complex lighting conditions. Then, a dual-channel attention fusion method is used to dynamically adjust the contribution of different color channels and enhance features of key areas such as the eyes and nose, suppressing background noise interference. Finally, an image classification model is used for light and color classification, significantly improving the accuracy of recognizing subtle facial physiological movements while ensuring computational efficiency.
[0021] Other features and advantages of the technical solution of the present invention will be described in detail in the following detailed embodiments section. Attached Figure Description
[0022] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a flowchart of a liveness detection method based on glare technology provided in an embodiment of the present invention; Figure 2 This is a flowchart of video liveness glare decoding in a specific example; Figure 3This is a block diagram of a liveness detection device based on glare technology provided in an embodiment of the present invention. Detailed Implementation
[0023] To make the technical solutions and advantages of the embodiments of the present invention clearer, the exemplary embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0024] In the process of realizing this invention, the inventors discovered that existing glare decoding technologies still have significant limitations in practical applications, mainly in three aspects: environmental adaptability, light and color recognition accuracy, and feature representation capability, as detailed below: 1. Insufficient utilization of frame difference features and weak discrimination ability. Traditional frame difference methods rely solely on the difference between simple adjacent pixels to detect changes in light color, which is easily affected by noise and changes in lighting, and can produce feature holes due to motion blur and occlusion. This is because there may be two colors of light that are similar between adjacent frames, or the difference images of different light color frames may have similar colors. It lacks accurate capture of the trend of light color changes between consecutive frames, making it difficult to distinguish the subtle movements of real faces from the differences in light signals in fake videos.
[0025] 2. Limited color channel feature extraction leads to low color differentiation. Existing feature extraction and classification models easily confuse the reflection features of two types of light colors, resulting in classification bias. This is because most solutions rely on a single RGB color space for feature extraction, ignoring the texture differences in the Cb and Cr channels in spaces such as YCbCr and HSV, and failing to fully integrate multi-operator features, making it difficult to capture subtle spectral differences between light colors.
[0026] 3. Limited feature input dimensions and inadequate model fusion capabilities. Existing feature extraction and classification models mostly use full-face images and basic features, without combining local facial features such as eyes and nose, and lack fusion structures for multi-channel and multi-region inputs. The root cause lies in the failure to recognize the differences in light reflection characteristics of different facial regions. A single input cannot comprehensively represent light and color features. At the same time, the feature extraction network is not optimized for glare scenes, making it difficult to integrate multi-source information to improve classification accuracy.
[0027] To address the aforementioned issues, this invention provides a liveness detection method and apparatus based on glare technology. First, the facial region is corrected by extracting the coordinates of key facial features, constructing a dynamic frame difference for facial keypoint correction. This effectively eliminates non-rigid motion interference caused by facial pose changes, ensuring that the frame difference results only reflect real physiological motion features, laying a stable foundation for subsequent feature extraction. Then, features from the YCrCb and RGB color spaces are extracted in parallel, enhancing the differences in brightness, color components, and relative changes in the three primary colors of the moving region, improving feature representation capabilities under complex lighting conditions. Next, a dual-channel attention fusion method is used to dynamically adjust the contribution of different color channels and enhance features of key areas such as the eyes and nose, suppressing background noise interference. Finally, an image classification model is used for light and color classification, significantly improving the accuracy of recognizing subtle facial physiological movements while maintaining computational efficiency.
[0028] Figure 1 This is a flowchart of a liveness detection method based on glare technology provided in an embodiment of the present invention. Figure 1 As shown, the liveness detection method based on glare technology provided in this embodiment includes the following steps: S110, real-time facial video capture; S120: Extract the coordinates of key facial features based on the first and current frame images of the face video, and correct the face region based on the coordinates of the key facial features. S130, perform multi-color space inter-frame difference calculation based on the corrected first frame image and the current frame image to obtain the YCrCb color space frame difference map and the RGB color space frame difference map; S140, extract features from the YCrCb color space frame difference map and the RGB color space frame difference map to obtain channel feature maps; S150, the dual-channel attention fusion method is used to fuse the channel feature maps to obtain a dual-channel attention feature map; S160: Input the dual-channel attention feature map into the image classification model for classification processing to obtain the light and color classification result.
[0029] In step S120 above, the face region is corrected based on the coordinates of key facial features (such as the pupils of both eyes, the tip of the nose, etc.). Specifically, this includes: calculating a similarity transformation matrix based on the coordinates of the key facial features; applying the similarity transformation matrix to the face region of the current frame image using bilinear interpolation, so that the face regions in the first frame image and the current frame image are aligned in spatial position, thereby achieving geometric correction of the face image.
[0030] In a specific embodiment, the similarity transformation matrix is calculated based on the coordinates of the key facial features. Specifically, using the coordinates of the key facial features in the first frame image as a reference, Procrustes analysis is performed on the key facial features in the current frame image to calculate the center coordinates of the key facial features in the first frame image and the center coordinates of the key facial features in the current frame image. The rotation angle and scaling factor are calculated through singular value decomposition (SVD) to establish the similarity transformation matrix.
[0031] The similarity transformation matrix is: ; Where M represents the similarity transformation matrix, θ is the rotation angle, s is the scaling factor, and C0 x C0 y Ct represents the center coordinates of key facial features in the first frame image. x 、Ct y These are the center coordinates of key facial features in the current frame image.
[0032] In step S130 above, multi-color space inter-frame difference calculation is performed based on the corrected first frame image and the current frame image, including: converting the corrected first frame image and the current frame image to the YCrCb color space, performing inter-channel difference operation on the Y, Cr, and Cb channels to obtain a YCrCb color space frame difference map; at the same time, converting the corrected first frame image and the current frame image to the RGB color space, performing inter-channel difference operation on the R, G, and B channels to obtain an RGB color space frame difference map.
[0033] Specifically, the Y, Cr, and Cb channels are subjected to inter-channel difference operations, which include: calculating the absolute difference between the Y, Cr, and Cb channels of the first frame image and the current frame image respectively to obtain the Y, Cr, and Cb channel frame difference map; then, through linear normalization processing, the pixel values of the Y, Cr, and Cb channel frame difference map are mapped to the range of [0, 255] to avoid brightness overflow.
[0034] Specifically, the inter-channel difference operation for the R, G, and B channels includes: calculating the difference between the RG, GB, and BR channels for the first frame image and the current frame image respectively to obtain the inter-channel difference map of RG, GB, and BR; and then performing a second frame difference operation on the inter-channel difference map of the first frame image and the inter-channel difference map of the current frame image to obtain the RGB color space frame difference map.
[0035] In step S140 above, feature extraction is performed on the YCrCb color space frame difference map and the RGB color space frame difference map. Specifically, this includes performing 3×3 convolution processing and ReLU function activation processing on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain a 6-channel feature map.
[0036] In step S150 above, a dual-channel attention fusion method is used to fuse the channel feature maps. Specifically, this includes: performing attention weighting on the channel feature maps, performing convolution and activation on the weighted channel feature maps to generate a spatial attention weight map; then, assigning weights to the regions corresponding to key facial features in the spatial attention weight map, and multiplying the weighted spatial attention weight map with the weighted channel feature maps pixel by pixel (enhancing features) to generate a dual-channel attention feature map.
[0037] In step S160 above, the loss functions used by the image classification model include: classification loss, key region feature loss, and color space consistency loss. The classification loss is a weighted cross-entropy loss for light and color classification tasks of face video frames. The key region feature loss is used to constrain the difference between key facial features and actual physiological motion features. The color space consistency loss is used to ensure the consistency of the distribution of YCrCb channel features and RGB channel features.
[0038] In specific application scenarios, the process of video liveness detection using facial video is as follows: the user starts facial recognition, the action liveness detection device issues instructions and detects the action, the action liveness detection model determines whether it passes, at this time the mobile phone screen is illuminated, the glare decoding device identifies the light color, the glare decoding model determines whether it passes, and finally the offline video understanding model determines whether it is fraudulent.
[0039] like Figure 2 As shown, in a specific example, the process of video liveness glare decoding is as follows: (1) Face detection to ensure that the face is within the frame; (2) Facial landmark detection, obtaining the coordinates of key points such as eyes and nose; (3) Geometric correction of the face region to align the two frames of faces in space; (4) Obtain frame difference maps for YCrCb and RGB color spaces respectively; (5) 3×3 convolution kernels extract features from two frame difference maps respectively, and then stitch them together to form a 6-channel feature map; (6) The channel attention module dynamically allocates the importance of different color channels; (7) The spatial attention module focuses on enhancing the key features of the moving area; (8) The MS-LSNet lightweight image classification model outputs light and color classification results.
[0040] Face detection and keypoint extraction employ a collaborative approach of "lightweight detection + high-precision localization". The SCRFD-0.5G model is used for face detection, suitable for real-time interactive scenarios. Weights pre-trained on the WIDERFace dataset are used, and the input image size is fixed at 384×384 (to match the subsequent MS-LSNet input requirements). The face detection confidence threshold is set to 0.55. When multiple faces are detected, the distance between the face bounding box and the image center is calculated, and the face region closest to the center is retained. The output face bounding box coordinates (x1, y1, x2, y2) and five initial keypoints (center of both eyes, tip of the nose, left and right corners of the mouth) are then output.
[0041] The keypoint refinement extraction employs the PFLD algorithm, further locating 106 facial keypoints based on the face bounding box output by SCRFD. A focus is placed on selecting 24 keypoints strongly correlated with physiological movement, including the pupils (points 67-73 and 74-80), the tip of the nose (point 52), the alar bases of the nose (points 50 and 53), and the upper lip (point 83). In the geometric correction stage, using the coordinates of the 24 keypoints in the first frame as a benchmark, Procrustes analysis is performed on the keypoints in the current frame: First, the center coordinates of the keypoints in the two frames are calculated (center C0=(x0_avg,y0_avg) in the first frame, center Ct=(xt_avg,yt_avg) in the current frame) to eliminate translational bias; then, the rotation angle θ (range -30° to 30°) and scaling factor s (range 0.8 to 1.2) are calculated through Singular Value Decomposition (SVD) to construct a similarity transformation matrix. ; Geometric correction is achieved by applying matrix M to the face region of the current frame using bilinear interpolation. After correction, the positional error of the key facial points between the two frames is controlled within 1.2 pixels.
[0042] In the multi-color-space inter-frame difference calculation process, the RGB color space is first converted to the YCrCb color space. In the YCrCb channel frame difference calculation, the absolute difference is calculated for the Y, Cr, and Cb channels respectively: ; ; ; Among them, D Y Y0 represents the absolute difference of the Y channel, and Y0 represents the Y channel value of the first frame. t 'Indicates the Y channel value of the current frame; D Cr Cr represents the absolute difference of the Cr channel, Cr0 represents the Cr channel value of the first frame, Cr t 'Indicates the current frame's Cr channel value; D Cb This represents the absolute difference of the Cb channel, where Cb0 represents the Cb channel value of the first frame. t 'Indicates the Cb channel value of the current frame; The pixel values of each channel frame difference map are mapped to the range of [0, 255] through linear normalization to avoid brightness overflow.
[0043] RGB channel processing employs a two-stage strategy of "inter-channel difference + quadratic frame difference": First, the differences between the RG, GB, and BR channels are calculated for the current frame and the first frame respectively, using the following constraint formula: , To prevent feature saturation caused by extreme differences; Then perform a second frame difference operation on the inter-channel difference maps of the two frames: ; Finally, an RGB space feature map is generated.
[0044] Two feature maps (one YCrCb channel frame difference map and one RGB channel quadratic frame difference map) are input into independent 3×3 convolutional kernels (the first convolutional layer of the MS-LSNet model). The number of convolutional kernels is set to 96 (matching the output dimension of the first convolutional layer of LSNet), with a stride of 1. SamePadding (padding size = 1) is used to ensure that the output feature map size is consistent with the input (384×384). After the convolutional layer, a ReLU activation function and a BatchNormalization layer (momentum = 0.9, eps = 1e-5) are sequentially applied. The moving mean and variance of the BatchNormalization layer are initialized using the ImageNet-1K dataset for pre-training to accelerate model convergence.
[0045] Channel attention and spatial attention modules can be incorporated into the MS-LSNet lightweight image classification model as dual-channel attention modules. The dual-channel attention module is designed based on the feature processing logic of MS-LSNet, employing a cascaded structure of "channel attention + spatial attention," implemented using PyTorch's nn.Module. In the channel attention submodule, the 6-channel feature map (6×384×384) is processed by global average pooling (GAP) to generate a 6-dimensional feature vector (the mean of each channel), which is then input into two fully connected layers (FC1: 6→3, FC2: 3→6), with a LeakyReLU activation function (negative slope = 0.1) in between. The output is processed by the Sigmoid function to generate the channel weight vector W. C =[W1,W2,...,W6]. For low-light scenes (mean Y channel value < 70 in the first frame), the Y channel weights are adjusted using adaptive coefficients: W Y '=W Y ×1.3, ensuring that brightness features are extracted first.
[0046] The spatial attention submodule uses keypoints output by PFLD as the localization basis: the eye region is located as a rectangle 30 pixels wide and 20 pixels high, centered at the midpoint of the left eye (mean of points 67-73), and similarly for the midpoint of the right eye (mean of points 74-80); the area around the nose is located as a circle with a radius of 18 pixels centered at the tip of the nose (point 52). The channel attention-weighted feature map is input into a 7×7 convolutional layer (stride 1, SamePadding) and a sigmoid activation function to extract spatial context information and generate a spatial attention weight map. Key regions of the spatial attention weight map are assigned a weight of 1.2-1.6 times (eye region weight = 1.6 during blinking, nose region weight = 1.5 during nasal expansion), and the background region weight is set to 1.0. The spatial attention weight map and the channel weighted feature map are multiplied pixel by pixel to generate a dual-channel attention feature map (i.e., a fused feature map). The final output fused feature map has a dimension of 96×384×384, which is suitable for the subsequent feature processing requirements of MS-LSNet.
[0047] The MS-LSNet model retains the residual connections of the original backbone network (using a bottleneck structure with a channel ratio of 1:4) and the feature pyramids (P3-P5 levels, corresponding to resolutions of 192×192, 96×96, and 48×48). After the first convolutional layer (3×3, outputting 96 channels), the aforementioned attention fusion module is inserted. The fused 96×384×384 feature map is then fed into the second convolutional layer of the original model, replacing the original 3-channel input and ensuring the model's computational efficiency.
[0048] The loss function of the MS-LSNet model employs a multi-task fusion strategy, including three types of sub-losses: (1) Classification loss: For the multi-classification task of light and color in video frames, a weighted cross-entropy loss is adopted, and the formula is: , Among them, y i For the real labels (different light color labels are 0, 1, 2, ..., k-1), P i Here, N represents the probability predicted by the model, and N is the number of samples in the batch.
[0049] (2) Key region feature loss: The L1 loss is used to constrain the difference between key region features and actual physiological motion features. The formula is as follows: , Where M is the number of feature points in the key region (taking the feature values corresponding to 24 key points), F j To extract features for the model, F j * These are real features (generated from physiological motion data annotated from the CASIA-FASD dataset).
[0050] (3) Color space consistency loss: KL divergence loss is used to ensure the consistency of YCrCb with the RGB channel feature distribution. The formula is: , Among them, P YCrCb P RGB These are the probability distributions of the features in the two channels.
[0051] The total loss function is: .
[0052] Weights can be determined through a validation set grid search (search range 0.1-0.7), and in practical applications, weights can also be set based on experience. Model training uses the AdamW optimizer (initial learning rate = 1e-4, weight decay = 1e-5, learning rate decays with cosine annealing over training epochs), batch size = 16, training epochs = 80, and an early stopping strategy (training stops if the validation set loss does not decrease after 6 epochs). The dataset used is a hybrid dataset of CASIA-FASD and SiW-M (containing 15000+ video frames, covering low light, side-facing, occlusion, and other scenes) and a real-world glare scene dataset.
[0053] Taking the scenario of remote loan application and identity verification in the internet finance sector as an example, real-time facial video clips of users are collected. First, a lightweight face detection model is used to locate the face in the first frame and the current frame, extracting key points such as the pupils and the tip of the nose. Procrustes analysis is then used to calculate the similarity transformation matrix to correct the face in the current frame. Next, both frames are transformed to the YCrCb space, and the frame difference map of the Y, Cr, and Cb channels is calculated. In the RGB space, the inter-channel difference map is calculated and matched with the first frame. Figure 2 The frame difference maps are processed by 3×3 convolution and ReLU activation. A 6-channel convolutional feature map is then concatenated, and the input channel attention module generates weights, increasing the weight of the Y channel in low-light conditions. A spatial attention module assigns a 1.4x weight to the 18-pixel radius region centered on the nose tip and the 35×22-pixel eye region centered on the pupil. The fused feature map is then input into an improved LSNet to output classification results, accurately identifying light and color changes in user videos, preventing injection attacks and photo / video forgery fraud, adapting to complex lighting environments for remote verification, and ensuring the security of financial company funds.
[0054] The aforementioned liveness detection method based on glare technology can still work stably in complex scenarios such as low light, side profile, and occlusion. It significantly improves the accuracy of liveness detection and physiological state analysis tasks, and the inference speed meets the real-time requirements, providing reliable technical support for high-precision biometric recognition.
[0055] This invention provides a liveness detection device based on glare technology. For example... Figure 3As shown, the liveness detection device based on glare technology provided in this embodiment includes a video acquisition module and an image processing module. The video acquisition module is used to acquire face videos in real time. The image processing module is used to: extract the coordinates of key facial features based on the first frame and the current frame of the face video; correct the face region based on the coordinates of the key facial features; perform multi-color space inter-frame difference calculation based on the corrected first frame and the current frame to obtain a YCrCb color space frame difference map and an RGB color space frame difference map; extract features from the YCrCb color space frame difference map and the RGB color space frame difference map to obtain channel feature maps; fuse the channel feature maps using a dual-channel attention fusion method to obtain a dual-channel attention feature map; and input the dual-channel attention feature map into an image classification model for classification processing to obtain a light and color classification result.
[0056] In this embodiment, the facial region is corrected based on the coordinates of key facial features (such as the pupils of both eyes, the tip of the nose, etc.). Specifically, this includes: calculating a similarity transformation matrix based on the coordinates of the key facial features; applying the similarity transformation matrix to the facial region of the current frame image using a bilinear interpolation method, so that the facial regions in the first frame image and the current frame image are aligned in spatial position, thereby achieving geometric correction of the facial image.
[0057] In this embodiment, the similarity transformation matrix is calculated based on the coordinates of the key facial features. Specifically, using the coordinates of the key facial features in the first frame image as a reference, Procrustes analysis is performed on the key facial features in the current frame image to calculate the center coordinates of the key facial features in the first frame image and the center coordinates of the key facial features in the current frame image. The rotation angle and scaling factor are calculated through singular value decomposition (SVD) to establish the similarity transformation matrix.
[0058] The similarity transformation matrix is: ; Where M represents the similarity transformation matrix, θ is the rotation angle, s is the scaling factor, and C0 x C0 y Ct represents the center coordinates of key facial features in the first frame image. x 、Ct y These are the center coordinates of key facial features in the current frame image.
[0059] In this embodiment, multi-color space inter-frame difference calculation is performed based on the corrected first frame image and the current frame image, including: converting the corrected first frame image and the current frame image to the YCrCb color space, performing inter-channel difference operations on the Y, Cr, and Cb channels to obtain a YCrCb color space frame difference map; simultaneously, converting the corrected first frame image and the current frame image to the RGB color space, performing inter-channel difference operations on the R, G, and B channels to obtain an RGB color space frame difference map.
[0060] Specifically, the Y, Cr, and Cb channels are subjected to inter-channel difference operations, which include: calculating the absolute difference between the Y, Cr, and Cb channels of the first frame image and the current frame image respectively to obtain the Y, Cr, and Cb channel frame difference map; then, through linear normalization processing, the pixel values of the Y, Cr, and Cb channel frame difference map are mapped to the range of [0, 255] to avoid brightness overflow.
[0061] Specifically, the inter-channel difference operation for the R, G, and B channels includes: calculating the difference between the RG, GB, and BR channels for the first frame image and the current frame image respectively to obtain the inter-channel difference map of RG, GB, and BR; and then performing a second frame difference operation on the inter-channel difference map of the first frame image and the inter-channel difference map of the current frame image to obtain the RGB color space frame difference map.
[0062] In this embodiment, feature extraction is performed on the YCrCb color space frame difference map and the RGB color space frame difference map. Specifically, this includes performing 3×3 convolution processing and ReLU function activation processing on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain a 6-channel feature map.
[0063] In this embodiment, a dual-channel attention fusion method is used to fuse the channel feature maps. Specifically, this includes: performing attention weighting on the channel feature maps, performing convolution and activation on the weighted channel feature maps to generate a spatial attention weight map; then, assigning weights to the regions corresponding to key facial features in the spatial attention weight map, and multiplying the weighted spatial attention weight map with the weighted channel feature maps pixel by pixel (enhancing features) to generate a dual-channel attention feature map.
[0064] In this embodiment, the image classification model employs the following loss functions: classification loss, key region feature loss, and color space consistency loss. The classification loss is a weighted cross-entropy loss used for light and color classification tasks of face video frames. The key region feature loss is used to constrain the differences between key facial features and actual physiological motion features. The color space consistency loss is used to ensure the consistency of the distribution of YCrCb channel features with that of the RGB channel features.
[0065] The liveness detection device based on glare technology provided in this embodiment of the invention has similar technical details and effects to the liveness detection method based on glare technology described above. It can be understood by referring to the technical details and application examples of the liveness detection method based on glare technology described above, and will not be repeated here.
[0066] The present invention also provides a computer device, including: a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the above-described liveness detection method based on glare technology.
[0067] The present invention also provides a machine-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the above-described liveness detection method based on glare technology.
[0068] The present invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described liveness detection method based on glare technology.
[0069] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present invention can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0070] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0071] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0072] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0073] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention. Clearly, those skilled in the art can make various alterations and modifications to the invention without departing from its spirit and scope. Thus, if these modifications and modifications of the invention fall within the scope of the claims and their equivalents, the invention is also intended to include these modifications and modifications.
Claims
1. A liveness detection method based on glare technology, characterized in that, include: Real-time facial video capture; The coordinates of key facial features are extracted from the first and current frames of a face video, and the face region is corrected based on the coordinates of the key facial features. Based on the corrected first frame image and the current frame image, perform inter-frame difference calculation in multiple color spaces to obtain the YCrCb color space frame difference map and the RGB color space frame difference map; Feature extraction was performed on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain channel feature maps; A dual-channel attention fusion method is used to fuse the channel feature maps to obtain a dual-channel attention feature map; The dual-channel attention feature map is input into the image classification model for classification processing to obtain the light and color classification results.
2. The liveness detection method based on glare technology according to claim 1, characterized in that, The correction of the facial region based on the coordinates of key facial features includes: Calculate the similarity transformation matrix based on the coordinates of key facial features; The similarity transformation matrix is applied to the face region of the current frame image using bilinear interpolation, so that the face regions in the first frame image and the current frame image are spatially aligned.
3. The liveness detection method based on glare technology according to claim 2, characterized in that, The calculation of the similarity transformation matrix based on the coordinates of key facial features includes: Using the coordinates of key facial features in the first frame as a reference, a Prouk analysis is performed on the key facial features in the current frame to calculate the center coordinates of the key facial features in the first frame and the current frame. The rotation angle and scaling factor are calculated through singular value decomposition to establish a similarity transformation matrix.
4. The liveness detection method based on glare technology according to claim 3, characterized in that, The similarity transformation matrix is: ; Where M represents the similarity transformation matrix, θ is the rotation angle, s is the scaling factor, and C0 x C0 y Ct represents the center coordinates of key facial features in the first frame image. x 、Ct y These are the center coordinates of key facial features in the current frame image.
5. The liveness detection method based on glare technology according to claim 1, characterized in that, The multi-color space inter-frame difference calculation based on the corrected first frame image and the current frame image includes: The corrected first frame image and the current frame image are converted to the YCrCb color space, and inter-channel difference operations are performed on the Y, Cr, and Cb channels to obtain the YCrCb color space frame difference map. Simultaneously, the corrected first frame image and the current frame image are converted to the RGB color space, and inter-channel difference operations are performed on the R, G, and B channels to obtain the RGB color space frame difference map.
6. The liveness detection method based on glare technology according to claim 5, characterized in that, The inter-channel difference operation on the Y, Cr, and Cb channels includes: The absolute difference between the Y, Cr, and Cb channels of the first frame image and the current frame image is calculated respectively to obtain the frame difference map of the Y, Cr, and Cb channels; Through linear normalization, the pixel values of the frame difference maps of the Y, Cr, and Cb channels are mapped to the range of [0, 255].
7. The liveness detection method based on glare technology according to claim 5, characterized in that, The inter-channel differential operation on the R, G, and B channels includes: Calculate the differences between the RG, GB, and BR channels for the first frame image and the current frame image respectively to obtain the difference map between the RG, GB, and BR channels; A second frame difference operation is performed on the inter-channel difference map of the first frame image and the inter-channel difference map of the current frame image to obtain the RGB color space frame difference map.
8. The liveness detection method based on glare technology according to claim 1, characterized in that, The feature extraction of the YCrCb color space frame difference map and the RGB color space frame difference map includes: The YCrCb color space frame difference map and the RGB color space frame difference map are processed by 3×3 convolution and function activation to obtain a 6-channel feature map.
9. The liveness detection method based on glare technology according to claim 1, characterized in that, The method of fusing channel feature maps using a dual-channel attention fusion approach includes: Attention weighting is applied to the channel feature maps; The weighted channel feature maps are convolved and activated to generate a spatial attention weight map; Weights are assigned to the regions corresponding to key facial features in the spatial attention weight map. The weighted spatial attention weight map is then multiplied pixel by pixel with the weighted channel feature map to generate a dual-channel attention feature map.
10. The liveness detection method based on glare technology according to claim 1, characterized in that, The loss functions used in the image classification model include: classification loss, key region feature loss, and color space consistency loss. The classification loss is a weighted cross-entropy loss for the light and color classification task of face video frames; The key region feature loss is used to constrain the difference between the key facial features and the actual physiological movement features. The color space consistency loss is used to ensure the consistency of the YCrCb channel features with the RGB channel features distribution.
11. A liveness detection device based on glare technology, characterized in that, include: Video acquisition module and image processing module; The video acquisition module is used to acquire facial videos in real time; The image processing module is used for: The coordinates of key facial features are extracted from the first and current frames of a face video, and the face region is corrected based on the coordinates of the key facial features. Based on the corrected first frame image and the current frame image, perform inter-frame difference calculation in multiple color spaces to obtain the YCrCb color space frame difference map and the RGB color space frame difference map; Feature extraction was performed on the YCrCb color space frame difference map and the RGB color space frame difference map to obtain channel feature maps; A dual-channel attention fusion method is used to fuse the channel feature maps to obtain a dual-channel attention feature map; The dual-channel attention feature map is input into the image classification model for classification processing to obtain the light and color classification results.
12. An electronic device, characterized in that, include: Memory, which stores computer programs; A processor for executing the computer program to implement the liveness detection method based on glare technology as described in any one of claims 1-10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the liveness detection method based on glare technology as described in any one of claims 1-10.
14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the liveness detection method based on glare technology as described in any one of claims 1-10.
Citation Information
Patent Citations
Low-bit-rate video coding method based on frame difference image
CN104602001A
Face spoofing detection method and system based on color channel difference image features
CN111460931A
Silent living body detection method
CN113609944A
Face image-based dazzle degree detection method and device, equipment and medium
CN113888500A
Silent human face living body detection method
CN117953596A