Infrared and visible image fusion method combining overexposure prior and attention mechanism
By combining overexposure priors and attention mechanisms, an infrared and visible light image fusion method is developed, which solves the problems of unnaturalness and loss of detail caused by image overexposure in existing technologies, and achieves efficient image fusion results that are applicable to various scenarios.
Patent Information
- Application Number
- CN202410792596.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing technologies tend to produce unnatural images and artifacts when processing overexposed images, and it is difficult to fully recover lost details. In particular, when fusing multiple exposure images, multiple images are required as input, which limits their applicability.
An infrared and visible light image fusion method combining overexposure prior and attention mechanism is adopted. An overexposure prior module is constructed by an adaptive threshold algorithm, and a fusion network model with attention mechanism is introduced, including an overexposure prior module, an exposure reduction module, a dual-branch attention encoding module and a decoding fusion module, for image fusion processing.
It effectively restores lost details in images, avoids overexposed area edge contours, improves image fusion efficiency and visual quality, requires no multiple image inputs, and has wide applicability.
Smart Images

Figure CN118822863B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image fusion, and in particular to an infrared and visible light image fusion method, apparatus, and storage medium that combines overexposure prior and attention mechanism. Background Technology
[0002] With the continuous advancement of technology and the popularization of digital photography, people's demands for image quality are also increasing. How to apply image processing techniques to improve image quality has become an important research hotspot. In digital photography, various factors such as outdoor lighting and equipment often lead to excessive brightness in certain areas of the captured image, resulting in loss of detail and color distortion, thus affecting the overall visual effect of the image. Therefore, this has become a crucial step in post-processing. By applying overexposure techniques, as much detail and original color information in the image as possible can be preserved to ensure image quality.
[0003] In existing technologies, de-exposure algorithms based on digital image enhancement typically adjust the brightness of overexposed areas of an image from a grayscale perspective, thereby improving the overall contrast. However, these methods may lead to over-enhancement, making the image look unnatural or producing artifacts. Furthermore, for images with severe detail loss, these methods may not be able to fully recover the lost details. De-exposure algorithms based on multi-exposure image fusion typically merge multiple images with different exposures to obtain richer details, thus recovering the details lost in the overexposed image. Summary of the Invention
[0004] The purpose of this invention is to provide an infrared and visible light image fusion method and detection system and preparation system that combine overexposure prior and attention mechanism, so as to solve one or more technical problems existing in the prior art, and at least provide a beneficial option or create conditions.
[0005] To address the aforementioned problems, in some embodiments of the first aspect of the present invention, an infrared and visible light image fusion method combining overexposure prior and attention mechanism is provided, comprising:
[0006] Acquire a first image and a second image to be fused, wherein the first image is an infrared image and the second image is an overexposed visible light image;
[0007] An overexposure prior module is constructed using an adaptive threshold algorithm. The attention mechanism and the overexposure prior module are then introduced into the fusion network model to obtain an overexposure image fusion model.
[0008] The first image and the second image are fused using the overexposed image fusion model to obtain a fused image.
[0009] Furthermore, the overexposed image fusion model includes an overexposed prior module, an exposure reduction module, a dual-branch attention encoding module, and a decoding fusion module;
[0010] The overexposure prior module is used to determine the overexposure area in the second image using an adaptive threshold algorithm, and to process the overexposure area using a Gaussian kernel function to obtain an exposure weight map.
[0011] The exposure reduction module is used to stitch and fuse the third image obtained by multiplying the exposure weight map with the first image and the second image with the fourth image obtained by multiplying the normalized exposure weight map to obtain the input feature map.
[0012] The dual-branch attention encoding module is used to extract a first feature map, a second feature map in the channel dimension, and a third feature map in the spatial dimension based on the input feature map, and then superimpose the first feature map, the second feature map, and the third feature map to obtain a fourth feature map.
[0013] The decoding and fusion module is used to perform feature reconstruction and dimensionality reduction based on the fourth feature map to obtain the fused image.
[0014] Furthermore, the process of obtaining the exposure weight map specifically includes:
[0015] The second image is converted from the RGB color model to the HSV color model, and the pixels in the V channel are initially exposed to determine the overexposed pixels in the V channel.
[0016] After the V channel pixels have completed the exposure determination, the color-related saturation threshold is calculated. Based on the color-related saturation threshold, the S channel pixels are then subjected to exposure determination to identify overexposed pixels in the S channel.
[0017] Based on the second image, a first mask image is set. Based on the overexposed pixels of the V channel and S channel, the pixels of the corresponding mask area on the first mask image are set to 255 to obtain a second mask image containing the overexposed area.
[0018] Based on the boundary of the overexposed region, a boundary circle is fitted, and a Gaussian kernel function is used to assign values to the boundary circle and superimpose it onto the overexposed region to obtain the exposure weight map.
[0019] Furthermore, the process of obtaining the input feature map specifically includes:
[0020] The first image is multiplied by the exposure weight map to obtain the third image;
[0021] Based on the second image, a third mask image is set, the third mask image is subtracted from the exposure weight image to obtain a normalized exposure weight image, and the normalized exposure weight image is multiplied by the second image to obtain a fourth image.
[0022] The third and fourth images are stitched together to form a dual-channel image, which is then fused to obtain the input feature map.
[0023] Furthermore, the process of obtaining the first feature map specifically includes:
[0024] The dual-channel input feature map is converted into a sixteen-channel map and non-linearly activated using the LRelu function to extract shallow feature information, thus obtaining the first feature map.
[0025] The first feature map includes a visible light feature map and an infrared light feature map, and the dual-branch attention coding module includes a channel attention module and a spatial attention module.
[0026] Furthermore, the process of obtaining the second feature map specifically includes:
[0027] Based on the first feature map, texture features are extracted from the visible light feature map, and significant target distribution features are extracted from the infrared light feature map;
[0028] The shallow feature information, texture features, and salient target distribution features are input into the channel attention module, and the channel attention module outputs a channel attention weight map;
[0029] The second feature map is obtained by multiplying the channel attention weight map with the shallow feature information, texture features, and salient target distribution features.
[0030] Furthermore, the process of obtaining the third feature map specifically includes:
[0031] Based on the first feature map, texture features are extracted from the visible light feature map, and significant target distribution features are extracted from the infrared light feature map;
[0032] The shallow feature information, texture features, and salient target distribution features are input into the spatial attention module, and the spatial attention module outputs a spatial attention weight map;
[0033] The spatial attention weight map is multiplied by the shallow feature information, texture features, and salient target distribution features to obtain the third feature map.
[0034] Furthermore, the decoding fusion module includes a window multi-head attention mechanism module and a multilayer perceptron module, and the process of feature reconstruction and dimensionality reduction based on the fourth feature map specifically includes:
[0035] The fourth feature map is subjected to layer normalization to obtain the fifth feature map. The fifth feature map is then input into the window multi-head attention mechanism module, which outputs the sixth feature map.
[0036] The sixth feature map and the fourth feature map are added together to form a residual connection. The seventh feature map output by the residual is then subjected to layer normalization and nonlinear processing by the multilayer perceptron module to obtain the eighth feature map.
[0037] The eighth feature map is residually connected to the seventh feature map, and the ninth feature map is output from the residual. The ninth feature map is then dimensionality-reduced and activated by the Tanh function to output the fused image.
[0038] In some embodiments of a second aspect of the present invention, an electronic device includes:
[0039] Memory, which stores computer programs;
[0040] A processor, which, when executing the computer program, implements the infrared and visible light image fusion method combining overexposure prior and attention mechanisms, which is a first aspect of the present invention.
[0041] In some embodiments of the third aspect of the invention, a storage medium storing a computer program is provided, characterized in that, when the computer program is executed by a processor, it implements the infrared and visible light image fusion method combining overexposure prior and attention mechanism of the first aspect of the invention.
[0042] The beneficial effects of this invention are as follows: By combining an overexposure prior module constructed through an adaptive threshold algorithm with an attention mechanism, an overexposure image fusion model is obtained. This model is used to fuse visible light images and infrared light images containing overexposure areas to obtain a low-exposure fused image. This reduces the proportion of overexposure areas in the reweighted image to be fused, thereby reducing the exposure and avoiding obvious contour lines at the edges of overexposure areas in the fused image. At the same time, it can enhance the image's global-to-local correlation and the model's deep feature extraction capability during the feature extraction stage. In the feature fusion and reconstruction stage, it can construct long-distance relationships between features, better preserving global complementary information. Through the combination of these two methods, the lost details of the image are restored to the greatest extent. Compared with the prior art, the image fusion method of this invention requires less input image data, has a simple algorithm, and is widely applicable. It can effectively improve the de-exposure efficiency in image fusion and improve the visual quality and perceptual effect of the fused image. Attached Figure Description
[0043] Figure 1 This is a schematic flowchart illustrating an infrared and visible light image fusion method that combines overexposure prior and attention mechanism according to an embodiment of the present invention.
[0044] Figure 2 This is a schematic diagram of the overall architecture of an overexposed image fusion model according to an embodiment of the present invention.
[0045] Figure 3This is a partial network structure diagram of a dual-branch attention coding module according to an embodiment of the present invention.
[0046] Figure 4 This is a partial network structure diagram of a decoding and fusion module according to an embodiment of the present invention.
[0047] Figure 5 This is a comparison chart of the VIF curves of different image fusion network models in one embodiment of the present invention and the overexposed image fusion model of the present invention.
[0048] Figure 6 This is a comparison chart of the MI curves of different image fusion network models in one embodiment of the present invention and the overexposed image fusion model of the present invention.
[0049] Figure 7 This is a comparison chart of the EN curves of different image fusion network models in one embodiment of the present invention and the overexposed image fusion model of the present invention.
[0050] Figure 8 This is a comparison diagram of the fused image results of different image fusion network models according to an embodiment of the present invention and the overexposed image fusion model of the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the present invention will be further described below in conjunction with the embodiments and accompanying drawings.
[0052] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0053] In existing technologies, overexposure correction algorithms based on digital image enhancement adjust the brightness of overexposed areas by grayscale conversion, thereby improving the overall image contrast. However, this method can lead to over-enhancement, making the image look unnatural or producing artifacts. Furthermore, for images with significant detail loss, it cannot fully recover the lost details.
[0054] Furthermore, overexposure removal algorithms based on multi-exposure image fusion recover lost details in overexposed images by merging multiple images with different exposures to obtain richer details. This method requires multiple images with different exposures as input, which may be difficult to obtain in actual shooting, and may not be suitable for shooting moving objects or handheld shooting. In addition, the merging process may introduce artifacts or image alignment issues, requiring fine-tuning and processing.
[0055] In an embodiment of the first aspect of the present invention, reference is made to... Figure 1 An infrared and visible light image fusion method combining overexposure prior and attention mechanism includes the following steps:
[0056] S100: Acquire the first image and the second image to be fused. The first image is an infrared image, and the second image is an overexposed visible light image.
[0057] In this embodiment, an infrared light image to be fused is obtained from the data to be fused, which is used as the first image; and a visible light image containing overexposed areas, i.e., an overexposed visible light image, is obtained, which is used as the second image.
[0058] S200 utilizes an adaptive thresholding algorithm to construct an overexposure prior module. By introducing the attention mechanism and the overexposure prior module into the fusion network model, an overexposure image fusion model is obtained.
[0059] In this embodiment, since different exposure levels in the overexposed area will affect the balance between visible light information and infrared light information in the fused image, an overexposure prior module is established through an adaptive threshold algorithm. The overexposure prior module can adaptively output an exposure weight map for the exposure level to limit the ratio of visible light information to infrared light information.
[0060] In this embodiment, the fusion network model is an end-to-end fusion network built using the Transformer architecture. The Transformer architecture is a deep learning model based on an attention mechanism, consisting of an encoder and a decoder.
[0061] By combining the pre-constructed overexposure prior module and attention mechanism into the fusion network model, an overexposure image fusion model is constructed.
[0062] S300 uses an overexposed image fusion model to fuse the first and second images to obtain a fused image.
[0063] In this embodiment, the first image and the second image are fused using a pre-constructed overexposed image fusion model to obtain a fused image.
[0064] Through the above embodiments, an overexposure prior module constructed using an adaptive threshold algorithm and an attention mechanism are combined to obtain an overexposure image fusion model. This model is used to fuse visible light and infrared light images containing overexposure areas to obtain a low-exposure fused image. This achieves a reduction in the proportion of overexposure areas in the reweighted images to be fused, thus weakening the exposure and avoiding obvious contour lines at the edges of overexposure areas in the fused image. Simultaneously, it enhances the global-to-local correlation of the image and the model's deep feature extraction capabilities during the feature extraction stage. Furthermore, during the feature fusion and reconstruction stages, it can construct long-distance relationships between features, better preserving global complementary information.
[0065] Compared with existing technologies, by combining the two, the lost details of the image can be restored to the greatest extent. Moreover, the image fusion method of the present invention requires a small number of input images, does not require fine adjustment and processing, has a wide range of applications, and can effectively improve the de-exposure efficiency in image fusion and improve the visual quality and perception effect of the fused image.
[0066] Reference Figure 2 In an embodiment of the first aspect of the present invention, the constructed overexposed image fusion model includes: an overexposed prior module, an exposure reduction module, a decoding fusion module, and a dual-branch attention coding module.
[0067] In the overexposure prior module, an adaptive threshold algorithm is used to process the second image to determine the overexposed areas in the overexposed visible light image. The overexposed areas are then processed using a Gaussian kernel function to obtain an exposure weight map.
[0068] In this embodiment, an exposure weight map is introduced because different exposure levels in overexposed areas affect the balance between visible and infrared information in the fused image. Therefore, it is necessary to introduce an adaptive exposure weight map that limits the ratio of infrared to visible information, thereby reducing the exposure. Furthermore, the adaptive exposure weight map gradually decays along the edges of overexposed areas, preventing obvious contour lines from appearing in the fused image at these edges. Additionally, the overexposure prior module can guide the network to retain meaningful information in overexposed areas.
[0069] In the exposure reduction module, the first image and the exposure weight map are multiplied to obtain the enhanced infrared light image, i.e., the third image. The second image and the normalized exposure weight map are multiplied to obtain the visible light image with softened exposure area, i.e., the fourth image. The third image and the fourth image are stitched together to obtain the input feature map.
[0070] In this embodiment, the main purpose of multiplying exposure weight maps of different ranges with the visible light image and the infrared light image respectively is to adaptively adjust the exposure levels of different regions in the fused image. This allows for differentiated processing between overexposed and non-overexposed areas of the original image to be fused, ensuring that the fused image maintains overall balance and naturalness. By multiplying the exposure weight maps with the visible light image and the infrared light image respectively, the exposure levels of different regions can be weighted during the fusion process, thereby better reducing the exposure levels of the fused image.
[0071] In the dual-branch attention encoding module, feature extraction is performed on the input feature map to obtain a first feature map, a second feature map, and a third feature map. Specifically, the second feature map is obtained by enhancing the extraction of useful features in the channel dimension, and the third feature map is obtained by enhancing the extraction of useful features in the spatial dimension. The first, second, and third feature maps are then superimposed, and residual connections are constructed between the three feature maps to obtain a fourth feature map, thereby fully extracting the complementary information lost during the convolution operation.
[0072] In this embodiment, traditional convolutional neural networks (CNNs) have limited effectiveness in processing multi-scale information and struggle to capture the relationship between global and local data, potentially posing challenges for the extraction and fusion of different targets in an image. By introducing an attention mechanism to extract features along both spatial and channel dimensions, the overexposed image fusion model can focus on important information at different spatial locations within the image and concentrate more attention on beneficial channels in the exposure reduction and image fusion process, thereby improving the overall visual effect of the fused image.
[0073] In the decoding and fusion module, the fourth feature map is reduced in dimensionality by the decoder feature reconstruction to obtain the final low-exposure fused image.
[0074] In this embodiment, by introducing an attention mechanism, the overexposed image fusion model is improved to capture a variety of image features, enabling the model to learn richer visible light detail texture information and infrared light salient target information, thereby improving the information retention of the fusion result.
[0075] Through the above embodiments, the problems of overexposed areas, loss of object features, edges, and contour information, and unnatural fusion in existing fused images are addressed. By processing the image to be fused through the network module in the model, the exposure of the fused image can be adaptively reduced, preserving the lost details of the image to be fused to the greatest extent possible. This ensures that the fused image remains balanced and natural overall, effectively improving the de-exposure efficiency in image fusion and the visual quality and perceptual effect of the fused image.
[0076] Referring to Figure 2 , in the embodiment of the first aspect of the present invention, in the overexposure prior module, the process of obtaining the exposure weight map specifically includes:
[0077] S310: Acquire a second image, convert the second image from an RGB color model to an HSV color model, and perform preliminary exposure determination on pixels of the V channel to obtain overexposed pixels on the V channel.
[0078] In this embodiment, an adaptive threshold algorithm is used to detect the overexposed area of the second image (I VIS ). First acquire a visible light image to be fused, that is, the second image (I VIs ). Convert the color model of the second image (I VIS ).
[0079] In the HSV color model, the V channel is represented as a luminance channel, with a corresponding mapping range of 0 to 255. Therefore, perform exposure determination on the pixel V of the V channel p . When the pixel V p >180, it is considered that the pixel V of the V channel is preliminarily determined p to be an exposed pixel, i.e., an overexposed pixel, completing the preliminary exposure determination, and proceed to the next step.
[0080] S311: After completing the preliminary exposure determination for the V channel, calculate a color-dependent saturation threshold, and further determine pixels of the S channel using the color-dependent saturation threshold to obtain overexposed pixels on the S channel.
[0081] In this embodiment, when V p >180, it is considered that the preliminary exposure determination is completed, and further determination is performed on pixels of the S channel, to calculate a color-dependent saturation threshold STH, with the specific formula as follows:
[0082] STH=F v (v)*F h (h)
[0083]
[0084] where v and h are the V channel and H channel in the HSV color model, respectively, F v (v) is a scaling factor adjusted according to the value of v, and F h (h) is used to control the value of STH according to the variation trend of saturation sensitivity in the HSV color model.
[0085] For the pixel S of the S channel p , when S p <STH, the pixel S p is considered to be an overexposed pixel, i.e., an overexposed pixel; when S pIf S ≥ STH, then pixel S is considered to be... p To properly expose pixels, and to achieve the desired exposure using the color-dependent saturation threshold STH, the pixels S on the S channel are... p Exposure determination is performed.
[0086] S312, using the second image, generate a first mask image, and using the overexposed pixels on the V and S channels, set the pixels of the corresponding mask area on the first mask image to 255 to obtain a second mask image, which contains overexposed areas.
[0087] In this embodiment, an image with all pixels being 1 and a size similar to the second image (I) is generated. VIS A mask image consistent with the first mask image is obtained by setting the pixels of the corresponding coordinate mask region to 255 according to the overexposed pixels detected in S310 and S311, resulting in a second mask image. The second mask image contains overexposed regions that can be matched with the second image (I). VIS The overexposed area corresponds to the area of exposure.
[0088] S313, for the boundary of the overexposed area on the second mask image, fit a boundary circle, use a Gaussian kernel function to assign a value to the boundary circle, and superimpose the result value onto the overexposed area to obtain an exposure weight map.
[0089] In this embodiment, for the exposed area obtained in S312, a circle is fitted to depict the boundary of the detected overexposed area, resulting in a boundary circle. A Gaussian kernel function is used to assign a value to the fitted boundary circle, and the result of the assigned boundary circle is superimposed on the overexposed area on the second mask image to obtain an exposure weight map (OP).
[0090] In the above embodiment, an adaptive thresholding algorithm is used to calculate the color-related saturation threshold STH, and this threshold is used to determine overexposed pixels and appropriately exposed pixels in the S-channel. After pixel determination, a boundary circle is fitted, and a Gaussian kernel function is used to generate an exposure weight map to limit the ratio of visible light information to infrared light information in the fused image, thereby reducing the exposure. The adaptive exposure weight map can gradually decay along the edge of the overexposed area, avoiding obvious contour lines at the edge of the overexposed area in the fused image, and guiding the network to retain meaningful information in the overexposed area.
[0091] Reference Figure 2 In an embodiment of the first aspect of the present invention, the process of obtaining the input feature map in the exposure reduction module specifically includes:
[0092] S320: Acquire the first image, perform a dot product operation between the first image and the exposure weight map to obtain the third image;
[0093] S321, Based on the second image, generate a third mask image, subtract the mask image from the exposure weight map to obtain a normalized exposure weight map, and perform a dot product operation between the normalized exposure weight map and the second image to obtain a fourth image.
[0094] S322: The third and fourth images are stitched together to form a dual-channel image, which is then fused to obtain the input feature map.
[0095] In this embodiment, refer to Figure 2 , the first image (I IR The enhanced infrared image is obtained by multiplying the image with the exposure weight image (OP) to obtain the third image.
[0096] Generate a third mask image with 2 pixels and the same size as the second image. Subtract the exposure weight map from the third mask image to normalize the exposure weight map.
[0097] The normalized exposure weight map (Normalized OP) and the second image (I) VIs Perform a dot product operation to obtain the softened visible light image of the exposed area, which is the fourth image.
[0098] The softened visible light image and the enhanced infrared image of the exposed area are stitched together to form a dual-channel image. The two multiplied images are then fused to obtain the input feature map. As input to the decoding and fusion module.
[0099] In this embodiment, by multiplying the exposure weight map with the visible light image and the infrared light image respectively, the exposure levels of different regions can be weighted during the fusion process, and the proportion of overexposed areas in the image to be fused can be reweighted, thereby better reducing the exposure of the fused image.
[0100] Reference Figure 2 and Figure 3 In an embodiment of the first aspect of the present invention, the process of obtaining the first feature map, the second feature map, and the third feature map in the dual-branch attention encoding module specifically includes:
[0101] S330 converts the dual-channel input feature map into a sixteen-channel map, performs non-linear activation using the LReLu function, extracts shallow feature information, and obtains the first feature map.
[0102] In this embodiment, reference is made to Figure 3 The dual-branch attention encoding module includes: a first convolutional layer, a second convolutional layer, an LReLu function activation layer, a third convolutional layer, a channel attention module, and a spatial attention module.
[0103] The first convolutional layer converts the two channels into sixteen channels, followed by non-linear activation using the LReLu function, thereby extracting shallow feature information and obtaining the first feature map F. (DAB,in) .
[0104] The first feature map includes: visible light feature map and infrared light feature map.
[0105] S331, Based on the first feature map, texture features and salient target distribution features are extracted from the visible light feature map and the infrared light feature map, respectively.
[0106] In this embodiment, reference is made to Figure 3 First feature map F (DAB,in) After sequential processing through the second convolutional layer, the LReLu function activation layer, and the third convolutional layer, texture features are extracted from the visible light feature map, and significant target distribution features are obtained from the infrared light feature map.
[0107] S332, input shallow features, texture features and salient target distribution features into the channel attention module to obtain the channel attention weight map.
[0108] In this embodiment, the features extracted in S330 and S331 are input to the channel attention module.
[0109] In the Channel Attention module, shallow features, texture features, and salient object distribution features are averaged and then compressed. The compressed features are then fed into a fully connected layer to reduce the feature dimension by a factor of four. After non-linear activation and full connection, the original feature dimension is restored to better fit the channel complexity and reduce the amount of computation and parameters. Finally, after normalization, the channel attention weight map is obtained.
[0110] S333, the obtained channel attention weight map is multiplied by the input shallow features, texture features and salient target distribution features to obtain the second feature map.
[0111] In this embodiment, after normalization, the resulting channel attention weight map is multiplied with the features input to the channel attention module to enhance the useful features in the channel dimension, thus obtaining a second feature map.
[0112] S334, Based on the first feature map, texture features and salient target distribution features are extracted from the visible light feature map and the infrared light feature map, respectively.
[0113] In this embodiment, the processing steps for the first feature map in S334 and S331 are the same, and will not be described again in this embodiment.
[0114] S335 inputs shallow features, texture features, and salient target distribution features into the spatial attention module to obtain the spatial attention weight map.
[0115] In this embodiment, the features extracted by S330 and S334 are input to the channel attention module.
[0116] In the Spatial Attention module, shallow features, texture features, and salient object distribution features are first passed through a convolutional layer, compressing these features by a factor of four. Then, they undergo a non-linear activation and another convolutional layer to further compress the features to one dimension. Finally, after normalization, the spatial attention weight map is obtained.
[0117] S335, the obtained spatial attention weight map is multiplied by the input shallow features, texture features and salient target distribution features to obtain the third feature map.
[0118] In this embodiment, after normalization, the resulting spatial attention weight map is multiplied with the features input to the spatial attention module to enhance the useful features in the spatial dimension, resulting in a third feature map.
[0119] It should be noted that by introducing channel attention and spatial attention mechanisms in the feature extraction part, feature maps enhanced by channel attention and spatial attention are obtained respectively. The first feature map, the second feature map, and the third feature map are superimposed, and residual connections are constructed between the three feature maps to output the fourth feature map, so as to fully extract the complementary information lost in the convolution operation.
[0120] Reference Figure 2 and Figure 4 In an embodiment of the first aspect of the present invention, the feature reconstruction and dimensionality reduction process in the decoding and fusion module specifically includes:
[0121] The decoding and fusion module includes: two layerNorm layers, a window-multi-head-attention mechanism module, and a multilayer perceptron module (MLP).
[0122] S340 performs layer normalization on the fourth feature map to obtain the fifth feature map, and then inputs it into the window multi-head attention mechanism module to output the sixth feature map.
[0123] In this embodiment, the fourth feature map with a dimension of sixteen is normalized by the first layer Norm layer to obtain the fifth feature map, which is then input to the window-multi-head-attention mechanism module.
[0124] In the window multi-head attention mechanism module, the fifth feature map is obtained, and the fifth feature map is divided into non-overlapping M×M windows to generate HW / M. 2 A window feature map of shape [M, M, C], where H and W are the dimensions of the fifth feature map, C is the number of channels, and M is the size of the dividing window.
[0125] The feature map in each partition window is flattened into a one-dimensional vector [M, M, C]. Using the corresponding q, k, v projection matrices, the flattened feature map in each partition window is linearly mapped to obtain the corresponding Q, K, V values. The Q, K, V values are then decomposed into eight attention heads, each with a dimension of two.
[0126] By using the self-attention mechanism calculation formula, each partitioned window is processed to obtain the output of each attention head.
[0127] The formula for the self-attention mechanism is:
[0128]
[0129] Where d represents the dimension, Q*K T value divided by To prevent Q*K T If the value is too large, it will cause the softmax result to overflow. That is, the corresponding Q matrix and K matrix in each channel are multiplied by a dot product, and then normalized by softmax to obtain the attention weight matrix. The attention weight matrix is then multiplied by the V value to obtain the output of each attention head, thereby reducing the amount of computation and maintaining local dependencies.
[0130] The outputs of the eight attention heads are concatenated into a window feature map of [M, M, C]. A linear mapping is then used to restore the original shape and dimensions of each partitioned window of [M, M, C]. The partitioned feature maps are then recombined into the original shape [H, W, C] to obtain the sixth feature map.
[0131] S341, the sixth feature map and the fourth feature map are added to form a residual connection, and the output seventh feature map is subjected to layer normalization operation and then input to the multilayer perceptron module for nonlinear processing. The multilayer perceptron module outputs the eighth feature map.
[0132] In this embodiment, the fourth feature map input to the decoding and fusion module is added to the sixth feature map obtained by processing S340 to form a residual connection, and the seventh feature map is output.
[0133] The seventh feature map is normalized by the second layer Norm layer, and then input into the multilayer perceptron (MLP) module for nonlinear processing, outputting the eighth feature map.
[0134] S342 performs a residual connection between the eighth feature map and the seventh feature map to output the ninth feature map. The ninth feature map is then subjected to dimensionality reduction and activated by the Tanh function to output a single-channel fused image.
[0135] In this embodiment, the eighth feature map is residually concatenated with the seventh feature map of the residual output of the previous layer. Finally, the ninth feature map of the sixteen channels of the residual output is dimensionality reduced by a 1x1 convolutional layer and activated by the Tanh function to obtain a single-channel fused image.
[0136] In this embodiment, a multi-head attention mechanism is introduced into the decoding module. The overexposed image fusion model can simultaneously focus on different subspaces of the input features, improving the model's ability to capture multiple image features. By computing multiple attention heads in parallel, the model can learn richer details and textures in visible light and significant target information in infrared light, improving the information retention of the fusion result. Furthermore, the introduction of residual connections and layer normalization can alleviate the vanishing and exploding gradient problems, making the model more stable during training.
[0137] In an embodiment of the first aspect of the present invention, the fusion method further includes:
[0138] Based on the RoadScene dataset, M 3 The FD and CVC-14 datasets are used to divide the training sample images into a first image block of 120x120 with a step size of 10. The first image block is preprocessed by a discrimination algorithm to retain a second image block with an overexposed area to non-overexposed area ratio of 1:5. The training dataset is constructed from the second image block.
[0139] In this embodiment, the problem of unnatural image fusion in existing Transformer-based infrared and visible light image fusion algorithms is addressed.
[0140] Based on the RoadScene dataset, M 3 The FD and CVC-14 datasets are used to segment the training sample images. Since the first image patch is mostly low signal-to-noise ratio and low contrast, and contains redundant background information, the first image patch is often segmented.
[0141] A discriminant algorithm is used to filter and preprocess the images, retaining a second image patch with an overexposed area to non-overexposed area ratio of 1:5. This yields 26,478 patch pairs used to learn the parameters of the overexposed image fusion model. This makes the training dataset closer to real-world exposure scenarios, allowing the constructed overexposed image fusion model to focus more on learning how to address image exposure imbalances.
[0142] The RoadScene dataset typically refers to a set of data used for research in computer vision and autonomous driving technologies. It contains images, videos, or other forms of information about road and traffic scenes. 3 The FD dataset is a multi-scene, multi-modal dataset, while the CVC-14 dataset is a multispectral pedestrian dataset.
[0143] The discrimination algorithm can be a feature matching technique, an ORB algorithm, or a scale-invariant feature transform (SIFT) algorithm to preprocess the first image patch.
[0144] Reference Figure 5 The curves in the figure represent the VIF values of each fused image in different network models. The VIF evaluation index is calculated based on the spatial and frequency domain correlation between the original image and the fusion result. The higher the VIF, the better the visual fidelity and quality of the fused image.
[0145] Reference Figure 6 The curves in the figure represent the MI values of each fused image in different network models. The evaluation metric MI is used to assess the similarity between the original image and the fused image. The higher the MI, the more detailed information the fused image retains.
[0146] Reference Figure 7 The curves in the figure represent the EN values of each fused image in different network models. The evaluation index EN is used to measure the information content and diversity of the fused image. The higher the EN, the richer the information content of the fused image and the better the fusion effect.
[0147] Reference Figure 8 The visible light and infrared images to be fused are fed into different image fusion network models to obtain fused images output by different image fusion network models. Among them, comparison network 1 and comparison network 2 are both image fusion methods based on autoencoders; comparison network 3 is an image fusion method based on GAN; comparison network 4 and comparison network 5 are both image fusion methods based on CNN.
[0148] from Figure 8It can be seen that the fused images from other comparison networks all exhibit significant overexposure due to the influence of the exposed areas. The structure of the network model obtained in this invention shows that by utilizing an overexposure prior, the impact of exposure is mitigated, and the infrared image features in the overexposure areas are enhanced. This further demonstrates that the proposed overexposure prior module can guide the network to retain meaningful information in overexposure areas. In terms of detail preservation, the network of this invention effectively preserves the outlines of cars and streetlights in the infrared images, while other comparison networks exhibit blurred details and incomplete preservation. This fully demonstrates that after introducing the attention mechanism, the network of this invention can help the model process detail and texture information more accurately, effectively reducing information loss during the fusion process.
[0149] According to an embodiment of a second aspect of the present invention, a computer device is provided.
[0150] The computer device includes a processor, memory, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. When the computer program is executed by the processor, it implements the infrared and visible light image fusion method combining overexposure priors and attention mechanisms, as described in the first aspect.
[0151] The components of the memory and processor are electrically connected directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The processor includes at least one software functional module, which can be stored in memory or embedded in the server's operating system (OS) in the form of software or firmware. The processor is used to execute the executable module stored in memory.
[0152] The memory can be Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store programs and voice data; the processor executes the program after receiving the execution instruction.
[0153] The processor may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application-Specific Integrated Circuit (ASIC), an On-Premises Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor.
[0154] The processor couples various input / output devices to itself and memory. In some embodiments, the processor and memory can be implemented on a single chip. In other instances, they can be implemented on separate chips.
[0155] Peripheral interfaces couple various input / output devices to the processor and memory. In some embodiments, the peripheral interface, processor, and memory can be implemented on a single chip. In other instances, they can be implemented on separate chips.
[0156] According to an embodiment of the third aspect of the present invention, a computer storage medium is also provided, wherein a computer program is stored in the computer storage medium. The computer storage medium may be a magnetic random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a flash memory, a magnetic surface memory, an optical disc, or a read-only optical disc, etc.; it may also be various devices including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc. When the computer program is executed by a processor, it implements the infrared and visible light image fusion method of the first aspect, which combines overexposure prior and attention mechanisms.
[0157] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0158] In this document, the terms “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, which includes not only the elements listed but also other elements not expressly listed.
[0159] The preferred embodiments of the present invention have been described in detail above, but the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for fusing infrared and visible light images by combining overexposure prior and attention mechanisms, characterized in that, include: Acquire a first image and a second image to be fused, wherein the first image is an infrared image and the second image is an overexposed visible light image; An overexposure prior module is constructed using an adaptive threshold algorithm. The attention mechanism and the overexposure prior module are then introduced into the fusion network model to obtain an overexposure image fusion model. The first image and the second image are fused using the overexposed image fusion model to obtain a fused image. The overexposed image fusion model includes an overexposed prior module, an exposure reduction module, a dual-branch attention encoding module, and a decoding fusion module. The overexposure prior module is used to determine the overexposure area in the second image using an adaptive threshold algorithm, and to process the overexposure area using a Gaussian kernel function to obtain an exposure weight map. The exposure reduction module is used to stitch and fuse the third image obtained by multiplying the exposure weight map with the first image and the second image with the fourth image obtained by multiplying the normalized exposure weight map to obtain the input feature map. The dual-branch attention encoding module is used to extract a first feature map, a second feature map in the channel dimension, and a third feature map in the spatial dimension based on the input feature map, and then superimpose the first feature map, the second feature map, and the third feature map to obtain a fourth feature map. The decoding and fusion module is used to perform feature reconstruction and dimensionality reduction based on the fourth feature map to obtain the fused image; The process of obtaining the exposure weight map specifically includes: The second image from Color model converted to Color model, for The pixels in the channel are used for preliminary exposure determination to determine the exposure level. Overexposed pixels on the channel; when After the pixels of the channel have completed the exposure determination, the color-related saturation threshold is calculated, and then the color-related saturation threshold is used to determine the appropriate settings. Exposure is determined by the pixels of the channel to identify the location. Overexposed pixels on the channel; Based on the second image, set the first mask image, and based on... Channels and For the overexposed pixels in the channel, set the corresponding pixel value in the mask area of the first mask image to 255 to obtain a second mask image containing the overexposed area; Based on the boundary of the overexposed area, a boundary circle is fitted, and a Gaussian kernel function is used to assign values to the boundary circle and superimpose it onto the overexposed area to obtain the exposure weight map. The process of obtaining the input feature map specifically includes: The first image is multiplied by the exposure weight map to obtain the third image; Based on the second image, a third mask image is set, the third mask image is subtracted from the exposure weight image to obtain a normalized exposure weight image, and the normalized exposure weight image is multiplied by the second image to obtain a fourth image. The third and fourth images are stitched together to form a dual-channel image, which is then fused to obtain the input feature map.
2. The infrared and visible light image fusion method combining overexposure prior and attention mechanism according to claim 1, characterized in that, The process of obtaining the first feature map specifically includes: The dual-channel input feature map is converted to a sixteen-channel map, and then... The function is nonlinearly activated to extract shallow feature information and obtain the first feature map; The first feature map includes a visible light feature map and an infrared light feature map, and the dual-branch attention coding module includes a channel attention module and a spatial attention module.
3. The infrared and visible light image fusion method combining overexposure prior and attention mechanism according to claim 2, characterized in that, The process of obtaining the second feature map specifically includes: Based on the first feature map, texture features are extracted from the visible light feature map, and significant target distribution features are extracted from the infrared light feature map; The shallow feature information, texture features, and salient target distribution features are input into the channel attention module, and the channel attention module outputs a channel attention weight map; The second feature map is obtained by multiplying the channel attention weight map with the shallow feature information, texture features, and salient target distribution features.
4. The infrared and visible light image fusion method combining overexposure prior and attention mechanism according to claim 2, characterized in that, The process of obtaining the third feature map specifically includes: Based on the first feature map, texture features are extracted from the visible light feature map, and significant target distribution features are extracted from the infrared light feature map; The shallow feature information, texture features, and salient target distribution features are input into the spatial attention module, and the spatial attention module outputs a spatial attention weight map; The spatial attention weight map is multiplied by the shallow feature information, texture features, and salient target distribution features to obtain the third feature map.
5. The infrared and visible light image fusion method combining overexposure prior and attention mechanism according to claim 1, characterized in that, The decoding and fusion module includes a window multi-head attention mechanism module and a multilayer perceptron module. The process of feature reconstruction and dimensionality reduction based on the fourth feature map specifically includes: The fourth feature map is subjected to layer normalization to obtain the fifth feature map. The fifth feature map is then input into the window multi-head attention mechanism module, which outputs the sixth feature map. The sixth feature map and the fourth feature map are added together to form a residual connection. The seventh feature map output by the residual is then subjected to layer normalization and nonlinear processing by the multilayer perceptron module to obtain the eighth feature map. The eighth feature map is residually concatenated with the seventh feature map, and the residual output is the ninth feature map. The ninth feature map is then dimensionality-reduced and... The function is activated, and the fused image is output.
6. A computer device, characterized in that, include: Memory, which stores computer programs; A processor, which, when executing the computer program, implements the infrared and visible light image fusion method as described in any one of claims 1 to 5, which combines overexposure priors and attention mechanisms.
7. A storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the infrared and visible light image fusion method combining overexposure prior and attention mechanism as described in any one of claims 1 to 5.
