Multiple weather images restoration using the task transformer and adaptive mixup strategy
Yang Wen Anyu Lai Bo Qian Hao Wang Wuzhen Shi Wenming Cao











Yang Wen Anyu Lai et al.



Guangdong Provincial Key Laboratory of Intelligent Information Processing, School of Electronic and Information Engineering, Shenzhen University, Shenzhen, China The Department of Comupter Science and Engineering, Shanghai Jiao Tong University, Shanghai, China

Multiple weather images restoration using the task transformer and adaptive mixup strategy
    Yang Wen10000-0001-6303-8178 Anyu Lai1 Bo Qian2 Hao Wang1 Wuzhen Shi1 Wenming Cao1
    September 9, 2024
==========================================================================================



§ ABSTRACT 
The current state-of-the-art in severe weather removal predominantly focuses on single-task applications, such as rain removal, haze removal, and snow removal. However, real-world weather conditions often consist of a mixture of several weather types, and the degree of weather mixing in autonomous driving scenarios remains unknown. In the presence of complex and diverse weather conditions, a single weather removal model often encounters challenges in producing clear images from severe weather images. Therefore, there is a need for the development of multi-task severe weather removal models that can effectively handle mixed weather conditions and improve image quality in autonomous driving scenarios. In this paper, we introduce a novel multi-task severe weather removal model that can effectively handle complex weather conditions in an adaptive manner. Our model incorporates a weather task sequence generator, enabling the self-attention mechanism to selectively focus on features specific to different weather types. To tackle the challenge of repairing large areas of weather degradation, we introduce Fast Fourier Convolution (FFC) to increase the receptive field. Additionally, we propose an adaptive upsampling technique that effectively processes both the weather task information and underlying image features by selectively retaining relevant information. Our proposed model has achieved state-of-the-art performance on the publicly available dataset.








§ INTRODUCTION

The removal of adverse weather conditions, including rain, snow, and haze, from images is a critical challenge in numerous fields. Extreme weather events significantly impair the ability of computer vision algorithms to extract relevant information from images. Therefore, mitigating such weather-related effects is necessary to enhance the reliability of computer vision systems<cit.><cit.><cit.>.


In this paper, we propose a novel approach for recovering multi-weather degraded images by leveraging a task sequence generator and an adaptive module. During the feature extraction phase, we employ a Task Intra-patch Block (TIPB) to partition the image into smaller patches and extract degraded features from them. These features are utilized not only in subsequent feature extraction stages but also fed into a Task Query Generator to generate task sequences based on the input task characteristics at each stage. This enables us to selectively focus on different types of degradation information during the upsampling stage. To address the challenge of handling large-area degraded features, we utilize Fast Fourier Convolution (FFC) to expand the receptive field. Finally, to fuse degraded information with background information, we employ adaptive upsampling techniques in the image restoration process. Our main contributions are:


    
  * We introduce a novel and highly efficient solution for tackling severe weather removal challenges, specifically focusing on image inpainting guided by the generation of weather degradation information and task feature sequences. Our proposed method surpasses the performance of existing state-of-the-art approaches in both real-world datasets and downstream object detection tasks.
    
  * We propose the Task Intra-patch Block (TIPB), a novel feature extraction block that effectively captures detailed features of various degradation types at different scales. By utilizing TIPB at multiple stages, our approach can extract highly informative features that are tailored to each stage of the image restoration process. This enables us to effectively address different types of degradation and achieve superior performance in restoring degraded images.
    
  * We present a novel task sequence generator that leverages multi-scale degradation details to generate task feature sequences. Our approach effectively captures the complex relationships between different degradation types at different scales and generates task sequences that are tailored to the specific. characteristics of the input image.





§ RELATED WORK



Deep learning-based solutions have become increasingly popular for various weather-related image restoration tasks, including rain removal<cit.>, hazy removal<cit.>, and snow removal<cit.>. These approaches have demonstrated significant performance improvements compared to traditional methods.



 §.§ For Rain Removal

 Jiang et al.<cit.> mainly proposed a multi-scale progressive fusion network (MSPFN). For the imaging principle of rain, due to the different distances between the rain and the camera, the rain in the image will show different ambiguities and resolutions, so the complementary information between multi-resolution and multi-pixels can be used to represent rain streaks The main paper proposes a framework from the perspective of input geometry and depth graphics, explores the multi-geometry representation of rain streaks, and first accomplishes deraining. For pixel rain streaks at different locations, the gradient calculation is used to obtain the global texture, so as to explore the complementarity in the spatial dimension and read out information to characterize the target rain streaks.




 §.§ For Haze Removal
 To address the dense and uneven distribution of haze, Jin et al.<cit.> propose a model that extracts feature representations from a pre-trained visual transformer (DINO-ViT) to recover background information. To guide the network to focus on non-uniform haze regions and then remove the haze accordingly, they introduce uncertainty feedback learning, which produces uncertainty maps with higher uncertainty in denser haze regions and can be viewed as the attention map representing the density of the haze and the non-uniformity of the distribution. Let the feedback network iteratively refine our dehazing output based on the uncertainty map. 

 

 §.§ For Snow Removal
 Currently, handcrafted features are still the mainstream for snow removal, making it difficult to achieve large-scale generalization. Liu et al.<cit.> designed a multi-stage network called DesnowNet to sequentially handle the removal of translucent and opaque snow particles. We also differentiate snow translucency and color difference properties for accurate estimation. Furthermore, their method separately estimates the remaining complement of snow-free images to recover details occluded by opaque snow. In addition, the whole network adopts a multi-scale design to simulate the diversity of snow.



 §.§ Multi-task Weather-related Image Restoration

Li et al.<cit.> first designed a generator with multiple task-specific encoders, each associated with a specific type of severe weather degradation. They utilize neural architecture search to optimally process image features extracted from all encoders. Subsequently, to transform degraded image features into clean background features, they introduce a series of tensor-based operations that encapsulate the fundamental physics behind the formation of rain, haze, snow, and adherent raindrops. These operations are the basic building blocks of schema search. Finally, the discriminator simultaneously evaluates the correctness of the restored image and classifies the degradation type. Valanarasu et al.<cit.> propose TransWeather, a Transformer-based end-to-end model that can recover images degraded by any weather condition with only one encoder and one decoder. Specifically, they exploit a novel Transformer encoder that uses intra-patch Transformer blocks to enhance intra-patch attention to effectively remove small weather degradations. 




§ METHOD


We propose a novel framework to tackle different image degradation tasks, as shown in Figure<ref>. In this section, we provide a comprehensive overview of the network framework.










 §.§ Network Architecture

The proposed network takes a 3×3 weather-degraded image as input. The input image will be processed by a multi-stage Transformer block to generate local information from different stages. The output of each stage is then input to the TIPB module, which extracts degradation-specific detail features according to the specific degradation task. The resulting multi-stage degradation features are fed into the task sequence generator to generate a task sequence that facilitates the identification of the specific degradation task affecting the input image. To capture more global information, the FFC module is introduced into the network. The down-sampled output of each stage is first input to the FFC module to extract global information, which is then used to assist in image restoration in the subsequent upsampling stage. In the upsampling stage, learnable parameters are employed to selectively fuse task features and image features, ultimately resulting in the restoration of a clear image.



 §.§ Task Intra-patch Block

At each stage, the Task Intra-patch Block(TIPB) processes the image features, which are first cropped to half the size of the original image to facilitate the extraction of smaller degraded details. As shown in Figure<ref>, in order to adaptively query different degraded features, an external learnable sequence is introduced and optimized during the training of the network. The resulting sequence generates a feature map that contains a substantial amount of task-specific information, which is combined with the input image and input into the Transform Block of the next stage. The feature maps from each stage are jointly input into the task sequence generator to generate a task query vector that assists in identifying the specific degradation task affecting the input image. This approach facilitates the effective extraction of task-specific information at each stage, ultimately leading to improved performance in image restoration. The output of TIPB can be expressed as:

    TIPB_i(I_i)=FFN(MSA(I_i)+I_i)

where T(·) represents the transformer block, FFN(·) repre-
sents the feed-forward network block, MSA(·) represents
multi-head self-attention, I is the input and i represents the
stage in the encoder. The multi-head attention of the TIPB module is different from the traditional form, and its self-attention is defined as follows: 

    Attn(Q,K,V) = softmax(Q_learnabledK^T/√(d))V

The proposed network leverages a randomly generated task query sequence (Q) to represent a diverse range of weather conditions. The keys (K) and values (V) used in the attention mechanism are derived from the input feature map.



 §.§ Task Sequence Generator

