Image deraining method and system based on frequency channel attention mechanism

The image rain removal method based on the frequency channel attention mechanism solves the problem of ignoring frequency domain features in the existing technology. It achieves more efficient rain streak removal and background retention by enhancing the feature subgraph through frequency components, and improves the rain removal method. Effect.

CN117893445BActive Publication Date: 2024-10-01GUANGZHOU MARITIME INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410078416.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-18
Publication Date
2024-10-01
Estimated Expiration
2044-01-18

AI Technical Summary

Technical Problem

Existing rain removal technology ignores the frequency domain features in the image, resulting in incomplete filtering of rain streaks and unsatisfactory rain removal effects.

Method used

The image rain removal method based on the frequency channel attention mechanism is used to obtain the initial rain-containing image, extract the feature map and divide it into multiple feature sub-images, calculate the frequency component of each feature sub-image, and enhance the feature sub-image based on the frequency component. , reconstruct the rain-removed image, retain the low-frequency background image, and remove the high-frequency rain streak information.

Benefits of technology

It improves the rain removal effect of the image, enhances the frequency domain features, achieves more accurate distinction between rain streaks and background, and improves the accuracy and effect of rain removal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117893445B_ABST
    Figure CN117893445B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and provides an image deraining method and system based on a frequency channel attention mechanism. The image deraining method based on the frequency channel attention mechanism includes: obtaining an initial rainy image; extracting features from the initial rainy image to obtain a first feature map; dividing the first feature map to obtain a plurality of feature sub-maps corresponding to the first feature map; calculating the frequency components corresponding to each feature sub-map; enhancing each feature sub-map according to each frequency component to obtain a second feature map; and reconstructing features of the initial rainy image according to the second feature map to obtain a derained image. Through the present invention, the frequency domain features in the image are enhanced, and the image deraining effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image deraining method and system based on a frequency channel attention mechanism. Background Art

[0002] Rainy and foggy weather can affect the image acquisition of computer vision. For example, rain streaks will cover the specific content that needs to be recognized in the image. At the same time, rain streaks can easily cause recognition errors in the visual system. As an important image processing technology, image rain (streak) removal technology can be used to eliminate raindrop interference in images and restore and reconstruct clear scenes. The existing rain removal technology uses a convolution kernel-based rain removal network model to capture the spatial features in the image, but ignores the frequency domain features in the image, resulting in incomplete filtering of rain streaks in the image and unsatisfactory rain removal effect. Summary of the invention

[0003] In order to improve the image deraining effect and enhance the frequency domain features in the image, the present invention proposes an image deraining method and system based on frequency channel attention mechanism.

[0004] In a first aspect, the present invention provides an image deraining method based on a frequency channel attention mechanism, the method comprising:

[0005] Get an initial rainy image;

[0006] Extract features from the initial rain-containing image to obtain a first feature map;

[0007] Dividing the first feature graph to obtain multiple feature subgraphs corresponding to the first feature graph;

[0008] Calculate the frequency components in each feature sub-graph;

[0009] According to each frequency component, each feature sub-graph is enhanced to obtain a second feature graph;

[0010] According to the second feature map, the features of the initial rainy image are reconstructed to obtain a derained image.

[0011] Considering that the rain streaks in the initial rain-containing image are high-frequency information and the rain-free background image is low-frequency information, the first feature map is divided by the above method to obtain multiple feature sub-maps. Different feature sub-maps contain different frequency components. The size of the frequency component corresponding to each feature sub-map represents the amount of information contained in the feature sub-map. The larger the frequency component, the larger the amount of information contained in the feature sub-map. Therefore, according to the frequency components corresponding to each feature sub-map, the feature sub-map is enhanced, and the enhanced feature sub-map is used to reconstruct the features of the initial rain-containing image, retain the low-frequency rain-free background image, remove the high-frequency rain streak information, and improve the image deraining effect by enhancing the frequency domain features in the image.

[0012] In an optional implementation, feature extraction is performed on the initial rain-containing image to obtain a first feature map, including:

[0013] The first convolutional network is used to extract features of the initial rainy image to obtain a third feature map.

[0014] Using a pre-built long short-term memory model, extract features from the third feature map to obtain a fourth feature map;

[0015] The fourth feature map is subjected to feature extraction through the pre-constructed second convolutional network to obtain the first feature map.

[0016] Through the above implementation, first, the pre-constructed first convolutional network is used to perform feature extraction, so that shallow features of the image, such as edges, textures, etc., can be extracted; then, the long short-term memory model is used to further extract features from the third feature map to obtain contextual association information in the initial rain-containing image, thereby overcoming the difficulty of capturing contextual information across a long distance under the principle of focusing on local processing in traditional convolutional neural network models, and solving the long-distance dependency problem; finally, the fourth feature map is deep-featured extracted through the pre-constructed second convolutional network, the rain streak feature extraction is enhanced and enriched, and the first feature map is obtained, thereby improving the accuracy and effect of image deraining.

