- Create a virtual environment using
virtualenv
.virtualenv -p python3 venv
- Install the package. (The version may be various depends on your devices.)
source venv/bin/activate pip install -r requirements.txt
- Download datasets and sort by yourself like below structure.
. ├── datset │ ├── Rain100L │ │ ├── testing.txt │ │ ├── test │ │ │ ├── input │ │ │ ├── gt
- Generate txt files which list the paths of images that you want to deal with. See
dataset/Rain100L/testing.txt
as example.
This part is implemented by Matlab, which modify from the source code of TIP 2012.
- Make sure the requirement packages (such as SPAMS) is installed.
- Modfiy
file_path
andrain_component_path
inrain_mask/extract_mask.m
and run it. - Modfiy
src_dir
andbinary_mask_dir
inbinarization.py
and run the commandcd rain_mask python binarazation.py
- Additional Rain Pixel Sampling on RDP
cd ../ python additional_rain_pixel_sampling.py
Modify dataset_path
, save_path
, and target_path
in the stochastic_filling.py
and run the command.
python stochastic_filling.py
We have two method, SRL-Derain and SRL-Derain
python main_srl_derain.py
- pretrain the
$R_{net}$ $^+$ by the whole testing set.python pretrain_rnet_plus.py
- use the pretrained
$R_{net}$ $^+$ to guide the SRL-Derain$^+$ .python main_srl_derain_plus.py
In ablation study, we also provide the derained results by using multiple training strategy, where the agents are train on training set and inference on testing set.
Note that we use
python pretrain_rnet_plus.py --data_path './dataset/Rain100L/training.txt' --save_dir_path './Results/Rain100L/train/Rnet+/'
python main_multiple.py --mode 'train' --data_path './dataset/Rain100L/training.txt' --save_dir_path './Results/Rain100L/test/SRL-Derain+_multiple/'
python main_multiple.py --mode 'test' --data_path './dataset/Rain100L/testing.txt' --save_dir_path './Results/Rain100L/test/SRL-Derain+_multiple/derained_result/' --model_weight_path './Results/Rain100L/test/SRL-Derain+_multiple/model_weight/model.npz'
- We evaluate image deraineing results in MATLAB, please modify
path
,file_path
, andgt_path
to your path.
./Metrics/evaluate_PSNR_SSIM.m
python Metrics/comput_brisque.py