by Xiaowei Hu, Chi-Wing Fu, Lei Zhu, Jing Qin and Pheng-Ann Heng
This implementation is written by Xiaowei Hu at the Chinese University of Hong Kong.
A PyTorch version is available at https://github.com/stevewongv/DSC-PyTorch implemented by Tianyu Wang.
The shadow detection results on the SBU and UCF datasets can be found at Google Drive.
The shadow detection results on the new split of UCF (used by some works) can be found at Google Drive; BER: 10.38, accuracy: 0.95.
The shadow removal results on the SRD and ISTD datasets can be found at Google Drive.
@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},
volume={42},
number={11},
pages={2795--2808},
year = {2020}
}
-
Please download and compile our CF-Caffe.
-
Clone the DSC repository, and we'll call the directory that you cloned as
DSC-master
.git clone https://github.com/xw-hu/DSC.git
-
Replace
CF-Caffe/examples/
byDSC-master/examples/
. ReplaceCF-Caffe/data/
byDSC-master/data/
.
-
Please download our pretrained model at Google Drive.
Put this model inexamples/DSC/DSC_detection/snapshot/
. -
(Matlab User) Enter the
examples/DSC/
and runtest_detection.m
in Matlab. -
(Python User) Enter the
examples/DSC/DSC_detection/
and export PYTHONPATH in the command window such as:export PYTHONPATH='../../../python'
Run the test model and resize the results to the size of original images:
ipython notebook DSC_test.ipynb
-
Apply CRF to do the post-processing for each image.
The code for CRF can be found in https://github.com/Andrew-Qibin/dss_crf
*Note that please provide a link to the original code as a footnote or a citation if you plan to use it.
Enter the examples/DSC/
and run test_removal.m
in Matlab.
Download the pre-trained VGG16 model at https://www.robots.ox.ac.uk/~vgg/research/very_deep/.
Put this model in CF-Caffe/models/
-
Enter the
examples/DSC/DSC_detection/
Modify the image path inDSC.prototxt
. -
Run
sh train.sh
-
Color compensation mechanism:
Enter the/data/SRD/
or/data/ISTD/
.
Runcolor_transfer_function.m
in Matlab. -
Transfer the images into the
LAB
color sapce and do the data argumentation:
Enter the/data/SRD/
or/data/ISTD/
.
RunToLab.m
anddata_argument.m
in Matlab. -
Enter the
examples/DSC/DSC_removal_SRD/
orexamples/DSC/DSC_removal_ISTD/
.
Modify the image path inDSC.prototxt
. -
Run
sh train.sh