[0017] In an optional implementation, the first feature graph is divided to obtain a plurality of feature subgraphs corresponding to the first feature graph, including:

[0018] The first feature map is divided according to the preset number of channel layers to obtain feature sub-maps.

[0019] In an optional implementation, calculating the frequency components in the feature subgraph includes:

[0020] A two-dimensional discrete cosine transform is performed on the feature sub-image to obtain frequency components corresponding to multiple preset frequencies in the feature sub-image. The preset frequencies are determined by a frequency distribution index map, which represents the accuracy of different frequencies for extracting image features.

[0021] In an optional implementation, a two-dimensional discrete cosine transform is performed on the characteristic subgraph to obtain frequency components corresponding to multiple preset frequencies in the characteristic subgraph, including:

[0022]

[0023] Among them, Freq n is the frequency component corresponding to the feature sub-graph n; N is the height of the feature sub-graph n / the width of the feature sub-graph n; Represents the pixel value of the i-th row and j-th column in the feature sub-image n; u is the vertical axis component in the frequency distribution index map, and v is the horizontal axis component in the frequency distribution index map.

[0024] In an optional implementation, each feature sub-graph is enhanced according to each frequency component to obtain a second feature graph, including:

[0025] For each feature sub-graph, concatenate the frequency components corresponding to the feature sub-graph to obtain the channel attention vector corresponding to the feature sub-graph;

[0026] Multiply each feature subgraph by the channel attention vector corresponding to each feature subgraph to obtain the enhanced feature subgraph corresponding to each feature subgraph;

[0027] The enhanced feature sub-graphs are concatenated to obtain a second feature graph.

[0028] Through the above implementation, by splicing each frequency component into a channel attention vector, the importance of different feature sub-graphs can be paid attention to. The channel attention vector can be regarded as a measure of the importance of the feature sub-graph. By multiplying the channel attention vector with the corresponding feature sub-graph, the weight corresponding to the feature sub-graph with a large frequency component is increased, providing a basis for better distinguishing rain streaks from background images.

[0029] In an optional implementation, reconstructing features of the initial rain-containing image according to the second feature map to obtain a rain-free image includes:

[0030] splicing the second feature map with the initial rain-containing image to obtain a spliced ​​initial rain-containing image;

[0031] Based on the spliced ​​initial rainy image, the steps of extracting features from the initial rainy image to obtain a first feature map and reconstructing features of the initial rainy image according to the second feature map are repeated until a derained image that meets preset conditions is obtained.

[0032] Through the above implementation, in each iterative calculation, reconstruction is performed based on the current feature information, the deraining result is continuously optimized, and the image deraining effect is enhanced. Among them, the preset conditions can be adjusted according to actual needs, so that the deraining effect is more in line with the actual scene, and efficient and accurate deraining processing is achieved.

[0033] In a second aspect, the present invention further provides an image deraining system based on a frequency channel attention mechanism, the system comprising:

[0034] An acquisition module, used for acquiring an initial rain-containing image;

[0035] The frequency domain residual module is used to extract features from the initial rain-containing image to obtain a first feature map; divide the first feature map to obtain multiple feature sub-maps corresponding to the first feature map; calculate the frequency components in each feature sub-map; enhance each feature sub-map according to each frequency component to obtain a second feature map;

[0036] The reconstruction module is used to perform feature reconstruction on the initial rain-containing image according to the second feature map to obtain a derained image.

[0037] Considering that the rain streaks in the initial rain-containing image are high-frequency information and the rain-free background image is low-frequency information, the first feature map is divided through the above system to obtain multiple feature sub-maps. Different feature sub-maps contain different frequency components. The size of the frequency component corresponding to each feature sub-map represents the amount of feature information contained in the feature sub-map. The larger the frequency component, the larger the amount of feature information contained in the feature sub-map. Therefore, according to the frequency components corresponding to each feature sub-map, the feature sub-map is enhanced, and the enhanced feature sub-map is used to reconstruct the features of the initial rain-containing image, retain the low-frequency rain-free background image, remove the high-frequency rain streak information, and improve the image deraining effect by enhancing the frequency domain features in the image.

[0038] In a third aspect, the present invention further provides a computer device, comprising a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the steps of the image deraining method based on the frequency channel attention mechanism of the first aspect or any embodiment of the first aspect by executing the computer instructions.

[0039] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the image deraining method based on the frequency channel attention mechanism of the first aspect or any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 is a flowchart of an image deraining method based on a frequency channel attention mechanism proposed according to an exemplary embodiment;

[0042] Figure 2 is, in one example, a frequency distribution index graph;

[0043] Figure 3 is a structural block diagram of an image deraining system based on a frequency channel attention mechanism proposed according to an exemplary embodiment;

