Image rain removal method and system based on multi-scale prior injection
By using a U-shaped encoder-decoder structure and a multi-scale prior injection method, combined with the Transformer model, the problem of difficulty in recovering background information in existing rain removal methods is solved, generating high-quality rain-free images and improving image rain removal performance and robustness to visual tasks.
Patent Information
- Application Number
- CN202511492788.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-10-20
AI Technical Summary
Existing image deraining methods struggle to effectively recover background information while removing rain streaks. Furthermore, traditional Transformer models suffer from redundant feature interference and low computational efficiency, neglecting the importance of image content structure and prior knowledge.
A U-shaped encoder-decoder structure is adopted to introduce prior information of the image. Multi-scale potential background prior features are extracted through the U-Net network and combined with the Transformer model. Self-attention and multi-scale dynamic sparse selection strategies are applied to optimize the utilization efficiency of prior information and enhance the ability to restore local details.
It achieves accurate image restoration, improves rain removal performance, generates rain-free images with rich texture details, enhances image quality, and improves robustness to advanced vision tasks.
Smart Images

Figure CN120976063B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to an image deraining method and system based on multi-scale prior injection. Background Technology
[0002] Rain streaks and raindrops in rainy images significantly degrade visual quality and negatively impact the performance of advanced computer vision tasks such as autonomous driving and object detection. Therefore, removing rain streaks and raindrops from rainy images and restoring clear background information is not only a way to improve image quality but also serves as a preprocessing step for advanced vision tasks, significantly enhancing their robustness under complex weather conditions. However, due to the complexity of rainy imaging, effectively restoring background information while removing rain streaks remains a highly challenging problem.
[0003] With the rapid development of deep learning technology, rain removal methods based on convolutional neural networks (CNNs) have made significant progress. However, due to the inherent limitation of local receptive fields in CNNs, they are insufficient in capturing long-range dependencies, often resulting in incomplete rain pattern removal. Traditional Transformer models suffer from redundant feature interference and low computational efficiency in image rain removal tasks due to their global attention mechanism. Existing image rain removal methods often neglect the importance of image content structure and prior knowledge. Summary of the Invention
[0004] This invention aims to at least solve one of the technical problems existing in related technologies. To this end, this invention provides an image deraining method and system based on multi-scale prior injection. This invention introduces prior information about the image through a U-shaped encoder-decoder structure, enabling the network to better learn the background distribution and structural features of the image, further optimizing the utilization efficiency of prior information. By combining the extracted prior information with a Transformer, the network is guided to retain structural features while processing global features, enhancing the ability to restore local details. Self-attention is applied at the channel dimension to reduce time and memory complexity, and a multi-scale dynamic sparse selection strategy is adopted when calculating the similarity of pixel pairs between all queries and keywords, retaining the most useful self-attention values for feature aggregation, generating rain-free images with rich texture details, achieving accurate image restoration and improving deraining performance.
[0005] This invention provides an image deraining method based on multi-scale prior injection, comprising:
[0006] S1: Obtain the rainy day image, subtract the grayscale image formed by the maximum pixel value along the channel dimension of the rainy day image from the grayscale image formed by the minimum pixel value along the channel dimension of the rainy day image to obtain an initial rough rainless image;
[0007] S2: Extract multi-scale latent background prior features from the initial coarse rainless image through the residual branches of the pre-trained U-Net network;
[0008] S3: Guided by the multi-scale latent background prior features, the multi-scale rain stripe features of the rainy day image are extracted through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features.
[0009] S4: The rain stripe features of the first-scale decoder are processed by the Tformer module and then by the convolution module to obtain the rain-removed feature image. The rain-removed feature image is added to the rainy day image to obtain the rain-removed image.
[0010] Furthermore, the U-Net network is a U-shaped encoder-decoder structure, including a residual branch and a PITformer branch. The residual branch includes multiple residual modules stacked sequentially, and the PITformer branch includes multiple PITformer modules stacked sequentially.
[0011] Furthermore, in step S2, multi-scale latent background prior features of the initial coarse rainless image are extracted through the residual branch of the U-Net network, and the calculation expression is:
[0012]
[0013]
[0014]
[0015] in, These are the latent background prior features of the first-scale encoder. For residual modules, for Convolution operation, This is a grayscale image formed by the maximum pixel value along the channel dimension of a rainy day image. This is a grayscale image formed by the minimum pixel value along the channel dimension of a rainy day image. For the first Scale encoder latent background prior features, For downsampling, For the first Scale encoder latent background prior features, For the first scale decoder latent background prior features, for Convolution operation, This is a splicing operation along the channel dimension. For upsampling operation, For the first scale decoder latent background prior features, For the first Scale encoder latent background prior features.
[0016] Furthermore, in step S3, guided by the multi-scale latent background prior features, the multi-scale rain stripe features of the rainy day image are extracted through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features. The calculation expression is as follows:
[0017]
[0018]
[0019]
[0020] in, The rain stripe feature is for the first-scale encoder. For the PITformer module, Image of a rainy day. For the first Rain stripe features of scale encoder For the first Rain stripe features of scale encoder For the first Scale decoder rain stripe features For the first Scale decoder rain stripe features For the first Rain stripe features of the scale encoder.
[0021] Furthermore, the PITformer module captures the global structure and texture information of the image through prior injection of attention blocks, and achieves feature fusion through a gated convolutional feedforward network. The calculation expression is as follows:
[0022]
[0023]
[0024] in, For the first Prior injection of intermediate features by the scale encoder Inject attention blocks into the prior. For layer normalization operation, It is a gated convolutional feedforward network.
[0025] Furthermore, the input feature map of the prior-injected attention block is subjected to partial convolution and Convolution generates queries, keys, and values. Feature aggregation is achieved through a multi-scale dynamic sparse strategy, resulting in a feature matrix after self-attention computation. The feature matrix obtained after self-attention computation and the encoder's latent background prior features are then processed by a prior injection unit and further processed by convolution to obtain the output features of the prior injection attention block.
[0026] Furthermore, the calculation expression for the prior injection unit is:
[0027]
[0028]
[0029]
[0030]
[0031]
[0032] in, For the first Scale encoder fusion features For the first The feature matrix obtained by the scale encoder after self-attention computation. These are features processed by the local attention mechanism. The features are obtained after processing by the global attention mechanism. It is the ReLU activation function. This is a global average pooling operation. Spatial attention weights, It is the Sigmoid activation function. For the first Output features of the prior injection unit in the scale encoder This is for element-wise multiplication.
[0033] Furthermore, the computational expression for the gated convolutional feedforward network is:
[0034]
[0035]
[0036] in, This is the first parallel path feature. This is a feature of the second parallel path. For channel grouping operations, For partial convolution, For element-wise multiplication, This is the GELU activation function.
[0037] Furthermore, the Tformer module is the module obtained by removing the prior injection unit from the PITformer module.
[0038] The present invention also provides an image deraining system based on multi-scale prior injection, for performing the above-mentioned image deraining method based on multi-scale prior injection, comprising:
[0039] An initial image acquisition subsystem acquires a rainy day image and subtracts the grayscale image formed by the maximum pixel value along the channel dimension of the rainy day image from the grayscale image formed by the minimum pixel value along the channel dimension of the rainy day image to obtain an initial rough rainless image.
[0040] The first feature extraction subsystem extracts multi-scale latent background prior features of the initial coarse rainless image through the residual branch of the pre-trained U-Net network.
[0041] The second feature extraction subsystem, guided by multi-scale latent background prior features, extracts multi-scale rain stripe features from rainy images through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features.
[0042] The rain removal image acquisition subsystem obtains a rain stripe feature image by passing the rain stripe feature of the first scale decoder through the Tformer module and then through the convolution module. The rain removal feature image is then added to the rainy day image to obtain a rainless image.
[0043] The above-described one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects:
[0044] This invention introduces prior information about the image through a U-shaped encoder-decoder structure, enabling the network to better learn the background distribution and structural features of the image, further optimizing the utilization efficiency of prior information. By combining the extracted prior information with the Transformer, the network is guided to retain structural features while processing global features, enhancing the ability to restore local details. Self-attention is applied in the channel dimension to reduce time and memory complexity, and a multi-scale dynamic sparse selection strategy is adopted when calculating the similarity of pixel pairs between all queries and keywords to retain the most useful self-attention values for feature aggregation, generating rain-free images with rich texture details, achieving accurate image restoration and improving rain removal performance.
[0045] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0047] Figure 1 This is a flowchart illustrating an image deraining method based on multi-scale prior injection provided by the present invention.
[0048] Figure 2 This is a schematic diagram of the overall network flow of an image deraining method based on multi-scale prior injection provided by the present invention.
[0049] Figure 3 This is a schematic diagram of the structure of the PITformer module provided by the present invention.
[0050] Figure 4 This is a schematic diagram of the prior injection attention block provided by the present invention.
[0051] Figure 5 This is a schematic diagram of the prior injection unit provided by the present invention.
[0052] Figure 6 This is a subjective comparison chart of the rain removal results of the Rain200H dataset in an embodiment of the present invention.
[0053] Figure 7 This is a subjective comparison chart of the rain removal results of the Internet-Data dataset in an embodiment of the present invention.
[0054] Figure 8 This is a schematic diagram of the structure of an image deraining system based on multi-scale prior injection provided by the present invention.
[0055] Figure label:
[0056] 101. Initial image acquisition subsystem; 102. First feature extraction subsystem; 103. Second feature extraction subsystem; 104. Rain removal image acquisition subsystem. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. The following embodiments are used to illustrate this invention but cannot be used to limit the scope of this invention.
[0058] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0059] The following is combined with Figures 1 to 8 This invention describes an image deraining method and system based on multi-scale prior injection.
[0060] like Figure 1 As shown, an image deraining method based on multi-scale prior injection includes:
[0061] S1: Obtain the rainy day image, subtract the grayscale image formed by the maximum pixel value along the channel dimension of the rainy day image from the grayscale image formed by the minimum pixel value along the channel dimension of the rainy day image to obtain an initial rough rainless image.
[0062] S2: Extract multi-scale latent background prior features from the initial coarse rainless image using the residual branches of the U-Net network;
[0063] The U-Net network has a U-shaped encoder-decoder structure, including a residual branch and a PITformer branch. The residual branch consists of multiple stacked residual modules, and the PITformer branch consists of multiple stacked PITformer modules. The overall network flow is as follows: Figure 2 As shown.
[0064] The scales of the residual branch and the PITformer branch, from left to right, are the encoder first scale, encoder second scale, encoder third scale, encoder fourth scale; decoder third scale, decoder second scale, decoder first scale.
[0065] The initial, rough, rainless image is input into the residual branch of the pre-trained U-Net network to obtain multi-scale latent background prior features. The calculation expression is as follows:
[0066]
[0067]
[0068]
[0069] in, These are the latent background prior features of the first-scale encoder. For residual modules, for Convolution operation, This is a grayscale image formed by the maximum pixel value along the channel dimension of a rainy day image. This is a grayscale image formed by the minimum pixel value along the channel dimension of a rainy day image. For the first Scale encoder latent background prior features, For downsampling, For the first Scale encoder latent background prior features, For the first scale decoder latent background prior features, for Convolution operation, This is a splicing operation along the channel dimension. For upsampling operation, For the first scale decoder latent background prior features, For the first Scale encoder latent background prior features.
[0070] S3: Guided by multi-scale latent background prior features, multi-scale rain stripe features of rainy images are extracted through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features; the calculation expression is:
[0071]
[0072]
[0073]
[0074] in, The rain stripe feature is for the first-scale encoder. For the PITformer module, Image of a rainy day. For the first Rain stripe features of scale encoder For the first Rain stripe features of scale encoder For the first Scale decoder rain stripe features For the first Scale decoder rain stripe features For the first Scale encoder rain stripe features, when hour, The first-scale decoder features rain stripes.
[0075] like Figure 3 As shown, the PITformer module captures the global structure and texture information of the image through prior injection attention blocks (PIAB), and achieves feature fusion through a gated convolutional feedforward network, with the first... Taking the scale encoder as an example, the calculation expression is:
[0076]
[0077]
[0078] in, For the first Prior injection of intermediate features by the scale encoder Inject attention blocks into the prior. For layer normalization operation, It is a gated convolutional feedforward network.
[0079] The prior injection attention block is based on the Transformer architecture and optimized for image deraining tasks.
[0080] like Figure 4 As shown, the input feature map of the prior injection attention block first undergoes partial convolution (Pconv) and Convolution generates queries ,key AND value To reduce computational and memory complexity, the self-attention mechanism is implemented along the channel dimension, employing a multi-scale dynamic sparsity (MDS) strategy. A Top-k selection algorithm is used to select the top-ranked similarity samples from each row of the similarity matrix. The network calculates the maximum value and sets elements below a preset threshold to zero. Different feature scales correspond to different thresholds. As the network depth increases, the threshold gradually increases to adapt to the diversity of multi-scale feature representations. The feature matrix obtained after self-attention calculation and the encoder's latent background prior features are passed through the prior injection unit and then through convolution to obtain the output features of the prior-injected attention block.
[0081] Self-attention is calculated as follows:
[0082]
[0083]
[0084] in, For query, As key, For value, For dimensional reshaping operations, For channel grouping operations, for Convolution operation, For partial convolution, For layer normalization operation, For the first The feature matrix obtained by the scale encoder after self-attention computation. The softmax activation function is used. For multi-scale dynamic sparse operations, For scaling parameters, For matrix multiplication, This is the transpose of the matrix. Figure 4 R is .
[0085] The computational expression for multi-scale dynamic sparse operations is:
[0086]
[0087] in, Output results for multi-scale dynamic sparse operations. for The resulting attention matrix, For each row in the matrix, the first... The invention sets a maximum value at four different scales. The values are 0.6, 0.7, 0.8, and 0.9, meaning that different values are retained at different scales. This is achieved by using a set of values to filter out redundant features, making feature aggregation within the scale more concentrated and robust.
[0088] The expression for calculating the output features of the prior injected attention block is:
[0089]
[0090] in, For the first Output features of PIAB in the scale encoder.
[0091] A Prior Injection Unit (PIU) is introduced into the Prior Injection Attention Block. By combining multi-scale prior features with the attention mechanism, the network's ability to understand image structure is explicitly enhanced. The introduction of the PIU enables PIAB to better preserve the structural information of the original image during rain removal, while effectively suppressing the interference of rain streaks on background features. This not only improves the model's ability to model global contextual information but also significantly enhances the recovery of local details, thereby achieving higher-quality rain removal performance in complex rain scenes.
[0092] like Figure 5 As shown, the Prior Injection Unit (PIU) enhances feature representation capabilities by introducing prior information. Specifically, the input prior feature map is first processed by a convolutional layer, and then these prior features are fused with the original feature map. During the fusion process, the module simultaneously extracts local details and global contextual information, thereby gaining a more comprehensive understanding of the image's spatial structure and helping to better preserve edge and texture information in the rain removal task. Next, spatial attention weights W are generated using the Sigmoid function, enabling the module to adaptively adjust the contribution levels of input and prior features, strengthening the focus on key regions. Finally, a weighted summation operation is used to generate the enhanced feature map. This process not only preserves the structural information of the original image but also introduces additional prior knowledge, enabling the model to extract rain stripe features more accurately in the rain removal task, thereby better recovering image details. Taking a scale encoder as an example, the expression for calculating PIU is:
[0093]
[0094]
[0095]
[0096]
[0097]
[0098] in, For the first Scale encoder fusion features For the first The feature matrix obtained by the scale encoder after self-attention computation. These are features processed by the local attention mechanism. The features are obtained after processing by the global attention mechanism. It is the ReLU activation function. This is a global average pooling operation. Spatial attention weights, It is the Sigmoid activation function. For the first Output features of the prior injection unit in the scale encoder.
[0099] Traditional feedforward networks use two Convolutional layers expand and compress feature channels, and nonlinear activation functions are applied in hidden layers to enhance the model's representational capabilities.
[0100] like Figure 3As shown, the gated convolutional feedforward network (PGFN) achieves interaction through element-wise multiplication of two parallel paths, one of which uses the GELU function for non-linear activation. Furthermore, to improve the distinction between rain streaks and background regions, a partial convolution (Pconv) operation is introduced to enhance local structure recovery performance. (The last sentence appears to be incomplete and requires further context.) Taking a scale encoder as an example, the calculation expression for a gated convolutional feedforward network is:
[0101]
[0102]
[0103] in, This is the first parallel path feature. This is a feature of the second parallel path. For channel grouping operations, For partial convolution, For element-wise multiplication, This is the GELU activation function.
[0104] S4: The rain stripe features of the first-scale decoder are processed by the Tformer module and then by the convolution module to obtain the rain-removed feature image. The rain-removed feature image is added to the rainy day image to obtain the rain-removed image.
[0105] The Tformer module is the module obtained by removing the prior injection unit from the PITformer module.
[0106] The expression for calculating the rain-removed image is:
[0107]
[0108] in, For rain removal images, , For dimension Image set, For height, For width, For the Tformer module, For the first-scale decoder rain stripe features, Image of a rainy day.
[0109] To verify the superior performance of this invention, quantitative and qualitative comparison experiments were conducted on the public synthetic datasets Rain200L, Rain200H, and DID-Data, comparing its results with those of several internationally advanced algorithms. These internationally advanced methods included Restormer (CVPR 2022 version, an efficient transformer for high-resolution image restoration), MFDNet (TIP 2024 version, a multi-scale fusion and decomposition network for single-image rain removal), and BIMNet (SPIC 2025 version, a bidirectional interactive multi-scale network based on wavelet transform-convolutional visual transformers). Table 1 shows the quantitative comparison experiments of the rain removal results on the synthetic datasets. This invention performed excellently on all evaluation metrics, where PSNR is the peak signal-to-noise ratio, and SSIM is the structural similarity index, with ↑ indicating a higher value is better. Subjective comparisons of the rain removal results on the Rain200H dataset are also included. Figure 6 As shown, the present invention can recover more detailed information while generating fewer artifacts, and the result is visually closest to the GT image, where Rainy represents the input rainy image and GT represents the no-rain reference image.
[0110] Table 1. Comparison of quantitative indicators of rain removal results from synthetic datasets.
[0111]
[0112] To verify the generalization ability and effectiveness of this invention in real-world scenarios, a pre-trained Rain200H model was tested on the Internet-Data dataset and compared with several internationally advanced algorithms. Table 2 shows the comparison of quantitative indicators for rain removal results on the Internet-Data dataset. This invention achieved optimal values in both the BRISQUE and NIQE metrics, where BRISQUE is a blind image quality assessment and NIQE is a natural image quality assessment; ↓ indicates that lower is better. Subjective comparison of rain removal results on the Internet-Data dataset is also included. Figure 7 As shown, compared with other methods, this invention can effectively remove most rain lines while better preserving background details, achieving more realistic reconstruction results in different scenarios. These experimental results fully demonstrate the powerful generalization ability of the model of this invention in real-world scenarios.
[0113] Table 2 Comparison of quantitative indicators for rain removal results from the Internet-Data dataset.
[0114]
[0115] To further verify the effectiveness of this invention in practical applications, the BDD350 dataset was used to apply derained images to an object detection task. Specifically, the derained images were used as input to the object detector, and YOLOv5 was employed as the detection model to evaluate the effect of image fusion in improving detection accuracy. Compared with other deraining methods, this invention can identify more targets with a lower error rate and higher detection confidence. The experimental results demonstrate that this invention not only improves image deraining but also effectively promotes the performance improvement of downstream tasks, exhibiting strong practical value.
[0116] like Figure 8 As shown, an image deraining system based on multi-scale prior injection is used to execute an image deraining method based on multi-scale prior injection, including:
[0117] The initial image acquisition subsystem 101 acquires a rainy day image, and subtracts the grayscale image formed by the maximum pixel value along the channel dimension of the rainy day image from the grayscale image formed by the minimum pixel value along the channel dimension of the rainy day image to obtain an initial rough rainless image.
[0118] The first feature extraction subsystem 102 extracts multi-scale latent background prior features of the initial coarse rainless image through the residual branch of the pre-trained U-Net network;
[0119] Guided by multi-scale latent background prior features, the second feature extraction subsystem 103 extracts multi-scale rain stripe features from rainy day images through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features.
[0120] The rain stripe features of the first-scale decoder in the rain removal image acquisition subsystem 104 are processed by the Tformer module and then by the convolution module to obtain the rain removal feature image. The rain removal feature image is then added to the rainy day image to obtain the rain removal image.
[0121] Through the collaborative work of the above modules, the U-shaped encoder-decoder structure introduces prior information about the image, enabling the network to better learn the background distribution and structural features of the image, further optimizing the utilization efficiency of prior information. By combining the extracted prior information with the Transformer, the network is guided to retain structural features while processing global features, enhancing the ability to restore local details. Self-attention is applied in the channel dimension to reduce time and memory complexity, and a multi-scale dynamic sparse selection strategy is adopted when calculating the similarity of pixel pairs between all queries and keywords to retain the most useful self-attention values for feature aggregation, generating rain-free images with rich texture details, achieving accurate image restoration and improving rain removal performance.
[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An image deraining method based on multi-scale prior injection, characterized in that, include: S1: Obtain the rainy day image, subtract the grayscale image formed by the maximum pixel value along the channel dimension of the rainy day image from the grayscale image formed by the minimum pixel value along the channel dimension of the rainy day image to obtain an initial rough rainless image; S2: Extract multi-scale latent background prior features from the initial coarse rainless image through the residual branches of the pre-trained U-Net network; S3: Guided by the multi-scale latent background prior features, the multi-scale rain stripe features of the rainy day image are extracted through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features. The PITformer module captures global structural and texture information of the image through prior injection of attention blocks, and achieves feature fusion through a gated convolutional feedforward network. The calculation expression is as follows: in, For the first Prior injection of intermediate features by the scale encoder Inject attention blocks into the prior. For layer normalization operation, It is a gated convolutional feedforward network. For the first Scale encoder latent background prior features, For the first Rain stripe features of a scale encoder; The input feature map of the prior injection attention block is processed by partial convolution and Convolution generates queries, keys, and values. Feature aggregation is achieved through a multi-scale dynamic sparse strategy to obtain a feature matrix after self-attention computation. The feature matrix obtained after self-attention computation and the encoder's latent background prior features are processed by a prior injection unit and then convolutional to obtain the output features of the prior injection attention block. S4: The rain stripe features of the first scale decoder are processed by the Tformer module and then by the convolution module to obtain the rain removal feature image. The rain removal feature image is added to the rainy day image to obtain the rain removal image. The Tformer module is the module obtained by removing the prior injection unit from the PITformer module.
2. The image deraining method based on multi-scale prior injection according to claim 1, characterized in that, The U-Net network is a U-shaped encoder-decoder structure, including a residual branch and a PITformer branch. The residual branch includes multiple residual modules stacked sequentially, and the PITformer branch includes multiple PITformer modules stacked sequentially.
3. The image deraining method based on multi-scale prior injection according to claim 1, characterized in that, In step S2, multi-scale latent background prior features of the initial coarse, rainless image are extracted using the residual branches of the U-Net network. The calculation expression is as follows: in, These are the latent background prior features of the first-scale encoder. For residual modules, for Convolution operation, This is a grayscale image formed by the maximum pixel value along the channel dimension of a rainy day image. This is a grayscale image formed by the minimum pixel value along the channel dimension of a rainy day image. For the first Scale encoder latent background prior features, For downsampling, For the first scale decoder latent background prior features, for Convolution operation, This is a splicing operation along the channel dimension. For upsampling operation, For the first scale decoder latent background prior features, For the first Scale encoder latent background prior features.
4. The image deraining method based on multi-scale prior injection according to claim 3, characterized in that, In step S3, guided by the multi-scale latent background prior features, the multi-scale rain stripe features of the rainy day image are extracted through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features. The calculation expression is as follows: in, The rain stripe feature is for the first-scale encoder. For the PITformer module, Image of a rainy day. For the first Rain stripe features of scale encoder For the first Scale decoder rain stripe features For the first Scale decoder rain stripe features For the first Rain stripe features of the scale encoder.
5. The image deraining method based on multi-scale prior injection according to claim 3, characterized in that, The calculation expression for the prior injection unit is: in, For the first Scale encoder fusion features For the first The feature matrix obtained by the scale encoder after self-attention computation. These are features processed by the local attention mechanism. The features are obtained after processing by the global attention mechanism. It is the ReLU activation function. This is a global average pooling operation. Spatial attention weights, It is the Sigmoid activation function. For the first Output features of the prior injection unit in the scale encoder This is for element-wise multiplication.
6. The image deraining method based on multi-scale prior injection according to claim 3, characterized in that, The computational expression for a gated convolutional feedforward network is: in, This is the first parallel path feature. This is a feature of the second parallel path. For channel grouping operations, For partial convolution, For element-wise multiplication, This is the GELU activation function.
7. An image deraining system based on multi-scale prior injection, characterized in that, To perform an image deraining method based on multi-scale prior injection as described in any one of claims 1 to 6, comprising: An initial image acquisition subsystem acquires a rainy day image and subtracts the grayscale image formed by the maximum pixel value along the channel dimension of the rainy day image from the grayscale image formed by the minimum pixel value along the channel dimension of the rainy day image to obtain an initial rough rainless image. The first feature extraction subsystem extracts multi-scale latent background prior features of the initial coarse rainless image through the residual branch of the pre-trained U-Net network. The second feature extraction subsystem, guided by multi-scale latent background prior features, extracts multi-scale rain stripe features from rainy images through the PITformer branch of the U-Net network to obtain the first-scale decoder rain stripe features. The rain removal image acquisition subsystem obtains a rain stripe feature image by passing the rain stripe feature of the first scale decoder through the Tformer module and then through the convolution module. The rain removal feature image is then added to the rainy day image to obtain the rain removal image.
Citation Information
Patent Citations
Progressive coupling image rain removal method and system based on CNN and Transform
CN116485689A
Multi-scale Transform image rain removal method based on residual channel prior guidance
CN119624811A