CN118735806A - Conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding - Google Patents
Conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding Download PDFInfo
- Publication number
- CN118735806A CN118735806A CN202410830265.8A CN202410830265A CN118735806A CN 118735806 A CN118735806 A CN 118735806A CN 202410830265 A CN202410830265 A CN 202410830265A CN 118735806 A CN118735806 A CN 118735806A
- Authority
- CN
- China
- Prior art keywords
- light image
- noise
- diffusion
- gradient
- conditional
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/60—Image enhancement or restoration using machine learning, e.g. neural networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/082—Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/77—Retouching; Inpainting; Scratch removal
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Molecular Biology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Image Processing (AREA)
Abstract
本发明公开了一种基于双分支注意力特征编码的条件扩散弱光图像增强方法及系统,该方法通过构建基于双分支注意力的弱光图像特征编码模型和条件扩散模型,弱光图像特征编码模型包括梯度恢复模块和亮度恢复模块,采用通道注意力机制和空间注意力机制,将弱光图像的特征转移到梯度恢复模块和亮度恢复模块,对弱光图像的特征图和梯度图进行恢复;将梯度图特征和亮度图特征作为先验信息指导扩散模型的训练,因此增强后的正常光图像具有更好的质量以及清晰度。
The present invention discloses a conditional diffusion low-light image enhancement method and system based on dual-branch attention feature coding. The method constructs a low-light image feature coding model and a conditional diffusion model based on dual-branch attention. The low-light image feature coding model includes a gradient recovery module and a brightness recovery module. A channel attention mechanism and a spatial attention mechanism are used to transfer the features of the low-light image to the gradient recovery module and the brightness recovery module, and the feature map and the gradient map of the low-light image are restored. The gradient map features and the brightness map features are used as prior information to guide the training of the diffusion model, so that the enhanced normal light image has better quality and clarity.
Description
技术领域Technical Field
本发明涉及计算机视觉及人工智能技术领域,具体为基于双分支注意力特征编码的条件扩散弱光图像增强方法及系统。The present invention relates to the field of computer vision and artificial intelligence technology, and specifically to a conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding.
背景技术Background Art
随着多媒体技术的不断发展,图像已经成为人们日常生活中最常见的信息媒介,很多信息都以图像的形式保存和传递。因此,图像质量的好坏与获取到信息的数量和准确度息息相关。然而,在图像拍摄过程中,由于环境因素的影响,如阴天或夜晚等场景,导致图像质量偏暗、对比度与信噪比低等问题。弱光图像计算增强技术有助于改善弱光图像的质量和清晰度,还可以为数字图像处理、计算机视觉、人工智能等领域的相关应用提供更可靠和高质量的数据。With the continuous development of multimedia technology, images have become the most common information medium in people's daily lives, and a lot of information is stored and transmitted in the form of images. Therefore, the quality of images is closely related to the amount and accuracy of information obtained. However, during the image capture process, due to the influence of environmental factors, such as cloudy days or night scenes, the image quality is dark, the contrast and signal-to-noise ratio are low, and other problems. Low-light image computational enhancement technology helps to improve the quality and clarity of low-light images, and can also provide more reliable and high-quality data for related applications in the fields of digital image processing, computer vision, artificial intelligence, etc.
现有弱光图像增强方法主要分为两类:第一类是传统弱光图像增强方法,又细分为基于直方图均衡化的增强方法和基于Retinex分解模型的增强方法,第二类是基于深度学习的弱光图像增强方法。基于直方图均衡化的方法通过调整输入弱光图像的像素分布来增强像素较小的值,从而提高图像的对比度和清晰度。使用此方法还原的图像可能会出现亮度过亮、局部细节丢失和色彩失真等问题,导致视觉效果不理想。基于Retinex模型的增强方法将感知到的图像分解为反射和照度两个分量,从而使得照度变化不会影响物体的颜色,但增强后的图像还是会有色彩失真和过度增强等情况。Existing low-light image enhancement methods are mainly divided into two categories: the first category is the traditional low-light image enhancement method, which is further divided 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. The histogram equalization-based method enhances the smaller pixel values by adjusting the pixel distribution of the input low-light image, thereby improving the contrast and clarity of the image. The image restored using this method may have problems such as excessive brightness, loss of local details, and color distortion, resulting in unsatisfactory visual effects. The enhancement method based on the Retinex model decomposes the perceived image into two components: reflection and illumination, so that changes in illumination will not affect the color of the object, but the enhanced image will still have color distortion and over-enhancement.
因此,如何处理图像中的噪声一直是弱光图像增强方法的难点,因为在增强图像亮度的同时,图像中的噪声也会被增强,从而导致增强结果出现过曝光、色彩失真等情况。Therefore, how to deal with the noise in the image has always been a difficult point in the low-light image enhancement method, because while enhancing the image brightness, the noise in the image will also be enhanced, resulting in overexposure, color distortion, etc. in the enhanced result.
针对现有技术手段对处理弱光图像噪声问题的局限,本发明首先根据强度从小到大依次添加噪声将输入弱光图像变为高斯噪声,然后从高斯噪声中逐步进行采样,最终得到高真实性的正常光图像。本发明可有效提高弱光图像的亮度、对比度以及清晰度,并有效抑制图像噪声,增强后图像的色彩和亮度更为接近正常光照图像,且能保留更多的图像细节信息。In view of the limitations of existing technical means in processing low-light image noise, the present invention first adds noise in order from small to large intensity to convert the input low-light image into Gaussian noise, and then gradually samples from the Gaussian noise to finally obtain a highly realistic normal-light image. The present invention can effectively improve the brightness, contrast and clarity of low-light images, and effectively suppress image noise. The color and brightness of the enhanced image are closer to the normal-light image, and more image detail information can be retained.
发明内容Summary of the invention
针对现有技术手段对处理弱光图像噪声的问题,本发明提供一种基于双分支注意力特征编码的条件扩散弱光图像增强方法,根据强度从小到大依次添加噪声将输入弱光图像变为高斯噪声,然后从高斯噪声中逐步进行采样,最终得到高真实性的正常光图像。可有效提高弱光图像的亮度、对比度以及清晰度,并有效抑制图像噪声,增强后图像的色彩和亮度更为接近正常光照图像,且能保留更多的图像细节信息。In view of the problem of low-light image noise processing in the existing technical means, the present invention provides a conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding, which adds noise in order from small to large intensity to convert the input low-light image into Gaussian noise, and then gradually samples from the Gaussian noise to finally obtain a high-fidelity normal-light image. It can effectively improve the brightness, contrast and clarity of low-light images, and effectively suppress image noise. The color and brightness of the enhanced image are closer to the normal-light image, and more image detail information can be retained.
本发明是通过以下技术方案来实现:The present invention is achieved through the following technical solutions:
一种基于双分支注意力特征编码的条件扩散弱光图像增强方法,包括以下步骤:A conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding, comprising the following steps:
步骤1、构建基于双分支注意力的弱光图像特征编码模型,包括并行连接的梯度恢复模块和亮度恢复模块,采用通道注意力机制和空间注意力机制,将弱光图像的特征转移到梯度恢复模块和亮度恢复模块,梯度恢复模块输出弱光图像的梯度图特征,亮度恢复模块输入弱光图像的光亮图特征;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 the 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 inputs the brightness map features of the low-light image.
步骤2、构建条件扩散模型,将梯度图特征、亮度图特征和原始弱光图像拼接后输入至条件扩散模型,在拼接图像中添加随机噪声将其变为纯噪声,从纯噪声中获取正常光图像;Step 2: construct a conditional diffusion model, splice the gradient map features, the brightness map features and the original low-light image and input them into the conditional diffusion model, add random noise to the spliced image to turn it into pure noise, and obtain a normal light image from the pure noise;
步骤3、采用结构相似性损失和颜色一致性损失为约束条件,并通过最小化损失函数来优化模型参数,对弱光图像特征编码模型和条件扩散模型进行训练,直至网络模型收敛,得到条件扩散弱光图像增强模型;Step 3: Using structural similarity loss and color consistency loss as constraints, and optimizing model parameters by minimizing the loss function, the low-light image feature encoding model and the conditional diffusion model are trained until the network model converges, thereby obtaining a conditional diffusion low-light image enhancement model;
步骤4、采用条件扩散弱光图像增强模型对弱光图像进行增强。Step 4: Use the conditional diffusion low-light image enhancement model to enhance the low-light image.
优选的,所述梯度恢复模块为包括多个神经网络层,神经网络层包括二维卷积层,归一化层、ReLU激活函数层和残差连接层,梯度恢复模块的输入为弱光图像的多通道数值矩阵,输出为梯度特征图。Preferably, the gradient recovery module includes multiple neural network layers, the neural network layer includes a two-dimensional convolution layer, a normalization layer, a ReLU activation function layer and a residual connection layer. 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.
优选的,所述亮度恢复模块包括多个神经网络层,神经网络层包括二维卷积层,归一化层、ReLU激活函数层和全连接层,所述亮度恢复模块从弱光图像数值矩阵中计算图像局部和全局的亮度分布特征得到光亮图特征。Preferably, the brightness restoration module includes multiple neural network layers, the neural network layer includes a two-dimensional convolution layer, a normalization layer, a ReLU activation function layer and a fully connected layer, and the brightness restoration module calculates the local and global brightness distribution characteristics of the image from the low-light image numerical matrix to obtain the brightness map characteristics.
优选的,所述条件扩散模型包括扩散加噪模块和扩散去噪模块;Preferably, the conditional diffusion model includes a diffusion noise addition module and a diffusion denoising module;
所述扩散加噪模块,用于对输入特征图逐步添加随机高斯噪声的方式进行加噪,直至所得的特征图变为服从高斯分布的纯噪声图像;The diffusion noise adding module is used to add noise to the input feature map by gradually adding random Gaussian noise until the obtained feature map becomes a pure noise image obeying Gaussian distribution;
所述扩散去噪模块,用于对纯噪声图像进行去燥并构建正常光图像。The diffusion denoising module is used to denoise the pure noise image and construct a normal light image.
优选的,所述条件扩散模型还包括对比度校正模块,用于采用噪声图的颜色作为特征向量,抑制扩散去噪过程发生的偏色现象。Preferably, the conditional diffusion model further includes a contrast correction module for using the color of the noise image as a feature vector to suppress the color cast phenomenon occurring in the diffusion denoising process.
优选的,所述添加随机噪声的方法如下:Preferably, the method of adding random noise is as follows:
其中x0为输入图像,xt为纯噪声图像,αt为超参数,zt为高斯噪声。Where x0 is the input image, xt is a pure noise image, αt is a hyperparameter, and zt is Gaussian noise.
所述去燥方法如下:The desiccation method is as follows:
其中,xt为经过t步加噪得到的纯噪声图,xt-1为经过第t步加噪前的图像,αt为超参数,εθ为神经网络预测的噪声。Among them, xt is the pure noise image obtained after t-step noise addition, xt -1 is the image before the t-th step noise addition, αt is the hyperparameter, and εθ is the noise predicted by the neural network.
优选的,步骤3所述损失函数的表达式如下:Preferably, the loss function in step 3 is expressed as follows:
Ltotal=Lg+Li+Ln L total = L g + Li + L n
其中,Lg为梯度损失,Li为亮度损失,Ln为去噪损失。Among them, Lg is the gradient loss, Li is the brightness loss, and Ln is the denoising loss.
优选的,所述梯度损失的表达式如下:Preferably, the expression of the gradient loss is as follows:
Lg=||G(I)-Igrad||1 L g =||G(I)-I grad || 1
其中,G(I)为梯度恢复模块输出的梯度图,Igrad为正常光图像的梯度图;Among them, G(I) is the gradient map output by the gradient recovery module, and I grad is the gradient map of the normal light image;
所述亮度损失的表达式如下:The expression of the brightness loss is as follows:
Li=||L(I)-Ilight||1 Li =||L(I) -Ilight || 1
其中,L(I)为亮度恢复模块输出的亮度图,Ilight为正常光图像的亮度图;Wherein, L(I) is the brightness image output by the brightness restoration module, and I light is the brightness image of the normal light image;
所述去噪损失的表达式如下:The expression of the denoising loss is as follows:
Ln=||ε-εθ||2 L n =||ε-ε θ || 2
其中,ε为扩散加噪模块中人为添加的噪声,εθ为扩散去噪模块中预测的噪声。Among them, ε is the noise artificially added in the diffusion noise addition module, and ε θ is the noise predicted in the diffusion denoising module.
一种基于双分支注意力特征编码的条件扩散弱光图像增强方法的系统,包括以下步骤:A system for conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding, comprising the following steps:
特征编码模块,用于构建基于双分支注意力的弱光图像特征编码模型,包括并行连接的梯度恢复模块和亮度恢复模块,采用通道注意力机制和空间注意力机制,将弱光图像的特征转移到梯度恢复模块和亮度恢复模块,梯度恢复模块输出弱光图像的梯度图特征,亮度恢复模块输入弱光图像的光亮图特征;A feature encoding module is used to construct a feature encoding model for low-light images based on dual-branch attention, including a gradient recovery module and a brightness recovery module connected in parallel. The channel attention mechanism and the 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 inputs the brightness map features of the low-light image.
噪声模块,用于构建条件扩散模型,将梯度图特征、亮度图特征和原始弱光图像拼接后输入至条件扩散模型,在拼接图像中添加随机噪声将其变为纯噪声,从纯噪声中获取正常光图像;The noise module is used to build a conditional diffusion model, splice the gradient map features, the brightness map features and the original low-light image and input them into the conditional diffusion model, add random noise to the spliced image to turn it into pure noise, and obtain a normal light image from the pure noise;
增强模块,用于采用结构相似性损失和颜色一致性损失为约束条件,并通过最小化损失函数来优化模型参数,对弱光图像特征编码模型和条件扩散模型进行训练,直至网络模型收敛,得到条件扩散弱光图像增强模型,采用条件扩散弱光图像增强模型对弱光图像进行增强。The enhancement module is used to use structural similarity loss and color consistency loss as constraints, and optimize the model parameters by minimizing the loss function. The low-light image feature encoding model and the conditional diffusion model are trained until the network model converges to obtain the conditional diffusion low-light image enhancement model, and the conditional diffusion low-light image enhancement model is used to enhance the low-light image.
与现有技术相比,本发明具有以下有益的技术效果:Compared with the prior art, the present invention has the following beneficial technical effects:
本发明提供一种基于双分支注意力特征编码的条件扩散弱光图像增强方法。本发明针对现有技术手段对处理弱光图像噪声问题的局限,引入了特征编码技术以及条件扩散模型。由于特征编码技术能为神经网络的训练提供先验信息,本发明增强后的正常光图像具有更好的质量以及清晰度。同时,由于本发明是从高斯噪声中逐步进行采样,最终得到正常光图像,所以具有更丰富、更真实的细节信息。此外,由于扩散模型生成图像往往有对比度不足的问题,通过对比度校正模块解决该问题,进一步提高了生成图像的质量。The present invention provides a conditional diffusion low-light image enhancement method based on dual-branch attention feature coding. In view of the limitations of the existing technical means in processing the low-light image noise problem, the present invention introduces feature coding technology and a conditional diffusion model. Since the feature coding technology can provide prior information for the training of the neural network, the normal light image enhanced by the present invention has better quality and clarity. At the same time, since the present invention gradually samples from Gaussian noise and finally obtains a normal light image, it has richer and more realistic detail information. In addition, since the image generated by the diffusion model often has the problem of insufficient contrast, this problem is solved by a contrast correction module, thereby further improving the quality of the generated image.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本发明条件扩散弱光图像增强方法的流程图;FIG1 is a flow chart of a conditional diffusion weak-light image enhancement method according to the present invention;
图2为本发明基于双分支注意力特征编码的条件扩散网络的总体框架图;FIG2 is an overall framework diagram of a conditional diffusion network based on dual-branch attention feature encoding of the present invention;
图3为本发明双分支注意力结构图;FIG3 is a diagram of a dual-branch attention structure of the present invention;
图4为本发明对比度校正模块结构图。FIG. 4 is a structural diagram of a contrast correction module of the present invention.
具体实施方式DETAILED DESCRIPTION
下面结合附图对本发明做进一步的详细说明,所述是对本发明的解释而不是限定。The present invention will be further described in detail below in conjunction with the accompanying drawings, which are intended to explain the present invention rather than to limit it.
参阅图1,一种基于双分支注意力特征编码的条件扩散弱光图像增强方法,包括以下步骤:Referring to FIG1 , a conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding includes the following steps:
步骤1、构建基于双分支注意力的弱光图像特征编码模型,用于获取弱光图像的梯度图和亮度图;Step 1: construct a low-light image feature encoding model based on dual-branch attention to obtain the gradient map and brightness map of the low-light image;
所述弱光图像特征编码模型包括梯度恢复模块和亮度恢复模块;The low-light image feature coding model includes a gradient recovery module and a brightness recovery module;
所述梯度恢复模块用于从弱光图像中恢复梯度图,梯度图提供了图像中局部灰度值变化的信息,可以描述图像中的边缘、纹理和区域之间的变化情况。The gradient recovery module is used to recover the gradient map from the low-light image. The gradient map provides information about the change of local grayscale values in the image and can describe the change between edges, textures and regions in the image.
所述亮度恢复模块用于从弱光图像中恢复亮度图,亮度图包含了图像中每个像素点的亮度信息,可以描述图像中的明暗分布情况,反映了图像的整体亮度特征。The brightness restoration module is used to restore a brightness map from a low-light image. The brightness map contains the brightness information of each pixel in the image, can describe the light and dark distribution in the image, and reflects the overall brightness characteristics of the image.
该弱光图像特征编码模型采用双分支注意力机制,通过结合通道注意力机制和空间注意力机制,可以有效地将弱光图像里的特征转移到梯度恢复模块以及亮度恢复模块。具体来说,双分支注意力机制将空间注意力权重与通道注意力权重相结合,这意味着模型在计算每个通道的注意力权重时,不仅会考虑到通道之间的关系,还会考虑到空间位置的关系。因此,它可以有效处理低照度图像中的细节模糊和结构损失。该方案使梯度恢复模块的输入包含了更多纹理信息,从而提高梯度图的质量。The low-light image feature encoding model adopts a dual-branch attention mechanism. By combining the channel attention mechanism and the spatial attention mechanism, it can effectively transfer the features in the low-light image to the gradient recovery module and the brightness recovery module. Specifically, the dual-branch attention mechanism combines the spatial attention weight with the channel attention weight, which means that when the model calculates the attention weight of each channel, it not only considers the relationship between the channels, but also the relationship between the spatial positions. Therefore, it can effectively handle detail blurring and structural loss in low-light images. This scheme enables the input of the gradient recovery module to contain more texture information, thereby improving the quality of the gradient map.
所述弱光图像特征编码模型采用深度神经网络方式进行构建,梯度恢复模块和亮度恢复模块采用并行连接方式。梯度恢复模块从弱光图像中恢复梯度特征图,用于描述图像中的边缘、纹理和区域之间的灰度一阶和二阶变化。梯度恢复模块不少于4个神经网络层,其中二维卷积层,归一化层、ReLU激活函数层依次序组合,可以包含1组或多组上述组合,每组可包含1个残差连接层,或多组使用由首部与尾部相连的一个残差连接层。梯度恢复模块的输入为弱光图像的多通道数值矩阵,输出为上述深度神经网络层计算得到的张量图,即梯度特征图。该模块的输入输出数值矩阵行列数量以及通道数保持一致。The low-light image feature encoding model is constructed using a deep neural network, and the gradient recovery module and the brightness recovery module are connected in parallel. The gradient recovery module recovers the gradient feature map from the low-light image, which is used to describe the first-order and second-order grayscale changes between the edges, textures and regions in the image. The gradient recovery module has no less than 4 neural network layers, in which the two-dimensional convolution layer, the normalization layer, and the ReLU activation function layer are combined in sequence, and may include one or more groups of the above combinations, each of which may include one residual connection layer, or multiple groups using a residual connection layer connected by the head and the tail. The input of the gradient recovery module is a multi-channel numerical matrix of the low-light image, and the output is a tensor map calculated by the above-mentioned deep neural network layer, that is, a gradient feature map. The number of rows and columns of the input and output numerical matrices of this module and the number of channels remain consistent.
亮度恢复模块从弱光图像数值矩阵中计算图像局部和全局的亮度分布特征。该亮度恢复模块包含至少5个神经网络层,其中二维卷积层,归一化层、ReLU激活函数层依次序组合,可以包含1组或多组上述组合,每组可包含1个残差连接层,或多组使用由首部与尾部相连的一个残差连接层,最终由1个Sigmoid激活函数层对计算结果进行量化输出。亮度恢复模块的数值矩阵行列数量保持一致,但输出通道数变为单通道。The brightness restoration module calculates the local and global brightness distribution characteristics of the image from the numerical matrix of the low-light image. The brightness restoration module contains at least 5 neural network layers, among which the two-dimensional convolution layer, the normalization layer, and the ReLU activation function layer are combined in sequence, and can contain one or more groups of the above combinations. Each group can contain one residual connection layer, or multiple groups use a residual connection layer connected by the head and the tail, and finally a Sigmoid activation function layer quantizes the calculation results and outputs them. The number of rows and columns of the numerical matrix of the brightness restoration module remains the same, but the number of output channels becomes a single channel.
该注意力模块同时采用通道注意力机制和空间注意力机制,对输入的弱光图像采用所述的梯度恢复模块和亮度恢复模块进行局部和全局特征计算。对于两个模块,其输入特征分别与三个同分辨率的可训练参数矩阵相乘得到键(k)、查询(q)以及值(v)。将键(k)和查询(q)计算点积得到两者的相似度,再采用softmax函数进行归一化,得到注意力机制所计算的权重ɑ。将注意力权重ɑ与值(v)进行加权平均,得到该模块的注意力计算后结果。最终,通道注意力和空间注意力计算结果的特征图逐元素进行相加操作得到特征编码模块的输出特征。该计算过程如下式所示:The attention module uses both the channel attention mechanism and the spatial attention mechanism, and uses the gradient recovery module and the brightness recovery module to perform local and global feature calculations on the input low-light image. For the two modules, 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 the query (q) is calculated to obtain the similarity between the two, and then normalized using the softmax function to obtain the weight ɑ calculated by the attention mechanism. The attention weight ɑ is weighted averaged with the value (v) to obtain the attention calculation result of the module. Finally, the feature maps of the channel attention and spatial attention calculation results are added element by element to obtain the output features of the feature encoding module. The calculation process is shown in the following formula:
Attention(Q,K,V)=Softmax(QKT)VAttention(Q,K,V)=Softmax(QK T )V
步骤2、构建条件扩散模型,包括扩散加噪模块、扩散去噪模块以及对比度校正模块;Step 2: construct a conditional diffusion model, including a diffusion noise addition module, a diffusion denoising module, and a contrast correction module;
将步骤1得到的梯度图及亮度图与原始弱光图像拼接在一起输入到条件扩散模型中进行增强和去噪。该模型首先将随机噪声逐步添加到输入图像中至其变为纯噪声,再学习扩散过程,从纯噪声中构建所需的正常光图像,通过从纯噪声中恢复正常光图像可以有效地解决传统弱光图像增强方法难以处理的噪声问题,进一步提高图像的质量。但扩散模型通常会导致生成的图片对比度不足,因此通过对比度校正模块使得模型在有效去除噪声的前提下进一步提高了图像的质量,具体方法如下:The gradient map and brightness map obtained in step 1 are spliced together with the original low-light image and input into the conditional diffusion model for enhancement and denoising. The model first gradually adds random noise to the input image until it becomes pure noise, then learns the diffusion process to construct the required normal light image from pure noise. By restoring the normal light image from pure noise, the noise problem that is difficult to handle by traditional low-light image enhancement methods can be effectively solved, further improving the image quality. However, the diffusion model usually results in insufficient contrast in the generated image. Therefore, the contrast correction module is used to further improve the image quality while effectively removing noise. The specific method is as follows:
该条件扩散模型采用深度神经网络方式进行构建,由扩散加噪模块以及扩散去噪模块采用并行连接方式构成。扩散加噪模块中,向输入特征图逐步添加随机高斯噪声的方式进行加噪,添加噪声步数为T,T不少于2步,直至所得的特征图变为服从高斯分布的纯噪声图像。将所述的梯度恢复模块和亮度恢复模块的输出特征图与纯噪声图像沿通道维度进行拼接,得到扩散去噪模块的输入。扩散去噪模块采用U型网络结构,包含不少于3个神经网络层,其中需包含不少于1次下采样和1次上采样过程,以获取不同尺度的特征计算结果。U型网络的每个二维卷积层与归一化,ReLU激活函数,线性层依次组合。扩散加噪模块可通过步数t以及输入图像x0得到纯噪声图像xt,加噪过程如下式所示:The conditional diffusion model is constructed using a deep neural network, and is composed of a diffusion noise addition module and a diffusion denoising module connected in parallel. In the diffusion noise addition module, random Gaussian noise is gradually added to the input feature map for noise addition, and the number of noise addition steps is T, T is not less than 2 steps, until the obtained feature map becomes a pure noise image that obeys the Gaussian distribution. The output feature map of the gradient recovery module and the brightness recovery module are spliced with the pure noise image along the channel dimension to obtain the input of the diffusion denoising module. The diffusion denoising module adopts a U-shaped network structure, which includes no less than 3 neural network layers, which must include no less than 1 downsampling and 1 upsampling process to obtain feature calculation results of different scales. Each two-dimensional convolutional layer of the U-shaped network is combined with normalization, ReLU activation function, and linear layer in sequence. The diffusion noise addition module can obtain a pure noise image xt through the number of steps t and the input image x0 . The noise addition process is shown as follows:
其中,x0为输入图像,xt为纯噪声图像,αt为超参数,zt为高斯噪声。Among them, x0 is the input image, xt is the pure noise image, αt is the hyperparameter, and zt is Gaussian noise.
扩散去噪模块可通过纯噪声图像xt以及神经网络预测的噪声εθ得到经过第t步加噪前的图像xt-1,经过t次迭代后最终得到正常光图像x0。去噪过程如下式所示:The diffusion denoising module can obtain the image x t-1 before the t-th step of denoising through the pure noise image x t and the noise ε θ predicted by the neural network, and finally obtain the normal light image x 0 after t iterations. The denoising process is shown in the following formula:
其中xt为经过t步加噪得到的纯噪声图,xt-1为经过第t步加噪前的图像,αt为超参数,εθ为神经网络预测的噪声。Where xt is the pure noise image obtained after t-step noise addition, xt -1 is the image before the t-th step noise addition, αt is the hyperparameter, and εθ is the noise predicted by the neural network.
其次,该条件扩散模型中引入了对比度校正模块,在保留生成的边缘和纹理的同时减轻扩散去噪过程发生的偏色现象,解决了扩散模型生成图像对比度不足的问题。Secondly, a contrast correction module is introduced into the conditional diffusion model, which reduces the color cast in the diffusion denoising process while retaining the generated edges and textures, thus solving the problem of insufficient contrast in images generated by the diffusion model.
该对比度校正模块包含至少4个神经网络层,其中模块主干的二维卷积层,ReLU激活函数层依次序组合,可以包含1组或多组上述组合。模块分支的二维卷积层,ReLU激活函数层,全局平均池化层依次序组合且只包含一组上述组合。对比度校正模块通过上述神经网络层将经过t步加噪得到的噪声图xt的颜色信息作为特征向量加入到网络中,使得经过一步去噪后的图像xt-1的颜色不会与xt发生过大偏差,从而抑制扩散去噪过程发生的偏色现象。The contrast correction module includes at least 4 neural network layers, wherein the two-dimensional convolution layer and the ReLU activation function layer of the module trunk are sequentially combined, and may include one or more groups of the above combinations. The two-dimensional convolution layer, the ReLU activation function layer, and the global average pooling layer of the module branch are sequentially combined and include only one group of the above combinations. The contrast correction module adds the color information of the noise image xt obtained by t-step denoising to the network as a feature vector through the above neural network layer, so that the color of the image xt-1 after one-step denoising will not deviate too much from xt , thereby suppressing the color cast phenomenon that occurs in the diffusion denoising process.
步骤3、采用图像数据集对弱光图像特征编码模型和条件扩散模型进行训练,由结构相似性损失和颜色一致性损失为约束的调优条件,并通过最小化损失函数来优化模型参数,直至网络模型收敛,利用测试集数据来评估模型的性能,保存神经网络训练后的参数,得到条件扩散弱光图像增强模型。Step 3: Use the image dataset to train the low-light image feature encoding model and the conditional diffusion model, use the structural similarity loss and color consistency loss as the constraints for tuning, and optimize the model parameters by minimizing the loss function until the network model converges. Use the test set data to evaluate the performance of the model, save the parameters of the neural network after training, and obtain the conditional diffusion low-light image enhancement model.
通过最小化损失函数项来优化模型参数,损失函数项由梯度损失、亮度损失以及去噪损失构成。梯度损失为梯度恢复模块输出的梯度特征图与正常光图像的梯度特征图的L1范数;亮度损失为亮度恢复模块输出的亮度特征图与正常光图像的亮度特征图的L1范数;去噪损失为扩散去噪模块中预测的噪声与扩散加噪模块中添加的噪声的L2范数。The model parameters are optimized by minimizing the loss function terms, which are composed 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; 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.
损失函数的表达式如下:The expression of the loss function is as follows:
Ltotal=Lg+Li+Ln (1)L total = L g + Li + L n (1)
其中,Lg为梯度损失,Li为亮度损失,Ln为去噪损失,分别如公式(2)、公式(3)、公式(4)所示。Wherein, Lg is the gradient loss, Li is the brightness loss, and Ln is the denoising loss, as shown in formula (2), formula (3), and formula (4), respectively.
Lg=||G(I)-Igrad||1 (2)L g =||G(I)-I grad || 1 (2)
其中,G(I)为梯度恢复模块输出的梯度图,Igrad为正常光图像的梯度图。Among them, G(I) is the gradient map output by the gradient recovery module, and I grad is the gradient map of the normal light image.
Li=||L(I)-Ilight||1 (3)L i =||L(I)-I light || 1 (3)
其中,L(I)为亮度恢复模块输出的亮度图,Ilight为正常光图像的亮度图。Among them, L(I) is the brightness image output by the brightness restoration module, and I light is the brightness image of the normal light image.
Ln=||ε-εθ||2 (4)L n =||ε-ε θ || 2 (4)
其中,ε为扩散加噪模块中人为添加的噪声,εθ为扩散去噪模块中预测的噪声。Among them, ε is the noise artificially added in the diffusion noise addition module, and ε θ is the noise predicted in the diffusion denoising module.
模型训练完成后,输入测试集中的弱光图像,得到增强后图像。将增强图像与测试集中的正常光图像分别通过峰值信噪比(PSNR)以及结构相似性(SSIM)两个图像质量评价指标衡量模型性能。After the model training is completed, the low-light images in the test set are input to obtain the enhanced images. The enhanced images and the normal-light images in the test set are compared with each other using two image quality evaluation indicators, peak signal-to-noise ratio (PSNR) and structural similarity (SSIM), to measure the model performance.
步骤4、采用条件扩散弱光图像增强模型进行弱光图像增强,弱光图像输入条件扩散弱光图像增强模型,得到生成增强后的图像,实现对弱光图像的增强。Step 4: Use the conditional diffusion weak-light image enhancement model to enhance the weak-light image. The weak-light image is input into the conditional diffusion weak-light image enhancement model to generate an enhanced image, thereby enhancing the weak-light image.
本发明首先通过基于双分支注意力机制的弱光图像特征编码模型得到梯度图以及亮度图,然后通过条件扩散模型从高斯噪声中得到正常光图像,并通过对比度校正模块进一步提高图像质量。The present invention first obtains a gradient map and a brightness map through a low-light image feature encoding model based on a dual-branch attention mechanism, then obtains a normal-light image from Gaussian noise through a conditional diffusion model, and further improves the image quality through a contrast correction module.
实施例1Example 1
参阅图2-4,一种基于双分支注意力特征编码的条件扩散弱光图像增强方法,该方法采用深度学习技术将弱光图像增强为正常光图像,包括以下步骤:Referring to FIG. 2-4, a conditional diffusion low-light image enhancement method based on dual-branch attention feature encoding, which uses deep learning technology to enhance low-light images into normal-light images, includes the following steps:
步骤1,搭建基于双分支注意力的弱光图像特征编码模型,包括梯度恢复模块和亮度恢复模块。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.
S1.1、梯度恢复模块:该模块由多组二维卷积层、ReLU激活函数、归一化和残差块构成。假设该模块输入为3×256×256的弱光图像,其输出为3×256×256的梯度特征图。S1.1, Gradient recovery module: This module consists of multiple sets of two-dimensional convolutional layers, ReLU activation functions, normalization and residual blocks. Assume that the input of this module is a 3×256×256 low-light image, and its output is a 3×256×256 gradient feature map.
S1.2、亮度恢复模块:该模块由多组二维卷积层、ReLU激活函数、Sigmoid激活函数、归一化和残差块构成。假设该模块输入为3×256×256的弱光图像,其输出为1×256×256的灰度图。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. Assume that the input of this module is a 3×256×256 low-light image, and its output is a 1×256×256 grayscale image.
基于双分支注意力的弱光图像特征编码模型搭建过程如下:The process of building a low-light image feature encoding model based on dual-branch attention is as follows:
将弱光图像作为原始输入分别输入至梯度恢复模块以及亮度恢复模块。其中梯度恢复模块第一层包含一个二维卷积、ReLU激活函数、双分支注意力和残差块,卷积核大小为3×3,输出通道为6,卷积步长为2。第二层包含一个二维卷积、ReLU激活函数和残差块,卷积核大小为3×3,输出通道为12,卷积步长为2。第三层包含一个二维卷积、ReLU激活函数和残差块,卷积核大小为1×1,输出通道为6,卷积步长为1。第四层包含一个二维卷积、ReLU激活函数和残差块,卷积核大小为1×1,输出通道为3,卷积步长为1。The low-light image is used as the original input to the gradient recovery module and the brightness recovery module respectively. The first layer of the gradient recovery module contains a two-dimensional convolution, ReLU activation function, dual-branch attention and residual block, the convolution kernel size is 3×3, the output channel is 6, and the convolution step is 2. The second layer contains a two-dimensional convolution, ReLU activation function and residual block, the convolution kernel size is 3×3, the output channel is 12, and the convolution step is 2. The third layer contains a two-dimensional convolution, ReLU activation function and residual block, the convolution kernel size is 1×1, the output channel is 6, and the convolution step is 1. The fourth layer contains a two-dimensional convolution, ReLU activation function and residual block, the convolution kernel size is 1×1, the output channel is 3, and the convolution step is 1.
亮度恢复模块第一层包含一个二维卷积、ReLU激活函数和归一化,卷积核大小为3×3,输出通道为3,卷积步长为1。第二层包含两个二维卷积、ReLU激活函数、双分支注意力和归一化。第一个二维卷积卷积核大小为3×3,输出通道为6,卷积步长为2,第二个二维卷积卷积核大小为3×3,输出通道为6,卷积步长为1。第三层与第二层结构相似,包含两个二维卷积、ReLU激活函数、和归一化。第一个二维卷积卷积核大小为3×3,输出通道为12,卷积步长为2,第二个二维卷积卷积核大小为3×3,输出通道为12,卷积步长为1。第四层包含两个二维卷积、ReLU激活函数和归一化。第一个二维卷积卷积核大小为1×1,输出通道为6,卷积步长为1,第二个二维卷积卷积核大小为3×3,输出通道为6,卷积步长为1。第五层包含两个二维卷积、Sigmoid激活函数和归一化。第一个二维卷积卷积核大小为1×1,输出通道为3,卷积步长为1,第二个二维卷积卷积核大小为3×3,输出通道为1,卷积步长为1。The first layer of the brightness restoration module contains a 2D convolution, ReLU activation function and normalization. The convolution kernel size is 3×3, the output channel is 3, and the convolution step is 1. The second layer contains two 2D convolutions, ReLU activation function, dual-branch attention and normalization. The first 2D convolution has a convolution kernel size of 3×3, an output channel of 6, and a convolution step of 2. The second 2D convolution has a convolution kernel size of 3×3, an output channel of 6, and a convolution step of 1. The third layer has a similar structure to the second layer, containing two 2D convolutions, ReLU activation function, and normalization. The first 2D convolution has a convolution kernel size of 3×3, an output channel of 12, and a convolution step of 2. The second 2D convolution has a convolution kernel size of 3×3, an output channel of 12, and a convolution step of 1. The fourth layer contains two 2D convolutions, ReLU activation function and normalization. The first 2D convolution has a kernel size of 1×1, an output channel of 6, and a convolution step of 1. The second 2D convolution has a kernel size of 3×3, an output channel of 6, and a convolution step of 1. The fifth layer contains two 2D convolutions, a Sigmoid activation function, and normalization. The first 2D convolution has a kernel size of 1×1, an output channel of 3, and a convolution step of 1. The second 2D convolution has a kernel size of 3×3, an output channel of 1, and a convolution step of 1.
步骤2,搭建条件扩散模型,包括扩散加噪模块、扩散去噪模块以及对比度校正模块。Step 2: Build a conditional diffusion model, including a diffusion noise addition module, a diffusion denoising module, and a contrast correction module.
S2.1、扩散加噪模块:该模块首先分1000步将随机噪声添加到大小为3×256×256的正常光图像中至其变为纯噪声图。再将由步骤1输出的3×256×256的梯度特征图以及1×256×256的灰度图沿通道与纯噪声图拼接起来,最终输出大小为7×256×256的噪声图。S2.1, Diffusion Noise Adding Module: This module first adds random noise to the 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 and 1×256×256 grayscale image output by step 1 are concatenated with the pure noise image along the channel, and finally a noise image of size 7×256×256 is output.
S2.2、扩散去噪模块:该模块由多组二维卷积层、ReLU激活函数、归一化、线性层以及对比度校正模块构成。它将加噪模块输出的7×256×256噪声图作为输入,通过学习扩散加噪过程,并通过对比度校正模块抑制去噪过程中发生的偏色,从纯噪声中构建正常光图像的分布,最终输出3×256×256的正常光图像。S2.2, Diffusion denoising module: This module consists of multiple sets of two-dimensional convolutional layers, ReLU activation functions, normalization, linear layers, and contrast correction modules. It takes the 7×256×256 noise map output by the denoising module as input, learns the diffusion denoising process, and suppresses the color cast that occurs during the denoising process through the contrast correction module, constructs the distribution of the normal light image from the pure noise, and finally outputs a 3×256×256 normal light image.
条件扩散模型搭建过程如下:The process of building the conditional diffusion model is as follows:
分1000步将随机噪声添加到大小为3×256×256的正常光图像中至其变为纯噪声图,再将由步骤1输出的3×256×256的梯度特征图以及1×256×256的灰度图沿通道与纯噪声图拼接起来,形成大小为7×256×256的噪声图。将7×256×256的噪声图输入到扩散去噪模块中,最终得到3×256×256的正常光图像。扩散去噪模块首先会将7×256×256的噪声图过一个二维卷积层,输出为32×256×256的特征图。此特征图分别会经过五次上采样和五次下采样,第一个下采样层包含一个二维卷积层、ReLU激活函数和归一化,卷积核大小为3×3,输出通道为32,卷积步长为2。后面四个下采样层与第一个下采样层结构相似,但二维卷积输出通道依次为64、128、256、1024。经过四次下采样后,特征图大小变为1024×16×16。第一个上采样层包含一个二维卷积层、ReLU激活函数、归一化和上采样,卷积核大小为3×3,输出通道为256,卷积步长为1。后面四个上采样层与第一个上采样层结构相似,但二维卷积输出通道依次为128、64、32、3。经过五次上采样后,网络会生成大小为3×256×256的预测噪声图。将噪声图减去预测噪声的结果输入到对比度校正模块,最终输出大小为3×256×256的正常光图像。Random noise is added to the normal light image of size 3×256×256 in 1000 steps until it becomes a pure noise image. Then the gradient feature map of size 3×256×256 and the grayscale image of size 1×256×256 output by step 1 are concatenated with the pure noise image along the channel to form a noise image of size 7×256×256. The 7×256×256 noise image is input into the diffusion denoising module, and finally a normal light image of size 3×256×256 is obtained. The diffusion denoising module first passes the 7×256×256 noise image through a two-dimensional convolution layer and outputs a 32×256×256 feature map. This feature map is upsampled five times and downsampled five times respectively. The first downsampling layer contains a two-dimensional convolution layer, ReLU activation function and normalization. The convolution kernel size is 3×3, the output channel is 32, and the convolution step size is 2. The next four downsampling layers are similar in structure to the first downsampling layer, but the 2D convolution output channels are 64, 128, 256, and 1024, respectively. After four downsamplings, the feature map size becomes 1024×16×16. The first upsampling layer contains a 2D convolution layer, ReLU activation function, normalization, and upsampling. The convolution kernel size is 3×3, the output channel is 256, and the convolution step is 1. The next four upsampling layers are similar in structure to the first upsampling layer, but the 2D convolution output channels are 128, 64, 32, and 3, respectively. After five upsamplings, 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 finally the normal light image of size 3×256×256 is output.
步骤3、采用不少于500组弱光与正常光照的成对图像数据对弱光图像特征编码模型和条件扩散模型进行训练,并通过最小化损失函数项来优化模型参数,直至网络模型收敛,并保存神经网络训练后的参数,得到条件扩散弱光图像增强模型,最后利用测试集数据来评估模型的性能。Step 3: Use no less than 500 sets of paired image data of low-light and normal-light to train the low-light image feature encoding model and the conditional diffusion model, and optimize the model parameters by minimizing the loss function until the network model converges. Save the parameters of the trained neural network to obtain the conditional diffusion low-light image enhancement model, and finally use the test set data to evaluate the performance of the model.
步骤4、将弱光图像输入条件扩散弱光图像增强模型,条件扩散弱光图像增强模型输出增强后弱光图像。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.
实施例2Example 2
一种基于双分支注意力特征编码的条件扩散弱光图像增强系统,包括以下步骤:A conditional diffusion low-light image enhancement system based on dual-branch attention feature encoding, comprising the following steps:
特征编码模块,用于构建基于双分支注意力的弱光图像特征编码模型,包括并行连接的梯度恢复模块和亮度恢复模块,采用通道注意力机制和空间注意力机制,将弱光图像的特征转移到梯度恢复模块和亮度恢复模块,梯度恢复模块输出弱光图像的梯度图特征,亮度恢复模块输入弱光图像的光亮图特征;A feature encoding module is used to construct a feature encoding model for low-light images based on dual-branch attention, including a gradient recovery module and a brightness recovery module connected in parallel. The channel attention mechanism and the 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 inputs the brightness map features of the low-light image.
噪声模块,用于构建条件扩散模型,将梯度图特征、亮度图特征和原始弱光图像拼接后输入至条件扩散模型,在拼接图像中添加随机噪声将其变为纯噪声,从纯噪声中获取正常光图像;The noise module is used to build a conditional diffusion model, splice the gradient map features, the brightness map features and the original low-light image and input them into the conditional diffusion model, add random noise to the spliced image to turn it into pure noise, and obtain a normal light image from the pure noise;
增强模块,用于采用结构相似性损失和颜色一致性损失为约束条件,并通过最小化损失函数来优化模型参数,对弱光图像特征编码模型和条件扩散模型进行训练,直至网络模型收敛,得到条件扩散弱光图像增强模型,采用条件扩散弱光图像增强模型对弱光图像进行增强。The enhancement module is used to use structural similarity loss and color consistency loss as constraints, and optimize the model parameters by minimizing the loss function. The low-light image feature encoding model and the conditional diffusion model are trained until the network model converges to obtain the conditional diffusion low-light image enhancement model, and the conditional diffusion low-light image enhancement model is used to enhance the low-light image.
本发明公开一种基于特征编码的条件扩散弱光图像增强方法,该方法首先从弱光图像中提取出梯度图以及亮度图,然后从高斯噪声中逐步进行采样,并且通过对比度校正模块解决了扩散模型生成结果对比度不足的问题,最终得到高真实性的正常光图像。其特征在于,通过基于双分支注意力的弱光图像特征编码模型得到梯度图以及亮度图,作为先验信息指导扩散模型的训练。The present invention discloses a conditional diffusion low-light image enhancement method based on feature coding. The method first extracts a gradient map and a brightness map from a low-light image, then gradually samples from Gaussian noise, and solves the problem of insufficient contrast of the result generated by the diffusion model through a contrast correction module, and finally obtains a normal light image with high authenticity. The method is characterized in that the gradient map and the brightness map are obtained by a low-light image feature coding model based on dual-branch attention, and are used as prior information to guide the training of the diffusion model.
此外,设计了条件扩散模型,从纯噪声中构建所需的正常光图像,可以更好地处理弱光图像中的噪声问题,增强后的图像能很好地模拟自然图像分布,具有更丰富、更真实的细节信息。本发明还加入了对比度校正模块,该模块能抑制扩散去噪过程中发生的偏色,进一步提高生成图像的质量。In addition, a conditional diffusion model is designed to construct the required normal light image from pure noise, which can better deal with the noise problem in low light images. The enhanced image can well simulate the distribution of natural images and has richer and more realistic detail information. The present invention also adds a contrast correction module, which can suppress the color cast that occurs during the diffusion denoising process and further improve the quality of the generated image.
以上内容仅为说明本发明的技术思想,不能以此限定本发明的保护范围,凡是按照本发明提出的技术思想,在技术方案基础上所做的任何改动,均落入本发明权利要求书的保护范围之内。The above contents are only for explaining the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410830265.8A CN118735806A (en) | 2024-06-25 | 2024-06-25 | Conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410830265.8A CN118735806A (en) | 2024-06-25 | 2024-06-25 | Conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN118735806A true CN118735806A (en) | 2024-10-01 |
Family
ID=92854482
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410830265.8A Pending CN118735806A (en) | 2024-06-25 | 2024-06-25 | Conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118735806A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119205539A (en) * | 2024-10-08 | 2024-12-27 | 电子科技大学 | A low-light image enhancement method based on low-light feature prior |
| CN119296143A (en) * | 2024-12-09 | 2025-01-10 | 山东承势电子科技有限公司 | Fingerprint feature recognition and analysis method based on directional field guidance and spatial attention technology |
-
2024
- 2024-06-25 CN CN202410830265.8A patent/CN118735806A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119205539A (en) * | 2024-10-08 | 2024-12-27 | 电子科技大学 | A low-light image enhancement method based on low-light feature prior |
| CN119296143A (en) * | 2024-12-09 | 2025-01-10 | 山东承势电子科技有限公司 | Fingerprint feature recognition and analysis method based on directional field guidance and spatial attention technology |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP7493867B1 (en) | Low-light image enhancement method based on deep Retinex | |
| CN115170915B (en) | Infrared and visible light image fusion method based on end-to-end attention network | |
| CN112435191B (en) | A low-light image enhancement method based on the fusion of multiple neural network structures | |
| CN112184577B (en) | Single image defogging method based on multiscale self-attention generation countermeasure network | |
| CN118735806A (en) | Conditional diffusion low-light image enhancement method and system based on dual-branch attention feature encoding | |
| CN117408924A (en) | A low-light image enhancement method based on multiple semantic feature fusion networks | |
| CN113744146A (en) | Image defogging method based on contrast learning and knowledge distillation | |
| CN114549343A (en) | Defogging method based on dual-branch residual error feature fusion | |
| Kumar et al. | Underwater image enhancement using deep learning | |
| Peng et al. | Raune-Net: a residual and attention-driven underwater image enhancement method | |
| CN116912110A (en) | Low-light image enhancement algorithm based on Retinex-Net | |
| CN118918019A (en) | Infrared and visible light image fusion method based on illumination adaptation and attention guidance | |
| CN119048399B (en) | Image restoration method, system, device and medium integrating cross attention | |
| CN119399045A (en) | Infrared-guided low-light image enhancement method based on global and local multi-scale fusion | |
| CN118552442A (en) | Image defogging method based on mixed large-scale convolution and attention fusion | |
| CN115953311A (en) | Image defogging method based on multi-scale feature representation of Transformer | |
| CN118887114A (en) | Low-light image enhancement method based on cross-attention fusion | |
| CN116703750A (en) | Image defogging method and system based on edge attention and multi-order differential loss | |
| CN119648602A (en) | Single image shadow removal method and computer device based on global context perception | |
| Xu et al. | Underwater image enhancement method based on a cross attention mechanism | |
| CN118608399A (en) | A method, system, device and medium for fusion of infrared image and visible light image | |
| CN120807949A (en) | Power line image defogging method based on CNN-converter double-branch feature selective fusion | |
| CN120355638A (en) | Infrared image contrast enhancement method and system for maintaining airspace consistency | |
| CN119273643A (en) | Virtual viewpoint image quality assessment method based on residual recovery and multi-feature fusion | |
| CN118628366A (en) | Hyperspectral and multispectral image fusion method and system based on self-learning coupled diffusion posterior sampling |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |