Image rain removal method based on deformable attention mechanism

By introducing a deformable attention mechanism and multi-scale feature fusion into the image rain removal technology, the problem of processing raindrop dense areas and irregular rain noise is solved, and more efficient rain noise filtering and image rain removal effects are achieved, which is suitable for Severe weather sensing tasks for autonomous vehicles.

CN118587120APending Publication Date: 2024-09-03BEIHANG UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410705300.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Existing image rain removal technology has limitations in areas with dense raindrops, and the receptive field of ordinary convolution kernels is limited, making it difficult to effectively remove irregular rain noise, resulting in redundant calculations and poor rain removal effects.

Method used

An image rain removal method based on the deformable attention mechanism is adopted. Through multiple rounds of training of the generation module and the discriminant module, the deformable attention mechanism and multi-scale feature fusion are used to adaptively capture rain noise, generate pseudo-rain removal images and perform discrimination. , adjust model parameters to achieve optimal performance.

Benefits of technology

It achieves more effective rain noise filtering, improves the ability to remove noise of different sizes, improves the clarity and accuracy of image rain removal, and is suitable for the perception tasks of autonomous vehicles under severe weather conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587120A
    Figure CN118587120A
Patent Text Reader

Abstract

The invention relates to the technical field of computer vision, in particular to an image rain removal method based on a deformable attention mechanism, and the method comprises the following steps: constructing a rainwater image and clean image pair data set; the generation module processes the rainwater image based on a deformable attention mechanism to generate a pseudo rain-removed image; a judgment module judges the pseudo rain-removed image and the clean image to obtain a judgment result; adjusting the parameters of the generation module and the discrimination module based on the discrimination result, and training an image rain removal model to enable the performances of the generation module and the discrimination module to be optimal; and applying the trained image rain removal model to image rain de-noising to obtain a rain-removed image. On the basis of the generative adversarial network, a deformable attention mechanism is introduced, rainwater noisy points with different fine granularities are adapted from a multi-scale level, and the capability of removing the rainwater noisy points can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the continuous development of autonomous driving technology, vehicle perception tasks play a vital role in autonomous driving systems. The current perception systems of autonomous vehicles often rely on image information obtained by cameras to perceive the surrounding environment, identify road signs, detect obstacles, etc., so as to make corresponding decisions and driving plans. However, in outdoor driving environments, weather factors such as rain, snow, and fog often have a negative impact on the images obtained by the camera, reducing the quality and clarity of the images, thereby affecting the perception ability and safety of autonomous vehicles.

[0003] Rainy days are common weather conditions, so it is even more necessary to study image rain denoising. Research on how to effectively deal with image quality issues under adverse weather conditions such as rainy days, especially the development of efficient image de-raining methods, is of great significance for improving the perception and safety of autonomous driving vehicles in various weather conditions.

[0004] Current image deraining technology mainly focuses on the field of deep learning. The Chinese patent application with publication number CN117689580A discloses an image deraining method, device, equipment and medium based on deformable multi-head attention. A deformable multi-head attention mechanism is developed on the basis of Transformer, and image deraining operation is realized by analyzing deep semantic features. The Chinese patent application with publication number CN117474783A discloses a two-step single image deraining method based on a generative adversarial network. Using a generative adversarial network architecture, a rain generator is first trained, and a discriminator is trained to capture the rain mask. Then, the rain mask in the image is extracted in the deraining stage, and finally a derained image is generated. However, single-scale deraining technology has its limitations for areas with dense raindrops, so some studies have focused on using multi-scale feature fusion methods to perform image deraining operations. The Chinese patent application with publication number CN117475285A discloses a progressive single image deraining method based on multi-scale fusion, which performs multi-scale fusion of shallow feature maps, deep feature maps and context information, and performs single image progressive deraining operation on images in the DDN-SIRR dataset. The Chinese patent application with publication number CN117670721A discloses a multi-scale feature fusion deraining method based on a generative adversarial network, and develops a multi-scale feature fusion MRainGAN network based on the generative adversarial network. Summary of the invention

