Single-Image-Reflection-Removal-Beyond-Linearity
Paper
Single Image Reflection Removal Beyond Linearity.
Qiang Wen, Yinjie Tan, Jing Qin, Wenxi Liu, Guoqiang Han, and Shengfeng He*
Requirement
- Python 3.5
- PIL
- OpenCV-Python
- Numpy
- Pytorch 0.4.0
- Ubuntu 16.04 LTS
Reflection Synthesis
cd ./Synthesis
-
Constrcut these new folders for training and testing
training set: trainA, trainB, trainC(contains real-world reflection images for adversarial loss.)
testing set: testA(contains the images to be used as reflection.), testB(contains the images to be used as transmission.)
-
To train the synthesis model:
python3 ./train.py --dataroot path_to_dir_for_reflection_synthesis/ --gpu_ids 0 --save_epoch_freq 1 --batchSize 10
or you can directly:
bash ./synthesis_train.sh
- To test the synthesis model:
python3 ./test.py --dataroot path_to_dir_for_synthesis/ --gpu_ids 0 --which_epoch 130 --how_many 1
or you can directly:
bash ./synthesis_test.sh
Here is the pre-trained model. And to generate the three types of reflection images, you can use these original images which are from perceptual-reflection-removal.
Due to the copyright, the real reflection images are not released here.
Reflection Removal
cd ./Removal
-
Constrcut these new folders for training and testing
training set: trainA(contains the reflection ground truth.), trainB(contains the transmission ground truth), trainC(contains the images which have the reflection to remove.), trainW(contains the alpha blending mask ground truth.)
testing set: testB(contains the transmission ground truth), testC(contains the images which have the reflection to remove.)
-
To train the removal model:
python3 ./train.py --dataroot path_to_dir_for_reflection_removal/ --gpu_ids 0 --save_epoch_freq 1 --batchSize 5 --which_type focused
or you can directly:
bash ./removal_train.sh
- To test the removal model:
python3 ./test.py --dataroot path_to_dir_for_reflection_removal/ --which_type focused --which_epoch 130 --how_many 1
or you can directly:
bash ./removal_test.sh
Here are the pre-trained models which are trained on the three types of synthetic dataset.
Here are the synthetic training set and testing set for reflection removal.
To evaluate on other datasets, please finetune the pre-trained models or re-train a new model on the specific training set.
Acknowledgments
Part of the code is based upon pytorch-CycleGAN-and-pix2pix.
Citation
@InProceedings{Wen_2019_CVPR,
author = {Wen, Qiang and Tan, Yinjie and Qin, Jing and Liu, Wenxi and Han, Guoqiang and He, Shengfeng},
title = {Single Image Reflection Removal Beyond Linearity},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}