Code Monkey home page Code Monkey logo

dsc's Introduction

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)},
     pages={7454--7462},
     year = {2018} }

@article{hu2019direction,
     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},
     year = {2019},
     note={to appear}
}

Results

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.

PyTorch Version

A PyTorch version is available at https://github.com/stevewongv/DSC-PyTorch implemented by Tianyu Wang.

Installation

  1. Please download and compile our CF-Caffe.

  2. 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
  3. Replace CF-Caffe/examples/ by DSC-master/examples/. Replace CF-Caffe/data/ by DSC-master/data/.

Test

Shadow Detection

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

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

  3. (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
  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 examples/DSC/ 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 CF-Caffe/models/

Shadow Detection

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

  2. Run

    sh train.sh

Shadow Removal

  1. Color compensation mechanism:
    Enter the /data/SRD/ or /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 /data/SRD/ or /data/ISTD/.
    Run ToLab.m and data_argument.m in Matlab.

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

  4. Run

    sh train.sh

dsc's People

Contributors

xw-hu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.