[0005] In view of the above problems, the present invention provides an image deraining method based on a deformable attention mechanism, which solves the problem that rain streaks in rain images in the prior art usually affect the features around the target, and the association between a large number of pixel points will cause redundant calculations. It also solves the problem that due to the irregular characteristics of rain streaks, the receptive field of ordinary convolution kernels is limited and they are easily covered by rain noise points.

[0006] The present invention provides an image deraining method based on a deformable attention mechanism, comprising the following steps:

[0007] Step S1, constructing a dataset of rain image and clean image pairs;

[0008] Step S2, determining an image deraining model, wherein the image deraining model includes a generation module and a discrimination module;

[0009] Step S3, the generation module processes the rain image in the data set based on the deformable attention mechanism to generate a pseudo derained image;

[0010] Step S4, the discrimination module judges the pseudo derained image and the clean image in the data set to obtain a discrimination result;

[0011] Step S5: Based on the discrimination result, adjusting the parameters of the generation module and the discrimination module, and training the image deraining model, so that the performance of the generation module and the discrimination module is optimized;

[0012] Step S6: Apply the trained image deraining model to image rain denoising to obtain a derained image.

[0013] Preferably, step S1 specifically includes: based on the clean image data, synthesizing a natural rainy day image corresponding to the same position as the clean image, to form a data set of image pairs consisting of the clean image and the rainy image.

[0014] Preferably, step S3 specifically includes: step S3-1, a generation module extracts features from an input image based on a deformable attention mechanism to obtain an attention pyramid; step S3-2, multi-scale feature fusion is performed on the attention pyramid, multi-layer processing is performed on the fused feature map, and a pseudo derained image is output.

[0015] Preferably, step S3-1 specifically includes:

[0016] Down-sampling the input rain image using convolution kernels of different sizes to obtain an image pyramid consisting of images of different resolutions, wherein the images of different resolutions include: a low-resolution image, a high-resolution image, and an original resolution image;

[0017] Using a convolutional neural network based on a deformable attention mechanism to extract features from the images of different resolutions, generating attention maps of different scales to form an attention pyramid;

[0018] Among them, the convolutional neural network of the deformable attention mechanism is provided with an attention weight matrix that is dynamically adjusted according to the input data, and the attention weight matrix is ​​used to adjust the receptive field of the neural network so that the receptive field matches the size of the rain noise point.

[0019] Preferably, step S3-2 specifically includes:

[0020] The attention maps of different scales in the attention pyramid are upsampled and superimposed respectively, and the superimposed attention map is multiplied with the original image to obtain a multi-scale fusion feature map;

[0021] The multi-scale fusion feature map is subjected to multi-layer processing, including: multiple convolutional layers for finer-grained feature extraction, a multi-layer residual module for further feature extraction, and a deconvolution layer with the same number of convolutional layers to restore the multi-layer feature map to the size of the input rain image; finally, a pseudo derained image is obtained according to the output feature map.

[0022] Preferably, step S4 specifically includes: step S4-1, the discrimination module discriminates the pseudo derained image and the clean image respectively to obtain category discrimination results of the pseudo derained image and the clean image; step S4-2, based on the category discrimination result of the pseudo derained image, calculating the generation module loss and the pseudo image loss; based on the category discrimination result of the clean image, calculating the true image loss.

[0023] Preferably, step S4-1 specifically includes: the discrimination module performs discrimination processing on the pseudo derained image and the clean image respectively, including: after processing by multiple convolution layers and pooling layers, the obtained high-dimensional feature map is input into a binary classifier to obtain category discrimination results of the pseudo derained image and the clean image respectively.

[0024] Preferably, step S4-2 specifically includes:

[0025] The calculation method of generating module loss g_loss is:

[0026] g_loss=BCELoss(x1,y1)=-w·[y1·log(x1)+(1-y1)·log(1-x1)]

[0027] x1=D(G(A)),y1=1

[0028] Among them, BCELoss(·) is the binary cross entropy loss function, x1 is the category discrimination result D(G(A)) of the pseudo derained image G(A); y1 is the all-1 matrix; w represents the weight of the model;

[0029] The calculation method of fake image loss fake_loss is:

[0030] fake_loss=BCELoss(x1,y0)=-w·[y0·log(x1)+(1-y0)·log(1-x1)]

[0031] x1=D(G(A)),y0=0

[0032] Among them, y0 is a matrix of all zeros;

[0033] The calculation method of real image loss real_loss is:

[0034] real_loss=BCELoss(x2,y1)=-w·[y1·log(x2)+(1-y1)·log(1-x2)]

[0035] x2=D(B),y1=1

[0036] Among them, x2 is the category discrimination result D(B) of the clean image B; y1 is an all-1 matrix.

[0037] Preferably, in step S5, adjusting the parameters of the generation module and the discrimination module based on the discrimination result specifically includes:

[0038] Performing back propagation according to the calculated generation module loss g_loss, adjusting the parameters of the generation module part, including: adjusting the attention weight of the convolutional neural network of the deformable attention mechanism and adjusting the network parameters of the convolutional layer, residual module and deconvolution layer in the generation module;

[0039] The fake image loss fake_loss and the real image loss real_loss are averaged as the overall loss d_loss of the discriminant module. Backward propagation is performed based on the calculated overall loss d_loss of the discriminant module to adjust the parameters of the discriminant module, including adjusting the network parameters of the convolutional layer, pooling layer and binary classifier in the discriminant module.

[0040] Compared with the prior art, the present invention has at least the following beneficial effects:

[0041] (1) The network structure of the image deraining method based on the deformable attention mechanism provided by the present invention includes two main modules: a generator and a discriminator. The generator is used to detect rain streaks from multi-scale angles, and the discriminator is used to determine whether its input image is a derained image or a clean image. Through multiple rounds of training, the model converges to achieve the optimal image deraining effect.

[0042] (2) The technical solution of the present invention is based on a generative adversarial network and introduces a deformable attention mechanism. By establishing flexible connections between different positions, it adaptively captures the non-uniform structure and deformation in the input data, thereby adaptively determining the target edge and achieving a better rain noise filtering effect.

[0043] (3) The present invention can perform feature extraction from multiple scales to meet the needs of rain noise points of different fine grains, thereby improving the ability to remove noise points of different sizes. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The drawings are only for the purpose of illustrating particular embodiments and are not to be construed as limiting the invention.

[0045] Figure 1 A flowchart of an image deraining method based on a deformable attention mechanism disclosed in an embodiment of the present invention;

[0046] Figure 2 A flow chart of a generation module disclosed in an embodiment of the present invention;

[0047] Figure 3 A schematic diagram for comparing different attention mechanisms disclosed in an embodiment of the present invention;

[0048] Figure 4 A schematic diagram of multi-scale feature fusion disclosed in an embodiment of the present invention;

[0049] Figure 5 A flow chart of a discrimination module disclosed in an embodiment of the present invention;

[0050] Figure 6 The overall structural diagram of the image deraining method based on the deformable attention mechanism disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. In addition, the present invention can also be implemented in other ways different from those described herein, and therefore, the protection scope of the present invention is not limited by the specific embodiments disclosed below.

[0052] In order to illustrate the effectiveness of the method proposed by the present invention, the above technical solution of the present invention is described in detail below through a specific embodiment. Figure 1 , Figure 6As shown, a method for image deraining based on a deformable attention mechanism is disclosed. The present invention is based on a generative adversarial network (GAN) to filter out rain noise from rainy images. The network structure of the present invention includes two main modules: a generation module and a discrimination module. The generation module is used to detect rain streaks from multi-scale angles, and the discrimination module is used to determine whether the image input is a derained image or a clean image. Through multiple rounds of training, the model converges to achieve the optimal image deraining effect, thereby obtaining a derained image. The specific implementation steps are as follows:

