Fog concentration self-adaptive image defogging method and system, and training method of defogging model
This image dehazing method, which employs fog concentration adaptation and physical guided feature decomposition, solves the problem of insufficient fog concentration adjustment in existing technologies, and achieves efficient image dehazing and detail restoration in complex industrial environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QUANZHOU INST OF INFORMATION ENG
- Filing Date
- 2026-07-02
- Publication Date
- 2026-07-31
AI Technical Summary
Existing image dehazing methods lack the ability to adaptively adjust fog concentration, resulting in over-enhancement of thin fog scenes or insufficient removal of dense fog scenes, which affects the accuracy of images acquired by industrial cameras.
An adaptive fog density image dehazing method is adopted. Multi-scale features are extracted by an encoder, and adaptive modulation and correction are performed by an adaptive fog density module and a physically guided feature decomposition module. Combined with additive correction formula and global residual connection, adaptive dehazing is achieved.
It improves the stability and robustness of the model, effectively removes haze, restores image clarity and detail, and is suitable for complex industrial environments.
Smart Images

Figure CN122492518A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, specifically to an adaptive fog density image dehazing method, system, and training method for a dehazing model. Background Technology
[0002] With the development of intelligent manufacturing, smart factories, and unmanned inspection, machine vision has been widely applied in scenarios such as product surface defect identification, equipment status monitoring, and industrial site security monitoring. In actual industrial settings, image acquisition environments are complex and variable. Scenarios such as steel smelting, coal mining, chemical production, and outdoor factory monitoring are prone to phenomena like smoke, water vapor, smog, and dust. These suspended particles scatter and absorb light, causing degradation problems in images captured by industrial cameras, such as decreased contrast, blurred edges, and loss of texture details, severely affecting the accuracy of subsequent visual tasks such as target detection and defect identification.
[0003] Existing methods generally use a fixed defogging intensity, which lacks the ability to adaptively adjust to different fog and dust concentrations, resulting in over-enhancing in light fog scenes and insufficient removal in dense fog scenes. Summary of the Invention
[0004] In view of the shortcomings of the existing technology, the purpose of this invention is to propose an image dehazing method, system and training method of dehazing model with fog concentration adaptive, so as to solve the problems mentioned in the background section above.
[0005] This invention is achieved through the following technical solution: Option 1: This invention provides a fog density adaptive image dehazing method, the method comprising the following steps: S1. Acquire the degraded image and preprocess the degraded image to obtain the input image to be dehazed; S2. Use an encoder to extract multi-scale features from the input image to be dehazed, and obtain multi-scale features that include at least shallow and deep features; S3. In the deep feature processing stage of the encoder, the deep features are modulated by the fog density adaptive module. The modulation includes: generating at least one modulation parameter based on the global context information of the deep features. The value of the modulation parameter is constrained within a preset bounded range. The deep features are then subjected to channel-level adaptive transformation using the modulation parameter. S4. The features modulated in step S3 are used as bottleneck features, and the bottleneck features are corrected by a physical guided feature decomposition module. The correction includes: estimating the spatial variation dehazing intensity features related to the transmittance of the atmospheric scattering model and the bias features related to atmospheric light in the feature space, and performing physical guided correction on the bottleneck features according to the additive correction formula, which is expressed as: ; in, Bottleneck characteristics These are the features after physical guidance and correction. The spatially varying defogging intensity characteristics, This refers to the bias characteristics related to atmospheric light. This represents element-wise multiplication. For learnable gating parameters; S5. The features corrected in step S4 are upsampled using the decoder. During the upsampling process, the multi-scale features extracted by the encoder in step S2 are fused through skip connections to gradually restore the spatial resolution. S6. By using global residual connections, the decoder output features are added to the input image to be dehazed to obtain a dehazed enhanced image.
[0006] Furthermore, the physical guidance feature decomposition module includes: The dehazing intensity branch is used to generate dehazing intensity features adapted to local spatial variations of the image based on the bottleneck features. ; Atmospheric bias branch, used to generate channel-level atmospheric light-related bias features characterizing the global fog and dust background based on the bottleneck features. .
[0007] Furthermore, in step S3, the fog concentration adaptive module performs the following operations: Global average pooling is performed on the input features to obtain the global context vector; The global context vector is processed through at least one fully connected layer and decomposed into scaling parameters. and offset parameters ; The scaling parameter is obtained by using a bounded function. Constrained to the [0,2] interval, the offset parameter Constrain to the interval [-0.1, 0.1]; The input features are adaptively modulated according to the following feature modulation formula: ; in, Bottleneck characteristics To learnable gating parameters, and Initialize to 0.
[0008] Furthermore, the skip connection fusion method in step S5 is as follows: the features upsampled by the decoder are concatenated with the corresponding layer features of the encoder in the channel dimension, and then fused through a convolutional layer.
[0009] Furthermore, the preprocessing in step S1 includes: normalizing the degraded image to a data range that the neural network can process, and performing size cropping, padding, or scaling according to the network input requirements.
[0010] Option 2: This invention provides an adaptive image dehazing system based on fog density, comprising: The acquisition module is used to acquire degraded images; The preprocessing module is used to preprocess the degraded image to obtain the input image to be dehazed; The encoder module is used to perform multi-scale feature extraction on the input image to be dehazed, to obtain multi-scale features that include at least shallow and deep features; A fog density adaptive module is set in the deep feature processing stage of the encoder module and is used to modulate the deep features. The modulation includes: generating at least one modulation parameter based on the global context information of the deep features, the value of the modulation parameter being constrained within a preset bounded range, and using the modulation parameter to perform channel-level adaptive transformation on the deep features. The physical-guided feature decomposition module is used to receive the features modulated by the fog concentration adaptive module as bottleneck features and to correct the bottleneck features. The correction includes: estimating the spatial variation defogging intensity features related to the transmittance of the atmospheric scattering model and the bias features related to atmospheric light in the feature space, and performing physical-guided correction on the bottleneck features according to the additive correction formula. The decoder module is used to upsample the features corrected by the physical guidance feature decomposition module. During the upsampling process, the multi-scale features extracted by the encoder module are fused through skip connections to gradually restore the spatial resolution. The global residual connection module is used to add the output features of the decoder module to the input image to be dehazed, so as to obtain a dehazed enhanced image.
[0011] Option 3: This invention provides a training method for a dehazing model, the training method comprising: The model parameters are constrained by a total loss function, which is composed of pixel domain loss and frequency domain loss. The frequency domain loss is used to constrain the consistency of the predicted dehazed image and the clear ground truth image in the frequency amplitude spectrum.
[0012] Furthermore, the total loss function is expressed as: ; in, Indicates pixel domain loss. Indicates frequency domain loss. The frequency domain loss weights are used.
[0013] Furthermore, the pixel domain loss Defined as: ; in, This represents the predicted dehazed image; Represents a clear truth image; It is a stable term; The mathematical expectation represents the average value of the pixel error corresponding to all pixel positions within a single image; The frequency domain loss Defined as: ; in, Represents the Fast Fourier Transform. Indicates taking the amplitude spectrum. express Norm.
[0014] Furthermore, the training method employs a progressive two-stage training strategy: the first stage involves training at a first image cropping size, and the second stage involves fine-tuning at a second image cropping size that is larger than the first image cropping size.
[0015] The beneficial effects of this invention are as follows: Firstly, this invention employs a Physically Guided Feature Decomposition (PFDM) module to replace the division method commonly used in existing technologies with an additive correction formula in the feature space for physically guided correction. Since this additive correction method does not require direct division by the transmittance feature, it effectively avoids problems such as numerical amplification, gradient explosion, and local artifact enhancement caused by excessively small or unstable transmittance estimates. This significantly reduces the risk of numerical divergence during model training and inference, and improves the overall stability and robustness of the model.
[0016] Secondly, the invention introduces a fog density adaptive module (HDA) in the deep stages of the encoder. This module extracts global context information by performing global average pooling on the input features, and generates channel-level scaling parameters after processing by a fully connected layer. and offset parameters The scaling parameter is obtained by using a bounded function. Constrained to the [0,2] interval, the offset parameter The parameters are constrained to the range of [-0.1, 0.1], enabling the network to automatically generate bounded modulation parameters based on the overall degree of fog degradation in the input image. Attached Figure Description
[0017] Figure 1 This is a flowchart of an image dehazing method with adaptive fog concentration according to the present invention.
[0018] Figure 2 This is a comparison chart of the defogging effects of the method of the present invention and existing defogging methods on the SOTS test set.
[0019] Figure 3 The images show a comparison of the defogging effects of the method of this invention and existing defogging methods in multiple real-world scenarios.
[0020] Figure 4 This is a comparison chart showing the defogging effect of the method of the present invention in multiple industrial scenarios under the influence of different factors. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It should be noted that the description of these embodiments is for the purpose of aiding understanding the present invention, but does not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0022] Example 1 An adaptive image dehazing method based on fog density, the method comprising the following steps: S1. Acquire the degraded image and preprocess the degraded image to obtain the input image to be dehazed.
[0023] Specifically, degraded images may originate from sources including, but not limited to, industrial cameras, inspection robots, fixed monitoring equipment, or drone inspection equipment. Degradation sources include smoke, water vapor, smog, dust, and lens fogging. Preprocessing involves normalizing the input image to a data range that the neural network can process, and then cropping, padding, or scaling the image according to the neural network's input requirements to obtain the input image to be dehazed.
[0024] For example: A degraded image due to smoke, water vapor, or haze is acquired from an industrial field camera or inspection robot. The degraded image can be an RGB three-channel color image. Preprocessing operations include: linearly normalizing the image pixel values from [0, 255] to the [0, 1] interval; if the neural network input size is fixed (e.g., 256×256 pixels), the image is center-cropped or bilinearly scaled; if the image size is larger than the input size, random cropping can be used to increase data diversity. In this embodiment, to adapt to subsequent network input, the image is uniformly scaled to 256×256 pixels to obtain the input image to be dehazed.
[0025] S2. Use an encoder to extract multi-scale features from the input image to be dehazed, and obtain multi-scale features that include at least shallow and deep features; Specifically, the input image is fed into an encoder built on NAFNet (Nonlinear Activation Free Network). The encoder includes multiple downsampling stages, each consisting of several PDNAFBlock (pixel-level deep nonlinear activation free modules) or NAFNet base blocks, used to extract multi-scale image features from shallow texture to deep semantics layer by layer.
[0026] For example, the encoder used in this embodiment is built based on NAFNet (Nonlinear Activation Free Network), and adopts an overall encoder-bottleneck-decoder U-Net structure. The encoder contains four downsampling stages, with the number of NAFNet blocks in each stage being [2, 2, 4, 8], and the basic number of channels being 64. The bottleneck layer contains 12 network blocks. The decoder contains four upsampling stages, with the number of blocks in each stage being [2, 2, 2, 2]. The input image to be dehazed is input into the encoder, and features are extracted layer by layer. The first stage outputs shallow features that retain edge and texture information; the fourth stage outputs deep features that contain high-level semantic information. The first, second, third, and fourth stages constitute a multi-scale feature set. Fog Concentration Adaptive (HDA) modules are embedded in the third and fourth stages of the encoder, and a Physically Guided Feature Decomposition (PFDM) module is embedded after the bottleneck layer. Finally, the neural network uses global residual connections to add the learned residuals to the input dehazed image to obtain the final dehazed image.
[0027] In the network structure of this invention, the fog concentration adaptive module (HDA) is embedded in the deep stage of the encoder, and the physical guided feature decomposition module (PFDM) is set after the bottleneck layer. Therefore, during data processing, the data first goes through the HDA module for adaptive modulation, and then through the PFDM module for physical guided correction.
[0028] S3. In the deep feature processing stage of the encoder, the deep features are modulated by the fog density adaptive module. The modulation includes: generating at least one modulation parameter based on the global context information of the deep features, the value of the modulation parameter being constrained within a preset bounded range, and using the modulation parameter to perform channel-level adaptive transformation on the deep features.
[0029] Specifically, the fog concentration adaptive module is used to adaptively adjust deep features based on the overall degradation level of the input image. In industrial settings, the concentrations of smoke, water vapor, and haze vary significantly across different areas, times, and operating conditions, making it difficult for fixed-intensity defogging methods to adapt to both light and dense fog simultaneously. Therefore, this invention introduces a fog concentration adaptive module in the deep encoding stage, enabling the network to automatically generate modulation parameters based on global image features. The specific operation is as follows: The data processing procedure of the fog concentration adaptive module specifically includes the following sub-steps: S31. Perform global average pooling on the input features to obtain the global context vector; Specifically, by performing global average pooling (GAP) on the input feature F, the spatial dimension is compressed to 1×1, resulting in a global context vector. This global context vector characterizes the overall degradation level and global statistical properties of the current input image. The input feature F is a feature map output from the deep stage of the encoder, with dimensions C×H×W, where C is the number of channels, and H and W are the height and width of the feature map, respectively.
[0030] S32. Process the global context vector through at least one fully connected layer and decompose it into scaling parameters. and offset parameters ; Specifically, the global context vector is sequentially input into two fully connected layers for processing. The first fully connected layer reduces the dimension from C to C / r (where r is the reduction ratio), and after activation by GELU (Gaussian Error Linear Unit), the second fully connected layer restores the dimension to 2C. The output is then split along the channel dimension into scaling parameters. and offset parameters Both have dimensions of C×1×1. Scaling parameters. Offset parameter used to control the magnification or reduction of features in each channel. Used to control the translation amount of each channel feature.
[0031] This process can be uniformly represented by the following modulation parameter generation formula: ; in, GAP (·) represents the global average pooling operation, which is used to compress the spatial dimension of the input feature F to 1×1 to obtain global context information; FC (·) represents a fully connected layer operation, used to transform and map the global context vector in terms of channel dimensions; GELU (·) denotes the Gaussian error linear unit activation function, used to introduce nonlinear transformations; Split (·) indicates a split operation, used to split the 2C-dimensional vector output by the fully connected layer into two C-dimensional vectors along the channel dimension, which are then used as scaling parameters. and offset parameters ; The scaling parameter is obtained by using a bounded function. Constrained to the [0,2] interval, the offset parameter Constrain to the interval [-0.1, 0.1]; To ensure stable modulation and avoid abnormal feature amplification or image distortion caused by excessively large modulation parameters, the scaling parameters are adjusted. and offset parameters Apply bounded constraints separately: ; ; in, represents the Sigmoid function, used to map the input to the interval [0,2], and tanh(·) represents the hyperbolic tangent function, used to map the input to the interval [-0.1, 0.1], thereby achieving a small translation adjustment of channel-level features and avoiding drastic perturbation to the original feature distribution.
[0032] S33. Adaptively modulate the input features according to the following feature modulation formula: ; in, Bottleneck characteristics To learnable gating parameters, and Initialized to 0, when When the value is 0, the fog concentration adaptive module is equivalent to an identity mapping; as training progresses, By gradually learning the appropriate modulation intensity, the network can automatically enhance or weaken the defogging process based on the fog concentration of the input image.
[0033] For example, after the third and fourth stages of the encoder, fog concentration adaptive modules are embedded respectively. Let the input features be... (For example, the deep feature F4 from the fourth stage output of the encoder in step S2 has dimensions of 512×32×32, where C=512, H=32, and W=32). First, global average pooling is performed on F to obtain the global context vector. Each channel value of Z represents the average feature response of all spatial locations in that channel, reflecting the overall activation intensity of the current input image along that channel dimension. Next, Z is input into the first fully connected layer, whose weight matrix dimension is (C / r)×C and output dimension is C / r (in this embodiment, r is 4, so the output dimension is 128). After GELU activation, it is input into the second fully connected layer, whose weight matrix dimension is 2C×(C / r) and output dimension is 2C (i.e., 1024). The output is then split along the channel dimension into scaling and offset parameters. The input features are adaptively modulated sequentially through steps S32 and S33. After modulation, F3 and F4 are adjusted to F3mod and F4mod, respectively. When the input is a hazy image, the network learns... A smaller value indicates weaker modulation intensity, avoiding over-enhancement; when the input is a dense fog image. A larger value indicates stronger modulation and effectively improves dehazing capabilities. The deepest modulated feature F4mod from the HDA output will serve as the input bottleneck feature for the next step.
[0034] S4. The features modulated in step S3 are used as bottleneck features, and the bottleneck features are corrected by the physical guided feature decomposition module. The correction includes: estimating the spatial variation defogging intensity features related to the transmittance of the atmospheric scattering model and the bias features related to atmospheric light in the feature space, and performing physical guided correction on the bottleneck features according to the additive correction formula.
[0035] Specifically, this invention uses an atmospheric scattering model as its physical basis. For an input degraded image, the imaging degradation process can be expressed as: ; in, This indicates the acquired degraded image. This represents an ideally clear image when there is no smog. Indicates the transmittance of the medium. Represents global atmospheric light. Indicates pixel position; Transmittance The formula can be expressed as: ; in, This represents the scattering coefficient, which is related to the concentration of smoke, water vapor, or haze. Indicates scene depth.
[0036] Combining the degradation process formula and the transmittance formula above, an ideal clear image can be obtained when there is no smog. The formula is: ; The above equation shows that an ideal, sharp image can be considered as a degraded image plus a correction term. This correction term is determined by two parts: one is a dehazing intensity term related to transmittance. Secondly, the deviation between the observed image and atmospheric light. .
[0037] This invention extends the aforementioned physical reconstruction relationship to the space (i.e., feature space) comprised of deep features extracted by convolutional neural networks. Bottleneck features in this feature space do not directly estimate the transmittance in the image domain (pixel space). and global atmospheric light Instead, it estimates the dehazing intensity features separately in this feature space. and bias characteristics The corrected features are obtained by using additive correction, i.e., the additive correction formula in step S4 is expressed as: ; in, Bottleneck characteristics These are the features after physical guidance and correction. The spatially varying defogging intensity characteristics, This refers to the bias characteristics related to atmospheric light. This represents element-wise multiplication. These are learnable gating parameters.
[0038] This invention transfers the physical reconstruction relationship of the atmospheric scattering model from the pixel space to a feature space composed of deep features extracted by a convolutional neural network. Additive correction terms corresponding to the physical model are directly constructed in the feature space, eliminating the need for explicit physical parameter estimation and inverse operations in the pixel domain. This maintains physical interpretability while improving network processing efficiency and end-to-end training convenience. Compared to physical-guided dehazing methods that use division (e.g., dividing features by transmittance features), this invention uses additive correction to obtain corrected features, avoiding direct division by transmittance features. This avoids problems such as numerical amplification, gradient explosion, and local artifact enhancement caused by excessively small or unstable transmittance estimates, significantly reducing the risk of numerical divergence during model training and inference, and improving the overall stability and robustness of the model.
[0039] Furthermore, the learnable gating parameters Initialized to 0, the Physically Guided Feature Decomposition Module (PFDM) is equivalent to the identity mapping in the early stages of training, i.e. This avoids the interference or damage caused by randomly initialized physical branches to the feature representations already learned by the backbone network in the early stages of training; as the training progresses, the learnable gating parameters... By gradually learning appropriate values, the physical guidance correction branch intervenes smoothly, ensuring both stability in the early stages of training and effectiveness in later stages. The combined effect of these designs achieves a good balance between physical interpretability, training stability, and dehazing performance, making it particularly suitable for industrial vision inspection scenarios with high requirements for stability and reliability.
[0040] S5. The features corrected in step S4 are upsampled using the decoder. During the upsampling process, the multi-scale features extracted by the encoder in step S2 are fused through skip connections to gradually restore the spatial resolution.
[0041] Preferably, the skip connection fusion method in step S5 is as follows: the features upsampled by the decoder are concatenated with the corresponding layer features of the encoder in the channel dimension, and then fused through a convolutional layer.
[0042] Specifically, in the encoder-decoder structure, shallow encoded features contain rich edge, texture, and spatial details, while deep features contain stronger semantic and global degradation information. Traditional NAFNet often uses element-wise addition to fuse skip connection features, which has limited expressive power and struggles to fully learn the complex relationships between features at different scales. This invention employs a Cat+Conv fusion method, concatenating decoder upsampled features with corresponding encoder features along the channel dimension, and then fusing the features through a 1×1 convolution. This approach enables the network to adaptively learn the fusion weights for multi-scale features, which is beneficial for recovering edges, textures, contours, equipment details, and distant structures in industrial images.
[0043] For example, the decoder contains four upsampling stages, each with a block count of [2, 2, 2, 2], and the base channel count gradually decreases from 512 to 64. Each upsampling stage first restores resolution through deconvolution or bilinear interpolation with a stride of 2. For the upsampled feature U of the current layer in the decoder and the corresponding layer feature E in the encoder (e.g., the third stage of the decoder corresponds to the second stage F2 of the encoder), the following is performed: concatenate U and E along the channel dimension to obtain... Then, the number of channels is compressed from 2C back to C through 1×1 convolution to obtain the fused features, where U represents the feature map after upsampling in the current stage of the decoder; E represents the feature map output by the corresponding layer of the encoder; C represents the number of channels in a single feature map; H represents the height of the feature map, i.e. the vertical dimension of the spatial resolution; and W represents the width of the feature map, i.e. the horizontal dimension of the spatial resolution. This indicates the space where the spliced feature map is located.
[0044] S6. By using global residual connections, the decoder output features are added to the input image to be dehazed to obtain a dehazed enhanced image.
[0045] The network ultimately outputs the learned residual image, which is then added to the input degraded image to obtain the dehazed enhanced image. This dehazed image can be used as preprocessing input for subsequent tasks such as industrial visual inspection, target recognition, defect detection, and positioning measurement.
[0046] Example 2 An adaptive image dehazing system based on fog density includes: The acquisition module is used to acquire degraded images. This module is configured to acquire degraded images in industrial visual inspection scenarios and can be deployed on visual acquisition devices such as industrial cameras, inspection robots, fixed monitoring equipment or drone inspection equipment.
[0047] The preprocessing module is used to preprocess the degraded image to obtain the input image to be dehazed; this module receives the degraded image output by the acquisition module, performs preprocessing such as normalization, size cropping, filling or scaling on the degraded image, and outputs the input image to be dehazed.
[0048] The encoder module is used to perform multi-scale feature extraction on the input image to be dehazed, and obtain multi-scale features including at least shallow features and deep features. The module is built based on NAFNet (Nonlinear Activation Free Network) and contains multiple downsampling stages. Each stage consists of several PDNAFBlock or NAFNet basic blocks. It is used to extract multi-scale features from shallow texture to deep semantics layer by layer from the input image to be dehazed, and output at least shallow features and deep features.
[0049] A fog density adaptive module, located in the deep feature processing stage of the encoder module, is used to modulate the deep features. The modulation includes: generating at least one modulation parameter based on the global context information of the deep features, the value of the modulation parameter being constrained within a preset bounded range, and using the modulation parameter to perform channel-level adaptive transformation on the deep features. This module, located in the deep feature processing stage of the encoder module, includes a global average pooling layer, a fully connected layer, a splitting unit, and a bounded constraint unit. It is used to generate bounded channel-level scaling parameters and offset parameters based on the global context information of the deep features, and to use learnable gating parameters to perform channel-level adaptive transformation on the deep features, outputting the modulated deep features.
[0050] A physically guided feature decomposition module is used to receive the features modulated by the fog concentration adaptive module as bottleneck features and to correct the bottleneck features. The correction includes: estimating the spatially varying defogging intensity features related to the transmittance of the atmospheric scattering model and the bias features related to atmospheric light in the feature space, and performing physically guided correction on the bottleneck features according to the additive correction formula. This module is located after the bottleneck layer between the encoder module and the decoder module. It includes a defogging intensity branch and an atmospheric bias branch. It is used to receive the deepest-level features modulated by the fog concentration adaptive module as bottleneck features, estimate the spatially varying defogging intensity features and the channel-level atmospheric bias features in the feature space, and perform physically guided correction on the bottleneck features according to the additive correction formula, and output the corrected features.
[0051] The decoder module is used to upsample the features corrected by the physical guided feature decomposition module. During the upsampling process, the multi-scale features extracted by the encoder module are fused through skip connections to gradually restore the spatial resolution. This module contains multiple upsampling stages. Each stage restores the spatial resolution through upsampling and uses the Cat+Conv skip connection fusion method to concatenate the upsampled features with the multi-scale features of the corresponding layer of the encoder module in the channel dimension and then perform convolution fusion to gradually restore the spatial resolution and output the reconstructed feature map.
[0052] The global residual connection module is used to add the output features of the decoder module to the input image to be dehazed, so as to obtain a dehazed enhanced image.
[0053] Example 3: A method for training a dehazing model, the training method comprising: The model parameters are constrained by a total loss function, which is composed of pixel domain loss and frequency domain loss. The frequency domain loss is used to constrain the consistency of the predicted dehazed image and the clear ground truth image in the frequency amplitude spectrum.
[0054] Specifically, to simultaneously improve pixel reconstruction accuracy and frequency domain detail recovery capability, this invention employs a joint constraint of Charbonnier loss and FFT (Fast Fourier Transform) frequency loss. A total loss function is used to constrain model parameters; this total loss function is composed of pixel domain loss and frequency domain loss, where the frequency domain loss is used to constrain the consistency of the predicted dehazed image and the clear ground truth image in the frequency amplitude spectrum.
[0055] Charbonnier loss is an improved pixel-level loss function, which can be viewed as a smooth approximation of the traditional L1 loss. It is defined as follows: ; in, This represents the predicted dehazed image; Represents a clear truth image; For stability, a value of 10 is preferred. -3 ; Let $\mathematical expectation$ represent the average pixel error across all pixel locations within a single image, where the pixel error is calculated from the predicted dehazed image at the same coordinates. With clear truth image The pixel difference is calculated.
[0056] Compared to ordinary L1 loss In comparison, Charbonnier loss maintains differentiability and smoothness as the error approaches zero, providing more refined gradient information for small errors, which helps the network recover more detailed textures and edges in the later stages of training. At the same time, it retains the advantage of L1 loss's robustness to outliers (such as noise and artifacts) and avoids the problem of L2 loss (mean squared error) over-penalizing outliers, which leads to over-smoothing of the image.
[0057] To recover high-frequency details (such as edges, textures, and structural contours) obscured by smoke, water vapor, and haze, this invention introduces frequency domain loss. Its definition is: ; in, This represents the Fast Fourier Transform, used to transform an image from pixel space to frequency space; This indicates taking the amplitude spectrum, that is, calculating the amplitude of each frequency component; express Norm, which is the sum of the absolute values of the amplitude differences over all frequency positions.
[0058] The total loss function directly constrains the predicted dehazed image to maintain consistency with the clear ground truth image across the amplitude spectrum of each frequency component, ensuring that the network not only focuses on the overall brightness at low frequencies (mainly composed of...). (Constraints) and also focus on the restoration of high-frequency details, which helps to restore fine structures such as edges and textures.
[0059] This invention employs a two-stage progressive training strategy. The first stage trains at a smaller crop size, enabling the model to quickly learn basic dehazing mapping relationships. The second stage switches to a larger crop size for fine-tuning, allowing the model to gain a larger receptive field and further restore image details and global structure. The first stage uses a 256×256 image crop size for training, and the second stage uses a 384×384 image crop size for fine-tuning. During training, data augmentation techniques such as random cropping, horizontal flipping, and rotations of 90°, 180°, and 270° can be used to improve the model's generalization ability to different shooting angles, scene structures, and degradation patterns.
[0060] For example: The ITS (indoor training set) and OTS (outdoor training set) of the RESIDE (real single-image dehazing) public dataset are used as the training set, and the indoor and outdoor subsets of the SOTS (synthetic objective test set) are used as the validation set. The total loss function is... ,in Set the value to 0.1. During the training process, Loss of stable terms Take 10 -3 The optimizer uses AdamW (Adaptive Moment Estimation Weight Decay Optimizer) with an initial learning rate of 1×10⁻⁶.-3 Weight decay 1×10 -4 Cosine annealing learning rate scheduling is employed. The specific parameters for progressive training are: Phase 1: cropping size 256×256, batch size 8, training for 50 epochs; Phase 2: loading the weights from Phase 1, upgrading the cropping size to 384×384, batch size 4, and reducing the learning rate to 1×10⁻⁶. -4 Fine-tuning was performed for 20 epochs. Data augmentation included random horizontal flips and random rotations (90°, 180°, 270°). After training using the above method, the PSNR (Peak Signal-to-Noise Ratio) reached 36.51 dB on the SOTS indoor test set and exceeded 30 dB on the SOTS outdoor test set.
[0061] Figure 2 This is a comparison chart of the defogging effects of PHNAFNet (Physically Guided Fog Concentration Adaptive Nonlinear Activated Free Network) and existing defogging methods on the SOTS (Synthetic Objective Test Set) test set in this embodiment of the invention.
[0062] Each column in the figure, from left to right, represents: the hazy input image, DCP (Dark Channel Prior, a traditional dehazing method based on statistical priors), the base model (i.e., the NAFNet base network without the PFDM and HDA modules of this invention), the method of this invention, and the clear ground truth image (the original clean reference image completely free of haze). Each image is labeled with its corresponding PSNR (Peak Signal-to-Noise Ratio) value (unit: dB) to objectively evaluate the image restoration quality of each method; a higher PSNR value indicates a better dehazing effect. The clear ground truth image in the rightmost column has a pixel error of 0, and theoretically, its PSNR would approach infinity, so it is not labeled.
[0063] Figure 2 The defogging comparison results for four different scenarios are presented. As can be seen from the figures, the PSNR values of the PHNAFNet of this invention reach 37.62dB, 35.79dB, 30.44dB and 36.51dB respectively, which are much higher than those of the DCP method (15.63dB, 13.95dB, 10.25dB and 11.60dB) and significantly higher than those of the basic model method (26.21dB, 26.82dB, 23.63dB and 32.91dB). This proves that the present invention has excellent defogging performance and quantitative advantages in both indoor (fourth row is the indoor scene) and outdoor scenes.
[0064] Figure 3This figure compares the dehazing performance of PHNAFNet (Physically Guided Fog Concentration Adaptive Nonlinear Activation Free Network) and existing dehazing methods in multiple real-world scenarios, comprehensively verifying the dehazing performance and generalization ability of this invention under different degradation levels and scene types. The figure has six columns horizontally, labeled from left to right as Sample 1 to Sample 6, corresponding to test samples in six different real-world scenarios; and five rows vertically, from top to bottom: foggy input image, DCP (Dark Channel Prior, a traditional dehazing method based on statistical priors), base model (i.e., the NAFNet base network without the PFDM and HDA modules of this invention), PFDM+HDA (i.e., simultaneously incorporating the physically guided feature decomposition module and the fog concentration adaptive module but without all optimizations such as Cat+Conv), and the method of this invention (complete solution). The following information can be gleaned from the figure: The PHNAFNet of this invention has the best visual effect among all comparison methods. It not only effectively removes haze from the image, but also restores the outline of the distant view, the outline of the foreground view, the edges of buildings, the texture of vegetation and the naturalness of colors. The clarity and contrast of the dehazed image are close to those of a real fog-free scene, which verifies the superiority of this invention in cross-domain generalization scenarios.
[0065] Figure 4 This image shows a comparison of the dehazing effects of PHNAFNet (Physically Guided Fog Concentration Adaptive Nonlinear Activation Free Network) in various industrial scenarios under different influencing factors, as described in this invention. The image has four horizontal columns, from left to right: towers, urban infrastructure, outdoor roads, and urban buildings, representing typical industrial outdoor visual inspection scenarios of different categories. It also has two vertical rows: the top row (with foggy input image) shows the original industrial scene image degraded by smoke, water vapor, or haze; the bottom row shows the enhanced image after dehazing using the method of this invention. The following information can be gleaned from the image: (1) Tower (Column 1): The input image has obvious haze obscuring the view, the outline of the distant tower structure is blurred, the edges of the skyline buildings are unclear, and the overall contrast is low. After the PHNAFNet dehazing process of this invention, the tower structure and outline edges become clear and sharp, the outlines of buildings in the city skyline are restored, the details of the distant structure are clearly distinguishable, and the overall contrast and clarity of the image are significantly improved.
[0066] (2) Urban supporting facilities (column 2): The outdoor roads in the input image are affected by fog and dust, resulting in blurred edges and low color saturation. After the defogging process of this invention, the structural outline of the urban supporting facilities is significantly enhanced.
[0067] (3) Outdoor Roads (Column 3): The input image contains varying degrees of moisture obscuring the view, blurring the outlines of buildings on both sides of the outdoor road and the direction of road extension, making distant structures difficult to discern. After defogging processing by this invention, the overall clarity of the outdoor road scene is significantly improved, and the details of building facades, road markings, and distant structures are effectively restored, resulting in natural colors and distinct layers in the image.
[0068] (4) City Buildings (Column 4): The input image of city buildings is blurred due to dust, and the edges of the city buildings are not clear. After the defogging process of this invention, the main structure outline of the city buildings is clear.
[0069] (5) Comprehensive comparative analysis: In all four typical industrial outdoor scenarios, the PHNAFNet of the present invention can effectively remove image degradation caused by haze, fog, water vapor and dust, restore the outline of distant structure and the details of near structure. The overall contrast, color saturation and detail visibility of the defogging image are significantly improved, and there are no obvious artifacts or color distortion.
[0070] according to Figures 2 to 4 This invention, PHNAFNet, demonstrates that it can effectively improve the visual quality of degraded images in industrial scenes. It can provide clearer and more identifiable preprocessing inputs for subsequent industrial visual inspection tasks (such as target detection, defect identification, equipment status monitoring, positioning measurement, and anomaly early warning), and has practical industrial deployment value and broad application prospects.
[0071] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0072] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first" and "second" may explicitly or implicitly include one or more of that feature.
[0073] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the invention should be included within the scope of protection of the invention.
Claims
1. A method for image defogging with adaptive fog concentration, characterized in that, The method includes the following steps: S1. Acquire the degraded image and preprocess the degraded image to obtain the input image to be dehazed; S2. Use an encoder to extract multi-scale features from the input image to be dehazed, and obtain multi-scale features that include at least shallow and deep features; S3. In the deep feature processing stage of the encoder, the deep features are modulated by the fog density adaptive module. The modulation includes: generating at least one modulation parameter based on the global context information of the deep features. The value of the modulation parameter is constrained within a preset bounded range. The deep features are then subjected to channel-level adaptive transformation using the modulation parameter. S4. The features modulated in step S3 are used as bottleneck features, and the bottleneck features are corrected by a physical guided feature decomposition module. The correction includes: estimating the spatial variation dehazing intensity features related to the transmittance of the atmospheric scattering model and the bias features related to atmospheric light in the feature space, and performing physical guided correction on the bottleneck features according to the additive correction formula, which is expressed as: ; wherein, is a bottleneck feature, is a feature corrected by physical guidance, is the spatially varying dehazing strength feature, is the atmospheric light related bias feature, denotes element-wise multiplication, is a learnable gating parameter; S5. The features corrected in step S4 are upsampled using the decoder. During the upsampling process, the multi-scale features extracted by the encoder in step S2 are fused through skip connections to gradually restore the spatial resolution. S6. By using global residual connections, the decoder output features are added to the input image to be dehazed to obtain a dehazed enhanced image.
2. The method of claim 1, wherein the method further comprises: The physical guided feature decomposition module includes: a dehazing intensity branch for generating a dehazing intensity feature adapted to local spatial variations of the image based on the bottleneck feature ; an atmospheric bias branch for generating a bias feature characterizing a channel-level atmospheric light correlation of a global fog-dust background based on the bottleneck feature .
3. The method of claim 1, wherein the image dehazing method is self-adaptive to the haze concentration. In step S3, the fog concentration adaptive module performs the following operations: Global average pooling is performed on the input features to obtain the global context vector; processing the global context vector through at least one fully connected layer and splitting into scaling parameters and bias parameters ; scaling parameters by bounded functions constrained to the interval [0,2] and the offset parameters constrained to the interval [-0.1,0.1] The input features are adaptively modulated according to the following feature modulation formula: ; wherein, is a bottleneck feature, is a learnable gating parameter, and is initialized to 0.
4. The method of claim 1, wherein the image dehazing method is self-adaptive to the haze density. The skip connection fusion method in step S5 is as follows: the features upsampled by the decoder are concatenated with the corresponding layer features of the encoder in the channel dimension, and then fused through a convolutional layer.
5. The method of claim 1, wherein the image dehazing method is self-adaptive to the haze density. The preprocessing in step S1 includes: normalizing the degraded image to a data range that the neural network can process, and performing size cropping, padding, or scaling according to the network input requirements.
6. A haze concentration adaptive image defogging system, characterized in that, include: The acquisition module is used to acquire degraded images; The preprocessing module is used to preprocess the degraded image to obtain the input image to be dehazed; The encoder module is used to perform multi-scale feature extraction on the input image to be dehazed, to obtain multi-scale features that include at least shallow and deep features; A fog density adaptive module is set in the deep feature processing stage of the encoder module and is used to modulate the deep features. The modulation includes: generating at least one modulation parameter based on the global context information of the deep features, the value of the modulation parameter being constrained within a preset bounded range, and using the modulation parameter to perform channel-level adaptive transformation on the deep features. The physical-guided feature decomposition module is used to receive the features modulated by the fog concentration adaptive module as bottleneck features and to correct the bottleneck features. The correction includes: estimating the spatial variation defogging intensity features related to the transmittance of the atmospheric scattering model and the bias features related to atmospheric light in the feature space, and performing physical-guided correction on the bottleneck features according to the additive correction formula. The decoder module is used to upsample the features corrected by the physical guidance feature decomposition module. During the upsampling process, the multi-scale features extracted by the encoder module are fused through skip connections to gradually restore the spatial resolution. The global residual connection module is used to add the output features of the decoder module to the input image to be dehazed, so as to obtain a dehazed enhanced image.
7. A method for training a defogging model, the method comprising: The training method includes: The model parameters are constrained by a total loss function, which is composed of pixel domain loss and frequency domain loss. The frequency domain loss is used to constrain the consistency of the predicted dehazed image and the clear ground truth image in the frequency amplitude spectrum.
8. The training method of claim 7, wherein, The total loss function is expressed as: ; wherein, represents the pixel domain loss, represents the frequency domain loss, is the frequency domain loss weight.
9. The training method according to claim 8, characterized in that, The pixel domain loss Defined as: ; in, This represents the predicted dehazed image; Represents a clear truth image; It is a stable term; The mathematical expectation represents the average value of the pixel error corresponding to all pixel positions within a single image; The frequency domain loss Defined as: ; in, Represents the Fast Fourier Transform. Indicates taking the amplitude spectrum. express Norm.
10. The training method according to claim 9, characterized in that, The training method employs a progressive two-stage training strategy: the first stage involves training at a first image cropping size, and the second stage involves fine-tuning at a second image cropping size that is larger than the first image cropping size.