The TIPB module introduces a stochastic task vector into the transformer module as a query in the attention mechanism. This vector is trained concurrently with the network and facilitates the capture of degradation characteristics under varying weather conditions. TIPB operates on each level of the encoder to extract degradation information of diverse scales in the image. The TIPB's output is subsequently fed into the encoder of the subsequent stage, and the outputs of all stages are jointly utilized as input to the Task Sequence Generator for generating a task sequence pertaining to the image.

The Task Sequence Generator comprises several convolutional layers of varying scales and a self-attention module. These convolutions, operating at different stages, enable effective processing of the output of the Task Information Processing Block (TIPB). We then utilize a 3x3 convolutional layer to combine the task information from the four different scales, resulting in a task feature query vector map. This map is subsequently used as the query (Q) in conjunction with the image in the self-attention mechanism to generate a feature map that contains rich task information. The output of Task sequence generator can be expressed as:

    Tsg(I, Q_Task)=FFN(MSA(I, Q_Task)+I)



    Q_Task=Cov_3,3(Cov_7,7(T_1)+Cov_5,5(T_2)+Cov_3,3(T_3))

Where Tsg(·) represents the output of the Task-sequence Generator, FFN(·), and MSA(·) represent the feedforward network and the multi-head self-attention module, respectively. I represent the feature map input to the Task-sequence Generator, and Q_Task represents the generated task query sequence. T_i denotes the output of TIPB from the i-th stage. Conv_n,n represents the use of n×n convolution operations.

The Task-sequence Generator module improves the ability to capture the degradation characteristics of different weather conditions. Figure <ref> presents a comparison of the intermediate results of three tasks using the Base Model and the Task-sequence Generator module. Specifically, outputs a and b correspond to the rain removal task, c and d correspond to the haze removal and rain removal task, and e corresponds to the snow removal task. The first three rows illustrate the input image, the output of the Base Model, and the output after incorporating the Task-sequence Generator module.

Our results demonstrate that the Task-sequence Generator module enhances the ability to capture degradation characteristics compared to the Base Model. Specifically, the degradation information in the output images is clearer, and the contrast between the degradation content and the background is stronger. These findings highlight the importance of incorporating advanced techniques, such as the Task-sequence Generator module, in image restoration tasks to improve performance and enhance the quality of the results.
 


 §.§ Fast Fourier Convolution 

 The restoration of weather images with dense degradation has posed a significant challenge in the field of image restoration. Conventional methods have primarily relied on local background information to restore detailed features, but their efficacy in dealing with large-scale degradation has been limited. Recently, Roman Suvorov et al. proposed a novel technique that leverages global information to tackle this problem. Building upon their work, we have employed this approach in the context of weather image restoration, enabling us to incorporate a wider range of background information and achieve effective restoration of images with large-scale degradation.





    
The illustration of FFC is available in Figure <ref>. The input feature map is split into two branches for parallel processing. The local branch performs a conventional convolution operation, while the global branch employs channel-wise fast Fourier transform (FFT) to capture the global context. The information from these two branches is then fused to generate a feature map with a receptive field that covers the entire image. This feature map is subsequently applied to the upsampling process, resulting in the restoration of a more realistic and detailed image. The steps of FFC are defined as follows:

a) applies Real FFT2d to an input tensor
  
    Real FFT2d: R^H ×  W ×  C→ C^H ×W/2×  C

and concatenates real and imaginary parts

    Complex To Real: C^H ×W/2×  C→ R^H ×W/2×  2C


b) applies a convolution block in the frequency domain
 
    Rule ∘ BN ∘ Conv 1× 1 : R^H ×W/2×  2C→ R^H ×W/2×  2C


c) applies inverse transform to recover a spatial structure
 
    Real To Complex : R^H ×W/2×  2C→ C^H ×W/2×  C
 
    
 
    Inverse Real FFT2d  : C^H ×W/2×  C→ R^H ×  W ×  C
 

Firstly, we apply the fast Fourier transform (FFT) to the input feature map. Next, we combine the real part and the imaginary part obtained from the FFT. Subsequently, we perform the convolution operation on the combined feature map, emphasizing the global background information. Finally, we separate the combined feature map into real and imaginary parts and restore the feature map to the time domain using the inverse Fourier transform.



 §.§ Adaptive Mixup For Feature Preserving

