This repository contains TensorFlow code for the paper titled "RIS-GAN: Explore Residual and Illumination with Generative Adversarial Networks for Shadow Removal" pdf (http://www.chengjianglong.com/publications/RISGAN_AAAI.pdf).
##RIS-GAN Architecture
Attached below is the architecture diagram of RIS-GAN as given in the paper.

- The GAN component is dervied from paper "Single Image Haze Removal using a Generative Adversarial Network".
- This RIS-GAN can be used for any application, and is not limited to Shadow removal.
- TensorFlow (version 1.4+)
- Matplotlib
- Numpy
- Scikit-Image
-
We use the pretrained VGG-19 on the ImageNet dataset to calculate Perceptual loss. We used the weights provided by machrisaa's implementation. Download the weights from this link and include it in this repository.
-
Download the dataset.
- We used the ISTD dataset for training. The shadow images and corresponding shadow-free images will be placed in directories
AandBrespectively.
- In case you want to use your own dataset, follow these instructions. If not, skip this step.
- Create two directories
AandBin this repository. - Place the input images into directory
Aand target images into directoryB. - Ensure that an input and target image pair has the same name, otherwise the program will throw an error (For instance, if
1.jpgis present inAit must also be present inB).
- Train the model by using the following code.
python main.py --A_dir A --B_dir B --mode train
The file main.py supports a lot of parameters, which are given a default value. You can set a new value to suit your needs.
- Test by using the follwing code.
python main.py --A_dir shadow --B_dir result --mode inference
##Sample results
Attached below are some shadow removal results from the test set.

If you use the code in your own research, please cite:
@InProceedings{Zhang:AAA2020,
title = {RIS-GAN: Explore Residual and Illumination with Generative Adversarial Networks for Shadow Removal},
author = {Zhang, Ling and Long, Chengjiang and Zhang, Xiaolong and Xiao, Chunxia},
booktitle = {AAAI Conference on Artificial Intelligence (AAAI)},
year = {2020}
}
Depending on the setup you use, consider also citing paper "Single Image Haze Removal using a Generative Adversarial Network".