[0053] Step S1: construct a dataset of rain image and clean image pairs.

[0054] In order to train the mapping between rainy images and clean images, rainy and sunny images at the same time and location are required. To this end, the image dataset of the present invention may be obtained by: collecting through online databases and public datasets, using data generation techniques such as data enhancement, simulated data generation, etc., obtaining through field collection or collecting through user contribution, etc.

[0055] In some embodiments, the present invention determines an image dataset based on data generation technology. First, it is necessary to create corresponding natural rainy day images from clean image data, and synthesize a dataset of image pairs consisting of clean images and rainy images. This step can use a rain generation network such as RainNet, DerainNet or PReNet, and the present invention does not limit the rain generation network used.

[0056] Through this method, the present invention solves the problem of difficulty in obtaining rainy and sunny image pairs under natural conditions, and can expand the scale and diversity of training data sets, which helps to improve the generalization ability and processing effect of the deraining algorithm.

[0057] Step S2: determine an image deraining model, wherein the image deraining model includes a generation module and a discrimination module.

[0058] Step S3: The generation module processes the rain images in the data set based on the deformable attention mechanism to generate a pseudo derained image.

[0059] The generation module is used to detect rain noise at different scales, and then filter out rain through a convolutional neural network to output a pseudo image G(A) after rain removal. The specific structure is as follows: Figure 2 shown.

[0060] Step S3-1: The generation module extracts features of the input image based on the deformable attention mechanism to obtain an attention pyramid.

[0061] like Figure 4As shown in the figure, the input rain image A is downsampled using convolution kernels of different sizes to obtain an image pyramid composed of images of different resolutions; then a convolutional neural network based on a deformable attention mechanism is used to extract features from images of different scales, generate multi-scale attention maps, and form an attention pyramid.

[0062] To address the problem of unclear edges of targets in images caused by rain, in the feature extraction stage, the present invention uses a deformable attention mechanism to replace the self-attention mechanism in the model, so that the model can establish flexible connections between different positions and adaptively capture the non-uniform structure and deformation in the input data, thereby adaptively determining the target edges.

[0063] The self-attention mechanism is a mechanism for processing sequence data. It can perform information interaction and weight calculation within the sequence to better adapt to the spatial variation of the input data, thereby capturing the complex associations between elements without relying on information outside the sequence. The deformable attention mechanism is an extension of the self-attention mechanism. It introduces a learnable attention weight matrix that can dynamically adjust the calculation method of the attention weight according to the input data, thereby more flexibly capturing the relationship between different elements in the sequence.

[0064] For rain image A, the use of traditional convolutional neural networks is often limited by the size of the receptive field. When each reference point is associated with surrounding pixels, the surrounding features with the highest attention weight are usually blurred due to the presence of rain noise, such as Figure 3 As shown in the left figure, this affects the distribution of attention weights and the image deraining effect. Figure 3 As shown in the figure on the right, when the attention mechanism is used for feature extraction, regardless of the spatial size of the feature map, the deformable attention module only focuses on a small set of key sampling points around the reference point.

[0065] In some embodiments, the present invention can implement a deformable attention mechanism by using deformable convolution, position-based attention mechanism, content-based attention mechanism or multi-head attention mechanism. The features of each position in the input sequence can be weighted, and the weight calculation can be based on position encoding and relative position; the similarity between the feature vectors of each position in the input sequence can be judged to obtain a representation that pays more attention to the relevant content, and the similarity calculation can be done by dot product, scaled dot product and other methods; the calculation method of dynamically adjusting the attention weight according to the content of the input sequence can be used to better adapt to different types of inputs, and the adjustment method can include dynamically adjusting the number of attention heads, attention calculation formulas, etc. Through the above methods, thanks to the advantages of variable number of sampling points and associated positions, the deformable attention mechanism of the present invention can effectively avoid the errors caused by irregular rain noise points, so that the reference points are more focused on the associated features themselves rather than the complex global situation, while expanding the receptive field and reducing the redundancy of calculation.