[0044] Figure 4 In an example, a structural diagram of another image deraining system based on the frequency channel attention mechanism is shown;

[0045] Figure 5 In an example, an experimental comparison diagram of the FCALN system provided by an embodiment of the present invention and the experiment comparison diagram of the PReNet system is shown;

[0046] Figure 6 It is a schematic diagram of the hardware structure of a computer device proposed according to an exemplary embodiment. DETAILED DESCRIPTION

[0047] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. 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.

[0048] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0049] In order to improve the image deraining effect and enhance the frequency domain features in the image, the present invention proposes an image deraining method and system based on frequency channel attention mechanism.

[0050] Figure 1 is a flowchart of an image deraining method based on a frequency channel attention mechanism proposed according to an exemplary embodiment. Figure 1 As shown, the image deraining method based on the frequency channel attention mechanism includes the following steps S101 to S106.

[0051] Step S101: Acquire an initial rainy image.

[0052] In an optional embodiment, the initial rain-containing image is an image in RGB color space.

[0053] In an optional embodiment, the initial rain-containing image is a rain-containing image that has undergone a preprocessing operation, wherein the preprocessing operation includes grayscale conversion, noise reduction, contrast enhancement, etc., which are not specifically limited here.

[0054] Step S102: extracting features from the initial rainy image to obtain a first feature map.

[0055] In an optional embodiment, the first feature map includes edge information, texture information, and information on raindrop characteristics of the initial rain-containing image.

[0056] In an optional embodiment, multiple convolutional layers may be used to extract features from the initial rainy image, thereby obtaining a first feature map.

[0057] Step S103: Divide the first feature graph to obtain a plurality of feature sub-graphs corresponding to the first feature graph.

[0058] In an optional embodiment, the first feature map includes a plurality of channel layers. The first feature map can be divided by a preset channel layer to obtain a plurality of feature sub-maps. Different feature sub-maps reflect the features of different frequency components of the initial rain-containing image, such as edge features, texture features, etc.

[0059] Step S104: Calculate the frequency components in each characteristic subgraph.

[0060] In an optional embodiment, a feature subgraph includes multiple frequencies and frequency components corresponding to each frequency, and the frequency component corresponding to a frequency reflects the amount of information of the feature contained in the frequency in the feature subgraph. The larger the frequency component corresponding to a frequency, the larger the amount of information of the feature contained in the frequency in the feature subgraph.

[0061] In an optional embodiment, the frequency components of the characteristic subgraph include a direct current component, a low frequency component and a high frequency component. The frequency components of the characteristic subgraph can be calculated by two-dimensional discrete cosine transform.

[0062] Step S105: enhancing each characteristic sub-graph according to each frequency component to obtain a second characteristic graph.

[0063] In an optional embodiment, each frequency component is used as a weight, and each frequency component is multiplied by each feature sub-graph to enhance the first feature graph and obtain the second feature graph.

[0064] Step S106: According to the second feature map, feature reconstruction is performed on the initial rainy image to obtain a rain-free image.

[0065] In an optional embodiment, the second feature map may be input into a convolutional layer to perform feature reconstruction, and the second feature map may be restored to a derained image in an RGB color space.

[0066] Considering that the rain streaks in the initial rain-containing image are high-frequency information and the rain-free background image is low-frequency information, therefore, in an embodiment of the present invention, the first feature map is divided to obtain a plurality of feature sub-maps. Different feature sub-maps contain different frequency components. The size of the frequency component corresponding to each feature sub-map represents the amount of feature information contained in the feature sub-map. The larger the frequency component, the larger the amount of feature information contained in the feature sub-map. Therefore, according to the frequency components corresponding to each feature sub-map, the feature sub-map is enhanced, and the enhanced feature sub-map is used to reconstruct the features of the initial rain-containing image, retain the low-frequency rain-free background image, remove the high-frequency rain streak information, and improve the image deraining effect by enhancing the frequency domain features in the image.

[0067] In one example, in the above step S102, feature extraction is performed on the initial rainy image in the following manner to obtain a first feature map:

[0068] First, the initial rainy image is feature extracted by a pre-constructed first convolutional network to obtain a third feature map. For example, a simple convolutional network with a 1×1 convolution kernel can be used as the first convolutional network to perform shallow feature extraction on the initial rainy image to obtain the third feature map.

[0069] Then, the pre-built long short-term memory model is used to extract features from the third feature map to obtain a fourth feature map.

[0070] In an optional embodiment, the Long Short-Term Memory (LSTM) model is a special recurrent neural network (RNN). The core idea of ​​LSTM is to introduce the so-called "gate" structure to solve the gradient vanishing problem in traditional RNN. LSTM consists of an input gate, an output gate, a forget gate and a cell state. Its hidden state h t-1 Determined by the output gate and cell state memory information.

