Code Monkey home page Code Monkey logo

deepguidedfilter's Introduction

Fast End-to-End Trainable Guided Filter

[Project] [Paper] [arXiv] [Demo] [Home]

Official implementation of Fast End-to-End Trainable Guided Filter.
Faster, Better and Lighter for image processing and dense prediction.

Overview

DeepGuidedFilter is the author's implementation of the deep learning building block for joint upsampling described in:

Fast End-to-End Trainable Guided Filter
Huikai Wu, Shuai Zheng, Junge Zhang, Kaiqi Huang
CVPR 2018

Given a reference image pair in high-resolution and low-resolution, our algorithm generates high-resolution target from the low-resolution input. Through joint training with CNNs, our algorithm achieves the state-of-the-art performance while runs 10-100 times faster.

Contact: Hui-Kai Wu ([email protected])

Try it on an image!

Prepare Environment

  1. Download source code from GitHub.
    git clone https://github.com/wuhuikai/DeepGuidedFilter
    
    cd DeepGuidedFilter && git checkout release
  2. Install dependencies (PyTorch version).
    conda install opencv
    conda install pytorch=0.2.0 cuda80 -c soumith
    
    pip install -r requirements.txt 
  3. (Optional) Install dependencies for MonoDepth (Tensorflow version).
    cd ComputerVision/MonoDepth
    
    pip install -r requirements.txt

Ready to GO !

Image Processing

cd ImageProcessing/DeepGuidedFilteringNetwork

python predict.py  --task auto_ps \
                   --img_path ../../images/auto_ps.jpg \
                   --save_folder . \
                   --model deep_guided_filter_advanced \
                   --low_size 64 \
                   --gpu 0

See Here or python predict.py -h for more details.

Semantic Segmentation with Deeplab-Resnet

  1. Enter the directory.
    cd ComputerVision/Deeplab-Resnet
  2. Download the pretrained model [Google Drive|BaiduYunPan].
  3. Run it now !
    python predict_dgf.py --img_path ../../images/segmentation.jpg --snapshots [MODEL_PATH]

Note:

  1. Result is in ../../images.
  2. Run python predict_dgf.py -h for more details.

Saliency Detection with DSS

  1. Enter the directory.
    cd ComputerVision/Saliency_DSS
  2. Download the pretrained model [Google Drive|BaiduYunPan].
  3. Try it now !
    python predict.py --im_path ../../images/saliency.jpg \
                      --netG [MODEL_PATH] \
                      --thres 161 \
                      --dgf --nn_dgf \
                      --post_sigmoid --cuda

Note:

  1. Result is in ../../images.
  2. See Here or python predict.py -h for more details.

Monocular Depth Estimation (TensorFlow version)

  1. Enter the directory.
    cd ComputerVision/MonoDepth
  2. Download and Unzip Pretrained Model [Google Drive|BaiduYunPan]
  3. Run on an Image !
    python monodepth_simple.py --image_path ../../images/depth.jpg --checkpoint_path [MODEL_PATH] --guided_filter

Note:

  1. Result is in ../../images.
  2. See Here or python monodepth_simple.py -h for more details.

Guided Filtering Layer

Install Released Version

  • PyTorch Version
    pip install guided-filter-pytorch
  • Tensorflow Version
    pip install guided-filter-tf

Usage

  • PyTorch Version
    from guided_filter_pytorch.guided_filter import FastGuidedFilter
    
    hr_y = FastGuidedFilter(r, eps)(lr_x, lr_y, hr_x)
    from guided_filter_pytorch.guided_filter import GuidedFilter
    
    hr_y = GuidedFilter(r, eps)(hr_x, init_hr_y)
  • Tensorflow Version
    from guided_filter_tf.guided_filter import fast_guided_filter
    
    hr_y = fast_guided_filter(lr_x, lr_y, hr_x, r, eps, nhwc)
    from guided_filter_tf.guided_filter import guided_filter
    
    hr_y = guided_filter(hr_x, init_hr_y, r, eps, nhwc)

Training from scratch

Prepare Training Environment

git checkout master

conda install opencv
conda install pytorch=0.2.0 cuda80 -c soumith
    
pip install -r requirements.txt

# (Optional) For MonoDepth (TF Version).
pip install -r ComputerVision/MonoDepth/requirements.txt 

Start to Train

Citation

@inproceedings{wu2017fast,
  title     = {Fast End-to-End Trainable Guided Filter},
  author    = {Wu, Huikai and Zheng, Shuai and Zhang, Junge and Huang, Kaiqi},
  booktitle = {CVPR},
  year = {2018}
}

deepguidedfilter's People

Contributors

wuhuikai avatar

Watchers

 avatar  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.