[0066] Step S3-2: perform multi-scale feature fusion on the attention pyramid, perform multi-layer processing on the fused feature map, and output a pseudo derained image.

[0067] The attention pyramid generated in step S3-2 is Figure 4 In the example in , multi-scale feature fusion is performed. Attention maps of different scales are upsampled and then superimposed. The superimposed attention map is then multiplied with the original image to obtain a multi-scale fused feature map, which can adapt to rain noise points of different sizes. Multiple convolutional layers are used to extract finer-grained features. Multi-layer residual modules are superimposed to further extract features and improve the deraining performance of the generation module. The same number of deconvolution layers as the convolutional layers is used to restore the multi-layer feature map to the size of the input image A. Finally, the pseudo derained image G(A) is obtained based on the output feature map for input into the subsequent discrimination module.

[0068] Step S4, the discrimination module judges the pseudo derained image and the clean image in the data set to obtain a discrimination result;

[0069] The discriminant module reads the derained image G(A) and the clean image B, performs true / false category judgment respectively, and then calculates the discriminator loss based on the judgment results. Among them, the derained image is false, and the label value is 0; the clean image is true, and the label value is 1. The specific structure is as follows Figure 5 shown.

[0070] Step S4-1, the discrimination module discriminates the pseudo derained image and the clean image respectively, and obtains the category discrimination results of the pseudo derained image and the clean image;

[0071] Step S4-2: Based on the category discrimination result of the pseudo derained image, the generation module loss and the pseudo image loss are calculated; based on the category discrimination result of the clean image, the true image loss is calculated.

[0072] The pseudo derained image G(A) output by the generation module in step S3-2 is used as the input of the discrimination module. After being processed by multiple convolutional layers and pooling layers, the obtained high-dimensional feature map is input into the binary classifier to judge whether the image is real or fake, and the category discrimination result D(G(A)) is obtained, which is used to indicate the probability that the discrimination module considers the input image G(A) to be a real image. The BCELoss function using it as a parameter calculates the loss of the generation module. Backward propagation is performed based on the calculated loss of the generation module g_loss to adjust the parameters of the generation module part.

[0073] In some embodiments, the attention weights of the convolutional neural network of the deformable attention mechanism are adjusted, and the network parameters of the convolutional layer, the residual module, and the deconvolutional layer in the generation module are adjusted.

[0074] The calculation method of generating module loss g_loss is:

[0075] g_loss=BCELoss(x1,y1)=-w·[y1·log(x1)+(1-y1)·log(1-x1)]

[0076] x1=D(G(A)),y1=1

[0077] Among them, g_loss is the generation module loss, which is used to calculate the difference between the derained image category D(G(A)) after discrimination and the real image category; x1 represents the derained image category D(G(A)) after discrimination; y1 represents the label value, which is an all-1 matrix; w represents the weight, which can be adjusted by the model during training.

[0078] Then the BCELoss function is used to calculate the fake image loss fake_loss, which is calculated as follows:

[0079] fake_loss=BCELoss(x1,y0)=-w·[y0·log(x1)+(1-y0)·log(1-x1)]

[0080] x1=D(G(A)),y0=0

[0081] Among them, fake_loss is the fake image loss of the discriminant module, which is used to reflect the accuracy of the derained image G(A) being judged as fake; x1 represents the derained image category D(G(A)) after discrimination; y0 represents the label value, which is an all-zero matrix; w represents the weight, which can be adjusted by the model during training.

[0082] Then the clean image is discriminated and the true image loss is calculated.

[0083] Select the clean image B in the training set as input, and calculate the real image loss real_loss through the discriminant module process described in step 3-1, so as to ensure the discriminant module's ability to distinguish clean images. The calculation method of the real image loss real_loss is:

[0084] real_loss=BCELoss(x2,y1)=-w·[y1·log(x2)+(1-y1)·log(1-x2)]

[0085] x2=D(B),y1=1

