This is a PyTorch implementation of "Direction-Aware Spatial Context Features for Shadow Detection, CVPR'18" and "Direction-Aware Spatial Context Features for Shadow Detection and Removal, T-PAMI'19" based on Xiaowei's DSC (Caffe) written by Tianyu Wang.
The Spacial IRNN is implemented by using CUDA 11.x. The backbone is ResNeXt101 pre-trained on ImageNet and the implementation of loss is from Quanlong Zheng.
We use two GTX 1080Ti to train the DSC on SBU dataset.
Methods | BER | Accuracy |
---|---|---|
DSC (Caffe) | 5.59 | 0.97 |
DSC (Our) | 5.19 | 0.95 |
Pre-trained model is available. You can download from OneDrive and put it into SBU_model
folder.
- You can download the ResNeXt101 model from Google Drive and put it in main folder.
- PyTorch == 1.8.1 (training and testing)
- Cupy (Installation Guide)
- TensorBoardX
- Python
- progressbar2
- scikit-image
- pydensecrf
- Clone this repository
git clone https://github.com/stevewongv/DSC-PyTorch.git
- Train
python3 main.py -a train # For Shadow Detection
python3 main_sr.py -a train # For Shadow Removal
- Test
python3 main.py -a test # For Shadow Detection
python3 main_sr.py -a test # For Shadow Removal
@InProceedings{Hu_2018_CVPR,
author = {Hu, Xiaowei and Zhu, Lei and Fu, Chi-Wing and Qin, Jing and Heng, Pheng-Ann},
title = {Direction-Aware Spatial Context Features for Shadow Detection},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
pages={7454--7462},
year = {2018}
}
@article{hu2020direction,
author = {Hu, Xiaowei and Fu, Chi-Wing and Zhu, Lei and Qin, Jing and Heng, Pheng-Ann},
title = {Direction-Aware Spatial Context Features for Shadow Detection and Removal},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
pages={2795--2808},
year = {2020}
}
Modified DSC module is used in SPANet:
@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}
}
- ResNext101 Backbone
- Test on SBU Test Set
- VGG19 Backbone
- Test on ISTD Test Set
- Test on UCF Test Set
- ...