[0071] Finally, the fourth feature map is subjected to feature extraction through the pre-constructed second convolutional network to obtain the first feature map. Exemplarily, a simple convolutional network with a 3×3 convolutional kernel can be used as the second convolutional network to perform deep feature extraction on the initial rainy image to obtain the first feature map.

[0072] In an embodiment of the present invention, first, a pre-constructed first convolutional network is used to perform feature extraction, so that shallow features of the image, such as edges, textures, etc., can be extracted; then, the third feature map is further feature extracted using a long short-term memory model to obtain contextual association information in the initial rain-containing image, thereby overcoming the difficulty of capturing contextual information across a long distance under the principle of focusing on local processing in traditional convolutional neural network models, and solving the long-distance dependency problem; finally, a pre-constructed second convolutional network is used to perform deep feature extraction on the fourth feature map, thereby enhancing and enriching the rain streak feature extraction, obtaining the first feature map, and further improving the accuracy and effect of image deraining.

[0073] In one example, in the above step S103, the first feature map is divided according to the preset channel layer number to obtain each feature sub-map. In the embodiment of the present invention, the first feature map includes 32 channel layers, the preset channel layer number is set to 2, and the number of feature sub-maps obtained is 16.

[0074] In one example, in the above step S104, a two-dimensional discrete cosine transform is performed on the feature sub-graph to obtain frequency components corresponding to multiple preset frequencies in the feature sub-graph. The preset frequencies are determined by a frequency distribution index map, and the frequency distribution index map represents the accuracy of different frequencies for extracting image features.

[0075] In an optional embodiment, the accuracy corresponding to the preset frequency is greater than the preset accuracy. In the embodiment of the present invention, the feature subgraph is converted from the spatial domain to the frequency domain, thereby revealing the frequency components of the preset frequency in the image, wherein the preset frequency is set according to the accuracy of different frequencies in the frequency distribution index map for extracting image features, and the frequency corresponding to a frequency higher than the preset accuracy is determined as the preset frequency, so that the frequency components contained in the feature subgraph can better reflect the features in the image and more accurately describe the feature information in the image, thereby improving the image deraining effect.

[0076] Figure 2 is the frequency distribution index graph. Figure 2 In the figure, u is the vertical axis component in the frequency distribution index diagram, v is the horizontal axis component in the frequency distribution index diagram, and a set of u and v corresponds to one frequency. Figure 2 Each number in the figure indicates the accuracy of the frequency corresponding to u and v in extracting feature information from the image, that is, the effectiveness of the frequency. The darker the color, the higher the accuracy (effectiveness) of the frequency corresponding to u and v.

[0077] In an optional embodiment, a two-dimensional discrete cosine transform is performed on the characteristic subgraph by the following formula to obtain frequency components corresponding to multiple preset frequencies in the characteristic subgraph:

[0078]

[0079] Among them, Freq n is the frequency component corresponding to the feature sub-graph n; N is the height of the feature sub-graph n / the width of the feature sub-graph n; x i,j They respectively represent the pixel values ​​of the i-th row and j-th column in the feature sub-image n; u is the vertical axis component in the frequency distribution index map, v is the horizontal axis component in the frequency distribution index map, and a set of u and v corresponds to one frequency.

[0080] In one example, in the above step S105, each feature sub-graph is enhanced by the following contents to obtain a second feature graph:

[0081] First, for each feature subgraph, the frequency components corresponding to the feature subgraph are concatenated to obtain a channel attention vector corresponding to the feature subgraph. In an embodiment of the present invention, for each feature subgraph, the frequency components corresponding to the preset frequency are concatenated in order from low to high preset frequencies to obtain a channel attention vector.

[0082] Then, each feature sub-graph is dot-multiplied with the channel attention vector corresponding to each feature sub-graph to obtain the enhanced feature sub-graph corresponding to each feature sub-graph.

[0083] Finally, the enhanced feature sub-graphs are concatenated to obtain a second feature graph. Exemplarily, a fully connected layer may be used to concatenate the enhanced feature sub-graphs to obtain the second feature graph.

[0084] In the embodiment of the present invention, by splicing each frequency component into a channel attention vector, the importance of different feature subgraphs at the preset frequency can be noted, and the channel attention vector can be regarded as a measure of the importance of the feature subgraph. The larger the frequency component, the more feature information of the preset frequency is contained in the feature subgraph, and the greater the influence of the feature subgraph on the image deraining effect. By multiplying this vector with the corresponding feature subgraph, the weight corresponding to the feature subgraph with a large frequency component is increased, providing a basis for better distinguishing rain streaks from background images.

[0085] In one example, in the above step S106, the features of the initial rain-containing image are reconstructed in the following manner to obtain a rain-free image:

[0086] First, the second feature map is spliced ​​with the initial rainy image to obtain a spliced ​​initial rainy image.