[0086] Among them, real_loss is the true image loss of the discriminant module, which is used to reflect the accuracy of the clean image being judged as true; x2 represents the clean image category D(B) after discrimination; y1 represents the label value, which is an all-1 matrix; w represents the weight, which can be adjusted by the model during training.

[0087] In particular, the clean image B is an image in the data set randomly selected by the network, and may be the clean image A corresponding to the rain image A.

[0088] The loss of the discriminative module is obtained based on the pseudo-image loss and the real-image loss.

[0089] The fake image loss fake_loss and the real image loss real_loss are averaged as the overall loss d_loss of the discriminant module. Backward propagation is performed based on the calculated discriminant loss to adjust the parameters of the discriminant module.

[0090] In some embodiments, adjusting the parameters of the discrimination module includes adjusting the network parameters of the convolution layer, the pooling layer and the binary classifier in the discrimination module.

[0091] Step S5: Based on the discrimination result, adjust the parameters of the generation module and the discrimination module, and train the image deraining model so that the performance of the generation module and the discrimination module is optimized.

[0092] In this step, the loss is optimized to achieve model convergence, and finally the optimal derained image G(A) is output to complete the image rain denoising task.

[0093] In some embodiments, the optimal goal of training is to achieve a dynamic balance between the performance of the generator and the discriminator. In the optimal state, the generator can generate data that is very close to the distribution of real data, while the discriminator cannot distinguish between the generated data and the real data, that is, the discriminator's judgment on the data generated by the generator and the real data becomes a random guess. The evaluation method for evaluating the optimality of GAN training may include: quality evaluation of generated data, such as visual inspection, expert evaluation or the use of some quantitative indicators and the classification performance of the discriminator; the present invention does not limit the evaluation method for training to achieve the optimal loss.

[0094] Through the above steps, the present invention designs a basic architecture of an image deraining network, which is based on a generative adversarial network and introduces a deformable attention mechanism to adaptively determine the edge of the target and extract features from multiple scales, thereby improving the ability to remove noise points of different sizes. After the rain filtering operation, the output derained image can provide a clearer and more accurate input for downstream image detection tasks, thereby achieving the purpose of accurately identifying targets, and can provide an effective solution to severe weather for the development of autonomous driving image perception tasks.

[0095] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.

Claims

1. An image deraining method based on a deformable attention mechanism, characterized in that: The following steps are involved: Step S1, constructing a dataset of rain image and clean image pairs; Step S2, determining an image deraining model, wherein the image deraining model includes a generation module and a discrimination module; Step S3, the generation module processes the rain image in the data set based on the deformable attention mechanism to generate a pseudo derained image; Step S4, the discrimination module judges the pseudo derained image and the clean image in the data set to obtain a discrimination result; Step S5: Based on the discrimination result, adjusting the parameters of the generation module and the discrimination module, and training the image deraining model, so that the performance of the generation module and the discrimination module is optimized; Step S6: Apply the trained image deraining model to image rain denoising to obtain a derained image.

2. The image deraining method based on deformable attention mechanism according to claim 1, characterized in that: Step S1 specifically includes: Based on the clean image data, natural rainy day images corresponding to the same position of the clean image are synthesized to form a data set of image pairs consisting of clean images and rainy images.

3. The image deraining method based on deformable attention mechanism according to claim 2, characterized in that: Step S3 specifically includes: Step S3-1, the generation module extracts features from the input image based on the deformable attention mechanism to obtain an attention pyramid; Step S3-2: perform multi-scale feature fusion on the attention pyramid, perform multi-layer processing on the fused feature map, and output a pseudo derained image.

4. The image deraining method based on deformable attention mechanism according to claim 3, characterized in that: Step S3-1 specifically includes: Down-sampling the input rain image using convolution kernels of different sizes to obtain an image pyramid consisting of images of different resolutions, wherein the images of different resolutions include: a low-resolution image, a high-resolution image, and an original resolution image; Using a convolutional neural network based on a deformable attention mechanism to extract features from the images of different resolutions, generating attention maps of different scales to form an attention pyramid; Among them, the convolutional neural network of the deformable attention mechanism is provided with an attention weight matrix that is dynamically adjusted according to the input data, and the attention weight matrix is ​​used to adjust the receptive field of the neural network so that the receptive field matches the size of the rain noise point.

