Intelligent monitoring image defogging method and system based on coring attention
By improving the atmospheric light scattering model and designing a nuclear attention module, combining the loss function training network, the existing defog removal method solves the haze residue and computational complexity problems in real haze scenarios, and achieves strong scene adaptability and Efficient fog removal effect.
Patent Information
- Application Number
- CN202310833436.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-07
- Publication Date
- 2025-01-07
AI Technical Summary
The existing fog removal method has problems of haze residue, artifacts and color shift in real haze scenarios, and the calculation complexity is high, making it impossible to effectively deal with haze areas of different densities and depths.
Using the intelligent monitoring image defog method based on nuclear attention, we construct a paired data set of haze images and clear images by improving the atmospheric light scattering model, and design a shallow feature extraction layer and a local-global nuclear attention module. Training is carried out in combination with mean square error, edge and Gaussian nuclear perception comparison loss function to form a nuclear attention defogging network.
In intelligent monitoring scenarios, haze of different densities and depths is significantly removed, which improves scene adaptability and fog removal effect, reduces haze residues and artifacts, and obtains more natural fog removal results.
Smart Images

Figure CN119273581A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of image processing and computer vision, and in particular to an intelligent monitoring image defogging method and system based on kernelized attention. Background Art
[0002] As one of the key applications of artificial intelligence theory and technology, intelligent monitoring technology has made great progress and has increasingly become a key technology in various fields. Among them, in intelligent monitoring scenarios, how to effectively improve the quality of visual imaging and enhance picture details and clarity has become one of the key and difficult problems faced by researchers. The imaging problem in intelligent monitoring scenarios is mainly manifested in the improvement of imaging quality under severe weather and environmental conditions, among which image restoration in complex environments with foggy weather is the main scientific problem.
[0003] In complex dynamic scenes of intelligent road traffic monitoring, dehazing real haze images still faces major challenges. The dual complexity of haze distribution is manifested in the interference of haze on global image information on the one hand, and the imbalance of image brightness and color caused by random haze distribution on the other hand. In natural scenes with prominent edge and texture features, the above problems may lead to serious degradation of image quality and performance of various tasks. In the past decade, the technology of restoring degraded images in foggy weather has made great progress through the joint efforts of many researchers, which has greatly improved the performance of dehazing methods. Existing dehazing methods can be roughly divided into methods based on prior statistics and methods based on deep learning.
[0004] One of the current existing technologies is a feature fusion attention dehazing network in the paper "Ffa-net: Feature fusion attention network for single image dehazing", which models the unevenly distributed haze from the channel direction and pixel direction to achieve image haze removal. It designs a feature attention (FA) module that combines channel attention (Channel Attention) with pixel attention (Pixel Attention). This module can adaptively process different features and pixels considering that different channel features contain different weighted information and the uneven distribution of haze on different image pixels. The disadvantage of this technology is that although the channel pixel attention group structure designed by it obtains excellent dehazing performance indicators on the synthetic haze dataset, it cannot effectively process haze areas with different densities and depths when processing haze images in real scenes, resulting in haze residues in the dehazed image. In addition, since the dehazing method introduces too many channel pixel attention group structures (57 feature fusion blocks), the computational complexity is relatively large.
[0005] The second existing technology is an end-to-end feedback spatial attention dehazing network in the paper "Fsad-net: Feedback spatial attention dehazing network", which can pass the input haze image through multiple loop iterations of the network to obtain the final haze-free output. By introducing a recursive structure and an iterative algorithm, a recurrent network structure is proposed. The network does not rely on the atmospheric light scattering model, but instead uses a feedback module built using a spatial residual attention mechanism to pass high-level information back to the previous layer to correct the feature representation. The disadvantage of this technology is that although the recursive structure and iterative algorithm are introduced into the dehazing network, and the spatial attention mechanism and jump connection are used to focus on the inherent spatial correlation between features. However, this method is still not scene-adaptive when processing haze images in complex scenes. Summary of the invention
[0006] The purpose of the present invention is to overcome the shortcomings of existing methods and propose an intelligent surveillance image defogging method and system based on kernelized attention. The main problem solved by the present invention is how to combine the advantages of kernel learning and deep learning to solve the problems of haze residue, artifacts and color shift in existing general defogging methods in real haze scenes.
[0007] In order to solve the above problems, the present invention proposes an intelligent surveillance image defogging method based on kernelized attention, the method comprising:
[0008] By improving the atmospheric light scattering model, a paired dataset of haze images and corresponding clear images is constructed for training the kernelized attention dehazing network.
[0009] The kernelized attention dehazing network structure is designed. The network is mainly divided into three parts: first, in order to obtain the shallow features of the input haze image, a shallow feature extraction layer is designed; second, in order to capture the haze-related feature information of different depths and densities in the real haze image, a local-global kernelized attention module is designed; finally, a convolution operation is used to restore the dehazed result image;
[0010] Three loss functions are used, namely: selecting a mean square error loss function to measure the similarity between the defogging result image and the clear sample image, introducing an edge loss function to maintain the detail information of the image, and designing a Gaussian kernel perceptual contrast loss function to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image; using the paired data set, the kernelized attention defogging network is trained using the above three loss functions to update it in the natural direction of defogging, forming a trained kernelized attention defogging network;
[0011] The user inputs the haze image to be processed into the trained kernelized attention dehazing network to obtain a restored clear image.
[0012] Preferably, the method of constructing a paired data set of haze images and corresponding clear images by improving the atmospheric light scattering model is specifically as follows:
[0013] The construction process is described by the following formula:
[0014]
[0015] Where I represents the haze image to be synthesized, J is the clear image used to synthesize I, γ is the constraint factor used to adjust the brightness of the generated haze image, d represents the scene depth, A is the atmospheric light value, and β is the random coefficient.
[0016] Preferably, the shallow feature extraction layer is specifically:
[0017] In the shallow feature extraction layer, the cascade attention module is introduced to perform shallow feature extraction on the input haze image. The output feature y of the cascade attention module is described by the following formula:
[0018] y=(y 1 ⊙x+x)⊙y 2 +x, (2)
[0019] in, h, w, c represent the height, width and number of channels of the input features respectively, ⊙ represents the dot multiplication operation of the matrix, x represents the input haze image, y 1 and 2 It represents the features extracted in the middle process of constructing the cascade attention module and is solved by the following formula:
[0020]
[0021] Among them, Conv 1 , Conv 2 They represent convolution operations with different convolution kernel sizes respectively; BN and ReLU represent normalization operation and ReLU activation function respectively.
[0022] Preferably, the local-global based kernelized attention module is specifically:
[0023] The local-global kernelized attention module first uses the random mapping features in the Gaussian kernel Fourier domain to perform a low-dimensional explicit representation of the high-order nonlinear feature information in the input feature map; the input feature y obtained by the shallow feature extraction layer is estimated on each channel using a low-dimensional explicit mapping function z(y) i ,y j), whose formula is as follows:
[0024]
[0025] Where σ represents the size of the Gaussian kernel used, and z represents the number of kernels used to estimate the given Gaussian kernel G(y i ,y j ) is a low-dimensional explicit mapping function, y i ,y j Respectively represent the i-th and j-th components of the input feature y;
[0026] According to Bochner's theorem, the Gaussian kernel G(y i ,y j ) in the original implicit space dimension Upper positive definite if and only if G(y i ,y j ) is the Fourier transform of a non-negative measure p(s); thus, the following derivation formula is obtained:
[0027]
[0028] in, represents the weight parameter sampled from the non-negative measure p(s), c and D represent the channel dimension sampling dimensions, u represents the imaginary part, and T represents the transpose;
[0029] From Euler's formula, we know that
[0030] exp(us T (y i -y j ))=cos(s T (y i -y j ))-usin(s T (y i -y j )), (6)
[0031] The Gaussian kernel used here is a real kernel, so the complex part of equation (6) is 0, and equation (6) is then simplified to the following form:
[0032] exp(us T (y i -y j ))=cos(s T (y i -y j )), (7)
[0033] Thus, the transformed form of formula (5) is obtained:
[0034]
[0035] Based on the above derivation, the expression of random Fourier features is obtained: b d represents the bias parameter and b d ∈[b 1 , …, b D ] comes from a uniform distribution U [0,2π] ;
[0036] Sample from the following formula:
[0037]
[0038] in is an integral variable that models channel dependencies from both a global and local perspective while retaining the spatial structure information of the input feature y:
[0039] After obtaining the random Fourier features z(y) of the input feature map, global average pooling is first used to convert the global spatial information in the channel direction into a channel description:
[0040]
[0041] where y c (i, j) represents the Cth channel y at position (i, j) c The value of H g is the global pooling function; the shape of the random Fourier feature z(y) changes from c×h×w to c×1×1; in order to obtain global features, a 1×1 convolution layer and a ReLU activation function layer are used, and the solution process is as follows:
[0042]
[0043] G c Represents the channel feature information obtained using the global average pooling operation, Represents global channel feature information;
[0044] In addition, considering the uneven distribution of haze on image pixels, the channel dependency is modeled from a local perspective so that the network can pay more attention to discriminative areas and highlight effective informative features. The process of modeling local channel features is as follows:
[0045]
[0046] Among them, Conv 1×1 , ReLU, BN represent 1×1 convolution layer, ReLU activation function layer, and normalization layer respectively. Represents local channel feature information;
[0047] By combining equations (11) and (12) to model the channel dependency between the global and local features of the input feature map, the channel feature response is adaptively reweighted; then the output of each kernelized attention module is Obtained by the following formula:
[0048]
[0049] in, Represents a matrix multiplication operation;
[0050] Through the above method, the kernelized attention module focuses on the discriminative haze areas in the feature map and highlights the effective haze-related feature information.
[0051] Preferably, the mean square error loss function is selected to measure the similarity between the defogging result image and the clear sample image, the edge loss function is introduced to maintain the detail information of the image, and a Gaussian kernel perceptual contrast loss function is designed to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image, specifically:
[0052] First, the mean square error loss function is selected to measure the similarity between the dehazed result image and the clear sample image, and its expression is:
[0053]
[0054] where y pre is the predicted dehazed result image, and J represents the clear sample image label.
[0055] Using only the mean square error loss usually makes the image too smooth and causes background blur, so the edge loss function is introduced to maintain the detail information of the image; the edge loss function is defined as follows:
[0056]
[0057] Where δ represents the Laplace operator and ε is an empirical value; the Laplace operator captures the edge information of the image through the second-order differential; the edge loss preserves the details of the haze image by minimizing the difference in edge information between the dehazed result image and the clear sample image label;
[0058] In addition, in order to obtain a more natural dehazing effect, a Gaussian kernel-aware contrast loss function is designed to constrain the dehazing result image restored by the network to be closer to the clear sample image and further away from the haze image. The target loss function can be expressed as follows:
[0059]
[0060] in and Respectively represent the distance between the positive sample pair and the negative sample pair in the metric space, L g is the output value of Gaussian kernel perceptual contrast loss, represents the kth hidden layer feature extracted from the fixed pre-trained model VGG-19, ρ k represents the weight coefficient, ω is the penalty parameter;
[0061] In summary, the total loss function is defined as the weighted sum of the mean square error loss and the margin loss:
[0062] L=αL MSE +βL edge +L g , (17)
[0063] Among them, α and β represent weights respectively.
[0064] Accordingly, the present invention also provides an intelligent surveillance image defogging system based on kernelized attention, comprising:
[0065] The dataset construction unit is used to construct a paired dataset of haze images and corresponding clear images by improving the atmospheric light scattering model, which is used for training the kernelized attention dehazing network;
[0066] The defogging network construction unit is used to design the kernelized attention defogging network structure. The network is mainly divided into three parts: first, in order to obtain the shallow features of the input haze image, a shallow feature extraction layer is designed; second, in order to capture the haze-related feature information of different depths and densities in the real haze image, a local-global kernelized attention module is designed; finally, a convolution operation is used to restore the defogging result image;
[0067] The defogging network training unit is used to use three loss functions, namely: selecting a mean square error loss function to measure the similarity between the defogging result image and the clear sample image, introducing an edge loss function to maintain the detail information of the image, and designing a Gaussian kernel perceptual contrast loss function to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image; using the paired data set, using the above three loss functions to train the kernelized attention defogging network, so that it is updated in the natural direction of defogging, and forming a trained kernelized attention defogging network;
[0068] The defogging processing unit is used for the user to input the haze image to be processed into the trained kernelized attention defogging network to obtain a restored clear image.
[0069] The implementation of the present invention has the following beneficial effects:
[0070] The present invention can remove haze of different densities and depths in intelligent monitoring scenes such as road traffic applications, with strong scene adaptability and obvious defogging effect. The constructed kernelized attention module uses random feature mapping in the Gaussian kernel Fourier domain, which has the advantage that these random features can benefit from the high resolution ability of high-dimensional or infinite-dimensional feature space, thereby helping the kernelized attention module to focus on more discriminative haze areas in the feature map. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is an overall flow chart of an intelligent monitoring image defogging method based on kernelized attention according to an embodiment of the present invention;
[0072] Figure 2 This is a diagram of the structure of a kernelized attention defogging network according to an embodiment of the present invention;
[0073] Figure 3 is a structural diagram of a cascaded attention module according to an embodiment of the present invention;
[0074] Figure 4 is a structural diagram of a cored attention module according to an embodiment of the present invention;
[0075] Figure 5 It is a structural diagram of an intelligent surveillance image defogging system based on kernelized attention according to an embodiment of the present invention. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0077] Figure 1 is an overall flow chart of an intelligent monitoring image defogging method based on kernelized attention according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0078] S1, by improving the atmospheric light scattering model, constructs a paired dataset of haze images and corresponding clear images for training the kernelized attention dehazing network;
[0079] S2, design the kernelized attention dehazing network structure, which is mainly divided into three parts: first, in order to obtain the shallow features of the input haze image, a shallow feature extraction layer is designed; second, in order to capture the haze-related feature information of different depths and densities in the real haze image, a local-global kernelized attention module is designed; finally, a convolution operation is used to restore the dehazing result image;
[0080] S3, using three loss functions, namely: selecting the mean square error loss function to measure the similarity between the defogging result image and the clear sample image, introducing the edge loss function to maintain the image details, and designing a Gaussian kernel perceptual contrast loss function to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image; using the paired data set, using the above three loss functions to train the kernelized attention defogging network, so that it is updated in the natural direction of defogging, forming a trained kernelized attention defogging network;
[0081] S4, the user inputs the haze image to be processed into the trained kernelized attention dehazing network to obtain a restored clear image.
[0082] Step S1 is as follows:
[0083] The construction process is described by the following formula:
[0084]
[0085] Where I represents the haze image to be synthesized; J is the clear image used to synthesize I; γ is the constraint factor used to adjust the brightness of the generated haze image, and is uniformly sampled in the interval [0.2, 0.8]; d represents the scene depth; A is the atmospheric light value, uniformly selected from the interval [0.75, 0.9]; β is the random coefficient, randomly selected from the interval [0.1, 0.6].
[0086] Step S2, kernelized attention dehazing network structure is as follows Figure 2 As shown, the details are as follows:
[0087] S2-1, in the shallow feature extraction layer, introduce the cascade attention module. The structure of the cascade attention module is as follows Figure 3 As shown. The input haze image is subjected to shallow feature extraction, and the output feature y of the cascade attention module is described by the following formula:
[0088] y=(y 1 ⊙x+x)⊙y 2 +x, (2)
[0089] in, h, w, c represent the height, width and number of channels of the input features respectively, ⊙ represents the dot multiplication operation of the matrix, x represents the input haze image, y 1 and 2 It represents the features extracted in the middle process of constructing the cascade attention module and is solved by the following formula:
[0090]
[0091] Among them, Conv 1 , Conv 2 They represent convolution operations with different convolution kernel sizes respectively; BN and ReLU represent normalization operation and ReLU activation function respectively.
[0092] S2-2, design a local-global kernelized attention module. The structure of each kernelized attention module is as follows Figure 4 The module first uses the random mapping features in the Fourier domain of the Gaussian kernel to perform a low-dimensional explicit representation of the high-order nonlinear feature information in the input feature map; the input feature y obtained by the shallow feature extraction layer uses a low-dimensional explicit mapping function z(y) to estimate the given Gaussian kernel G(y) on each channel i ,y j ), whose formula is as follows:
[0093]
[0094] Where σ represents the size of the Gaussian kernel used, and z represents the number of kernels used to estimate the given Gaussian kernel G(y i ,y j ) is a low-dimensional explicit mapping function, y i ,y j Respectively represent the i-th and j-th components of the input feature y;
[0095] According to Bochner's theorem, the Gaussian kernel G(y i ,y j ) in the original implicit space dimension Upper positive definite if and only if G(y i ,y j ) is the Fourier transform of a non-negative measure p(s); thus, the following derivation formula is obtained:
[0096]
[0097] in, represents the weight parameter sampled from the non-negative measure p(s), c and D represent the channel dimension sampling dimensions, u represents the imaginary part, and T represents the transpose;
[0098] From Euler's formula, we know that
[0099] exp(us T (y i -y j ))=cos(s T (y i -y j ))-usin(s T (y i -y j)), (6)
[0100] The Gaussian kernel used here is a real kernel, so the complex part of equation (6) is 0, and equation (6) is then simplified to the following form:
[0101] exp(us T (y i -y j ))=cos(s T (y i -y j )), (7)
[0102] Thus, the transformed form of formula (5) is obtained:
[0103]
[0104] Based on the above derivation, the expression of random Fourier features is obtained: b d represents the bias parameter and b d ∈[b 1 , …, b D ] comes from a uniform distribution U [0,2π] ;
[0105] Sample from the following formula:
[0106]
[0107] in is an integral variable that models channel dependencies from both a global and local perspective while retaining the spatial structure information of the input feature y:
[0108] After obtaining the random Fourier features z(y) of the input feature map, global average pooling is first used to convert the global spatial information in the channel direction into a channel description:
[0109]
[0110] where y c (i, j) represents the Cth channel y at position (i, j) c The value of H g is the global pooling function; the shape of the random Fourier feature z(y) changes from c×h×w to c×1×1; in order to obtain global features, a 1×1 convolution layer and a ReLU activation function layer are used, and the solution process is as follows:
[0111]
[0112] G cRepresents the channel feature information obtained using the global average pooling operation, Represents global channel feature information;
[0113] In addition, considering the uneven distribution of haze on image pixels, the channel dependency is modeled from a local perspective so that the network can pay more attention to discriminative areas and highlight effective informative features. The process of modeling local channel features is as follows:
[0114]
[0115] Among them, Conv 1×1 , ReLU, BN represent 1×1 convolution layer, ReLU activation function layer, and normalization layer respectively. Represents local channel feature information;
[0116] By combining equations (11) and (12) to model the channel dependency between the global and local features of the input feature map, the channel feature response is adaptively reweighted; then the output of each kernelized attention module is Obtained by the following formula:
[0117]
[0118] in, Represents a matrix multiplication operation;
[0119] Through the above method, the kernelized attention module focuses on the discriminative haze areas in the feature map and highlights the effective haze-related feature information.
[0120] S2-3, output the predicted haze-free image y through the image restoration layer composed of convolution operations pre .
[0121] Step S3 is as follows:
[0122] First, the mean square error loss function is selected to measure the similarity between the dehazed result image and the clear sample image, and its expression is:
[0123]
[0124] where y pre is the predicted dehazed result image, and J represents the clear sample image label.
[0125] Using only the mean square error loss usually makes the image too smooth and causes background blur, so the edge loss function is introduced to maintain the detail information of the image; the edge loss function is defined as follows:
[0126]
[0127] Where δ represents the Laplace operator; ε is an empirical value, which is set to 0.001; the Laplace operator captures the edge information of the image through the second-order differential; the edge loss preserves the details of the haze image by minimizing the difference in edge information between the dehazed result image and the clear sample image label;
[0128] In addition, in order to obtain a more natural dehazing effect, a Gaussian kernel-aware contrast loss function is designed to constrain the dehazing result image restored by the network to be closer to the clear sample image and further away from the haze image. The target loss function can be expressed as follows:
[0129]
[0130] in and Respectively represent the distance between the positive sample pair and the negative sample pair in the metric space, L g is the output value of Gaussian kernel perceptual contrast loss, represents the kth hidden layer feature extracted from the fixed pre-trained model VGG-19, ρ k represents the weight coefficient, ω is the penalty parameter;
[0131] In summary, the total loss function is defined as the weighted sum of the mean square error loss and the margin loss:
[0132] L=αL MSE +βL edge +L g , (17)
[0133] Among them, α and β represent weights, and α=1 and β=0.2 are selected respectively according to experience.
[0134] Accordingly, the present invention also provides an intelligent surveillance image defogging system based on kernelized attention, such as Figure 5 As shown, including:
[0135] Dataset construction unit 1 is used to construct a paired dataset of haze images and corresponding clear images by improving the atmospheric light scattering model, which is used for training the kernelized attention dehazing network;
[0136] The defogging network construction unit 2 is used to design the kernelized attention defogging network structure. The network is mainly divided into three parts: first, in order to obtain the shallow features of the input haze image, a shallow feature extraction layer is designed; second, in order to capture the haze-related feature information of different depths and densities in the real haze image, a local-global kernelized attention module is designed; finally, a convolution operation is used to restore the defogging result image;
[0137] The defogging network training unit 3 is used to use three loss functions, namely: selecting a mean square error loss function to measure the similarity between the defogging result image and the clear sample image, introducing an edge loss function to maintain the detail information of the image, and designing a Gaussian kernel perceptual contrast loss function to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image; using the paired data set, using the above three loss functions to train the kernelized attention defogging network, so that it is updated in the natural direction of defogging, and a trained kernelized attention defogging network is formed;
[0138] The defogging processing unit 4 is used for the user to input the haze image to be processed into the trained kernelized attention defogging network to obtain a restored clear image.
[0139] Therefore, the present invention can remove haze of different densities and depths in intelligent monitoring scenes such as road traffic applications, with strong scene adaptability and obvious defogging effect. The constructed kernelized attention module uses random feature mapping in the Gaussian kernel Fourier domain, which has the advantage that these random features can benefit from the high resolution ability of high-dimensional or infinite-dimensional feature space, thereby helping the kernelized attention module to focus on more discriminative haze areas in the feature map.
[0140] The above is a detailed introduction to an intelligent surveillance image defogging method and system based on kernelized attention provided by an embodiment of the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An intelligent surveillance image defogging method based on kernelized attention, characterized in that: The method comprises: By improving the atmospheric light scattering model, a paired dataset of haze images and corresponding clear images is constructed for training the kernelized attention dehazing network. The kernelized attention dehazing network structure is designed. The network is mainly divided into three parts: first, in order to obtain the shallow features of the input haze image, a shallow feature extraction layer is designed; second, in order to capture the haze-related feature information of different depths and densities in the real haze image, a local-global kernelized attention module is designed; finally, a convolution operation is used to restore the dehazed result image; Three loss functions are used, namely: selecting a mean square error loss function to measure the similarity between the defogging result image and the clear sample image, introducing an edge loss function to maintain the detail information of the image, and designing a Gaussian kernel perceptual contrast loss function to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image; using the paired data set, the kernelized attention defogging network is trained using the above three loss functions to update it in the natural direction of defogging, forming a trained kernelized attention defogging network; The user inputs the haze image to be processed into the trained kernelized attention dehazing network to obtain a restored clear image.
2. The intelligent surveillance image defogging method based on kernelized attention as claimed in claim 1, characterized in that: The method constructs a paired dataset of haze images and corresponding clear images by improving the atmospheric light scattering model, specifically: The construction process is described by the following formula: Where I represents the haze image to be synthesized, J is the clear image used to synthesize I, γ is the constraint factor used to adjust the brightness of the generated haze image, d represents the scene depth, A is the atmospheric light value, and β is the random coefficient.
3. The intelligent surveillance image defogging method based on kernelized attention as claimed in claim 1, characterized in that: The shallow feature extraction layer is specifically: In the shallow feature extraction layer, the cascade attention module is introduced to perform shallow feature extraction on the input haze image. The output feature y of the cascade attention module is described by the following formula: y=(y1⊙x+x)⊙y2+x, (2) in, h, w, c represent the height, width and number of channels of the input features respectively, ⊙ represents the dot product operation of the matrix, x represents the input haze image, y1 and y2 represent the features extracted in the intermediate process of building the cascade attention module, which can be solved by the following formula: Among them, Conv1 and Conv2 represent convolution operations with different convolution kernel sizes respectively; BN and ReLU represent normalization operations and ReLU activation functions respectively.
4. The intelligent surveillance image defogging method based on kernelized attention as claimed in claim 1, characterized in that: The local-global kernelized attention module is specifically: The local-global kernelized attention module first uses the random mapping features in the Gaussian kernel Fourier domain to perform a low-dimensional explicit representation of the high-order nonlinear feature information in the input feature map; the input feature y obtained by the shallow feature extraction layer is estimated on each channel using a low-dimensional explicit mapping function z(y) i ,y j ), whose formula is as follows: Where σ represents the size of the Gaussian kernel used, and z represents the number of kernels used to estimate the given Gaussian kernel G(y i ,y j ) is a low-dimensional explicit mapping function, y i ,y j Respectively represent the i-th and j-th components of the input feature y; According to Bochner's theorem, the Gaussian kernel G(y i ,y j ) in the original implicit space dimension Upper positive definite if and only if G(y i ,y j ) is the Fourier transform of a non-negative measure p(s); thus, the following derivation formula is obtained: in, represents the weight parameter sampled from the non-negative measure p(s), c and D represent the channel dimension sampling dimensions, u represents the imaginary part, and T represents the transpose; From Euler's formula, we know that exp(us T (and i -and j ))=cos(s T (and i -and j ))-u without(s) T (and i -and j )), (6) The Gaussian kernel used here is a real kernel, so the complex part of equation (6) is 0, and equation (6) is then simplified to the following form: exp(us T (and i -and j ))=cos(s T (and i -and j )), (7) Thus, the transformed form of formula (5) is obtained: Based on the above derivation, the expression of random Fourier features is obtained: b d represents the bias parameter and b d ∈[b1,…,b D ] comes from a uniform distribution U [0,2π] ; Sample from the following formula: in is an integral variable that models channel dependencies from both a global and local perspective while retaining the spatial structure information of the input feature y: After obtaining the random Fourier features z(y) of the input feature map, global average pooling is first used to convert the global spatial information in the channel direction into a channel description: where y c (i, j) represents the Cth channel y at position (i, j) c The value of H g is the global pooling function; the shape of the random Fourier feature z(y) changes from c×h×w to c×1×1; in order to obtain global features, a 1×1 convolution layer and a ReLU activation function layer are used, and the solution process is as follows: G c Represents the channel feature information obtained using the global average pooling operation, Represents global channel feature information; In addition, considering the uneven distribution of haze on image pixels, the channel dependency is modeled from a local perspective so that the network can pay more attention to discriminative areas and highlight effective informative features. The process of modeling local channel features is as follows: Among them, Conv 1×1 , ReLU, BN represent 1×1 convolution layer, ReLU activation function layer, and normalization layer respectively. Represents local channel feature information; By combining equations (11) and (12) to model the channel dependency between the global and local features of the input feature map, the channel feature response is adaptively reweighted; then the output of each kernelized attention module is Obtained by the following formula: in, Represents a matrix multiplication operation; Through the above method, the kernelized attention module focuses on the discriminative haze areas in the feature map and highlights the effective haze-related feature information.
5. The intelligent surveillance image defogging method based on kernelized attention as claimed in claim 1, characterized in that: The mean square error loss function is selected to measure the similarity between the dehazed image and the clear sample image, the edge loss function is introduced to maintain the image details, and a Gaussian kernel perceptual contrast loss function is designed to constrain the dehazed image restored by the network to be closer to the clear sample image and further away from the haze image. Specifically: First, the mean square error loss function is selected to measure the similarity between the dehazed result image and the clear sample image, and its expression is: where y pre is the predicted dehazed result image, J represents the clear sample image label; Using only the mean square error loss usually makes the image too smooth and causes background blur, so the edge loss function is introduced to maintain the detail information of the image; the edge loss function is defined as follows: Where δ represents the Laplace operator and ε is an empirical value; the Laplace operator captures the edge information of the image through the second-order differential; the edge loss preserves the details of the haze image by minimizing the difference in edge information between the dehazed result image and the clear sample image label; In addition, in order to obtain a more natural dehazing effect, a Gaussian kernel-aware contrast loss function is designed to constrain the dehazing result image restored by the network to be closer to the clear sample image and further away from the haze image. The target loss function can be expressed as follows: in and Respectively represent the distance between the positive sample pair and the negative sample pair in the metric space, L g is the output value of Gaussian kernel perceptual contrast loss, represents the kth hidden layer feature extracted from the fixed pre-trained model VGG-19, ρ k represents the weight coefficient, ω is the penalty parameter; In summary, the total loss function is defined as the weighted sum of the mean square error loss and the margin loss: L=αL MSE +βL edge +L g , (17) Among them, α and β represent weights respectively.
6. An intelligent surveillance image defogging system based on kernelized attention, characterized in that: The system comprises: The dataset construction unit is used to construct a paired dataset of haze images and corresponding clear images by improving the atmospheric light scattering model, which is used for training the kernelized attention dehazing network; The defogging network construction unit is used to design the kernelized attention defogging network structure. The network is mainly divided into three parts: first, in order to obtain the shallow features of the input haze image, a shallow feature extraction layer is designed; second, in order to capture the haze-related feature information of different depths and densities in the real haze image, a local-global kernelized attention module is designed; finally, a convolution operation is used to restore the defogging result image; The defogging network training unit is used to use three loss functions, namely: selecting a mean square error loss function to measure the similarity between the defogging result image and the clear sample image, introducing an edge loss function to maintain the detail information of the image, and designing a Gaussian kernel perceptual contrast loss function to constrain the defogging result image restored by the network to be closer to the clear sample image and further away from the haze image; using the paired data set, using the above three loss functions to train the kernelized attention defogging network, so that it is updated in the natural direction of defogging, and forming a trained kernelized attention defogging network; The defogging processing unit is used for the user to input the haze image to be processed into the trained kernelized attention defogging network to obtain a restored clear image.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Haze image target detection model and algorithm
CN120259638A
Multi-source heterogeneous data alignment method and device
CN120541366A