[0087] Then, based on the spliced ​​initial rain-containing image, the steps of extracting features from the initial rain-containing image to obtain the first feature map and reconstructing features of the initial rain-containing image according to the second feature map are repeated until a rain-removed image that meets preset conditions is obtained. The preset conditions may be the maximum number of iterations, the maximum processing time, or other constraints related to the rain removal effect may be set according to actual conditions, such as the noise level of the image after raindrops are removed, the edge retention capability, etc.

[0088] In the embodiment of the present invention, in each iteration, reconstruction is performed based on the current feature information, the derained image is continuously optimized, and the image deraining effect is enhanced. The preset conditions can be adjusted according to actual needs, so that the deraining effect is more in line with the actual scene, and efficient and accurate deraining processing is achieved.

[0089] Figure 3 An image deraining system based on a frequency channel attention mechanism is provided according to an exemplary embodiment, and the system includes:

[0090] The acquisition module 301 is used to acquire an initial rainy image.

[0091] The frequency domain residual module 302 is used to extract features from the initial rain-containing image to obtain a first feature map; divide the first feature map to obtain multiple feature sub-maps corresponding to the first feature map; calculate the frequency components in each feature sub-map; and enhance each feature sub-map according to each frequency component to obtain a second feature map.

[0092] The reconstruction module 303 is used to perform feature reconstruction on the initial rainy image according to the second feature map to obtain a rain-free image.

[0093] Taking into account that the rain streaks in the initial rain-containing image are high-frequency information and the rain-free background image is low-frequency information, the first feature map is divided through the above system to obtain multiple feature sub-maps. Different feature sub-maps contain different frequency components. The size of the frequency component corresponding to each feature sub-map represents the amount of feature information contained in the feature sub-map. The larger the frequency component, the larger the amount of feature information contained in the feature sub-map. Therefore, according to the frequency components corresponding to each feature sub-map, an enhanced feature sub-map is obtained, and the enhanced feature sub-map is used to reconstruct the features of the initial rain-containing image, retain the low-frequency rain-free background image, remove the high-frequency rain streak information, and improve the image deraining effect by enhancing the frequency domain features in the image.

[0094] Figure 4It is a structural diagram of another image deraining system (Frequency Channel Attention Lightweight Derain Network, FCALN) based on the frequency channel attention mechanism. The system includes multiple splicing modules, multiple frequency domain residual modules and reconstruction modules. The splicing modules correspond to the frequency domain residual modules one by one, and the splicing modules and the frequency domain residual modules are alternately connected in sequence. The number of splicing modules and the number of frequency domain residual modules can be set according to actual conditions. In an embodiment of the present invention, the number of splicing modules and the number of frequency domain residual modules are both set to 6. The frequency domain residual module includes a 1×1 convolution layer, a long short-term memory model, a frequency domain residual submodule and a 3×3 convolution layer, wherein the 1×1 convolution layer is used to extract the third feature map, the long short-term memory model is used to extract the fourth feature map, and the 3×3 convolution layer is used to reconstruct the features of the initial rainy image according to the second feature map to obtain a derained image. The frequency domain residual submodule includes multiple frequency domain residual hierarchical structures. In an embodiment of the present invention, the number of frequency domain residual hierarchical structures is 5.

[0095] Each frequency domain residual hierarchical structure includes a 3×3 convolution layer, a segmentation layer, and an enhancement layer. The 3×3 convolution layer is used to extract the first feature map; the segmentation layer is used to divide the first feature map to obtain multiple feature sub-maps corresponding to the first feature map; the enhancement layer is used to calculate the frequency components in each feature sub-map; and each feature sub-map is enhanced according to each frequency component to obtain the second feature map. The enhancement layer contains two fully connected layers, a RELU nonlinear activation function, and a sigmoid activation function.

[0096] The system adopts a residual network connection structure, the overall number of modules and channels of the network is small, and 1×1 convolution is used to extract features to reduce parameters, and the introduced parameters are controlled at 168K, achieving lightweight. On the basis of maintaining the lightweight model structure, the rain removal model of the present invention can also well retain the image background structure information, effectively remove the rain information in the image, and restore the details blocked by rain streaks.

[0097] In this system, the deraining operation on a single image is achieved through the following steps.

[0098] Step a1: Input the initial rainy image x with size × channel H (image height) × W (image width) × 3 (3 channels of image RGB) t=0 , and spliced ​​with its own image. After splicing, the feature map x' with a size of H×W×6 channels is input into the FCALN module.

[0099] The FCALN system consists of T FCALN modules, and the rain streak information in the image is gradually eliminated in T stages through T=6 FCALN modules. The following steps a2-a5 are the processing process of the t-th FCALN module (FCALN t-stage module), where t∈[1,T]:

[0100] Step a2: Assume that the tth FCALN module of the FCALN system (such as Figure 4 -(a)), when t>1, the deraining result output image x of the previous stage iterative calculation t-1 With the initial rainy image x 0 The concatenation is used as the input of the t-th FCALN module (the t-stage module of FCALN). The front end of each FCALN module uses a simple convolutional network with a 1×1 convolution kernel to preprocess the input feature map x', that is, to extract shallow features and obtain 32 channel feature maps f in .

[0101] Step a3: Concatenate feature maps f in and the hidden state h of the long short-term memory model t-1 , forming a 64-channel input feature map, where the initial hidden state h0 at t = 1 is a randomly generated 32-channel feature map. The long short-term memory model consists of an input gate, an output gate, a forget gate and a unit state. Its hidden state h t-1 Determined by the output gate and cell state memory information. The FCALN system obtains the contextual information of the rain image through a long short-term memory model structure with time sequence and constructs the deraining feature map g t Among them, g t Also used as the next hidden state h t .

[0102] Step a4: Figure 4 -(b) As shown, the frequency domain residual sub-block structure of the FCALN module consists of k embedded frequency domain hierarchical structures, each of which is a residual structure that combines frequency domain and channel attention. Assume that the deraining feature map g is input into the kth frequency domain hierarchical structure, where k∈[1,5]. First, a layer of 3×3 convolution kernel is used to perform deep feature extraction on the rain streak feature, which enhances and enriches the rain streak feature extraction. When k=5, the rain streak feature extraction effect is relatively good. Then, the frequency channel attention mechanism is used to focus on the detection of rain streak information, improving the performance of extracting key rain streak features (see steps a4-1—a4-3 for details).

[0103] Step a4-1: Figure 4 -(c) shows that the embedded frequency domain hierarchical structure first transforms the deraining feature map g t The 32-channel layer is divided into n equal parts, and the n sub-models are {g 0, g 1 , …, g n-1}, and average pooling is used to reduce the spatial size of the feature sub-map. Therefore, the spatial size of the feature sub-map of each sub-model is h×w×(C / n), where h is the height of the sub-model feature map, w is the width of the sub-model feature map, and n is set to 16 in the embodiment of the present invention.

[0104] Step a4-2: In order to obtain the channel attention (frequency channel attention) vector of the multi-frequency points corresponding to the system network channel, for each sub-model part, a two-dimensional discrete cosine transform (2D-DCT) formula is used, which is expressed as follows.

[0105]

[0106] Among them, N is h or w, which are the height of the input sub-model feature map and the width of the input feature map respectively; i and j in the formula represent the pixel values ​​of the i-th row and j-th column in the feature sub-map respectively, u in the formula is the vertical axis component of the frequency index coordinate, v in the formula is the horizontal axis component of the frequency index coordinate, and c is a constant related to u and v; the coefficients of the DCT frequency transform are calculated by the above formula for different u and v, and a series of frequency domain components Freq of different frequency components are obtained. n , where u = 0 and v = 0 are the DC components of the rain image features. The larger the u and v are, the more high-frequency component information the features represent. In order to correspond to the n input sub-model feature maps, Figure 2 Different combinations of u (vertical axis) and v (horizontal axis) are selected to obtain n frequency point values. The n combinations of DC-low frequency-high frequency are arranged from low to high frequency values, and all frequency domain components are spliced ​​to obtain a multi-frequency channel attention vector Freq = Cat (Freq 0 ,Freq 1 ,…,Freq n-1 ). The values ​​of u and v can be found in Figure 2 .

[0107] Step a4-3: Multiply the channel attention vector (n frequency coefficients or weights) of the multi-frequency points by the corresponding n sub-model feature maps in the deraining feature map to obtain a weighted deraining feature map. in The i and j in the sub-model feature map represent the pixel values ​​in the i-th row and j-th column, respectively. Then, a fully connected layer and a linear rectification function are used to transform g f The transformation process sums the spatial dimensions of the feature subgraph to obtain a feature subgraph with normalized spatial dimensions, whose size is 1×1×C. Then, in the fully connected layer (FC), the C channel is divided into n equal parts, and the C channel is transformed into Channels, reduce the amount of calculation, and activate by activating the S function. Then the n equally divided channels are connected through the fully connected layer (FC) Transformed into the original C channel, the transformed feature subgraph g is obtained f '. After transforming the attention vectors of all frequency channels, the weighted deraining feature map g obtained above is f Weighted to input g f 'A scaling operation is performed on the features of each channel, and then the enhanced deraining feature map g' is output.

[0108] Step a5: Input the enhanced deraining feature map g' into a 3×3 convolutional layer for feature reconstruction, restore the deraining feature g' to an image in the RGB color space, and output the deraining result x of the current stage iteration. t .

[0109] like Figure 4 As shown in (a), the input of the FCALN module at the tth stage can be described by the following formula.

