Giter VIP home page Giter VIP logo

torchepll's Introduction

EPLL PyTorch Implementation

This repository contains an implementation of EPLL and the implementation for the work Posterior Sampling for Image Restoration using Explicit Patch Priors in PyTorch.

Expected Patch Log-Likelihood

Expected Patch Log-Likelihood (EPLL) is a well established image decorruption algorithm. EPLL uses a patch-denoiser in order to restore full images, using the Half-Quadratic Splitting algorithm. The original paper uses a Gaussian mixture model (GMM) in order to denoise patches, but in principal any patch-denoiser can be used. This implementation allows for any patch denoiser to be used in order to restore images.

Denoising

denoise_demo.py shows how to denoise an image using the EPLL algorithm. Running it should produce the following images:

The first image is the noisy version and the second one is the denoised version, specifically under noise with $\sigma=35/255$. The patch-prior for these results is a GMM with 100 centers trained on ~5 million patches from the BSD300 train set.

This implementation follows the terminology of Posterior Sampling for Image Restoration using Explicit Patch Priors, which interprets the EPLL-loss as a loss of grids of the image. This allows for easily running faster versions of the same EPLL algorithm (using less grids), albeit at a slight cost of accuracy. For instance, the above images were produced using 16 grids, which takes ~5.2 seconds (with a GPU), while running on the same task with 4 grids takes ~1.3 seconds.

General Corruptions

EPLL is widely known not for denoising, but for general image restorations. This implementation allows for that as well!

deblur_demo.py shows how to deblur an image using this implementations and should produce the following images:

Crucially, this implementation uses automatic differentiation in order to decorrupt images. Any corruption process $H$ can be restored, as long as $H$ is passed as a differentiable function to the function EPLL.decorrupt.

Changing the Patch-Prior

While a GMM is commonly used for EPLL, essentially any other patch-prior can be used. Specifically, all that is needed is a class with a function denoise which receives batches of patches as well as the noise variance and returns the denoised patches.

torchepll's People

Contributors

friedmanroy avatar friedroy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

unkaktus

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.