An image dehazing method based on image enhancement and multi-scale gating networks
By combining image enhancement and multi-scale gating networks, the problems of poor adaptability and inaccurate color restoration in real foggy scenes of existing image dehazing methods are solved, and significant improvements in image clarity and true color are achieved.
Patent Information
- Application Number
- CN202511344294.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-03-10
- Estimated Expiration
- 2045-09-19
AI Technical Summary
Existing image dehazing methods have poor model adaptability in real foggy scenes, and the processed images are prone to color casts and artifacts, making it difficult to restore the colors of the real scene.
Image enhancement techniques such as percentile stretching and Gamma correction are used to preprocess the image. A multi-scale gating network is constructed, and the transition matrix is estimated using ECA and spatial attention mechanisms. Image dehazing is performed through the multi-scale gating network, and the model is optimized by combining SSIM and MSE loss functions.
Significantly improves image clarity and contrast, restores image details and true colors, improves image quality, and avoids color distortion and artifacts.
Smart Images

Figure CN121258836B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, and specifically to an image dehazing method based on image enhancement and multi-scale gating networks. Background Technology
[0002] With the increasing prevalence of intelligent sensing systems in fields such as intelligent transportation, autonomous driving, remote sensing monitoring, and video security, visual quality has become one of the key factors affecting the accuracy and stability of system perception. Due to the scattering effect of suspended particulate matter in the atmosphere, foggy weather often leads to blurred image textures, low image contrast, and color distortion, severely affecting the performance of subsequent visual tasks such as target detection, target tracking, and image recognition. Therefore, image dehazing technology, as an image enhancement method, has become an important part of performing computer vision tasks and is of great significance for improving the environmental adaptability and robustness of vision systems.
[0003] Traditional image dehazing methods primarily rely on atmospheric scattering models, estimating transmission maps and atmospheric light values to physically model and inversely recover fogged images. While these methods have achieved good results in simulating foggy image processing scenarios, they exhibit poor adaptability to varying fog concentrations in real-world foggy environments, and the processed images are prone to color casts.
[0004] In recent years, deep learning has made groundbreaking progress in image processing tasks. Existing techniques have introduced structures such as Convolutional Neural Networks (CNNs) and Generative Adversarial Networks (GANs) into image dehazing tasks. Through end-to-end learning mechanisms, these methods automatically extract hierarchical features of images under large-scale data-driven conditions, achieving high-quality restoration of hazy images. However, existing learning-based methods generally rely on a large number of clearly labeled images as supervised samples, which also easily leads to poor model adaptability in real-world foggy scenes. Furthermore, images processed by the model often fail to reproduce the colors of the real scene and are prone to artifacts.
[0005] Therefore, proposing an effective image dehazing method to restore the clear structure and true colors of an image is of great significance for improving image quality and ensuring the performance of subsequent visual tasks. Summary of the Invention
[0006] To address the problems existing in the prior art, this invention discloses an image dehazing method based on image enhancement and multi-scale gating networks. This method can effectively restore the outline, details and texture of the target in the image that is obscured by fog, and restore the true scene colors of the image that is gray or white due to fog. The dehazed image has improved clarity while having more natural and realistic color expression, which greatly improves the image quality.
[0007] The technical solution provided by this invention includes the following steps:
[0008] Step 1: Create a foggy day image dataset and divide the dataset into a training set, a validation set, and a test set;
[0009] Step 2: Preprocess the training set using image enhancement techniques;
[0010] Step 3: Construct a multi-scale gating network;
[0011] Step 4: Train the multi-scale gating network using the validation set and the preprocessed training set, and save the best trained model;
[0012] Step 5: Use the test set to test the accuracy of the optimal model. If the accuracy requirements are met, the final image dehazing model is obtained.
[0013] Furthermore, step 2 specifically includes steps 2.1 to 2.2:
[0014] Step 2.1: The foggy image is processed by percentile stretching strategy and Gamma correction. This method can effectively reduce fog concentration, significantly improve image contrast and restore the true scene color of the image.
[0015] Furthermore, the percentile stretching strategy involves discarding the darkest and brightest 1% of extreme pixels in the image and performing a linear mapping within the remaining 98% of pixels to map the original grayscale range to the full display range. low ,P high The specific operation can be represented as follows:
[0016]
[0017] Where Q(x,y) is the intensity value of the input image at pixel coordinates (x,y), Q′(x,y) is the intensity value of the output image at pixel coordinates (x,y), and P high For the high percentile threshold, P low The lower percentile threshold;
[0018] Furthermore, the Gamma correction is achieved by applying differentiated gains to different brightness levels through a grayscale mapping function. Specifically, this operation can be represented as follows:
[0019] Q″(x,y)=[Q′(x,y)] γ (2)
[0020] Where Q′(x,y) is the intensity value of the image after percentile stretching at pixel coordinates (x,y), Q″(x,y) is the intensity value of the output image at pixel coordinates (x,y), and γ is the mapping parameter, 0<γ<1;
[0021] Step 2.2: Convert the image from RGB space to Lab space and perform histogram equalization using the L channel. This method can effectively enhance the clarity of target texture and contour in the image and further dilute the fog concentration in the image, thus achieving preprocessing of the training set.
[0022] Furthermore, the L-channel histogram is divided into blocks, and the number of pixels with the 0th gray value in each block is counted. A threshold τ is set. If the number of pixels with the same gray value in each block exceeds the threshold τ, the overflowing pixel blocks are evenly distributed to other gray values. Then, histogram equalization is performed, which can be represented as follows:
[0023]
[0024] Where L(x,y) represents the original brightness of the pixel at coordinates (x,y) within this block, L out (x,y) represents the output brightness after mapping; This represents the number of pixels with a brightness less than L(x,y) in the block, where H clipped (i) represents the number of pixels with a grayscale value of i; CDF min N is the number of pixels with the smallest grayscale value within the block. pixels L represents the total number of pixels in the current block. max This represents the maximum possible brightness.
[0025] Furthermore, the new L channel is merged with the original a and b channels and converted back to RGB space;
[0026] Furthermore, step 3 specifically includes steps 3.1 to 3.2:
[0027] Step 3.1: The multi-scale gating network consists of a K-value estimation module and a sharp image generation module. The K-value estimation module consists of Conv module 1, Conv module 2, Conv module 3, Conv module 4, ECA module, Conv-branch module, Concat module, Conv module 5, Spatial-Attention module, and Conv module 6.
[0028] The kernel size of Conv module 1, Conv module 2, Conv module 3, Conv module 4, Conv-branch module and Conv module 6 is 3×3, and the kernel size of Conv module 5 is 1×1.
[0029] The validation set and the preprocessed training set are used as inputs to the K-value estimation module, which then passes through Conv module 1, Conv module 2, Conv module 3, and Conv module 4 in sequence.
[0030] The output of Conv module 4 serves as the input to both the ECA module and the Conv-branch module.
[0031] The outputs of the ECA module and the Conv-branch module are used as the inputs of the Concat module, and then pass through the Conv module 5, the Spatial-Attention module and the Conv module 6 in sequence to obtain the transition matrix K(x);
[0032] Furthermore, the ECA module consists of a GAP module, a Conv module, a Sigmoid activation function, and a pixel-wise multiplication unit connected in sequence;
[0033] The ECA module takes a multi-channel feature map as input, performs global average pooling on each channel through the GAP module to obtain a channel response sequence of length C; uses a 1×1 convolutional block Conv to capture the relationship between adjacent channels; then maps the result to [0,1] through the Sigmoid activation function to obtain the channel weights; then multiplies it pixel by pixel with the original feature map, and finally outputs the processed feature map.
[0034] Furthermore, the Spatial-Attention module consists of a dual-branch structure formed by the AVGPOOL module and the MAXPOOL module, and a Concat module, a Conv module, a Sigmoid activation function, and a pixel-wise multiplication unit connected in sequence.
[0035] The Spatial-Attention module takes a single-channel feature map as input. It performs channel-wise average pooling and channel-wise max pooling on the input features using the AVGPOOL and MAXPOOL modules, resulting in two single-channel feature maps reflecting overall brightness and salient edges. The Concat module then concatenates these two single-channel feature maps. A 7×7 convolutional block (Conv) is then used to fuse the contextual information around the same location in the feature maps, resulting in a spatial response map. This map is then mapped to [0,1] using a Sigmoid function to obtain the channel weights, which are then multiplied pixel-by-pixel with the original feature map. Finally, the processed feature map is output.
[0036] Step 3.2: The clear image generation module converts the foggy image into a fog-free image using the transition matrix K(x). The specific operation can be represented as follows:
[0037] J(x)=K(x)I(x)+I(x) (4) where J(x) represents the dehazed image, I(x) represents the foggy image, K(x) is the transition matrix, and x is the pixel coordinate;
[0038] Furthermore, step 4 specifically includes steps 4.1 to 4.4:
[0039] Step 4.1: Set the training parameters of the multi-scale gating network;
[0040] Training parameters include: number of iterations, batch size, learning rate, weight decay, and number of threads;
[0041] Step 4.2: Input the validation set and the preprocessed training set into the multi-scale gating network, and calculate the gradient of the loss function through backpropagation. The formula for calculating the loss function is:
[0042] L loss =(1-α)×(1-SSIM)+α×MSE (5)
[0043] Where a is the weighting factor, α∈[0,1]; the MSE formula is:
[0044]
[0045] Where MSE represents the mean square error of the original image x and the dehazed image y, x(i,h) represents the pixel value in the i-th row and j-th column of the original image, y(i,j) represents the pixel value in the i-th row and j-th column of the dehazed image, and m and n are the width and height of the image; the SSIM formula is:
[0046]
[0047] Where, μ x μ is the local mean of the original image x. y y is the local mean of the dehazed image; Let x be the variance of the image. Let σ be the variance of the image y. xy Let be the covariance of the images x and y; c1 and c2 are stability constants.
[0048] Step 4.3: Use the optimizer to update the model parameters in the direction of gradient descent until the loss functions of the training and validation sets no longer change;
[0049] Step 4.4: Save the trained model parameters as the optimal model;
[0050] Furthermore, step 5 specifically includes steps 5.1 to 5.3:
[0051] Step 5.1: Preprocess the test set according to the image enhancement technique described in Step 2;
[0052] Step 5.2: Input the preprocessed test set into the optimal model described in Step 4, and output the dehazed test set image;
[0053] Step 5.2: Calculate the objective evaluation metrics for the original test set images and the dehazed test set images: PSNR and SSIM, where:
[0054] PSNR, or Peak Signal Ratio, measures the ratio between the original image and the error in an image. A higher PSNR indicates better dehazing. The specific formula is as follows:
[0055]
[0056] Where MSE represents the mean square error of the original image x and the dehazed image y, and is specifically calculated using formula (6); MAx x The maximum pixel value in image x;
[0057] SSIM is the structural similarity index, which is used to measure the similarity between two images in terms of structure, brightness, contrast, etc. The larger the value, the better the dehazing effect. The specific calculation is formula (7).
[0058] Step 5.3: When the objective evaluation indicators meet the requirements, the final multi-scale gated network model is obtained.
[0059] Compared with the prior art, the beneficial effects of the present invention are:
[0060] (1) By using percentile stretching strategy and Gamma correction to process foggy images, this method can effectively reduce fog concentration, significantly improve image contrast, and restore the true scene color of the image.
[0061] (2) Convert the image from RGB space to Lab space and use the L channel to perform histogram equalization. This method can effectively enhance the clarity of target texture and contour in the image and further dilute the fog concentration in the image, thus achieving preprocessing of the training set.
[0062] (3) A multi-scale gating network is constructed using ECA channel attention mechanism and spatial attention mechanism. This network can enhance the model’s ability to perceive foggy regions and edge structures, and obtain a more accurate transition matrix K(x). The foggy image I(x) is converted into a defoggy image J(x) by formula J(x)=K(x)I(x)+I(x), which can significantly improve image clarity, better restore image details, brightness and contrast, and maintain the true color of the image. Attached Figure Description
[0063] Figure 1 This is a flowchart of an image dehazing method based on image enhancement and multi-scale gating networks according to the present invention.
[0064] Figure 2 Schematic diagram of a multi-scale gating network structure
[0065] Figure 3 Schematic diagram of the K-value estimation module
[0066] Figure 4 Schematic diagram of ECA module structure
[0067] Figure 5 A schematic diagram of the Spatial-Attention module structure.
[0068] Figure 6 Images of real foggy weather
[0069] Figure 7 for Figure 6 Image after dehazing using this method
[0070] Figure 8 Images of real foggy weather
[0071] Figure 9 for Figure 8 Image after dehazing using this method Detailed Implementation
[0072] To make the technical solution, structural features, achieved objectives, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings. It should be noted that the specific embodiments described herein are only for clearer explanation of the present invention and are not intended to limit the present invention.
[0073] Figure 1 This is a flowchart of an image dehazing method based on image enhancement and multi-scale gating networks disclosed in this invention. The implementation process is as follows:
[0074] Step 1: Create a foggy day image dataset and divide the dataset into a training set, a validation set, and a test set;
[0075] In this embodiment, to comprehensively evaluate the effectiveness of the proposed image dehazing method, the publicly available ITS (Indoor Training Set) dataset was selected as the experimental basis. The ITS dataset contains 27,250 synthetic fog images and corresponding clear images. All images are based on real scenes and are synthesized using atmospheric scattering models and depth map information. It features fog conditions with varying concentrations and scene complexities, and the dataset is divided into training, validation, and test sets in an 8:1:1 ratio.
[0076] Step 2: Preprocess the training set using image enhancement techniques, further including steps 2.1 to 2.2:
[0077] Step 2.1: The foggy image is processed by percentile stretching strategy and Gamma correction. This method can effectively reduce fog concentration, significantly improve image contrast and restore the true scene color of the image.
[0078] Furthermore, the percentile stretching strategy involves discarding the darkest and brightest 1% of extreme pixels in the image and performing a linear mapping within the remaining 98% of pixels to map the original grayscale range to the full display range. low ,P high The specific operation can be represented as follows:
[0079]
[0080] Where Q(x,y) is the intensity value of the input image at pixel coordinates (x,y), Q′(x,y) is the intensity value of the output image at pixel coordinates (x,y), and P high For the high percentile threshold, P low The lower percentile threshold;
[0081] Furthermore, the Gamma correction is achieved by applying differentiated gains to different brightness levels through a grayscale mapping function. Specifically, this operation can be represented as follows:
[0082] Q″(x,y)=[Q′(x,y)] γ (2)
[0083] Where Q′(x,y) is the intensity value of the image after percentile stretching at pixel coordinates (x,y), Q″(x,y) is the intensity value of the output image at pixel coordinates (x,y), and γ is the mapping parameter, γ=0.7;
[0084] Step 2.2: Convert the image from RGB space to Lab space and perform histogram equalization using the L channel. This method can effectively enhance the clarity of target texture and contour in the image and further dilute the fog concentration in the image, thus achieving preprocessing of the training set.
[0085] Furthermore, the L-channel histogram is divided into blocks of 8×8 size. The number of pixels with the i-th grayscale value in each block is counted, and a threshold τ = 36 is set. If the number of pixels with the same grayscale value in each block exceeds the threshold τ, the overflowing pixel blocks are evenly distributed to other grayscale values. Then, histogram equalization is performed, which can be represented as follows:
[0086]
[0087] Where L(x,y) represents the original brightness of the pixel at coordinates (x,y) within this block, L out (x,y) represents the output brightness after mapping; This represents the number of pixels with a brightness less than L(x,y) in the block, where H clipped (i) represents the number of pixels with a grayscale value of i; CDF min N is the number of pixels with the smallest grayscale value within the block. pixels L represents the total number of pixels in the current block. max This represents the maximum possible brightness.
[0088] Furthermore, the new L channel is merged with the original a and b channels and converted back to RGB space;
[0089] Step 3: Construct a multi-scale gating network. The structure of the multi-scale gating network is as follows: Figure 2 As shown, it further includes steps 3.1 to 3.2:
[0090] Step 3.1: The multi-scale gating network K-value estimation module and the sharp image generation module are composed of Conv module 1, Conv module 2, Conv module 3, Conv module 4, ECA module, Conv-branch module, Concat module, Conv module 5, Spatial-Attention module, and Conv module 6. The structure of the K-value estimation module is as follows: Figure 3 As shown;
[0091] The kernel size of Conv module 1, Conv module 2, Conv module 3, Conv module 4, Conv-branch module and Conv module 6 is 3×3, and the kernel size of Conv module 5 is 1×1.
[0092] The validation set and the preprocessed training set are used as inputs to the K-value estimation module, which then passes through Conv module 1, Conv module 2, Conv module 3, and Conv module 4 in sequence.
[0093] The output of Conv module 4 serves as the input to both the ECA module and the Conv-branch module.
[0094] The outputs of the ECA module and the Conv-branch module are used as the inputs of the Concat module, and then pass through the Conv module 5, the Spatial-Attention module and the Conv module 6 in sequence to obtain the transition matrix K(x);
[0095] Furthermore, the ECA module consists of a GAP module, a Conv module, a Sigmoid activation function, and a pixel-wise multiplication unit connected in sequence, as shown in the following structure: Figure 4 As shown;
[0096] The ECA module takes a multi-channel feature map as input, performs global average pooling on each channel through the GAP module to obtain the corresponding sequence of channels with a length of C; uses a 1×1 convolutional block Conv to capture the relationship between adjacent channels; then maps the result to [0,1] through the Sigmoid activation function to obtain the channel weights; then multiplies it pixel by pixel with the original feature map, and finally outputs the processed feature map.
[0097] Furthermore, the Spatial-Attention module consists of a dual-branch structure formed by the AVGPOOL and MAXPOOL modules, and sequentially connected Concat, Conv, Sigmoid activation functions, and pixel-wise multiplication units. The Spatial-Attention module structure is as follows: Figure 5 As shown;
[0098] The Spatial-Attention module takes a single-channel feature map as input. It then uses the AVGPOOL and MAXPOOL modules to perform channel-wise average pooling and channel-wise max pooling on the input feature map, resulting in two single-channel feature maps reflecting overall brightness and significant edges. The Concat module concatenates these two single-channel feature maps. A 7×7 convolutional block (Conv) then fuses the contextual information around the same location in the feature maps to obtain a spatial response map. This map is then mapped to [0,1] using a Sigmoid activation function to obtain the channel weights, which are then multiplied pixel-by-pixel with the original feature map. Finally, the processed feature map is output.
[0099] Step 3.2: The clear image generation module converts the foggy image into a fog-free image using the transition matrix K(x). The specific operation can be represented as follows:
[0100] J(x)=K(x)I(x)+I(x) (4) where J(x) represents the dehazed image, I(x) represents the foggy image, K(x) is the transition matrix, and x is the pixel coordinate;
[0101] Step 4: Train the multi-scale gating network using the validation set and the preprocessed training set, and save the optimal trained model. This further includes steps 4.1 to 4.4:
[0102] Step 4.1: Set the training parameters of the multi-scale gating network;
[0103] Training parameters include: number of iterations, batch size, learning rate, weight decay, and number of threads;
[0104] Step 4.2: Input the validation set and the preprocessed training set into the multi-scale gating network, and calculate the gradient of the loss function through backpropagation. The formula for calculating the loss function is:
[0105] L loss =(1-α)×(1-SSIM)+α×MSE (5)
[0106] Where α is the weighting factor, α∈[0,1]; the MSE formula is:
[0107]
[0108] Where MSE represents the mean square error of the original image x and the dehazed image y, x(i,j) represents the pixel value in the i-th row and j-th column of the original image, y(i,j) represents the pixel value in the i-th row and j-th column of the dehazed image, and m and n are the width and height of the image; the SSIM formula is:
[0109]
[0110] Where, μ x μ is the local mean of the original image x. y y is the local mean of the dehazed image; Let x be the variance of the image. Let σ be the variance of the image y. xy Let be the covariance of the images x and y; c1 and c2 are stability constants.
[0111] Step 4.3: Use the optimizer to update the model parameters in the direction of gradient descent until the loss functions of the training and validation sets no longer change;
[0112] Step 4.4: Save the trained model parameters as the optimal model.
[0113] 6. The image dehazing method based on image enhancement and multi-scale gating networks according to claim 1, characterized in that step 5 further includes steps 5.1 to 5.3:
[0114] Step 5.1: Preprocess the test set according to the image enhancement technique described in Step 2;
[0115] Step 5.2: Input the preprocessed test set into the optimal model described in Step 4, and output the dehazed test set image;
[0116] Step 5.2: Calculate the objective evaluation metrics for the original test set images and the enhanced test set images: PSNR and SSIM, where:
[0117] PSNR, or Peak Signal Ratio, measures the ratio between the original image and the error in an image. A higher PSNR indicates better dehazing. The specific formula is as follows:
[0118]
[0119] Where MSE represents the mean square error of the original image x and the dehazed image y, and is specifically calculated using formula (6); MAX x The maximum pixel value in image x;
[0120] SSIM stands for Structural Similarity Index, which measures the similarity between two images in terms of structure, brightness, contrast, etc. A higher value indicates a better dehazing effect. The specific calculation is shown in formula (7):
[0121] Step 5.3: When the objective evaluation indicators meet the requirements, the final multi-scale gated network model is obtained.
[0122] To better verify the effectiveness of this method, foggy images were selected, such as... Figure 6 As shown, the input image is followed by the dehazed image. Figure 7 As shown; the vanishing point of the road in the distance and the outline of the tree trunks on both sides are clearly reconstructed, and the fine texture and layers of the leaves are clearly revealed from the blurry gray fog; the overall gray fog is effectively suppressed, and the color and contrast of the fallen leaves on the ground are closer to reality, and the alternation of green and yellowish-brown is naturally restored, without obvious halo or oversaturation.
[0123] To better verify the effectiveness of this method, foggy images were selected, such as... Figure 8 As shown, the input image is followed by the dehazed image. Figure 9 As shown, the mountain's hierarchical boundaries and ridgelines are more distinct, and the ripples on the water and the outline of the ship are clearly restored. The previous whitish or grayish tones caused by fog have been corrected, and the tonal transitions between the sky, mountains, and water are more natural. The relationship between the blue-green color and shadows in the water is realistically reproduced. The results maintain an improvement in global contrast while avoiding color distortion and noise amplification, balancing the restoration of target outlines, details, and textures with the color reproduction of the real scene, thus significantly improving the overall image quality.
[0124] In this embodiment, to verify the effectiveness of the image dehazing method disclosed in this invention, we tested DCP, AOD-Net, DehazeNet, GFN, and the image dehazing method proposed in this invention on the ITS dataset. The evaluation results are shown in Table 1. Among them, the image dehazing method based on image enhancement and multi-scale gating network proposed in this paper outperforms other methods in both PSNR and SSIM evaluation metrics.
[0125] Table 1. Comparative Experimental Results
[0126]
[0127] The above description is merely one embodiment of the present invention and does not limit the patent scope of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An image defogging method based on image enhancement and multi-scale gating network, characterized in that, Specifically comprising the following steps: Step 1: Establish a foggy image dataset, divide the dataset into a training set, a validation set and a test set; Step 2: Preprocess the training set through image enhancement technology; Step 2.1: Process the foggy image through the percentile stretching strategy and Gamma correction, which can effectively reduce the fog concentration, significantly improve the image contrast, and restore the true scene color of the image; Step 2.2: First, convert the image from RGB space to Lab space, then perform histogram equalization on the L channel, which can effectively enhance the clarity of image texture and contour, and further dilute the fog concentration in the image, realizing the preprocessing of the training set; Step 3: Construct a multi-scale gating network; Step 3.1: The multi-scale gating network is composed of a K value estimation module and a clear image generation module, and the K value estimation module is composed of Conv module 1, Conv module 2, Conv module 3, Conv module 4, ECA module, Conv-branch module, Concat module, Conv module 5, Spatial-Attention module and Conv module 6; The convolution kernel size of Conv module 1, Conv module 2, Conv module 3, Conv module 4, Conv-branch module and Conv module 6 is 3x3, and the convolution kernel size of Conv module 5 is 1x1; The validation set and the preprocessed training set are input into the K value estimation module, and sequentially pass through Conv module 1, Conv module 2, Conv module 3 and Conv module 4; The output of the Conv module 4 is input into the ECA module and the Conv-branch module respectively; The output of the ECA module and the Conv-branch module is input into the Concat module, and then sequentially passes through the Conv module 5, the Spatial-Attention module and the Conv module 6 to obtain the transition matrix K(x); Step 3.2: The clear image generation module is to bring the transition matrix K(x) into formula (1) to convert the foggy image into a non-foggy image, and the specific operation is: J(x)=K(x)I(x)+I(x) (1) Where J(x) represents the de-fogged image, I(x) represents the foggy image, K(x) is the transition matrix, and x is the pixel coordinate; Step 4: Train the multi-scale gating network using the validation set and the preprocessed training set, and save the optimal model trained; Step 5: Test the accuracy of the optimal model using the test set, and meet the accuracy requirement, that is, obtain the final image de-fogging model.
2. The image defogging method based on image enhancement and multi-scale gating network according to claim 1, characterized in that, The step 2.1 further comprises steps 2.1.1 to 2.1.2: Step 2.1.1: The percentile stretching strategy is to discard the 1% darkest and 1% brightest extreme pixels in the image and do a linear mapping in the remaining 98% pixel range to map the original gray scale interval to the full display range [P low ,P high ], which can be expressed as: where Q(x, y) is the intensity value of the input image at pixel coordinates (x, y), Q ′ (x, y) is the intensity value of the output image at pixel coordinates (x, y), R high is a high percentile threshold, P low is a low percentile threshold; Step 2.1.2: The Gamma correction is to implement differential gain on different brightness levels through a gray mapping function, and the specific operation can be represented as: Q"(x, y) = [Q ′ (x, y)] γ (3) where Q ′ (x,y) is the intensity value of the image after percentile stretching at pixel coordinate (x,y), Q"(x,y) is the intensity value of the output image at pixel coordinate (x,y), and γ is a mapping parameter, 0<γ<1.
3. The image defogging method based on image enhancement and multi-scale gating network according to claim 1, characterized in that, The step 2.2 further comprises steps 2.2.1 to 2.2.2: Step 2.2.1: convert the image from RGB space to Lab space, in which the L channel represents the luminance information and the a, b channels carry the chrominance information; Step 2.2.2: block the L channel histogram, count the number of pixels of the i-th gray value in each block, and set a threshold τ. If the number of pixels of the same gray value in each block exceeds the threshold τ, the overflow pixel block is evenly distributed to other gray values; then histogram equalization is implemented, which can be represented as: where L(x, y) represents the original luminance of the pixel with coordinate (x, y) in the block, L out (x, y) is the output luminance after mapping; represents the number of pixels in the block whose luminance is less than L(x, y), where H clipped (i) represents the number of pixels with gray value i; CDF min is the number of pixels with the minimum gray value in the block, N pixels is the total number of pixels in the current block, L max is the maximum value of luminance. Step 2.2.3: merge the new L channel with the original a, b channels and convert back to RGB space.
4. The image defogging method based on image enhancement and multi-scale gating network according to claim 1, characterized in that, The step 3.1 further comprises steps 3.1.1 to 3.1.2: Step 3.1.1: the ECA module is composed of a GAP module, a Conv module, a Sigmoid activation function and a pixel-by-pixel multiplication unit connected in sequence; The ECA module takes a multi-channel feature map as input, performs global average pooling on each channel through the GAP module to obtain a channel response sequence of length C; uses a 1x1 convolution block Conv to capture the relationship between adjacent channels; then maps the result to [0, 1] through the Sigmoid activation function to obtain the channel weight; Then multiply the original feature map pixel by pixel, and finally output the processed feature map; Step 3.1.2: the Spatial-Attention module is composed of a double-branch structure formed by an AVGPOOL module and a MAXPOOL module, and a Concat module, a Conv module, a Sigmoid activation function and a pixel-by-pixel multiplication unit connected in sequence; The Spatial-Attention module takes a single-channel feature map as input, performs channel average pooling and channel maximum pooling on the input feature through the AVGPOOL module and the MAXPOOL module to obtain two single-channel feature maps reflecting overall brightness and significant edges; the two single-channel feature maps are spliced through the Concat module; then a 7x7 convolution block Conv is used to fuse the context information around the same position of the feature map to obtain a spatial response map; the Sigmoid activation function is used to map to [0, 1] to obtain the channel weight, and then the original feature map is multiplied pixel by pixel, and finally the processed feature map is output.
5. The image defogging method based on image enhancement and multi-scale gating network according to claim 1, characterized in that, The step 4 further comprises steps 4.1 to 4.4: Step 4.1: set the training parameters of the multi-scale gating network; The training parameters include: the number of iterations, the batch size, the learning rate, the weight decay and the number of threads; Step 4.2: input the validation set and the preprocessed training set into the multi-scale gating network, calculate the gradient of the loss function through back propagation, and the loss function calculation formula is: L loss = (1 - a) x (1 - SSIM) + a x MSE (5) Where α is a weight factor, α ∈ [0, 1]; the MSE formula is: Where MSE represents the mean square error of the original image x and the dehazed image y, x(i,j) represents the pixel value of the original image at the jth row and jth column, y(i,j) represents the pixel value of the dehazed image at the ith row and jth column, m and n are the width and height of the image; the SSIM formula is: where μ x is the local mean of the original image x, μ y is the local mean of the defogged image y; is the variance of the image x, is the variance of the image y, σ xy is the covariance of the images x, y; c1, c2 are stability constants; Step 4.3: using the optimizer to update the model parameters, so that it is updated in the direction of gradient descent; until the loss function of the training set and the validation set no longer changes; Step 4.4: save the trained model parameters as the optimal model.
6. The image defogging method based on image enhancement and multi-scale gating network according to claim 1, characterized in that, The step 5, further comprising steps 5.1 to 5.3: Step 5.1: the test set is preprocessed according to the image enhancement technology of step 2; Step 5.2: input the preprocessed test set into the optimal model of step 4, and output the test set image after defogging; Step 5.2: calculate the objective evaluation indexes PSNR and SSIM of the original test set image and the test set image after defogging, wherein: PSNR is the peak signal ratio, which is used to measure the ratio between the original image and the error, the larger the value, the better the defogging effect, and the specific formula is: Wherein, MSE represents the mean square error of the original image x and the image y after defogging, and is specifically calculated as formula (6); MAX x is the maximum pixel value in the image x; SSIM is the structural similarity index, which is used to measure the similarity of two images in structure, brightness and contrast, the larger the value, the better the defogging effect, and the specific calculation is formula (7); Step 5.3: when the objective evaluation index evaluation meets the requirements, the final multi-scale gating network model is obtained.
Citation Information
Patent Citations
Underwater image enhancement method based on multi-scale attention mixed feature fusion
CN118485605A
Methods and Systems for Applications for Z-numbers
US20140201126A1