[0110] x t =x+f out (g'(g(f in (x t-1 ))))

[0111] Repeat steps a1 to a5 T times and output the final derained image x T , where T=6.

[0112] In an embodiment of the present invention, the FCALN system is further trained, which specifically includes the following steps:

[0113] Step b1: Set the parameters in FCALN. The parameters of FCALN include image input size, learning rate lr, data batch size Batchsize, training times epochs and gradient descent optimizer optimizer.

[0114] Step b2: Use the standard Rain100L and Rain100H datasets to train and test FCALN. t-1 Input FCA LN, output de-rained image x t Among them, the number of images in the training set accounts for 80% of the dataset, and the remaining 20% ​​is the test dataset. The training and test datasets include the initial rainy images and their corresponding target rain-free images.

[0115] Step b3: Calculate the loss function based on the derained image and the target rain-free image. The training process uses Negative-SSIM Loss as the loss function.

[0116] Step b4: Back-propagate the calculated loss function to update the parameters in FCALN.

[0117] Step b5: Repeat steps b2 and b4 to iterate some parameters of FCALN until the loss function converges. The training process uses Peak signal-to-noise ratio (PSNR) and Structural Similarity (SSIM) as measurement indicators to adaptively adjust the training effect of image deraining, and uses negative SSIM as the loss function to control FCALN convergence and prevent overfitting.

[0118] Step b6: Demonstrate the performance of the present invention through extensive comparative experiments.

[0119] After training, the rain images in the test set are input into FCALN for evaluation, and indicators such as PSNR and SSIM are counted and compared with the results of related technologies.

[0120] The larger the PSNR and SSIM values ​​are, the smaller the image distortion is and the better the quality is. The PSNR index measures the peak signal-to-noise ratio of the two images. When its value is greater than 30dB, the image quality is good and the distortion is low. The SSIM index measures the structural similarity of the two images, and its value range is -1 to 1. t and the target rain-free image x gt When the two are completely consistent, the SSIM value is 1.

[0121] The quantitative comparison results on the Rain100H / 100L synthetic dataset are shown in Table 1. From the test results of the PSNR and SSIM average measurement indicators, it can be seen that the FCALN of the embodiment of the present invention performs better than PReNet and AttentiveGAN. Its PSNR average value and SSIM average value are higher than those of PReNet and AttentiveGAN, and better than the DRT model based on the derived Transformer transformer network, and slightly lower than the performance of another Restormer model based on the derived Transformer structure.

[0122] Table 1. Comparison of PSNR and SSIM averages of several algorithms on the test set Rain100H / 100L

[0123]

[0124] As shown in Table 2, the lightweight FCALN uses only 168K parameters, which is 1 to 2 orders of magnitude lower than the related technologies, but achieves better performance than most related technologies. The lightweight FCALN can achieve a good balance between parameters and test time, and can be transplanted to devices with limited computing resources to perform fast and effective image deraining.

[0125] Table 2 Comparison of parameters and test time of several algorithms

[0126]

[0127] Figure 5 The experimental comparison diagram of FCALN and PReNet provided by the embodiment of the present invention is shown in the figure. The first column is a reference rain-free image, the second column is a rain-containing image with a local area magnification, the third column is a PReNet derained image, and the fourth column is a FCALN derained image.

[0128] Figure 6 FIG. 1 is a schematic diagram of a hardware structure of a computer device according to an exemplary embodiment. Figure 6 As shown, the device includes one or more processors 610 and a memory 620, and the memory 620 includes a persistent memory, a volatile memory, and a hard disk. Figure 6 A processor 610 is taken as an example. The device may further include: an input device 630 and an output device 640.

[0129] The processor 610, the memory 620, the input device 630 and the output device 640 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0130] The processor 610 may be a central processing unit (CPU). The processor 610 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips. A general-purpose processor may be a microprocessor or the processor may be any conventional processor.

[0131] The memory 620 is a non-transient computer-readable storage medium, including persistent memory, volatile memory and hard disk, which can be used to store non-transient software programs, non-transient computer executable programs and modules, such as the program instructions / modules corresponding to the image deraining method based on the frequency channel attention mechanism in the embodiment of the present application. The processor 610 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 620, that is, realizing any of the above-mentioned image deraining methods based on the frequency channel attention mechanism.

[0132] The memory 620 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data used as needed, etc. In addition, the memory 620 may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 620 may optionally include a memory remotely arranged relative to the processor 610, and these remote memories may be connected to the data processing device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0133] The input device 630 can receive input digital or character information and generate signal input related to user settings and function control. The output device 640 can include display devices such as display screens.

[0134] One or more modules are stored in the memory 620, and when executed by one or more processors 610, the execution is as follows: Figure 1 The method shown.

[0135] The above-mentioned product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to Figure 1 Related description of the illustrated embodiment.

