Conditional diffusion weak light image enhancement method and system based on double-branch attention feature coding
Patent Information
- Application Number
- CN202410830265.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2044-06-25
AI Technical Summary
[0006]针对现有技术手段对处理弱光图像噪声的问题,本发明提供一种基于双分支注意力特征编码的条件扩散弱光图像增强方法,根据强度从小到大依次添加噪声将输入弱光图像变为高斯噪声,然后从高斯噪声中逐步进行采样,最终得到高真实性的正常光图像
本发明提供一种基于双分支注意力特征编码的条件扩散弱光图像增强方法。本发明针对现有技术手段对处理弱光图像噪声问题的局限,引入了特征编码技术以及条件扩散模型。由于特征编码技术能为神经网络的训练提供先验信息,本发明增强后的正常光图像具有更好的质量以及清晰度。同时,由于本发明是从高斯噪声中逐步进行采样,最终得到正常光图像,所以具有更丰富、更真实的细节信息。此外,由于扩散模型生成图像往往有对比度不足的问题,通过对比度校正模块解决该问题,进一步提高了生成图像的质量。
Smart Images

Figure CN118735806B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and artificial intelligence, specifically to a conditional diffusion low-light image enhancement method and system based on bi-branch attention feature encoding. Background Technology
[0002] With the continuous development of multimedia technology, images have become the most common information medium in people's daily lives, and much information is stored and transmitted in the form of images. Therefore, the quality of an image is closely related to the quantity and accuracy of the information obtained. However, during the image capture process, environmental factors, such as cloudy days or nighttime scenes, can lead to problems such as dark image quality, low contrast, and low signal-to-noise ratio. Low-light image computational enhancement technology helps improve the quality and clarity of low-light images and can also provide more reliable and high-quality data for related applications in digital image processing, computer vision, artificial intelligence, and other fields.
[0003] Existing low-light image enhancement methods are mainly divided into two categories: the first category is traditional low-light image enhancement methods, which are further subdivided into enhancement methods based on histogram equalization and enhancement methods based on Retinex decomposition models; the second category is low-light image enhancement methods based on deep learning. Histogram equalization-based methods enhance smaller pixel values by adjusting the pixel distribution of the input low-light image, thereby improving image contrast and clarity. However, images restored using this method may suffer from problems such as overexposure, loss of local details, and color distortion, resulting in unsatisfactory visual effects. Retinex model-based enhancement methods decompose the perceived image into two components: reflectance and illuminance, ensuring that changes in illuminance do not affect the color of objects. However, the enhanced image may still suffer from color distortion and over-enhancement.
[0004] Therefore, how to handle noise in images has always been a challenge in low-light image enhancement methods, because while enhancing image brightness, noise in the image is also enhanced, resulting in overexposure, color distortion, and other issues in the enhancement results.
[0005] To address the limitations of existing technologies in handling noise in low-light images, this invention first transforms the input low-light image into Gaussian noise by adding noise sequentially from lowest to highest intensity. Then, it progressively samples from the Gaussian noise to ultimately obtain a highly realistic normal-light image. This invention effectively improves the brightness, contrast, and clarity of low-light images, effectively suppresses image noise, and results in an enhanced image whose color and brightness more closely resemble normal-light images while retaining more image detail. Summary of the Invention
[0006] To address the problem of noise in low-light images using existing techniques, this invention provides a conditional diffusion low-light image enhancement method based on bi-branch attention feature encoding. This method transforms the input low-light image into Gaussian noise by sequentially adding noise of increasing intensity. Then, it progressively samples from the Gaussian noise to ultimately obtain a highly realistic normal-light image. This effectively improves the brightness, contrast, and sharpness of low-light images while effectively suppressing image noise. The enhanced image's color and brightness more closely resemble those of a normal-light image, and it retains more image detail.
[0007] This invention is achieved through the following technical solution: A conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding includes the following steps: Step 1: Construct a low-light image feature encoding model based on dual-branch attention, including a gradient recovery module and a brightness recovery module connected in parallel. The channel attention mechanism and spatial attention mechanism are used to transfer the features of the low-light image to the gradient recovery module and the brightness recovery module. The gradient recovery module outputs the gradient map features of the low-light image, and the brightness recovery module outputs the brightness map features of the low-light image. Step 2: Construct a conditional diffusion model. The gradient map features, brightness map features and the original low-light image are stitched together and input into the conditional diffusion model. Random noise is added to the stitched image to turn it into pure noise. The normal light image is then obtained from the pure noise. Step 3: Using structural similarity loss and color consistency loss as constraints, and optimizing the model parameters by minimizing the loss function, train the low-light image feature encoding model and the conditional diffusion model until the network model converges, and obtain the conditional diffusion low-light image enhancement model. Step 4: Enhance the low-light image using the conditional diffusion low-light image enhancement model.
[0008] Preferably, the gradient recovery module includes multiple neural network layers, including two-dimensional convolutional layers, normalization layers, ReLU activation function layers, and residual connection layers. The input of the gradient recovery module is a multi-channel numerical matrix of the low-light image, and the output is a gradient feature map.
[0009] Preferably, the brightness restoration module includes multiple neural network layers, including a two-dimensional convolutional layer, a normalization layer, a ReLU activation function layer, and a fully connected layer. The brightness restoration module calculates the local and global brightness distribution features of the image from the low-light image numerical matrix to obtain brightness map features.
[0010] Preferably, the conditional diffusion model includes a diffusion noise-adding module and a diffusion noise-reducing module; The diffusion noise module is used to add random Gaussian noise to the input feature map step by step until the resulting feature map becomes a pure noise image that follows a Gaussian distribution. The diffusion denoising module is used to denoise a purely noisy image and construct a normal light image.
[0011] Preferably, the conditional diffusion model further includes a contrast correction module, which uses the color of the noise map as a feature vector to suppress color distortion during the diffusion denoising process.
[0012] Preferably, the method for adding random noise is as follows:
[0013] in For the input image, The image is pure noise. For hyperparameters, It is Gaussian noise.
[0014] The noise reduction method is as follows:
[0015] in, This is the pure noise map obtained after t steps of noise addition. The image before noise addition at step t. For hyperparameters, The noise predicted by the neural network.
[0016] Preferably, the expression for the loss function in step 3 is as follows:
[0017] in, For gradient loss, For brightness loss, This is for noise reduction loss.
[0018] Preferably, the expression for the gradient loss is as follows:
[0019] in, The gradient map output by the gradient recovery module. This is the gradient map of a normal light image; The expression for the brightness loss is as follows:
[0020] in, The brightness map output by the brightness restoration module. This is the brightness map of a normal light image; The expression for the denoising loss is as follows:
[0021] in, The noise artificially added to the diffusion noise module. This refers to the noise predicted in the diffusion denoising module.
[0022] A system for conditional diffusion low-light image enhancement based on dual-branch attention feature encoding includes the following steps: The feature encoding module is used to construct a low-light image feature encoding model based on dual-branch attention. It includes a gradient recovery module and a brightness recovery module connected in parallel. It adopts channel attention mechanism and spatial attention mechanism to transfer the features of the low-light image to the gradient recovery module and the brightness recovery module. The gradient recovery module outputs the gradient map features of the low-light image, and the brightness recovery module outputs the brightness map features of the low-light image. The noise module is used to construct the conditional diffusion model. It stitches the gradient map features, brightness map features and the original low light image and inputs them into the conditional diffusion model. Random noise is added to the stitched image to turn it into pure noise, and the normal light image is obtained from the pure noise. The enhancement module is used to train the low-light image feature encoding model and the conditional diffusion model by minimizing the loss function, using structural similarity loss and color consistency loss as constraints, until the network model converges, thus obtaining the conditional diffusion low-light image enhancement model. The conditional diffusion low-light image enhancement model is then used to enhance the low-light image.
[0023] Compared with the prior art, the present invention has the following beneficial technical effects: This invention provides a conditional diffusion image enhancement method for low-light images based on dual-branch attention feature encoding. Addressing the limitations of existing techniques in handling noise in low-light images, this invention introduces feature encoding technology and a conditional diffusion model. Since feature encoding provides prior information for training the neural network, the enhanced normal-light image obtained by this invention has better quality and clarity. Furthermore, because this invention samples progressively from Gaussian noise to obtain the final normal-light image, it possesses richer and more realistic detail information. In addition, since images generated by diffusion models often suffer from insufficient contrast, a contrast correction module is used to address this issue, further improving the quality of the generated image. Attached Figure Description
[0024] Figure 1 This is a flowchart of the conditional diffusion low-light image enhancement method of the present invention; Figure 2 This is a diagram illustrating the overall framework of the conditional diffusion network based on dual-branch attention feature encoding of this invention. Figure 3 This is a diagram of the dual-branch attention structure of the present invention; Figure 4 This is a structural diagram of the contrast correction module of the present invention. Detailed Implementation
[0025] The present invention will now be described in further detail with reference to the accompanying drawings. These descriptions are intended to explain the invention and not to limit it.
[0026] See Figure 1 A conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding includes the following steps: Step 1: Construct a low-light image feature encoding model based on bi-branch attention to obtain the gradient map and brightness map of the low-light image; The low-light image feature encoding model includes a gradient recovery module and a brightness recovery module; The gradient recovery module is used to recover gradient maps from low-light images. Gradient maps provide information on local grayscale value changes in the image and can describe the changes between edges, textures, and regions in the image.
[0027] The brightness recovery module is used to recover a brightness map from a low-light image. The brightness map contains the brightness information of each pixel in the image, which can describe the distribution of light and dark in the image and reflect the overall brightness characteristics of the image.
[0028] This low-light image feature encoding model employs a dual-branch attention mechanism. By combining channel attention and spatial attention, it effectively transfers features from low-light images to the gradient recovery and brightness recovery modules. Specifically, the dual-branch attention mechanism combines spatial attention weights with channel attention weights. This means that when calculating the attention weight for each channel, the model considers not only the relationships between channels but also their spatial relationships. Therefore, it can effectively handle detail blurring and structural loss in low-light images. This approach allows the gradient recovery module to incorporate more texture information into its input, thereby improving the quality of the gradient map.
[0029] The low-light image feature encoding model is constructed using a deep neural network, with the gradient recovery module and brightness recovery module connected in parallel. The gradient recovery module recovers gradient feature maps from the low-light image, used to describe the first and second-order gray-level changes between edges, textures, and regions in the image. The gradient recovery module has at least four neural network layers, including a two-dimensional convolutional layer, a normalization layer, and a ReLU activation function layer combined in sequence. It can contain one or more sets of these combinations, each set containing one residual connection layer, or multiple sets using a single residual connection layer connected from the beginning to the end. The input to the gradient recovery module is a multi-channel numerical matrix of the low-light image, and the output is a tensor map, i.e., the gradient feature map, calculated by the aforementioned deep neural network layers. The number of rows and columns, as well as the number of channels, of the input and output numerical matrices of this module are consistent.
[0030] The brightness restoration module calculates the local and global brightness distribution features of the image from the numerical matrix of the low-light image. This module contains at least five neural network layers, where two-dimensional convolutional layers, normalization layers, and ReLU activation function layers are combined in sequence. It can contain one or more sets of these combinations, each containing one residual connection layer, or multiple sets using a single residual connection layer connected from the beginning to the end. Finally, a sigmoid activation function layer quantizes the calculation results and outputs them. The number of rows and columns in the numerical matrix of the brightness restoration module remains constant, but the number of output channels becomes a single channel.
[0031] This attention module employs both channel attention and spatial attention mechanisms. For the input low-light image, it uses the gradient recovery module and brightness recovery module to calculate local and global features. For each module, the input features are multiplied by three trainable parameter matrices of the same resolution to obtain the key (k), query (q), and value (v). The dot product of the key (k) and query (q) is calculated to obtain their similarity, and then normalized using the softmax function to obtain the weight α calculated by the attention mechanism. The attention weight α is then weighted and averaged with the value (v) to obtain the result of the attention calculation for this module. Finally, the feature maps calculated by channel attention and spatial attention are added element-wise to obtain the output features of the feature encoding module. The calculation process is shown in the following equation:
[0032] Step 2: Construct a conditional diffusion model, including a diffusion noise addition module, a diffusion noise reduction module, and a contrast correction module; The gradient map and brightness map obtained in step 1 are concatenated with the original low-light image and input into the conditional diffusion model for enhancement and denoising. This model first gradually adds random noise to the input image until it becomes pure noise, then learns the diffusion process to construct the desired normal light image from the pure noise. By recovering the normal light image from pure noise, it effectively solves the noise problem that traditional low-light image enhancement methods struggle to handle, further improving image quality. However, diffusion models often result in insufficient contrast in the generated images. Therefore, a contrast correction module is used to further improve image quality while effectively removing noise. The specific method is as follows: This conditional diffusion model is constructed using a deep neural network, consisting of a diffusion noise-adding module and a diffusion denoising module connected in parallel. In the diffusion noise-adding module, random Gaussian noise is added to the input feature map incrementally for a number of steps, T, with a minimum of two steps, until the resulting feature map becomes a pure noise image following a Gaussian distribution. The output feature maps of the gradient recovery module and the brightness recovery module are concatenated with the pure noise image along the channel dimension to obtain the input to the diffusion denoising module. The diffusion denoising module uses a U-shaped network structure, containing at least three neural network layers, including at least one downsampling and one upsampling process to obtain feature calculation results at different scales. Each two-dimensional convolutional layer of the U-shaped network is sequentially combined with a normalization, ReLU activation function, and linear layer. The diffusion noise-adding module can be controlled by the number of steps t and the input image. Obtain a pure noise image The noise addition process is shown in the following formula:
[0033] in, For the input image, The image is pure noise. For hyperparameters, It is Gaussian noise.
[0034] The diffusion denoising module can denoise images with pure noise. and the noise in neural network predictions Obtain the image before noise addition at step t. After t iterations, a normal light image is finally obtained. The noise reduction process is shown in the following equation:
[0035] in This is the pure noise map obtained after t steps of noise addition. The image before noise addition at step t. For hyperparameters, The noise predicted by the neural network.
[0036] Secondly, the conditional diffusion model introduces a contrast correction module, which reduces the color cast phenomenon that occurs during the diffusion denoising process while preserving the generated edges and textures, thus solving the problem of insufficient contrast in the images generated by the diffusion model.
[0037] The contrast correction module contains at least four neural network layers. The main module's 2D convolutional layers and ReLU activation function layers are sequentially combined, and may include one or more such combinations. The branch modules' 2D convolutional layers, ReLU activation function layers, and global average pooling layers are sequentially combined, and each branch contains only one such combination. The contrast correction module uses these neural network layers to correct the noise in the image obtained after t steps of noise addition. The color information is added to the network as a feature vector, which improves the image quality after one denoising step. The color will not match Excessive deviation occurs, thereby suppressing the color cast phenomenon that occurs during the diffusion denoising process.
[0038] Step 3: Train the low-light image feature encoding model and the conditional diffusion model using the image dataset. The optimization conditions are structure similarity loss and color consistency loss. The model parameters are optimized by minimizing the loss function until the network model converges. The performance of the model is evaluated using the test set data. The parameters after the neural network training are saved to obtain the conditional diffusion low-light image enhancement model.
[0039] The model parameters are optimized by minimizing the loss function term, which consists of gradient loss, brightness loss, and denoising loss. The gradient loss is the L1 norm of the gradient feature map output by the gradient recovery module and the gradient feature map of the normal light image; the brightness loss is the L1 norm of the brightness feature map output by the brightness recovery module and the brightness feature map of the normal light image; and the denoising loss is the L2 norm of the noise predicted in the diffusion denoising module and the noise added in the diffusion denoising module.
[0040] The expression for the loss function is as follows: (1) in, For gradient loss, For brightness loss, The noise reduction loss is shown in Equations (2), (3), and (4), respectively.
[0041] (2) in, The gradient map output by the gradient recovery module. This is the gradient map of a normal light image.
[0042] (3) in, The brightness map output by the brightness restoration module. This is the brightness map of a normal light image.
[0043] (4) in, The noise artificially added to the diffusion noise module. This refers to the noise predicted in the diffusion denoising module.
[0044] After the model is trained, low-light images from the test set are input to obtain enhanced images. The enhanced images and normal-light images from the test set are compared using two image quality evaluation metrics: Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity (SSIM).
[0045] Step 4: Use the conditional diffusion low-light image enhancement model to enhance the low-light image. Input the low-light image into the conditional diffusion low-light image enhancement model to obtain the enhanced image, thus realizing the enhancement of the low-light image.
[0046] This invention first obtains gradient and brightness maps through a low-light image feature encoding model based on a dual-branch attention mechanism, then obtains normal light images from Gaussian noise through a conditional diffusion model, and further improves image quality through a contrast correction module.
[0047] Example 1 See Figure 2-4 A conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding is proposed. This method uses deep learning technology to enhance low-light images into normal-light images, and includes the following steps: Step 1: Build a low-light image feature encoding model based on dual-branch attention, including a gradient recovery module and a brightness recovery module.
[0048] S1.1 Gradient Recovery Module: This module consists of multiple sets of two-dimensional convolutional layers, ReLU activation function, normalization, and residual blocks. Assuming the input to this module is a 3×256×256 low-light image, its output is a 3×256×256 gradient feature map.
[0049] S1.2 Brightness Restoration Module: This module consists of multiple sets of two-dimensional convolutional layers, ReLU activation function, Sigmoid activation function, normalization, and residual blocks. Assuming the input to this module is a 3×256×256 low-light image, its output is a 1×256×256 grayscale image.
[0050] The process of building a low-light image feature encoding model based on dual-branch attention is as follows: The low-light image is used as the raw input and fed into the gradient recovery module and the brightness recovery module respectively. The gradient recovery module has the following layers: The first layer contains a 2D convolution, a ReLU activation function, a two-branch attention mechanism, and a residual block. The kernel size is 3×3, the output channels are 6, and the stride is 2. The second layer contains a 2D convolution, a ReLU activation function, and a residual block. The kernel size is 3×3, the output channels are 12, and the stride is 2. The third layer contains a 2D convolution, a ReLU activation function, and a residual block. The kernel size is 1×1, the output channels are 6, and the stride is 1. The fourth layer contains a 2D convolution, a ReLU activation function, and a residual block. The kernel size is 1×1, the output channels are 3, and the stride is 1.
[0051] The brightness restoration module consists of four layers. The first layer contains a 3×3 kernel, a ReLU activation function, and normalization. The kernel size is 3×3, the output channels are 3, and the stride is 1. The second layer contains two 2D convolutions, a ReLU activation function, a two-branch attention mechanism, and normalization. The first 2D convolution has a 3×3 kernel, 6 output channels, and a stride of 2. The second 2D convolution also has a 3×3 kernel, 6 output channels, and a stride of 1. The third layer is similar in structure to the second, containing two 2D convolutions, a ReLU activation function, and normalization. The first 2D convolution has a 3×3 kernel, 12 output channels, and a stride of 2. The second 2D convolution has a 3×3 kernel, 12 output channels, and a stride of 1. The fourth layer contains two 2D convolutions, a ReLU activation function, and normalization. The first 2D convolution has a 1×1 kernel, 6 output channels, and a stride of 1. The second 2D convolution has a 3×3 kernel, 6 output channels, and a stride of 1. The fifth layer contains two 2D convolutions, a sigmoid activation function, and normalization. The first 2D convolution has a 1×1 kernel, 3 output channels, and a stride of 1. The second 2D convolution has a 3×3 kernel, 1 output channel, and a stride of 1.
[0052] Step 2: Build a conditional diffusion model, including a diffusion noise-adding module, a diffusion noise-reducing module, and a contrast correction module.
[0053] S2.1, Diffusion Noise Addition Module: This module first adds random noise to a normal light image of size 3×256×256 in 1000 steps until it becomes a pure noise image. Then, the 3×256×256 gradient feature map output from step 1 and the 1×256×256 grayscale image are concatenated with the pure noise image along the channels, finally outputting a noise image of size 7×256×256.
[0054] S 2.2, Diffusion Denoising Module: This module consists of multiple sets of two-dimensional convolutional layers, ReLU activation functions, normalization, linear layers, and a contrast correction module. It takes the 7×256×256 noise map output from the noise-adding module as input, learns the diffusion noise-adding process, and suppresses color casts occurring during denoising through the contrast correction module. It then constructs the distribution of a normal light image from the pure noise, ultimately outputting a 3×256×256 normal light image.
[0055] The process of building the conditional diffusion model is as follows: In 1000 steps, random noise is added to a normal light image of size 3×256×256 until it becomes a pure noise image. Then, the 3×256×256 gradient feature map output from step 1 and the 1×256×256 grayscale image are concatenated along the channels with the pure noise image to form a noise image of size 7×256×256. The 7×256×256 noise image is input into the diffusion denoising module to finally obtain a 3×256×256 normal light image. The diffusion denoising module first passes the 7×256×256 noise image through a two-dimensional convolutional layer, outputting a 32×256×256 feature map. This feature map undergoes five upsampling and five downsampling operations. The first downsampling layer contains a two-dimensional convolutional layer, a ReLU activation function, and normalization. The convolutional kernel size is 3×3, the output channels are 32, and the convolutional stride is 2. The following four downsampling layers have a similar structure to the first downsampling layer, but the output channels of the 2D convolutions are 64, 128, 256, and 1024, respectively. After four downsampling passes, the feature map size becomes 1024×16×16. The first upsampling layer contains a 2D convolutional layer, a ReLU activation function, normalization, and upsampling. The convolutional kernel size is 3×3, the output channels are 256, and the convolutional stride is 1. The following four upsampling layers have a similar structure to the first upsampling layer, but the output channels of the 2D convolutions are 128, 64, 32, and 3, respectively. After five upsampling passes, the network generates a predicted noise map of size 3×256×256. The result of subtracting the predicted noise from the noise map is input into the contrast correction module, and the final output is a normal light image of size 3×256×256.
[0056] Step 3: Train the low-light image feature encoding model and the conditional diffusion model using no less than 500 pairs of images with low light and normal light. Optimize the model parameters by minimizing the loss function term until the network model converges. Save the parameters after neural network training to obtain the conditional diffusion low-light image enhancement model. Finally, use the test set data to evaluate the model's performance.
[0057] Step 4: Input the low-light image into the conditional diffusion low-light image enhancement model, and the conditional diffusion low-light image enhancement model outputs the enhanced low-light image.
[0058] Example 2 A conditional diffusion low-light image enhancement system based on dual-branch attention feature encoding includes the following steps: The feature encoding module is used to construct a low-light image feature encoding model based on dual-branch attention. It includes a gradient recovery module and a brightness recovery module connected in parallel. It adopts channel attention mechanism and spatial attention mechanism to transfer the features of the low-light image to the gradient recovery module and the brightness recovery module. The gradient recovery module outputs the gradient map features of the low-light image, and the brightness recovery module inputs the brightness map features of the low-light image. The noise module is used to construct the conditional diffusion model. It stitches the gradient map features, brightness map features and the original low light image and inputs them into the conditional diffusion model. Random noise is added to the stitched image to turn it into pure noise, and the normal light image is obtained from the pure noise. The enhancement module is used to train the low-light image feature encoding model and the conditional diffusion model by minimizing the loss function, using structural similarity loss and color consistency loss as constraints, until the network model converges, thus obtaining the conditional diffusion low-light image enhancement model. The conditional diffusion low-light image enhancement model is then used to enhance the low-light image.
[0059] This invention discloses a conditional diffusion low-light image enhancement method based on feature encoding. The method first extracts the gradient map and brightness map from the low-light image, then progressively samples from Gaussian noise, and addresses the problem of insufficient contrast in the diffusion model's generated results through a contrast correction module, ultimately obtaining a highly realistic normal-light image. Its key feature is that the gradient map and brightness map are obtained through a low-light image feature encoding model based on bi-branch attention, serving as prior information to guide the training of the diffusion model.
[0060] Furthermore, a conditional diffusion model was designed to construct the desired normal light image from pure noise, which can better handle noise problems in low-light images. The enhanced image can well simulate the distribution of natural images and has richer and more realistic details. This invention also incorporates a contrast correction module, which can suppress color casts that occur during diffusion denoising, further improving the quality of the generated image.
[0061] The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.
Claims
1. A conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding, characterized in that, Includes the following steps: Step 1: Construct a low-light image feature encoding model based on dual-branch attention, including a gradient recovery module and a brightness recovery module connected in parallel. The channel attention mechanism and spatial attention mechanism are used to transfer the features of the low-light image to the gradient recovery module and the brightness recovery module. The gradient recovery module outputs the gradient map features of the low-light image, and the brightness recovery module outputs the brightness map features of the low-light image. Step 2: Construct a conditional diffusion model. The gradient map features, brightness map features and the original low-light image are stitched together and input into the conditional diffusion model. Random noise is added to the stitched image to turn it into pure noise. The normal light image is then obtained from the pure noise. Step 3: Using gradient loss, brightness loss and denoising loss as constraints, and optimizing the model parameters by minimizing the loss function, train the low-light image feature encoding model and the conditional diffusion model until the network model converges, and obtain the conditional diffusion low-light image enhancement model. Step 4: Enhance the low-light image using the conditional diffusion low-light image enhancement model.
2. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 1, characterized in that, The gradient recovery module comprises multiple neural network layers, including two-dimensional convolutional layers, normalization layers, ReLU activation function layers, and residual connection layers. The input of the gradient recovery module is a multi-channel numerical matrix of the low-light image, and the output is a gradient feature map.
3. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 1, characterized in that, The brightness restoration module includes multiple neural network layers, including two-dimensional convolutional layers, normalization layers, ReLU activation function layers, and fully connected layers. The brightness restoration module calculates the local and global brightness distribution features of the image from the low-light image numerical matrix to obtain brightness map features.
4. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 1, characterized in that, The conditional diffusion model includes a diffusion noise-adding module and a diffusion noise-reducing module; The diffusion noise module is used to add random Gaussian noise to the input feature map step by step until the resulting feature map becomes a pure noise image that follows a Gaussian distribution. The diffusion denoising module is used to denoise a purely noisy image and construct a normal light image.
5. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 4, characterized in that, The conditional diffusion model also includes a contrast correction module, which uses the color of the noise map as a feature vector to suppress color bias during the diffusion denoising process.
6. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 4, characterized in that, The method for adding random noise is as follows: in For the input image, The image is pure noise. For hyperparameters, It is Gaussian noise; The noise reduction method is as follows: in, This is the image with pure noise obtained after t steps of noise addition. The image before noise addition at step t. For hyperparameters, The noise predicted by the neural network.
7. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 4, characterized in that, The expression for the loss function described in step 3 is as follows: in, For gradient loss, For brightness loss, This is for noise reduction loss.
8. The conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to claim 7, characterized in that, The expression for the gradient loss is as follows: in, The gradient map features output by the gradient recovery module. Gradient map features of normal light images; The expression for the brightness loss is as follows: in, Features of the luminance map output by the luminance recovery module. The brightness map features of a normal light image; The expression for the denoising loss is as follows: in, The noise artificially added to the diffusion noise module. This refers to the noise predicted in the diffusion denoising module.
9. A system for performing the conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding according to any one of claims 1-8, characterized in that, include: The feature encoding module is used to construct a low-light image feature encoding model based on dual-branch attention. It includes a gradient recovery module and a brightness recovery module connected in parallel. It adopts channel attention mechanism and spatial attention mechanism to transfer the features of the low-light image to the gradient recovery module and the brightness recovery module. The gradient recovery module outputs the gradient map features of the low-light image, and the brightness recovery module outputs the brightness map features of the low-light image. The noise module is used to construct the conditional diffusion model. It stitches the gradient map features, brightness map features and the original low light image and inputs them into the conditional diffusion model. Random noise is added to the stitched image to turn it into pure noise, and the normal light image is obtained from the pure noise. The enhancement module uses gradient loss, brightness loss, and denoising loss as constraints, and optimizes the model parameters by minimizing the loss function. It trains the low-light image feature encoding model and the conditional diffusion model until the network model converges, resulting in the conditional diffusion low-light image enhancement model. The conditional diffusion low-light image enhancement model is then used to enhance the low-light image.
