Giter VIP home page Giter VIP logo

fast_gaussian_filter's Introduction

Chainer Implementation of Fast Gaussian Filter

This is an unofficial code for the paper Fast High-Dimensional Filtering Using the Permutohedral Lattice [Adams+ Eurographics 2010].

This GPU implementation (94 ± 1 ms on GTX 970) is faster than the authors' CPU implementation (827 ± 4 ms on Core i5-2400) on the reference image.

This code supports derivative of the output image with respect to the input image for neural networks.

Installation

sudo python setup.py install

Example

# parameters for bilateral filtering
std_spatial = 5
std_color = 0.125

# read image
image_in = scipy.misc.imread('./ref/in.jpg').astype('float32') / 255.

# create features for filtering
y, x = np.meshgrid(np.arange(image_in.shape[0]), np.arange(image_in.shape[1]), indexing='ij')
points = np.concatenate((x[:, :, None], y[:, :, None], image_in), axis=-1)
points[:, :, :2] /= std_spatial
points[:, :, 2:] /= std_color

# for fast_gaussian_filter
points = points.reshape((1, -1, 5)) # [batch size, number of pixels, dim of points]
features = image_in.reshape((1, -1, 3)) # [batch size, number of pixels, dim of image]
points = chainer.cuda.to_gpu(points).astype('float32')
features = chainer.cuda.to_gpu(features).astype('float32')

# filter
image_out = fast_gaussian_filter.fast_gaussian_filter(features, points=points)

From left-to-right: input image, output image by our code, output image by the authors' code. Mean squared error is 1.412e-10.

fast_gaussian_filter's People

Contributors

hiroharu-kato avatar

Stargazers

 avatar  avatar Karll Henning avatar Marc Finzi avatar  avatar  avatar Peterou avatar Vittorio La Barbera avatar Kenjiro Sugimoto avatar JanySunny avatar  avatar  avatar

fast_gaussian_filter's Issues

FATAL ISSUE

There is a serious bug in mutex-like processing, and the code does not work well.

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.