[0136] The embodiment of the present invention further provides a non-transitory computer storage medium, which stores computer executable instructions, and the computer executable instructions can execute the method in any of the above method embodiments. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.

[0137] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0138] The above is only a specific embodiment of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but should conform to the widest scope consistent with the principles and novel features applied herein.

Claims

1. An image deraining method based on frequency channel attention mechanism, It is characterized in that The method comprises: Get an initial rainy image; Performing feature extraction on the initial rain-containing image to obtain a first feature map; Dividing the first feature graph to obtain a plurality of feature subgraphs corresponding to the first feature graph; Calculate the frequency components in each of the characteristic subgraphs; According to each of the frequency components, each of the characteristic sub-graphs is enhanced to obtain a second characteristic graph; According to the second feature map, feature reconstruction is performed on the initial rainy image to obtain a rain-free image; The step of extracting features from the initial rain-containing image to obtain a first feature map includes: Extracting features of the initial rain-containing image through a pre-constructed first convolutional network to obtain a third feature map; Using a pre-built long short-term memory model, extracting features from the third feature map to obtain a fourth feature map; Performing feature extraction on the fourth feature map through a pre-constructed second convolutional network to obtain the first feature map; Wherein, according to each of the frequency components, each of the characteristic sub-graphs is enhanced to obtain a second characteristic graph, including: For each feature sub-graph, concatenate the frequency components corresponding to the feature sub-graph to obtain a channel attention vector corresponding to the feature sub-graph; Multiply each of the feature subgraphs by the channel attention vector corresponding to each of the feature subgraphs to obtain an enhanced feature subgraph corresponding to each of the feature subgraphs; The enhanced feature sub-graphs are concatenated to obtain the second feature graph.

2. The method according to claim 1, It is characterized in that The first feature graph is divided to obtain a plurality of feature subgraphs corresponding to the first feature graph, including: The first feature map is divided according to a preset number of channel layers to obtain the feature sub-maps.

3. The method according to claim 1, It is characterized in that Calculating the frequency components in the characteristic subgraph includes: A two-dimensional discrete cosine transform is performed on the feature sub-graph to obtain frequency components corresponding to multiple preset frequencies in the feature sub-graph, wherein the preset frequencies are determined by a frequency distribution index graph, and the frequency distribution index graph represents the accuracy of different frequencies for extracting image features.

4. The method according to claim 3, It is characterized in that Performing a two-dimensional discrete cosine transform on the characteristic subgraph to obtain frequency components corresponding to a plurality of preset frequencies in the characteristic subgraph includes: Among them, Freq n is the frequency component corresponding to the feature sub-graph n; N is the height of the feature sub-graph n / the width of the feature sub-graph n; Represents the pixel value of the i-th row and j-th column in the feature sub-image n; u is the vertical axis component in the frequency distribution index map, and v is the horizontal axis component in the frequency distribution index map.

5. The method according to claim 1, It is characterized in that According to the second feature map, feature reconstruction is performed on the initial rainy image to obtain a rain-free image, including: Splicing the second feature map with the initial rain-containing image to obtain a spliced ​​initial rain-containing image; Based on the spliced ​​initial rainy image, the steps of extracting features from the initial rainy image to obtain a first feature map and reconstructing features of the initial rainy image according to the second feature map are repeated until a derained image that meets preset conditions is obtained.

6. An image deraining system based on frequency channel attention mechanism, It is characterized in that The system comprises: An acquisition module, used for acquiring an initial rain-containing image; A frequency domain residual module is used to extract features from the initial rain-containing image to obtain a first feature map; divide the first feature map to obtain a plurality of feature sub-maps corresponding to the first feature map; calculate the frequency components in each of the feature sub-maps; and enhance each of the feature sub-maps according to each of the frequency components to obtain a second feature map; A reconstruction module, used for performing feature reconstruction on the initial rain-containing image according to the second feature map to obtain a derained image; The frequency domain residual module is specifically used to perform feature extraction on the initial rain-containing image through a pre-constructed first convolutional network to obtain a third feature map, perform feature extraction on the third feature map using a pre-constructed long short-term memory model to obtain a fourth feature map, and perform feature extraction on the fourth feature map through a pre-constructed second convolutional network to obtain the first feature map; Among them, the frequency domain residual module is specifically used to splice the frequency components corresponding to each feature sub-graph to obtain the channel attention vector corresponding to the feature sub-graph, multiply each feature sub-graph by the channel attention vector corresponding to each feature sub-graph to obtain the enhanced feature sub-graph corresponding to each feature sub-graph, and splice each enhanced feature sub-graph to obtain the second feature graph.

7. A computer device, It is characterized in that The invention comprises a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the steps of the image deraining method based on the frequency channel attention mechanism according to any one of claims 1 to 5 by executing the computer instructions.

8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the image deraining method based on the frequency channel attention mechanism are implemented as described in any one of claims 1 to 5.