Spatial Attentive Single-Image Deraining with a High Quality Real Rain Dataset (CVPR'19)

Overview

Spatial Attentive Single-Image Deraining with a High Quality Real Rain Dataset (CVPR'19)

Tianyu Wang*, Xin Yang*, Ke Xu, Shaozhe Chen, Qiang Zhang, Rynson W.H. Lau † (* Joint first author. † Rynson Lau is the corresponding author.)

[Arxiv]

Abstract

Removing rain streaks from a single image has been drawing considerable attention as rain streaks can severely degrade the image quality and affect the performance of existing outdoor vision tasks. While recent CNN-based derainers have reported promising performances, deraining remains an open problem for two reasons. First, existing synthesized rain datasets have only limited realism, in terms of modeling real rain characteristics such as rain shape, direction and intensity. Second, there are no public benchmarks for quantitative comparisons on real rain images, which makes the current evaluation less objective. The core challenge is that real world rain/clean image pairs cannot be captured at the same time. In this paper, we address the single image rain removal problem in two ways. First, we propose a semi-automatic method that incorporates temporal priors and human supervision to generate a high-quality clean image from each input sequence of real rain images. Using this method, we construct a large-scale dataset of ∼29.5K rain/rain-free image pairs that cover a wide range of natural rain scenes. Second, to better cover the stochastic distributions of real rain streaks, we propose a novel SPatial Attentive Network (SPANet) to remove rain streaks in a local-to-global manner. Extensive experiments demonstrate that our network performs favorably against the state-of-the-art deraining methods.

Citation

If you use this code or our dataset(including test set), please cite:

@InProceedings{Wang_2019_CVPR,
  author = {Wang, Tianyu and Yang, Xin and Xu, Ke and Chen, Shaozhe and Zhang, Qiang and Lau, Rynson W.H.},
  title = {Spatial Attentive Single-Image Deraining with a High Quality Real Rain Dataset},
  booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  month = {June},
  year = {2019}
}

Dataset

See my personal site

UPDATE We release the code of clean image generation. We also provide some synthesize and real video examples for researchers to try. Note that we only implemented the code using 8 threads.

Requirements

  • PyTorch == 0.4.1 (1.0.x may not work for training)
  • cupy (Installation Guide)
  • opencv-python
  • TensorBoardX
  • Python3.6
  • progressbar2
  • scikit-image
  • ffmpeg >= 4.0.1
  • python-ffmpeg

Setup

  • Clone this repo:
$ git clone ...
$ cd SPANet

Train & Test

Train:

  • Download the dataset(~44GB) and unpack it into code folder (See details in Train_Dataset_README.md). Then, run:
$ python main.py -a train -m latest

Test:

  • Download the test dataset(~455MB) and unpack it into code folder (See details in Test_Dataset_README.md). Then, run:
$ python main.py -a test -m latest

Performance Change

PSNR 38.02 -> 38.53

SSIM 0.9868 -> 0.9875

For generalization, we here stop at 40K steps.

All PSNR and SSIM of results are computed by using skimage.measure. Please use this to evaluate your works.

License

Please see License.txt file.

Acknowledgement

Code borrows from RESCAN by Xia Li. The CUDA extension references pyinn by Sergey Zagoruyko and DSC(CF-Caffe) by Xiaowei Hu. Thanks for sharing!

Contact

E-Mail: [email protected]

Comments
  • Change the path and PSNR of the training and test datasets

    Change the path and PSNR of the training and test datasets

    Thank you for your contribution, I have finished reading your thesis, and now using your code, I find that I can't find in which .py file to change the path of the training dataset and test dataset, if you know please tell me. In addition, I found that the evaluation does not have a PSNR code. Could you post it? thank you.

    opened by FUNGERN 18
  • Training Problems

    Training Problems

    When I train your model with your training data set , I get this error: 2019-08-16 21:04:48,300 - INFO - set log dir as ./logdir 2019-08-16 21:04:48,300 - INFO - set model dir as ./model hhaha: <torch.utils.data.dataloader._DataLoaderIter object at 0x7f199e9516a0> Traceback (most recent call last): File "main.py", line 300, in run_train_val(args.model) File "main.py", line 228, in run_train_val batch_t = next(dt_train) File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 336, in next return self._process_next_batch(batch) File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch raise batch.exc_type(batch.exc_msg) AttributeError: Traceback (most recent call last): File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 106, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/ubuntu/ZY/SPANet-master/dataset.py", line 28, in getitem O = Image.fromarray(O) File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/PIL/Image.py", line 2642, in fromarray arr = obj.array_interface AttributeError: 'NoneType' object has no attribute 'array_interface'

    As a green hand, I did a lot of research, but all failed. Could you take a look at this problem for me? Thanks a lot!

    opened by Uparrow0 6
  • Error in beginning of the training

    Error in beginning of the training

    When I try to start training I have encountered this error:

    2020-08-19 10:18:42,483 - INFO - set log dir as ./logdir 2020-08-19 10:18:42,483 - INFO - set model dir as ./model 2020-08-19 10:18:55,600 - INFO - train_derain--l1_loss:0.01721 mask_loss:0.02403 ssim_loss:0.9961 all_loss:0.04513 lr:0.0005 step:4e+04 2020-08-19 10:18:57,353 - INFO - val_derain--l1_loss:0.01398 mask_loss:0.01736 ssim_loss:0.9957 all_loss:0.03568 lr:0.0005 step:4e+04 2020-08-19 10:18:58,377 - INFO - save image as step_40000 2020-08-19 10:18:58,413 - INFO - save model as step_40000 Exception ignored in: <bound method _DataLoaderIter.del of <torch.utils.data.dataloader._DataLoaderIter object at 0x7f9809fadfd0>> Traceback (most recent call last): File "/home/erdem/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 399, in del self._shutdown_workers() File "/home/erdem/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 378, in _shutdown_workers self.worker_result_queue.get() File "/usr/lib/python3.6/multiprocessing/queues.py", line 337, in get return _ForkingPickler.loads(res) File "/home/erdem/.local/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 151, in rebuild_storage_fd fd = df.detach() File "/usr/lib/python3.6/multiprocessing/resource_sharer.py", line 57, in detach with _resource_sharer.get_connection(self._id) as conn: File "/usr/lib/python3.6/multiprocessing/resource_sharer.py", line 87, in get_connection c = Client(address, authkey=process.current_process().authkey) File "/usr/lib/python3.6/multiprocessing/connection.py", line 493, in Client answer_challenge(c, authkey) File "/usr/lib/python3.6/multiprocessing/connection.py", line 737, in answer_challenge response = connection.recv_bytes(256) # reject large message File "/usr/lib/python3.6/multiprocessing/connection.py", line 216, in recv_bytes buf = self._recv_bytes(maxlength) File "/usr/lib/python3.6/multiprocessing/connection.py", line 407, in _recv_bytes buf = self._recv(4) File "/usr/lib/python3.6/multiprocessing/connection.py", line 379, in _recv chunk = read(handle, remaining) ConnectionResetError: [Errno 104] Connection reset by peer

    But when I try to train again in different times, sometimes it gave no error but sometimes gave different ConnectionResetError. I can't understand why it is happening. Since I am working with only one GPU I set my batch size and num_workers to 1. When I set batch size bigger than 1, it gave "CUDA error:out of memory". Is the error caused by my GPU? I hope you can help me, thank you.

    I am using python 3.6, pytorch0.4.1.

    opened by erdemarpaci 3
  • Train mode issue - latest pth error.

    Train mode issue - latest pth error.

    Can not use the 'latest' model for training or testing.

    When i try this code in terminal : python main.py -a test -m latest

    It will happen " state_dict missing key(s) " ERROR : RuntimeError: Error(s) in loading state_dict for SPANet: Missing key(s) in state_dict: "SAM1.irnn1.right_weight.weight", "SAM1.irnn1.right_weight.bias"...... (ignored error message) Unexpected key(s) in state_dict: "SAM1.irnn1.right_wight.weight", "SAM1.irnn1.right_wight.bias"...... (ignored error message)

    So i tried to fix some variables scope name errors in SPANet.py e.g. right_weight -> right_wight up_weight -> up_wight down_weight -> down_wight left_wight -> left_weight

    But, the (other) error happens again in the training phase (testing phase error fixed!): ValueError: loaded state dict contains a parameter group that doesn't match the size of optimizer's group

    I hope you can solve this problem as soon as possible! Thx!

    opened by bravotty 2
  • NameError: name 'obj' is not defined

    NameError: name 'obj' is not defined

    When I want to test your model with your test data set (Real_Internet, real_test_1000), I get this error: 2019-08-11 21:25:44,906 - INFO - set log dir as ./logdir 2019-08-11 21:25:44,906 - INFO - set model dir as ./model Traceback (most recent call last): File "main.py", line 297, in run_test(args.model) File "main.py", line 251, in run_test sess.load_checkpoints(ckp_name,'test') File "main.py", line 121, in load_checkpoints self.step = obj['clock'] NameError: name 'obj' is not defined

    Could you please tell me how can I solve this problem

    opened by Mazin-Hnewa 1
  • 模型加载

    模型加载

    作者您好,我在测试的时候模型加载没问题,但是当训练的时候加载报错,加载net没问题,加载优化函数Adam报错self.opt.load_state_dict(obj['opt']) ,报错,loaded state dict contains a parameter group that doesn't match the size of optimizer's group

    opened by jilner 1
  •  the structure of  Percentile filter

    the structure of Percentile filter

    Thanks for the great repo. The paper didn't tell the Percentile filter in detail,could you release the code of Percentile filter,or tell us the theory of Percentile filter. Thanks again.

    opened by jilner 1
  • About the implementation of SAM module

    About the implementation of SAM module

    Thank you for your wonderful work! I'm confused with the implementation of IRNN here. https://github.com/stevewongv/SPANet/blob/0fa01d44d4ef622743babf1eb7be3dc00ea676df/SPANet.py#L32 Why the IRNN implementation used CNN instead of RNN?

    opened by manmanCover 0
  • problem.

    problem.

    我的环境: pytorch==0.4.1 python==3.6.13 错误代码: def forward(self,input): return irnn()(input,self.up_weight.weight, self.right_weight.weight,self.down_weight.weight, self.left_weight.weight, self.up_weight.bias,self.right_weight.bias, self.down_weight.bias,self.left_weight.bias) 是不是这个版本不支持这么调用 我改成 o= irnn.forward(self,input,self.up_weight.weight, self.right_weight.weight,self.down_weight.weight, self.left_weight.weight, self.up_weight.bias,self.right_weight.bias, self.down_weight.bias,self.left_weight.bias AttributeError: 'Spacial_IRNN' object has no attribute 'save_for_backward'

    opened by szpxmu 0
Owner
Steve Wong
Discovering the world. CS Ph.D @ CUHK
Steve Wong
【CVPR 2021, Variational Inference Framework, PyTorch】 From Rain Generation to Rain Removal

From Rain Generation to Rain Removal (CVPR2021) Hong Wang, Zongsheng Yue, Qi Xie, Qian Zhao, Yefeng Zheng, and Deyu Meng [PDF&&Supplementary Material]

Hong Wang 48 Nov 23, 2022
Official repository for "Restormer: Efficient Transformer for High-Resolution Image Restoration". SOTA for motion deblurring, image deraining, denoising (Gaussian/real data), and defocus deblurring.

Restormer: Efficient Transformer for High-Resolution Image Restoration Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan,

Syed Waqas Zamir 906 Dec 30, 2022
Selective Wavelet Attention Learning for Single Image Deraining

SWAL Code for Paper "Selective Wavelet Attention Learning for Single Image Deraining" Prerequisites Python 3 PyTorch Models We provide the models trai

Bobo 9 Jun 17, 2022
RCDNet: A Model-driven Deep Neural Network for Single Image Rain Removal (CVPR2020)

RCDNet: A Model-driven Deep Neural Network for Single Image Rain Removal (CVPR2020) Hong Wang, Qi Xie, Qian Zhao, and Deyu Meng [PDF] [Supplementary M

Hong Wang 6 Sep 27, 2022
Two-Stream Adaptive Graph Convolutional Networks for Skeleton-Based Action Recognition in CVPR19

2s-AGCN Two-Stream Adaptive Graph Convolutional Networks for Skeleton-Based Action Recognition in CVPR19 Note PyTorch version should be 0.3! For PyTor

LShi 547 Dec 26, 2022
Flickr-Faces-HQ (FFHQ) is a high-quality image dataset of human faces, originally created as a benchmark for generative adversarial networks (GAN)

Flickr-Faces-HQ Dataset (FFHQ) Flickr-Faces-HQ (FFHQ) is a high-quality image dataset of human faces, originally created as a benchmark for generative

NVIDIA Research Projects 2.9k Dec 28, 2022
E2EC: An End-to-End Contour-based Method for High-Quality High-Speed Instance Segmentation

E2EC: An End-to-End Contour-based Method for High-Quality High-Speed Instance Segmentation E2EC: An End-to-End Contour-based Method for High-Quality H

zhangtao 146 Dec 29, 2022
Seeing Dynamic Scene in the Dark: High-Quality Video Dataset with Mechatronic Alignment (ICCV2021)

Seeing Dynamic Scene in the Dark: High-Quality Video Dataset with Mechatronic Alignment This is a pytorch project for the paper Seeing Dynamic Scene i

DV Lab 21 Nov 28, 2022
NUANCED is a user-centric conversational recommendation dataset that contains 5.1k annotated dialogues and 26k high-quality user turns.

NUANCED: Natural Utterance Annotation for Nuanced Conversation with Estimated Distributions Overview NUANCED is a user-centric conversational recommen

Facebook Research 18 Dec 28, 2021
Facestar dataset. High quality audio-visual recordings of human conversational speech.

Facestar Dataset Description Existing audio-visual datasets for human speech are either captured in a clean, controlled environment but contain only a

Meta Research 87 Dec 21, 2022
Self-Learned Video Rain Streak Removal: When Cyclic Consistency Meets Temporal Correspondence

In this paper, we address the problem of rain streaks removal in video by developing a self-learned rain streak removal method, which does not require any clean groundtruth images in the training process.

Yang Wenhan 44 Dec 6, 2022
Point Cloud Denoising input segmentation output raw point-cloud valid/clear fog rain de-noised Abstract Lidar sensors are frequently used in environme

Point Cloud Denoising input segmentation output raw point-cloud valid/clear fog rain de-noised Abstract Lidar sensors are frequently used in environme

null 75 Nov 24, 2022
Pythonic particle-based (super-droplet) warm-rain/aqueous-chemistry cloud microphysics package with box, parcel & 1D/2D prescribed-flow examples in Python, Julia and Matlab

PySDM PySDM is a package for simulating the dynamics of population of particles. It is intended to serve as a building block for simulation systems mo

Atmospheric Cloud Simulation Group @ Jagiellonian University 32 Oct 18, 2022
Dynamic Attentive Graph Learning for Image Restoration, ICCV2021 [PyTorch Code]

Dynamic Attentive Graph Learning for Image Restoration This repository is for GATIR introduced in the following paper: Chong Mou, Jian Zhang, Zhuoyuan

Jian Zhang 84 Dec 9, 2022
EMNLP 2021: Single-dataset Experts for Multi-dataset Question-Answering

MADE (Multi-Adapter Dataset Experts) This repository contains the implementation of MADE (Multi-adapter dataset experts), which is described in the pa

Princeton Natural Language Processing 68 Jul 18, 2022
EMNLP 2021: Single-dataset Experts for Multi-dataset Question-Answering

MADE (Multi-Adapter Dataset Experts) This repository contains the implementation of MADE (Multi-adapter dataset experts), which is described in the pa

Princeton Natural Language Processing 39 Oct 5, 2021
Unofficial implementation of "TTNet: Real-time temporal and spatial video analysis of table tennis" (CVPR 2020)

TTNet-Pytorch The implementation for the paper "TTNet: Real-time temporal and spatial video analysis of table tennis" An introduction of the project c

Nguyen Mau Dung 438 Dec 29, 2022
Maximum Spatial Perturbation for Image-to-Image Translation (Official Implementation)

MSPC for I2I This repository is by Yanwu Xu and contains the PyTorch source code to reproduce the experiments in our CVPR2022 paper Maximum Spatial Pe

null 51 Dec 14, 2022