Face image enhancement and recognition method in low-light environment
Through the multi-scale Retinex enhancement and adaptive feature fusion method, the accuracy and stability of face recognition under low light are solved, and efficient recognition in low light environments is achieved, hardware cost is reduced and recognition efficiency and security are improved.
Patent Information
- Application Number
- CN202510950562.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-07-10
AI Technical Summary
In low-light environments, traditional face recognition technology is difficult to effectively extract image features, resulting in low recognition accuracy. The existing methods cannot adapt to lighting changes and the enhanced image does not match the recognition model, affecting the overall performance.
Multi-scale Retinex enhancement technology is used to separate the illumination and reflection components, combine adaptive feature fusion and attention mechanism, dynamically adjust feature weights, optimize feature expression through the residual attention module, and identify them in combination with pre-trained models.
It improves the accuracy and stability of face recognition in low-light environments, reduces dependence on external fill-up equipment, and improves recognition efficiency and security.
Smart Images

Figure CN120452048A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of face recognition technology, and in particular to a face image enhancement and recognition method in a low-light environment. Background Art
[0002] Facial recognition technology has become an important means of identity verification in many fields, including security monitoring, access control, and mobile payments. However, in low-light environments, such as at night, in underground parking lots, and in dimly lit indoor spaces, the performance of traditional facial recognition systems degrades significantly. Low light conditions cause facial images to exhibit uneven brightness, blurred details, and increased noise, making it difficult to extract facial features. Existing technologies typically employ only a single image enhancement method, such as histogram equalization, but this method tends to over-enhance noise, resulting in image distortion and ineffective recognition. Furthermore, some systems rely on supplemental lighting to enhance image quality, which not only increases hardware costs and deployment difficulties but can also cause user discomfort due to light interference, making them unsuitable for use in complex scenarios.
[0003] With the widespread application of deep learning in computer vision, some face recognition algorithms based on convolutional neural networks (CNNs) have been used in low-light scenarios. However, these algorithms often directly extract features from raw, low-quality images, making it difficult to overcome the effects of uneven lighting, resulting in inaccurate feature extraction. For example, in dim lighting, the network model may not accurately capture the detailed features of key areas such as the eyes and nose, significantly reducing recognition accuracy. Furthermore, existing image enhancement and recognition processes operate independently, lacking targeted collaborative optimization for low-light environments. The enhanced image may not match the input requirements of the recognition model, further impacting overall performance.
[0004] Although some research has attempted to combine image enhancement with recognition, there are still deficiencies in the feature processing link. Traditional methods often use fixed weights when fusing different types of image features, which cannot adapt to the dynamic changes of image features in low-light environments. For example, in extremely low-light conditions, the importance of local texture features may increase significantly, but the fixed-weight fusion method cannot highlight these key features, resulting in insufficient algorithm robustness. In addition, existing technologies lack an effective comprehensive processing mechanism when faced with mixed interference from complex noise and uneven lighting, making it difficult to ensure recognition accuracy and stability while improving image quality. Summary of the Invention
[0005] The present invention proposes a method for enhancing and recognizing facial images in a low-light environment to solve the problems mentioned in the above-mentioned prior art.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for enhancing and recognizing facial images in a low-light environment, comprising the following steps: Multi-scale Retinex enhancement: The input low-light face image is subjected to three-scale Gaussian filtering, with the scale parameters set to 15, 80, and 250, respectively. This filtering separates the illumination and reflection components at different scales. The reflection component is nonlinearly enhanced using an adaptive piecewise logarithmic transformation function. This function dynamically adjusts the threshold and compensation parameters based on the global brightness mean of the image, enhancing dark details while suppressing noise amplification. Adaptive feature fusion steps: Extract the local binary pattern (LBP) features and the histogram of oriented gradients (HOG) features of the enhanced image, evaluate the lighting conditions by calculating the global brightness mean of the image, and dynamically adjust the fusion weights of the two types of features: automatically increase the weight of the LBP texture features in weak lighting to highlight subtle facial textures; increase the weight of the HOG gradient features in strong lighting to enhance contour information; and generate a feature vector of the information through a dynamic fusion strategy; Attention mechanism optimization steps: Construct a residual attention module, extract spatial features through convolution operations and generate a spatial attention weight matrix to focus on the face area; at the same time, use global average pooling and fully connected layers to calculate the channel attention weight matrix to suppress the interference of irrelevant background channels; after multiplying the spatial and channel attention weight matrices element by element, perform weighted optimization on the fused features to improve the feature expression ability of the region and output a discriminative feature vector.
[0007] Furthermore, it also includes: Lighting assessment preprocessing step: Calculate the global brightness mean of the input image. When the mean is lower than the set threshold, the enhancement process is triggered. The scale parameters of the multi-scale Retinex enhancement are dynamically adjusted based on the brightness mean to achieve image enhancement requirements under different light intensities.
[0008] Noise suppression preprocessing step: The input image is denoised using the non-local mean filtering algorithm. By calculating the similarity weight between the current pixel and the pixels in the search window, the image edge details are retained while suppressing noise, generating a clear denoised image.
[0009] Furthermore, in the multi-scale Retinex enhancement step, when weighted fusion is performed on reflection components of different scales, the weights are dynamically adjusted according to the local texture features of the image, and the scale components corresponding to the texture area are given higher weights.
[0010] Furthermore, it also includes: Adaptive histogram equalization steps: convert the enhanced image to the YCbCr color space, perform block-wise local histogram equalization on the luminance component to enhance local contrast; and eliminate the blocking effect at the sub-region boundary through bilinear interpolation.
[0011] Furthermore, in the attention mechanism optimization step, the spatial attention module extracts spatial features through convolution operations, and the channel attention module calculates channel weights through global average pooling and fully connected layers, and finally generates an attention weight matrix through element-by-element multiplication.
[0012] Furthermore, it also includes: Face recognition and matching steps: The optimized feature vector is input into the pre-trained face recognition model to extract the face feature vector and calculate the cosine similarity with the registered vector in the database. The success of face recognition is determined based on the similarity value.
[0013] Post-processing steps for quality assessment: Calculate the clarity index of the enhanced image and evaluate the image quality based on the gradient changes in the horizontal and vertical directions; when the clarity is lower than the threshold, iteratively adjust the enhancement parameters to meet the quality requirements.
[0014] Auxiliary steps for liveness detection: Extract the local ternary pattern LTP texture features and optical flow field micro-motion features of the enhanced image, and input them into the liveness detection model for authenticity judgment to resist non-liveness attacks in photos and videos.
[0015] Furthermore, the piecewise logarithmic transformation function used in the multi-scale Retinex enhancement step dynamically adjusts the enhancement parameters according to the image brightness to achieve processing of different lighting areas.
[0016] Compared with the existing technology, the beneficial effects of the present invention are: Through the integration of multiple technologies and innovative strategies, the accuracy and stability of face recognition in low-light scenarios have been improved. During the image enhancement stage, multi-scale Retinex enhancement combined with adaptive histogram equalization technology can precisely adjust the image's brightness and contrast, effectively avoiding noise amplification and detail loss. The enhanced image is clearer and more natural, providing a high-quality data foundation for subsequent recognition.
[0017] Adaptive feature fusion and optimized attention mechanisms are the core advantages of this method. Dynamically adjusting the fusion weights of features like LBP and HOG based on lighting conditions allows the full utilization of the strengths of each feature under varying lighting intensities, ensuring accurate extraction of key features. The residual attention module further focuses on key areas of the face, suppressing background interference and enhancing feature expressiveness, significantly improving the model's ability to process low-quality images.
[0018] In practical applications, this method improves the accuracy and efficiency of facial recognition. Compared to traditional methods, this method maintains a high recognition success rate even in extremely dark environments, reducing false positives and rejections due to lighting issues. Furthermore, through pre-processing steps such as lighting assessment and noise suppression, and post-processing steps for quality assessment, a complete closed-loop optimization system is formed, effectively addressing interference from complex environments, reducing the system's reliance on external lighting equipment, and lowering deployment costs and usage restrictions. Furthermore, the auxiliary step of liveness detection ensures the security of the recognition process, providing a reliable technical solution for fields such as security and finance, where accuracy and safety are extremely important. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a schematic block diagram of the face image enhancement and recognition method in a low-light environment proposed by the present invention; Figure 2 This is a schematic diagram comparing the clarity of face image enhancement and recognition in a low-light environment proposed by the present invention using different methods; Figure 3 This is a schematic diagram comparing the multi-scale Retinex enhancement effects of different face image enhancement and recognition methods proposed by the present invention in a low-light environment; Figure 4 Schematic diagram of the dynamic adjustment of adaptive feature fusion weights for face image enhancement and recognition in low-light environments proposed by the present invention DETAILED DESCRIPTION
[0020] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0021] Reference Figure 1 and Figure 4 : A specific implementation method of a face image enhancement and recognition method in a low-light environment.
[0022] The facial image enhancement and recognition method in low-light environments of this application achieves high-quality enhancement and accurate recognition of facial images in low-light scenes through multi-step collaborative processing. The specific implementation details are as follows: 1. Multi-scale Retinex enhancement steps 1. Three-scale Gaussian filtering and component separation technical details Perform three-scale Gaussian filtering on the input low-light face image I(x,y) (resolution (640x480)). The specific implementation is as follows: Small scale filtering ( =15): Uses a 31x31 pixel Gaussian kernel with a standard deviation of 15 to capture high-frequency details such as eyelashes and pores while suppressing local noise. High-Frequency Detail Capture: σ = 15 corresponds to a smaller Gaussian kernel (31×31) with a limited filtering range. It is primarily used to extract high-frequency details in facial images (such as eyelashes, pores, and wrinkles) while suppressing local noise.
[0023] Balancing computational efficiency and detail preservation: The Gaussian kernel size is generally positively correlated with σ (the theoretical kernel size is 6σ + 1, or 15 × 6 + 1 = 91). A 31 × 31 kernel is used to reduce computational effort while ensuring detail extraction. Experiments have shown that this size effectively preserves subtle facial textures and significantly suppresses noise.
[0024] Mesoscale filtering ( =80): Use a Gaussian kernel of 161x161 pixels with a standard deviation of 80 to extract facial organ contours (such as eyes and nose boundaries) and medium-scale structures.
[0025] Large-scale filtering ( =250): The large-scale filter uses a Gaussian kernel size of 501×501 pixels with a standard deviation of 250. It is mainly used to show the overall lighting conditions of the image and identify areas with uneven brightness, such as large shadows. Next, we need to separate the illumination component and the reflection component of the image. This is achieved through convolution. The illumination component L i (x,y) is obtained as follows: take the original image I(x,y) and a two-dimensional Gaussian kernel function The result of the convolution operation is the illumination component. i The calculation of (x,y) is a little more complicated. First, take the natural logarithm of the original image I(x,y), and then subtract the illumination component L i The natural logarithm of (x, y) is used to convert the image from the original pixel domain to the logarithmic domain, so that we can distinguish between the illumination and reflection components. Global illumination trend characterization: σ = 250 corresponds to a large-scale Gaussian kernel (501 × 501), whose coverage can capture the global illumination changes in the image (such as large shadows and uneven light and dark areas) and separate the illumination components through convolution operations.
[0026] Indirect verification of illumination uniformity: After large-scale filtering, an adaptive piecewise logarithmic transformation function dynamically adjusts the enhancement parameters for dark and bright areas. Combined with a texture adaptive weighted fusion strategy, this effectively enhances dark detail and suppresses noise amplification. Experimental data shows that this solution improves recognition accuracy in low-light environments (≤5 lux), indirectly demonstrating the effectiveness of large-scale parameters in addressing illumination uniformity.
[0027] Single-scale filtering is difficult to simultaneously take into account detail preservation and global illumination adjustment (for example, single-scale Retinex enhancement will lead to dark noise amplification or bright overexposure), while three scales (15, 80, 250) correspond to high-frequency details, medium structure, and global illumination, respectively, forming a hierarchical processing flow.
[0028] Large-scale kernels (501×501) are computationally intensive, but this paper optimizes processing latency to 85ms / frame through lightweight design (such as depthwise separable convolution), meeting real-time requirements. This demonstrates that the parameter settings strike a balance between lighting processing effectiveness and hardware efficiency. Experimental verification shows that the coverage of the 501×501 kernel ensures lighting analysis accuracy while avoiding excessive consumption of computing resources.
[0029] The setting of the three scale parameters (15, 80, 250) is based on the requirements of hierarchical feature extraction (high-frequency details → medium structure → global illumination) and the results of experimental optimization. The enhancement effect of low-light images is improved through multi-scale collaborative processing.
[0030] When processing low-light facial images, three-scale Gaussian filtering and component separation techniques play a key role. First, a three-scale Gaussian filtering operation is performed on the input low-light facial image I(x,y) with a resolution of 640x480.
[0031] Small-scale filtering uses a 31x31 pixel Gaussian kernel with a standard deviation of 15. This filter is designed to capture high-frequency details in facial images, such as eyelashes and pores. It also effectively suppresses local noise, making these high-frequency details more distinct and prominent, rather than being blurred by noise.
[0032] Mid-scale filtering uses a 161x161 pixel Gaussian kernel with a standard deviation of 80. This scale focuses on extracting facial contours, accurately capturing mid-scale structures such as the shape of the eye and the outline of the nose. This information is crucial for accurately identifying facial features and lays the foundation for subsequent analysis and processing.
[0033] Large-scale filtering uses a 501x501 pixel Gaussian kernel with a standard deviation of 250. It primarily characterizes the global illumination trends of an image and can discern areas of uneven brightness, such as large shadows. Understanding global illumination helps understand the overall illumination distribution of an image, providing a crucial basis for subsequent illumination adjustments and image enhancement.
[0034] After completing the three-scale Gaussian filtering, a convolution operation is used to separate the illumination component Li(x,y) and the reflection component Ri(x,y). Specifically, the illumination component Li(x,y) is obtained by convolving the image I(x,y) with the two-dimensional Gaussian kernel function G(x,y;σi), that is, Li(x,y)=I(x,y)*G(x,y;σi). The reflection component Ri(x,y) is calculated by converting the image from the pixel domain to the logarithmic domain using the formula Ri(x,y)=ln(I(x,y))-ln(Li(x,y)). Here, ln represents the natural logarithm operation. This method can effectively separate the illumination and reflection information, providing a clear and accurate image component foundation for further processing of low-light facial images, improving image quality, enhancing details, and other subsequent operations.
[0035] 2. Adaptive piecewise logarithmic transformation optimization When processing the reflectance component of an image, we designed a dynamic enhancement function whose core parameters are automatically adjusted based on the image's global mean brightness, M. The global mean brightness, M, is calculated by summing the brightness values of each pixel in the image and dividing the sum by the total number of pixels in the image (640 × 480).
[0036] For darker areas of the image (when the reflectance value is less than or equal to the dynamic threshold T(M)), we have dedicated enhancement parameters. One parameter decreases as M increases, starting at 2.0 and decreasing by 0.015 for each increase in M. The other parameter also adjusts with M and is equal to 150 minus M. When M is less than 50, meaning in extremely low light conditions, the first parameter is reduced to 1.25, while the second is increased to 100. This makes the differences between dark pixels more pronounced and highlights the details in the dark areas.
[0037] For brighter areas of the image (when the reflectance value exceeds the dynamic threshold T(M)), there are also protection parameters. One parameter increases with M, starting at 0.8 and increasing by 0.005 for each increase in M. The other parameter is equal to 30 plus 0.5 multiplied by M. Here, the dynamic threshold T(M) gradually decreases as the light level dims, ensuring a more pronounced enhancement effect in dark areas.
[0038] T(M) is negatively correlated with the global brightness mean M and is a linear function ,in, is the initial threshold, is the adjustment coefficient and k>0. For example, when M=50, T(M) may correspond to an intermediate value; when M<50, T(M) decreases as M decreases to enhance dark processing.
[0039] In addition, we also introduce a compensation constant. Its function is to eliminate the grayscale mutation problem that occurs when processing the image in segments, ensuring that the transition from dark to bright parts of the image is very smooth without obvious traces.
[0040] 3. Texture Adaptive Weighted Fusion Strategy First, calculate the local texture standard deviation of the reflectance component at each scale. Taking a 5x5 pixel neighborhood as an example, calculate the sum of the squares of the differences between the reflectance component data within the neighborhood and the neighborhood mean, then divide it by 25 and take the square root. The neighborhood mean is the average value of the reflectance components within the 5x5 neighborhood.
[0041] Next, weights are assigned based on the ratio of the square of the local texture standard deviation at each scale to the sum of the squares of the standard deviations at all scales. The final reflection component is then obtained by multiplying the reflection component at each scale by its corresponding weight and summing the results.
[0042] For different regions, texture-rich areas (such as the area around the eyes, where the local texture standard deviation is greater than 15) can receive a weight exceeding 70%. For smooth areas (such as the cheeks, where the local texture standard deviation is less than 5), multi-scale averaging is used to suppress noise. When processing the reflective component of low-light facial images, a dynamic enhancement strategy is also used. This strategy first calculates the global brightness mean, which is the sum of the brightness values of all pixels and then divides it by the total number of pixels in the image (640×480).
[0043] In order to make the image transition naturally in the segmented processing areas and avoid grayscale mutations, a compensation constant C is introduced, which is calculated by a specific formula to ensure the overall smoothness of the image.
[0044] The texture adaptive weighted fusion strategy is invented. In order to fuse the reflection components of different scales, the local texture standard deviation σi of each scale reflection component in a 5×5 pixel neighborhood is first calculated, which reflects the change of texture in the neighborhood. Then the weight w of each scale is calculated based on the standard deviation. i The weight calculation method makes the scale with large texture changes account for a higher proportion in the fusion. Finally, the reflection components of the three scales are added according to their respective weights to obtain the fusion result. In areas with rich textures, such as around the eyes, the weight of a certain scale can account for more than 70%, highlighting the details of these areas; in areas with smooth textures such as cheeks, multi-scale averaging is used to reduce noise interference. 2. Adaptive Feature Fusion Steps 1. Dual-modal feature refinement extraction LBP feature enhancement: In the dual-modal feature refinement extraction, LBP feature enhancement is an important part. A circular template with a radius of 2 pixels and 8 neighborhoods is used to calculate the LBP value of the uniform pattern. A certain pixel in the image is taken as the center, denoted as (x c ,y c ), whose gray value is g c , the grayscale value of the surrounding 8 neighboring pixels is g p . Through a specific formula To calculate the LBP value, the s(x) function takes a value based on whether x is greater than or equal to 0. Then s(x) = 1, otherwise 0. In this way, each pixel is converted into an LBP value, and then a 59-dimensional uniform pattern histogram is generated. In order to make the features more standardized and comparable, they are also converted into unit vectors through L2 normalization. This series of operations can highlight the local texture features of the image, allowing subtle texture changes in the image to be clearly displayed, and provide strong feature support for subsequent image analysis and recognition tasks; Pseudo-infrared HOG feature generation: A pre-trained U-Net model is used to convert low-light RGB images into pseudo-infrared images, enhancing the representation of thermal radiation differences. HOG feature extraction parameters: Cell size: 8x8 pixels; Block size: 16x16 pixels (50% overlap); Number of directions: 9 (0°-180°, 20° intervals); A 3780-dimensional feature vector is generated, capturing facial contours and edge information.
[0045] 2. Dynamic weight adjustment mechanism Based on the global brightness mean M, the LBP feature weight is calculated by the Sigmoid function ; When M<60 (low light), α>0.7, LBP texture features dominate; when When α is less than 0.4 (normal lighting), the HOG gradient feature weight is increased; the coefficient "0.1" determines the gradient of the weight α as it changes with the global brightness mean M. A smaller coefficient (such as 0.1) makes the function curve smoother, preventing the weight from fluctuating violently with slight changes in lighting; a larger coefficient (such as 0.5) makes the curve steeper and the weight switching more sensitive; Calculation verification: When M=60, ; When M=80, (Theoretical value), the HOG gradient feature dominates the feature normalization coefficient so that α<0.4.
[0046] The fusion formula is: , where F LBP and They are the normalized LBP and pseudo-infrared HOG feature vectors respectively. Specifically, in terms of LBP feature enhancement, a specific circular template is used to enhance the LBP feature. The template radius is 2 pixels and has 8 neighborhoods. When calculating the uniform mode LBP value, the center pixel is used as the reference and its grayscale value is compared with the grayscale value of the neighboring pixels. The center pixel is recorded as (x c ,y c ), whose gray value is g c , the gray value of the neighborhood pixel is g p By formula Calculate, where s(x) takes the value of 1 or 0 depending on whether x is greater than or equal to 0. This calculates the LBP value corresponding to each pixel, and then generates a 59-dimensional uniform pattern histogram. Finally, it is L2 normalized and converted into a unit vector to highlight the local texture details of the image.
[0047] In terms of pseudo-infrared HOG feature generation, the pre-trained U-Net model is first used to convert the low-light RGB image into a pseudo-infrared image to make the difference in thermal radiation more obvious. Then the HOG features are extracted, and the cell size is set to 8×8 pixels, the block size is 16×16 pixels and the overlap rate is 50%. There are 9 directions, from 0° to 180°, with an interval of 20°. According to these settings, a 3780-dimensional feature vector is obtained to capture the contour and edge information of the face. The dynamic weight adjustment mechanism determines the LBP feature weight α through the Sigmoid function based on the global brightness mean M of the image. When M is less than 60 and in low light, α is greater than 0.7, which means that the LBP texture feature plays a major role in fusion, because texture is important for recognition under low light. When M is greater than or equal to 80, in normal light, α is less than 0.4, and the HOG gradient feature weight increases. The fusion formula is , where F LBP and They are the normalized LBP and pseudo-infrared HOG feature vectors, so that the two features can be adaptively fused according to the lighting conditions; The underlying structure of the U-Net model is an encoder-decoder structure. U-Net contains symmetrical downsampling (encoder) and upsampling (decoder) paths, with multi-scale features fused via skip connections. When used for RGB to pseudo-infrared conversion, the following core design is retained: Encoder: Consists of 4-5 downsampling blocks, each containing 2-3 convolutional layers (such as 3×3 convolution kernels), with BatchNormalization and ReLU activation functions, gradually reducing the spatial resolution (such as from 640×480 to 80×60) to extract semantic features.
[0048] Decoder: Corresponding to 4-5 upsampling blocks, it restores the resolution through transposed convolution or interpolation, and combines the underlying details passed by the jump connection to generate a pseudo infrared image.
[0049] Number of convolution kernels: The number of convolution kernels in the initial layer may be 64, and it doubles with each subsequent downsampling (e.g. 64 → 128 → 256 → 512). The number of kernels in the corresponding decoder layer is halved, which is in line with the typical configuration of U-Net. Pseudo-infrared images are designed to represent differences in thermal radiation from objects. However, certain pixel values in RGB images (such as the red channel) are indirectly related to the surface temperature of an object (e.g., hot objects appear redder). U-Net transforms visible light images into simulated infrared heat maps by learning the mapping between RGB pixel values and infrared radiation intensity.
[0050] 3. Attention Mechanism Optimization Steps 1. Implementation of spatial attention module Feature compression and activation: fusion features Perform global average pooling and global maximum pooling respectively to generate F avg and F max For fusion features (where H represents height, W represents width, and C represents the number of channels), generating F avg and F max The process is as follows: Generate F avg :Through the global average pooling operation, the fusion feature F fusion The average calculation is performed on the spatial dimension (i.e., the height H and width W dimensions). Specifically, all pixel values at the corresponding position on each channel are added together and then divided by the total number of pixels in the channel (H×W) to obtain an average vector on the channel dimension. These vectors are combined to form F avg , which compresses the fusion features and highlights the overall average feature information. max : Using the global maximum pooling operation, the fusion feature F fusion In the spatial dimensions (H and W dimensions), find the maximum value of the pixel at the corresponding position on each channel, combine these maximum values to form F max , which emphasizes the most significant feature information in the fused features; The number of input channels of the convolution layer is 2C, and the number of output channels is 1, so the convolution kernel size is 7*7*2C and the number is 1; the convolution layer generates a single-channel spatial attention matrix W by weighted summing the 2C input channels. s , its mathematical expression is: ,in, is the Sigmoid activation function, The weight matrix dimension is 1×7×7×2C, which realizes the integration and transformation of cross-channel information; When the 7×7 convolutional layer performs convolution operations on the 2C-dimensional features, the correlation between different channels is learned through the weight matrix. For example, the channel weights related to facial areas (such as eyes and nose) are strengthened and the interference of background channels is suppressed.
[0051] Convolution extracts spatial weights: Generates the spatial attention matrix through a 7x7 convolution layer (padding=3, activation function is Sigmoid) : Emphasize key areas such as the eyes (weight increased by 40%-60%) and nose. 7×7 convolution layer: refers to a convolution layer with a convolution kernel size of 7×7 pixels. The convolution operation is to slide the convolution kernel on the image (here is the feature map) and perform weighted summation on the elements at the corresponding positions to extract image features. padding=3: indicates the number of pixels used to pad the input feature map before the convolution operation. Padding is to add extra pixels around the boundary of the feature map. Here, 3 pixels are added to the top, bottom, left and right of the feature map. The purpose is to keep the size of the feature map unchanged during the convolution process to avoid excessive loss of edge information due to the convolution operation. The activation function is Sigmoid: The Sigmoid function is a commonly used activation function, and the formula is , which can compress the input value to between 0 and 1. The Sigmoid function is used as the activation function here to add nonlinear characteristics to the output of the convolution layer, so that the model can learn more complex patterns. s : That is, the spatial attention matrix, the dimension is , H is the height of the feature map, and W is the width of the feature map. Each element value of this matrix represents the attention weight of the corresponding position in the spatial dimension. The larger the value, the more attention the model pays to the position. : Represents the Sigmoid activation function, which is used to perform nonlinear transformation on the output of the convolutional layer and generate element values of the spatial attention matrix. : represents a 7×7 convolution operation, which performs convolution operation on the concatenated features to extract spatial features. Concat(F avg ,F max ): is the F generated by global average pooling avg and F generated by global maximum pooling max Concatenate along the channel dimension (Concat is the abbreviation of Concatenate) to merge the two features into a new feature as the input of the subsequent convolution operation. avg : is the fusion feature F fusion The features generated after global average pooling highlight the average information of the fused features. max: is the fusion feature F fusion The features generated after global maximum pooling highlight the most significant information in the fused features.
[0052] 2. Channel Attention Module Optimization Global information aggregation: perform global average pooling on Ffusion to obtain channel statistics ; z: channel statistics, dimension is , is the fusion feature F fusion The result obtained after global average pooling aggregates the global information on each channel. : The cth element in the channel statistic z is calculated by the formula Calculated, that is, the fusion feature F fusion The statistical value of each channel is obtained by summing the spatial dimensions (x from 1 to W, y from 1 to H) and dividing it by the total number of pixels H×W.
[0053] Nonlinear transformation: Generate channel weights through a two-layer fully connected network (dimensionality reduction ratio 16:1) ,in , is the ReLU activation function. It suppresses the background color channel (such as the blue channel) and enhances the skin texture channel (such as the green channel) by 20%-30%. c : Channel weight, dimension is , is the result obtained after processing by two layers of fully connected networks, used to indicate the importance of each channel; W2: the weight matrix of the second layer of fully connected networks, with a dimension of , used to further transform the features processed by the first layer of fully connected network. : ReLU activation function, the formula is , used to introduce nonlinearity in a two-layer fully connected network to enhance the expressive power of the model. W1: The weight matrix of the first layer of the fully connected network, with a dimension of , perform dimensionality reduction transformation on the channel statistics z. z: The channel statistics obtained by the previous global information aggregation are used as the input of the two-layer fully connected network.
[0054] The relationship between the number of original channels and the number of intermediate layer nodes is: Let the input channel statistics z∈R C , C is the number of channels of fusion features, and the dimensionality reduction ratio of the two-layer fully connected network is 16:1, that is: The number of output nodes of the first fully connected layer (dimensionality reduction layer) is: u=C / 16, and the weight matrix W1∈R (C / 16)×C ; The number of output nodes of the second fully connected layer (dimensionality increase layer) is restored to C, and the weight matrix W2∈R C×(C / 16) ; Mathematical expression: middle layer latitude = original number of channels C / 16; for example, if the number of channels of fused features C=512, then the number of middle layer nodes is 512 / 16=32.
[0055] 3. Joint Attention and Residual Fusion Weight matrix fusion: , Represents element-wise multiplication; Residual Connection: in, For shallow features (such as the gradient features of the original image), upsampling is used to maintain dimensionality and preserve edge details. Specifically, regarding the attention mechanism optimization steps, this section focuses on optimizing the attention mechanism through a series of operations, mainly covering the spatial attention module, the channel attention module, and the joint attention and residual fusion.
[0056] In terms of the implementation of the spatial attention module, the fused features are first processed, and then compressed and activated through global average pooling and global maximum pooling to obtain two different processed features.
[0057] Next, these two features are concatenated and passed through a 7×7 convolutional layer (with padding = 3 and a sigmoid activation function) to generate a spatial attention matrix. This matrix emphasizes key facial areas such as the eyes (with a 40%-60% increase in weight) and the nose, allowing the model to focus more on the characteristics of these important areas.
[0058] In terms of channel attention module optimization, we first perform global average pooling on the fusion features to aggregate the global information in the channel dimension and obtain channel statistics.
[0059] The channel statistics are then fed into a two-layer fully connected network (with a 16:1 dimensionality reduction ratio) for a nonlinear transformation to generate channel weights. This operation suppresses background color channels (such as the blue channel) while simultaneously increasing the weight of skin texture channels (such as the green channel) by approximately 20%-30%, achieving differentiated processing of different channel features.
[0060] In terms of joint attention and residual fusion, the spatial attention matrix and the channel attention matrix are multiplied element by element to fuse their information and obtain a comprehensive weight matrix.
[0061] Using the residual connection method, the fusion feature is multiplied by the weight matrix obtained above, and then the shallow features (such as the gradient features of the original image, which are upsampled to make their dimensions consistent with the fusion features) are added to retain the edge details of the image and optimize the final features.
[0062] 4. Technical Details Extension 1. Light assessment pre-processing threshold setting: When M < 60 (corresponding to an illuminance of approximately 5 lux), the low-light enhancement process is triggered; the scale parameters are dynamically adjusted: ; For example, when M=30, Reduced to 12, the ability to extract local details is enhanced. In this formula: : This is a dynamically adjusted scale parameter. It changes according to the image's lighting conditions, affecting subsequent image processing, such as adjusting the ability to extract local details. : is the initial value of the scale parameter, which is the original parameter setting before considering the dynamic adjustment of illumination. e: natural constant, a mathematical constant, approximately equal to 2.71828, which is used as the base of the exponential function in this formula. M: represents the global brightness mean of the image. It is obtained by calculating the brightness values of all pixels in the image and averaging them. It is used to judge the illumination conditions of the image. When M<60, the low-light enhancement process will be triggered, and it is also the key variable in the dynamic adjustment formula of the scale parameter. The formula describes the scale parameter as a whole How to dynamically adjust based on the global brightness mean M to adapt to the needs of image feature extraction under different lighting conditions.
[0063] 2. Noise suppression preprocessing Non-local means filter parameters: Search window size: 21x21 pixels Neighborhood block size: 5x5 pixels Similarity weight: Among them, N p and N q For the neighborhood blocks of pixels p and q, the L2 distance is calculated and normalized, effectively suppressing Gaussian noise (standard deviation reduced by 40%). Search window size (21×21 pixels): The search window defines the range within the image for searching for similar pixel neighborhoods. Centered on a pixel, a search is performed for similar pixel blocks within a 21×21 pixel range. A larger search window means more pixel blocks are available for comparison, which can more comprehensively capture similar structural information in the image. For example, in a texture-rich image, a larger search window may find multiple similar texture pattern areas, providing more effective information for accurate noise suppression. However, a large window size will also increase the amount of computation, so a trade-off needs to be made between effectiveness and computational efficiency.
[0064] Neighborhood block size (5×5 pixels): A neighborhood block is the basic unit used to measure pixel similarity. For each pixel, a 5×5 pixel block is centered around it. Within the search window, the similarity between 5×5 neighborhood blocks at different locations is compared to determine the association between pixels. For example, when determining the noise level of a pixel, its 5×5 neighborhood block is compared with the 5×5 neighborhood blocks of other pixels within the search window. Setting this size is crucial: too small may not capture sufficient structural information to accurately determine similarity, while too large may include too much irrelevant information, affecting the accuracy of similarity determination. w(p,q): represents the similarity weight between pixels p and q. This value reflects the degree of similarity between the two pixel neighborhood blocks. A weight closer to 1 indicates greater similarity between the two neighborhood blocks; a weight closer to 0 indicates greater dissimilarity. During the filtering process, pixel neighborhood blocks with high similarity have a greater impact on the filtering result for the current pixel. exp: represents the natural exponential function, with the natural constant e (approximately 2.71828) as its base. Here, the calculated value is converted into a weight value between 0 and 1 through the natural exponential function, so that the change of the weight value conforms to a certain mathematical law, which is convenient for weighted average calculation. p and N q : Represents the 5×5 neighborhood blocks of pixel p and pixel q respectively. These two neighborhood blocks contain the pixel value information around the corresponding pixel, and the similarity of pixels p and q is determined by comparing the differences between them. : This calculates the square of the L2 distance between neighboring blocks Np and Nq. L2 distance (Euclidean distance) is a commonly used method to measure the distance between vectors. In images, it measures the distance between the pixel value vectors of two neighboring blocks. The square of the L2 distance is calculated to better reflect the degree of difference between neighboring blocks in the formula. The squaring operation amplifies the difference, making the similarity judgment more sensitive. : In the denominator of the formula, it plays a role in adjusting the weight calculation. It can control the sensitivity of the weight to the difference between neighboring blocks. The larger the value, the less sensitive the weight is to the difference between neighboring blocks. Even if there are certain differences between neighboring blocks, they may be given a relatively high weight; the smaller the value, the more sensitive the weight is to the difference. The weight will be greatly reduced if there is a slight difference between neighboring blocks. Here it is set to , is a value that, through experimental and theoretical analysis, achieves a good balance between similarity judgment and noise suppression effectiveness in the current image noise suppression scenario. This non-local means filter parameter setting and calculation effectively suppresses Gaussian noise, reducing the standard deviation of the noise by approximately 40%, significantly improving image quality and providing cleaner, more accurate image data for subsequent image analysis and processing.
[0065] 3. Adaptive Histogram Equalization Color space conversion: convert the image from RGB to YCbCr, processing only the brightness component Y; Block size: 16x16 pixels, calculate the local cumulative distribution function (CDF): ; : Indicates the brightness value of the block after processing, which is the result of calculation. : Represents the local cumulative distribution function value calculated for the brightness component Y in a 16×16 pixel block. It reflects the distribution and accumulation of brightness values in the block and is obtained through statistical analysis of the brightness data in the block. Y: is the brightness component of the original image after conversion to the YCbCr color space. Y max : Refers to the maximum value of the brightness component Y in the current block, that is, the pixel value with the highest brightness in the 16×16 pixel block. min : represents the minimum value of the luminance component Y within the current block, that is, the lowest brightness pixel value in the 16×16 pixel block. This formula adjusts the block's luminance value by combining the local cumulative distribution function and the maximum brightness value within the block, achieving adaptive histogram equalization.
[0066] Block effect removal: The block boundaries are smoothed by bilinear interpolation, and the interpolation kernel is a 3x3 Gaussian kernel.
[0067] 4. Liveness detection assistance LTP features: A ternary pattern with a radius (r = 1, 8 neighborhoods) is used to generate a 105-dimensional histogram. Optical flow calculation: The Farneback algorithm is used to extract the mean and variance of motion vectors from adjacent frames to generate 2-dimensional features. The classifier uses SVM (radial basis kernel function). The training samples include more than 100,000 real faces and more than 50,000 attack samples. The confidence threshold is set to 0.7, and the liveness detection accuracy rate reaches 97.2%. Specifically: When processing images, the preprocessing step is crucial, as it lays the foundation for subsequent more accurate analysis and recognition.
[0068] The first step is the illumination evaluation preprocessing. The illumination condition is determined by calculating the global brightness mean M of the image. When M is less than 60, it means that the illumination intensity is weak, corresponding to an illumination of approximately 5 lux, and the low-light enhancement process is triggered. At the same time, the scale parameter is dynamically adjusted according to specific rules. For example, when M is 30, the scale parameter will be reduced, like the original parameter It will be reduced to 12, which can enhance the ability to extract local details of the image and help better capture subtle features in low-light images.
[0069] Next comes noise suppression preprocessing. Non-local mean filtering is used, and the relevant parameters are carefully set. The search window size is set to 21×21 pixels, and the neighborhood block size is 5×5 pixels. Specific rules are used to calculate the similarity weights between pixels. This setting effectively suppresses Gaussian noise, reducing the standard deviation of the noise by approximately 40%, resulting in clearer images and reducing noise interference with subsequent processing.
[0070] Next comes the adaptive histogram equalization step. First, the image is converted from the common RGB color space to the YCbCr color space. This is because in this space, the luminance component Y is separated from the color components Cb and Cr, making it easier to process the luminance separately. For the luminance component Y only, the local cumulative distribution function is calculated using a block size of 16×16 pixels. In this way, targeted adjustments can be made based on the luminance distribution characteristics of different areas of the image. To eliminate the blocking effect caused by block processing, bilinear interpolation is used, and a 3×3 Gaussian kernel is used as the interpolation kernel to smooth the block boundaries, making the image transition natural and the visual effect better.
[0071] Finally, the auxiliary phase of liveness detection involves the use of a variety of technical approaches. First, a three-value pattern with a radius of r = 1 and an 8-neighborhood is used to extract LTP features, generating a 105-dimensional histogram. These features reflect some of the inherent characteristics of the face. The Farneback algorithm is then used to calculate the optical flow field, extracting the mean and variance of the motion vectors of adjacent frames to generate two-dimensional features that capture the dynamic information of the face. These features are then input into a support vector machine (using a radial basis kernel function) for classification. The training sample consists of over 100,000 real face samples and over 50,000 attack samples, with a confidence threshold set to 0.7. With this training and configuration, the liveness detection accuracy reaches 97.2%, effectively determining whether a face is alive and providing reliable support for subsequent applications such as face recognition.
[0072] The method for face image enhancement and recognition in low-light environments proposed in this paper optimizes the entire process from image preprocessing to identity determination by integrating multiple technologies. The details are as follows: During the preprocessing phase, the global mean brightness value M of the image is calculated. The enhancement process is triggered when M is less than 60. A non-local mean filtering algorithm using a 21×21 pixel search window and a 5×5 pixel neighborhood block is used to suppress Gaussian noise, reducing the noise standard deviation by 40%. After converting the image to YCbCr space, local histogram equalization is performed on the brightness components of the 16×16 pixel blocks. Bilinear interpolation with a 3×3 Gaussian kernel is then used to remove blocking artifacts and improve local contrast.
[0073] The core image enhancement process utilizes a three-scale Retinex technique: σ=15 (31×31 kernel) extracts high-frequency details such as eyelashes, σ=80 (161×161 kernel) captures facial contours, and σ=250 (501×501 kernel) analyzes global illumination. After decomposing illumination and reflectance components in the logarithmic domain, an adaptive piecewise logarithmic transformation function is used to enhance the reflectance component. The dark parameter γ1 decreases linearly with M from 2.0 in 0.015 steps, β1=150-M; the highlight parameter γ2 increases from 0.8 in 0.005 steps, β2=30+0.5M. The dynamic threshold T(M) decreases linearly with decreasing illumination. The weights of reflectance components at each scale are dynamically adjusted based on the standard deviation of texture in a 5×5 neighborhood, with the weights exceeding 70% in texture-rich areas.
[0074] In the feature fusion stage, 59-dimensional LBP texture features and 3780-dimensional pseudo-infrared HOG features are extracted (extracted after generating a pseudo-infrared image through U-Net). The fusion weight is dynamically adjusted using the Sigmoid function α=1 / (1+e^(-0.1×(M-80))): when M<60, α>0.7, LBP dominates; when M≥80, α<0.4, HOG dominates.
[0075] In the attention optimization module, spatial attention processes the features obtained by concatenating global average pooling and maximum pooling through a 7×7 convolution (padding=3), generating a spatial weight matrix that focuses on key areas such as the eyes (weighting is increased by 40%-60%). Channel attention calculates channel weights through a fully connected layer from C to C / 16 to C, enhancing the skin texture channel by 20%-30% and suppressing the background channel. The two are element-wise multiplied and concatenated with the residual of the shallow feature layer to output a discriminative feature vector.
[0076] In the post-processing stage, the horizontal and vertical gradients of the enhanced image are calculated to assess clarity. If the image falls below a threshold, the parameters are iteratively adjusted. 105-dimensional LTP features, 2-dimensional optical flow features, and pseudo-infrared HOG features are extracted and concatenated into a 3887-dimensional vector. This vector is then fed into a support vector machine (radial basis kernel) for liveness detection, achieving an accuracy of 97.2%. Finally, the optimized features are fed into a pre-trained model, and recognition is achieved through cosine similarity matching. Experiments show that this method achieves an 85.3% recognition accuracy in an environment of 5 lux or less, a 102.6% improvement over traditional methods. The false positive rate is reduced to 2.3%, the clarity Q value is improved by 125.6%, and processing latency is optimized to 85ms / frame, meeting real-time security requirements.
[0077] Test data and beneficial characterization Data explanation: This application uses dynamic piecewise logarithmic transformation (T(M) adaptively adjusted with illumination) and texture weighted fusion (w iThe cross-layer residual attention module significantly reduces the false recognition rate through the dual effects of spatial attention (increasing the weight of the eye by 50%) and channel attention (enhancing the skin texture channel by 25%). The combination of non-local mean filtering and adaptive histogram equalization improves the image clarity Q value by 125.6%, while optimizing the processing latency to 85ms to meet real-time monitoring needs. The liveness detection module effectively resists photo and video attacks through multimodal feature fusion (LTP + optical flow + pseudo-infrared HOG), and the recognition rate is increased to 97.2%. The overall solution has achieved a comprehensive breakthrough in facial image enhancement and recognition performance in low-light environments, and is suitable for scenarios with extremely high environmental adaptability requirements, such as smart security and mobile payment.
[0078] The above are only preferred specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solutions and inventive concepts of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A method for enhancing and recognizing facial images in a low-light environment, characterized in that: The following steps are involved: Multi-scale Retinex enhancement: The input low-light face image is subjected to three-scale Gaussian filtering, with the scale parameters set to 15, 80, and 250, respectively. This filtering separates the illumination and reflection components at different scales. The reflection component is nonlinearly enhanced using an adaptive piecewise logarithmic transformation function. This function dynamically adjusts the threshold and compensation parameters based on the global brightness mean of the image, enhancing dark details while suppressing noise amplification. Adaptive feature fusion steps: Extract the local binary pattern (LBP) features and the histogram of oriented gradients (HOG) features of the enhanced image, evaluate the lighting conditions by calculating the global brightness mean of the image, and dynamically adjust the fusion weights of the two types of features: automatically increase the weight of the LBP texture features in weak lighting to highlight subtle facial textures; increase the weight of the HOG gradient features in strong lighting to enhance contour information; and generate a feature vector of the information through a dynamic fusion strategy; Attention mechanism optimization steps: Construct a residual attention module, extract spatial features through convolution operations and generate a spatial attention weight matrix to focus on the face area; at the same time, use global average pooling and fully connected layers to calculate the channel attention weight matrix to suppress the interference of background channels; after multiplying the spatial and channel attention weight matrices element by element, perform weighted optimization on the fused features to improve the feature expression ability of the region and output a discriminative feature vector.
2. The method for enhancing and recognizing facial images in a low-light environment according to claim 1, wherein: Also includes: Lighting assessment preprocessing step: Calculate the global brightness mean of the input image. When the mean is lower than the set threshold, the enhancement process is triggered. The scale parameters of the multi-scale Retinex enhancement are dynamically adjusted based on the brightness mean to achieve image enhancement requirements under different light intensities.
3. The method for facial image enhancement and recognition in a low-light environment according to claim 1, wherein: Also includes: Noise suppression preprocessing step: The input image is denoised using the non-local mean filtering algorithm. By calculating the similarity weight between the current pixel and the pixels in the search window, the image edge details are retained while suppressing noise to generate a denoised image.
4. The method for enhancing and recognizing facial images in a low-light environment according to claim 1, wherein: In the multi-scale Retinex enhancement step, when weighted fusion is performed on reflection components of different scales, the weights are dynamically adjusted according to the local texture features of the image, and the scale components corresponding to the texture area are given higher weights.
5. The method for enhancing and recognizing facial images in a low-light environment according to claim 1, wherein: Also includes: Adaptive histogram equalization step: convert the enhanced image to YCbCr color space, perform block-wise local histogram equalization on the luminance component to improve local contrast; The blocking effect at the sub-region boundary is eliminated by bilinear interpolation.
6. The method for enhancing and recognizing facial images in a low-light environment according to claim 1, wherein: In the attention mechanism optimization step, the spatial attention module extracts spatial features through convolution operations, and the channel attention module calculates channel weights through global average pooling and fully connected layers, and finally generates an attention weight matrix through element-by-element multiplication.
7. The method for facial image enhancement and recognition in a low-light environment according to claim 1, wherein: Also includes: Face recognition and matching steps: The optimized feature vector is input into the pre-trained face recognition model to extract the face feature vector and calculate the cosine similarity with the registered vector in the database. The success of face recognition is determined based on the similarity value.
8. The method for facial image enhancement and recognition in a low-light environment according to claim 1, wherein: Also includes: Quality assessment post-processing steps: Calculate the clarity index of the enhanced image and evaluate the image quality based on the gradient changes in the horizontal and vertical directions; When the clarity is lower than the threshold, the enhancement parameters are iteratively adjusted to meet the quality requirements.
9. The method for facial image enhancement and recognition in a low-light environment according to claim 1, wherein: Also includes: Auxiliary steps for liveness detection: Extract the local ternary pattern LTP texture features and optical flow field micro-motion features of the enhanced image, and input them into the liveness detection model for authenticity judgment to resist non-liveness attacks in photos and videos.
10. The method for enhancing and recognizing facial images in a low-light environment according to claim 1, wherein: The piecewise logarithmic transformation function used in the multi-scale Retinex enhancement step dynamically adjusts the enhancement parameters according to the image brightness to achieve processing of different lighting areas.
Citation Information
Patent Citations
Multi-feature fusion-based deep learning face recognition method
CN107578007A
Low-illumination image enhancement method based on multi-attention mechanism and Retinex
CN116645305A
Artificial intelligence visual detection method and system based on local binary pattern
CN118941771A
Multi-scale Retinex low-illumination image enhancement method based on modified bilateral filtering
CN119850498A
Face data privacy protection method and device
CN120074802A
Cited By
Identity recognition method and system based on image processing
CN121033919A
Image multi-target detection system and method based on channel attention mechanism
CN121053377A
Image multi-target detection system and method based on channel attention mechanism
CN121053377B
End-to-end multi-model fusion face recognition method based on attention mechanism
CN121170862A
Method and system for identifying reading of electricity meter
CN121190923A