Giter Club home page Giter Club logo

hdr-expandnet's Introduction

ExpandNet

Create HDR images from LDR inputs:

| (left) LDR input | (middle) Exposures taken from the predicted HDR | (right) Tone mapped HDR |


Training and inference code for:

ExpandNet: A Deep Convolutional Neural Network for High Dynamic Range Expansion from Low Dynamic Range Content

Demetris Marnerides, Thomas Bashford-Rogers, Jonathan Hatchett and Kurt Debattista

Paper was presented at Eurographics 2018 and published in Computer Graphics Forum.

(arxiv version)


Prerequisites

Requires the PyTorch library along with OpenCV. Python >= 3.6 supported only.

First follow the instructions for installing PyTorch.

To install OpenCV use:

conda install opencv3 -c menpo

NOTE There might be training issues when using latest versions of OpenCV for the tone mapping operators (issue #14)


Usage

The expand.py script accepts an LDR image as input, and creates an HDR Image prediction, (.hdr or .exr file if --use_exr flag is used).

python expand.py  ldr_input.jpg

Can also do batch processing:

python expand.py  *.jpg

Or take whole directory as input:

python expand.py  path/to/ldr_dir

To put results in a separate directory:

python expand.py  *.jpg --out results/

Results can be resized and filenames can be tagged:

python expand.py test.jpg --resize True --height 960 --width 540 --tag my-tag

If a GPU is available and Pytorch detects it then the conversion will happen on the GPU. To force CPU usage (slower) set --use_gpu False.

The network operates on patches to limit memory usage when expanding high resolution images. The flag --patch_size adjusts the size.

The resulting HDR Image can be tone mapped using the TMOs provided by OpenCV, or using the exposure operator.

python expand.py  test.jpg --tone_map reinhard

Testing on video

Use --video True (along with a tone mapper --tone_map) to test video conversion.

WARNING This is completely new and experimental. Very slow and memory consuming! Should only test short low-res clips. The model is not designed for videos thus flickering occurs which is reduced in the code by smoothing luminance percentile curves.

In the following example, on the left is the LDR video input and on the right is the (reinhard) tone mapped prediction.

Any tips to improve this are welcome!


Training

To train:

python train.py 

For more training configuration and settings please use:

python train.py --help

Viewing HDR Images

There is a very easy to use online viewer at openhdr.org which also has tone mapping functionality.


Contact: [email protected]

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.