The proposed network incorporates an encoder-decoder architecture that can effectively extract low-level features from the input image and task-specific features from the degraded image. Adaptive upsampling is utilized to enable the effective mixing of task information and image features. Addition-based skip connections, which are commonly used in encoder-decoder models, may lead to loss of shallow features or external task information. To address this, the Adaptive Mixup approach is introduced, which is able to retain more texture information of the image by adaptively mixing the features from different levels of the network. The output of Adaptive Mxiup can be expressed as:
    
    f_↑ i+1 = Mix(f_↓ m-i, f_↑ i)=σ (θ _i)*f_↓ 
    i+(1-σ (θ_i) *f_↑ i)

Where f_↑ i and f_↓ m-i represent the upsampling and downsampling feature maps of the i-th stage(i⊆{1,2...m}), σ(θ_i) represents the learnable factor of the i-th stage, which is used to fuse the low-level features from the downsampling and the task features from the decoder, and Its value is determined by the sigmoid operator on the parameter θ_i.




§ RESULT

In this section, we conducted an extensive experimental analysis to validate the effectiveness of our proposed approach. Specifically, we provide detailed information regarding the dataset used, experimental design, and comparative analysis with state-of-the-art techniques. 













 §.§ Comparison with state-of-the-art

We compare our method against state-of-the-art modalities specifically designed for each task. We compare with state-of-the-art methods such as Attention Gan<cit.> and Swin-IR<cit.>. 
At the same time, we also compare with the state-of-the-art methods of multi-tasking such as All-in-one<cit.> and Transweather<cit.>. The detailed experimental results will be shown below.


 


  §.§.§ Visual Quality Comparison

We performed a qualitative comparison with All-in-One Network and TransWeather. The results are shown in Figures <ref>. Our proposed method exhibits superior performance in removing degradations, particularly in cases where there are large areas of degenerate features. In the first scenario of Figure <ref>, our ability to remove large raindrops is superior to the other two models. Furthermore, our approach outperforms other models in terms of restoring texture and color information in the image.  In the second scenario of the Figure<ref>, our model significantly outperforms the other two models in restoring the wall color. Both All-in one and TransWeather leave residual color changes caused by raindrops on the image.



  §.§.§ Referenced Quality Metrics

We use PSNR and SSIM to quantitatively evaluate the performance of different models in RainDrop test sets. The experimental results are shown in Tables <ref>. Our results demonstrate that our proposed method outperforms the multi-task single-job approach in the combination of three distinct weather types. Moreover, when compared to other multi-task models, our approach exhibits superior performance.





  §.§.§ Object Detection Comparison

Severe weather conditions significantly impact the field of autonomous driving, particularly in the context of object detection from acquired images. The ability to accurately detect objects in these images is crucial for analyzing the current driving situation and making appropriate judgments. In this chapter, we utilize the YOLOV5 algorithm to perform object detection on images repaired by each of the considered models.
Table<ref> presents the quantitative analysis outcomes of our object detection methodology on a dataset comprising 200 objects. In terms of detection accuracy, our approach surpasses the performance of the All-in-One<cit.> method. Furthermore, when compared to the TransWeather<cit.> technique, our detected objects exhibit a higher level of confidence.






§ CONCLUSION

In this paper, we present a novel model for addressing the challenges posed by multi-weather degraded images. Our proposed approach involves leveraging trainable sequences to extract multi-scale features, which are subsequently utilized to generate task sequences specific to degradation-related tasks. These task sequences serve as guidance for the network, enabling selective focus on degradation information from different tasks. To capture broader background information and facilitate the restoration of large degraded regions, we introduce a Fast Fourier Convolution (FFC) module. This module effectively captures global contextual information, aiding in the recovery process. Additionally, we employ adaptive mixing to fuse features obtained from different modules, enhancing the overall performance of our method. Our proposed approach overcomes the limitation of single-task-specific networks, which often struggle to be practically deployed. When compared to other multi-task processing networks, our method exhibits superior capabilities in extracting information on various weather degradations while effectively repairing extensive degraded content. To validate the effectiveness of our proposed method, we conducted extensive evaluations on diverse datasets. The experimental results demonstrate the superior performance of our approach, surpassing many state-of-the-art methods in the field.









splncs04