5. The image deraining method based on deformable attention mechanism according to claim 4, characterized in that: Step S3-2 specifically includes: The attention maps of different scales in the attention pyramid are upsampled and superimposed respectively, and the superimposed attention map is multiplied with the original image to obtain a multi-scale fusion feature map; The multi-scale fusion feature map is subjected to multi-layer processing, including: multiple convolutional layers for finer-grained feature extraction, a multi-layer residual module for further feature extraction, and a deconvolution layer with the same number of convolutional layers to restore the multi-layer feature map to the size of the input rain image; finally, a pseudo derained image is obtained according to the output feature map.

6. The image deraining method based on a deformable attention mechanism according to any one of claims 3 to 5, characterized in that: Step S4 specifically includes: Step S4-1, the discrimination module discriminates the pseudo derained image and the clean image respectively, and obtains the category discrimination results of the pseudo derained image and the clean image; Step S4-2: Based on the category discrimination result of the pseudo derained image, the generation module loss and the pseudo image loss are calculated; based on the category discrimination result of the clean image, the true image loss is calculated.

7. The image deraining method based on deformable attention mechanism according to claim 6, characterized in that: Step S4-1 specifically includes: The discrimination module performs discrimination processing on the pseudo derained image and the clean image respectively, including: after processing through multiple convolutional layers and pooling layers, the obtained high-dimensional feature map is input into a binary classifier to obtain the category discrimination results of the pseudo derained image and the clean image respectively.

8. The image deraining method based on deformable attention mechanism according to claim 7, characterized in that: Step S4-2 specifically includes: The calculation method of generating module loss g_loss is: g_loss=BCELoss(x1,y1)=-w·[y1·log(x1)+(1-y1)·log(1-x1)] x1=D(G(A)),y1=1 Among them, BCELoss(·) is the binary cross entropy loss function, x1 is the category discrimination result D(G(A)) of the pseudo derained image G(A); y1 is the all-1 matrix; w represents the weight of the model; The calculation method of fake_loss is: fake_loss=BCELoss(x1,y0)=-w·[y0·log(x1)+(1-y0)·log(1-x1)] x1=D(G(A)),y0=0 Among them, y0 is a matrix of all zeros; The calculation method of real image loss real_loss is: real_loss=BCELoss(x2,y1)=-w·[y1·log(x2)+(1-y1)·log(1-x2)] x2=D(B),y1=1 Among them, x2 is the category discrimination result D(B) of the clean image B; y1 is an all-1 matrix.

9. The image deraining method based on deformable attention mechanism according to claim 8, characterized in that: In step S5, adjusting the parameters of the generation module and the discrimination module based on the discrimination result specifically includes: Performing back propagation according to the calculated generation module loss g_loss, adjusting the parameters of the generation module part, including: adjusting the attention weight of the convolutional neural network of the deformable attention mechanism and adjusting the network parameters of the convolutional layer, residual module and deconvolution layer in the generation module; The fake image loss fake_loss and the real image loss real_loss are averaged as the overall loss d_loss of the discriminant module. Backward propagation is performed based on the calculated overall loss d_loss of the discriminant module to adjust the parameters of the discriminant module, including adjusting the network parameters of the convolutional layer, pooling layer and binary classifier in the discriminant module.

Citation Information

Patent Citations

  • Two-step single image rain removal method based on generative adversarial network

    CN117474783A

  • Progressive single image rain removal method based on multi-scale fusion

    CN117475285A

  • Multi-scale feature fusion rain removal method based on generative adversarial network

    CN117670721A

  • Image rain removal method and device based on deformation multi-head attention, equipment and medium

    CN117689580A

  • Refined single image rain removal method based on generative adversarial network

    CN110992275A