wpfhtl / DSC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Direction-aware Spatial Context Features for Shadow Detection (and Removal)

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.


Citation

@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)},
     month = {June},
     year = {2018}
}

@article{hu2018direction,
     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={arXiv preprint arXiv:1805.04635},
     year = {2018}
}

Results

The results of shadow detection on SBU and UCF can be found at Google Drive.

Installation

  1. Clone the DSC repository, and we'll call the directory that you cloned DSC into DSC.

    git clone https://github.com/xw-hu/DSC.git
  2. Build DSC (based on Caffe)

    *This model is tested on Ubuntu 16.04, CUDA 8.0, cuDNN 5.0

    Follow the Caffe installation instructions here: http://caffe.berkeleyvision.org/installation.html

    make all -j XX
    make matcaffe
    make pycaffe

Test

Shadow Detection

  1. Please download our pretrained model at Google Drive.
    Put this model in DSC/examples/DSC_detection/snapshot/.

  2. (Matlab User) Enter the DSC/examples/ and run test_detection.m in Matlab.

  3. (Python User) Enter the DSC/examples/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
  4. 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.

Shadow Removal

Enter the DSC/examples/ and run test_removal.m in Matlab.

Train

Download the pre-trained VGG16 model at http://www.robots.ox.ac.uk/~vgg/research/very_deep/.
Put this model in DSC/models/

Shadow Detection

  1. Enter the DSC/examples/DSC_detection/
    Modify the image path in DSC.prototxt.

  2. Run

    sh train.sh

Shadow Removal

  1. Color compensation mechanism:
    Enter the DSC/data/SRD/ or DSC/data/ISTD/.
    Run color_transfer_function.m in Matlab.

  2. Transfer the images into the LAB color sapce and do the data argumentation:
    Enter the DSC/data/SRD/ or DSC/data/ISTD/.
    Run ToLab.m and data_argument.m in Matlab.

  3. Enter the DSC/examples/DSC_removal_SRD/ or DSC/examples/DSC_removal_ISTD/.
    Modify the image path in DSC.prototxt.

  4. Run

    sh train.sh

About

License:Apache License 2.0


Languages

Language:C++ 80.0%Language:Python 8.5%Language:Cuda 6.5%Language:CMake 2.6%Language:MATLAB 1.3%Language:Makefile 0.7%Language:Shell 0.4%Language:Dockerfile 0.1%